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

Unified Diff: media/ffmpeg/ffmpeg_common.cc

Issue 363813002: Update to Pipeline Metadata and Decoder Stream for Orientation Data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: VideoRotation enum added Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« media/base/video_decoder_config.h ('K') | « media/base/video_decoder_config.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common.cc
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 42642fbfbecd917c185699e0cc4c95066974b0cf..50f36cdaab4eb607175c775b2f3420094be9e584 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -411,6 +411,14 @@ void AVStreamToVideoDecoderConfig(
if (key)
is_encrypted = true;
+ AVDictionaryEntry* rotation_entry =
+ av_dict_get(stream->metadata, "rotate", NULL, 0);
+ int rotation = 0;
+ if (rotation_entry && rotation_entry->value && rotation_entry->value[0])
+ base::StringToInt(rotation_entry->value, &rotation);
+
+ DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270);
scherkus (not reviewing) 2014/07/07 20:52:38 are we certain FFmpeg can't spit out values other
+
AVDictionaryEntry* webm_alpha =
av_dict_get(stream->metadata, "alpha_mode", NULL, 0);
if (webm_alpha && !strcmp(webm_alpha->value, "1")) {
@@ -424,6 +432,22 @@ void AVStreamToVideoDecoderConfig(
stream->codec->extradata, stream->codec->extradata_size,
is_encrypted,
record_stats);
+
+ switch (rotation) {
+ case 0:
+ config->set_rotation(kRotate0);
+ break;
+ case 90:
+ config->set_rotation(kRotate90);
+ break;
+ case 180:
+ config->set_rotation(kRotate180);
+ break;
+ case 270:
+ config->set_rotation(kRotate270);
+ default:
+ break;
+ }
}
void VideoDecoderConfigToAVCodecContext(
« media/base/video_decoder_config.h ('K') | « media/base/video_decoder_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698