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_FILTERS_SOURCE_BUFFER_H_ | 5 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_H_ |
6 #define MEDIA_FILTERS_SOURCE_BUFFER_H_ | 6 #define MEDIA_FILTERS_SOURCE_BUFFER_H_ |
7 | 7 |
8 #include "media/base/audio_decoder_config.h" | 8 #include "media/base/audio_decoder_config.h" |
9 #include "media/base/stream_parser.h" | 9 #include "media/base/stream_parser.h" |
10 #include "media/base/video_decoder_config.h" | 10 #include "media/base/video_decoder_config.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // SourceBuffer will store media segments and initialization segments that are | 14 // SourceBuffer will store media segments and initialization segments that are |
15 // dynamically appended to a particular source ID, hand them to a StreamParser | 15 // dynamically appended to a particular source ID, hand them to a StreamParser |
16 // to be parsed, and provide buffers to ChunkDemuxerStreams during playback. | 16 // to be parsed, and provide buffers to ChunkDemuxerStreams during playback. |
17 class MEDIA_EXPORT SourceBuffer { | 17 class MEDIA_EXPORT SourceBuffer { |
18 public: | 18 public: |
19 SourceBuffer(); | 19 SourceBuffer(); |
20 ~SourceBuffer(); | 20 ~SourceBuffer(); |
21 | 21 |
22 typedef base::Callback<void(bool, base::TimeDelta)> InitCB; | 22 typedef base::Callback<void(bool, base::TimeDelta)> InitCB; |
23 typedef base::Callback<bool(const AudioDecoderConfig&, | 23 typedef base::Callback<bool(const AudioDecoderConfig&, |
24 const VideoDecoderConfig&)> NewConfigCB; | 24 const VideoDecoderConfig&)> NewConfigCB; |
25 typedef base::Callback<bool(const StreamParser::BufferQueue&)> NewBuffersCB; | 25 typedef base::Callback<bool(const StreamParser::BufferQueue&)> NewBuffersCB; |
26 typedef base::Callback<bool(scoped_array<uint8>, int)> KeyNeededCB; | 26 typedef base::Callback<bool(scoped_array<uint8>, int)> KeyNeededCB; |
27 | 27 |
28 void Init(const InitCB& init_cb, | 28 void Init(scoped_ptr<StreamParser> parser, |
| 29 const InitCB& init_cb, |
29 const NewConfigCB& config_cb, | 30 const NewConfigCB& config_cb, |
30 const NewBuffersCB& audio_cb, | 31 const NewBuffersCB& audio_cb, |
31 const NewBuffersCB& video_cb, | 32 const NewBuffersCB& video_cb, |
32 const KeyNeededCB& key_needed_cb); | 33 const KeyNeededCB& key_needed_cb); |
33 | 34 |
34 // Add buffers to this source. Incoming data will be parsed and then stored | 35 // Add buffers to this source. Incoming data will be parsed and then stored |
35 // in SourceBufferStreams, which will handle ordering and overlap resolution. | 36 // in SourceBufferStreams, which will handle ordering and overlap resolution. |
36 // Returns true if data was successfully appended, false if the parse failed. | 37 // Returns true if data was successfully appended, false if the parse failed. |
37 bool AppendData(const uint8* data, size_t length); | 38 bool AppendData(const uint8* data, size_t length); |
38 | 39 |
(...skipping 17 matching lines...) Expand all Loading... |
56 NewBuffersCB audio_cb_; | 57 NewBuffersCB audio_cb_; |
57 NewBuffersCB video_cb_; | 58 NewBuffersCB video_cb_; |
58 KeyNeededCB key_needed_cb_; | 59 KeyNeededCB key_needed_cb_; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(SourceBuffer); | 61 DISALLOW_COPY_AND_ASSIGN(SourceBuffer); |
61 }; | 62 }; |
62 | 63 |
63 } // namespace media | 64 } // namespace media |
64 | 65 |
65 #endif // MEDIA_FILTERS_SOURCE_BUFFER_H_ | 66 #endif // MEDIA_FILTERS_SOURCE_BUFFER_H_ |
OLD | NEW |