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

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

Issue 7867051: Introduce AudioDecoderConfig to migrate away from GetAVStream(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: samples_per_second Created 9 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
6 #define MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/channel_layout.h"
11 #include "media/base/media_export.h"
12
13 namespace media {
14
15 enum AudioCodec {
16 kUnknownAudioCodec,
17 kCodecAAC,
18 kCodecMP3,
19 kCodecPCM,
20 kCodecVorbis,
21
22 // DO NOT ADD RANDOM AUDIO CODECS!
23 //
24 // The only acceptable time to add a new codec is if there is production code
25 // that uses said codec in the same CL.
26 };
27
28 class MEDIA_EXPORT AudioDecoderConfig {
29 public:
30 // Constructs an uninitialized object. Clients should call Initialize() with
31 // appropriate values before using.
32 AudioDecoderConfig();
33
34 // Constructs an initialized object. It is acceptable to pass in NULL for
35 // |extra_data|, otherwise the memory is copied.
36 AudioDecoderConfig(AudioCodec codec, int bits_per_channel,
37 ChannelLayout channel_layout, int samples_per_second,
38 const uint8* extra_data, size_t extra_data_size);
39
40 ~AudioDecoderConfig();
41
42 // Resets the internal state of this object.
43 void Initialize(AudioCodec codec, int bits_per_channel,
44 ChannelLayout channel_layout, int samples_per_second,
45 const uint8* extra_data, size_t extra_data_size);
46
47 // Returns true if this object has appropriate configuration values, false
48 // otherwise.
49 bool IsValidConfig() const;
50
51 AudioCodec codec() const;
52 int bits_per_channel() const;
53 ChannelLayout channel_layout() const;
54 int samples_per_second() const;
55
56 // Optional byte data required to initialize audio decoders such as Vorbis
57 // codebooks.
58 uint8* extra_data() const;
59 size_t extra_data_size() const;
60
61 private:
62 AudioCodec codec_;
63 int bits_per_channel_;
64 ChannelLayout channel_layout_;
65 int samples_per_second_;
66
67 scoped_array<uint8> extra_data_;
68 size_t extra_data_size_;
69
70 DISALLOW_COPY_AND_ASSIGN(AudioDecoderConfig);
71 };
72
73 } // namespace media
74
75 #endif // MEDIA_BASE_AUDIO_DECODER_CONFIG_H_
OLDNEW
« no previous file with comments | « content/renderer/media/audio_renderer_impl_unittest.cc ('k') | media/base/audio_decoder_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698