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 "webkit/media/crypto/ppapi/content_decryption_module.h" | |
11 | |
12 struct AVCodecContext; | |
13 struct AVFrame; | |
14 | |
15 namespace webkit_media { | |
16 | |
17 static const uint32_t kBufferAlignment = 32; | |
xhwang
2012/10/17 18:43:00
Move this to ffmpeg_cdm_video_frame.cc ?
Tom Finegan
2012/10/17 19:55:44
Done.
| |
18 static const uint32_t kBufferPadBytes = kBufferAlignment - 1; | |
xhwang
2012/10/17 18:43:00
Where is this used?
Tom Finegan
2012/10/17 19:55:44
From media, done.
| |
19 static const int kDecodeThreads = 1; | |
xhwang
2012/10/17 18:43:00
move this to ffmpeg_cdm_video_decoder.cc file?
Tom Finegan
2012/10/17 19:55:44
Done.
Tom Finegan
2012/10/17 19:55:44
Done.
| |
20 | |
21 class FFmpegCdmVideoDecoder { | |
22 public: | |
23 FFmpegCdmVideoDecoder(cdm::Allocator* allocator); | |
24 ~FFmpegCdmVideoDecoder(); | |
25 bool Initialize(const cdm::VideoDecoderConfig& config); | |
26 void Deinitialize(); | |
27 void Reset(); | |
28 | |
29 // Decodes |compressed_frame|. Stores output frame in |decoded_frame| and | |
30 // returns |cdm::kSuccess| when an output frame is available. Returns | |
31 // |cdm::kNeedMoreData| when |compressed_frame| does not produce an output | |
32 // frame. Returns |cdm::kDecodeError| when decoding fails. | |
33 cdm::Status DecodeFrame(const uint8_t* compressed_frame, | |
34 int32_t compressed_frame_size, | |
35 int64_t timestamp, | |
36 cdm::VideoFrame* decoded_frame); | |
37 | |
38 // Callback called from within FFmpeg to allocate a buffer based on | |
39 // the dimensions of |codec_context|. See AVCodecContext.get_buffer | |
40 // documentation inside FFmpeg. | |
41 int GetVideoBuffer(AVCodecContext* codec_context, AVFrame* frame); | |
42 | |
43 private: | |
44 void ReleaseFFmpegResources(); | |
45 | |
46 // FFmpeg structures owned by this object. | |
47 AVCodecContext* codec_context_; | |
48 AVFrame* av_frame_; | |
49 | |
50 bool is_initialized_; | |
51 | |
52 cdm::Allocator* const allocator_; | |
53 cdm::VideoDecoderConfig config_; | |
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 |