OLD | NEW |
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/time.h" | 10 #include "base/time/time.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 base::TimeDelta()); | 261 base::TimeDelta()); |
262 has_audio_ = true; | 262 has_audio_ = true; |
263 audio_track_id_ = track->header.track_id; | 263 audio_track_id_ = track->header.track_id; |
264 } | 264 } |
265 if (track->media.handler.type == kVideo && !video_config.IsValidConfig()) { | 265 if (track->media.handler.type == kVideo && !video_config.IsValidConfig()) { |
266 RCHECK(!samp_descr.video_entries.empty()); | 266 RCHECK(!samp_descr.video_entries.empty()); |
267 if (desc_idx >= samp_descr.video_entries.size()) | 267 if (desc_idx >= samp_descr.video_entries.size()) |
268 desc_idx = 0; | 268 desc_idx = 0; |
269 const VideoSampleEntry& entry = samp_descr.video_entries[desc_idx]; | 269 const VideoSampleEntry& entry = samp_descr.video_entries[desc_idx]; |
270 | 270 |
271 if (!(entry.format == FOURCC_AVC1 || | 271 if (!entry.IsFormatValid()) { |
272 (entry.format == FOURCC_ENCV && | |
273 entry.sinf.format.format == FOURCC_AVC1))) { | |
274 MEDIA_LOG(log_cb_) << "Unsupported video format 0x" | 272 MEDIA_LOG(log_cb_) << "Unsupported video format 0x" |
275 << std::hex << entry.format << " in stsd box."; | 273 << std::hex << entry.format << " in stsd box."; |
276 return false; | 274 return false; |
277 } | 275 } |
278 | 276 |
279 // TODO(strobe): Recover correct crop box | 277 // TODO(strobe): Recover correct crop box |
280 gfx::Size coded_size(entry.width, entry.height); | 278 gfx::Size coded_size(entry.width, entry.height); |
281 gfx::Rect visible_rect(coded_size); | 279 gfx::Rect visible_rect(coded_size); |
282 gfx::Size natural_size = GetNaturalSize(visible_rect.size(), | 280 gfx::Size natural_size = GetNaturalSize(visible_rect.size(), |
283 entry.pixel_aspect.h_spacing, | 281 entry.pixel_aspect.h_spacing, |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return !err; | 567 return !err; |
570 } | 568 } |
571 | 569 |
572 void MP4StreamParser::ChangeState(State new_state) { | 570 void MP4StreamParser::ChangeState(State new_state) { |
573 DVLOG(2) << "Changing state: " << new_state; | 571 DVLOG(2) << "Changing state: " << new_state; |
574 state_ = new_state; | 572 state_ = new_state; |
575 } | 573 } |
576 | 574 |
577 } // namespace mp4 | 575 } // namespace mp4 |
578 } // namespace media | 576 } // namespace media |
OLD | NEW |