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
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -39,6 +39,7 @@ typedef struct {
|
||||
AVRational time_base; ///< time_base to set in the output link
|
||||
AVRational sample_aspect_ratio;
|
||||
char sws_param[256];
|
||||
int eof;
|
||||
} BufferSourceContext;
|
||||
|
||||
#define CHECK_PARAM_CHANGE(s, c, width, height, format)\
|
||||
@@ -55,6 +56,12 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter,
|
||||
AVFilterBufferRef *buf;
|
||||
int ret;
|
||||
|
||||
if (!picref) {
|
||||
c->eof = 1;
|
||||
return 0;
|
||||
} else if (c->eof)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (!av_fifo_space(c->fifo) &&
|
||||
(ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
|
||||
sizeof(buf))) < 0)
|
||||
@@ -125,6 +132,12 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
|
||||
BufferSourceContext *c = s->priv;
|
||||
int ret;
|
||||
|
||||
if (!buf) {
|
||||
c->eof = 1;
|
||||
return 0;
|
||||
} else if (c->eof)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (!av_fifo_space(c->fifo) &&
|
||||
(ret = av_fifo_realloc2(c->fifo, av_fifo_size(c->fifo) +
|
||||
sizeof(buf))) < 0)
|
||||
@@ -144,9 +157,17 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
|
||||
int av_vsrc_buffer_add_frame(AVFilterContext *buffer_src,
|
||||
const AVFrame *frame, int flags)
|
||||
{
|
||||
BufferSourceContext *c = buffer_src->priv;
|
||||
AVFilterBufferRef *picref;
|
||||
int ret;
|
||||
AVFilterBufferRef *picref =
|
||||
avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE);
|
||||
|
||||
if (!frame) {
|
||||
c->eof = 1;
|
||||
return 0;
|
||||
} else if (c->eof)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
picref = avfilter_get_video_buffer_ref_from_frame(frame, AV_PERM_WRITE);
|
||||
if (!picref)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = av_vsrc_buffer_add_video_buffer_ref(buffer_src, picref, flags);
|
||||
@@ -226,6 +247,8 @@ static int request_frame(AVFilterLink *link)
|
||||
AVFilterBufferRef *buf;
|
||||
|
||||
if (!av_fifo_size(c->fifo)) {
|
||||
if (c->eof)
|
||||
return AVERROR_EOF;
|
||||
av_log(link->src, AV_LOG_WARNING,
|
||||
"request_frame() called with no available frame!\n");
|
||||
return AVERROR(EINVAL);
|
||||
@@ -243,7 +266,10 @@ static int request_frame(AVFilterLink *link)
|
||||
static int poll_frame(AVFilterLink *link)
|
||||
{
|
||||
BufferSourceContext *c = link->src->priv;
|
||||
return !!av_fifo_size(c->fifo);
|
||||
int size = av_fifo_size(c->fifo);
|
||||
if (!size && c->eof)
|
||||
return AVERROR_EOF;
|
||||
return size/sizeof(AVFilterBufferRef*);
|
||||
}
|
||||
|
||||
AVFilter avfilter_vsrc_buffer = {
|
||||
|
||||
Reference in New Issue
Block a user