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 #ifndef MEDIA_WEBM_WEBM_TRACKS_PARSER_H_ | 5 #ifndef MEDIA_WEBM_WEBM_TRACKS_PARSER_H_ |
6 #define MEDIA_WEBM_WEBM_TRACKS_PARSER_H_ | 6 #define MEDIA_WEBM_WEBM_TRACKS_PARSER_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/time.h" | 12 #include "base/time.h" |
11 #include "media/webm/webm_content_encodings_client.h" | 13 #include "media/webm/webm_content_encodings_client.h" |
12 #include "media/webm/webm_parser.h" | 14 #include "media/webm/webm_parser.h" |
13 | 15 |
14 namespace media { | 16 namespace media { |
15 | 17 |
16 // Parser for WebM Tracks element. | 18 // Parser for WebM Tracks element. |
17 class WebMTracksParser : public WebMParserClient { | 19 class WebMTracksParser : public WebMParserClient { |
18 public: | 20 public: |
19 explicit WebMTracksParser(int64 timecode_scale); | 21 explicit WebMTracksParser(int64 timecode_scale); |
20 virtual ~WebMTracksParser(); | 22 virtual ~WebMTracksParser(); |
21 | 23 |
22 // Parses a WebM Tracks element in |buf|. | 24 // Parses a WebM Tracks element in |buf|. |
23 // | 25 // |
24 // Returns -1 if the parse fails. | 26 // Returns -1 if the parse fails. |
25 // Returns 0 if more data is needed. | 27 // Returns 0 if more data is needed. |
26 // Returns the number of bytes parsed on success. | 28 // Returns the number of bytes parsed on success. |
27 int Parse(const uint8* buf, int size); | 29 int Parse(const uint8* buf, int size); |
28 | 30 |
29 int64 audio_track_num() const { return audio_track_num_; } | 31 int64 audio_track_num() const { return audio_track_num_; } |
30 int64 video_track_num() const { return video_track_num_; } | 32 int64 video_track_num() const { return video_track_num_; } |
31 | 33 |
32 const uint8* video_encryption_key_id() const; | 34 const std::string& video_encryption_key_id() const; |
33 int video_encryption_key_id_size() const; | |
34 | 35 |
35 private: | 36 private: |
36 // WebMParserClient methods | 37 // WebMParserClient methods |
37 virtual WebMParserClient* OnListStart(int id) OVERRIDE; | 38 virtual WebMParserClient* OnListStart(int id) OVERRIDE; |
38 virtual bool OnListEnd(int id) OVERRIDE; | 39 virtual bool OnListEnd(int id) OVERRIDE; |
39 virtual bool OnUInt(int id, int64 val) OVERRIDE; | 40 virtual bool OnUInt(int id, int64 val) OVERRIDE; |
40 virtual bool OnFloat(int id, double val) OVERRIDE; | 41 virtual bool OnFloat(int id, double val) OVERRIDE; |
41 virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE; | 42 virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE; |
42 virtual bool OnString(int id, const std::string& str) OVERRIDE; | 43 virtual bool OnString(int id, const std::string& str) OVERRIDE; |
43 | 44 |
44 int64 timecode_scale_; | 45 int64 timecode_scale_; |
45 | 46 |
46 int64 track_type_; | 47 int64 track_type_; |
47 int64 track_num_; | 48 int64 track_num_; |
48 scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_; | 49 scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_; |
49 | 50 |
50 int64 audio_track_num_; | 51 int64 audio_track_num_; |
51 scoped_ptr<WebMContentEncodingsClient> audio_content_encodings_client_; | 52 scoped_ptr<WebMContentEncodingsClient> audio_content_encodings_client_; |
52 | 53 |
53 int64 video_track_num_; | 54 int64 video_track_num_; |
54 scoped_ptr<WebMContentEncodingsClient> video_content_encodings_client_; | 55 scoped_ptr<WebMContentEncodingsClient> video_content_encodings_client_; |
55 | 56 |
56 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMTracksParser); | 57 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMTracksParser); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace media | 60 } // namespace media |
60 | 61 |
61 #endif // MEDIA_WEBM_WEBM_TRACKS_PARSER_H_ | 62 #endif // MEDIA_WEBM_WEBM_TRACKS_PARSER_H_ |
OLD | NEW |