* qatar/master: vsrc_buffer: fix check from 7ae7c41. libxvid: Reorder functions to avoid forward declarations; make functions static. libxvid: drop some pointless dead code wmal: vertical alignment cosmetics wmal: Warn about missing bitstream splicing feature and ask for sample. wmal: Skip seekable_frame_in_packet. wmal: Drop unused variable num_possible_block_size. avfiltergraph: make the AVFilterInOut alloc/free API public graphparser: allow specifying sws flags in the graph description. graphparser: fix the order of connecting unlabeled links. graphparser: add avfilter_graph_parse2(). vsrc_buffer: allow using a NULL buffer to signal EOF. swscale: handle last pixel if lines have an odd width. qdm2: fix a dubious pointer cast WMAL: Do not try to read rawpcm coefficients if bits is invalid mov: Fix detecting there is no sync sample. tiffdec: K&R cosmetics avf: has_duration does not check the global one dsputil: fix optimized emu_edge function on Win64. Conflicts: doc/APIchanges libavcodec/libxvid_rc.c libavcodec/libxvidff.c libavcodec/tiff.c libavcodec/wmalosslessdec.c libavfilter/avfiltergraph.h libavfilter/graphparser.c libavfilter/version.h libavfilter/vsrc_buffer.c libswscale/output.c
Showing the changes to libavfilter/vsrc_buffer.c (1 of 18 files). Show all
Unified · Split
| @@ -39,6 +39,7 @@ typedef struct { · 38 unmodified lines | ||
| 39 | 39 | AVRational time_base; ///< time_base to set in the output link |
| 40 | 40 | AVRational sample_aspect_ratio; |
| 41 | 41 | char sws_param[256]; |
| 42 | + int eof; | |
| 42 | 43 | } BufferSourceContext; |
| 43 | 44 | |
| 44 | 45 | #define CHECK_PARAM_CHANGE(s, c, width, height, format)\ |
| @@ -55,6 +56,12 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter, · 10 unmodified lines | ||
| 55 | 56 | AVFilterBufferRef *buf; |
| 56 | 57 | int ret; |
| 57 | 58 | |
| 59 | + if (!picref) { | |
| 60 | + c->eof = 1; | |
| 61 | + return 0; | |
| 62 | + } else if (c->eof) | |
| 63 | + return AVERROR(EINVAL); | |
| 64 | + | |
| 58 | 65 | if (!av_fifo_space(c->fifo) && |
| 59 | 66 | (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + |
| 60 | 67 | sizeof(buf))) < 0) |
| @@ -125,6 +132,12 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) · 64 unmodified lines | ||
| 125 | 132 | BufferSourceContext *c = s->priv; |
| 126 | 133 | int ret; |
| 127 | 134 | |
| 135 | + if (!buf) { | |
| 136 | + c->eof = 1; | |
| 137 | + return 0; | |
| 138 | + } else if (c->eof) | |
| 139 | + return AVERROR(EINVAL); | |
| 140 | + | |
| 128 | 141 | if (!av_fifo_space(c->fifo) && |
| 129 | 142 | (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) + |
| 130 | 143 | sizeof(buf))) < 0) |
| @@ -144,9 +157,17 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) · 13 unmodified lines | ||
| 144 | 157 | int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src, |
| 145 | 158 | const AVFrame *frame, int flags) |
| 146 | 159 | { |
| 160 | + BufferSourceContext *c = buffer_src->priv; | |
| 161 | + AVFilterBufferRef *picref; | |
| 147 | 162 | int ret; |
| 148 | − AVFilterBufferRef *picref = | |
| 149 | − avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE); | |
| 163 | + | |
| 164 | + if (!frame) { | |
| 165 | + c->eof = 1; | |
| 166 | + return 0; | |
| 167 | + } else if (c->eof) | |
| 168 | + return AVERROR(EINVAL); | |
| 169 | + | |
| 170 | + picref = avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE); | |
| 150 | 171 | if (!picref) |
| 151 | 172 | return AVERROR(ENOMEM); |
| 152 | 173 | ret = av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref, flags); |
| @@ -226,6 +247,8 @@ static int request_frame(AVFilterLink *link) · 73 unmodified lines | ||
| 226 | 247 | AVFilterBufferRef *buf; |
| 227 | 248 | |
| 228 | 249 | if (!av_fifo_size(c->fifo)) { |
| 250 | + if (c->eof) | |
| 251 | + return AVERROR_EOF; | |
| 229 | 252 | av_log(link->src, AV_LOG_WARNING, |
| 230 | 253 | "request_frame() called with no available frame!\n"); |
| 231 | 254 | return AVERROR(EINVAL); |
| @@ -243,7 +266,10 @@ static int request_frame(AVFilterLink *link) · 11 unmodified lines | ||
| 243 | 266 | static int poll_frame(AVFilterLink *link) |
| 244 | 267 | { |
| 245 | 268 | BufferSourceContext *c = link->src->priv; |
| 246 | − return !!av_fifo_size(c->fifo); | |
| 269 | + int size = av_fifo_size(c->fifo); | |
| 270 | + if (!size && c->eof) | |
| 271 | + return AVERROR_EOF; | |
| 272 | + return size/sizeof(AVFilterBufferRef*); | |
| 247 | 273 | } |
| 248 | 274 | |
| 249 | 275 | AVFilter avfilter_vsrc_buffer = { |