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
838d8031
Commit
838d8031
authored
Apr 11, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/mp: switch to an AVOptions-based system.
parent
70b72ca6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
avfilter.c
libavfilter/avfilter.c
+15
-1
vf_mp.c
libavfilter/vf_mp.c
+17
-3
No files found.
libavfilter/avfilter.c
View file @
838d8031
...
...
@@ -680,7 +680,6 @@ static const char *const filters_left_to_update[] = {
#endif
"atempo"
,
"buffer"
,
"mp"
,
"pan"
,
"scale"
,
};
...
...
@@ -818,6 +817,21 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
goto
fail
;
#endif
}
else
{
#if CONFIG_MP_FILTER
if
(
!
strcmp
(
filter
->
filter
->
name
,
"mp"
))
{
char
*
escaped
;
if
(
!
strncmp
(
args
,
"filter="
,
7
))
args
+=
7
;
ret
=
av_escape
(
&
escaped
,
args
,
":="
,
AV_ESCAPE_MODE_BACKSLASH
,
0
);
if
(
ret
<
0
)
{
av_log
(
filter
,
AV_LOG_ERROR
,
"Unable to escape MPlayer filters arg '%s'
\n
"
,
args
);
goto
fail
;
}
ret
=
process_options
(
filter
,
&
options
,
escaped
);
av_free
(
escaped
);
}
else
#endif
ret
=
process_options
(
filter
,
&
options
,
args
);
if
(
ret
<
0
)
goto
fail
;
...
...
libavfilter/vf_mp.c
View file @
838d8031
...
...
@@ -32,6 +32,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libmpcodecs/vf.h"
#include "libmpcodecs/img_format.h"
...
...
@@ -262,12 +263,23 @@ struct SwsContext *ff_sws_getContextFromCmdLine(int srcW, int srcH, int srcForma
}
typedef
struct
{
const
AVClass
*
class
;
vf_instance_t
vf
;
vf_instance_t
next_vf
;
AVFilterContext
*
avfctx
;
int
frame_returned
;
char
*
filter
;
}
MPContext
;
#define OFFSET(x) offsetof(MPContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
mp_options
[]
=
{
{
"filter"
,
"set MPlayer filter name and parameters"
,
OFFSET
(
filter
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
.
flags
=
FLAGS
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
mp
);
void
ff_mp_msg
(
int
mod
,
int
lev
,
const
char
*
format
,
...
){
va_list
va
;
va_start
(
va
,
format
);
...
...
@@ -533,7 +545,7 @@ mp_image_t* ff_vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgty
static
void
dummy_free
(
void
*
opaque
,
uint8_t
*
data
){}
int
ff_vf_next_put_image
(
struct
vf_instance
*
vf
,
mp_image_t
*
mpi
,
double
pts
){
MPContext
*
m
=
(
void
*
)
vf
;
MPContext
*
m
=
(
MPContext
*
)(((
uint8_t
*
)
vf
)
-
offsetof
(
MPContext
,
vf
))
;
AVFilterLink
*
outlink
=
m
->
avfctx
->
outputs
[
0
];
AVFrame
*
picref
=
av_frame_alloc
();
int
i
;
...
...
@@ -605,13 +617,13 @@ int ff_vf_next_config(struct vf_instance *vf,
}
int
ff_vf_next_control
(
struct
vf_instance
*
vf
,
int
request
,
void
*
data
){
MPContext
*
m
=
(
void
*
)
vf
;
MPContext
*
m
=
(
MPContext
*
)(((
uint8_t
*
)
vf
)
-
offsetof
(
MPContext
,
vf
))
;
av_log
(
m
->
avfctx
,
AV_LOG_DEBUG
,
"Received control %d
\n
"
,
request
);
return
0
;
}
static
int
vf_default_query_format
(
struct
vf_instance
*
vf
,
unsigned
int
fmt
){
MPContext
*
m
=
(
void
*
)
vf
;
MPContext
*
m
=
(
MPContext
*
)(((
uint8_t
*
)
vf
)
-
offsetof
(
MPContext
,
vf
))
;
int
i
;
av_log
(
m
->
avfctx
,
AV_LOG_DEBUG
,
"query %X
\n
"
,
fmt
);
...
...
@@ -644,6 +656,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
m
->
avfctx
=
ctx
;
args
=
m
->
filter
;
if
(
!
args
||
1
!=
sscanf
(
args
,
"%255[^:=]"
,
name
)){
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid parameter.
\n
"
);
return
AVERROR
(
EINVAL
);
...
...
@@ -850,4 +863,5 @@ AVFilter avfilter_vf_mp = {
.
query_formats
=
query_formats
,
.
inputs
=
mp_inputs
,
.
outputs
=
mp_outputs
,
.
priv_class
=
&
mp_class
,
};
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