OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { | 26 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
27 public: | 27 public: |
28 explicit FFmpegVideoDecoder( | 28 explicit FFmpegVideoDecoder( |
29 const scoped_refptr<base::MessageLoopProxy>& message_loop); | 29 const scoped_refptr<base::MessageLoopProxy>& message_loop); |
30 virtual ~FFmpegVideoDecoder(); | 30 virtual ~FFmpegVideoDecoder(); |
31 | 31 |
32 // VideoDecoder implementation. | 32 // VideoDecoder implementation. |
33 virtual void Initialize(const VideoDecoderConfig& config, | 33 virtual void Initialize(const VideoDecoderConfig& config, |
34 const PipelineStatusCB& status_cb) OVERRIDE; | 34 const PipelineStatusCB& status_cb) OVERRIDE; |
35 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 35 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
36 const ReadCB& read_cb) OVERRIDE; | 36 const DecodeCB& decode_cb) OVERRIDE; |
37 virtual void Reset(const base::Closure& closure) OVERRIDE; | 37 virtual void Reset(const base::Closure& closure) OVERRIDE; |
38 virtual void Stop(const base::Closure& closure) OVERRIDE; | 38 virtual void Stop(const base::Closure& closure) OVERRIDE; |
39 | 39 |
40 // Callback called from within FFmpeg to allocate a buffer based on | 40 // Callback called from within FFmpeg to allocate a buffer based on |
41 // the dimensions of |codec_context|. See AVCodecContext.get_buffer | 41 // the dimensions of |codec_context|. See AVCodecContext.get_buffer |
42 // documentation inside FFmpeg. | 42 // documentation inside FFmpeg. |
43 int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame); | 43 int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame); |
44 | 44 |
45 private: | 45 private: |
46 enum DecoderState { | 46 enum DecoderState { |
(...skipping 19 matching lines...) Expand all Loading... |
66 | 66 |
67 // Reset decoder and call |reset_cb_|. | 67 // Reset decoder and call |reset_cb_|. |
68 void DoReset(); | 68 void DoReset(); |
69 | 69 |
70 scoped_refptr<base::MessageLoopProxy> message_loop_; | 70 scoped_refptr<base::MessageLoopProxy> message_loop_; |
71 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_; | 71 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_; |
72 base::WeakPtr<FFmpegVideoDecoder> weak_this_; | 72 base::WeakPtr<FFmpegVideoDecoder> weak_this_; |
73 | 73 |
74 DecoderState state_; | 74 DecoderState state_; |
75 | 75 |
76 ReadCB read_cb_; | 76 DecodeCB decode_cb_; |
77 base::Closure reset_cb_; | 77 base::Closure reset_cb_; |
78 | 78 |
79 // FFmpeg structures owned by this object. | 79 // FFmpeg structures owned by this object. |
80 AVCodecContext* codec_context_; | 80 AVCodecContext* codec_context_; |
81 AVFrame* av_frame_; | 81 AVFrame* av_frame_; |
82 | 82 |
83 VideoDecoderConfig config_; | 83 VideoDecoderConfig config_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 85 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace media | 88 } // namespace media |
89 | 89 |
90 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 90 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |