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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // Gets the parser's media type associated with this buffer. Value is | 45 // Gets the parser's media type associated with this buffer. Value is |
46 // meaningless for EOS buffers. | 46 // meaningless for EOS buffers. |
47 Type type() const { return type_; } | 47 Type type() const { return type_; } |
48 | 48 |
49 // Gets the parser's track ID associated with this buffer. Value is | 49 // Gets the parser's track ID associated with this buffer. Value is |
50 // meaningless for EOS buffers. | 50 // meaningless for EOS buffers. |
51 TrackId track_id() const { return track_id_; } | 51 TrackId track_id() const { return track_id_; } |
52 | 52 |
53 // Converts this buffer to a splice buffer. |pre_splice_buffers| must not | 53 // Converts this buffer to a splice buffer. |pre_splice_buffers| must not |
54 // have any EOS buffers and must not have any nested splice buffers. | 54 // have any EOS buffers, must not have any splice buffers, nor must have any |
| 55 // buffer with preroll. |
55 // | 56 // |
56 // |pre_splice_buffers| will be deep copied and each copy's splice_timestamp() | 57 // |pre_splice_buffers| will be deep copied and each copy's splice_timestamp() |
57 // will be set to this buffer's splice_timestamp(). A copy of |this|, with a | 58 // will be set to this buffer's splice_timestamp(). A copy of |this|, with a |
58 // splice_timestamp() of kNoTimestamp(), will be added to the end of | 59 // splice_timestamp() of kNoTimestamp(), will be added to the end of |
59 // |splice_buffers_|. | 60 // |splice_buffers_|. |
60 // | 61 // |
61 // See the Audio Splice Frame Algorithm in the MSE specification for details. | 62 // See the Audio Splice Frame Algorithm in the MSE specification for details. |
62 typedef StreamParser::BufferQueue BufferQueue; | 63 typedef StreamParser::BufferQueue BufferQueue; |
63 void ConvertToSpliceBuffer(const BufferQueue& pre_splice_buffers); | 64 void ConvertToSpliceBuffer(const BufferQueue& pre_splice_buffers); |
64 const BufferQueue& get_splice_buffers() const { return splice_buffers_; } | 65 const BufferQueue& get_splice_buffers() const { return splice_buffers_; } |
65 | 66 |
| 67 // Specifies a buffer which must be decoded prior to this one to ensure this |
| 68 // buffer can be accurately decoded. The given buffer must be of the same |
| 69 // type, must not be a splice buffer, must not have any discard padding, and |
| 70 // must not be an end of stream buffer. |preroll| is not copied. |
| 71 // |
| 72 // It's expected that this preroll buffer will be discarded entirely post |
| 73 // decoding. As such it's discard_padding() will be set to its duration(). |
| 74 // |
| 75 // All future timestamp, decode timestamp, config id, or track id changes to |
| 76 // this buffer will be applied to the preroll buffer as well. These values |
| 77 // will be applied when GetPrerollBuffer() is called. |
| 78 void SetPrerollBuffer(const scoped_refptr<StreamParserBuffer>& preroll); |
| 79 const scoped_refptr<StreamParserBuffer>& GetPrerollBuffer(); |
| 80 |
66 private: | 81 private: |
67 StreamParserBuffer(const uint8* data, int data_size, | 82 StreamParserBuffer(const uint8* data, int data_size, |
68 const uint8* side_data, int side_data_size, | 83 const uint8* side_data, int side_data_size, |
69 bool is_keyframe, Type type, | 84 bool is_keyframe, Type type, |
70 TrackId track_id); | 85 TrackId track_id); |
71 virtual ~StreamParserBuffer(); | 86 virtual ~StreamParserBuffer(); |
72 | 87 |
73 bool is_keyframe_; | 88 bool is_keyframe_; |
74 base::TimeDelta decode_timestamp_; | 89 base::TimeDelta decode_timestamp_; |
75 int config_id_; | 90 int config_id_; |
76 Type type_; | 91 Type type_; |
77 TrackId track_id_; | 92 TrackId track_id_; |
78 | |
79 BufferQueue splice_buffers_; | 93 BufferQueue splice_buffers_; |
| 94 scoped_refptr<StreamParserBuffer> preroll_buffer_; |
80 | 95 |
81 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); | 96 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); |
82 }; | 97 }; |
83 | 98 |
84 } // namespace media | 99 } // namespace media |
85 | 100 |
86 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ | 101 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
OLD | NEW |