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

Unified Diff: media/filters/ffmpeg_demuxer.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: Fixed Merge 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
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 05fa340ad55147d5b6d0934f35ea1b73c71d665d..e23116f55fedc8d537a3ea7e69b01dc6211f5aa7 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -14,6 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/metrics/sparse_histogram.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/sys_byteorder.h"
@@ -92,11 +93,14 @@ FFmpegDemuxerStream::FFmpegDemuxerStream(FFmpegDemuxer* demuxer,
type_(UNKNOWN),
end_of_stream_(false),
last_packet_timestamp_(kNoTimestamp()),
+ video_rotation_(VIDEO_ROTATION_0),
bitstream_converter_enabled_(false),
fixup_negative_ogg_timestamps_(false) {
DCHECK(demuxer_);
bool is_encrypted = false;
+ int rotation = 0;
+ AVDictionaryEntry* rotation_entry = NULL;
// Determine our media format.
switch (stream->codec->codec_type) {
@@ -109,6 +113,28 @@ FFmpegDemuxerStream::FFmpegDemuxerStream(FFmpegDemuxer* demuxer,
type_ = VIDEO;
AVStreamToVideoDecoderConfig(stream, &video_config_, true);
is_encrypted = video_config_.is_encrypted();
+
+ rotation_entry = av_dict_get(stream->metadata, "rotate", NULL, 0);
+ if (rotation_entry && rotation_entry->value && rotation_entry->value[0])
+ base::StringToInt(rotation_entry->value, &rotation);
+
+ switch (rotation) {
+ case 0:
+ break;
+ case 90:
+ video_rotation_ = VIDEO_ROTATION_90;
+ break;
+ case 180:
+ video_rotation_ = VIDEO_ROTATION_180;
+ break;
+ case 270:
+ video_rotation_ = VIDEO_ROTATION_270;
+ break;
+ default:
+ LOG(ERROR) << "Unsupported video rotation metadata: " << rotation;
+ break;
+ }
+
break;
case AVMEDIA_TYPE_SUBTITLE:
type_ = TEXT;
@@ -380,6 +406,10 @@ VideoDecoderConfig FFmpegDemuxerStream::video_decoder_config() {
return video_config_;
}
+VideoRotation FFmpegDemuxerStream::video_rotation() {
+ return video_rotation_;
+}
+
FFmpegDemuxerStream::~FFmpegDemuxerStream() {
DCHECK(!demuxer_);
DCHECK(read_cb_.is_null());

Powered by Google App Engine
This is Rietveld 408576698