| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/decryptor.h" | 10 #include "media/base/decryptor.h" |
| 11 #include "media/base/demuxer_stream.h" | 11 #include "media/base/demuxer_stream.h" |
| 12 #include "media/base/video_decoder.h" | 12 #include "media/base/video_decoder.h" |
| 13 | 13 |
| 14 class MessageLoop; | 14 class MessageLoop; |
| 15 | 15 |
| 16 struct AVCodecContext; | 16 struct AVCodecContext; |
| 17 struct AVFrame; | 17 struct AVFrame; |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 | 20 |
| 21 class DecoderBuffer; | 21 class DecoderBuffer; |
| 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 Decryptor* decryptor); |
| 26 | 27 |
| 27 // VideoDecoder implementation. | 28 // VideoDecoder implementation. |
| 28 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, | 29 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, |
| 29 const PipelineStatusCB& status_cb, | 30 const PipelineStatusCB& status_cb, |
| 30 const StatisticsCB& statistics_cb) OVERRIDE; | 31 const StatisticsCB& statistics_cb) OVERRIDE; |
| 31 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 32 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 32 virtual void Reset(const base::Closure& closure) OVERRIDE; | 33 virtual void Reset(const base::Closure& closure) OVERRIDE; |
| 33 virtual void Stop(const base::Closure& closure) OVERRIDE; | 34 virtual void Stop(const base::Closure& closure) OVERRIDE; |
| 34 | 35 |
| 35 // Must be called prior to initialization if decrypted buffers will be | |
| 36 // encountered. | |
| 37 void set_decryptor(Decryptor* decryptor); | |
| 38 | |
| 39 // Callback called from within FFmpeg to allocate a buffer based on | 36 // Callback called from within FFmpeg to allocate a buffer based on |
| 40 // the dimensions of |codec_context|. See AVCodecContext.get_buffer | 37 // the dimensions of |codec_context|. See AVCodecContext.get_buffer |
| 41 // documentation inside FFmpeg. | 38 // documentation inside FFmpeg. |
| 42 int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame); | 39 int GetVideoBuffer(AVCodecContext *codec_context, AVFrame* frame); |
| 43 | 40 |
| 44 protected: | 41 protected: |
| 45 virtual ~FFmpegVideoDecoder(); | 42 virtual ~FFmpegVideoDecoder(); |
| 46 | 43 |
| 47 private: | 44 private: |
| 48 enum DecoderState { | 45 enum DecoderState { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 scoped_refptr<DemuxerStream> demuxer_stream_; | 107 scoped_refptr<DemuxerStream> demuxer_stream_; |
| 111 | 108 |
| 112 Decryptor* decryptor_; | 109 Decryptor* decryptor_; |
| 113 | 110 |
| 114 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 111 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
| 115 }; | 112 }; |
| 116 | 113 |
| 117 } // namespace media | 114 } // namespace media |
| 118 | 115 |
| 119 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 116 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| OLD | NEW |