[FFmpeg-cvslog] vsrc_buffer: error on changing frame parameters.

Anton Khirnov git at videolan.org
Wed Jan 11 02:57:12 CET 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Jan  3 11:18:00 2012 +0100| [5d25140f714cbbf72e82e95c61a97353e75e6f90] | committer: Anton Khirnov

vsrc_buffer: error on changing frame parameters.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d25140f714cbbf72e82e95c61a97353e75e6f90
---

 libavfilter/vsrc_buffer.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index 9146502..178b3e6 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -36,6 +36,12 @@ typedef struct {
     AVRational        pixel_aspect;
 } 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,
                              int64_t pts, AVRational pixel_aspect)
 {
@@ -49,6 +55,8 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
         //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->w, c->h);
     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);
     }
 
+    CHECK_PARAM_CHANGE(s, c, buf->video->w, buf->video->h, buf->format);
+
     c->buf = buf;
 
     return 0;



More information about the ffmpeg-cvslog mailing list