| 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_BUFFER_H_ | 5 #ifndef MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
| 6 #define MEDIA_BASE_STREAM_PARSER_BUFFER_H_ | 6 #define MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Decode timestamp. If not explicitly set, or set to kNoTimestamp, the | 128 // Decode timestamp. If not explicitly set, or set to kNoTimestamp, the |
| 129 // value will be taken from the normal timestamp. | 129 // value will be taken from the normal timestamp. |
| 130 DecodeTimestamp GetDecodeTimestamp() const; | 130 DecodeTimestamp GetDecodeTimestamp() const; |
| 131 void SetDecodeTimestamp(DecodeTimestamp timestamp); | 131 void SetDecodeTimestamp(DecodeTimestamp timestamp); |
| 132 | 132 |
| 133 // Gets/sets the ID of the decoder config associated with this buffer. | 133 // Gets/sets the ID of the decoder config associated with this buffer. |
| 134 int GetConfigId() const; | 134 int GetConfigId() const; |
| 135 void SetConfigId(int config_id); | 135 void SetConfigId(int config_id); |
| 136 | 136 |
| 137 // Returns the config ID of this buffer if it has no splice buffers or | |
| 138 // |index| is out of range. Otherwise returns the config ID for the | |
| 139 // buffer in |splice_buffers_| at position |index|. | |
| 140 int GetSpliceBufferConfigId(size_t index) const; | |
| 141 | |
| 142 // Gets the parser's media type associated with this buffer. Value is | 137 // Gets the parser's media type associated with this buffer. Value is |
| 143 // meaningless for EOS buffers. | 138 // meaningless for EOS buffers. |
| 144 Type type() const { return type_; } | 139 Type type() const { return type_; } |
| 145 const char* GetTypeName() const; | 140 const char* GetTypeName() const; |
| 146 | 141 |
| 147 // Gets the parser's track ID associated with this buffer. Value is | 142 // Gets the parser's track ID associated with this buffer. Value is |
| 148 // meaningless for EOS buffers. | 143 // meaningless for EOS buffers. |
| 149 TrackId track_id() const { return track_id_; } | 144 TrackId track_id() const { return track_id_; } |
| 150 | 145 |
| 151 // Converts this buffer to a splice buffer. |pre_splice_buffers| must not | |
| 152 // have any EOS buffers, must not have any splice buffers, nor must have any | |
| 153 // buffer with preroll. | |
| 154 // | |
| 155 // |pre_splice_buffers| will be deep copied and each copy's splice_timestamp() | |
| 156 // will be set to this buffer's splice_timestamp(). A copy of |this|, with a | |
| 157 // splice_timestamp() of kNoTimestamp, will be added to the end of | |
| 158 // |splice_buffers_|. | |
| 159 // | |
| 160 // See the Audio Splice Frame Algorithm in the MSE specification for details. | |
| 161 typedef StreamParser::BufferQueue BufferQueue; | |
| 162 void ConvertToSpliceBuffer(const BufferQueue& pre_splice_buffers); | |
| 163 const BufferQueue& splice_buffers() const { return splice_buffers_; } | |
| 164 | |
| 165 // Specifies a buffer which must be decoded prior to this one to ensure this | 146 // Specifies a buffer which must be decoded prior to this one to ensure this |
| 166 // buffer can be accurately decoded. The given buffer must be of the same | 147 // buffer can be accurately decoded. The given buffer must be of the same |
| 167 // type, must not be a splice buffer, must not have any discard padding, and | 148 // type, must not have any discard padding, and must not be an end of stream |
| 168 // must not be an end of stream buffer. |preroll| is not copied. | 149 // buffer. |preroll| is not copied. |
| 169 // | 150 // |
| 170 // It's expected that this preroll buffer will be discarded entirely post | 151 // It's expected that this preroll buffer will be discarded entirely post |
| 171 // decoding. As such it's discard_padding() will be set to kInfiniteDuration. | 152 // decoding. As such it's discard_padding() will be set to kInfiniteDuration. |
| 172 // | 153 // |
| 173 // All future timestamp, decode timestamp, config id, or track id changes to | 154 // All future timestamp, decode timestamp, config id, or track id changes to |
| 174 // this buffer will be applied to the preroll buffer as well. | 155 // this buffer will be applied to the preroll buffer as well. |
| 175 void SetPrerollBuffer(const scoped_refptr<StreamParserBuffer>& preroll); | 156 void SetPrerollBuffer(const scoped_refptr<StreamParserBuffer>& preroll); |
| 176 const scoped_refptr<StreamParserBuffer>& preroll_buffer() { | 157 const scoped_refptr<StreamParserBuffer>& preroll_buffer() { |
| 177 return preroll_buffer_; | 158 return preroll_buffer_; |
| 178 } | 159 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 192 int side_data_size, | 173 int side_data_size, |
| 193 bool is_key_frame, | 174 bool is_key_frame, |
| 194 Type type, | 175 Type type, |
| 195 TrackId track_id); | 176 TrackId track_id); |
| 196 ~StreamParserBuffer() override; | 177 ~StreamParserBuffer() override; |
| 197 | 178 |
| 198 DecodeTimestamp decode_timestamp_; | 179 DecodeTimestamp decode_timestamp_; |
| 199 int config_id_; | 180 int config_id_; |
| 200 Type type_; | 181 Type type_; |
| 201 TrackId track_id_; | 182 TrackId track_id_; |
| 202 BufferQueue splice_buffers_; | |
| 203 scoped_refptr<StreamParserBuffer> preroll_buffer_; | 183 scoped_refptr<StreamParserBuffer> preroll_buffer_; |
| 204 bool is_duration_estimated_; | 184 bool is_duration_estimated_; |
| 205 | 185 |
| 206 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); | 186 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); |
| 207 }; | 187 }; |
| 208 | 188 |
| 209 } // namespace media | 189 } // namespace media |
| 210 | 190 |
| 211 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ | 191 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
| OLD | NEW |