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

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

Issue 7452016: Remove MediaFormat once and for all. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 9 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
« no previous file with comments | « media/filters/file_data_source.cc ('k') | media/media.gyp » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_NULL_AUDIO_RENDERER_H_ 5 #ifndef MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
6 #define MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 6 #define MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
7 7
8 // NullAudioRenderer effectively uses an extra thread to "throw away" the 8 // NullAudioRenderer effectively uses an extra thread to "throw away" the
9 // audio data at a rate resembling normal playback speed. It's just like 9 // audio data at a rate resembling normal playback speed. It's just like
10 // decoding to /dev/null! 10 // decoding to /dev/null!
11 // 11 //
12 // NullAudioRenderer can also be used in situations where the client has no 12 // NullAudioRenderer can also be used in situations where the client has no
13 // audio device or we haven't written an audio implementation for a particular 13 // audio device or we haven't written an audio implementation for a particular
14 // platform yet. 14 // platform yet.
15 //
16 // It supports any type of MediaFormat as long as the mime type has been set to
17 // audio/x-uncompressed. Playback rate is also supported and NullAudioRenderer
18 // will slow down and speed up accordingly.
19 15
20 #include <deque> 16 #include <deque>
21 17
22 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
23 #include "base/threading/platform_thread.h" 19 #include "base/threading/platform_thread.h"
24 #include "media/base/buffers.h" 20 #include "media/base/buffers.h"
25 #include "media/base/filters.h" 21 #include "media/base/filters.h"
26 #include "media/filters/audio_renderer_base.h" 22 #include "media/filters/audio_renderer_base.h"
27 23
28 namespace media { 24 namespace media {
(...skipping 11 matching lines...) Expand all
40 // PlatformThread::Delegate implementation. 36 // PlatformThread::Delegate implementation.
41 virtual void ThreadMain(); 37 virtual void ThreadMain();
42 38
43 protected: 39 protected:
44 // AudioRendererBase implementation. 40 // AudioRendererBase implementation.
45 virtual bool OnInitialize(const AudioDecoderConfig& config); 41 virtual bool OnInitialize(const AudioDecoderConfig& config);
46 virtual void OnStop(); 42 virtual void OnStop();
47 43
48 private: 44 private:
49 // A number to convert bytes written in FillBuffer to milliseconds based on 45 // A number to convert bytes written in FillBuffer to milliseconds based on
50 // the audio format. Calculated in OnInitialize by looking at the decoder's 46 // the audio format.
51 // MediaFormat.
52 size_t bytes_per_millisecond_; 47 size_t bytes_per_millisecond_;
53 48
54 // A buffer passed to FillBuffer to advance playback. 49 // A buffer passed to FillBuffer to advance playback.
55 scoped_array<uint8> buffer_; 50 scoped_array<uint8> buffer_;
56 size_t buffer_size_; 51 size_t buffer_size_;
57 52
58 // Separate thread used to throw away data. 53 // Separate thread used to throw away data.
59 base::PlatformThreadHandle thread_; 54 base::PlatformThreadHandle thread_;
60 55
61 // Shutdown flag. 56 // Shutdown flag.
62 bool shutdown_; 57 bool shutdown_;
63 58
64 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer); 59 DISALLOW_COPY_AND_ASSIGN(NullAudioRenderer);
65 }; 60 };
66 61
67 } // namespace media 62 } // namespace media
68 63
69 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_ 64 #endif // MEDIA_FILTERS_NULL_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « media/filters/file_data_source.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698