Chromium Code Reviews| Index: webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
| diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4044e42c9ad0859e76c5154c66b8b606fa5d0379 |
| --- /dev/null |
| +++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_video_decoder.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
| +#define WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/ref_counted.h" |
|
ddorwin
2012/10/16 18:04:30
What is ref counted?
Tom Finegan
2012/10/16 21:44:44
Removed, vestige of media/filters/ffmpeg_video_dec
|
| +#include "webkit/media/crypto/ppapi/content_decryption_module.h" |
| + |
| +struct AVCodecContext; |
| +struct AVFrame; |
| + |
| +namespace webkit_media { |
| + |
| +static const uint32_t kBufferAlignment = 32; |
| +static const uint32_t kBufferPadBytes = kBufferAlignment - 1; |
| +static const int kDecodeThreads = 1; |
| + |
| +bool IsValidConfig(cdm::VideoFormat format, const cdm::Size& data_size); |
|
ddorwin
2012/10/16 18:04:30
Should this all be in the cdm namespace? It's only
Tom Finegan
2012/10/16 21:44:44
This should not have been here. Made it a static m
|
| + |
| +class FFmpegCdmVideoDecoder { |
| + public: |
| + FFmpegCdmVideoDecoder(cdm::Allocator* allocator); |
| + ~FFmpegCdmVideoDecoder(); |
| + bool Initialize(const cdm::VideoDecoderConfig& config); |
| + void Deinitialize(); |
| + void Reset(); |
| + |
| + // Decodes |compressed_frame|, and stores decoded frame in |decoded_frame| |
| + // when an output frame is available. Returns true when when successful. |
|
ddorwin
2012/10/16 18:04:30
"Returns whether the call was successful."
Then y
Tom Finegan
2012/10/16 21:44:44
Done.
|
| + // Note: This method can return true with a null |decoded_frame|. This occurs |
| + // when the decoder needs more data to produce an output video frame. Returns |
| + // false upon failure. |
|
xhwang
2012/10/16 21:59:53
During EOS, we'll call DecodeFrame with NULL input
Tom Finegan
2012/10/17 02:39:10
Method returns cdm::Status now, as it should have
|
| + bool DecodeFrame(const uint8_t* compressed_frame, |
| + int32_t compressed_frame_size, |
| + int64_t timestamp, |
| + cdm::VideoFrame* decoded_frame); |
| + |
| + // Callback called from within FFmpeg to allocate a buffer based on |
| + // the dimensions of |codec_context|. See AVCodecContext.get_buffer |
| + // documentation inside FFmpeg. |
| + int GetVideoBuffer(AVCodecContext* codec_context, AVFrame* frame); |
|
ddorwin
2012/10/16 18:04:30
Can this be private? It's provided to FFmpeg as a
Tom Finegan
2012/10/16 21:44:44
This is what GetCdmVideoBufferImpl() calls, and th
ddorwin
2012/10/17 03:18:20
Go back. This causes you to friend and non-static
Tom Finegan
2012/10/17 04:25:29
Done.
|
| + |
| + private: |
| + void ReleaseFFmpegResources(); |
| + |
| + // FFmpeg structures owned by this object. |
|
ddorwin
2012/10/16 18:04:30
Can we use scoped_ptr since these are owned? Or is
Tom Finegan
2012/10/16 21:44:44
Discussed offline. Not really too much base, more
xhwang
2012/10/17 18:43:00
I miss boost::shared_ptr where you can specify del
|
| + AVCodecContext* codec_context_; |
| + AVFrame* av_frame_; |
| + |
| + cdm::Allocator* const allocator_; |
| + cdm::VideoDecoderConfig config_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FFmpegCdmVideoDecoder); |
| +}; |
| + |
| +} // namespace webkit_media |
| + |
| +#endif // WEBKIT_MEDIA_CRYPTO_PPAPI_FFMPEG_CDM_VIDEO_DECODER_H_ |