This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new f944afd040 avutil/opt: Use correct enum size
f944afd040 is described below
commit f944afd04097178b7e3c0d6c7f4e524a9e8f6063
Author: Andreas Rheinhardt <[email protected]>
AuthorDate: Tue Aug 4 23:13:33 2026 +0200
Commit: Andreas Rheinhardt <[email protected]>
CommitDate: Sat Aug 8 02:33:43 2026 +0200
avutil/opt: Use correct enum size
AV_OPT_TYPE_PIXEL_FMT and AV_OPT_TYPE_SAMPLE_FMT are documented
to use the corresponding enum type. This matters when using
-fshort-enums.
Signed-off-by: Andreas Rheinhardt <[email protected]>
---
libavutil/opt.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/libavutil/opt.c b/libavutil/opt.c
index dd7d7a597c..9a773e8a38 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -74,8 +74,8 @@ static const struct {
[AV_OPT_TYPE_DICT] = { sizeof(AVDictionary *), "<dictionary>" },
[AV_OPT_TYPE_IMAGE_SIZE] = { sizeof(int[2]), "<image_size>" },
[AV_OPT_TYPE_VIDEO_RATE] = { sizeof(AVRational), "<video_rate>" },
- [AV_OPT_TYPE_PIXEL_FMT] = { sizeof(int), "<pix_fmt>" },
- [AV_OPT_TYPE_SAMPLE_FMT] = { sizeof(int), "<sample_fmt>" },
+ [AV_OPT_TYPE_PIXEL_FMT] = { sizeof(enum AVPixelFormat), "<pix_fmt>" },
+ [AV_OPT_TYPE_SAMPLE_FMT] = { sizeof(enum AVSampleFormat),
"<sample_fmt>" },
[AV_OPT_TYPE_DURATION] = { sizeof(int64_t), "<duration>" },
[AV_OPT_TYPE_COLOR] = { sizeof(uint8_t[4]), "<color>" },
[AV_OPT_TYPE_CHLAYOUT] = { sizeof(AVChannelLayout),"<channel_layout>"
},
@@ -577,7 +577,8 @@ fail:
}
static int set_string_fmt(void *obj, const AVOption *o, const char *val,
uint8_t *dst,
- int fmt_nb, int ((*get_fmt)(const char *)), const
char *desc)
+ int fmt_nb, int ((*get_fmt)(const char *)), const
char *desc,
+ enum AVOptionType type)
{
int fmt, min, max;
@@ -612,7 +613,11 @@ static int set_string_fmt(void *obj, const AVOption *o,
const char *val, uint8_t
return AVERROR(ERANGE);
}
- *(int *)dst = fmt;
+ switch (type) {
+ case AV_OPT_TYPE_PIXEL_FMT: *(enum AVPixelFormat *)dst = fmt; break;
+ case AV_OPT_TYPE_SAMPLE_FMT: *(enum AVSampleFormat*)dst = fmt; break;
+ default: av_unreachable("set_string_fmt() is only called for pixel and
sample formats");
+ }
return 0;
}
@@ -624,7 +629,8 @@ static int get_pix_fmt(const char *name)
static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val,
uint8_t *dst)
{
return set_string_fmt(obj, o, val, dst,
- AV_PIX_FMT_NB, get_pix_fmt, "pixel format");
+ AV_PIX_FMT_NB, get_pix_fmt,
+ "pixel format", AV_OPT_TYPE_PIXEL_FMT);
}
static int get_sample_fmt(const char *name)
@@ -635,7 +641,8 @@ static int get_sample_fmt(const char *name)
static int set_string_sample_fmt(void *obj, const AVOption *o, const char
*val, uint8_t *dst)
{
return set_string_fmt(obj, o, val, dst,
- AV_SAMPLE_FMT_NB, get_sample_fmt, "sample format");
+ AV_SAMPLE_FMT_NB, get_sample_fmt,
+ "sample format", AV_OPT_TYPE_SAMPLE_FMT);
}
static int set_string_dict(void *obj, const AVOption *o, const char *val,
uint8_t **dst)
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]