mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-19 09:02:26 +02:00
vsrc_buffer: error on changing frame parameters.
This commit is contained in:
parent
7b9373db89
commit
5d25140f71
@ -36,6 +36,12 @@ typedef struct {
|
|||||||
AVRational pixel_aspect;
|
AVRational pixel_aspect;
|
||||||
} BufferSourceContext;
|
} BufferSourceContext;
|
||||||
|
|
||||||
|
#define CHECK_PARAM_CHANGE(s, c, width, height, format)\
|
||||||
|
if (c->w != width || c->h != height || c->pix_fmt != format) {\
|
||||||
|
av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
|
||||||
|
return AVERROR(EINVAL);\
|
||||||
|
}
|
||||||
|
|
||||||
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
|
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
|
||||||
int64_t pts, AVRational pixel_aspect)
|
int64_t pts, AVRational pixel_aspect)
|
||||||
{
|
{
|
||||||
@ -49,6 +55,8 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
|
|||||||
//return -1;
|
//return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHECK_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, frame->format);
|
||||||
|
|
||||||
c->buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
|
c->buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE,
|
||||||
c->w, c->h);
|
c->w, c->h);
|
||||||
av_image_copy(c->buf->data, c->buf->linesize, frame->data, frame->linesize,
|
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)
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHECK_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
|
||||||
|
|
||||||
c->buf = buf;
|
c->buf = buf;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user