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

lance.lmwang at gmail.com lance.lmwang at gmail.com
Tue May 19 17:54:33 EEST 2020


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 6f5afaf..0ce61f2 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -974,7 +974,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 c949ff7..57c3070 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);
         if (dump != NULL) {
             fputs(dump, stderr);
             fflush(stderr);
@@ -493,7 +493,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 },
 };
 
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list