Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
d9b0d75c
Commit
d9b0d75c
authored
12 years ago
by
Nicolas George
Browse files
Options
Downloads
Patches
Plain Diff
opt: add AV_OPT_TYPE_PIXEL_FMT.
parent
9f7b014a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavutil/opt.c
+20
-0
20 additions, 0 deletions
libavutil/opt.c
libavutil/opt.h
+1
-0
1 addition, 0 deletions
libavutil/opt.h
with
21 additions
and
0 deletions
libavutil/opt.c
+
20
−
0
View file @
d9b0d75c
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include
"dict.h"
#include
"dict.h"
#include
"log.h"
#include
"log.h"
#include
"parseutils.h"
#include
"parseutils.h"
#include
"pixdesc.h"
#if FF_API_FIND_OPT
#if FF_API_FIND_OPT
//FIXME order them and do a bin search
//FIXME order them and do a bin search
...
@@ -249,6 +250,18 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
...
@@ -249,6 +250,18 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
if
(
ret
<
0
)
if
(
ret
<
0
)
av_log
(
obj
,
AV_LOG_ERROR
,
"Unable to parse option value
\"
%s
\"
as image size
\n
"
,
val
);
av_log
(
obj
,
AV_LOG_ERROR
,
"Unable to parse option value
\"
%s
\"
as image size
\n
"
,
val
);
return
ret
;
return
ret
;
case
AV_OPT_TYPE_PIXEL_FMT
:
ret
=
av_get_pix_fmt
(
val
);
if
(
ret
==
PIX_FMT_NONE
)
{
char
*
tail
;
ret
=
strtol
(
val
,
&
tail
,
0
);
if
(
*
tail
||
(
unsigned
)
ret
>=
PIX_FMT_NB
)
{
av_log
(
obj
,
AV_LOG_ERROR
,
"Unable to parse option value
\"
%s
\"
as pixel format
\n
"
,
val
);
return
AVERROR
(
EINVAL
);
}
}
*
(
enum
PixelFormat
*
)
dst
=
ret
;
return
0
;
}
}
av_log
(
obj
,
AV_LOG_ERROR
,
"Invalid option type.
\n
"
);
av_log
(
obj
,
AV_LOG_ERROR
,
"Invalid option type.
\n
"
);
...
@@ -434,6 +447,9 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
...
@@ -434,6 +447,9 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
case
AV_OPT_TYPE_IMAGE_SIZE
:
case
AV_OPT_TYPE_IMAGE_SIZE
:
ret
=
snprintf
(
buf
,
sizeof
(
buf
),
"%dx%d"
,
((
int
*
)
dst
)[
0
],
((
int
*
)
dst
)[
1
]);
ret
=
snprintf
(
buf
,
sizeof
(
buf
),
"%dx%d"
,
((
int
*
)
dst
)[
0
],
((
int
*
)
dst
)[
1
]);
break
;
break
;
case
AV_OPT_TYPE_PIXEL_FMT
:
ret
=
snprintf
(
buf
,
sizeof
(
buf
),
"%s"
,
(
char
*
)
av_x_if_null
(
av_get_pix_fmt_name
(
*
(
enum
PixelFormat
*
)
dst
),
"?"
));
break
;
default:
default:
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
...
@@ -606,6 +622,9 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
...
@@ -606,6 +622,9 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
case
AV_OPT_TYPE_IMAGE_SIZE
:
case
AV_OPT_TYPE_IMAGE_SIZE
:
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
"<image_size>"
);
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
"<image_size>"
);
break
;
break
;
case
AV_OPT_TYPE_PIXEL_FMT
:
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
"<pix_fmt>"
);
break
;
case
AV_OPT_TYPE_CONST
:
case
AV_OPT_TYPE_CONST
:
default:
default:
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
""
);
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
""
);
...
@@ -684,6 +703,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
...
@@ -684,6 +703,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
break
;
break
;
case
AV_OPT_TYPE_STRING
:
case
AV_OPT_TYPE_STRING
:
case
AV_OPT_TYPE_IMAGE_SIZE
:
case
AV_OPT_TYPE_IMAGE_SIZE
:
case
AV_OPT_TYPE_PIXEL_FMT
:
av_opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
av_opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
break
;
break
;
case
AV_OPT_TYPE_BINARY
:
case
AV_OPT_TYPE_BINARY
:
...
...
This diff is collapsed.
Click to expand it.
libavutil/opt.h
+
1
−
0
View file @
d9b0d75c
...
@@ -226,6 +226,7 @@ enum AVOptionType{
...
@@ -226,6 +226,7 @@ enum AVOptionType{
AV_OPT_TYPE_BINARY
,
///< offset must point to a pointer immediately followed by an int for the length
AV_OPT_TYPE_BINARY
,
///< offset must point to a pointer immediately followed by an int for the length
AV_OPT_TYPE_CONST
=
128
,
AV_OPT_TYPE_CONST
=
128
,
AV_OPT_TYPE_IMAGE_SIZE
=
MKBETAG
(
'S'
,
'I'
,
'Z'
,
'E'
),
///< offset must point to two consecutive integers
AV_OPT_TYPE_IMAGE_SIZE
=
MKBETAG
(
'S'
,
'I'
,
'Z'
,
'E'
),
///< offset must point to two consecutive integers
AV_OPT_TYPE_PIXEL_FMT
=
MKBETAG
(
'P'
,
'F'
,
'M'
,
'T'
),
#if FF_API_OLD_AVOPTIONS
#if FF_API_OLD_AVOPTIONS
FF_OPT_TYPE_FLAGS
=
0
,
FF_OPT_TYPE_FLAGS
=
0
,
FF_OPT_TYPE_INT
,
FF_OPT_TYPE_INT
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment