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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "media/base/audio_decoder_config.h" | 16 #include "media/base/audio_decoder_config.h" |
17 #include "media/base/media_log.h" | 17 #include "media/base/media_log.h" |
18 #include "media/base/text_track_config.h" | 18 #include "media/base/text_track_config.h" |
19 #include "media/base/video_decoder_config.h" | 19 #include "media/base/video_decoder_config.h" |
20 #include "media/formats/webm/webm_audio_client.h" | 20 #include "media/formats/webm/webm_audio_client.h" |
21 #include "media/formats/webm/webm_content_encodings_client.h" | 21 #include "media/formats/webm/webm_content_encodings_client.h" |
22 #include "media/formats/webm/webm_parser.h" | 22 #include "media/formats/webm/webm_parser.h" |
23 #include "media/formats/webm/webm_video_client.h" | 23 #include "media/formats/webm/webm_video_client.h" |
24 | 24 |
25 namespace media { | 25 namespace media { |
26 | 26 |
27 // Parser for WebM Tracks element. | 27 // Parser for WebM Tracks element. |
28 class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { | 28 class MEDIA_EXPORT WebMTracksParser : public WebMParserClient { |
29 public: | 29 public: |
30 explicit WebMTracksParser(const LogCB& log_cb, bool ignore_text_tracks); | 30 WebMTracksParser(const LogCB& log_cb, |
| 31 bool ignore_text_tracks, |
| 32 bool live_mode); |
31 virtual ~WebMTracksParser(); | 33 virtual ~WebMTracksParser(); |
32 | 34 |
33 // Parses a WebM Tracks element in |buf|. | 35 // Parses a WebM Tracks element in |buf|. |
34 // | 36 // |
35 // Returns -1 if the parse fails. | 37 // Returns -1 if the parse fails. |
36 // Returns 0 if more data is needed. | 38 // Returns 0 if more data is needed. |
37 // Returns the number of bytes parsed on success. | 39 // Returns the number of bytes parsed on success. |
38 int Parse(const uint8* buf, int size); | 40 int Parse(const uint8* buf, int size); |
39 | 41 |
40 int64 audio_track_num() const { return audio_track_num_; } | 42 int64 audio_track_num() const { return audio_track_num_; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 77 |
76 private: | 78 private: |
77 // WebMParserClient implementation. | 79 // WebMParserClient implementation. |
78 virtual WebMParserClient* OnListStart(int id) OVERRIDE; | 80 virtual WebMParserClient* OnListStart(int id) OVERRIDE; |
79 virtual bool OnListEnd(int id) OVERRIDE; | 81 virtual bool OnListEnd(int id) OVERRIDE; |
80 virtual bool OnUInt(int id, int64 val) OVERRIDE; | 82 virtual bool OnUInt(int id, int64 val) OVERRIDE; |
81 virtual bool OnFloat(int id, double val) OVERRIDE; | 83 virtual bool OnFloat(int id, double val) OVERRIDE; |
82 virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE; | 84 virtual bool OnBinary(int id, const uint8* data, int size) OVERRIDE; |
83 virtual bool OnString(int id, const std::string& str) OVERRIDE; | 85 virtual bool OnString(int id, const std::string& str) OVERRIDE; |
84 | 86 |
| 87 bool live_mode_; |
| 88 |
85 int64 track_type_; | 89 int64 track_type_; |
86 int64 track_num_; | 90 int64 track_num_; |
87 int64 track_uid_; | 91 int64 track_uid_; |
88 std::string track_name_; | 92 std::string track_name_; |
89 std::string track_language_; | 93 std::string track_language_; |
90 std::string codec_id_; | 94 std::string codec_id_; |
91 std::vector<uint8> codec_private_; | 95 std::vector<uint8> codec_private_; |
92 int64 seek_preroll_; | 96 int64 seek_preroll_; |
93 int64 codec_delay_; | 97 int64 codec_delay_; |
94 int64 default_duration_; | 98 int64 default_duration_; |
(...skipping 15 matching lines...) Expand all Loading... |
110 | 114 |
111 WebMVideoClient video_client_; | 115 WebMVideoClient video_client_; |
112 VideoDecoderConfig video_decoder_config_; | 116 VideoDecoderConfig video_decoder_config_; |
113 | 117 |
114 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); | 118 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); |
115 }; | 119 }; |
116 | 120 |
117 } // namespace media | 121 } // namespace media |
118 | 122 |
119 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ | 123 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ |
OLD | NEW |