| 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 <memory> |
| 11 #include <set> | 12 #include <set> |
| 12 #include <string> | 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.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/media_tracks.h" |
| 22 #include "media/base/text_track_config.h" | 22 #include "media/base/text_track_config.h" |
| 23 #include "media/base/video_decoder_config.h" | 23 #include "media/base/video_decoder_config.h" |
| 24 #include "media/formats/webm/webm_audio_client.h" | 24 #include "media/formats/webm/webm_audio_client.h" |
| 25 #include "media/formats/webm/webm_content_encodings_client.h" | 25 #include "media/formats/webm/webm_content_encodings_client.h" |
| 26 #include "media/formats/webm/webm_parser.h" | 26 #include "media/formats/webm/webm_parser.h" |
| 27 #include "media/formats/webm/webm_video_client.h" | 27 #include "media/formats/webm/webm_video_client.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 int detected_audio_track_count() const { return detected_audio_track_count_; } | 81 int detected_audio_track_count() const { return detected_audio_track_count_; } |
| 82 | 82 |
| 83 int detected_video_track_count() const { return detected_video_track_count_; } | 83 int detected_video_track_count() const { return detected_video_track_count_; } |
| 84 | 84 |
| 85 int detected_text_track_count() const { return detected_text_track_count_; } | 85 int detected_text_track_count() const { return detected_text_track_count_; } |
| 86 | 86 |
| 87 // Note: Calling media_tracks() method passes the ownership of the MediaTracks | 87 // Note: Calling media_tracks() method passes the ownership of the MediaTracks |
| 88 // object from WebMTracksParser to the caller (which is typically | 88 // object from WebMTracksParser to the caller (which is typically |
| 89 // WebMStreamParser object). So this method must be called only once, after | 89 // WebMStreamParser object). So this method must be called only once, after |
| 90 // track parsing has been completed. | 90 // track parsing has been completed. |
| 91 scoped_ptr<MediaTracks> media_tracks() { | 91 std::unique_ptr<MediaTracks> media_tracks() { |
| 92 CHECK(media_tracks_.get()); | 92 CHECK(media_tracks_.get()); |
| 93 return std::move(media_tracks_); | 93 return std::move(media_tracks_); |
| 94 } | 94 } |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 void Reset(); | 97 void Reset(); |
| 98 void ResetTrackEntry(); | 98 void ResetTrackEntry(); |
| 99 | 99 |
| 100 // WebMParserClient implementation. | 100 // WebMParserClient implementation. |
| 101 WebMParserClient* OnListStart(int id) override; | 101 WebMParserClient* OnListStart(int id) override; |
| 102 bool OnListEnd(int id) override; | 102 bool OnListEnd(int id) override; |
| 103 bool OnUInt(int id, int64_t val) override; | 103 bool OnUInt(int id, int64_t val) override; |
| 104 bool OnFloat(int id, double val) override; | 104 bool OnFloat(int id, double val) override; |
| 105 bool OnBinary(int id, const uint8_t* data, int size) override; | 105 bool OnBinary(int id, const uint8_t* data, int size) override; |
| 106 bool OnString(int id, const std::string& str) override; | 106 bool OnString(int id, const std::string& str) override; |
| 107 | 107 |
| 108 bool reset_on_next_parse_; | 108 bool reset_on_next_parse_; |
| 109 int64_t track_type_; | 109 int64_t track_type_; |
| 110 int64_t track_num_; | 110 int64_t track_num_; |
| 111 std::string track_name_; | 111 std::string track_name_; |
| 112 std::string track_language_; | 112 std::string track_language_; |
| 113 std::string codec_id_; | 113 std::string codec_id_; |
| 114 std::vector<uint8_t> codec_private_; | 114 std::vector<uint8_t> codec_private_; |
| 115 int64_t seek_preroll_; | 115 int64_t seek_preroll_; |
| 116 int64_t codec_delay_; | 116 int64_t codec_delay_; |
| 117 int64_t default_duration_; | 117 int64_t default_duration_; |
| 118 scoped_ptr<WebMContentEncodingsClient> track_content_encodings_client_; | 118 std::unique_ptr<WebMContentEncodingsClient> track_content_encodings_client_; |
| 119 | 119 |
| 120 int64_t audio_track_num_; | 120 int64_t audio_track_num_; |
| 121 int64_t audio_default_duration_; | 121 int64_t audio_default_duration_; |
| 122 int64_t video_track_num_; | 122 int64_t video_track_num_; |
| 123 int64_t video_default_duration_; | 123 int64_t video_default_duration_; |
| 124 bool ignore_text_tracks_; | 124 bool ignore_text_tracks_; |
| 125 TextTracks text_tracks_; | 125 TextTracks text_tracks_; |
| 126 std::set<int64_t> ignored_tracks_; | 126 std::set<int64_t> ignored_tracks_; |
| 127 std::string audio_encryption_key_id_; | 127 std::string audio_encryption_key_id_; |
| 128 std::string video_encryption_key_id_; | 128 std::string video_encryption_key_id_; |
| 129 scoped_refptr<MediaLog> media_log_; | 129 scoped_refptr<MediaLog> media_log_; |
| 130 | 130 |
| 131 WebMAudioClient audio_client_; | 131 WebMAudioClient audio_client_; |
| 132 AudioDecoderConfig audio_decoder_config_; | 132 AudioDecoderConfig audio_decoder_config_; |
| 133 | 133 |
| 134 WebMVideoClient video_client_; | 134 WebMVideoClient video_client_; |
| 135 VideoDecoderConfig video_decoder_config_; | 135 VideoDecoderConfig video_decoder_config_; |
| 136 | 136 |
| 137 int detected_audio_track_count_; | 137 int detected_audio_track_count_; |
| 138 int detected_video_track_count_; | 138 int detected_video_track_count_; |
| 139 int detected_text_track_count_; | 139 int detected_text_track_count_; |
| 140 scoped_ptr<MediaTracks> media_tracks_; | 140 std::unique_ptr<MediaTracks> media_tracks_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); | 142 DISALLOW_COPY_AND_ASSIGN(WebMTracksParser); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace media | 145 } // namespace media |
| 146 | 146 |
| 147 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ | 147 #endif // MEDIA_FORMATS_WEBM_WEBM_TRACKS_PARSER_H_ |
| OLD | NEW |