Browse code

lavd/lavfi: add dumpgraph option.

Nicolas George authored on 2012/01/20 03:38:11
Showing 2 changed files
... ...
@@ -28,6 +28,7 @@ version next:
28 28
 - rv34: frame-level multi-threading
29 29
 - optimized iMDCT transform on x86 using SSE for for mpegaudiodec
30 30
 - Improved PGS subtitle decoder
31
+- dumpgraph option to lavfi device
31 32
 
32 33
 
33 34
 version 0.9:
... ...
@@ -41,6 +41,7 @@
41 41
 typedef struct {
42 42
     AVClass *class;          ///< class for private options
43 43
     char          *graph_str;
44
+    char          *dump_graph;
44 45
     AVFilterGraph *graph;
45 46
     AVFilterContext **sinks;
46 47
     int *sink_stream_map;
... ...
@@ -230,6 +231,13 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx,
230 230
     if ((ret = avfilter_graph_config(lavfi->graph, avctx)) < 0)
231 231
         FAIL(ret);
232 232
 
233
+    if (lavfi->dump_graph) {
234
+        char *dump = avfilter_graph_dump(lavfi->graph, lavfi->dump_graph);
235
+        fputs(dump, stderr);
236
+        fflush(stderr);
237
+        av_free(dump);
238
+    }
239
+
233 240
     /* fill each stream with the information in the corresponding sink */
234 241
     for (i = 0; i < avctx->nb_streams; i++) {
235 242
         AVFilterLink *link = lavfi->sinks[lavfi->stream_sink_map[i]]->inputs[0];
... ...
@@ -329,6 +337,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
329 329
 
330 330
 static const AVOption options[] = {
331 331
     { "graph", "Libavfilter graph", OFFSET(graph_str),  AV_OPT_TYPE_STRING, {.str = NULL }, 0,  0, DEC },
332
+    { "dumpgraph", "Dump graph to stderr", OFFSET(dump_graph), AV_OPT_TYPE_STRING, {.str = NULL}, 0,  0, DEC },
332 333
     { NULL },
333 334
 };
334 335