| 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 AudioDecoderConfig; |
| 17 class Buffer; | 17 class Buffer; |
| 18 class VideoDecoderConfig; | 18 class VideoDecoderConfig; |
| 19 | 19 |
| 20 class MEDIA_EXPORT DemuxerStream | 20 class MEDIA_EXPORT DemuxerStream |
| 21 : public base::RefCountedThreadSafe<DemuxerStream> { | 21 : public base::RefCountedThreadSafe<DemuxerStream> { |
| 22 public: | 22 public: |
| 23 typedef base::Callback<void(Buffer*)> ReadCallback; | |
| 24 | |
| 25 enum Type { | 23 enum Type { |
| 26 UNKNOWN, | 24 UNKNOWN, |
| 27 AUDIO, | 25 AUDIO, |
| 28 VIDEO, | 26 VIDEO, |
| 29 NUM_TYPES, // Always keep this entry as the last one! | 27 NUM_TYPES, // Always keep this entry as the last one! |
| 30 }; | 28 }; |
| 31 | 29 |
| 32 // Schedules a read. When the |read_callback| is called, the downstream | 30 // Request a buffer to returned via the provided callback. |
| 33 // object takes ownership of the buffer by AddRef()'ing the buffer. | 31 // |
| 32 // Buffers will be non-NULL yet may be end of stream buffers. |
| 33 typedef base::Callback<void(scoped_refptr<Buffer>)> ReadCallback; |
| 34 virtual void Read(const ReadCallback& read_callback) = 0; | 34 virtual void Read(const ReadCallback& read_callback) = 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 |