OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Implements the Demuxer interface using FFmpeg's libavformat. At this time | 5 // Implements the Demuxer interface using FFmpeg's libavformat. At this time |
6 // will support demuxing any audio/video format thrown at it. The streams | 6 // will support demuxing any audio/video format thrown at it. The streams |
7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer | 7 // output mime types audio/x-ffmpeg and video/x-ffmpeg and include an integer |
8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs | 8 // key FFmpegCodecID which contains the CodecID enumeration value. The CodecIDs |
9 // can be used to create and initialize the corresponding FFmpeg decoder. | 9 // can be used to create and initialize the corresponding FFmpeg decoder. |
10 // | 10 // |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 bool HasPendingReads(); | 51 bool HasPendingReads(); |
52 | 52 |
53 // Enqueues and takes ownership over the given AVPacket. | 53 // Enqueues and takes ownership over the given AVPacket. |
54 void EnqueuePacket(AVPacket* packet); | 54 void EnqueuePacket(AVPacket* packet); |
55 | 55 |
56 // Returns the duration of this stream. | 56 // Returns the duration of this stream. |
57 base::TimeDelta duration() { return duration_; } | 57 base::TimeDelta duration() { return duration_; } |
58 | 58 |
59 // DemuxerStream implementation. | 59 // DemuxerStream implementation. |
60 virtual const MediaFormat& media_format(); | 60 virtual const MediaFormat& media_format(); |
61 virtual void Read(Assignable<Buffer>* buffer); | 61 virtual void Read(Callback1<Buffer*>::Type* read_callback); |
62 | 62 |
63 AVStream* av_stream() { | 63 AVStream* av_stream() { |
64 return av_stream_; | 64 return av_stream_; |
65 } | 65 } |
66 | 66 |
67 static const char* interface_id(); | 67 static const char* interface_id(); |
68 | 68 |
69 protected: | 69 protected: |
70 virtual void* QueryInterface(const char* interface_id); | 70 virtual void* QueryInterface(const char* interface_id); |
71 | 71 |
72 private: | 72 private: |
73 // Returns true if there are still pending reads. | 73 // Returns true if there are still pending reads. |
74 bool FulfillPendingReads(); | 74 bool FulfillPendingReads(); |
75 | 75 |
76 FFmpegDemuxer* demuxer_; | 76 FFmpegDemuxer* demuxer_; |
77 AVStream* av_stream_; | 77 AVStream* av_stream_; |
78 MediaFormat media_format_; | 78 MediaFormat media_format_; |
79 base::TimeDelta time_base_; | 79 base::TimeDelta time_base_; |
80 base::TimeDelta duration_; | 80 base::TimeDelta duration_; |
81 Lock lock_; | 81 Lock lock_; |
82 | 82 |
83 typedef std::deque< scoped_refptr<Buffer> > InputQueue; | 83 typedef std::deque< scoped_refptr<Buffer> > BufferQueue; |
84 InputQueue input_queue_; | 84 BufferQueue buffer_queue_; |
85 | 85 |
86 typedef std::deque< scoped_refptr< Assignable<Buffer> > > OutputQueue; | 86 typedef std::deque<Callback1<Buffer*>::Type*> ReadQueue; |
87 OutputQueue output_queue_; | 87 ReadQueue read_queue_; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); | 89 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
90 }; | 90 }; |
91 | 91 |
92 class FFmpegDemuxer : public Demuxer { | 92 class FFmpegDemuxer : public Demuxer { |
93 public: | 93 public: |
94 // FilterFactory provider. | 94 // FilterFactory provider. |
95 static FilterFactory* CreateFilterFactory() { | 95 static FilterFactory* CreateFilterFactory() { |
96 return new FilterFactoryImpl0<FFmpegDemuxer>(); | 96 return new FilterFactoryImpl0<FFmpegDemuxer>(); |
97 } | 97 } |
(...skipping 30 matching lines...) Expand all Loading... |
128 // Vector of streams. | 128 // Vector of streams. |
129 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; | 129 typedef std::vector< scoped_refptr<FFmpegDemuxerStream> > StreamVector; |
130 StreamVector streams_; | 130 StreamVector streams_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); | 132 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace media | 135 } // namespace media |
136 | 136 |
137 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ | 137 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ |
OLD | NEW |