[FFmpeg-devel] [PATCH v1 2/2] avdevice/lavf: change the dumpgraph option to bool type

lance.lmwang at gmail.com lance.lmwang at gmail.com
Wed Nov 20 16:54:56 EET 2019


From: Limin Wang <lance.lmwang at gmail.com>

dumpgraph option currently uses string types, but actually only requires bool type

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 doc/indevs.texi     | 2 +-
 libavdevice/lavfi.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 92bc65be41..19de11c516 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -979,7 +979,7 @@ filters. Syntax of the filtergraph is the same as the one specified by
 the option @var{graph}.
 
 @item dumpgraph
-Dump graph to stderr.
+Dump graph to stderr. Boolean value, by default disabled.
 
 @end table
 
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index ca8f05f3f7..0804a62b90 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -47,7 +47,7 @@ typedef struct {
     AVClass *class;          ///< class for private options
     char          *graph_str;
     char          *graph_filename;
-    char          *dump_graph;
+    int dump_graph;
     AVFilterGraph *graph;
     AVFilterContext **sinks;
     int *sink_stream_map;
@@ -301,7 +301,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
         goto end;
 
     if (lavfi->dump_graph) {
-        char *dump = avfilter_graph_dump(lavfi->graph, lavfi->dump_graph);
+        char *dump = avfilter_graph_dump(lavfi->graph, NULL);
         fputs(dump, stderr);
         fflush(stderr);
         av_free(dump);
@@ -489,7 +489,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
 static const AVOption options[] = {
     { "graph",     "set libavfilter graph", OFFSET(graph_str),  AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
     { "graph_file","set libavfilter graph filename", OFFSET(graph_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC},
-    { "dumpgraph", "dump graph to stderr",  OFFSET(dump_graph), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+    { "dumpgraph", "dump graph to stderr",  OFFSET(dump_graph), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC },
     { NULL },
 };
 
-- 
2.21.0



More information about the ffmpeg-devel mailing list