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

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

Issue 7867051: Introduce AudioDecoderConfig to migrate away from GetAVStream(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot files Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
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 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 stream_(stream), 60 stream_(stream),
61 type_(UNKNOWN), 61 type_(UNKNOWN),
62 discontinuous_(false), 62 discontinuous_(false),
63 stopped_(false) { 63 stopped_(false) {
64 DCHECK(demuxer_); 64 DCHECK(demuxer_);
65 65
66 // Determine our media format. 66 // Determine our media format.
67 switch (stream->codec->codec_type) { 67 switch (stream->codec->codec_type) {
68 case AVMEDIA_TYPE_AUDIO: 68 case AVMEDIA_TYPE_AUDIO:
69 type_ = AUDIO; 69 type_ = AUDIO;
70 audio_config_.reset(AVCodecContextToAudioDecoderConfig(stream->codec));
70 break; 71 break;
71 case AVMEDIA_TYPE_VIDEO: 72 case AVMEDIA_TYPE_VIDEO:
72 type_ = VIDEO; 73 type_ = VIDEO;
73 break; 74 break;
74 default: 75 default:
75 NOTREACHED(); 76 NOTREACHED();
76 break; 77 break;
77 } 78 }
78 79
79 // Calculate the duration. 80 // Calculate the duration.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 bitstream_converter_.reset( 235 bitstream_converter_.reset(
235 new FFmpegBitstreamConverter(filter_name, stream_->codec)); 236 new FFmpegBitstreamConverter(filter_name, stream_->codec));
236 CHECK(bitstream_converter_->Initialize()); 237 CHECK(bitstream_converter_->Initialize());
237 } 238 }
238 } 239 }
239 240
240 AVStream* FFmpegDemuxerStream::GetAVStream() { 241 AVStream* FFmpegDemuxerStream::GetAVStream() {
241 return stream_; 242 return stream_;
242 } 243 }
243 244
245 AudioDecoderConfig* FFmpegDemuxerStream::audio_decoder_config() {
246 return audio_config_.get();
247 }
248
244 // static 249 // static
245 base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( 250 base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp(
246 const AVRational& time_base, int64 timestamp) { 251 const AVRational& time_base, int64 timestamp) {
247 if (timestamp == static_cast<int64>(AV_NOPTS_VALUE)) 252 if (timestamp == static_cast<int64>(AV_NOPTS_VALUE))
248 return kNoTimestamp; 253 return kNoTimestamp;
249 254
250 return ConvertFromTimeBase(time_base, timestamp); 255 return ConvertFromTimeBase(time_base, timestamp);
251 } 256 }
252 257
253 // 258 //
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 read_event_.Wait(); 719 read_event_.Wait();
715 return last_read_bytes_; 720 return last_read_bytes_;
716 } 721 }
717 722
718 void FFmpegDemuxer::SignalReadCompleted(size_t size) { 723 void FFmpegDemuxer::SignalReadCompleted(size_t size) {
719 last_read_bytes_ = size; 724 last_read_bytes_ = size;
720 read_event_.Signal(); 725 read_event_.Signal();
721 } 726 }
722 727
723 } // namespace media 728 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698