| OLD | NEW |
| 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 Loading... |
| 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 AVCodecContextToAudioDecoderConfig(stream->codec, &audio_config_); |
| 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 Loading... |
| 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 const AudioDecoderConfig& FFmpegDemuxerStream::audio_decoder_config() { |
| 246 CHECK_EQ(type_, AUDIO); |
| 247 return audio_config_; |
| 248 } |
| 249 |
| 244 // static | 250 // static |
| 245 base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( | 251 base::TimeDelta FFmpegDemuxerStream::ConvertStreamTimestamp( |
| 246 const AVRational& time_base, int64 timestamp) { | 252 const AVRational& time_base, int64 timestamp) { |
| 247 if (timestamp == static_cast<int64>(AV_NOPTS_VALUE)) | 253 if (timestamp == static_cast<int64>(AV_NOPTS_VALUE)) |
| 248 return kNoTimestamp; | 254 return kNoTimestamp; |
| 249 | 255 |
| 250 return ConvertFromTimeBase(time_base, timestamp); | 256 return ConvertFromTimeBase(time_base, timestamp); |
| 251 } | 257 } |
| 252 | 258 |
| 253 // | 259 // |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 read_event_.Wait(); | 720 read_event_.Wait(); |
| 715 return last_read_bytes_; | 721 return last_read_bytes_; |
| 716 } | 722 } |
| 717 | 723 |
| 718 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 724 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
| 719 last_read_bytes_ = size; | 725 last_read_bytes_ = size; |
| 720 read_event_.Signal(); | 726 read_event_.Signal(); |
| 721 } | 727 } |
| 722 | 728 |
| 723 } // namespace media | 729 } // namespace media |
| OLD | NEW |