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