diff options
author | fgalligan@chromium.org <fgalligan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 23:52:41 +0000 |
---|---|---|
committer | fgalligan@chromium.org <fgalligan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 23:52:41 +0000 |
commit | 4d98e445c98768bb5eb44f8947bea55c1da8334b (patch) | |
tree | b6cf720b8d7ac51b47ab9196bbcaa7c5349977f9 /media/ffmpeg/ffmpeg_common.cc | |
parent | 76e5e6d404fa7d608a9da91e3903a9a2c9165a77 (diff) | |
download | chromium_src-4d98e445c98768bb5eb44f8947bea55c1da8334b.zip chromium_src-4d98e445c98768bb5eb44f8947bea55c1da8334b.tar.gz chromium_src-4d98e445c98768bb5eb44f8947bea55c1da8334b.tar.bz2 |
Support for parsing encrypted WebM streams by src.
- Note: Only looking for comments on direction. A lot of work
still needs to be done before committing.
- Added support to FFmpegDemuxer to decrypt encrypted WebM streams.
- Added support to FFmpegDemuxer to handle the needKey and keyAdded
messages.
- Added support to WebMediaPlayerImpl to handle the needKey and
keyAdded messages.
BUG=123426
TEST=All media_unittests pass
Review URL: https://chromiumcodereview.appspot.com/10829470
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/ffmpeg/ffmpeg_common.cc')
-rw-r--r-- | media/ffmpeg/ffmpeg_common.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index a2c4efd..8a69a86 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc @@ -269,8 +269,9 @@ static AVSampleFormat SampleFormatToAVSampleFormat(SampleFormat sample_format) { return AV_SAMPLE_FMT_NONE; } -void AVCodecContextToAudioDecoderConfig( +static void AVCodecContextToAudioDecoderConfig( const AVCodecContext* codec_context, + bool is_encrypted, AudioDecoderConfig* config) { DCHECK_EQ(codec_context->codec_type, AVMEDIA_TYPE_AUDIO); @@ -294,7 +295,7 @@ void AVCodecContextToAudioDecoderConfig( codec_context->sample_rate, codec_context->extradata, codec_context->extradata_size, - false, // Not encrypted. + is_encrypted, true); if (codec != kCodecOpus) { DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, @@ -302,6 +303,17 @@ void AVCodecContextToAudioDecoderConfig( } } +void AVStreamToAudioDecoderConfig( + const AVStream* stream, + AudioDecoderConfig* config) { + bool is_encrypted = false; + AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); + if (key) + is_encrypted = true; + return AVCodecContextToAudioDecoderConfig(stream->codec, + is_encrypted, config); +} + void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config, AVCodecContext* codec_context) { codec_context->codec_type = AVMEDIA_TYPE_AUDIO; @@ -365,12 +377,17 @@ void AVStreamToVideoDecoderConfig( coded_size = natural_size; } + bool is_encrypted = false; + AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); + if (key) + is_encrypted = true; + config->Initialize(codec, profile, format, coded_size, visible_rect, natural_size, stream->codec->extradata, stream->codec->extradata_size, - false, // Not encrypted. + is_encrypted, true); } |