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/webm/webm_tracks_parser.h" | 5 #include "media/webm/webm_tracks_parser.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "media/base/buffers.h" | 9 #include "media/base/buffers.h" |
10 #include "media/webm/webm_constants.h" | 10 #include "media/webm/webm_constants.h" |
11 #include "media/webm/webm_content_encodings.h" | 11 #include "media/webm/webm_content_encodings.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 // Values for TrackType element. | 15 // Values for TrackType element. |
16 static const int kWebMTrackTypeVideo = 1; | 16 static const int kWebMTrackTypeVideo = 1; |
17 static const int kWebMTrackTypeAudio = 2; | 17 static const int kWebMTrackTypeAudio = 2; |
18 | 18 |
19 WebMTracksParser::WebMTracksParser() | 19 WebMTracksParser::WebMTracksParser() |
20 : track_type_(-1), | 20 : track_type_(-1), |
21 track_num_(-1), | 21 track_num_(-1), |
22 audio_track_num_(-1), | 22 audio_track_num_(-1), |
23 video_track_num_(-1) { | 23 video_track_num_(-1) { |
24 } | 24 } |
25 | 25 |
26 WebMTracksParser::~WebMTracksParser() {} | 26 WebMTracksParser::~WebMTracksParser() {} |
27 | 27 |
28 const std::string& WebMTracksParser::audio_encryption_key_id() const { | |
29 if (!audio_content_encodings_client_.get()) | |
30 return EmptyString(); | |
31 | |
32 DCHECK(!audio_content_encodings_client_->content_encodings().empty()); | |
33 return audio_content_encodings_client_->content_encodings()[0]-> | |
acolwell GONE FROM CHROMIUM
2012/10/10 16:00:06
If you only ever use the first encoding, why don't
xhwang
2012/10/11 00:49:41
Done.
| |
34 encryption_key_id(); | |
35 } | |
36 | |
28 const std::string& WebMTracksParser::video_encryption_key_id() const { | 37 const std::string& WebMTracksParser::video_encryption_key_id() const { |
29 if (!video_content_encodings_client_.get()) | 38 if (!video_content_encodings_client_.get()) |
30 return EmptyString(); | 39 return EmptyString(); |
31 | 40 |
32 DCHECK(!video_content_encodings_client_->content_encodings().empty()); | 41 DCHECK(!video_content_encodings_client_->content_encodings().empty()); |
33 return video_content_encodings_client_->content_encodings()[0]-> | 42 return video_content_encodings_client_->content_encodings()[0]-> |
acolwell GONE FROM CHROMIUM
2012/10/10 16:00:06
ditto
xhwang
2012/10/11 00:49:41
Done.
| |
34 encryption_key_id(); | 43 encryption_key_id(); |
35 } | 44 } |
36 | 45 |
37 int WebMTracksParser::Parse(const uint8* buf, int size) { | 46 int WebMTracksParser::Parse(const uint8* buf, int size) { |
38 track_type_ =-1; | 47 track_type_ =-1; |
39 track_num_ = -1; | 48 track_num_ = -1; |
40 audio_track_num_ = -1; | 49 audio_track_num_ = -1; |
41 video_track_num_ = -1; | 50 video_track_num_ = -1; |
42 | 51 |
43 WebMListParser parser(kWebMIdTracks, this); | 52 WebMListParser parser(kWebMIdTracks, this); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 bool WebMTracksParser::OnString(int id, const std::string& str) { | 150 bool WebMTracksParser::OnString(int id, const std::string& str) { |
142 if (id == kWebMIdCodecID && str != "A_VORBIS" && str != "V_VP8") { | 151 if (id == kWebMIdCodecID && str != "A_VORBIS" && str != "V_VP8") { |
143 DVLOG(1) << "Unexpected CodecID " << str; | 152 DVLOG(1) << "Unexpected CodecID " << str; |
144 return false; | 153 return false; |
145 } | 154 } |
146 | 155 |
147 return true; | 156 return true; |
148 } | 157 } |
149 | 158 |
150 } // namespace media | 159 } // namespace media |
OLD | NEW |