summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 00:53:01 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 00:53:01 +0000
commit074248931d91c43c612ee611342a5c354f580b2e (patch)
tree654b9a2a73672ae31daba1161fa969c8646bd11a /media
parent57675d4d32433b20aa1852690c69ddbf18693f1f (diff)
downloadchromium_src-074248931d91c43c612ee611342a5c354f580b2e.zip
chromium_src-074248931d91c43c612ee611342a5c354f580b2e.tar.gz
chromium_src-074248931d91c43c612ee611342a5c354f580b2e.tar.bz2
Chromium side changes for enabling VP8 and WebM support.
Patches by Frank Galligan (fgalligan@google.com), Tom Finegan (tomfinegan@google.com) and James Zern (jzern@google.com). BUG=none TEST=none Review URL: http://codereview.chromium.org/2093007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/ffmpeg_demuxer.cc8
-rw-r--r--media/filters/ffmpeg_demuxer_unittest.cc5
2 files changed, 13 insertions, 0 deletions
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 154e565..5268c59 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -404,11 +404,19 @@ void FFmpegDemuxer::InitializeTask(DataSource* data_source,
// Create demuxer streams for all supported streams.
base::TimeDelta max_duration;
+ const bool kDemuxerIsWebm = !strcmp("webm", format_context_->iformat->name);
for (size_t i = 0; i < format_context_->nb_streams; ++i) {
AVCodecContext* codec_context = format_context_->streams[i]->codec;
CodecType codec_type = codec_context->codec_type;
if (codec_type == CODEC_TYPE_AUDIO || codec_type == CODEC_TYPE_VIDEO) {
AVStream* stream = format_context_->streams[i];
+ // WebM is currently strictly VP8 and Vorbis.
+ if (kDemuxerIsWebm && (stream->codec->codec_id != CODEC_ID_VP8 &&
+ stream->codec->codec_id != CODEC_ID_VORBIS)) {
+ packet_streams_.push_back(NULL);
+ continue;
+ }
+
FFmpegDemuxerStream* demuxer_stream
= new FFmpegDemuxerStream(this, stream);
diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc
index 8c3cb6a..31d575f 100644
--- a/media/filters/ffmpeg_demuxer_unittest.cc
+++ b/media/filters/ffmpeg_demuxer_unittest.cc
@@ -79,6 +79,7 @@ class FFmpegDemuxerTest : public testing::Test {
// Initialize FFmpeg fixtures.
memset(&format_context_, 0, sizeof(format_context_));
+ memset(&input_format_, 0, sizeof(input_format_));
memset(&streams_, 0, sizeof(streams_));
memset(&codecs_, 0, sizeof(codecs_));
@@ -96,6 +97,9 @@ class FFmpegDemuxerTest : public testing::Test {
codecs_[AV_STREAM_AUDIO].channels = kChannels;
codecs_[AV_STREAM_AUDIO].sample_rate = kSampleRate;
+ input_format_.name = "foo";
+ format_context_.iformat = &input_format_;
+
// Initialize AVStream and AVFormatContext structures. We set the time base
// of the streams such that duration is reported in microseconds.
format_context_.nb_streams = AV_STREAM_MAX;
@@ -162,6 +166,7 @@ class FFmpegDemuxerTest : public testing::Test {
// FFmpeg fixtures.
AVFormatContext format_context_;
+ AVInputFormat input_format_;
AVCodecContext codecs_[AV_STREAM_MAX];
AVStream streams_[AV_STREAM_MAX];
MockFFmpeg mock_ffmpeg_;