| 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/aes_decryptor.h" |
| 14 | 14 |
| 15 class DecoderBuffer; |
| 15 class MessageLoop; | 16 class MessageLoop; |
| 16 | 17 |
| 17 struct AVCodecContext; | 18 struct AVCodecContext; |
| 18 struct AVFrame; | 19 struct AVFrame; |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 | 22 |
| 22 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { | 23 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { |
| 23 public: | 24 public: |
| 24 FFmpegVideoDecoder(const base::Callback<MessageLoop*()>& message_loop_cb); | 25 FFmpegVideoDecoder(const base::Callback<MessageLoop*()>& message_loop_cb); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 kNormal, | 44 kNormal, |
| 44 kFlushCodec, | 45 kFlushCodec, |
| 45 kDecodeFinished, | 46 kDecodeFinished, |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // Carries out the reading operation scheduled by Read(). | 49 // Carries out the reading operation scheduled by Read(). |
| 49 void DoRead(const ReadCB& read_cb); | 50 void DoRead(const ReadCB& read_cb); |
| 50 | 51 |
| 51 // Reads from the demuxer stream with corresponding callback method. | 52 // Reads from the demuxer stream with corresponding callback method. |
| 52 void ReadFromDemuxerStream(); | 53 void ReadFromDemuxerStream(); |
| 53 void DecodeBuffer(const scoped_refptr<Buffer>& buffer); | 54 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); |
| 54 | 55 |
| 55 // Carries out the decoding operation scheduled by DecodeBuffer(). | 56 // Carries out the decoding operation scheduled by DecodeBuffer(). |
| 56 void DoDecodeBuffer(const scoped_refptr<Buffer>& buffer); | 57 void DoDecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer); |
| 57 bool Decode(const scoped_refptr<Buffer>& buffer, | 58 bool Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 58 scoped_refptr<VideoFrame>* video_frame); | 59 scoped_refptr<VideoFrame>* video_frame); |
| 59 | 60 |
| 60 // Delivers the frame to |read_cb_| and resets the callback. | 61 // Delivers the frame to |read_cb_| and resets the callback. |
| 61 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); | 62 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); |
| 62 | 63 |
| 63 // Releases resources associated with |codec_context_| and |av_frame_| | 64 // Releases resources associated with |codec_context_| and |av_frame_| |
| 64 // and resets them to NULL. | 65 // and resets them to NULL. |
| 65 void ReleaseFFmpegResources(); | 66 void ReleaseFFmpegResources(); |
| 66 | 67 |
| 67 // Reset decoder and call |reset_cb_|. | 68 // Reset decoder and call |reset_cb_|. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 scoped_refptr<DemuxerStream> demuxer_stream_; | 100 scoped_refptr<DemuxerStream> demuxer_stream_; |
| 100 | 101 |
| 101 AesDecryptor decryptor_; | 102 AesDecryptor decryptor_; |
| 102 | 103 |
| 103 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 104 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace media | 107 } // namespace media |
| 107 | 108 |
| 108 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 109 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| OLD | NEW |