/*
* Copyright (c) 2007 Bobby Bingham
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/avassert.h"
#include "libavutil/audioconvert.h"
+#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/samplefmt.h"
for (buf = fifo->root.next; buf; buf = tmp) {
tmp = buf->next;
- avfilter_unref_buffer(buf->buf);
+ avfilter_unref_bufferp(&buf->buf);
av_free(buf);
}
- avfilter_unref_buffer(fifo->buf_out);
+ avfilter_unref_bufferp(&fifo->buf_out);
}
static int add_to_queue(AVFilterLink *inlink, AVFilterBufferRef *buf)
queue_pop(s);
} else {
buf_out = avfilter_ref_buffer(head, AV_PERM_READ);
+ if (!buf_out)
+ return AVERROR(ENOMEM);
+
buf_out->audio->nb_samples = link->request_samples;
buffer_offset(link, head, link->request_samples);
}
* so we don't have to worry about dereferencing it ourselves. */
switch (outlink->type) {
case AVMEDIA_TYPE_VIDEO:
- ff_start_frame(outlink, fifo->root.next->buf);
- ff_draw_slice (outlink, 0, outlink->h, 1);
- ff_end_frame (outlink);
+ if ((ret = ff_start_frame(outlink, fifo->root.next->buf)) < 0 ||
+ (ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
+ (ret = ff_end_frame(outlink)) < 0)
+ return ret;
+
queue_pop(fifo);
break;
case AVMEDIA_TYPE_AUDIO:
.start_frame = add_to_queue,
.draw_slice = draw_slice,
.end_frame = end_frame,
- .rej_perms = AV_PERM_REUSE2, },
+ .min_perms = AV_PERM_PRESERVE, },
{ .name = NULL}},
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.type = AVMEDIA_TYPE_AUDIO,
.get_audio_buffer = ff_null_get_audio_buffer,
.filter_samples = add_to_queue,
- .rej_perms = AV_PERM_REUSE2, },
+ .min_perms = AV_PERM_PRESERVE, },
{ .name = NULL}},
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,