diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-07-21 17:14:19 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-07-21 17:14:19 +0000 |
commit | 59775b3c1aa38ef24973c05a76cccc83e32ec175 (patch) | |
tree | 748be2ec47c87892aed01bf8016bf96237e0890c /libavfilter/vsrc_buffer.c | |
parent | e2f48c05e9a88f39579d331a48851726a9c46a57 (diff) | |
download | ffmpeg-59775b3c1aa38ef24973c05a76cccc83e32ec175.tar.gz |
Extend buffer source syntax.
Make the buffer source accept a string for specifying the input pixel
format.
Originally committed as revision 24387 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/vsrc_buffer.c')
-rw-r--r-- | libavfilter/vsrc_buffer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c index bb3c210d83..9e84c27e43 100644 --- a/libavfilter/vsrc_buffer.c +++ b/libavfilter/vsrc_buffer.c @@ -63,12 +63,21 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, 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; |