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 "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
12 #include "media/base/video_rotation.h" | 12 #include "media/base/video_rotation.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 class AudioDecoderConfig; | 16 class AudioDecoderConfig; |
17 class DecoderBuffer; | 17 class DecoderBuffer; |
18 class VideoDecoderConfig; | 18 class VideoDecoderConfig; |
19 | 19 |
20 class MEDIA_EXPORT DemuxerStream { | 20 class MEDIA_EXPORT DemuxerStream { |
21 public: | 21 public: |
22 enum Type { | 22 enum Type { |
23 UNKNOWN, | 23 UNKNOWN, |
24 AUDIO, | 24 AUDIO, |
25 VIDEO, | 25 VIDEO, |
26 TEXT, | 26 TEXT, |
27 NUM_TYPES, // Always keep this entry as the last one! | 27 TYPE_MAX = TEXT, |
28 }; | 28 }; |
29 | 29 |
30 enum Liveness { | 30 enum Liveness { |
31 LIVENESS_UNKNOWN, | 31 LIVENESS_UNKNOWN, |
32 LIVENESS_RECORDED, | 32 LIVENESS_RECORDED, |
33 LIVENESS_LIVE, | 33 LIVENESS_LIVE, |
| 34 LIVENESS_MAX = LIVENESS_LIVE, |
34 }; | 35 }; |
35 | 36 |
36 // Status returned in the Read() callback. | 37 // Status returned in the Read() callback. |
37 // kOk : Indicates the second parameter is Non-NULL and contains media data | 38 // kOk : Indicates the second parameter is Non-NULL and contains media data |
38 // or the end of the stream. | 39 // or the end of the stream. |
39 // kAborted : Indicates an aborted Read(). This can happen if the | 40 // kAborted : Indicates an aborted Read(). This can happen if the |
40 // DemuxerStream gets flushed and doesn't have any more data to | 41 // DemuxerStream gets flushed and doesn't have any more data to |
41 // return. The second parameter MUST be NULL when this status is | 42 // return. The second parameter MUST be NULL when this status is |
42 // returned. | 43 // returned. |
43 // kConfigChange : Indicates that the AudioDecoderConfig or | 44 // kConfigChange : Indicates that the AudioDecoderConfig or |
44 // VideoDecoderConfig for the stream has changed. | 45 // VideoDecoderConfig for the stream has changed. |
45 // The DemuxerStream expects an audio_decoder_config() or | 46 // The DemuxerStream expects an audio_decoder_config() or |
46 // video_decoder_config() call before Read() will start | 47 // video_decoder_config() call before Read() will start |
47 // returning DecoderBuffers again. The decoder will need this | 48 // returning DecoderBuffers again. The decoder will need this |
48 // new configuration to properly decode the buffers read | 49 // new configuration to properly decode the buffers read |
49 // from this point forward. The second parameter MUST be NULL | 50 // from this point forward. The second parameter MUST be NULL |
50 // when this status is returned. | 51 // when this status is returned. |
51 // This will only be returned if SupportsConfigChanges() | 52 // This will only be returned if SupportsConfigChanges() |
52 // returns 'true' for this DemuxerStream. | 53 // returns 'true' for this DemuxerStream. |
53 enum Status { | 54 enum Status { |
54 kOk, | 55 kOk, |
55 kAborted, | 56 kAborted, |
56 kConfigChanged, | 57 kConfigChanged, |
| 58 kStatusMax = kConfigChanged, |
57 }; | 59 }; |
58 | 60 |
59 // Request a buffer to returned via the provided callback. | 61 // Request a buffer to returned via the provided callback. |
60 // | 62 // |
61 // The first parameter indicates the status of the read. | 63 // The first parameter indicates the status of the read. |
62 // The second parameter is non-NULL and contains media data | 64 // The second parameter is non-NULL and contains media data |
63 // or the end of the stream if the first parameter is kOk. NULL otherwise. | 65 // or the end of the stream if the first parameter is kOk. NULL otherwise. |
64 typedef base::Callback<void(Status, | 66 typedef base::Callback<void(Status, |
65 const scoped_refptr<DecoderBuffer>&)>ReadCB; | 67 const scoped_refptr<DecoderBuffer>&)>ReadCB; |
66 virtual void Read(const ReadCB& read_cb) = 0; | 68 virtual void Read(const ReadCB& read_cb) = 0; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 virtual void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) = 0; | 112 virtual void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) = 0; |
111 | 113 |
112 protected: | 114 protected: |
113 // Only allow concrete implementations to get deleted. | 115 // Only allow concrete implementations to get deleted. |
114 virtual ~DemuxerStream(); | 116 virtual ~DemuxerStream(); |
115 }; | 117 }; |
116 | 118 |
117 } // namespace media | 119 } // namespace media |
118 | 120 |
119 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ | 121 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ |
OLD | NEW |