OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_INFO_PARSER_H_ | 5 #ifndef MEDIA_WEBM_WEBM_INFO_PARSER_H_ |
6 #define MEDIA_WEBM_WEBM_INFO_PARSER_H_ | 6 #define MEDIA_WEBM_WEBM_INFO_PARSER_H_ |
7 | 7 |
| 8 #include "base/compiler_specific.h" |
8 #include "media/webm/webm_parser.h" | 9 #include "media/webm/webm_parser.h" |
9 | 10 |
10 namespace media { | 11 namespace media { |
11 | 12 |
12 // Parser for WebM Info element. | 13 // Parser for WebM Info element. |
13 class WebMInfoParser : public WebMParserClient { | 14 class WebMInfoParser : public WebMParserClient { |
14 public: | 15 public: |
15 WebMInfoParser(); | 16 WebMInfoParser(); |
16 virtual ~WebMInfoParser(); | 17 virtual ~WebMInfoParser(); |
17 | 18 |
18 // Parses a WebM Info element in |buf|. | 19 // Parses a WebM Info element in |buf|. |
19 // | 20 // |
20 // Returns -1 if the parse fails. | 21 // Returns -1 if the parse fails. |
21 // Returns 0 if more data is needed. | 22 // Returns 0 if more data is needed. |
22 // Returns the number of bytes parsed on success. | 23 // Returns the number of bytes parsed on success. |
23 int Parse(const uint8* buf, int size); | 24 int Parse(const uint8* buf, int size); |
24 | 25 |
25 int64 timecode_scale() const { return timecode_scale_; } | 26 int64 timecode_scale() const { return timecode_scale_; } |
26 double duration() const { return duration_; } | 27 double duration() const { return duration_; } |
27 | 28 |
28 private: | 29 private: |
29 // WebMParserClient methods | 30 // WebMParserClient methods |
30 virtual bool OnListStart(int id); | 31 virtual bool OnListStart(int id) OVERRIDE; |
31 virtual bool OnListEnd(int id); | 32 virtual bool OnListEnd(int id) OVERRIDE; |
32 virtual bool OnUInt(int id, int64 val); | 33 virtual bool OnUInt(int id, int64 val) OVERRIDE; |
33 virtual bool OnFloat(int id, double val); | 34 virtual bool OnFloat(int id, double val) OVERRIDE; |
34 virtual bool OnBinary(int id, const uint8* data, int size); | 35 virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE; |
35 virtual bool OnString(int id, const std::string& str); | 36 virtual bool OnString(int id, const std::string& str) OVERRIDE; |
36 virtual bool OnSimpleBlock(int track_num, int timecode, int flags, | 37 virtual bool OnSimpleBlock(int track_num, int timecode, int flags, |
37 const uint8* data, int size); | 38 const uint8* data, int size) OVERRIDE; |
38 | 39 |
39 int64 timecode_scale_; | 40 int64 timecode_scale_; |
40 double duration_; | 41 double duration_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(WebMInfoParser); | 43 DISALLOW_COPY_AND_ASSIGN(WebMInfoParser); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace media | 46 } // namespace media |
46 | 47 |
47 #endif // MEDIA_WEBM_WEBM_INFO_PARSER_H_ | 48 #endif // MEDIA_WEBM_WEBM_INFO_PARSER_H_ |
OLD | NEW |