| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bool Decode(const scoped_refptr<Buffer>& buffer, | 57 bool Decode(const scoped_refptr<Buffer>& buffer, |
| 58 scoped_refptr<VideoFrame>* video_frame); | 58 scoped_refptr<VideoFrame>* video_frame); |
| 59 | 59 |
| 60 // Delivers the frame to |read_cb_| and resets the callback. | 60 // Delivers the frame to |read_cb_| and resets the callback. |
| 61 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); | 61 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); |
| 62 | 62 |
| 63 // Releases resources associated with |codec_context_| and |av_frame_| | 63 // Releases resources associated with |codec_context_| and |av_frame_| |
| 64 // and resets them to NULL. | 64 // and resets them to NULL. |
| 65 void ReleaseFFmpegResources(); | 65 void ReleaseFFmpegResources(); |
| 66 | 66 |
| 67 // Flush decoder and call |flush_cb_|. |
| 68 void DoFlush(); |
| 69 |
| 67 // Allocates a video frame based on the current format and dimensions based on | 70 // Allocates a video frame based on the current format and dimensions based on |
| 68 // the current state of |codec_context_|. | 71 // the current state of |codec_context_|. |
| 69 scoped_refptr<VideoFrame> AllocateVideoFrame(); | 72 scoped_refptr<VideoFrame> AllocateVideoFrame(); |
| 70 | 73 |
| 71 MessageLoop* message_loop_; | 74 MessageLoop* message_loop_; |
| 72 | 75 |
| 73 DecoderState state_; | 76 DecoderState state_; |
| 74 | 77 |
| 75 StatisticsCB statistics_cb_; | 78 StatisticsCB statistics_cb_; |
| 76 | 79 |
| 77 ReadCB read_cb_; | 80 ReadCB read_cb_; |
| 81 base::Closure flush_cb_; |
| 78 | 82 |
| 79 // FFmpeg structures owned by this object. | 83 // FFmpeg structures owned by this object. |
| 80 AVCodecContext* codec_context_; | 84 AVCodecContext* codec_context_; |
| 81 AVFrame* av_frame_; | 85 AVFrame* av_frame_; |
| 82 | 86 |
| 83 // Frame rate of the video. | 87 // Frame rate of the video. |
| 84 int frame_rate_numerator_; | 88 int frame_rate_numerator_; |
| 85 int frame_rate_denominator_; | 89 int frame_rate_denominator_; |
| 86 | 90 |
| 87 // TODO(scherkus): I think this should be calculated by VideoRenderers based | 91 // TODO(scherkus): I think this should be calculated by VideoRenderers based |
| 88 // on information provided by VideoDecoders (i.e., aspect ratio). | 92 // on information provided by VideoDecoders (i.e., aspect ratio). |
| 89 gfx::Size natural_size_; | 93 gfx::Size natural_size_; |
| 90 | 94 |
| 91 // Pointer to the demuxer stream that will feed us compressed buffers. | 95 // Pointer to the demuxer stream that will feed us compressed buffers. |
| 92 scoped_refptr<DemuxerStream> demuxer_stream_; | 96 scoped_refptr<DemuxerStream> demuxer_stream_; |
| 93 | 97 |
| 94 AesDecryptor decryptor_; | 98 AesDecryptor decryptor_; |
| 95 | 99 |
| 96 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); | 100 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); |
| 97 }; | 101 }; |
| 98 | 102 |
| 99 } // namespace media | 103 } // namespace media |
| 100 | 104 |
| 101 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ | 105 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ |
| OLD | NEW |