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 // Implements a Demuxer that can switch among different data sources mid-stream. | 5 // Implements a Demuxer that can switch among different data sources mid-stream. |
6 // Uses FFmpegDemuxer under the covers, so see the caveats at the top of | 6 // Uses FFmpegDemuxer under the covers, so see the caveats at the top of |
7 // ffmpeg_demuxer.h. | 7 // ffmpeg_demuxer.h. |
8 | 8 |
9 #include "media/filters/chunk_demuxer.h" | 9 #include "media/filters/chunk_demuxer.h" |
10 | 10 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 bool ChunkDemuxer::SetupStreams() { | 527 bool ChunkDemuxer::SetupStreams() { |
528 int result = av_find_stream_info(format_context_); | 528 int result = av_find_stream_info(format_context_); |
529 | 529 |
530 if (result < 0) | 530 if (result < 0) |
531 return false; | 531 return false; |
532 | 532 |
533 bool no_supported_streams = true; | 533 bool no_supported_streams = true; |
534 for (size_t i = 0; i < format_context_->nb_streams; ++i) { | 534 for (size_t i = 0; i < format_context_->nb_streams; ++i) { |
535 AVStream* stream = format_context_->streams[i]; | 535 AVStream* stream = format_context_->streams[i]; |
536 AVCodecContext* codec_context = stream->codec; | 536 AVCodecContext* codec_context = stream->codec; |
537 CodecType codec_type = codec_context->codec_type; | 537 AVMediaType codec_type = codec_context->codec_type; |
538 | 538 |
539 if (codec_type == CODEC_TYPE_AUDIO && | 539 if (codec_type == AVMEDIA_TYPE_AUDIO && |
540 stream->codec->codec_id == CODEC_ID_VORBIS && | 540 stream->codec->codec_id == CODEC_ID_VORBIS && |
541 !audio_.get()) { | 541 !audio_.get()) { |
542 audio_ = new ChunkDemuxerStream(DemuxerStream::AUDIO, stream); | 542 audio_ = new ChunkDemuxerStream(DemuxerStream::AUDIO, stream); |
543 no_supported_streams = false; | 543 no_supported_streams = false; |
544 continue; | 544 continue; |
545 } | 545 } |
546 | 546 |
547 if (codec_type == CODEC_TYPE_VIDEO && | 547 if (codec_type == AVMEDIA_TYPE_VIDEO && |
548 stream->codec->codec_id == CODEC_ID_VP8 && | 548 stream->codec->codec_id == CODEC_ID_VP8 && |
549 !video_.get()) { | 549 !video_.get()) { |
550 video_ = new ChunkDemuxerStream(DemuxerStream::VIDEO, stream); | 550 video_ = new ChunkDemuxerStream(DemuxerStream::VIDEO, stream); |
551 no_supported_streams = false; | 551 no_supported_streams = false; |
552 continue; | 552 continue; |
553 } | 553 } |
554 } | 554 } |
555 | 555 |
556 return !no_supported_streams; | 556 return !no_supported_streams; |
557 } | 557 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 } | 610 } |
611 | 611 |
612 // TODO(acolwell) : make this more representative of what is actually | 612 // TODO(acolwell) : make this more representative of what is actually |
613 // buffered. | 613 // buffered. |
614 buffered_bytes_ += length; | 614 buffered_bytes_ += length; |
615 | 615 |
616 return true; | 616 return true; |
617 } | 617 } |
618 | 618 |
619 } // namespace media | 619 } // namespace media |
OLD | NEW |