]> git.sesse.net Git - casparcg/blob - shell/default_audio_config.h
Fixed bug where audio filter did not use the input channel layout of a stream
[casparcg] / shell / default_audio_config.h
1 /*
2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
3 *
4 * This file is part of CasparCG (www.casparcg.com).
5 *
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Helge Norberg, helge.norberg@svt.se
20 */
21
22 #pragma once
23
24 #include <string>
25
26 #include <boost/property_tree/ptree.hpp>
27 #include <boost/property_tree/xml_parser.hpp>
28
29 namespace caspar {
30
31 std::wstring get_default_audio_config_xml()
32 {
33         return LR"(
34                 <audio>
35                         <channel-layouts>
36                                 <channel-layout name="mono"        type="mono"        num-channels="1" channel-order="FC" />
37                                 <channel-layout name="stereo"      type="stereo"      num-channels="2" channel-order="FL FR" />
38                                 <channel-layout name="matrix"      type="matrix"      num-channels="2" channel-order="ML MR" />
39                                 <channel-layout name="film"        type="5.1"         num-channels="6" channel-order="FL FC FR BL BR LFE" />
40                                 <channel-layout name="smpte"       type="5.1"         num-channels="6" channel-order="FL FR FC LFE BL BR" />
41                                 <channel-layout name="ebu_r123_8a" type="5.1+downmix" num-channels="8" channel-order="DL DR FL FR FC LFE BL BR" />
42                                 <channel-layout name="ebu_r123_8b" type="5.1+downmix" num-channels="8" channel-order="FL FR FC LFE BL BR DL DR" />
43                                 <channel-layout name="8ch"         type="8ch"         num-channels="8" />
44                                 <channel-layout name="16ch"        type="16ch"        num-channels="16" />
45                         </channel-layouts>
46                         <mix-configs>
47                                 <mix-config from-type="mono"          to-types="stereo, 5.1"  mix="FL = FC                                           | FR = FC" />
48                                 <mix-config from-type="mono"          to-types="5.1+downmix"  mix="FL = FC                                           | FR = FC                                         | DL = FC | DR = FC" />
49                                 <mix-config from-type="mono"          to-types="matrix"       mix="ML = FC                                           | MR = FC" />
50                                 <mix-config from-type="stereo"        to-types="mono"         mix="FC &lt; FL + FR" />
51                                 <mix-config from-type="stereo"        to-types="matrix"       mix="ML = FL                                           | MR = FR" />
52                                 <mix-config from-type="stereo"        to-types="5.1"          mix="FL = FL                                           | FR = FR" />
53                                 <mix-config from-type="stereo"        to-types="5.1+downmix"  mix="FL = FL                                           | FR = FR                                         | DL = FL | DR = FR" />
54                                 <mix-config from-type="5.1"           to-types="mono"         mix="FC &lt; FL + FR + 0.707*FC + 0.707*BL + 0.707*BR" />
55                                 <mix-config from-type="5.1"           to-types="stereo"       mix="FL &lt; FL + 0.707*FC + 0.707*BL                  | FR &lt; FR + 0.707*FC + 0.707*BR" />
56                                 <mix-config from-type="5.1"           to-types="5.1+downmix"  mix="FL = FL                                           | FR = FR                                         | FC = FC | BL = BL | BR = BR | LFE = LFE | DL &lt; FL + 0.707*FC + 0.707*BL | DR &lt; FR + 0.707*FC + 0.707*BR" />
57                                 <mix-config from-type="5.1"           to-types="matrix"       mix="ML = 0.3204*FL + 0.293*FC + -0.293*BL + -0.293*BR | MR = 0.3204*FR + 0.293*FC + 0.293*BL + 0.293*BR" />
58                                 <mix-config from-type="5.1+stereomix" to-types="mono"         mix="FC &lt; DL + DR" />
59                                 <mix-config from-type="5.1+stereomix" to-types="stereo"       mix="FL = DL                                           | FR = DR" />
60                                 <mix-config from-type="5.1+stereomix" to-types="5.1"          mix="FL = FL                                           | FR = FR                                         | FC = FC | BL = BL | BR = BR | LFE = LFE" />
61                                 <mix-config from-type="5.1+stereomix" to-types="matrix"       mix="ML = 0.3204*FL + 0.293*FC + -0.293*BL + -0.293*BR | MR = 0.3204*FR + 0.293*FC + 0.293*BL + 0.293*BR" />
62                         </mix-configs>
63                 </audio>
64         )";
65 }
66
67 boost::property_tree::wptree get_default_audio_config()
68 {
69         std::wstringstream stream(get_default_audio_config_xml());
70         boost::property_tree::wptree result;
71         boost::property_tree::xml_parser::read_xml(stream, result, boost::property_tree::xml_parser::trim_whitespace | boost::property_tree::xml_parser::no_comments);
72
73         return result;
74 }
75
76 }