Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e67a87ea
Commit
e67a87ea
authored
Feb 25, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_(no)format: switch to an AVOptions-based system.
parent
0af7fe1f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
10 deletions
+75
-10
filters.texi
doc/filters.texi
+20
-8
avfilter.c
libavfilter/avfilter.c
+27
-0
vf_format.c
libavfilter/vf_format.c
+28
-2
No files found.
doc/filters.texi
View file @
e67a87ea
...
@@ -1067,16 +1067,22 @@ Convert the input video to one of the specified pixel formats.
...
@@ -1067,16 +1067,22 @@ Convert the input video to one of the specified pixel formats.
Libavfilter will try to pick one that is supported for the input to
Libavfilter will try to pick one that is supported for the input to
the next filter.
the next filter.
The filter accepts a list of pixel format names, separated by ":",
This filter accepts the following parameters:
for example "yuv420p:monow:rgb24".
@table @option
@item pix_fmts
A '|'-separated list of pixel format names, for example
"pix_fmts=yuv420p|monow|rgb24".
@end table
Some examples follow:
Some examples follow:
@example
@example
# convert the input video to the format "yuv420p"
# convert the input video to the format "yuv420p"
format=yuv420p
format=
pix_fmts=
yuv420p
# convert the input video to any of the formats in the list
# convert the input video to any of the formats in the list
format=
yuv420p:yuv444p:
yuv410p
format=
pix_fmts=yuv420p|yuv444p|
yuv410p
@end example
@end example
@section fps
@section fps
...
@@ -1336,17 +1342,23 @@ alpha component (if available). The default value in input is 0.
...
@@ -1336,17 +1342,23 @@ alpha component (if available). The default value in input is 0.
Force libavfilter not to use any of the specified pixel formats for the
Force libavfilter not to use any of the specified pixel formats for the
input to the next filter.
input to the next filter.
The filter accepts a list of pixel format names, separated by ":",
This filter accepts the following parameters:
for example "yuv420p:monow:rgb24".
@table @option
@item pix_fmts
A '|'-separated list of pixel format names, for example
"pix_fmts=yuv420p|monow|rgb24".
@end table
Some examples follow:
Some examples follow:
@example
@example
# force libavfilter to use a format different from "yuv420p" for the
# force libavfilter to use a format different from "yuv420p" for the
# input to the vflip filter
# input to the vflip filter
noformat=yuv420p,vflip
noformat=
pix_fmts=
yuv420p,vflip
# convert the input video to any of the formats not contained in the list
# convert the input video to any of the formats not contained in the list
noformat=yuv420p
:yuv444p:
yuv410p
noformat=yuv420p
|yuv444p|
yuv410p
@end example
@end example
@section null
@section null
...
...
libavfilter/avfilter.c
View file @
e67a87ea
...
@@ -486,6 +486,33 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
...
@@ -486,6 +486,33 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
ret
=
av_dict_parse_string
(
&
options
,
args
,
"="
,
":"
,
0
);
ret
=
av_dict_parse_string
(
&
options
,
args
,
"="
,
":"
,
0
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
fail
;
goto
fail
;
#if FF_API_OLD_FILTER_OPTS
}
else
if
(
!
strcmp
(
filter
->
filter
->
name
,
"format"
)
||
!
strcmp
(
filter
->
filter
->
name
,
"noformat"
))
{
/* a hack for compatibility with the old syntax
* replace colons with |s */
char
*
copy
=
av_strdup
(
args
);
char
*
p
=
copy
;
if
(
!
copy
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
if
(
strchr
(
copy
,
':'
))
{
av_log
(
filter
,
AV_LOG_WARNING
,
"This syntax is deprecated. Use "
"'|' to separate the list items.
\n
"
);
}
while
((
p
=
strchr
(
p
,
':'
)))
*
p
++
=
'|'
;
ret
=
process_unnamed_options
(
filter
,
&
options
,
copy
);
av_freep
(
&
copy
);
if
(
ret
<
0
)
goto
fail
;
#endif
}
else
{
}
else
{
ret
=
process_unnamed_options
(
filter
,
&
options
,
args
);
ret
=
process_unnamed_options
(
filter
,
&
options
,
args
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
...
libavfilter/vf_format.c
View file @
e67a87ea
...
@@ -28,12 +28,16 @@
...
@@ -28,12 +28,16 @@
#include "libavutil/internal.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "avfilter.h"
#include "formats.h"
#include "formats.h"
#include "internal.h"
#include "internal.h"
#include "video.h"
#include "video.h"
typedef
struct
{
typedef
struct
{
const
AVClass
*
class
;
char
*
pix_fmts
;
/**
/**
* List of flags telling if a given image format has been listed
* List of flags telling if a given image format has been listed
* as argument to the filter.
* as argument to the filter.
...
@@ -52,8 +56,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
...
@@ -52,8 +56,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
enum
AVPixelFormat
pix_fmt
;
enum
AVPixelFormat
pix_fmt
;
/* parse the list of formats */
/* parse the list of formats */
for
(
cur
=
args
;
cur
;
cur
=
sep
?
sep
+
1
:
NULL
)
{
for
(
cur
=
format
->
pix_fmts
;
cur
;
cur
=
sep
?
sep
+
1
:
NULL
)
{
if
(
!
(
sep
=
strchr
(
cur
,
'
:
'
)))
if
(
!
(
sep
=
strchr
(
cur
,
'
|
'
)))
pix_fmt_name_len
=
strlen
(
cur
);
pix_fmt_name_len
=
strlen
(
cur
);
else
else
pix_fmt_name_len
=
sep
-
cur
;
pix_fmt_name_len
=
sep
-
cur
;
...
@@ -92,6 +96,12 @@ static AVFilterFormats *make_format_list(FormatContext *format, int flag)
...
@@ -92,6 +96,12 @@ static AVFilterFormats *make_format_list(FormatContext *format, int flag)
return
formats
;
return
formats
;
}
}
#define OFFSET(x) offsetof(FormatContext, x)
static
const
AVOption
options
[]
=
{
{
"pix_fmts"
,
"A '|'-separated list of pixel formats"
,
OFFSET
(
pix_fmts
),
AV_OPT_TYPE_STRING
,
.
flags
=
AV_OPT_FLAG_VIDEO_PARAM
},
{
NULL
},
};
#if CONFIG_FORMAT_FILTER
#if CONFIG_FORMAT_FILTER
static
int
query_formats_format
(
AVFilterContext
*
ctx
)
static
int
query_formats_format
(
AVFilterContext
*
ctx
)
{
{
...
@@ -99,6 +109,13 @@ static int query_formats_format(AVFilterContext *ctx)
...
@@ -99,6 +109,13 @@ static int query_formats_format(AVFilterContext *ctx)
return
0
;
return
0
;
}
}
static
const
AVClass
format_class
=
{
.
class_name
=
"format"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_format_inputs
[]
=
{
static
const
AVFilterPad
avfilter_vf_format_inputs
[]
=
{
{
{
.
name
=
"default"
,
.
name
=
"default"
,
...
@@ -125,6 +142,7 @@ AVFilter avfilter_vf_format = {
...
@@ -125,6 +142,7 @@ AVFilter avfilter_vf_format = {
.
query_formats
=
query_formats_format
,
.
query_formats
=
query_formats_format
,
.
priv_size
=
sizeof
(
FormatContext
),
.
priv_size
=
sizeof
(
FormatContext
),
.
priv_class
=
&
format_class
,
.
inputs
=
avfilter_vf_format_inputs
,
.
inputs
=
avfilter_vf_format_inputs
,
.
outputs
=
avfilter_vf_format_outputs
,
.
outputs
=
avfilter_vf_format_outputs
,
...
@@ -138,6 +156,13 @@ static int query_formats_noformat(AVFilterContext *ctx)
...
@@ -138,6 +156,13 @@ static int query_formats_noformat(AVFilterContext *ctx)
return
0
;
return
0
;
}
}
static
const
AVClass
noformat_class
=
{
.
class_name
=
"noformat"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_noformat_inputs
[]
=
{
static
const
AVFilterPad
avfilter_vf_noformat_inputs
[]
=
{
{
{
.
name
=
"default"
,
.
name
=
"default"
,
...
@@ -164,6 +189,7 @@ AVFilter avfilter_vf_noformat = {
...
@@ -164,6 +189,7 @@ AVFilter avfilter_vf_noformat = {
.
query_formats
=
query_formats_noformat
,
.
query_formats
=
query_formats_noformat
,
.
priv_size
=
sizeof
(
FormatContext
),
.
priv_size
=
sizeof
(
FormatContext
),
.
priv_class
=
&
noformat_class
,
.
inputs
=
avfilter_vf_noformat_inputs
,
.
inputs
=
avfilter_vf_noformat_inputs
,
.
outputs
=
avfilter_vf_noformat_outputs
,
.
outputs
=
avfilter_vf_noformat_outputs
,
...
...
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