Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
8a55377f
Commit
8a55377f
authored
Mar 07, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* transcode: downmixing to 1 and 2 channels now really mixes the input
channels. (Badly done but it gives some results ;)
parent
3acd8838
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
2 deletions
+61
-2
modules/stream_out/transcode.c
modules/stream_out/transcode.c
+61
-2
No files found.
modules/stream_out/transcode.c
View file @
8a55377f
...
...
@@ -972,8 +972,67 @@ static int transcode_audio_ffmpeg_process( sout_stream_t *p_stream,
id
->
i_dts
+=
(
I64C
(
1000000
)
*
id
->
i_buffer_pos
/
2
/
id
->
f_src
.
audio
.
i_channels
/
id
->
f_src
.
audio
.
i_rate
);
if
(
id
->
f_src
.
audio
.
i_channels
!=
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
)
if
(
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
==
1
&&
id
->
f_src
.
audio
.
i_channels
>
1
)
{
int16_t
*
p_sample
=
(
int16_t
*
)
aout_buf
.
p_buffer
;
int
i_src_c
=
id
->
f_src
.
audio
.
i_channels
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
aout_buf
.
i_nb_samples
;
i
++
)
{
int
j
,
c
=
0
;
for
(
j
=
1
;
j
<
i_src_c
;
j
++
)
{
c
+=
p_sample
[
i_src_c
*
i
+
j
];
}
p_sample
[
i
]
=
c
/
(
i_src_c
-
1
);
}
aout_buf
.
i_nb_bytes
=
i
*
2
;
}
else
if
(
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
==
2
&&
id
->
f_src
.
audio
.
i_channels
>
2
)
{
int
i_src_c
=
id
->
f_src
.
audio
.
i_channels
;
unsigned
int
i
;
static
const
float
mixf_l
[
4
][
6
]
=
/* [i_src_c - 3][channel index] */
{
{
0
.
00
,
1
.
00
,
0
.
00
,
0
.
00
,
0
.
00
,
0
.
00
},
/* 3 channels */
{
0
.
00
,
0
.
50
,
0
.
50
,
0
.
00
,
0
.
00
,
0
.
00
},
/* 4 channels */
{
0
.
00
,
0
.
50
,
0
.
00
,
0
.
50
,
0
.
00
,
0
.
00
},
/* 5 channels */
{
0
.
00
,
0
.
34
,
0
.
33
,
0
.
00
,
0
.
33
,
0
.
00
},
/* 6 channels */
};
static
const
float
mixf_r
[
4
][
6
]
=
/* [i_src_c - 3][channel index] */
{
{
0
.
00
,
1
.
00
,
0
.
00
,
0
.
00
,
0
.
00
,
0
.
00
},
/* 3 channels */
{
0
.
00
,
0
.
00
,
0
.
50
,
0
.
50
,
0
.
00
,
0
.
00
},
/* 4 channels */
{
0
.
00
,
0
.
00
,
0
.
50
,
0
.
00
,
0
.
50
,
0
.
00
},
/* 5 channels */
{
0
.
00
,
0
.
00
,
0
.
33
,
0
.
34
,
0
.
00
,
0
.
33
},
/* 6 channels */
};
for
(
i
=
0
;
i
<
aout_buf
.
i_nb_samples
;
i
++
)
{
int16_t
*
p_src
=
(
int16_t
*
)
aout_buf
.
p_buffer
+
i_src_c
*
i
;
int16_t
*
p_dst
=
(
int16_t
*
)
aout_buf
.
p_buffer
+
2
*
i
;
int
j
;
float
l
=
0
.
0
,
r
=
0
.
0
;
for
(
j
=
0
;
j
<
i_src_c
;
j
++
)
{
l
+=
mixf_l
[
i_src_c
-
3
][
j
]
*
p_src
[
j
];
r
+=
mixf_r
[
i_src_c
-
3
][
j
]
*
p_src
[
j
];
}
p_dst
[
0
]
=
(
int
)(
l
+
0
.
5
);
p_dst
[
1
]
=
(
int
)(
r
+
0
.
5
);
}
aout_buf
.
i_nb_bytes
=
i
*
2
*
2
;
}
else
if
(
id
->
f_src
.
audio
.
i_channels
!=
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
)
{
unsigned
int
i
;
int
j
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment