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
6889deba
Commit
6889deba
authored
Feb 11, 2016
by
Tobias Rapp
Committed by
Paul B Mahol
Feb 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/f_metadata: add starts_with string function
Signed-off-by:
Tobias Rapp
<
t.rapp@noa-archive.com
>
parent
202f9787
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
filters.texi
doc/filters.texi
+4
-0
f_metadata.c
libavfilter/f_metadata.c
+10
-0
No files found.
doc/filters.texi
View file @
6889deba
...
@@ -8500,6 +8500,10 @@ Can be one of following:
...
@@ -8500,6 +8500,10 @@ Can be one of following:
Values are interpreted as strings, returns true if @code{value} is same as metadata value up
Values are interpreted as strings, returns true if @code{value} is same as metadata value up
to N chars as set in @code{length} option.
to N chars as set in @code{length} option.
@item starts_with
Values are interpreted as strings, returns true if metadata value starts with
the @code{value} option string.
@item less
@item less
Values are interpreted as floats, returns true if metadata value is less than @code{value}.
Values are interpreted as floats, returns true if metadata value is less than @code{value}.
...
...
libavfilter/f_metadata.c
View file @
6889deba
...
@@ -49,6 +49,7 @@ enum MetadataMode {
...
@@ -49,6 +49,7 @@ enum MetadataMode {
enum
MetadataFunction
{
enum
MetadataFunction
{
METADATAF_STRING
,
METADATAF_STRING
,
METADATAF_STARTS_WITH
,
METADATAF_LESS
,
METADATAF_LESS
,
METADATAF_EQUAL
,
METADATAF_EQUAL
,
METADATAF_GREATER
,
METADATAF_GREATER
,
...
@@ -102,6 +103,7 @@ static const AVOption filt_name##_options[] = { \
...
@@ -102,6 +103,7 @@ static const AVOption filt_name##_options[] = { \
{ "value", "set metadata value", OFFSET(value), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
{ "value", "set metadata value", OFFSET(value), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
{ "function", "function for comparing values", OFFSET(function), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
{ "function", "function for comparing values", OFFSET(function), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, METADATAF_NB-1, FLAGS, "function" }, \
{ "string", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STRING }, 0, 3, FLAGS, "function" }, \
{ "string", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STRING }, 0, 3, FLAGS, "function" }, \
{ "starts_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_STARTS_WITH }, 0, 0, FLAGS, "function" }, \
{ "less", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS }, 0, 3, FLAGS, "function" }, \
{ "less", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_LESS }, 0, 3, FLAGS, "function" }, \
{ "equal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL }, 0, 3, FLAGS, "function" }, \
{ "equal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_EQUAL }, 0, 3, FLAGS, "function" }, \
{ "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER }, 0, 3, FLAGS, "function" }, \
{ "greater", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_GREATER }, 0, 3, FLAGS, "function" }, \
...
@@ -117,6 +119,11 @@ static int string(MetadataContext *s, const char *value1, const char *value2, si
...
@@ -117,6 +119,11 @@ static int string(MetadataContext *s, const char *value1, const char *value2, si
return
!
strncmp
(
value1
,
value2
,
length
);
return
!
strncmp
(
value1
,
value2
,
length
);
}
}
static
int
starts_with
(
MetadataContext
*
s
,
const
char
*
value1
,
const
char
*
value2
,
size_t
length
)
{
return
!
strncmp
(
value1
,
value2
,
strlen
(
value2
));
}
static
int
equal
(
MetadataContext
*
s
,
const
char
*
value1
,
const
char
*
value2
,
size_t
length
)
static
int
equal
(
MetadataContext
*
s
,
const
char
*
value1
,
const
char
*
value2
,
size_t
length
)
{
{
float
f1
,
f2
;
float
f1
,
f2
;
...
@@ -201,6 +208,9 @@ static av_cold int init(AVFilterContext *ctx)
...
@@ -201,6 +208,9 @@ static av_cold int init(AVFilterContext *ctx)
case
METADATAF_STRING
:
case
METADATAF_STRING
:
s
->
compare
=
string
;
s
->
compare
=
string
;
break
;
break
;
case
METADATAF_STARTS_WITH
:
s
->
compare
=
starts_with
;
break
;
case
METADATAF_LESS
:
case
METADATAF_LESS
:
s
->
compare
=
less
;
s
->
compare
=
less
;
break
;
break
;
...
...
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