Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: media/filters/ffmpeg_video_decoder.h

Issue 8772069: Collapse FFmpegVideoDecodeEngine into FFmpegVideoDecoder and remove VideoDecodeEngine. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "media/base/filters.h" 11 #include "media/base/filters.h"
12 #include "media/base/pts_stream.h" 12 #include "media/base/pts_stream.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 14
15 class MessageLoop; 15 class MessageLoop;
16 16
17 struct AVCodecContext;
18 struct AVFrame;
19
17 namespace media { 20 namespace media {
18 21
19 class VideoDecodeEngine;
20
21 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { 22 class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
22 public: 23 public:
23 explicit FFmpegVideoDecoder(MessageLoop* message_loop); 24 explicit FFmpegVideoDecoder(MessageLoop* message_loop);
24 virtual ~FFmpegVideoDecoder(); 25 virtual ~FFmpegVideoDecoder();
25 26
26 // Filter implementation. 27 // Filter implementation.
27 virtual void Stop(const base::Closure& callback) OVERRIDE; 28 virtual void Stop(const base::Closure& callback) OVERRIDE;
28 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE; 29 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb) OVERRIDE;
29 virtual void Pause(const base::Closure& callback) OVERRIDE; 30 virtual void Pause(const base::Closure& callback) OVERRIDE;
30 virtual void Flush(const base::Closure& callback) OVERRIDE; 31 virtual void Flush(const base::Closure& callback) OVERRIDE;
(...skipping 15 matching lines...) Expand all
46 47
47 // Carries out the reading operation scheduled by Read(). 48 // Carries out the reading operation scheduled by Read().
48 void DoRead(const ReadCB& callback); 49 void DoRead(const ReadCB& callback);
49 50
50 // Reads from the demuxer stream with corresponding callback method. 51 // Reads from the demuxer stream with corresponding callback method.
51 void ReadFromDemuxerStream(); 52 void ReadFromDemuxerStream();
52 void DecodeBuffer(const scoped_refptr<Buffer>& buffer); 53 void DecodeBuffer(const scoped_refptr<Buffer>& buffer);
53 54
54 // Carries out the decoding operation scheduled by DecodeBuffer(). 55 // Carries out the decoding operation scheduled by DecodeBuffer().
55 void DoDecodeBuffer(const scoped_refptr<Buffer>& buffer); 56 void DoDecodeBuffer(const scoped_refptr<Buffer>& buffer);
57 bool Decode(const scoped_refptr<Buffer>& buffer,
58 scoped_refptr<VideoFrame>* video_frame);
56 59
57 // Delivers the frame to |read_cb_| and resets the callback. 60 // Delivers the frame to |read_cb_| and resets the callback.
58 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame); 61 void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame);
59 62
63 // Releases resources associated with |codec_context_| and |av_frame_|
64 // and resets them to NULL.
65 void ReleaseFFmpegResources();
66
67 // Allocates a video frame based on the current format and dimensions based on
68 // the current state of |codec_context_|.
69 scoped_refptr<VideoFrame> AllocateVideoFrame();
70
60 MessageLoop* message_loop_; 71 MessageLoop* message_loop_;
61 72
62 PtsStream pts_stream_; 73 PtsStream pts_stream_;
63 DecoderState state_; 74 DecoderState state_;
64 scoped_ptr<VideoDecodeEngine> decode_engine_;
65 75
66 StatisticsCallback statistics_callback_; 76 StatisticsCallback statistics_callback_;
67 77
68 ReadCB read_cb_; 78 ReadCB read_cb_;
69 79
80 // FFmpeg structures owned by this object.
81 AVCodecContext* codec_context_;
82 AVFrame* av_frame_;
83
84 // Frame rate of the video.
85 int frame_rate_numerator_;
86 int frame_rate_denominator_;
87
70 // TODO(scherkus): I think this should be calculated by VideoRenderers based 88 // TODO(scherkus): I think this should be calculated by VideoRenderers based
71 // on information provided by VideoDecoders (i.e., aspect ratio). 89 // on information provided by VideoDecoders (i.e., aspect ratio).
72 gfx::Size natural_size_; 90 gfx::Size natural_size_;
73 91
74 // Pointer to the demuxer stream that will feed us compressed buffers. 92 // Pointer to the demuxer stream that will feed us compressed buffers.
75 scoped_refptr<DemuxerStream> demuxer_stream_; 93 scoped_refptr<DemuxerStream> demuxer_stream_;
76 94
77 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 95 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
78 }; 96 };
79 97
80 } // namespace media 98 } // namespace media
81 99
82 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 100 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698