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

Unified Diff: media/filters/ffmpeg_video_decoder.h

Issue 60069: FFmpeg video decoder glue code... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/buffers.h ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_video_decoder.h
===================================================================
--- media/filters/ffmpeg_video_decoder.h (revision 12922)
+++ media/filters/ffmpeg_video_decoder.h (working copy)
@@ -6,9 +6,15 @@
#ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
#define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
+#include <queue>
+
#include "media/base/factory.h"
#include "media/filters/decoder_base.h"
+// FFmpeg types.
+struct AVCodecContext;
+struct AVFrame;
+
namespace media {
//------------------------------------------------------------------------------
@@ -23,13 +29,52 @@
virtual bool OnInitialize(DemuxerStream* demuxer_stream);
- virtual void OnDecode(Buffer* input);
+ virtual void OnDecode(Buffer* buffer);
private:
friend class FilterFactoryImpl0<FFmpegVideoDecoder>;
FFmpegVideoDecoder();
virtual ~FFmpegVideoDecoder();
+ bool EnqueueVideoFrame(VideoSurface::Format surface_format,
+ const AVFrame& frame);
+
+ void CopyPlane(size_t plane, const VideoSurface& surface,
+ const AVFrame& frame);
+
+ size_t width_;
+ size_t height_;
+
+ // FFmpeg outputs packets in decode timestamp (dts) order, which may not
+ // always be in presentation timestamp (pts) order. Therefore, when Process
+ // is called we cannot assume that the pts of the input |buffer| passed to the
+ // OnDecode() method is necessarily the pts of video frame. For example:
+ //
+ // Process() Timestamp Timestamp
+ // Call # Buffer In Buffer Out
+ // 1 1 1
+ // 2 3 --- <--- frame 3 buffered by FFmpeg
+ // 3 2 2
+ // 4 4 3 <--- copying timestamp 4 and 6 would be
+ // 5 6 4 <-' incorrect, which is why we sort and
+ // 6 5 5 queue incoming timestamps
+
+ // A queue entry that holds a timestamp and a duration.
+ struct TimeTuple {
+ base::TimeDelta timestamp;
+ base::TimeDelta duration;
+
+ bool operator<(const TimeTuple& other) const {
+ return timestamp >= other.timestamp;
+ }
+ };
+
+ // A priority queue of presentation TimeTuples.
+ typedef std::priority_queue<TimeTuple> TimeQueue;
+ TimeQueue time_queue_;
+
+ AVCodecContext* codec_context_;
+
DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
};
« no previous file with comments | « media/base/buffers.h ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698