Index: media/filters/libvpx_video_decoder.h |
diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/libvpx_video_decoder.h |
similarity index 53% |
copy from media/filters/ffmpeg_video_decoder.h |
copy to media/filters/libvpx_video_decoder.h |
index e18f88b4f2bf416537e0bbfd6f67a940f3502694..0c3ee03e3c5da6190c4a54808bc6ec58325fe28e 100644 |
--- a/media/filters/ffmpeg_video_decoder.h |
+++ b/media/filters/libvpx_video_decoder.h |
@@ -2,17 +2,16 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
-#define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
+#ifndef MEDIA_FILTERS_LIBVPX_VIDEO_DECODER_H_ |
+#define MEDIA_FILTERS_LIBVPX_VIDEO_DECODER_H_ |
#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
-#include "media/base/decryptor.h" |
#include "media/base/demuxer_stream.h" |
#include "media/base/video_decoder.h" |
-struct AVCodecContext; |
-struct AVFrame; |
+struct vpx_codec_ctx; |
+struct vpx_image; |
namespace base { |
class MessageLoopProxy; |
@@ -20,12 +19,23 @@ class MessageLoopProxy; |
namespace media { |
-class DecoderBuffer; |
- |
-class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
+class MEDIA_EXPORT LibvpxVideoDecoder : public VideoDecoder { |
public: |
- FFmpegVideoDecoder(const scoped_refptr<base::MessageLoopProxy>& message_loop, |
- Decryptor* decryptor); |
+ // Callback to notify decryptor creation. |
+ //typedef base::Callback<void(Decryptor*)> DecryptorNotificationCB; |
+ |
+ // Callback to request/cancel decryptor creation notification. |
+ // Calling this callback with a non-null callback registers decryptor creation |
+ // notification. When the decryptor is created, notification will be sent |
+ // through the provided callback. |
+ // Calling this callback with a null callback cancels previously registered |
+ // decryptor creation notification. Any previously provided callback will be |
+ // fired immediately with NULL. |
+ //typedef base::Callback<void(const DecryptorNotificationCB&)> |
+ // RequestDecryptorNotificationCB; |
xhwang
2012/12/10 01:41:11
you don't need these if this class doesn't use a D
Tom Finegan
2012/12/13 09:57:26
Done.
|
+ |
+ LibvpxVideoDecoder( |
+ const scoped_refptr<base::MessageLoopProxy>& message_loop); |
// VideoDecoder implementation. |
virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
@@ -35,13 +45,8 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
virtual void Reset(const base::Closure& closure) OVERRIDE; |
virtual void Stop(const base::Closure& closure) OVERRIDE; |
- // 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); |
- |
protected: |
- virtual ~FFmpegVideoDecoder(); |
+ virtual ~LibvpxVideoDecoder(); |
private: |
enum DecoderState { |
@@ -51,10 +56,15 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
kDecodeFinished |
}; |
- // Carries out the reading operation scheduled by Read(). |
+ // Handles (re-)initializing the decoder with a (new) config. |
+ // Returns true when initialization was successful. |
+ bool ConfigureDecoder(); |
+ |
+ void CloseDecoder(); |
+ |
+ // Carries out the buffer reading operation scheduled by Read(). |
void DoRead(const ReadCB& read_cb); |
- // Reads from the demuxer stream. |
void ReadFromDemuxerStream(); |
// Carries out the buffer processing operation scheduled by |
@@ -62,52 +72,36 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
void DoDecryptOrDecodeBuffer(DemuxerStream::Status status, |
const scoped_refptr<DecoderBuffer>& buffer); |
- // Callback called by the decryptor to deliver decrypted data buffer and |
- // reporting decrypt status. This callback could be called synchronously or |
- // asynchronously. |
- void BufferDecrypted(Decryptor::Status decrypt_status, |
- const scoped_refptr<DecoderBuffer>& buffer); |
- |
- // Carries out the operation scheduled by BufferDecrypted(). |
- void DoBufferDecrypted(Decryptor::Status decrypt_status, |
- const scoped_refptr<DecoderBuffer>& buffer); |
- |
void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); |
bool Decode(const scoped_refptr<DecoderBuffer>& buffer, |
scoped_refptr<VideoFrame>* video_frame); |
- // Handles (re-)initializing the decoder with a (new) config. |
- // Returns true if initialization was successful. |
- bool ConfigureDecoder(); |
- |
- // Releases resources associated with |codec_context_| and |av_frame_| |
- // and resets them to NULL. |
- void ReleaseFFmpegResources(); |
- |
// Reset decoder and call |reset_cb_|. |
void DoReset(); |
+ bool CopyVpxImageTo(const vpx_image* vpx_image, |
+ scoped_refptr<VideoFrame>* video_frame); |
+ |
scoped_refptr<base::MessageLoopProxy> message_loop_; |
DecoderState state_; |
+ //PipelineStatusCB init_cb_; |
xhwang
2012/12/10 01:41:11
do you need this?
Tom Finegan
2012/12/13 09:57:26
Done.
|
StatisticsCB statistics_cb_; |
- |
ReadCB read_cb_; |
base::Closure reset_cb_; |
- // FFmpeg structures owned by this object. |
- AVCodecContext* codec_context_; |
- AVFrame* av_frame_; |
+ int64 frame_num_; |
+ scoped_refptr<VideoFrame> video_frame_; |
// Pointer to the demuxer stream that will feed us compressed buffers. |
scoped_refptr<DemuxerStream> demuxer_stream_; |
- Decryptor* decryptor_; |
+ vpx_codec_ctx* vpx_codec_; |
- DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
+ DISALLOW_COPY_AND_ASSIGN(LibvpxVideoDecoder); |
}; |
} // namespace media |
-#endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
+#endif // MEDIA_FILTERS_LIBVPX_VIDEO_DECODER_H_ |