]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/lavfi.c
vsrc_mandelbrot: spatial interpolation
[ffmpeg] / libavdevice / lavfi.c
index 4d7297bce6153460738e9f61032d98e33b89dc36..cce09c5592306e1152c352cb498668ca8cf17252 100644 (file)
@@ -161,8 +161,9 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx,
     /* for each open output create a corresponding stream */
     for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
         AVStream *st;
-        if (!(st = av_new_stream(avctx, i)))
+        if (!(st = avformat_new_stream(avctx, NULL)))
             FAIL(AVERROR(ENOMEM));
+        st->id = i;
     }
 
     /* create a sink for each output and connect them to the graph */
@@ -299,7 +300,9 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
         avpicture_layout(&pict, ref->format, ref->video->w,
                          ref->video->h, pkt->data, size);
     } else if (ref->audio) {
-        size = ref->linesize[0];
+        size = ref->audio->nb_samples *
+            av_get_bytes_per_sample(ref->format) *
+            av_get_channel_layout_nb_channels(ref->audio->channel_layout);
         if ((ret = av_new_packet(pkt, size)) < 0)
             return ret;
         memcpy(pkt->data, ref->data[0], size);
@@ -319,7 +322,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 
 static const AVOption options[] = {
-    { "graph", "Libavfilter graph", OFFSET(graph_str),  FF_OPT_TYPE_STRING, {.str = NULL }, 0,  0, DEC },
+    { "graph", "Libavfilter graph", OFFSET(graph_str),  AV_OPT_TYPE_STRING, {.str = NULL }, 0,  0, DEC },
     { NULL },
 };