content/media/fmp4/demuxer/channel_layout.h

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_
michael@0 6 #define MEDIA_BASE_CHANNEL_LAYOUT_H_
michael@0 7
michael@0 8
michael@0 9 namespace mp4_demuxer {
michael@0 10
michael@0 11 // Enumerates the various representations of the ordering of audio channels.
michael@0 12 // Logged to UMA, so never reuse a value, always add new/greater ones!
michael@0 13 enum ChannelLayout {
michael@0 14 CHANNEL_LAYOUT_NONE = 0,
michael@0 15 CHANNEL_LAYOUT_UNSUPPORTED = 1,
michael@0 16
michael@0 17 // Front C
michael@0 18 CHANNEL_LAYOUT_MONO = 2,
michael@0 19
michael@0 20 // Front L, Front R
michael@0 21 CHANNEL_LAYOUT_STEREO = 3,
michael@0 22
michael@0 23 // Front L, Front R, Back C
michael@0 24 CHANNEL_LAYOUT_2_1 = 4,
michael@0 25
michael@0 26 // Front L, Front R, Front C
michael@0 27 CHANNEL_LAYOUT_SURROUND = 5,
michael@0 28
michael@0 29 // Front L, Front R, Front C, Back C
michael@0 30 CHANNEL_LAYOUT_4_0 = 6,
michael@0 31
michael@0 32 // Front L, Front R, Side L, Side R
michael@0 33 CHANNEL_LAYOUT_2_2 = 7,
michael@0 34
michael@0 35 // Front L, Front R, Back L, Back R
michael@0 36 CHANNEL_LAYOUT_QUAD = 8,
michael@0 37
michael@0 38 // Front L, Front R, Front C, Side L, Side R
michael@0 39 CHANNEL_LAYOUT_5_0 = 9,
michael@0 40
michael@0 41 // Front L, Front R, Front C, Side L, Side R, LFE
michael@0 42 CHANNEL_LAYOUT_5_1 = 10,
michael@0 43
michael@0 44 // Front L, Front R, Front C, Back L, Back R
michael@0 45 CHANNEL_LAYOUT_5_0_BACK = 11,
michael@0 46
michael@0 47 // Front L, Front R, Front C, Back L, Back R, LFE
michael@0 48 CHANNEL_LAYOUT_5_1_BACK = 12,
michael@0 49
michael@0 50 // Front L, Front R, Front C, Side L, Side R, Back L, Back R
michael@0 51 CHANNEL_LAYOUT_7_0 = 13,
michael@0 52
michael@0 53 // Front L, Front R, Front C, Side L, Side R, LFE, Back L, Back R
michael@0 54 CHANNEL_LAYOUT_7_1 = 14,
michael@0 55
michael@0 56 // Front L, Front R, Front C, Side L, Side R, LFE, Front LofC, Front RofC
michael@0 57 CHANNEL_LAYOUT_7_1_WIDE = 15,
michael@0 58
michael@0 59 // Stereo L, Stereo R
michael@0 60 CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
michael@0 61
michael@0 62 // Stereo L, Stereo R, LFE
michael@0 63 CHANNEL_LAYOUT_2POINT1 = 17,
michael@0 64
michael@0 65 // Stereo L, Stereo R, Front C, LFE
michael@0 66 CHANNEL_LAYOUT_3_1 = 18,
michael@0 67
michael@0 68 // Stereo L, Stereo R, Front C, Rear C, LFE
michael@0 69 CHANNEL_LAYOUT_4_1 = 19,
michael@0 70
michael@0 71 // Stereo L, Stereo R, Front C, Side L, Side R, Back C
michael@0 72 CHANNEL_LAYOUT_6_0 = 20,
michael@0 73
michael@0 74 // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
michael@0 75 CHANNEL_LAYOUT_6_0_FRONT = 21,
michael@0 76
michael@0 77 // Stereo L, Stereo R, Side L, Side R, Front C, Rear C.
michael@0 78 CHANNEL_LAYOUT_HEXAGONAL = 22,
michael@0 79
michael@0 80 // Stereo L, Stereo R, Side L, Side R, Front C, Rear Center, LFE
michael@0 81 CHANNEL_LAYOUT_6_1 = 23,
michael@0 82
michael@0 83 // Stereo L, Stereo R, Back L, Back R, Front C, Rear Center, LFE
michael@0 84 CHANNEL_LAYOUT_6_1_BACK = 24,
michael@0 85
michael@0 86 // Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
michael@0 87 CHANNEL_LAYOUT_6_1_FRONT = 25,
michael@0 88
michael@0 89 // Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
michael@0 90 CHANNEL_LAYOUT_7_0_FRONT = 26,
michael@0 91
michael@0 92 // Front L, Front R, Front C, Back L, Back R, LFE, Front LofC, Front RofC
michael@0 93 CHANNEL_LAYOUT_7_1_WIDE_BACK = 27,
michael@0 94
michael@0 95 // Front L, Front R, Front C, Side L, Side R, Rear C, Back L, Back R.
michael@0 96 CHANNEL_LAYOUT_OCTAGONAL = 28,
michael@0 97
michael@0 98 // Channels are not explicitly mapped to speakers.
michael@0 99 CHANNEL_LAYOUT_DISCRETE = 29,
michael@0 100
michael@0 101 // Total number of layouts.
michael@0 102 CHANNEL_LAYOUT_MAX // Must always be last!
michael@0 103 };
michael@0 104
michael@0 105 enum Channels {
michael@0 106 LEFT = 0,
michael@0 107 RIGHT,
michael@0 108 CENTER,
michael@0 109 LFE,
michael@0 110 BACK_LEFT,
michael@0 111 BACK_RIGHT,
michael@0 112 LEFT_OF_CENTER,
michael@0 113 RIGHT_OF_CENTER,
michael@0 114 BACK_CENTER,
michael@0 115 SIDE_LEFT,
michael@0 116 SIDE_RIGHT,
michael@0 117 CHANNELS_MAX
michael@0 118 };
michael@0 119
michael@0 120 // Returns the expected channel position in an interleaved stream. Values of -1
michael@0 121 // mean the channel at that index is not used for that layout. Values range
michael@0 122 // from 0 to CHANNELS_MAX - 1.
michael@0 123 int ChannelOrder(ChannelLayout layout, Channels channel);
michael@0 124
michael@0 125 // Returns the number of channels in a given ChannelLayout.
michael@0 126 int ChannelLayoutToChannelCount(ChannelLayout layout);
michael@0 127
michael@0 128 // Given the number of channels, return the best layout,
michael@0 129 // or return CHANNEL_LAYOUT_UNSUPPORTED if there is no good match.
michael@0 130 ChannelLayout GuessChannelLayout(int channels);
michael@0 131
michael@0 132 } // namespace mp4_demuxer
michael@0 133
michael@0 134 #endif // MEDIA_BASE_CHANNEL_LAYOUT_H_

mercurial