Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
85a6404d
Commit
85a6404d
authored
Jul 24, 2021
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/formats: describe conversion in negotiation structure.
parent
86d3dd56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
33 deletions
+18
-33
avfiltergraph.c
libavfilter/avfiltergraph.c
+12
-33
formats.c
libavfilter/formats.c
+4
-0
formats.h
libavfilter/formats.h
+2
-0
No files found.
libavfilter/avfiltergraph.c
View file @
85a6404d
...
...
@@ -430,7 +430,7 @@ static int formats_declared(AVFilterContext *f)
static
int
query_formats
(
AVFilterGraph
*
graph
,
AVClass
*
log_ctx
)
{
int
i
,
j
,
ret
;
int
scaler_count
=
0
,
resampl
er_count
=
0
;
int
convert
er_count
=
0
;
int
count_queried
=
0
;
/* successful calls to query_formats() */
int
count_merged
=
0
;
/* successful merge of formats lists */
int
count_already_merged
=
0
;
/* lists already merged */
...
...
@@ -497,6 +497,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
const
AVFilter
*
filter
;
AVFilterLink
*
inlink
,
*
outlink
;
char
inst_name
[
30
];
const
char
*
opts
;
if
(
graph
->
disable_auto_convert
)
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
...
...
@@ -507,40 +508,18 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
}
/* couldn't merge format lists. auto-insert conversion filter */
switch
(
link
->
type
)
{
case
AVMEDIA_TYPE_VIDEO
:
if
(
!
(
filter
=
avfilter_get_by_name
(
"scale"
)))
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"'scale' filter "
"not present, cannot convert pixel formats.
\n
"
);
return
AVERROR
(
EINVAL
);
}
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto_scaler_%d"
,
scaler_count
++
);
if
((
ret
=
avfilter_graph_create_filter
(
&
convert
,
filter
,
inst_name
,
graph
->
scale_sws_opts
,
NULL
,
graph
))
<
0
)
return
ret
;
break
;
case
AVMEDIA_TYPE_AUDIO
:
if
(
!
(
filter
=
avfilter_get_by_name
(
"aresample"
)))
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"'aresample' filter "
"not present, cannot convert audio formats.
\n
"
);
return
AVERROR
(
EINVAL
);
}
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto_resampler_%d"
,
resampler_count
++
);
if
((
ret
=
avfilter_graph_create_filter
(
&
convert
,
filter
,
inst_name
,
graph
->
aresample_swr_opts
,
NULL
,
graph
))
<
0
)
return
ret
;
break
;
default:
if
(
!
(
filter
=
avfilter_get_by_name
(
neg
->
conversion_filter
)))
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"'%s' filter not present, cannot convert formats.
\n
"
,
neg
->
conversion_filter
);
return
AVERROR
(
EINVAL
);
}
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto_%s_%d"
,
neg
->
conversion_filter
,
converter_count
++
);
opts
=
FF_FIELD_AT
(
char
*
,
neg
->
conversion_opts_offset
,
*
graph
);
ret
=
avfilter_graph_create_filter
(
&
convert
,
filter
,
inst_name
,
opts
,
NULL
,
graph
);
if
(
ret
<
0
)
return
ret
;
if
((
ret
=
avfilter_insert_filter
(
link
,
convert
,
0
,
0
))
<
0
)
return
ret
;
...
...
libavfilter/formats.c
View file @
85a6404d
...
...
@@ -329,11 +329,15 @@ static const AVFilterFormatsMerger mergers_audio[] = {
static
const
AVFilterNegotiation
negotiate_video
=
{
.
nb
=
FF_ARRAY_ELEMS
(
mergers_video
),
.
mergers
=
mergers_video
,
.
conversion_filter
=
"scale"
,
.
conversion_opts_offset
=
offsetof
(
AVFilterGraph
,
scale_sws_opts
),
};
static
const
AVFilterNegotiation
negotiate_audio
=
{
.
nb
=
FF_ARRAY_ELEMS
(
mergers_audio
),
.
mergers
=
mergers_audio
,
.
conversion_filter
=
"aresample"
,
.
conversion_opts_offset
=
offsetof
(
AVFilterGraph
,
aresample_swr_opts
),
};
const
AVFilterNegotiation
*
ff_filter_get_negotiation
(
AVFilterLink
*
link
)
...
...
libavfilter/formats.h
View file @
85a6404d
...
...
@@ -78,6 +78,8 @@ typedef struct AVFilterFormatMerger {
typedef
struct
AVFilterNegotiation
{
unsigned
nb
;
const
AVFilterFormatsMerger
*
mergers
;
const
char
*
conversion_filter
;
unsigned
conversion_opts_offset
;
}
AVFilterNegotiation
;
const
AVFilterNegotiation
*
ff_filter_get_negotiation
(
AVFilterLink
*
link
);
...
...
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