Revision 037be76e ffmpeg.c

View differences:

ffmpeg.c
356 356

  
357 357
    graph = avfilter_graph_alloc();
358 358

  
359
    if ((ret = avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src")) < 0)
360
        return ret;
361
    if ((ret = avfilter_open(&ist->output_video_filter, &ffsink, "out")) < 0)
362
        return ret;
363

  
364 359
    snprintf(args, 255, "%d:%d:%d:%d:%d", ist->st->codec->width,
365 360
             ist->st->codec->height, ist->st->codec->pix_fmt, 1, AV_TIME_BASE);
366
    if ((ret = avfilter_init_filter(ist->input_video_filter, args, NULL)) < 0)
361
    ret = avfilter_graph_create_filter(&ist->input_video_filter, avfilter_get_by_name("buffer"),
362
                                       "src", args, NULL, graph);
363
    if (ret < 0)
367 364
        return ret;
368
    if ((ret = avfilter_init_filter(ist->output_video_filter, NULL, &ffsink_ctx)) < 0)
365
    ret = avfilter_graph_create_filter(&ist->output_video_filter, &ffsink,
366
                                       "out", NULL, &ffsink_ctx, graph);
367
    if (ret < 0)
369 368
        return ret;
370

  
371
    /* add input and output filters to the overall graph */
372
    avfilter_graph_add_filter(graph, ist->input_video_filter);
373
    avfilter_graph_add_filter(graph, ist->output_video_filter);
374

  
375 369
    last_filter = ist->input_video_filter;
376 370

  
377 371
    if (codec->width  != icodec->width || codec->height != icodec->height) {
......
379 373
                 codec->width,
380 374
                 codec->height,
381 375
                 (int)av_get_int(sws_opts, "sws_flags", NULL));
382
        if ((ret = avfilter_open(&filter, avfilter_get_by_name("scale"), NULL)) < 0)
383
            return ret;
384
        if ((ret = avfilter_init_filter(filter, args, NULL)) < 0)
376
        if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
377
                                                NULL, args, NULL, graph)) < 0)
385 378
            return ret;
386 379
        if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0)
387 380
            return ret;
388 381
        last_filter = filter;
389
        avfilter_graph_add_filter(graph, last_filter);
390 382
    }
391 383

  
392 384
    snprintf(args, sizeof(args), "flags=0x%X", (int)av_get_int(sws_opts, "sws_flags", NULL));

Also available in: Unified diff