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_TRACKS_PARSER_H_ | 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ |
6 #define MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ | 6 #define MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 WebMTracksParser(const scoped_refptr<MediaLog>& media_log, | 30 WebMTracksParser(const scoped_refptr<MediaLog>& media_log, |
31 bool ignore_text_tracks); | 31 bool ignore_text_tracks); |
32 ~WebMTracksParser() override; | 32 ~WebMTracksParser() override; |
33 | 33 |
34 // Parses a WebM Tracks element in |buf|. | 34 // Parses a WebM Tracks element in |buf|. |
35 // | 35 // |
36 // Returns -1 if the parse fails. | 36 // Returns -1 if the parse fails. |
37 // Returns 0 if more data is needed. | 37 // Returns 0 if more data is needed. |
38 // Returns the number of bytes parsed on success. | 38 // Returns the number of bytes parsed on success. |
39 int Parse(const uint8* buf, int size); | 39 int Parse(const uint8_t* buf, int size); |
40 | 40 |
41 int64 audio_track_num() const { return audio_track_num_; } | 41 int64_t audio_track_num() const { return audio_track_num_; } |
42 int64 video_track_num() const { return video_track_num_; } | 42 int64_t video_track_num() const { return video_track_num_; } |
43 | 43 |
44 // If TrackEntry DefaultDuration field existed for the associated audio or | 44 // If TrackEntry DefaultDuration field existed for the associated audio or |
45 // video track, returns that value converted from ns to base::TimeDelta with | 45 // video track, returns that value converted from ns to base::TimeDelta with |
46 // precision not greater than |timecode_scale_in_us|. Defaults to | 46 // precision not greater than |timecode_scale_in_us|. Defaults to |
47 // kNoTimestamp(). | 47 // kNoTimestamp(). |
48 base::TimeDelta GetAudioDefaultDuration( | 48 base::TimeDelta GetAudioDefaultDuration( |
49 const double timecode_scale_in_us) const; | 49 const double timecode_scale_in_us) const; |
50 base::TimeDelta GetVideoDefaultDuration( | 50 base::TimeDelta GetVideoDefaultDuration( |
51 const double timecode_scale_in_us) const; | 51 const double timecode_scale_in_us) const; |
52 | 52 |
53 const std::set<int64>& ignored_tracks() const { return ignored_tracks_; } | 53 const std::set<int64_t>& ignored_tracks() const { return ignored_tracks_; } |
54 | 54 |
55 const std::string& audio_encryption_key_id() const { | 55 const std::string& audio_encryption_key_id() const { |
56 return audio_encryption_key_id_; | 56 return audio_encryption_key_id_; |
57 } | 57 } |
58 | 58 |
59 const AudioDecoderConfig& audio_decoder_config() { | 59 const AudioDecoderConfig& audio_decoder_config() { |
60 return audio_decoder_config_; | 60 return audio_decoder_config_; |
61 } | 61 } |
62 | 62 |
63 const std::string& video_encryption_key_id() const { | 63 const std::string& video_encryption_key_id() const { |
64 return video_encryption_key_id_; | 64 return video_encryption_key_id_; |
65 } | 65 } |
66 | 66 |
67 const VideoDecoderConfig& video_decoder_config() { | 67 const VideoDecoderConfig& video_decoder_config() { |
68 return video_decoder_config_; | 68 return video_decoder_config_; |
69 } | 69 } |
70 | 70 |
71 typedef std::map<int, TextTrackConfig> TextTracks; | 71 typedef std::map<int, TextTrackConfig> TextTracks; |
72 | 72 |
73 const TextTracks& text_tracks() const { | 73 const TextTracks& text_tracks() const { |
74 return text_tracks_; | 74 return text_tracks_; |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 // WebMParserClient implementation. | 78 // WebMParserClient implementation. |
79 WebMParserClient* OnListStart(int id) override; | 79 WebMParserClient* OnListStart(int id) override; |
80 bool OnListEnd(int id) override; | 80 bool OnListEnd(int id) override; |
81 bool OnUInt(int id, int64 val) override; | 81 bool OnUInt(int id, int64_t val) override; |
82 bool OnFloat(int id, double val) override; | 82 bool OnFloat(int id, double val) override; |
83 bool OnBinary(int id, const uint8* data, int size) override; | 83 bool OnBinary(int id, const uint8_t* data, int size) override; |
84 bool OnString(int id, const std::string& str) override; | 84 bool OnString(int id, const std::string& str) override; |
85 | 85 |
86 int64 track_type_; | 86 int64_t track_type_; |
87 int64 track_num_; | 87 int64_t track_num_; |
88 std::string track_name_; | 88 std::string track_name_; |
89 std::string track_language_; | 89 std::string track_language_; |
90 std::string codec_id_; | 90 std::string codec_id_; |
91 std::vector<uint8> codec_private_; | 91 std::vector<uint8_t> codec_private_; |
92 int64 seek_preroll_; | 92 int64_t seek_preroll_; |
93 int64 codec_delay_; | 93 int64_t codec_delay_; |
94 int64 default_duration_; | 94 int64_t default_duration_; |
95 scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_; | 95 scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_; |
96 | 96 |
97 int64 audio_track_num_; | 97 int64_t audio_track_num_; |
98 int64 audio_default_duration_; | 98 int64_t audio_default_duration_; |
99 int64 video_track_num_; | 99 int64_t video_track_num_; |
100 int64 video_default_duration_; | 100 int64_t video_default_duration_; |
101 bool ignore_text_tracks_; | 101 bool ignore_text_tracks_; |
102 TextTracks text_tracks_; | 102 TextTracks text_tracks_; |
103 std::set<int64> ignored_tracks_; | 103 std::set<int64_t> ignored_tracks_; |
104 std::string audio_encryption_key_id_; | 104 std::string audio_encryption_key_id_; |
105 std::string video_encryption_key_id_; | 105 std::string video_encryption_key_id_; |
106 scoped_refptr<MediaLog> media_log_; | 106 scoped_refptr<MediaLog> media_log_; |
107 | 107 |
108 WebMAudioClient audio_client_; | 108 WebMAudioClient audio_client_; |
109 AudioDecoderConfig audio_decoder_config_; | 109 AudioDecoderConfig audio_decoder_config_; |
110 | 110 |
111 WebMVideoClient video_client_; | 111 WebMVideoClient video_client_; |
112 VideoDecoderConfig video_decoder_config_; | 112 VideoDecoderConfig video_decoder_config_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); | 114 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); |
115 }; | 115 }; |
116 | 116 |
117 } // namespace media | 117 } // namespace media |
118 | 118 |
119 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ | 119 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ |
OLD | NEW |