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