History

Merge remote-tracking branch 'qatar/master'

* 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

Michael Niedermayer committed 14 years ago

Commit 7432bcf2 parents 01bf2ad 7bf9e3318 files · +993 −702Browse files

Showing the changes to libavfilter/vsrc_buffer.c (1 of 18 files). Show all

Unified · Split

libavfilter/vsrc_buffer.c+29−3
@@ -39,6 +39,7 @@ typedef struct { · 38 unmodified lines
3939 AVRational time_base; ///< time_base to set in the output link
4040 AVRational sample_aspect_ratio;
4141 char sws_param[256];
42+ int eof;
4243 } BufferSourceContext;
4344
4445 #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
5556 AVFilterBufferRef *buf;
5657 int ret;
5758
59+ if (!picref) {
60+ c->eof = 1;
61+ return 0;
62+ } else if (c->eof)
63+ return AVERROR(EINVAL);
64+
5865 if (!av_fifo_space(c->fifo) &&
5966 (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
6067 sizeof(buf))) < 0)
@@ -125,6 +132,12 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) · 64 unmodified lines
125132 BufferSourceContext *c = s->priv;
126133 int ret;
127134
135+ if (!buf) {
136+ c->eof = 1;
137+ return 0;
138+ } else if (c->eof)
139+ return AVERROR(EINVAL);
140+
128141 if (!av_fifo_space(c->fifo) &&
129142 (ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
130143 sizeof(buf))) < 0)
@@ -144,9 +157,17 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf) · 13 unmodified lines
144157 int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src,
145158 const AVFrame *frame, int flags)
146159 {
160+ BufferSourceContext *c = buffer_src->priv;
161+ AVFilterBufferRef *picref;
147162 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);
150171 if (!picref)
151172 return AVERROR(ENOMEM);
152173 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
226247 AVFilterBufferRef *buf;
227248
228249 if (!av_fifo_size(c->fifo)) {
250+ if (c->eof)
251+ return AVERROR_EOF;
229252 av_log(link->src, AV_LOG_WARNING,
230253 "request_frame() called with no available frame!\n");
231254 return AVERROR(EINVAL);
@@ -243,7 +266,10 @@ static int request_frame(AVFilterLink *link) · 11 unmodified lines
243266 static int poll_frame(AVFilterLink *link)
244267 {
245268 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*);
247273 }
248274
249275 AVFilter avfilter_vsrc_buffer = {

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