| 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, StreamParserHost* host) OVERRIDE; | 25 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, |
| 26 const NewBuffersCB& audio_cb, |
| 27 const NewBuffersCB& video_cb) OVERRIDE; |
| 26 virtual void Flush() OVERRIDE; | 28 virtual void Flush() OVERRIDE; |
| 27 virtual bool Parse(const uint8* buf, int size) OVERRIDE; | 29 virtual bool Parse(const uint8* buf, int size) OVERRIDE; |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 enum State { | 32 enum State { |
| 31 kWaitingForInit, | 33 kWaitingForInit, |
| 32 kParsingHeaders, | 34 kParsingHeaders, |
| 33 kParsingClusters, | 35 kParsingClusters, |
| 34 kError | 36 kError |
| 35 }; | 37 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 // CUES elements if they are encountered since we currently don't use the | 52 // CUES elements if they are encountered since we currently don't use the |
| 51 // data in these elements. | 53 // data in these elements. |
| 52 // | 54 // |
| 53 // Returns < 0 if the parse fails. | 55 // Returns < 0 if the parse fails. |
| 54 // Returns 0 if more data is needed. | 56 // Returns 0 if more data is needed. |
| 55 // Returning > 0 indicates success & the number of bytes parsed. | 57 // Returning > 0 indicates success & the number of bytes parsed. |
| 56 int ParseCluster(const uint8* data, int size); | 58 int ParseCluster(const uint8* data, int size); |
| 57 | 59 |
| 58 State state_; | 60 State state_; |
| 59 InitCB init_cb_; | 61 InitCB init_cb_; |
| 60 StreamParserHost* host_; | 62 NewConfigCB config_cb_; |
| 63 NewBuffersCB audio_cb_; |
| 64 NewBuffersCB video_cb_; |
| 61 | 65 |
| 62 scoped_ptr<WebMClusterParser> cluster_parser_; | 66 scoped_ptr<WebMClusterParser> cluster_parser_; |
| 63 ByteQueue byte_queue_; | 67 ByteQueue byte_queue_; |
| 64 | 68 |
| 65 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); | 69 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 } // namespace media | 72 } // namespace media |
| 69 | 73 |
| 70 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ | 74 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ |
| OLD | NEW |