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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "media/base/video_decoder.h" | 12 #include "media/base/video_decoder.h" |
13 #include "media/crypto/aes_decryptor.h" | 13 #include "media/crypto/decryptor.h" |
14 | 14 |
15 class DecoderBuffer; | 15 class DecoderBuffer; |
16 class MessageLoop; | 16 class MessageLoop; |
17 | 17 |
18 struct AVCodecContext; | 18 struct AVCodecContext; |
19 struct AVFrame; | 19 struct AVFrame; |
20 | 20 |
21 namespace media { | 21 namespace media { |
22 | 22 |
23 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { | 23 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
24 public: | 24 public: |
25 FFmpegVideoDecoder(const base::Callback<MessageLoop*()>& message_loop_cb); | 25 FFmpegVideoDecoder(const base::Callback<MessageLoop*()>& message_loop_cb); |
26 | 26 |
27 // VideoDecoder implementation. | 27 // VideoDecoder implementation. |
28 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 28 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
29 const PipelineStatusCB& status_cb, | 29 const PipelineStatusCB& status_cb, |
30 const StatisticsCB& statistics_cb) OVERRIDE; | 30 const StatisticsCB& statistics_cb) OVERRIDE; |
31 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 31 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
32 virtual void Reset(const base::Closure& closure) OVERRIDE; | 32 virtual void Reset(const base::Closure& closure) OVERRIDE; |
33 virtual void Stop(const base::Closure& closure) OVERRIDE; | 33 virtual void Stop(const base::Closure& closure) OVERRIDE; |
34 virtual const gfx::Size& natural_size() OVERRIDE; | 34 virtual const gfx::Size& natural_size() OVERRIDE; |
35 | 35 |
36 // Must be called prior to initialization if decrypted buffers will be | 36 // Must be called prior to initialization if decrypted buffers will be |
37 // encountered. | 37 // encountered. |
38 void set_decryptor(AesDecryptor* decryptor); | 38 void set_decryptor(Decryptor* decryptor); |
39 | 39 |
40 protected: | 40 protected: |
41 virtual ~FFmpegVideoDecoder(); | 41 virtual ~FFmpegVideoDecoder(); |
42 | 42 |
43 private: | 43 private: |
44 enum DecoderState { | 44 enum DecoderState { |
45 kUninitialized, | 45 kUninitialized, |
46 kNormal, | 46 kNormal, |
47 kFlushCodec, | 47 kFlushCodec, |
48 kDecodeFinished, | 48 kDecodeFinished, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 int frame_rate_numerator_; | 94 int frame_rate_numerator_; |
95 int frame_rate_denominator_; | 95 int frame_rate_denominator_; |
96 | 96 |
97 // TODO(scherkus): I think this should be calculated by VideoRenderers based | 97 // TODO(scherkus): I think this should be calculated by VideoRenderers based |
98 // on information provided by VideoDecoders (i.e., aspect ratio). | 98 // on information provided by VideoDecoders (i.e., aspect ratio). |
99 gfx::Size natural_size_; | 99 gfx::Size natural_size_; |
100 | 100 |
101 // Pointer to the demuxer stream that will feed us compressed buffers. | 101 // Pointer to the demuxer stream that will feed us compressed buffers. |
102 scoped_refptr<DemuxerStream> demuxer_stream_; | 102 scoped_refptr<DemuxerStream> demuxer_stream_; |
103 | 103 |
104 AesDecryptor* decryptor_; | 104 Decryptor* decryptor_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 106 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
107 }; | 107 }; |
108 | 108 |
109 } // namespace media | 109 } // namespace media |
110 | 110 |
111 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 111 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
OLD | NEW |