Chromium Code Reviews| 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 #include "media/base/ranges.h" | 11 #include "media/base/ranges.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 class AudioDecoderConfig; | 15 class AudioDecoderConfig; |
| 16 class DecoderBuffer; | 16 class DecoderBuffer; |
| 17 class VideoDecoderConfig; | 17 class VideoDecoderConfig; |
| 18 | 18 |
| 19 class MEDIA_EXPORT DemuxerStream | 19 class MEDIA_EXPORT DemuxerStream |
| 20 : public base::RefCountedThreadSafe<DemuxerStream> { | 20 : public base::RefCountedThreadSafe<DemuxerStream> { |
| 21 public: | 21 public: |
| 22 enum Type { | 22 enum Type { |
| 23 UNKNOWN, | 23 UNKNOWN, |
| 24 AUDIO, | 24 AUDIO, |
| 25 VIDEO, | 25 VIDEO, |
| 26 NUM_TYPES, // Always keep this entry as the last one! | 26 NUM_TYPES, // Always keep this entry as the last one! |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 enum Status { | |
|
Ami GONE FROM CHROMIUM
2012/06/26 00:33:21
Before this CL, ReadCB had 3 possible return scena
acolwell GONE FROM CHROMIUM
2012/07/12 01:19:38
I believe it does make sense. Mind if I defer this
| |
| 30 kOk, | |
| 31 kAborted, | |
| 32 kConfigChanged, | |
| 33 }; | |
| 34 | |
| 29 // Request a buffer to returned via the provided callback. | 35 // Request a buffer to returned via the provided callback. |
| 30 // | 36 // |
| 31 // Non-NULL buffer pointers will contain media data or signal the end of the | 37 // The first parameter indicates the status of the read. |
| 32 // stream. A NULL pointer indicates an aborted Read(). This can happen if the | 38 // kOk : Indicates the second parameter is Non-NULL and contains media data |
|
Ami GONE FROM CHROMIUM
2012/06/26 00:33:21
These comments belong at the enum declaration, not
acolwell GONE FROM CHROMIUM
2012/07/12 01:19:38
Done.
| |
| 33 // DemuxerStream gets flushed and doesn't have any more data to return. | 39 // or the end of the stream. |
| 34 typedef base::Callback<void(const scoped_refptr<DecoderBuffer>&)> ReadCB; | 40 // kAborted : Indicates an aborted Read(). This can happen if the |
| 41 // DemuxerStream gets flushed and doesn't have any more data to | |
| 42 // return. The second parameter MUST be NULL when this status is | |
| 43 // return. | |
|
Ami GONE FROM CHROMIUM
2012/06/26 00:33:21
s/\./ed./
acolwell GONE FROM CHROMIUM
2012/07/12 01:19:38
Done.
| |
| 44 // kConfigChange : Indicates that the decoder configuration has changed and a | |
| 45 // call to audio_decoder_config() or video_decoder_config() | |
|
Ami GONE FROM CHROMIUM
2012/06/26 00:33:21
This phrasing implies that calling [av]_d_c() on a
acolwell GONE FROM CHROMIUM
2012/07/12 01:19:38
Done.
| |
| 46 // is needed before more data is returned. The second | |
| 47 // parameter MUST be NULL when this status is return. | |
|
Ami GONE FROM CHROMIUM
2012/06/26 00:33:21
ditto
acolwell GONE FROM CHROMIUM
2012/07/12 01:19:38
Done.
| |
| 48 typedef base::Callback<void(Status, const scoped_refptr<DecoderBuffer>&)> | |
| 49 ReadCB; | |
| 35 virtual void Read(const ReadCB& read_cb) = 0; | 50 virtual void Read(const ReadCB& read_cb) = 0; |
| 36 | 51 |
| 37 // Returns the audio decoder configuration. It is an error to call this method | 52 // Returns the audio decoder configuration. It is an error to call this method |
| 38 // if type() != AUDIO. | 53 // if type() != AUDIO. |
| 39 virtual const AudioDecoderConfig& audio_decoder_config() = 0; | 54 virtual const AudioDecoderConfig& audio_decoder_config() = 0; |
| 40 | 55 |
| 41 // Returns the video decoder configuration. It is an error to call this method | 56 // Returns the video decoder configuration. It is an error to call this method |
| 42 // if type() != VIDEO. | 57 // if type() != VIDEO. |
| 43 virtual const VideoDecoderConfig& video_decoder_config() = 0; | 58 virtual const VideoDecoderConfig& video_decoder_config() = 0; |
| 44 | 59 |
| 45 // Returns time ranges known to have been seen by this stream. | 60 // Returns time ranges known to have been seen by this stream. |
| 46 virtual Ranges<base::TimeDelta> GetBufferedRanges() = 0; | 61 virtual Ranges<base::TimeDelta> GetBufferedRanges() = 0; |
| 47 | 62 |
| 48 // Returns the type of stream. | 63 // Returns the type of stream. |
| 49 virtual Type type() = 0; | 64 virtual Type type() = 0; |
| 50 | 65 |
| 51 virtual void EnableBitstreamConverter() = 0; | 66 virtual void EnableBitstreamConverter() = 0; |
| 52 | 67 |
| 53 protected: | 68 protected: |
| 54 friend class base::RefCountedThreadSafe<DemuxerStream>; | 69 friend class base::RefCountedThreadSafe<DemuxerStream>; |
| 55 virtual ~DemuxerStream(); | 70 virtual ~DemuxerStream(); |
| 56 }; | 71 }; |
| 57 | 72 |
| 58 } // namespace media | 73 } // namespace media |
| 59 | 74 |
| 60 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ | 75 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ |
| OLD | NEW |