[FFmpeg-cvslog] r24387 - trunk/libavfilter/vsrc_buffer.c

stefano subversion
Wed Jul 21 19:14:19 CEST 2010


Author: stefano
Date: Wed Jul 21 19:14:19 2010
New Revision: 24387

Log:
Extend buffer source syntax.

Make the buffer source accept a string for specifying the input pixel
format.

Modified:
   trunk/libavfilter/vsrc_buffer.c

Modified: trunk/libavfilter/vsrc_buffer.c
==============================================================================
--- trunk/libavfilter/vsrc_buffer.c	Wed Jul 21 19:14:15 2010	(r24386)
+++ trunk/libavfilter/vsrc_buffer.c	Wed Jul 21 19:14:19 2010	(r24387)
@@ -63,12 +63,21 @@ int av_vsrc_buffer_add_frame(AVFilterCon
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     BufferSourceContext *c = ctx->priv;
+    char pix_fmt_str[128];
     int n = 0;
 
-    if (!args || (n = sscanf(args, "%d:%d:%d", &c->w, &c->h, &c->pix_fmt)) != 3) {
+    if (!args || (n = sscanf(args, "%d:%d:%127s", &c->w, &c->h, pix_fmt_str)) != 3) {
         av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : "");
         return AVERROR(EINVAL);
     }
+    if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
+        char *tail;
+        c->pix_fmt = strtol(pix_fmt_str, &tail, 10);
+        if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) {
+            av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_fmt_str);
+            return AVERROR(EINVAL);
+        }
+    }
 
     av_log(ctx, AV_LOG_INFO, "w:%d h:%d pixfmt:%s\n", c->w, c->h, av_pix_fmt_descriptors[c->pix_fmt].name);
     return 0;



More information about the ffmpeg-cvslog mailing list