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" |
| 11 #include "base/memory/weak_ptr.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "media/base/video_decoder.h" | 13 #include "media/base/video_decoder.h" |
13 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
14 #include "media/base/video_frame_pool.h" | 15 #include "media/base/video_frame_pool.h" |
15 #include "media/ffmpeg/ffmpeg_deleters.h" | 16 #include "media/ffmpeg/ffmpeg_deleters.h" |
16 | 17 |
17 struct AVCodecContext; | 18 struct AVCodecContext; |
18 struct AVFrame; | 19 struct AVFrame; |
19 | 20 |
20 namespace base { | 21 namespace base { |
(...skipping 16 matching lines...) Expand all Loading... |
37 | 38 |
38 // VideoDecoder implementation. | 39 // VideoDecoder implementation. |
39 virtual void Initialize(const VideoDecoderConfig& config, | 40 virtual void Initialize(const VideoDecoderConfig& config, |
40 bool low_delay, | 41 bool low_delay, |
41 const PipelineStatusCB& status_cb, | 42 const PipelineStatusCB& status_cb, |
42 const OutputCB& output_cb) OVERRIDE; | 43 const OutputCB& output_cb) OVERRIDE; |
43 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, | 44 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, |
44 const DecodeCB& decode_cb) OVERRIDE; | 45 const DecodeCB& decode_cb) OVERRIDE; |
45 virtual void Reset(const base::Closure& closure) OVERRIDE; | 46 virtual void Reset(const base::Closure& closure) OVERRIDE; |
46 | 47 |
| 48 void DecodeInternal(const scoped_refptr<DecoderBuffer>& buffer, |
| 49 const DecodeCB& decode_cb); |
| 50 |
47 // Callback called from within FFmpeg to allocate a buffer based on | 51 // Callback called from within FFmpeg to allocate a buffer based on |
48 // the dimensions of |codec_context|. See AVCodecContext.get_buffer2 | 52 // the dimensions of |codec_context|. See AVCodecContext.get_buffer2 |
49 // documentation inside FFmpeg. | 53 // documentation inside FFmpeg. |
50 int GetVideoBuffer(struct AVCodecContext* codec_context, | 54 int GetVideoBuffer(struct AVCodecContext* codec_context, |
51 AVFrame* frame, | 55 AVFrame* frame, |
52 int flags); | 56 int flags); |
53 | 57 |
54 private: | 58 private: |
55 enum DecoderState { | 59 enum DecoderState { |
56 kUninitialized, | 60 kUninitialized, |
(...skipping 23 matching lines...) Expand all Loading... |
80 // FFmpeg structures owned by this object. | 84 // FFmpeg structures owned by this object. |
81 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; | 85 scoped_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; |
82 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; | 86 scoped_ptr<AVFrame, ScopedPtrAVFreeFrame> av_frame_; |
83 | 87 |
84 VideoDecoderConfig config_; | 88 VideoDecoderConfig config_; |
85 | 89 |
86 VideoFramePool frame_pool_; | 90 VideoFramePool frame_pool_; |
87 | 91 |
88 bool decode_nalus_; | 92 bool decode_nalus_; |
89 | 93 |
| 94 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_; |
| 95 |
90 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 96 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
91 }; | 97 }; |
92 | 98 |
93 } // namespace media | 99 } // namespace media |
94 | 100 |
95 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 101 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |