| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <memory> |
| 13 #include <string> | 14 #include <string> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/callback_forward.h" | 17 #include "base/callback_forward.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "media/base/demuxer_stream.h" | 21 #include "media/base/demuxer_stream.h" |
| 22 #include "media/base/eme_constants.h" | 22 #include "media/base/eme_constants.h" |
| 23 #include "media/base/media_export.h" | 23 #include "media/base/media_export.h" |
| 24 #include "media/base/media_log.h" | 24 #include "media/base/media_log.h" |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 | 27 |
| 28 class MediaTracks; | 28 class MediaTracks; |
| 29 class StreamParserBuffer; | 29 class StreamParserBuffer; |
| 30 class TextTrackConfig; | 30 class TextTrackConfig; |
| 31 | 31 |
| 32 // Abstract interface for parsing media byte streams. | 32 // Abstract interface for parsing media byte streams. |
| 33 class MEDIA_EXPORT StreamParser { | 33 class MEDIA_EXPORT StreamParser { |
| 34 public: | 34 public: |
| 35 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; | 35 using BufferQueue = std::deque<scoped_refptr<StreamParserBuffer>>; |
| 36 | 36 |
| 37 // Range of |TrackId| is dependent upon stream parsers. It is currently | 37 // Range of |TrackId| is dependent upon stream parsers. It is currently |
| 38 // the key for the buffer's text track config in the applicable | 38 // the key for the buffer's text track config in the applicable |
| 39 // TextTrackConfigMap (which is passed in StreamParser::NewConfigCB), or | 39 // TextTrackConfigMap (which is passed in StreamParser::NewConfigCB), or |
| 40 // 0 for other media types that currently allow at most one track. | 40 // 0 for other media types that currently allow at most one track. |
| 41 // WebMTracksParser uses -1 as an invalid text track number. | 41 // WebMTracksParser uses -1 as an invalid text track number. |
| 42 // TODO(wolenetz/acolwell): Change to size_type while fixing stream parsers to | 42 // TODO(wolenetz/acolwell): Change to size_type while fixing stream parsers to |
| 43 // emit validated track configuration and buffer vectors rather than max 1 | 43 // emit validated track configuration and buffer vectors rather than max 1 |
| 44 // audio, max 1 video, and N text tracks in a map keyed by | 44 // audio, max 1 video, and N text tracks in a map keyed by |
| 45 // bytestream-specific-ranged track numbers. See http://crbug.com/341581. | 45 // bytestream-specific-ranged track numbers. See http://crbug.com/341581. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // Indicates when new stream configurations have been parsed. | 83 // Indicates when new stream configurations have been parsed. |
| 84 // First parameter - An object containing information about media tracks as | 84 // First parameter - An object containing information about media tracks as |
| 85 // well as audio/video decoder configs associated with each | 85 // well as audio/video decoder configs associated with each |
| 86 // track the parser will use from the stream. | 86 // track the parser will use from the stream. |
| 87 // Second parameter - The new text tracks configuration. If the map is empty, | 87 // Second parameter - The new text tracks configuration. If the map is empty, |
| 88 // then no text tracks were parsed for use from the stream. | 88 // then no text tracks were parsed for use from the stream. |
| 89 // Return value - True if the new configurations are accepted. | 89 // Return value - True if the new configurations are accepted. |
| 90 // False if the new configurations are not supported | 90 // False if the new configurations are not supported |
| 91 // and indicates that a parsing error should be signalled. | 91 // and indicates that a parsing error should be signalled. |
| 92 typedef base::Callback<bool(scoped_ptr<MediaTracks>, | 92 typedef base::Callback<bool(std::unique_ptr<MediaTracks>, |
| 93 const TextTrackConfigMap&)> | 93 const TextTrackConfigMap&)> |
| 94 NewConfigCB; | 94 NewConfigCB; |
| 95 | 95 |
| 96 // New stream buffers have been parsed. | 96 // New stream buffers have been parsed. |
| 97 // First parameter - A queue of newly parsed audio buffers. | 97 // First parameter - A queue of newly parsed audio buffers. |
| 98 // Second parameter - A queue of newly parsed video buffers. | 98 // Second parameter - A queue of newly parsed video buffers. |
| 99 // Third parameter - A map of text track ids to queues of newly parsed inband | 99 // Third parameter - A map of text track ids to queues of newly parsed inband |
| 100 // text buffers. If the map is not empty, it must contain | 100 // text buffers. If the map is not empty, it must contain |
| 101 // at least one track with a non-empty queue of text | 101 // at least one track with a non-empty queue of text |
| 102 // buffers. | 102 // buffers. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // subtle issues with tie-breaking. See http://crbug.com/338484. | 166 // subtle issues with tie-breaking. See http://crbug.com/338484. |
| 167 MEDIA_EXPORT bool MergeBufferQueues( | 167 MEDIA_EXPORT bool MergeBufferQueues( |
| 168 const StreamParser::BufferQueue& audio_buffers, | 168 const StreamParser::BufferQueue& audio_buffers, |
| 169 const StreamParser::BufferQueue& video_buffers, | 169 const StreamParser::BufferQueue& video_buffers, |
| 170 const StreamParser::TextBufferQueueMap& text_buffers, | 170 const StreamParser::TextBufferQueueMap& text_buffers, |
| 171 StreamParser::BufferQueue* merged_buffers); | 171 StreamParser::BufferQueue* merged_buffers); |
| 172 | 172 |
| 173 } // namespace media | 173 } // namespace media |
| 174 | 174 |
| 175 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 175 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
| OLD | NEW |