[FFmpeg-trac] #36(avfilter:new): libavfilter: empty source buffer + yadif filters chain, polling for frames -> assertion failed

FFmpeg trac at avcodec.org
Sat Apr 2 18:25:40 CEST 2011


#36: libavfilter: empty source buffer + yadif filters chain, polling for frames
-> assertion failed
----------------------+----------------------
  Reporter:  fpretto  |      Owner:  michael
      Type:  defect   |     Status:  new
  Priority:  normal   |  Component:  avfilter
   Version:           |   Keywords:
Blocked By:           |   Blocking:
Reproduced:  0        |   Analyzed:  0
----------------------+----------------------
 NB: the "nullsink" filter is used improperly as the last filter in the
 chain.

 The following self compiling sample gives:

 Assertion failed!
 Program: C:\Users\ceztko\Staging\target\Debug\Test.exe
 File: libavfilter/vf_yadif.c, Line 277
 Expression: yadif->next

 Polling for frames with the empty source filter should, IMO, return 0, or
 be a specific switchable error (not a generic -1).

 {{{
 #include <stdio.h>

 #include <libavfilter/avfilter.h>
 #include <libavfilter/avfiltergraph.h>
 #include <libavfilter/vsrc_buffer.h>

 int main(int argc, char* argv[])
 {
     avfilter_register_all();

     AVFilterGraph *filter_graph = avfilter_graph_alloc();
     if (filter_graph == NULL)
             printf("error init");

     AVFilter *buffer_filter = avfilter_get_by_name("buffer");
     if (buffer_filter == NULL)
             printf("error init");

     char args[256];
     snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", 720, 576,
             PIX_FMT_YUV420P, 1, 25, 16, 15);

     int rv;

     // Buffer video source: the decoded frames from the codec will be
 inserted here
     AVFilterContext *buffer_filter_ctx;
     rv = avfilter_graph_create_filter(&buffer_filter_ctx, buffer_filter,
 "src",
             args, NULL, filter_graph);
     if (rv != 0)
             printf("error init");

     AVFilter *sink_filter = avfilter_get_by_name("nullsink");
     if (sink_filter == NULL)
             printf("error init");

     // Null video sink: to terminate the filter chain
     AVFilterContext *sink_filter_ctx;
     rv = avfilter_graph_create_filter(&sink_filter_ctx, sink_filter,
 "out",
             NULL, NULL, filter_graph);
     if (rv != 0)
             printf("error init");

     // Endpoints for the filter graph
     AVFilterInOut *buffer_filter_outputs =
        (AVFilterInOut *)av_mallocz(sizeof(AVFilterInOut));
     if (buffer_filter_outputs == NULL)
             printf("error init");

     buffer_filter_outputs->name = av_strdup("in");
     buffer_filter_outputs->filter_ctx = buffer_filter_ctx;
     buffer_filter_outputs->pad_idx = 0;
     buffer_filter_outputs->next = NULL;

     AVFilterInOut *sink_filter_inputs =
         (AVFilterInOut *)av_mallocz(sizeof(AVFilterInOut));
     if (sink_filter_inputs == NULL)
             printf("error init");

     sink_filter_inputs->name = av_strdup("out");
     sink_filter_inputs->filter_ctx = sink_filter_ctx;
     sink_filter_inputs->pad_idx = 0;
     sink_filter_inputs->next = NULL;

     rv = avfilter_graph_parse(filter_graph, "yadif=1-1",
             sink_filter_inputs, buffer_filter_outputs, NULL);
     if (rv != 0)
             printf("error init");

     rv = avfilter_graph_config(filter_graph, NULL);
     if (rv != 0)
             printf("error init");

     AVFilterLink *output_link = sink_filter_ctx->inputs[0];
     rv = avfilter_poll_frame(output_link);
     printf("%d", rv);

         return 0;
 }
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/36>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list