History

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

Stefano Sabatini committed 16 years ago

Commit 59775b31 parent e2f48c01 file · +10 −1Browse files

Unified · Split

libavfilter/vsrc_buffer.c+10−1
@@ -63,12 +63,21 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, · 62 unmodified lines
63static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)63static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
64{64{
65 BufferSourceContext *c = ctx->priv;65 BufferSourceContext *c = ctx->priv;
66 char pix_fmt_str[128];
66 int n = 0;67 int n = 0;
67 68
68 if (!args || (n = sscanf(args, "%d:%d:%d", &c->w, &c->h, &c->pix_fmt)) != 3) {69 if (!args || (n = sscanf(args, "%d:%d:%127s", &c->w, &c->h, pix_fmt_str)) != 3) {
69 av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : "");70 av_log(ctx, AV_LOG_ERROR, "Expected 3 arguments, but only %d found in '%s'\n", n, args ? args : "");
70 return AVERROR(EINVAL);71 return AVERROR(EINVAL);
71 }72 }
73 if ((c->pix_fmt = av_get_pix_fmt(pix_fmt_str)) == PIX_FMT_NONE) {
74 char *tail;
75 c->pix_fmt = strtol(pix_fmt_str, &tail, 10);
76 if (*tail || c->pix_fmt < 0 || c->pix_fmt >= PIX_FMT_NB) {
77 av_log(ctx, AV_LOG_ERROR, "Invalid pixel format string '%s'\n", pix_fmt_str);
78 return AVERROR(EINVAL);
79 }
80 }
72 81
73 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);82 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);
74 return 0;83 return 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t