Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
ad19cb3c
Commit
ad19cb3c
authored
Oct 25, 2013
by
Nicolas George
Committed by
Carl Eugen Hoyos
Nov 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/af_pan: support unknown layouts on input.
Fix trac ticket #2899. (cherry picked from commit
7b0a5873
)
parent
bc04a3a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
af_pan.c
libavfilter/af_pan.c
+8
-8
No files found.
libavfilter/af_pan.c
View file @
ad19cb3c
...
@@ -46,7 +46,6 @@ typedef struct PanContext {
...
@@ -46,7 +46,6 @@ typedef struct PanContext {
double
gain
[
MAX_CHANNELS
][
MAX_CHANNELS
];
double
gain
[
MAX_CHANNELS
][
MAX_CHANNELS
];
int64_t
need_renorm
;
int64_t
need_renorm
;
int
need_renumber
;
int
need_renumber
;
int
nb_input_channels
;
int
nb_output_channels
;
int
nb_output_channels
;
int
pure_gains
;
int
pure_gains
;
...
@@ -239,7 +238,7 @@ static int query_formats(AVFilterContext *ctx)
...
@@ -239,7 +238,7 @@ static int query_formats(AVFilterContext *ctx)
ff_set_common_samplerates
(
ctx
,
formats
);
ff_set_common_samplerates
(
ctx
,
formats
);
// inlink supports any channel layout
// inlink supports any channel layout
layouts
=
ff_all_channel_
layou
ts
();
layouts
=
ff_all_channel_
coun
ts
();
ff_channel_layouts_ref
(
layouts
,
&
inlink
->
out_channel_layouts
);
ff_channel_layouts_ref
(
layouts
,
&
inlink
->
out_channel_layouts
);
// outlink supports only requested output channel layout
// outlink supports only requested output channel layout
...
@@ -259,7 +258,6 @@ static int config_props(AVFilterLink *link)
...
@@ -259,7 +258,6 @@ static int config_props(AVFilterLink *link)
int
i
,
j
,
k
,
r
;
int
i
,
j
,
k
,
r
;
double
t
;
double
t
;
pan
->
nb_input_channels
=
av_get_channel_layout_nb_channels
(
link
->
channel_layout
);
if
(
pan
->
need_renumber
)
{
if
(
pan
->
need_renumber
)
{
// input channels were given by their name: renumber them
// input channels were given by their name: renumber them
for
(
i
=
j
=
0
;
i
<
MAX_CHANNELS
;
i
++
)
{
for
(
i
=
j
=
0
;
i
<
MAX_CHANNELS
;
i
++
)
{
...
@@ -273,7 +271,7 @@ static int config_props(AVFilterLink *link)
...
@@ -273,7 +271,7 @@ static int config_props(AVFilterLink *link)
// sanity check; can't be done in query_formats since the inlink
// sanity check; can't be done in query_formats since the inlink
// channel layout is unknown at that time
// channel layout is unknown at that time
if
(
pan
->
nb_input_
channels
>
SWR_CH_MAX
||
if
(
link
->
channels
>
SWR_CH_MAX
||
pan
->
nb_output_channels
>
SWR_CH_MAX
)
{
pan
->
nb_output_channels
>
SWR_CH_MAX
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"libswresample support a maximum of %d channels. "
"libswresample support a maximum of %d channels. "
...
@@ -288,6 +286,8 @@ static int config_props(AVFilterLink *link)
...
@@ -288,6 +286,8 @@ static int config_props(AVFilterLink *link)
0
,
ctx
);
0
,
ctx
);
if
(
!
pan
->
swr
)
if
(
!
pan
->
swr
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
if
(
!
link
->
channel_layout
)
av_opt_set_int
(
pan
->
swr
,
"ich"
,
link
->
channels
,
0
);
if
(
!
pan
->
out_channel_layout
)
if
(
!
pan
->
out_channel_layout
)
av_opt_set_int
(
pan
->
swr
,
"och"
,
pan
->
nb_output_channels
,
0
);
av_opt_set_int
(
pan
->
swr
,
"och"
,
pan
->
nb_output_channels
,
0
);
...
@@ -297,7 +297,7 @@ static int config_props(AVFilterLink *link)
...
@@ -297,7 +297,7 @@ static int config_props(AVFilterLink *link)
// get channel map from the pure gains
// get channel map from the pure gains
for
(
i
=
0
;
i
<
pan
->
nb_output_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
pan
->
nb_output_channels
;
i
++
)
{
int
ch_id
=
-
1
;
int
ch_id
=
-
1
;
for
(
j
=
0
;
j
<
pan
->
nb_input_
channels
;
j
++
)
{
for
(
j
=
0
;
j
<
link
->
channels
;
j
++
)
{
if
(
pan
->
gain
[
i
][
j
])
{
if
(
pan
->
gain
[
i
][
j
])
{
ch_id
=
j
;
ch_id
=
j
;
break
;
break
;
...
@@ -315,7 +315,7 @@ static int config_props(AVFilterLink *link)
...
@@ -315,7 +315,7 @@ static int config_props(AVFilterLink *link)
if
(
!
((
pan
->
need_renorm
>>
i
)
&
1
))
if
(
!
((
pan
->
need_renorm
>>
i
)
&
1
))
continue
;
continue
;
t
=
0
;
t
=
0
;
for
(
j
=
0
;
j
<
pan
->
nb_input_
channels
;
j
++
)
for
(
j
=
0
;
j
<
link
->
channels
;
j
++
)
t
+=
pan
->
gain
[
i
][
j
];
t
+=
pan
->
gain
[
i
][
j
];
if
(
t
>
-
1E-5
&&
t
<
1E-5
)
{
if
(
t
>
-
1E-5
&&
t
<
1E-5
)
{
// t is almost 0 but not exactly, this is probably a mistake
// t is almost 0 but not exactly, this is probably a mistake
...
@@ -324,7 +324,7 @@ static int config_props(AVFilterLink *link)
...
@@ -324,7 +324,7 @@ static int config_props(AVFilterLink *link)
"Degenerate coefficients while renormalizing
\n
"
);
"Degenerate coefficients while renormalizing
\n
"
);
continue
;
continue
;
}
}
for
(
j
=
0
;
j
<
pan
->
nb_input_
channels
;
j
++
)
for
(
j
=
0
;
j
<
link
->
channels
;
j
++
)
pan
->
gain
[
i
][
j
]
/=
t
;
pan
->
gain
[
i
][
j
]
/=
t
;
}
}
av_opt_set_int
(
pan
->
swr
,
"icl"
,
link
->
channel_layout
,
0
);
av_opt_set_int
(
pan
->
swr
,
"icl"
,
link
->
channel_layout
,
0
);
...
@@ -339,7 +339,7 @@ static int config_props(AVFilterLink *link)
...
@@ -339,7 +339,7 @@ static int config_props(AVFilterLink *link)
// summary
// summary
for
(
i
=
0
;
i
<
pan
->
nb_output_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
pan
->
nb_output_channels
;
i
++
)
{
cur
=
buf
;
cur
=
buf
;
for
(
j
=
0
;
j
<
pan
->
nb_input_
channels
;
j
++
)
{
for
(
j
=
0
;
j
<
link
->
channels
;
j
++
)
{
r
=
snprintf
(
cur
,
buf
+
sizeof
(
buf
)
-
cur
,
"%s%.3g i%d"
,
r
=
snprintf
(
cur
,
buf
+
sizeof
(
buf
)
-
cur
,
"%s%.3g i%d"
,
j
?
" + "
:
""
,
pan
->
gain
[
i
][
j
],
j
);
j
?
" + "
:
""
,
pan
->
gain
[
i
][
j
],
j
);
cur
+=
FFMIN
(
buf
+
sizeof
(
buf
)
-
cur
,
r
);
cur
+=
FFMIN
(
buf
+
sizeof
(
buf
)
-
cur
,
r
);
...
...
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