OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ | |
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/scoped_ptr.h" | |
xhwang
2012/10/18 16:30:25
why scoped_ptr here?
Tom Finegan
2012/10/18 19:29:41
Forgot to remove it, thanks.
| |
11 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | |
12 | |
13 struct AVCodecContext; | |
14 struct AVFrame; | |
15 | |
16 namespace webkit_media { | |
17 | |
18 class FFmpegCdmVideoDecoder { | |
19 public: | |
20 FFmpegCdmVideoDecoder(cdm::Allocator* allocator); | |
21 ~FFmpegCdmVideoDecoder(); | |
22 bool Initialize(const cdm::VideoDecoderConfig& config); | |
23 void Deinitialize(); | |
24 void Reset(); | |
25 | |
26 // Returns true when |format| and |data_size| specify a supported video | |
27 // output configuration. | |
28 static bool IsValidOutputConfig(cdm::VideoFormat format, | |
xhwang
2012/10/18 16:30:25
const-ref for format?
Tom Finegan
2012/10/18 19:29:41
It's just an enum?
xhwang
2012/10/18 19:35:16
nm then.
| |
29 const cdm::Size& data_size); | |
30 | |
31 // Decodes |compressed_frame|. Stores output frame in |decoded_frame| and | |
32 // returns |cdm::kSuccess| when an output frame is available. Returns | |
33 // |cdm::kNeedMoreData| when |compressed_frame| does not produce an output | |
34 // frame. Returns |cdm::kDecodeError| when decoding fails. | |
35 cdm::Status DecodeFrame(const uint8_t* compressed_frame, | |
36 int32_t compressed_frame_size, | |
37 int64_t timestamp, | |
38 cdm::VideoFrame* decoded_frame); | |
39 | |
40 private: | |
41 // Allocates storage, then copies video frame stored in |av_frame_| to | |
42 // |cdm_video_frame|. Returns true when allocation and copy succeed. | |
43 bool CopyAvFrameTo(cdm::VideoFrame* cdm_video_frame); | |
44 | |
45 void ReleaseFFmpegResources(); | |
46 | |
47 // FFmpeg structures owned by this object. | |
48 AVCodecContext* codec_context_; | |
49 AVFrame* av_frame_; | |
50 | |
51 bool is_initialized_; | |
52 | |
53 cdm::Allocator* const allocator_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder); | |
56 }; | |
57 | |
58 } // namespace webkit_media | |
59 | |
60 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ | |
OLD | NEW |