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

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

Issue 10447035: Introducing DecoderBuffer and general Buffer cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/2011/2012/ Created 8 years, 6 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
« no previous file with comments | « media/filters/chunk_demuxer_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.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 (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_FILTERS_FFMPEG_AUDIO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "media/base/audio_decoder.h" 12 #include "media/base/audio_decoder.h"
13 13
14 struct AVCodecContext; 14 struct AVCodecContext;
15 15
16 namespace media { 16 namespace media {
17 17
18 class DataBuffer; 18 class DataBuffer;
19 class DecoderBuffer;
19 20
20 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder { 21 class MEDIA_EXPORT FFmpegAudioDecoder : public AudioDecoder {
21 public: 22 public:
22 FFmpegAudioDecoder(const base::Callback<MessageLoop*()>& message_loop_cb); 23 FFmpegAudioDecoder(const base::Callback<MessageLoop*()>& message_loop_cb);
23 24
24 // AudioDecoder implementation. 25 // AudioDecoder implementation.
25 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 26 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
26 const PipelineStatusCB& status_cb, 27 const PipelineStatusCB& status_cb,
27 const StatisticsCB& statistics_cb) OVERRIDE; 28 const StatisticsCB& statistics_cb) OVERRIDE;
28 virtual void Read(const ReadCB& read_cb) OVERRIDE; 29 virtual void Read(const ReadCB& read_cb) OVERRIDE;
29 virtual int bits_per_channel() OVERRIDE; 30 virtual int bits_per_channel() OVERRIDE;
30 virtual ChannelLayout channel_layout() OVERRIDE; 31 virtual ChannelLayout channel_layout() OVERRIDE;
31 virtual int samples_per_second() OVERRIDE; 32 virtual int samples_per_second() OVERRIDE;
32 virtual void Reset(const base::Closure& closure) OVERRIDE; 33 virtual void Reset(const base::Closure& closure) OVERRIDE;
33 34
34 protected: 35 protected:
35 virtual ~FFmpegAudioDecoder(); 36 virtual ~FFmpegAudioDecoder();
36 37
37 private: 38 private:
38 // Methods running on decoder thread. 39 // Methods running on decoder thread.
39 void DoInitialize(const scoped_refptr<DemuxerStream>& stream, 40 void DoInitialize(const scoped_refptr<DemuxerStream>& stream,
40 const PipelineStatusCB& status_cb, 41 const PipelineStatusCB& status_cb,
41 const StatisticsCB& statistics_cb); 42 const StatisticsCB& statistics_cb);
42 void DoReset(const base::Closure& closure); 43 void DoReset(const base::Closure& closure);
43 void DoRead(const ReadCB& read_cb); 44 void DoRead(const ReadCB& read_cb);
44 void DoDecodeBuffer(const scoped_refptr<Buffer>& input); 45 void DoDecodeBuffer(const scoped_refptr<DecoderBuffer>& input);
45 46
46 // Reads from the demuxer stream with corresponding callback method. 47 // Reads from the demuxer stream with corresponding callback method.
47 void ReadFromDemuxerStream(); 48 void ReadFromDemuxerStream();
48 void DecodeBuffer(const scoped_refptr<Buffer>& buffer); 49 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer);
49 50
50 // Updates the output buffer's duration and timestamp based on the input 51 // Updates the output buffer's duration and timestamp based on the input
51 // buffer. Will fall back to an estimated timestamp if the input lacks a 52 // buffer. Will fall back to an estimated timestamp if the input lacks a
52 // valid timestamp. 53 // valid timestamp.
53 void UpdateDurationAndTimestamp(const Buffer* input, DataBuffer* output); 54 void UpdateDurationAndTimestamp(const Buffer* input, DataBuffer* output);
54 55
55 // Calculates duration based on size of decoded audio bytes. 56 // Calculates duration based on size of decoded audio bytes.
56 base::TimeDelta CalculateDuration(int size); 57 base::TimeDelta CalculateDuration(int size);
57 58
58 // Delivers decoded samples to |read_cb_| and resets the callback. 59 // Delivers decoded samples to |read_cb_| and resets the callback.
(...skipping 21 matching lines...) Expand all
80 uint8* decoded_audio_; // Allocated via av_malloc(). 81 uint8* decoded_audio_; // Allocated via av_malloc().
81 82
82 ReadCB read_cb_; 83 ReadCB read_cb_;
83 84
84 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder); 85 DISALLOW_IMPLICIT_CONSTRUCTORS(FFmpegAudioDecoder);
85 }; 86 };
86 87
87 } // namespace media 88 } // namespace media
88 89
89 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_ 90 #endif // MEDIA_FILTERS_FFMPEG_AUDIO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer_unittest.cc ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698