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

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

Issue 1414793002: Update WebmMuxer for audio component of MediaStream recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address miu's comments Created 5 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2015 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_FILTERS_OPUS_CONSTANTS_H_
6 #define MEDIA_FILTERS_OPUS_CONSTANTS_H_
7
8 namespace media {
9
10 // The Opus specification is part of IETF RFC 6716:
11 // http://tools.ietf.org/html/rfc6716
12
13 // Opus Extra Data contents:
14 // - "OpusHead" magic signature (64 bits)
15 // - version number (8 bits)
16 // - Channels C (8 bits)
17 // - Pre-skip (16 bits)
18 // - Sampling rate (32 bits)
19 // - Gain in dB (16 bits, S7.8)
20 // - Mapping (8 bits, 0=single stream (mono/stereo) 1=Vorbis mapping,
21 // 2..254: reserved, 255: multistream with no mapping)
22 //
23 // - if (mapping != 0)
24 // - N = totel number of streams (8 bits)
25 // - M = number of paired streams (8 bits)
26 // - C times channel origin
27 // - if (C<2*M)
28 // - stream = byte/2
29 // - if (byte&0x1 == 0)
30 // - left
31 // else
32 // - right
33 // - else
34 // - stream = byte-M
35
36 enum {
37 // Default audio output channel layout. Used to initialize |stream_map| in
38 // OpusExtraData, and passed to opus_multistream_decoder_create() when the
39 // extra data does not contain mapping information. The values are valid only
40 // for mono and stereo output: Opus streams with more than 2 channels require
41 // a stream map.
42 OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT = 2,
43
miu 2015/11/04 00:18:28 nit: Please remove extra newline.
ajose 2015/11/04 20:51:19 Done.
44
Tom Finegan 2015/11/04 00:28:55 nit: one line of whitespace is probably good here
ajose 2015/11/04 20:51:19 Done.
45 // Opus uses Vorbis channel mapping, and Vorbis channel mapping specifies
46 // mappings for up to 8 channels. This information is part of the Vorbis I
47 // Specification:
48 // http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html
49 OPUS_MAX_VORBIS_CHANNELS = 8,
50
51 // Size of the Opus extra data excluding optional mapping information.
52 OPUS_EXTRADATA_SIZE = 19,
53 // Offset for magic signature "OpusHead"
54 OPUS_EXTRADATA_LABEL_OFFSET = 0,
55 // Offset to the Opus version number
56 OPUS_EXTRADATA_VERSION_OFFSET = 8,
57 // Offset to the channel count byte in the Opus extra data
58 OPUS_EXTRADATA_CHANNELS_OFFSET = 9,
59 // Offset to the pre-skip value in the Opus extra data
60 OPUS_EXTRADATA_SKIP_SAMPLES_OFFSET = 10,
61 // Offset to the sampling rate value in the Opus extra data
62 OPUS_EXTRADATA_SAMPLE_RATE_OFFSET = 12,
63 // Offset to the gain value in the Opus extra data
64 OPUS_EXTRADATA_GAIN_OFFSET = 16,
65 // Offset to the channel mapping byte in the Opus extra data
66 OPUS_EXTRADATA_CHANNEL_MAPPING_OFFSET = 18,
67
68 // Extra Data contains a stream map, beyond the always present
69 // |OPUS_EXTRADATA_SIZE| bytes of data. The mapping data contains stream
70 // count, coupling information, and per channel mapping values:
71 // - Byte 0: Number of streams.
72 // - Byte 1: Number coupled.
73 // - Byte 2: Starting at byte 2 are |extra_data->channels| uint8 mapping
74 // values.
75 OPUS_EXTRADATA_NUM_STREAMS_OFFSET = OPUS_EXTRADATA_SIZE,
76 OPUS_EXTRADATA_NUM_COUPLED_OFFSET = OPUS_EXTRADATA_NUM_STREAMS_OFFSET + 1,
77 OPUS_EXTRADATA_STREAM_MAP_OFFSET = OPUS_EXTRADATA_NUM_STREAMS_OFFSET + 2,
78 };
79
80 // Vorbis channel ordering for streams with >= 2 channels:
81 // 2 Channels
82 // L, R
83 // 3 Channels
84 // L, Center, R
85 // 4 Channels
86 // Front L, Front R, Back L, Back R
87 // 5 Channels
88 // Front L, Center, Front R, Back L, Back R
89 // 6 Channels (5.1)
90 // Front L, Center, Front R, Back L, Back R, LFE
91 // 7 channels (6.1)
92 // Front L, Front Center, Front R, Side L, Side R, Back Center, LFE
93 // 8 Channels (7.1)
94 // Front L, Center, Front R, Side L, Side R, Back L, Back R, LFE
95 //
96 // Channel ordering information is taken from section 4.3.9 of the Vorbis I
97 // Specification:
98 // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9
99
miu 2015/11/04 00:18:28 nit: Please remove extra newline here too.
ajose 2015/11/04 20:51:19 Done.
100 extern const uint8_t
101 kDefaultOpusChannelLayout[OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT];
102
103 // These are the FFmpeg channel layouts expressed using the position of each
104 // channel in the output stream from libopus.
105 extern const uint8_t kFFmpegChannelDecodingLayouts[OPUS_MAX_VORBIS_CHANNELS]
106 [OPUS_MAX_VORBIS_CHANNELS];
107
108 // Opus internal to Vorbis channel order mapping written in the header.
109 extern const uint8_t kOpusVorbisChannelMap[OPUS_MAX_VORBIS_CHANNELS]
110 [OPUS_MAX_VORBIS_CHANNELS];
111
112 } // namespace media
113
114 #endif // MEDIA_FILTERS_OPUS_CONSTANTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698