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

Side by Side Diff: media/mp4/mp4_stream_parser.cc

Issue 10830110: Remove VideoDecoderConfig::aspect_ratio_xxx methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments & rebased Created 8 years, 4 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
« no previous file with comments | « media/filters/pipeline_integration_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/mp4/mp4_stream_parser.h" 5 #include "media/mp4/mp4_stream_parser.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "media/base/audio_decoder_config.h" 11 #include "media/base/audio_decoder_config.h"
12 #include "media/base/stream_parser_buffer.h" 12 #include "media/base/stream_parser_buffer.h"
13 #include "media/base/video_decoder_config.h" 13 #include "media/base/video_decoder_config.h"
14 #include "media/base/video_util.h"
14 #include "media/mp4/box_definitions.h" 15 #include "media/mp4/box_definitions.h"
15 #include "media/mp4/box_reader.h" 16 #include "media/mp4/box_reader.h"
16 #include "media/mp4/es_descriptor.h" 17 #include "media/mp4/es_descriptor.h"
17 #include "media/mp4/rcheck.h" 18 #include "media/mp4/rcheck.h"
18 19
19 namespace media { 20 namespace media {
20 namespace mp4 { 21 namespace mp4 {
21 22
22 MP4StreamParser::MP4StreamParser(bool has_sbr) 23 MP4StreamParser::MP4StreamParser(bool has_sbr)
23 : state_(kWaitingForInit), 24 : state_(kWaitingForInit),
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 212
212 if (!(entry.format == FOURCC_AVC1 || 213 if (!(entry.format == FOURCC_AVC1 ||
213 (entry.format == FOURCC_ENCV && 214 (entry.format == FOURCC_ENCV &&
214 entry.sinf.format.format == FOURCC_AVC1))) { 215 entry.sinf.format.format == FOURCC_AVC1))) {
215 LOG(ERROR) << "Unsupported video format."; 216 LOG(ERROR) << "Unsupported video format.";
216 return false; 217 return false;
217 } 218 }
218 RCHECK(EmitKeyNeeded(entry.sinf.info.track_encryption)); 219 RCHECK(EmitKeyNeeded(entry.sinf.info.track_encryption));
219 220
220 // TODO(strobe): Recover correct crop box 221 // TODO(strobe): Recover correct crop box
222 gfx::Size coded_size(entry.width, entry.height);
223 gfx::Rect visible_rect(coded_size);
224 gfx::Size natural_size = GetNaturalSize(visible_rect.size(),
225 entry.pixel_aspect.h_spacing,
226 entry.pixel_aspect.v_spacing);
221 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12, 227 video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12,
222 gfx::Size(entry.width, entry.height), 228 coded_size, visible_rect, natural_size,
223 gfx::Rect(0, 0, entry.width, entry.height),
224 entry.pixel_aspect.h_spacing,
225 entry.pixel_aspect.v_spacing,
226 // No decoder-specific buffer needed for AVC; 229 // No decoder-specific buffer needed for AVC;
227 // SPS/PPS are embedded in the video stream 230 // SPS/PPS are embedded in the video stream
228 NULL, 0, false); 231 NULL, 0, true);
229 has_video_ = true; 232 has_video_ = true;
230 video_track_id_ = track->header.track_id; 233 video_track_id_ = track->header.track_id;
231 } 234 }
232 } 235 }
233 236
234 // TODO(strobe): For now, we avoid sending new configs on a new 237 // TODO(strobe): For now, we avoid sending new configs on a new
235 // reinitialization segment, and instead simply embed the updated parameter 238 // reinitialization segment, and instead simply embed the updated parameter
236 // sets into the video stream. The conditional should be removed when 239 // sets into the video stream. The conditional should be removed when
237 // http://crbug.com/122913 is fixed. (We detect whether we've already sent 240 // http://crbug.com/122913 is fixed. (We detect whether we've already sent
238 // configs by looking at init_cb_ instead of config_cb_, because init_cb_ 241 // configs by looking at init_cb_ instead of config_cb_, because init_cb_
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 return !err; 459 return !err;
457 } 460 }
458 461
459 void MP4StreamParser::ChangeState(State new_state) { 462 void MP4StreamParser::ChangeState(State new_state) {
460 DVLOG(2) << "Changing state: " << new_state; 463 DVLOG(2) << "Changing state: " << new_state;
461 state_ = new_state; 464 state_ = new_state;
462 } 465 }
463 466
464 } // namespace mp4 467 } // namespace mp4
465 } // namespace media 468 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/pipeline_integration_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698