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

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

Issue 691233002: Added aac bitstream converter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
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 // 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // FFmpeg forward declarations. 43 // FFmpeg forward declarations.
44 struct AVPacket; 44 struct AVPacket;
45 struct AVRational; 45 struct AVRational;
46 struct AVStream; 46 struct AVStream;
47 47
48 namespace media { 48 namespace media {
49 49
50 class MediaLog; 50 class MediaLog;
51 class FFmpegDemuxer; 51 class FFmpegDemuxer;
52 class FFmpegGlue; 52 class FFmpegGlue;
53 class FFmpegH264ToAnnexBBitstreamConverter; 53 class FFmpegBitstreamConverter;
xhwang 2014/11/06 04:35:28 Fix order.
kjoswiak 2014/11/07 02:14:38 Done.
54 54
55 typedef scoped_ptr<AVPacket, ScopedPtrAVFreePacket> ScopedAVPacket; 55 typedef scoped_ptr<AVPacket, ScopedPtrAVFreePacket> ScopedAVPacket;
56 56
57 class FFmpegDemuxerStream : public DemuxerStream { 57 class FFmpegDemuxerStream : public DemuxerStream {
58 public: 58 public:
59 // Keeps a copy of |demuxer| and initializes itself using information inside 59 // Keeps a copy of |demuxer| and initializes itself using information inside
60 // |stream|. Both parameters must outlive |this|. 60 // |stream|. Both parameters must outlive |this|.
61 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream); 61 FFmpegDemuxerStream(FFmpegDemuxer* demuxer, AVStream* stream);
62 ~FFmpegDemuxerStream() override; 62 ~FFmpegDemuxerStream() override;
63 63
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 friend class FFmpegDemuxerTest; 117 friend class FFmpegDemuxerTest;
118 118
119 // Runs |read_cb_| if present with the front of |buffer_queue_|, calling 119 // Runs |read_cb_| if present with the front of |buffer_queue_|, calling
120 // NotifyCapacityAvailable() if capacity is still available. 120 // NotifyCapacityAvailable() if capacity is still available.
121 void SatisfyPendingRead(); 121 void SatisfyPendingRead();
122 122
123 // Converts an FFmpeg stream timestamp into a base::TimeDelta. 123 // Converts an FFmpeg stream timestamp into a base::TimeDelta.
124 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base, 124 static base::TimeDelta ConvertStreamTimestamp(const AVRational& time_base,
125 int64 timestamp); 125 int64 timestamp);
126 126
127 // Resets any currently active bitstream converters. 127 // Resets any currently active bitstream converter.
128 void ResetBitstreamConverter(); 128 void ResetBitstreamConverter();
129 129
130 // Create new bitstream converter, destroying active converter if present
xhwang 2014/11/06 04:35:28 Add period after "present".
kjoswiak 2014/11/07 02:14:38 Done.
131 void InitBitstreamConverter();
132
130 FFmpegDemuxer* demuxer_; 133 FFmpegDemuxer* demuxer_;
131 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 134 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
132 AVStream* stream_; 135 AVStream* stream_;
133 AudioDecoderConfig audio_config_; 136 AudioDecoderConfig audio_config_;
134 VideoDecoderConfig video_config_; 137 VideoDecoderConfig video_config_;
135 Type type_; 138 Type type_;
136 base::TimeDelta duration_; 139 base::TimeDelta duration_;
137 bool end_of_stream_; 140 bool end_of_stream_;
138 base::TimeDelta last_packet_timestamp_; 141 base::TimeDelta last_packet_timestamp_;
139 base::TimeDelta last_packet_duration_; 142 base::TimeDelta last_packet_duration_;
140 Ranges<base::TimeDelta> buffered_ranges_; 143 Ranges<base::TimeDelta> buffered_ranges_;
141 VideoRotation video_rotation_; 144 VideoRotation video_rotation_;
142 145
143 DecoderBufferQueue buffer_queue_; 146 DecoderBufferQueue buffer_queue_;
144 ReadCB read_cb_; 147 ReadCB read_cb_;
145 148
146 #if defined(USE_PROPRIETARY_CODECS) 149 #if defined(USE_PROPRIETARY_CODECS)
147 scoped_ptr<FFmpegH264ToAnnexBBitstreamConverter> bitstream_converter_; 150 scoped_ptr<FFmpegBitstreamConverter> bitstream_converter_;
148 #endif 151 #endif
149 152
150 bool bitstream_converter_enabled_;
151
152 std::string encryption_key_id_; 153 std::string encryption_key_id_;
153 bool fixup_negative_ogg_timestamps_; 154 bool fixup_negative_ogg_timestamps_;
154 155
155 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); 156 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream);
156 }; 157 };
157 158
158 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { 159 class MEDIA_EXPORT FFmpegDemuxer : public Demuxer {
159 public: 160 public:
160 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 161 FFmpegDemuxer(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
161 DataSource* data_source, 162 DataSource* data_source,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 // NOTE: Weak pointers must be invalidated before all other member variables. 302 // NOTE: Weak pointers must be invalidated before all other member variables.
302 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; 303 base::WeakPtrFactory<FFmpegDemuxer> weak_factory_;
303 304
304 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer); 305 DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxer);
305 }; 306 };
306 307
307 } // namespace media 308 } // namespace media
308 309
309 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_ 310 #endif // MEDIA_FILTERS_FFMPEG_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698