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_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 namespace media { | 12 namespace media { |
13 | 13 |
14 class AudioDecoderConfig; | 14 class AudioDecoderConfig; |
15 class Buffer; | 15 class DecoderBuffer; |
16 class VideoDecoderConfig; | 16 class VideoDecoderConfig; |
17 | 17 |
18 class MEDIA_EXPORT DemuxerStream | 18 class MEDIA_EXPORT DemuxerStream |
19 : public base::RefCountedThreadSafe<DemuxerStream> { | 19 : public base::RefCountedThreadSafe<DemuxerStream> { |
20 public: | 20 public: |
21 enum Type { | 21 enum Type { |
22 UNKNOWN, | 22 UNKNOWN, |
23 AUDIO, | 23 AUDIO, |
24 VIDEO, | 24 VIDEO, |
25 NUM_TYPES, // Always keep this entry as the last one! | 25 NUM_TYPES, // Always keep this entry as the last one! |
26 }; | 26 }; |
27 | 27 |
28 // Request a buffer to returned via the provided callback. | 28 // Request a buffer to returned via the provided callback. |
29 // | 29 // |
30 // Non-NULL buffer pointers will contain media data or signal the end of the | 30 // Non-NULL buffer pointers will contain media data or signal the end of the |
31 // stream. A NULL pointer indicates an aborted Read(). This can happen if the | 31 // stream. A NULL pointer indicates an aborted Read(). This can happen if the |
32 // DemuxerStream gets flushed and doesn't have any more data to return. | 32 // DemuxerStream gets flushed and doesn't have any more data to return. |
33 typedef base::Callback<void(const scoped_refptr<Buffer>&)> ReadCB; | 33 typedef base::Callback<void(const scoped_refptr<DecoderBuffer>&)> ReadCB; |
34 virtual void Read(const ReadCB& read_cb) = 0; | 34 virtual void Read(const ReadCB& read_cb) = 0; |
35 | 35 |
36 // Returns the audio decoder configuration. It is an error to call this method | 36 // Returns the audio decoder configuration. It is an error to call this method |
37 // if type() != AUDIO. | 37 // if type() != AUDIO. |
38 virtual const AudioDecoderConfig& audio_decoder_config() = 0; | 38 virtual const AudioDecoderConfig& audio_decoder_config() = 0; |
39 | 39 |
40 // Returns the video decoder configuration. It is an error to call this method | 40 // Returns the video decoder configuration. It is an error to call this method |
41 // if type() != VIDEO. | 41 // if type() != VIDEO. |
42 virtual const VideoDecoderConfig& video_decoder_config() = 0; | 42 virtual const VideoDecoderConfig& video_decoder_config() = 0; |
43 | 43 |
44 // Returns the type of stream. | 44 // Returns the type of stream. |
45 virtual Type type() = 0; | 45 virtual Type type() = 0; |
46 | 46 |
47 virtual void EnableBitstreamConverter() = 0; | 47 virtual void EnableBitstreamConverter() = 0; |
48 | 48 |
49 protected: | 49 protected: |
50 friend class base::RefCountedThreadSafe<DemuxerStream>; | 50 friend class base::RefCountedThreadSafe<DemuxerStream>; |
51 virtual ~DemuxerStream(); | 51 virtual ~DemuxerStream(); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace media | 54 } // namespace media |
55 | 55 |
56 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ | 56 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ |
OLD | NEW |