1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
From: Timo Teräs
Posted upstream, see:
https://trac.videolan.org/vlc/ticket/12122
diff -ru vlc-2.1.5.orig/modules/audio_filter/channel_mixer/trivial.c vlc-2.1.5/modules/audio_filter/channel_mixer/trivial.c
--- vlc-2.1.5.orig/modules/audio_filter/channel_mixer/trivial.c 2013-06-24 21:00:38.000000000 -0300
+++ vlc-2.1.5/modules/audio_filter/channel_mixer/trivial.c 2014-09-12 16:16:49.288413334 -0300
@@ -133,7 +133,9 @@
{
p_src++;
}
- if ( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER )
+ if ( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER ||
+ p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_LEFT ||
+ p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_RIGHT )
{
/* Mono mode */
for ( i = p_in_buf->i_nb_samples; i--; )
diff -ru vlc-2.1.5.orig/modules/stream_out/transcode/audio.c vlc-2.1.5/modules/stream_out/transcode/audio.c
--- vlc-2.1.5.orig/modules/stream_out/transcode/audio.c 2014-04-22 11:03:57.000000000 -0300
+++ vlc-2.1.5/modules/stream_out/transcode/audio.c 2014-09-12 16:28:50.805087137 -0300
@@ -35,6 +35,11 @@
#include <vlc_meta.h>
#include <vlc_modules.h>
+static const int pi_mono_channel_maps[3] =
+{
+ AOUT_CHAN_CENTER, AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
+};
+
static const int pi_channels_maps[6] =
{
0,
@@ -167,7 +172,11 @@
if( !id->p_encoder->fmt_in.audio.i_physical_channels
|| !id->p_encoder->fmt_in.audio.i_original_channels )
{
- if( id->p_encoder->fmt_in.audio.i_channels < 6 )
+ if (id->p_encoder->fmt_in.audio.i_channels == 1)
+ id->p_encoder->fmt_in.audio.i_physical_channels =
+ id->p_encoder->fmt_in.audio.i_original_channels =
+ pi_mono_channel_maps[p_sys->i_mono_source];
+ else if( id->p_encoder->fmt_in.audio.i_channels < 6 )
id->p_encoder->fmt_in.audio.i_physical_channels =
id->p_encoder->fmt_in.audio.i_original_channels =
pi_channels_maps[id->p_encoder->fmt_in.audio.i_channels];
diff -ru vlc-2.1.5.orig/modules/stream_out/transcode/transcode.c vlc-2.1.5/modules/stream_out/transcode/transcode.c
--- vlc-2.1.5.orig/modules/stream_out/transcode/transcode.c 2013-06-24 21:00:38.000000000 -0300
+++ vlc-2.1.5/modules/stream_out/transcode/transcode.c 2014-09-12 11:58:28.988259972 -0300
@@ -99,6 +99,9 @@
#define ACHANS_TEXT N_("Audio channels")
#define ACHANS_LONGTEXT N_( \
"Number of audio channels in the transcoded streams." )
+#define AMONOSRC_TEXT N_("Audio source for mono")
+#define AMONOSRC_LONGTEXT N_( \
+ "Audio source channel for mono output (0=center, 1=left, 2=right)." )
#define AFILTER_TEXT N_("Audio filter")
#define AFILTER_LONGTEXT N_( \
"Audio filters will be applied to the audio streams (after conversion " \
@@ -199,6 +202,8 @@
ALANG_LONGTEXT, true )
add_integer( SOUT_CFG_PREFIX "channels", 0, ACHANS_TEXT,
ACHANS_LONGTEXT, false )
+ add_integer( SOUT_CFG_PREFIX "monosrc", 0, AMONOSRC_TEXT,
+ AMONOSRC_LONGTEXT, false )
add_integer( SOUT_CFG_PREFIX "samplerate", 0, ARATE_TEXT,
ARATE_LONGTEXT, true )
add_bool( SOUT_CFG_PREFIX "audio-sync", false, ASYNC_TEXT,
@@ -232,7 +237,7 @@
"venc", "vcodec", "vb",
"scale", "fps", "width", "height", "vfilter", "deinterlace",
"deinterlace-module", "threads", "hurry-up", "aenc", "acodec", "ab", "alang",
- "afilter", "samplerate", "channels", "senc", "scodec", "soverlay",
+ "afilter", "samplerate", "channels", "monosrc", "senc", "scodec", "soverlay",
"sfilter", "osd", "audio-sync", "high-priority", "maxwidth", "maxheight",
NULL
};
@@ -296,6 +301,8 @@
p_sys->i_channels = var_GetInteger( p_stream, SOUT_CFG_PREFIX "channels" );
+ p_sys->i_mono_source = var_GetInteger( p_stream, SOUT_CFG_PREFIX "monosrc" );
+
if( p_sys->i_acodec )
{
if( ( p_sys->i_acodec == VLC_CODEC_MP3 ||
diff -ru vlc-2.1.5.orig/modules/stream_out/transcode/transcode.h vlc-2.1.5/modules/stream_out/transcode/transcode.h
--- vlc-2.1.5.orig/modules/stream_out/transcode/transcode.h 2014-04-22 11:03:57.000000000 -0300
+++ vlc-2.1.5/modules/stream_out/transcode/transcode.h 2014-09-12 11:50:13.548255065 -0300
@@ -31,6 +31,7 @@
config_chain_t *p_audio_cfg;
uint32_t i_sample_rate;
uint32_t i_channels;
+ uint32_t i_mono_source;
int i_abitrate;
char *psz_af;
diff -ru vlc-2.1.5.orig/src/audio_output/common.c vlc-2.1.5/src/audio_output/common.c
--- vlc-2.1.5.orig/src/audio_output/common.c 2013-12-03 11:12:35.000000000 -0200
+++ vlc-2.1.5/src/audio_output/common.c 2014-09-12 16:26:54.821752658 -0300
@@ -107,13 +107,12 @@
case AOUT_CHAN_LEFT:
case AOUT_CHAN_RIGHT:
case AOUT_CHAN_CENTER:
- if ( (p_format->i_original_channels & AOUT_CHAN_CENTER)
- || (p_format->i_original_channels
- & (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT)) )
- return "Mono";
- else if ( p_format->i_original_channels & AOUT_CHAN_LEFT )
+ if ( p_format->i_original_channels & AOUT_CHAN_LEFT )
return "Left";
- return "Right";
+ else if ( p_format->i_original_channels & AOUT_CHAN_RIGHT )
+ return "Right";
+ return "Mono";
+
case AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT:
if ( p_format->i_original_channels & AOUT_CHAN_REVERSESTEREO )
{
|