Chromium Code Reviews| 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_VIDEO_DECODER_H_ | |
| 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_VIDEO_DECODER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "webkit/media/crypto/ppapi/content_decryption_module.h" | |
| 12 | |
| 13 struct AVCodecContext; | |
| 14 struct AVFrame; | |
| 15 | |
| 16 namespace webkit_media { | |
| 17 | |
| 18 static const uint32_t kBufferAlignment = 32; | |
|
ddorwin
2012/10/13 03:54:42
media/base has constants for these.
Tom Finegan
2012/10/13 23:47:26
The only ones I can find are in .cc files. Should
| |
| 19 static const uint32_t kBufferPadBytes = kBufferAlignment - 1; | |
| 20 static const int kDecodeThreads = 2; | |
| 21 | |
| 22 bool IsValidConfig(cdm::VideoFormat format, const cdm::Size& data_size); | |
| 23 | |
| 24 class FFmpegVideoDecoder { | |
|
ddorwin
2012/10/13 03:54:42
I worry about having identically named classes and
Tom Finegan
2012/10/13 23:47:26
Yeah, I use cs.chromium.org a lot... I can see tha
| |
| 25 public: | |
| 26 FFmpegVideoDecoder(cdm::Allocator* allocator); | |
| 27 ~FFmpegVideoDecoder(); | |
| 28 bool Initialize(const cdm::VideoDecoderConfig& config); | |
| 29 void Deinitialize(); | |
| 30 void Reset(); | |
| 31 | |
| 32 | |
|
ddorwin
2012/10/13 03:54:42
remove line
Tom Finegan
2012/10/13 23:47:26
Done.
| |
| 33 // Decodes |compressed_frame|, and stores decompressed frame in | |
| 34 //|decompressed_frame| when an output frame is available. Returns true when | |
|
ddorwin
2012/10/13 03:54:42
param name does not match
Tom Finegan
2012/10/13 23:47:26
Done.
| |
| 35 // when successful. | |
| 36 // Note: This method can return true without providing an output frame. This | |
|
ddorwin
2012/10/13 03:54:42
with a null |decoded_frame|.
Tom Finegan
2012/10/13 23:47:26
Done.
| |
| 37 // occurs when the decoder needs more data to produce an output video frame. | |
| 38 // Returns false upon failure. | |
| 39 bool DecodeFrame(const uint8_t* compressed_frame, | |
| 40 int32_t frame_length, | |
|
ddorwin
2012/10/13 03:54:42
compressed_frame_size?
Tom Finegan
2012/10/13 23:47:26
Done.
| |
| 41 int64_t timestamp, | |
| 42 cdm::VideoFrame* decoded_frame); | |
|
ddorwin
2012/10/13 03:54:42
I think this CL shows we have a fundamental proble
Tom Finegan
2012/10/13 23:47:26
The video frame memory is allocated using the allo
Tom Finegan
2012/10/14 00:41:11
Actually, thinking about this some more, maybe thi
| |
| 43 | |
| 44 // Callback called from within FFmpeg to allocate a buffer based on | |
| 45 // the dimensions of |codec_context|. See AVCodecContext.get_buffer | |
| 46 // documentation inside FFmpeg. | |
| 47 int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame); | |
|
ddorwin
2012/10/13 03:54:42
*<space>
Tom Finegan
2012/10/13 23:47:26
Done.
| |
| 48 | |
| 49 private: | |
| 50 void ReleaseFFmpegResources(); | |
| 51 | |
| 52 // FFmpeg structures owned by this object. | |
| 53 AVCodecContext* codec_context_; | |
| 54 AVFrame* av_frame_; | |
| 55 | |
| 56 cdm::Allocator* const allocator_; | |
| 57 cdm::VideoDecoderConfig config_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | |
| 60 }; | |
| 61 | |
| 62 } // namespace webkit_media | |
| 63 | |
| 64 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_VIDEO_DECODER_H_ | |
| OLD | NEW |