| 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 "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/buffers.h" | 11 #include "media/base/buffers.h" |
| 12 #include "media/base/byte_queue.h" | 12 #include "media/base/byte_queue.h" |
| 13 #include "media/base/stream_parser.h" | 13 #include "media/base/stream_parser.h" |
| 14 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
| 15 #include "media/webm/webm_cluster_parser.h" | 15 #include "media/webm/webm_cluster_parser.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 | 18 |
| 19 class WebMStreamParser : public StreamParser { | 19 class WebMStreamParser : public StreamParser { |
| 20 public: | 20 public: |
| 21 WebMStreamParser(); | 21 WebMStreamParser(); |
| 22 virtual ~WebMStreamParser(); | 22 virtual ~WebMStreamParser(); |
| 23 | 23 |
| 24 // StreamParser implementation. | 24 // StreamParser implementation. |
| 25 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, | 25 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
| 26 const NewBuffersCB& audio_cb, | 26 const NewBuffersCB& audio_cb, |
| 27 const NewBuffersCB& video_cb, | 27 const NewBuffersCB& video_cb, |
| 28 const NeedKeyCB& need_key_cb, | 28 const NeedKeyCB& need_key_cb, |
| 29 const NewMediaSegmentCB& new_segment_cb, | 29 const NewMediaSegmentCB& new_segment_cb, |
| 30 const base::Closure& end_of_segment_cb) OVERRIDE; | 30 const base::Closure& end_of_segment_cb, |
| 31 const LogCB& log_cb) OVERRIDE; |
| 31 virtual void Flush() OVERRIDE; | 32 virtual void Flush() OVERRIDE; |
| 32 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 33 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 enum State { | 36 enum State { |
| 36 kWaitingForInit, | 37 kWaitingForInit, |
| 37 kParsingHeaders, | 38 kParsingHeaders, |
| 38 kParsingClusters, | 39 kParsingClusters, |
| 39 kError | 40 kError |
| 40 }; | 41 }; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 void FireNeedKey(const std::string& key_id); | 65 void FireNeedKey(const std::string& key_id); |
| 65 | 66 |
| 66 State state_; | 67 State state_; |
| 67 InitCB init_cb_; | 68 InitCB init_cb_; |
| 68 NewConfigCB config_cb_; | 69 NewConfigCB config_cb_; |
| 69 NewBuffersCB audio_cb_; | 70 NewBuffersCB audio_cb_; |
| 70 NewBuffersCB video_cb_; | 71 NewBuffersCB video_cb_; |
| 71 NeedKeyCB need_key_cb_; | 72 NeedKeyCB need_key_cb_; |
| 72 NewMediaSegmentCB new_segment_cb_; | 73 NewMediaSegmentCB new_segment_cb_; |
| 73 base::Closure end_of_segment_cb_; | 74 base::Closure end_of_segment_cb_; |
| 75 LogCB log_cb_; |
| 74 | 76 |
| 75 // True if a new cluster id has been seen, but no audio or video buffers have | 77 // True if a new cluster id has been seen, but no audio or video buffers have |
| 76 // been parsed yet. | 78 // been parsed yet. |
| 77 bool waiting_for_buffers_; | 79 bool waiting_for_buffers_; |
| 78 | 80 |
| 79 scoped_ptr<WebMClusterParser> cluster_parser_; | 81 scoped_ptr<WebMClusterParser> cluster_parser_; |
| 80 ByteQueue byte_queue_; | 82 ByteQueue byte_queue_; |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); | 84 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 } // namespace media | 87 } // namespace media |
| 86 | 88 |
| 87 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ | 89 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ |
| OLD | NEW |