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
a619787a
Commit
a619787a
authored
Dec 25, 2019
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/tests/opt: add av_opt_get/av_opt_set tests
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
672b925e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
opt.c
libavutil/tests/opt.c
+41
-0
opt
tests/ref/fate/opt
+26
-0
No files found.
libavutil/tests/opt.c
View file @
a619787a
...
@@ -171,6 +171,47 @@ int main(void)
...
@@ -171,6 +171,47 @@ int main(void)
av_opt_free
(
&
test_ctx
);
av_opt_free
(
&
test_ctx
);
}
}
printf
(
"
\n
Testing av_opt_get/av_opt_set()
\n
"
);
{
TestContext
test_ctx
=
{
0
};
TestContext
test2_ctx
=
{
0
};
const
AVOption
*
o
=
NULL
;
test_ctx
.
class
=
&
test_class
;
test2_ctx
.
class
=
&
test_class
;
av_log_set_level
(
AV_LOG_QUIET
);
av_opt_set_defaults
(
&
test_ctx
);
while
(
o
=
av_opt_next
(
&
test_ctx
,
o
))
{
char
*
value1
=
NULL
;
char
*
value2
=
NULL
;
int
ret1
=
AVERROR_BUG
;
int
ret2
=
AVERROR_BUG
;
int
ret3
=
AVERROR_BUG
;
if
(
o
->
type
==
AV_OPT_TYPE_CONST
)
continue
;
ret1
=
av_opt_get
(
&
test_ctx
,
o
->
name
,
0
,
(
uint8_t
**
)
&
value1
);
if
(
ret1
>=
0
)
{
ret2
=
av_opt_set
(
&
test2_ctx
,
o
->
name
,
value1
,
0
);
if
(
ret2
>=
0
)
ret3
=
av_opt_get
(
&
test2_ctx
,
o
->
name
,
0
,
(
uint8_t
**
)
&
value2
);
}
printf
(
"name: %-11s get: %-16s set: %-16s get: %-16s %s
\n
"
,
o
->
name
,
ret1
>=
0
?
value1
:
av_err2str
(
ret1
),
ret2
>=
0
?
"OK"
:
av_err2str
(
ret2
),
ret3
>=
0
?
value2
:
av_err2str
(
ret3
),
ret1
>=
0
&&
ret2
>=
0
&&
ret3
>=
0
&&
!
strcmp
(
value1
,
value2
)
?
"OK"
:
"Mismatch"
);
av_free
(
value1
);
av_free
(
value2
);
}
av_opt_free
(
&
test_ctx
);
av_opt_free
(
&
test2_ctx
);
}
printf
(
"
\n
Test av_opt_serialize()
\n
"
);
printf
(
"
\n
Test av_opt_serialize()
\n
"
);
{
{
TestContext
test_ctx
=
{
0
};
TestContext
test_ctx
=
{
0
};
...
...
tests/ref/fate/opt
View file @
a619787a
...
@@ -102,6 +102,32 @@ name: bool3 default:1 error:
...
@@ -102,6 +102,32 @@ name: bool3 default:1 error:
name: dict1 default:1 error:
name: dict1 default:1 error:
name: dict2 default:1 error:
name: dict2 default:1 error:
Testing av_opt_get/av_opt_set()
name: num get: 0 set: OK get: 0 OK
name: toggle get: 1 set: OK get: 1 OK
name: rational get: 1/1 set: OK get: 1/1 OK
name: string get: default set: OK get: default OK
name: escape get: \=, set: OK get: \=, OK
name: flags get: 0x00000001 set: OK get: 0x00000001 OK
name: size get: 200x300 set: OK get: 200x300 OK
name: pix_fmt get: 0bgr set: OK get: 0bgr OK
name: sample_fmt get: s16 set: OK get: s16 OK
name: video_rate get: 25/1 set: OK get: 25/1 OK
name: duration get: 0.001 set: OK get: 0.001 OK
name: color get: 0xffc0cbff set: OK get: 0xffc0cbff OK
name: cl get: 0x137 set: OK get: 0x137 OK
name: bin get: 62696E00 set: OK get: 62696E00 OK
name: bin1 get: set: OK get: OK
name: bin2 get: set: OK get: OK
name: num64 get: 1 set: OK get: 1 OK
name: flt get: 0.333333 set: OK get: 0.333333 OK
name: dbl get: 0.333333 set: OK get: 0.333333 OK
name: bool1 get: auto set: OK get: auto OK
name: bool2 get: true set: OK get: true OK
name: bool3 get: false set: OK get: false OK
name: dict1 get: set: OK get: OK
name: dict2 get: happy=\:-) set: OK get: happy=\:-) OK
Test av_opt_serialize()
Test av_opt_serialize()
num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=0x137,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=0x137,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
Setting entry with key 'num' to value '0'
Setting entry with key 'num' to value '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