summaryrefslogtreecommitdiff
path: root/libavutil/opt.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-11-03 13:51:53 +0100
committerStefano Sabatini <stefasab@gmail.com>2012-11-03 13:53:49 +0100
commitb91fa5fcca70bdf188b757084edd444d4d8530c9 (patch)
tree62b438e032de123d5dc2292eca0ece41b4fffaa9 /libavutil/opt.c
parent1dad4867146007486d6e84e59454734d1fc804c5 (diff)
lavu/opt: set sample format default value, and accept NULL value
Fix commit c9eaa98a3e0b1db75680f9ea28e01f21cada1dc3. +10l.
Diffstat (limited to 'libavutil/opt.c')
-rw-r--r--libavutil/opt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 140784e20f..404fbac9c9 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -242,7 +242,9 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
if (!o || !target_obj)
return AVERROR_OPTION_NOT_FOUND;
- if (!val && (o->type != AV_OPT_TYPE_STRING && o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_IMAGE_SIZE))
+ if (!val && (o->type != AV_OPT_TYPE_STRING &&
+ o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT &&
+ o->type != AV_OPT_TYPE_IMAGE_SIZE))
return AVERROR(EINVAL);
dst = ((uint8_t*)target_obj) + o->offset;
@@ -738,6 +740,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
case AV_OPT_TYPE_STRING:
case AV_OPT_TYPE_IMAGE_SIZE:
case AV_OPT_TYPE_PIXEL_FMT:
+ case AV_OPT_TYPE_SAMPLE_FMT:
av_opt_set(s, opt->name, opt->default_val.str, 0);
break;
case AV_OPT_TYPE_BINARY: