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_STREAM_PARSER_H_ | 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_STREAM_PARSER_H_ |
6 #define MEDIA_FORMATS_WEBM_WEBM_STREAM_PARSER_H_ | 6 #define MEDIA_FORMATS_WEBM_WEBM_STREAM_PARSER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
11 #include "media/base/byte_queue.h" | 11 #include "media/base/byte_queue.h" |
12 #include "media/base/stream_parser.h" | 12 #include "media/base/stream_parser.h" |
13 #include "media/base/video_decoder_config.h" | 13 #include "media/base/video_decoder_config.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 class WebMClusterParser; | 17 class WebMClusterParser; |
18 | 18 |
19 class WebMStreamParser : public StreamParser { | 19 class WebMStreamParser : public StreamParser { |
20 public: | 20 public: |
21 WebMStreamParser(); | 21 WebMStreamParser(); |
22 ~WebMStreamParser() override; | 22 ~WebMStreamParser() override; |
23 | 23 |
24 // StreamParser implementation. | 24 // StreamParser implementation. |
25 void Init(const InitCB& init_cb, | 25 void Init(const InitCB& init_cb, |
26 const NewConfigCB& config_cb, | 26 const NewConfigCB& config_cb, |
27 const NewBuffersCB& new_buffers_cb, | 27 const NewBuffersCB& new_buffers_cb, |
28 bool ignore_text_tracks, | 28 bool ignore_text_tracks, |
29 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 29 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
30 const NewMediaSegmentCB& new_segment_cb, | 30 const base::Closure& start_of_segment_cb, |
31 const base::Closure& end_of_segment_cb, | 31 const base::Closure& end_of_segment_cb, |
32 const scoped_refptr<MediaLog>& media_log) override; | 32 const scoped_refptr<MediaLog>& media_log) override; |
33 void Flush() override; | 33 void Flush() override; |
34 bool Parse(const uint8* buf, int size) override; | 34 bool Parse(const uint8* buf, int size) override; |
35 | 35 |
36 private: | 36 private: |
37 enum State { | 37 enum State { |
38 kWaitingForInit, | 38 kWaitingForInit, |
39 kParsingHeaders, | 39 kParsingHeaders, |
40 kParsingClusters, | 40 kParsingClusters, |
(...skipping 24 matching lines...) Expand all Loading... |
65 // Fire needkey event through the |encrypted_media_init_data_cb_|. | 65 // Fire needkey event through the |encrypted_media_init_data_cb_|. |
66 void OnEncryptedMediaInitData(const std::string& key_id); | 66 void OnEncryptedMediaInitData(const std::string& key_id); |
67 | 67 |
68 State state_; | 68 State state_; |
69 InitCB init_cb_; | 69 InitCB init_cb_; |
70 NewConfigCB config_cb_; | 70 NewConfigCB config_cb_; |
71 NewBuffersCB new_buffers_cb_; | 71 NewBuffersCB new_buffers_cb_; |
72 bool ignore_text_tracks_; | 72 bool ignore_text_tracks_; |
73 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; | 73 EncryptedMediaInitDataCB encrypted_media_init_data_cb_; |
74 | 74 |
75 NewMediaSegmentCB new_segment_cb_; | 75 base::Closure start_of_segment_cb_; |
76 base::Closure end_of_segment_cb_; | 76 base::Closure end_of_segment_cb_; |
77 scoped_refptr<MediaLog> media_log_; | 77 scoped_refptr<MediaLog> media_log_; |
78 | 78 |
79 bool unknown_segment_size_; | 79 bool unknown_segment_size_; |
80 | 80 |
81 scoped_ptr<WebMClusterParser> cluster_parser_; | 81 scoped_ptr<WebMClusterParser> cluster_parser_; |
82 ByteQueue byte_queue_; | 82 ByteQueue byte_queue_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); | 84 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); |
85 }; | 85 }; |
86 | 86 |
87 } // namespace media | 87 } // namespace media |
88 | 88 |
89 #endif // MEDIA_FORMATS_WEBM_WEBM_STREAM_PARSER_H_ | 89 #endif // MEDIA_FORMATS_WEBM_WEBM_STREAM_PARSER_H_ |
OLD | NEW |