Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: media/base/demuxer_stream.h

Issue 10669022: Add status parameter to DemuxerStream::ReadCB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix seek_tester build buster Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Status returned in the Read() callback.
30 // kOk : Indicates the second parameter is Non-NULL and contains media data
31 // or the end of the stream.
32 // kAborted : Indicates an aborted Read(). This can happen if the
33 // DemuxerStream gets flushed and doesn't have any more data to
34 // return. The second parameter MUST be NULL when this status is
35 // returned.
36 // kConfigChange : Indicates that the AudioDecoderConfig or
37 // VideoDecoderConfig for the stream has changed.
38 // The DemuxerStream expects an audio_decoder_config() or
39 // video_decoder_config() call before Read() will start
40 // returning DecoderBuffers again. The decoder will need this
41 // new configuration to properly decode the buffers read
42 // from this point forward. The second parameter MUST be NULL
43 // when this status is returned.
44 enum Status {
45 kOk,
46 kAborted,
47 kConfigChanged,
48 };
49
29 // Request a buffer to returned via the provided callback. 50 // Request a buffer to returned via the provided callback.
30 // 51 //
31 // Non-NULL buffer pointers will contain media data or signal the end of the 52 // The first parameter indicates the status of the read.
32 // stream. A NULL pointer indicates an aborted Read(). This can happen if the 53 // The second parameter is Non-NULL and contains media data
Ami GONE FROM CHROMIUM 2012/07/12 17:10:26 s/Non/non/
acolwell GONE FROM CHROMIUM 2012/07/12 21:59:58 Done.
33 // DemuxerStream gets flushed and doesn't have any more data to return. 54 // or the end of the stream if the first parameter is kOk. NULL otherwise.
34 typedef base::Callback<void(const scoped_refptr<DecoderBuffer>&)> ReadCB; 55 typedef base::Callback<void(Status, const scoped_refptr<DecoderBuffer>&)>
56 ReadCB;
Ami GONE FROM CHROMIUM 2012/07/12 17:10:26 indent isn't supported by style guide. I'd put a
acolwell GONE FROM CHROMIUM 2012/07/12 21:59:58 Done.
35 virtual void Read(const ReadCB& read_cb) = 0; 57 virtual void Read(const ReadCB& read_cb) = 0;
36 58
37 // Returns the audio decoder configuration. It is an error to call this method 59 // Returns the audio decoder configuration. It is an error to call this method
38 // if type() != AUDIO. 60 // if type() != AUDIO.
39 virtual const AudioDecoderConfig& audio_decoder_config() = 0; 61 virtual const AudioDecoderConfig& audio_decoder_config() = 0;
40 62
41 // Returns the video decoder configuration. It is an error to call this method 63 // Returns the video decoder configuration. It is an error to call this method
42 // if type() != VIDEO. 64 // if type() != VIDEO.
43 virtual const VideoDecoderConfig& video_decoder_config() = 0; 65 virtual const VideoDecoderConfig& video_decoder_config() = 0;
44 66
45 // Returns time ranges known to have been seen by this stream. 67 // Returns time ranges known to have been seen by this stream.
46 virtual Ranges<base::TimeDelta> GetBufferedRanges() = 0; 68 virtual Ranges<base::TimeDelta> GetBufferedRanges() = 0;
47 69
48 // Returns the type of stream. 70 // Returns the type of stream.
49 virtual Type type() = 0; 71 virtual Type type() = 0;
50 72
51 virtual void EnableBitstreamConverter() = 0; 73 virtual void EnableBitstreamConverter() = 0;
52 74
53 protected: 75 protected:
54 friend class base::RefCountedThreadSafe<DemuxerStream>; 76 friend class base::RefCountedThreadSafe<DemuxerStream>;
55 virtual ~DemuxerStream(); 77 virtual ~DemuxerStream();
56 }; 78 };
57 79
58 } // namespace media 80 } // namespace media
59 81
60 #endif // MEDIA_BASE_DEMUXER_STREAM_H_ 82 #endif // MEDIA_BASE_DEMUXER_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698