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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // Incrementally parses WebM cluster elements. This method also skips | 54 // Incrementally parses WebM cluster elements. This method also skips |
55 // CUES elements if they are encountered since we currently don't use the | 55 // CUES elements if they are encountered since we currently don't use the |
56 // data in these elements. | 56 // data in these elements. |
57 // | 57 // |
58 // Returns < 0 if the parse fails. | 58 // Returns < 0 if the parse fails. |
59 // Returns 0 if more data is needed. | 59 // Returns 0 if more data is needed. |
60 // Returning > 0 indicates success & the number of bytes parsed. | 60 // Returning > 0 indicates success & the number of bytes parsed. |
61 int ParseCluster(const uint8* data, int size); | 61 int ParseCluster(const uint8* data, int size); |
62 | 62 |
| 63 // Fire needkey event through the |need_key_cb_|. |
| 64 void FireNeedKey(const std::string& key_id); |
| 65 |
63 State state_; | 66 State state_; |
64 InitCB init_cb_; | 67 InitCB init_cb_; |
65 NewConfigCB config_cb_; | 68 NewConfigCB config_cb_; |
66 NewBuffersCB audio_cb_; | 69 NewBuffersCB audio_cb_; |
67 NewBuffersCB video_cb_; | 70 NewBuffersCB video_cb_; |
68 NeedKeyCB need_key_cb_; | 71 NeedKeyCB need_key_cb_; |
69 NewMediaSegmentCB new_segment_cb_; | 72 NewMediaSegmentCB new_segment_cb_; |
70 base::Closure end_of_segment_cb_; | 73 base::Closure end_of_segment_cb_; |
71 | 74 |
72 // True if a new cluster id has been seen, but no audio or video buffers have | 75 // True if a new cluster id has been seen, but no audio or video buffers have |
73 // been parsed yet. | 76 // been parsed yet. |
74 bool waiting_for_buffers_; | 77 bool waiting_for_buffers_; |
75 | 78 |
76 scoped_ptr<WebMClusterParser> cluster_parser_; | 79 scoped_ptr<WebMClusterParser> cluster_parser_; |
77 ByteQueue byte_queue_; | 80 ByteQueue byte_queue_; |
78 | 81 |
79 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); | 82 DISALLOW_COPY_AND_ASSIGN(WebMStreamParser); |
80 }; | 83 }; |
81 | 84 |
82 } // namespace media | 85 } // namespace media |
83 | 86 |
84 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ | 87 #endif // MEDIA_WEBM_WEBM_STREAM_PARSER_H_ |
OLD | NEW |