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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "media/ffmpeg/ffmpeg_common.h" 5 #include "media/ffmpeg/ffmpeg_common.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 coded_size.set_width((coded_size.width() + 1) / 2 * 2); 404 coded_size.set_width((coded_size.width() + 1) / 2 * 2);
405 if (format != VideoFrame::YV16) 405 if (format != VideoFrame::YV16)
406 coded_size.set_height((coded_size.height() + 1) / 2 * 2); 406 coded_size.set_height((coded_size.height() + 1) / 2 * 2);
407 } 407 }
408 408
409 bool is_encrypted = false; 409 bool is_encrypted = false;
410 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0); 410 AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0);
411 if (key) 411 if (key)
412 is_encrypted = true; 412 is_encrypted = true;
413 413
414 AVDictionaryEntry* rotation_entry =
415 av_dict_get(stream->metadata, "rotate", NULL, 0);
416 int rotation = 0;
417 if (rotation_entry && rotation_entry->value && rotation_entry->value[0])
418 base::StringToInt(rotation_entry->value, &rotation);
419
420 DCHECK(rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270);
421 if (rotation != 90 && rotation != 180 && rotation != 270)
422 rotation = 0;
423
414 AVDictionaryEntry* webm_alpha = 424 AVDictionaryEntry* webm_alpha =
415 av_dict_get(stream->metadata, "alpha_mode", NULL, 0); 425 av_dict_get(stream->metadata, "alpha_mode", NULL, 0);
416 if (webm_alpha && !strcmp(webm_alpha->value, "1")) { 426 if (webm_alpha && !strcmp(webm_alpha->value, "1")) {
417 format = VideoFrame::YV12A; 427 format = VideoFrame::YV12A;
418 } 428 }
419 429
420 config->Initialize(codec, 430 config->Initialize(codec,
421 profile, 431 profile,
422 format, 432 format,
423 coded_size, visible_rect, natural_size, 433 coded_size, visible_rect, natural_size,
424 stream->codec->extradata, stream->codec->extradata_size, 434 stream->codec->extradata, stream->codec->extradata_size,
425 is_encrypted, 435 is_encrypted,
426 record_stats); 436 record_stats);
437
438 config->set_rotation(rotation);
427 } 439 }
428 440
429 void VideoDecoderConfigToAVCodecContext( 441 void VideoDecoderConfigToAVCodecContext(
430 const VideoDecoderConfig& config, 442 const VideoDecoderConfig& config,
431 AVCodecContext* codec_context) { 443 AVCodecContext* codec_context) {
432 codec_context->codec_type = AVMEDIA_TYPE_VIDEO; 444 codec_context->codec_type = AVMEDIA_TYPE_VIDEO;
433 codec_context->codec_id = VideoCodecToCodecID(config.codec()); 445 codec_context->codec_id = VideoCodecToCodecID(config.codec());
434 codec_context->profile = VideoCodecProfileToProfileID(config.profile()); 446 codec_context->profile = VideoCodecProfileToProfileID(config.profile());
435 codec_context->coded_width = config.coded_size().width(); 447 codec_context->coded_width = config.coded_size().width();
436 codec_context->coded_height = config.coded_size().height(); 448 codec_context->coded_height = config.coded_size().height();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return false; 590 return false;
579 591
580 *out = parsed_time; 592 *out = parsed_time;
581 return true; 593 return true;
582 } 594 }
583 595
584 return false; 596 return false;
585 } 597 }
586 598
587 } // namespace media 599 } // namespace media
OLDNEW
« 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