[FFmpeg-cvslog] lavu/opt: set sample format default value, and accept NULL value

Stefano Sabatini git at videolan.org
Sat Nov 3 13:54:55 CET 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sat Nov  3 13:51:53 2012 +0100| [b91fa5fcca70bdf188b757084edd444d4d8530c9] | committer: Stefano Sabatini

lavu/opt: set sample format default value, and accept NULL value

Fix commit c9eaa98a3e0b1db75680f9ea28e01f21cada1dc3.
+10l.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b91fa5fcca70bdf188b757084edd444d4d8530c9
---

 libavutil/opt.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 140784e..404fbac 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:



More information about the ffmpeg-cvslog mailing list