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
88ec5435
Commit
88ec5435
authored
Feb 27, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/opt: also test av_opt_show2()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e9c85ae6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
22 deletions
+48
-22
opt.c
libavutil/opt.c
+25
-22
opt
tests/ref/fate/opt
+23
-0
No files found.
libavutil/opt.c
View file @
88ec5435
...
@@ -1928,28 +1928,28 @@ typedef struct TestContext
...
@@ -1928,28 +1928,28 @@ typedef struct TestContext
#define TEST_FLAG_MU 04
#define TEST_FLAG_MU 04
static
const
AVOption
test_options
[]
=
{
static
const
AVOption
test_options
[]
=
{
{
"num"
,
"set num"
,
OFFSET
(
num
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
100
},
{
"num"
,
"set num"
,
OFFSET
(
num
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
100
,
1
},
{
"toggle"
,
"set toggle"
,
OFFSET
(
toggle
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
},
{
"toggle"
,
"set toggle"
,
OFFSET
(
toggle
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
1
,
1
},
{
"rational"
,
"set rational"
,
OFFSET
(
rational
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
1
},
0
,
10
},
{
"rational"
,
"set rational"
,
OFFSET
(
rational
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
1
},
0
,
10
,
1
},
{
"string"
,
"set string"
,
OFFSET
(
string
),
AV_OPT_TYPE_STRING
,
{.
str
=
"default"
},
CHAR_MIN
,
CHAR_MAX
},
{
"string"
,
"set string"
,
OFFSET
(
string
),
AV_OPT_TYPE_STRING
,
{.
str
=
"default"
},
CHAR_MIN
,
CHAR_MAX
,
1
},
{
"escape"
,
"set escape str"
,
OFFSET
(
escape
),
AV_OPT_TYPE_STRING
,
{.
str
=
"
\\
=,"
},
CHAR_MIN
,
CHAR_MAX
},
{
"escape"
,
"set escape str"
,
OFFSET
(
escape
),
AV_OPT_TYPE_STRING
,
{.
str
=
"
\\
=,"
},
CHAR_MIN
,
CHAR_MAX
,
1
},
{
"flags"
,
"set flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
INT_MAX
,
0
,
"flags"
},
{
"flags"
,
"set flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
INT_MAX
,
1
,
"flags"
},
{
"cool"
,
"set cool flag"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TEST_FLAG_COOL
},
INT_MIN
,
INT_MAX
,
0
,
"flags"
},
{
"cool"
,
"set cool flag"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TEST_FLAG_COOL
},
INT_MIN
,
INT_MAX
,
1
,
"flags"
},
{
"lame"
,
"set lame flag"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TEST_FLAG_LAME
},
INT_MIN
,
INT_MAX
,
0
,
"flags"
},
{
"lame"
,
"set lame flag"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TEST_FLAG_LAME
},
INT_MIN
,
INT_MAX
,
1
,
"flags"
},
{
"mu"
,
"set mu flag"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TEST_FLAG_MU
},
INT_MIN
,
INT_MAX
,
0
,
"flags"
},
{
"mu"
,
"set mu flag"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TEST_FLAG_MU
},
INT_MIN
,
INT_MAX
,
1
,
"flags"
},
{
"size"
,
"set size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,{.
str
=
"200x300"
},
0
,
0
},
{
"size"
,
"set size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,{.
str
=
"200x300"
},
0
,
0
,
1
},
{
"pix_fmt"
,
"set pixfmt"
,
OFFSET
(
pix_fmt
),
AV_OPT_TYPE_PIXEL_FMT
,
{.
i64
=
AV_PIX_FMT_0BGR
},
-
1
,
INT_MAX
},
{
"pix_fmt"
,
"set pixfmt"
,
OFFSET
(
pix_fmt
),
AV_OPT_TYPE_PIXEL_FMT
,
{.
i64
=
AV_PIX_FMT_0BGR
},
-
1
,
INT_MAX
,
1
},
{
"sample_fmt"
,
"set samplefmt"
,
OFFSET
(
sample_fmt
),
AV_OPT_TYPE_SAMPLE_FMT
,
{.
i64
=
AV_SAMPLE_FMT_S16
},
-
1
,
INT_MAX
},
{
"sample_fmt"
,
"set samplefmt"
,
OFFSET
(
sample_fmt
),
AV_OPT_TYPE_SAMPLE_FMT
,
{.
i64
=
AV_SAMPLE_FMT_S16
},
-
1
,
INT_MAX
,
1
},
{
"video_rate"
,
"set videorate"
,
OFFSET
(
video_rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
},
{
"video_rate"
,
"set videorate"
,
OFFSET
(
video_rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
1
},
{
"duration"
,
"set duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
1000
},
0
,
INT64_MAX
},
{
"duration"
,
"set duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
1000
},
0
,
INT64_MAX
,
1
},
{
"color"
,
"set color"
,
OFFSET
(
color
),
AV_OPT_TYPE_COLOR
,
{.
str
=
"pink"
},
0
,
0
},
{
"color"
,
"set color"
,
OFFSET
(
color
),
AV_OPT_TYPE_COLOR
,
{.
str
=
"pink"
},
0
,
0
,
1
},
{
"cl"
,
"set channel layout"
,
OFFSET
(
channel_layout
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=
AV_CH_LAYOUT_HEXAGONAL
},
0
,
INT64_MAX
},
{
"cl"
,
"set channel layout"
,
OFFSET
(
channel_layout
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=
AV_CH_LAYOUT_HEXAGONAL
},
0
,
INT64_MAX
,
1
},
{
"bin"
,
"set binary value"
,
OFFSET
(
binary
),
AV_OPT_TYPE_BINARY
,
{.
str
=
"62696e00"
},
0
,
0
},
{
"bin"
,
"set binary value"
,
OFFSET
(
binary
),
AV_OPT_TYPE_BINARY
,
{.
str
=
"62696e00"
},
0
,
0
,
1
},
{
"bin1"
,
"set binary value"
,
OFFSET
(
binary1
),
AV_OPT_TYPE_BINARY
,
{.
str
=
NULL
},
0
,
0
},
{
"bin1"
,
"set binary value"
,
OFFSET
(
binary1
),
AV_OPT_TYPE_BINARY
,
{.
str
=
NULL
},
0
,
0
,
1
},
{
"bin2"
,
"set binary value"
,
OFFSET
(
binary2
),
AV_OPT_TYPE_BINARY
,
{.
str
=
""
},
0
,
0
},
{
"bin2"
,
"set binary value"
,
OFFSET
(
binary2
),
AV_OPT_TYPE_BINARY
,
{.
str
=
""
},
0
,
0
,
1
},
{
"num64"
,
"set num 64bit"
,
OFFSET
(
num64
),
AV_OPT_TYPE_INT64
,
{.
i64
=
1
},
0
,
100
},
{
"num64"
,
"set num 64bit"
,
OFFSET
(
num64
),
AV_OPT_TYPE_INT64
,
{.
i64
=
1
},
0
,
100
,
1
},
{
"flt"
,
"set float"
,
OFFSET
(
flt
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
.
0
/
3
},
0
,
100
},
{
"flt"
,
"set float"
,
OFFSET
(
flt
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
.
0
/
3
},
0
,
100
,
1
},
{
"dbl"
,
"set double"
,
OFFSET
(
dbl
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
.
0
/
3
},
0
,
100
},
{
"dbl"
,
"set double"
,
OFFSET
(
dbl
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
.
0
/
3
},
0
,
100
,
1
},
{
NULL
},
{
NULL
},
};
};
...
@@ -2001,6 +2001,9 @@ int main(void)
...
@@ -2001,6 +2001,9 @@ int main(void)
printf
(
"num64=%"
PRId64
"
\n
"
,
test_ctx
.
num64
);
printf
(
"num64=%"
PRId64
"
\n
"
,
test_ctx
.
num64
);
printf
(
"flt=%.6f
\n
"
,
test_ctx
.
flt
);
printf
(
"flt=%.6f
\n
"
,
test_ctx
.
flt
);
printf
(
"dbl=%.6f
\n
"
,
test_ctx
.
dbl
);
printf
(
"dbl=%.6f
\n
"
,
test_ctx
.
dbl
);
av_opt_show2
(
&
test_ctx
,
NULL
,
-
1
,
0
);
av_opt_free
(
&
test_ctx
);
av_opt_free
(
&
test_ctx
);
}
}
...
...
tests/ref/fate/opt
View file @
88ec5435
...
@@ -17,6 +17,29 @@ binary_size=4
...
@@ -17,6 +17,29 @@ binary_size=4
num64=1
num64=1
flt=0.333333
flt=0.333333
dbl=0.333333
dbl=0.333333
TestContext AVOptions:
-num <int> E....... set num (from 0 to 100) (default 0)
-toggle <int> E....... set toggle (from 0 to 1) (default 1)
-rational <rational> E....... set rational (from 0 to 10) (default 1/1)
-string <string> E....... set string (default "default")
-escape <string> E....... set escape str (default "\=,")
-flags <flags> E....... set flags (default 1)
cool E....... set cool flag
lame E....... set lame flag
mu E....... set mu flag
-size <image_size> E....... set size (default "200x300")
-pix_fmt <pix_fmt> E....... set pixfmt (default 0bgr)
-sample_fmt <sample_fmt> E....... set samplefmt (default s16)
-video_rate <video_rate> E....... set videorate (default "25")
-duration <duration> E....... set duration (default 1000)
-color <color> E....... set color (default "pink")
-cl <channel_layout> E....... set channel layout (default 0x137)
-bin <binary> E....... set binary value
-bin1 <binary> E....... set binary value
-bin2 <binary> E....... set binary value
-num64 <int64> E....... set num 64bit (from 0 to 100) (default 1)
-flt <float> E....... set float (from 0 to 100) (default 0.333333)
-dbl <double> E....... set double (from 0 to 100) (default 0.333333)
Testing av_opt_is_set_to_default()
Testing av_opt_is_set_to_default()
name: num default:1 error:
name: num default:1 error:
...
...
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