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