OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DEMUXER_STREAM_H_ | 5 #ifndef MEDIA_BASE_DEMUXER_STREAM_H_ |
6 #define MEDIA_BASE_DEMUXER_STREAM_H_ | 6 #define MEDIA_BASE_DEMUXER_STREAM_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 struct AVStream; | 12 struct AVStream; |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
| 16 class AudioDecoderConfig; |
16 class Buffer; | 17 class Buffer; |
17 | 18 |
18 class MEDIA_EXPORT DemuxerStream | 19 class MEDIA_EXPORT DemuxerStream |
19 : public base::RefCountedThreadSafe<DemuxerStream> { | 20 : public base::RefCountedThreadSafe<DemuxerStream> { |
20 public: | 21 public: |
21 typedef base::Callback<void(Buffer*)> ReadCallback; | 22 typedef base::Callback<void(Buffer*)> ReadCallback; |
22 | 23 |
23 enum Type { | 24 enum Type { |
24 UNKNOWN, | 25 UNKNOWN, |
25 AUDIO, | 26 AUDIO, |
26 VIDEO, | 27 VIDEO, |
27 NUM_TYPES, // Always keep this entry as the last one! | 28 NUM_TYPES, // Always keep this entry as the last one! |
28 }; | 29 }; |
29 | 30 |
30 // Schedules a read. When the |read_callback| is called, the downstream | 31 // Schedules a read. When the |read_callback| is called, the downstream |
31 // object takes ownership of the buffer by AddRef()'ing the buffer. | 32 // object takes ownership of the buffer by AddRef()'ing the buffer. |
32 virtual void Read(const ReadCallback& read_callback) = 0; | 33 virtual void Read(const ReadCallback& read_callback) = 0; |
33 | 34 |
34 // Returns an |AVStream*| if supported, or NULL. | 35 // Returns an |AVStream*| if supported, or NULL. |
35 virtual AVStream* GetAVStream(); | 36 virtual AVStream* GetAVStream(); |
36 | 37 |
| 38 // Returns the audio decoder configuration. It is an error to call this method |
| 39 // if type() != AUDIO. |
| 40 virtual const AudioDecoderConfig& audio_decoder_config() = 0; |
| 41 |
37 // Returns the type of stream. | 42 // Returns the type of stream. |
38 virtual Type type() = 0; | 43 virtual Type type() = 0; |
39 | 44 |
40 virtual void EnableBitstreamConverter() = 0; | 45 virtual void EnableBitstreamConverter() = 0; |
41 | 46 |
42 protected: | 47 protected: |
43 friend class base::RefCountedThreadSafe<DemuxerStream>; | 48 friend class base::RefCountedThreadSafe<DemuxerStream>; |
44 virtual ~DemuxerStream(); | 49 virtual ~DemuxerStream(); |
45 }; | 50 }; |
46 | 51 |
47 } // namespace media | 52 } // namespace media |
48 | 53 |
49 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ | 54 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ |
OLD | NEW |