| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // return. The second parameter MUST be NULL when this status is | 33 // return. The second parameter MUST be NULL when this status is |
| 34 // returned. | 34 // returned. |
| 35 // kConfigChange : Indicates that the AudioDecoderConfig or | 35 // kConfigChange : Indicates that the AudioDecoderConfig or |
| 36 // VideoDecoderConfig for the stream has changed. | 36 // VideoDecoderConfig for the stream has changed. |
| 37 // The DemuxerStream expects an audio_decoder_config() or | 37 // The DemuxerStream expects an audio_decoder_config() or |
| 38 // video_decoder_config() call before Read() will start | 38 // video_decoder_config() call before Read() will start |
| 39 // returning DecoderBuffers again. The decoder will need this | 39 // returning DecoderBuffers again. The decoder will need this |
| 40 // new configuration to properly decode the buffers read | 40 // new configuration to properly decode the buffers read |
| 41 // from this point forward. The second parameter MUST be NULL | 41 // from this point forward. The second parameter MUST be NULL |
| 42 // when this status is returned. | 42 // when this status is returned. |
| 43 // This will only be returned if SupportsConfigChanges() |
| 44 // returns 'true' for this DemuxerStream. |
| 43 enum Status { | 45 enum Status { |
| 44 kOk, | 46 kOk, |
| 45 kAborted, | 47 kAborted, |
| 46 kConfigChanged, | 48 kConfigChanged, |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 // Request a buffer to returned via the provided callback. | 51 // Request a buffer to returned via the provided callback. |
| 50 // | 52 // |
| 51 // The first parameter indicates the status of the read. | 53 // The first parameter indicates the status of the read. |
| 52 // The second parameter is non-NULL and contains media data | 54 // The second parameter is non-NULL and contains media data |
| 53 // or the end of the stream if the first parameter is kOk. NULL otherwise. | 55 // or the end of the stream if the first parameter is kOk. NULL otherwise. |
| 54 typedef base::Callback<void(Status, | 56 typedef base::Callback<void(Status, |
| 55 const scoped_refptr<DecoderBuffer>&)>ReadCB; | 57 const scoped_refptr<DecoderBuffer>&)>ReadCB; |
| 56 virtual void Read(const ReadCB& read_cb) = 0; | 58 virtual void Read(const ReadCB& read_cb) = 0; |
| 57 | 59 |
| 58 // Returns the audio decoder configuration. It is an error to call this method | 60 // Returns the audio decoder configuration. It is an error to call this method |
| 59 // if type() != AUDIO. | 61 // if type() != AUDIO. |
| 60 virtual AudioDecoderConfig audio_decoder_config() = 0; | 62 virtual AudioDecoderConfig audio_decoder_config() = 0; |
| 61 | 63 |
| 62 // Returns the video decoder configuration. It is an error to call this method | 64 // Returns the video decoder configuration. It is an error to call this method |
| 63 // if type() != VIDEO. | 65 // if type() != VIDEO. |
| 64 virtual VideoDecoderConfig video_decoder_config() = 0; | 66 virtual VideoDecoderConfig video_decoder_config() = 0; |
| 65 | 67 |
| 66 // Returns the type of stream. | 68 // Returns the type of stream. |
| 67 virtual Type type() = 0; | 69 virtual Type type() = 0; |
| 68 | 70 |
| 69 virtual void EnableBitstreamConverter() = 0; | 71 virtual void EnableBitstreamConverter() = 0; |
| 70 | 72 |
| 73 // Whether or not this DemuxerStream allows midstream configuration changes. |
| 74 // |
| 75 // A DemuxerStream that returns 'true' to this may return the 'kConfigChange' |
| 76 // status from a Read() call. In this case the client is expected to be |
| 77 // capable of taking appropriate action to handle config changes. Otherwise |
| 78 // audio_decoder_config() and video_decoder_config()'s return values are |
| 79 // guaranteed to remain constant, and the client may make optimizations based |
| 80 // on this. |
| 81 virtual bool SupportsConfigChanges() = 0; |
| 82 |
| 71 protected: | 83 protected: |
| 72 // Only allow concrete implementations to get deleted. | 84 // Only allow concrete implementations to get deleted. |
| 73 virtual ~DemuxerStream(); | 85 virtual ~DemuxerStream(); |
| 74 }; | 86 }; |
| 75 | 87 |
| 76 } // namespace media | 88 } // namespace media |
| 77 | 89 |
| 78 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ | 90 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ |
| OLD | NEW |