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

Side by Side Diff: media/filters/decoder_stream.h

Issue 1834303005: Refactor audio and video decoder status into common file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 4 years, 8 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
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/decoder_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_FILTERS_DECODER_STREAM_H_ 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_H_
6 #define MEDIA_FILTERS_DECODER_STREAM_H_ 6 #define MEDIA_FILTERS_DECODER_STREAM_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 21 matching lines...) Expand all
32 class DecryptingDemuxerStream; 32 class DecryptingDemuxerStream;
33 33
34 // Wraps a DemuxerStream and a list of Decoders and provides decoded 34 // Wraps a DemuxerStream and a list of Decoders and provides decoded
35 // output to its client (e.g. Audio/VideoRendererImpl). 35 // output to its client (e.g. Audio/VideoRendererImpl).
36 template<DemuxerStream::Type StreamType> 36 template<DemuxerStream::Type StreamType>
37 class MEDIA_EXPORT DecoderStream { 37 class MEDIA_EXPORT DecoderStream {
38 public: 38 public:
39 typedef DecoderStreamTraits<StreamType> StreamTraits; 39 typedef DecoderStreamTraits<StreamType> StreamTraits;
40 typedef typename StreamTraits::DecoderType Decoder; 40 typedef typename StreamTraits::DecoderType Decoder;
41 typedef typename StreamTraits::OutputType Output; 41 typedef typename StreamTraits::OutputType Output;
42 typedef typename Decoder::Status DecoderStatus;
43 42
44 enum Status { 43 enum Status {
45 OK, // Everything went as planned. 44 OK, // Everything went as planned.
46 ABORTED, // Read aborted due to Reset() during pending read. 45 ABORTED, // Read aborted due to Reset() during pending read.
47 DEMUXER_READ_ABORTED, // Demuxer returned aborted read. 46 DEMUXER_READ_ABORTED, // Demuxer returned aborted read.
48 DECODE_ERROR, // Decoder returned decode error. 47 DECODE_ERROR, // Decoder returned decode error.
49 }; 48 };
50 49
51 // Indicates completion of a DecoderStream initialization. 50 // Indicates completion of a DecoderStream initialization.
52 typedef base::Callback<void(bool success)> InitCB; 51 typedef base::Callback<void(bool success)> InitCB;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const scoped_refptr<Output>& output); 148 const scoped_refptr<Output>& output);
150 149
151 // Decodes |buffer| and returns the result via OnDecodeOutputReady(). 150 // Decodes |buffer| and returns the result via OnDecodeOutputReady().
152 void Decode(const scoped_refptr<DecoderBuffer>& buffer); 151 void Decode(const scoped_refptr<DecoderBuffer>& buffer);
153 152
154 // Flushes the decoder with an EOS buffer to retrieve internally buffered 153 // Flushes the decoder with an EOS buffer to retrieve internally buffered
155 // decoder output. 154 // decoder output.
156 void FlushDecoder(); 155 void FlushDecoder();
157 156
158 // Callback for Decoder::Decode(). 157 // Callback for Decoder::Decode().
159 void OnDecodeDone(int buffer_size, bool end_of_stream, DecoderStatus status); 158 void OnDecodeDone(int buffer_size, bool end_of_stream, DecodeStatus status);
160 159
161 // Output callback passed to Decoder::Initialize(). 160 // Output callback passed to Decoder::Initialize().
162 void OnDecodeOutputReady(const scoped_refptr<Output>& output); 161 void OnDecodeOutputReady(const scoped_refptr<Output>& output);
163 162
164 // Reads a buffer from |stream_| and returns the result via OnBufferReady(). 163 // Reads a buffer from |stream_| and returns the result via OnBufferReady().
165 void ReadFromDemuxerStream(); 164 void ReadFromDemuxerStream();
166 165
167 // Callback for DemuxerStream::Read(). 166 // Callback for DemuxerStream::Read().
168 void OnBufferReady(DemuxerStream::Status status, 167 void OnBufferReady(DemuxerStream::Status status,
169 const scoped_refptr<DecoderBuffer>& buffer); 168 const scoped_refptr<DecoderBuffer>& buffer);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 234
236 template <> 235 template <>
237 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const; 236 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const;
238 237
239 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream; 238 typedef DecoderStream<DemuxerStream::VIDEO> VideoFrameStream;
240 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream; 239 typedef DecoderStream<DemuxerStream::AUDIO> AudioBufferStream;
241 240
242 } // namespace media 241 } // namespace media
243 242
244 #endif // MEDIA_FILTERS_DECODER_STREAM_H_ 243 #endif // MEDIA_FILTERS_DECODER_STREAM_H_
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/decoder_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698