...
|
...
|
@@ -36,6 +36,12 @@ typedef struct {
|
36
|
36
|
AVRational pixel_aspect;
|
37
|
37
|
} BufferSourceContext;
|
38
|
38
|
|
|
39
|
+#define CHECK_PARAM_CHANGE(s, c, width, height, format)\
|
|
40
|
+ if (c->w != width || c->h != height || c->pix_fmt != format) {\
|
|
41
|
+ av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
|
|
42
|
+ return AVERROR(EINVAL);\
|
|
43
|
+ }
|
|
44
|
+
|
39
|
45
|
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
|
40
|
46
|
int64_t pts, AVRational pixel_aspect)
|
41
|
47
|
{
|
...
|
...
|
@@ -49,6 +55,8 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
|
49
|
49
|
//return -1;
|
50
|
50
|
}
|
51
|
51
|
|
|
52
|
+ CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format);
|
|
53
|
+
|
52
|
54
|
c->buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
|
53
|
55
|
c->w, c->h);
|
54
|
56
|
av_image_copy(c->buf->data, c->buf->linesize, frame->data, frame->linesize,
|
...
|
...
|
@@ -73,6 +81,8 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
|
73
|
73
|
return AVERROR(EINVAL);
|
74
|
74
|
}
|
75
|
75
|
|
|
76
|
+ CHECK_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
|
|
77
|
+
|
76
|
78
|
c->buf = buf;
|
77
|
79
|
|
78
|
80
|
return 0;
|