| 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 | 19 |
| 19 class MEDIA_EXPORT DemuxerStream | 20 class MEDIA_EXPORT DemuxerStream |
| 20 : public base::RefCountedThreadSafe<DemuxerStream> { | 21 : public base::RefCountedThreadSafe<DemuxerStream> { |
| 21 public: | 22 public: |
| 22 typedef base::Callback<void(Buffer*)> ReadCallback; | 23 typedef base::Callback<void(Buffer*)> ReadCallback; |
| 23 | 24 |
| 24 enum Type { | 25 enum Type { |
| 25 UNKNOWN, | 26 UNKNOWN, |
| 26 AUDIO, | 27 AUDIO, |
| 27 VIDEO, | 28 VIDEO, |
| 28 NUM_TYPES, // Always keep this entry as the last one! | 29 NUM_TYPES, // Always keep this entry as the last one! |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 // Schedules a read. When the |read_callback| is called, the downstream | 32 // Schedules a read. When the |read_callback| is called, the downstream |
| 32 // object takes ownership of the buffer by AddRef()'ing the buffer. | 33 // object takes ownership of the buffer by AddRef()'ing the buffer. |
| 33 virtual void Read(const ReadCallback& read_callback) = 0; | 34 virtual void Read(const ReadCallback& read_callback) = 0; |
| 34 | 35 |
| 35 // Returns an |AVStream*| if supported, or NULL. | |
| 36 virtual AVStream* GetAVStream(); | |
| 37 | |
| 38 // 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 |
| 39 // if type() != AUDIO. | 37 // if type() != AUDIO. |
| 40 virtual const AudioDecoderConfig& audio_decoder_config() = 0; | 38 virtual const AudioDecoderConfig& audio_decoder_config() = 0; |
| 41 | 39 |
| 40 // Returns the video decoder configuration. It is an error to call this method |
| 41 // if type() != VIDEO. |
| 42 virtual const VideoDecoderConfig& video_decoder_config() = 0; |
| 43 |
| 42 // Returns the type of stream. | 44 // Returns the type of stream. |
| 43 virtual Type type() = 0; | 45 virtual Type type() = 0; |
| 44 | 46 |
| 45 virtual void EnableBitstreamConverter() = 0; | 47 virtual void EnableBitstreamConverter() = 0; |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 friend class base::RefCountedThreadSafe<DemuxerStream>; | 50 friend class base::RefCountedThreadSafe<DemuxerStream>; |
| 49 virtual ~DemuxerStream(); | 51 virtual ~DemuxerStream(); |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 } // namespace media | 54 } // namespace media |
| 53 | 55 |
| 54 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ | 56 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ |
| OLD | NEW |