Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 // audio, max 1 video, and N text tracks in a map keyed by | 39 // audio, max 1 video, and N text tracks in a map keyed by |
| 40 // bytestream-specific-ranged track numbers. See http://crbug.com/341581. | 40 // bytestream-specific-ranged track numbers. See http://crbug.com/341581. |
| 41 typedef int TrackId; | 41 typedef int TrackId; |
| 42 | 42 |
| 43 // Map of text track ID to the track configuration. | 43 // Map of text track ID to the track configuration. |
| 44 typedef std::map<TrackId, TextTrackConfig> TextTrackConfigMap; | 44 typedef std::map<TrackId, TextTrackConfig> TextTrackConfigMap; |
| 45 | 45 |
| 46 // Map of text track ID to decode-timestamp-ordered buffers for the track. | 46 // Map of text track ID to decode-timestamp-ordered buffers for the track. |
| 47 typedef std::map<TrackId, const BufferQueue> TextBufferQueueMap; | 47 typedef std::map<TrackId, const BufferQueue> TextBufferQueueMap; |
| 48 | 48 |
| 49 StreamParser(); | 49 // Stream parameters passed in InitCB |
| 50 virtual ~StreamParser(); | 50 struct StreamParameters { |
|
acolwell GONE FROM CHROMIUM
2014/04/24 21:00:55
nit: s/Stream// or s/Stream/Init/ so we don't have
Sergey Ulanov
2014/04/24 22:13:43
Done.
| |
| 51 StreamParameters(); | |
|
acolwell GONE FROM CHROMIUM
2014/04/24 21:00:55
nit: I think we should at least force duration to
Sergey Ulanov
2014/04/24 22:13:43
Done.
| |
| 52 | |
| 53 // Stream duration. | |
| 54 base::TimeDelta duration; | |
| 55 | |
| 56 // Indicates the source time associated with presentation timestamp 0. A | |
| 57 // null Time is returned if no mapping to Time exists. | |
| 58 base::Time timeline_offset; | |
| 59 | |
| 60 // Indicates that timestampOffset should be updated based on the earliest | |
| 61 // end timestamp (audio or video) provided during each NewBuffersCB. | |
| 62 bool auto_update_timestamp_offset; | |
| 63 }; | |
| 51 | 64 |
| 52 // Indicates completion of parser initialization. | 65 // Indicates completion of parser initialization. |
| 53 // First parameter - Indicates initialization success. Set to true if | 66 // success - True if initialization was successful. |
| 54 // initialization was successful. False if an error | 67 // params - Stream parameters, in case of successful initialization. |
| 55 // occurred. | 68 typedef base::Callback<void(bool success, |
| 56 // Second parameter - Indicates the stream duration. Only contains a valid | 69 const StreamParameters& params)> InitCB; |
| 57 // value if the first parameter is true. | |
| 58 // Third parameter - Indicates the Time associated with | |
| 59 // presentation timestamp 0 if such a mapping exists in | |
| 60 // the bytestream. If no mapping exists this parameter | |
| 61 // contains null Time object. Only contains a valid | |
| 62 // value if the first parameter is true. | |
| 63 // Fourth parameters - Indicates that timestampOffset should be updated based | |
| 64 // on the earliest end timestamp (audio or video) provided | |
| 65 // during each NewBuffersCB. | |
| 66 typedef base::Callback<void(bool, base::TimeDelta, base::Time, bool)> InitCB; | |
| 67 | 70 |
| 68 // Indicates when new stream configurations have been parsed. | 71 // Indicates when new stream configurations have been parsed. |
| 69 // First parameter - The new audio configuration. If the config is not valid | 72 // First parameter - The new audio configuration. If the config is not valid |
| 70 // then it means that there isn't an audio stream. | 73 // then it means that there isn't an audio stream. |
| 71 // Second parameter - The new video configuration. If the config is not valid | 74 // Second parameter - The new video configuration. If the config is not valid |
| 72 // then it means that there isn't an audio stream. | 75 // then it means that there isn't an audio stream. |
| 73 // Third parameter - The new text tracks configuration. If the map is empty, | 76 // Third parameter - The new text tracks configuration. If the map is empty, |
| 74 // then no text tracks were parsed from the stream. | 77 // then no text tracks were parsed from the stream. |
| 75 // Return value - True if the new configurations are accepted. | 78 // Return value - True if the new configurations are accepted. |
| 76 // False if the new configurations are not supported | 79 // False if the new configurations are not supported |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 96 // Signals the beginning of a new media segment. | 99 // Signals the beginning of a new media segment. |
| 97 typedef base::Callback<void()> NewMediaSegmentCB; | 100 typedef base::Callback<void()> NewMediaSegmentCB; |
| 98 | 101 |
| 99 // A new potentially encrypted stream has been parsed. | 102 // A new potentially encrypted stream has been parsed. |
| 100 // First parameter - The type of the initialization data associated with the | 103 // First parameter - The type of the initialization data associated with the |
| 101 // stream. | 104 // stream. |
| 102 // Second parameter - The initialization data associated with the stream. | 105 // Second parameter - The initialization data associated with the stream. |
| 103 typedef base::Callback<void(const std::string&, | 106 typedef base::Callback<void(const std::string&, |
| 104 const std::vector<uint8>&)> NeedKeyCB; | 107 const std::vector<uint8>&)> NeedKeyCB; |
| 105 | 108 |
| 109 StreamParser(); | |
|
acolwell GONE FROM CHROMIUM
2014/04/24 21:00:55
Why is this needed? Should we be using a differend
Sergey Ulanov
2014/04/24 22:13:43
I just moved them here from line 49. Style guide s
| |
| 110 virtual ~StreamParser(); | |
| 111 | |
| 106 // Initializes the parser with necessary callbacks. Must be called before any | 112 // Initializes the parser with necessary callbacks. Must be called before any |
| 107 // 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 |
| 108 // been parsed to determine the initial stream configurations, presentation | 114 // been parsed to determine the initial stream configurations, presentation |
| 109 // 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 |
| 110 // 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|. |
| 111 virtual void Init(const InitCB& init_cb, | 117 virtual void Init(const InitCB& init_cb, |
| 112 const NewConfigCB& config_cb, | 118 const NewConfigCB& config_cb, |
| 113 const NewBuffersCB& new_buffers_cb, | 119 const NewBuffersCB& new_buffers_cb, |
| 114 bool ignore_text_track, | 120 bool ignore_text_track, |
| 115 const NeedKeyCB& need_key_cb, | 121 const NeedKeyCB& need_key_cb, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 144 // subtle issues with tie-breaking. See http://crbug.com/338484. | 150 // subtle issues with tie-breaking. See http://crbug.com/338484. |
| 145 MEDIA_EXPORT bool MergeBufferQueues( | 151 MEDIA_EXPORT bool MergeBufferQueues( |
| 146 const StreamParser::BufferQueue& audio_buffers, | 152 const StreamParser::BufferQueue& audio_buffers, |
| 147 const StreamParser::BufferQueue& video_buffers, | 153 const StreamParser::BufferQueue& video_buffers, |
| 148 const StreamParser::TextBufferQueueMap& text_buffers, | 154 const StreamParser::TextBufferQueueMap& text_buffers, |
| 149 StreamParser::BufferQueue* merged_buffers); | 155 StreamParser::BufferQueue* merged_buffers); |
| 150 | 156 |
| 151 } // namespace media | 157 } // namespace media |
| 152 | 158 |
| 153 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 159 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
| OLD | NEW |