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
8aa62bb9
Commit
8aa62bb9
authored
Aug 16, 2011
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
af_aformat: use evil ADD_FORMATS macro for cutting out duplicated code
parent
5fa98ab4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
52 deletions
+22
-52
af_aformat.c
libavfilter/af_aformat.c
+22
-52
No files found.
libavfilter/af_aformat.c
View file @
8aa62bb9
...
...
@@ -42,60 +42,30 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
if
(
!
args
)
goto
arg_fail
;
fmts_str
=
av_get_token
(
&
args
,
":"
);
if
(
!
fmts_str
||
!*
fmts_str
)
goto
arg_fail
;
if
(
!
strcmp
(
fmts_str
,
"all"
))
{
aformat
->
formats
=
avfilter_all_formats
(
AVMEDIA_TYPE_AUDIO
);
}
else
{
for
(
fmt_str
=
fmts_str
;
fmt_str
=
strtok_r
(
fmt_str
,
","
,
&
ptr
);
fmt_str
=
NULL
)
{
if
((
ret
=
ff_parse_sample_format
((
int
*
)
&
fmt
,
fmt_str
,
ctx
))
<
0
)
{
av_freep
(
&
fmts_str
);
return
ret
;
}
avfilter_add_format
(
&
aformat
->
formats
,
fmt
);
}
}
av_freep
(
&
fmts_str
);
if
(
*
args
)
#define ADD_FORMATS(all_formats, fmt_name, fmt_type, fmts_list) \
fmts_str = av_get_token(&args, ":"); \
if (!fmts_str || !*fmts_str) \
goto arg_fail; \
if (!strcmp(fmts_str, "all")) { \
aformat->fmts_list = all_formats; \
} else { \
for (fmt_str = fmts_str; \
fmt_str = strtok_r(fmt_str, ",", &ptr); fmt_str = NULL) { \
if ((ret = ff_parse_##fmt_name((fmt_type *)&fmt, \
fmt_str, ctx)) < 0) { \
av_freep(&fmts_str); \
return ret; \
} \
avfilter_add_format(&aformat->fmts_list, fmt); \
} \
} \
av_freep(&fmts_str); \
if (*args) \
args++;
fmts_str
=
av_get_token
(
&
args
,
":"
);
if
(
!
fmts_str
||
!*
fmts_str
)
goto
arg_fail
;
if
(
!
strcmp
(
fmts_str
,
"all"
))
{
aformat
->
chlayouts
=
avfilter_all_channel_layouts
();
}
else
{
for
(
fmt_str
=
fmts_str
;
fmt_str
=
strtok_r
(
fmt_str
,
","
,
&
ptr
);
fmt_str
=
NULL
)
{
if
((
ret
=
ff_parse_channel_layout
(
&
fmt
,
fmt_str
,
ctx
))
<
0
)
{
av_freep
(
&
fmts_str
);
return
ret
;
}
avfilter_add_format
(
&
aformat
->
chlayouts
,
fmt
);
}
}
av_freep
(
&
fmts_str
);
if
(
*
args
)
args
++
;
fmts_str
=
av_get_token
(
&
args
,
":"
);
if
(
!
fmts_str
||
!*
fmts_str
)
goto
arg_fail
;
if
(
!
strcmp
(
fmts_str
,
"all"
))
{
aformat
->
packing
=
avfilter_all_packing_formats
();
}
else
{
for
(
fmt_str
=
fmts_str
;
fmt_str
=
strtok_r
(
fmt_str
,
","
,
&
ptr
);
fmt_str
=
NULL
)
{
if
((
ret
=
ff_parse_packing_format
((
int
*
)
&
fmt
,
fmt_str
,
ctx
))
<
0
)
{
av_freep
(
&
fmts_str
);
return
ret
;
}
avfilter_add_format
(
&
aformat
->
packing
,
fmt
);
}
}
av_freep
(
&
fmts_str
);
ADD_FORMATS
(
avfilter_all_formats
(
AVMEDIA_TYPE_AUDIO
),
sample_format
,
int
,
formats
);
ADD_FORMATS
(
avfilter_all_channel_layouts
(),
channel_layout
,
int64_t
,
chlayouts
);
ADD_FORMATS
(
avfilter_all_packing_formats
(),
packing_format
,
int
,
packing
);
return
0
;
...
...
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