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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "media/base/audio_decoder_config.h" | 19 #include "media/base/audio_decoder_config.h" |
20 #include "media/base/media_log.h" | 20 #include "media/base/media_log.h" |
| 21 #include "media/base/media_tracks.h" |
21 #include "media/base/text_track_config.h" | 22 #include "media/base/text_track_config.h" |
22 #include "media/base/video_decoder_config.h" | 23 #include "media/base/video_decoder_config.h" |
23 #include "media/formats/webm/webm_audio_client.h" | 24 #include "media/formats/webm/webm_audio_client.h" |
24 #include "media/formats/webm/webm_content_encodings_client.h" | 25 #include "media/formats/webm/webm_content_encodings_client.h" |
25 #include "media/formats/webm/webm_parser.h" | 26 #include "media/formats/webm/webm_parser.h" |
26 #include "media/formats/webm/webm_video_client.h" | 27 #include "media/formats/webm/webm_video_client.h" |
27 | 28 |
28 namespace media { | 29 namespace media { |
29 | 30 |
30 // Parser for WebM Tracks element. | 31 // Parser for WebM Tracks element. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 const VideoDecoderConfig& video_decoder_config() { | 71 const VideoDecoderConfig& video_decoder_config() { |
71 return video_decoder_config_; | 72 return video_decoder_config_; |
72 } | 73 } |
73 | 74 |
74 typedef std::map<int, TextTrackConfig> TextTracks; | 75 typedef std::map<int, TextTrackConfig> TextTracks; |
75 | 76 |
76 const TextTracks& text_tracks() const { | 77 const TextTracks& text_tracks() const { |
77 return text_tracks_; | 78 return text_tracks_; |
78 } | 79 } |
79 | 80 |
| 81 // Note: Calling media_tracks() method passes the ownership of the MediaTracks |
| 82 // object from WebMTracksParser to the caller (which is typically |
| 83 // WebMStreamParser object). So this method must be called only once, after |
| 84 // track parsing has been completed. |
| 85 scoped_ptr<MediaTracks> media_tracks() { |
| 86 CHECK(media_tracks_.get()); |
| 87 return std::move(media_tracks_); |
| 88 } |
| 89 |
80 private: | 90 private: |
81 // WebMParserClient implementation. | 91 // WebMParserClient implementation. |
82 WebMParserClient* OnListStart(int id) override; | 92 WebMParserClient* OnListStart(int id) override; |
83 bool OnListEnd(int id) override; | 93 bool OnListEnd(int id) override; |
84 bool OnUInt(int id, int64_t val) override; | 94 bool OnUInt(int id, int64_t val) override; |
85 bool OnFloat(int id, double val) override; | 95 bool OnFloat(int id, double val) override; |
86 bool OnBinary(int id, const uint8_t* data, int size) override; | 96 bool OnBinary(int id, const uint8_t* data, int size) override; |
87 bool OnString(int id, const std::string& str) override; | 97 bool OnString(int id, const std::string& str) override; |
88 | 98 |
89 int64_t track_type_; | 99 int64_t track_type_; |
(...skipping 17 matching lines...) Expand all Loading... |
107 std::string audio_encryption_key_id_; | 117 std::string audio_encryption_key_id_; |
108 std::string video_encryption_key_id_; | 118 std::string video_encryption_key_id_; |
109 scoped_refptr<MediaLog> media_log_; | 119 scoped_refptr<MediaLog> media_log_; |
110 | 120 |
111 WebMAudioClient audio_client_; | 121 WebMAudioClient audio_client_; |
112 AudioDecoderConfig audio_decoder_config_; | 122 AudioDecoderConfig audio_decoder_config_; |
113 | 123 |
114 WebMVideoClient video_client_; | 124 WebMVideoClient video_client_; |
115 VideoDecoderConfig video_decoder_config_; | 125 VideoDecoderConfig video_decoder_config_; |
116 | 126 |
| 127 scoped_ptr<MediaTracks> media_tracks_; |
| 128 |
117 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); | 129 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); |
118 }; | 130 }; |
119 | 131 |
120 } // namespace media | 132 } // namespace media |
121 | 133 |
122 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ | 134 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ |
OLD | NEW |