Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBM_WEBM_STREAM_PARSER_H_ | 5 #ifndef MEDIA_WEBM_WEBM_STREAM_PARSER_H_ |
| 6 #define MEDIA_WEBM_WEBM_STREAM_PARSER_H_ | 6 #define MEDIA_WEBM_WEBM_STREAM_PARSER_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 11 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 12 #include "media/base/audio_decoder_config.h" | 10 #include "media/base/audio_decoder_config.h" |
| 13 #include "media/base/buffers.h" | 11 #include "media/base/buffers.h" |
| 14 #include "media/base/byte_queue.h" | 12 #include "media/base/byte_queue.h" |
| 15 #include "media/base/stream_parser.h" | 13 #include "media/base/stream_parser.h" |
| 16 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
| 17 | 15 |
| 18 namespace media { | 16 namespace media { |
| 19 | 17 |
| 20 class WebMClusterParser; | 18 class WebMClusterParser; |
| 21 | 19 |
| 22 class WebMStreamParser : public StreamParser { | 20 class WebMStreamParser : public StreamParser { |
| 23 public: | 21 public: |
| 24 WebMStreamParser(); | 22 WebMStreamParser(); |
| 25 virtual ~WebMStreamParser(); | 23 virtual ~WebMStreamParser(); |
| 26 | 24 |
| 27 // StreamParser implementation. | 25 // StreamParser implementation. |
| 28 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, | 26 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
| 29 const NewBuffersCB& new_buffers_cb, | 27 const NewBuffersCB& new_buffers_cb, |
| 30 const NewTextBuffersCB& text_cb, | 28 const NewTextBuffersCB& text_cb, |
| 31 const NeedKeyCB& need_key_cb, | 29 const NeedKeyCB& need_key_cb, |
| 32 const AddTextTrackCB& add_text_track_cb, | 30 bool enable_text_tracks, |
|
acolwell GONE FROM CHROMIUM
2013/10/24 18:57:51
WDYT about just making text_cb null if text tracks
Matthew Heaney (Chromium)
2013/10/25 03:05:38
Done.
| |
| 33 const NewMediaSegmentCB& new_segment_cb, | 31 const NewMediaSegmentCB& new_segment_cb, |
| 34 const base::Closure& end_of_segment_cb, | 32 const base::Closure& end_of_segment_cb, |
| 35 const LogCB& log_cb) OVERRIDE; | 33 const LogCB& log_cb) OVERRIDE; |
| 36 virtual void Flush() OVERRIDE; | 34 virtual void Flush() OVERRIDE; |
| 37 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 35 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
| 38 | 36 |
| 39 private: | 37 private: |
| 40 enum State { | 38 enum State { |
| 41 kWaitingForInit, | 39 kWaitingForInit, |
| 42 kParsingHeaders, | 40 kParsingHeaders, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 67 | 65 |
| 68 // Fire needkey event through the |need_key_cb_|. | 66 // Fire needkey event through the |need_key_cb_|. |
| 69 void FireNeedKey(const std::string& key_id); | 67 void FireNeedKey(const std::string& key_id); |
| 70 | 68 |
| 71 State state_; | 69 State state_; |
| 72 InitCB init_cb_; | 70 InitCB init_cb_; |
| 73 NewConfigCB config_cb_; | 71 NewConfigCB config_cb_; |
| 74 NewBuffersCB new_buffers_cb_; | 72 NewBuffersCB new_buffers_cb_; |
| 75 NewTextBuffersCB text_cb_; | 73 NewTextBuffersCB text_cb_; |
| 76 NeedKeyCB need_key_cb_; | 74 NeedKeyCB need_key_cb_; |
| 77 AddTextTrackCB add_text_track_cb_; | 75 bool enable_text_tracks_; |
| 78 | |
| 79 typedef std::map<int, TextTrack* > TextTrackMap; | |
| 80 TextTrackMap text_track_map_; | |
| 81 | 76 |
| 82 NewMediaSegmentCB new_segment_cb_; | 77 NewMediaSegmentCB new_segment_cb_; |
| 83 base::Closure end_of_segment_cb_; | 78 base::Closure end_of_segment_cb_; |
| 84 LogCB log_cb_; | 79 LogCB log_cb_; |
| 85 | 80 |
| 86 // True if a new cluster id has been seen, but no audio or video buffers have | 81 // True if a new cluster id has been seen, but no audio or video buffers have |
| 87 // been parsed yet. | 82 // been parsed yet. |
| 88 bool waiting_for_buffers_; | 83 bool waiting_for_buffers_; |
| 89 | 84 |
| 90 scoped_ptr<WebMClusterParser> cluster_parser_; | 85 scoped_ptr<WebMClusterParser> cluster_parser_; |
| 91 ByteQueue byte_queue_; | 86 ByteQueue byte_queue_; |
| 92 | 87 |
| 93 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); | 88 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); |
| 94 }; | 89 }; |
| 95 | 90 |
| 96 } // namespace media | 91 } // namespace media |
| 97 | 92 |
| 98 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ | 93 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ |
| OLD | NEW |