| 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_BASE_STREAM_PARSER_H_ | 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_ |
| 6 #define MEDIA_BASE_STREAM_PARSER_H_ | 6 #define MEDIA_BASE_STREAM_PARSER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // text buffers. If the map is not empty, it must contain | 92 // text buffers. If the map is not empty, it must contain |
| 93 // at least one track with a non-empty queue of text | 93 // at least one track with a non-empty queue of text |
| 94 // buffers. | 94 // buffers. |
| 95 // Return value - True indicates that the buffers are accepted. | 95 // Return value - True indicates that the buffers are accepted. |
| 96 // False if something was wrong with the buffers and a parsing | 96 // False if something was wrong with the buffers and a parsing |
| 97 // error should be signalled. | 97 // error should be signalled. |
| 98 typedef base::Callback<bool(const BufferQueue&, | 98 typedef base::Callback<bool(const BufferQueue&, |
| 99 const BufferQueue&, | 99 const BufferQueue&, |
| 100 const TextBufferQueueMap&)> NewBuffersCB; | 100 const TextBufferQueueMap&)> NewBuffersCB; |
| 101 | 101 |
| 102 // Signals the beginning of a new media segment. | |
| 103 typedef base::Callback<void()> NewMediaSegmentCB; | |
| 104 | |
| 105 // A new potentially encrypted stream has been parsed. | 102 // A new potentially encrypted stream has been parsed. |
| 106 // First parameter - The type of the initialization data associated with the | 103 // First parameter - The type of the initialization data associated with the |
| 107 // stream. | 104 // stream. |
| 108 // Second parameter - The initialization data associated with the stream. | 105 // Second parameter - The initialization data associated with the stream. |
| 109 typedef base::Callback<void(EmeInitDataType, const std::vector<uint8>&)> | 106 typedef base::Callback<void(EmeInitDataType, const std::vector<uint8>&)> |
| 110 EncryptedMediaInitDataCB; | 107 EncryptedMediaInitDataCB; |
| 111 | 108 |
| 112 StreamParser(); | 109 StreamParser(); |
| 113 virtual ~StreamParser(); | 110 virtual ~StreamParser(); |
| 114 | 111 |
| 115 // Initializes the parser with necessary callbacks. Must be called before any | 112 // Initializes the parser with necessary callbacks. Must be called before any |
| 116 // data is passed to Parse(). |init_cb| will be called once enough data has | 113 // data is passed to Parse(). |init_cb| will be called once enough data has |
| 117 // been parsed to determine the initial stream configurations, presentation | 114 // been parsed to determine the initial stream configurations, presentation |
| 118 // start time, and duration. If |ignore_text_track| is true, then no text | 115 // start time, and duration. If |ignore_text_track| is true, then no text |
| 119 // buffers should be passed later by the parser to |new_buffers_cb|. | 116 // buffers should be passed later by the parser to |new_buffers_cb|. |
| 120 virtual void Init( | 117 virtual void Init( |
| 121 const InitCB& init_cb, | 118 const InitCB& init_cb, |
| 122 const NewConfigCB& config_cb, | 119 const NewConfigCB& config_cb, |
| 123 const NewBuffersCB& new_buffers_cb, | 120 const NewBuffersCB& new_buffers_cb, |
| 124 bool ignore_text_track, | 121 bool ignore_text_track, |
| 125 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, | 122 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, |
| 126 const NewMediaSegmentCB& new_segment_cb, | 123 const base::Closure& start_of_segment_cb, |
| 127 const base::Closure& end_of_segment_cb, | 124 const base::Closure& end_of_segment_cb, |
| 128 const scoped_refptr<MediaLog>& media_log) = 0; | 125 const scoped_refptr<MediaLog>& media_log) = 0; |
| 129 | 126 |
| 130 // Called when a seek occurs. This flushes the current parser state | 127 // Called when a seek occurs. This flushes the current parser state |
| 131 // and puts the parser in a state where it can receive data for the new seek | 128 // and puts the parser in a state where it can receive data for the new seek |
| 132 // point. | 129 // point. |
| 133 virtual void Flush() = 0; | 130 virtual void Flush() = 0; |
| 134 | 131 |
| 135 // Called when there is new data to parse. | 132 // Called when there is new data to parse. |
| 136 // | 133 // |
| (...skipping 17 matching lines...) Expand all Loading... |
| 154 // subtle issues with tie-breaking. See http://crbug.com/338484. | 151 // subtle issues with tie-breaking. See http://crbug.com/338484. |
| 155 MEDIA_EXPORT bool MergeBufferQueues( | 152 MEDIA_EXPORT bool MergeBufferQueues( |
| 156 const StreamParser::BufferQueue& audio_buffers, | 153 const StreamParser::BufferQueue& audio_buffers, |
| 157 const StreamParser::BufferQueue& video_buffers, | 154 const StreamParser::BufferQueue& video_buffers, |
| 158 const StreamParser::TextBufferQueueMap& text_buffers, | 155 const StreamParser::TextBufferQueueMap& text_buffers, |
| 159 StreamParser::BufferQueue* merged_buffers); | 156 StreamParser::BufferQueue* merged_buffers); |
| 160 | 157 |
| 161 } // namespace media | 158 } // namespace media |
| 162 | 159 |
| 163 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 160 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
| OLD | NEW |