OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/formats/webm/webm_tracks_parser.h" | 5 #include "media/formats/webm/webm_tracks_parser.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 int64 mult = duration_in_ns / 1000; | 37 int64 mult = duration_in_ns / 1000; |
38 mult /= timecode_scale_in_us; | 38 mult /= timecode_scale_in_us; |
39 if (mult == 0) | 39 if (mult == 0) |
40 return kNoTimestamp(); | 40 return kNoTimestamp(); |
41 | 41 |
42 mult = static_cast<double>(mult) * timecode_scale_in_us; | 42 mult = static_cast<double>(mult) * timecode_scale_in_us; |
43 return base::TimeDelta::FromMicroseconds(mult); | 43 return base::TimeDelta::FromMicroseconds(mult); |
44 } | 44 } |
45 | 45 |
46 WebMTracksParser::WebMTracksParser(const LogCB& log_cb, bool ignore_text_tracks) | 46 WebMTracksParser::WebMTracksParser(const LogCB& log_cb, |
47 : track_type_(-1), | 47 bool ignore_text_tracks, |
| 48 bool live_mode) |
| 49 : live_mode_(live_mode), |
| 50 track_type_(-1), |
48 track_num_(-1), | 51 track_num_(-1), |
49 track_uid_(-1), | 52 track_uid_(-1), |
50 seek_preroll_(-1), | 53 seek_preroll_(-1), |
51 codec_delay_(-1), | 54 codec_delay_(-1), |
52 default_duration_(-1), | 55 default_duration_(-1), |
53 audio_track_num_(-1), | 56 audio_track_num_(-1), |
54 audio_default_duration_(-1), | 57 audio_default_duration_(-1), |
55 video_track_num_(-1), | 58 video_track_num_(-1), |
56 video_default_duration_(-1), | 59 video_default_duration_(-1), |
57 ignore_text_tracks_(ignore_text_tracks), | 60 ignore_text_tracks_(ignore_text_tracks), |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 224 |
222 if (default_duration_ == 0) { | 225 if (default_duration_ == 0) { |
223 MEDIA_LOG(log_cb_) << "Illegal 0ns video TrackEntry DefaultDuration"; | 226 MEDIA_LOG(log_cb_) << "Illegal 0ns video TrackEntry DefaultDuration"; |
224 return false; | 227 return false; |
225 } | 228 } |
226 video_default_duration_ = default_duration_; | 229 video_default_duration_ = default_duration_; |
227 | 230 |
228 DCHECK(!video_decoder_config_.IsValidConfig()); | 231 DCHECK(!video_decoder_config_.IsValidConfig()); |
229 if (!video_client_.InitializeConfig( | 232 if (!video_client_.InitializeConfig( |
230 codec_id_, codec_private_, !video_encryption_key_id_.empty(), | 233 codec_id_, codec_private_, !video_encryption_key_id_.empty(), |
231 &video_decoder_config_)) { | 234 live_mode_, &video_decoder_config_)) { |
232 return false; | 235 return false; |
233 } | 236 } |
234 } else { | 237 } else { |
235 MEDIA_LOG(log_cb_) << "Ignoring video track " << track_num_; | 238 MEDIA_LOG(log_cb_) << "Ignoring video track " << track_num_; |
236 ignored_tracks_.insert(track_num_); | 239 ignored_tracks_.insert(track_num_); |
237 } | 240 } |
238 } else if (track_type_ == kWebMTrackTypeSubtitlesOrCaptions || | 241 } else if (track_type_ == kWebMTrackTypeSubtitlesOrCaptions || |
239 track_type_ == kWebMTrackTypeDescriptionsOrMetadata) { | 242 track_type_ == kWebMTrackTypeDescriptionsOrMetadata) { |
240 if (ignore_text_tracks_) { | 243 if (ignore_text_tracks_) { |
241 MEDIA_LOG(log_cb_) << "Ignoring text track " << track_num_; | 244 MEDIA_LOG(log_cb_) << "Ignoring text track " << track_num_; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 344 |
342 if (id == kWebMIdLanguage) { | 345 if (id == kWebMIdLanguage) { |
343 track_language_ = str; | 346 track_language_ = str; |
344 return true; | 347 return true; |
345 } | 348 } |
346 | 349 |
347 return true; | 350 return true; |
348 } | 351 } |
349 | 352 |
350 } // namespace media | 353 } // namespace media |
OLD | NEW |