lavd/lavfi: add dumpgraph option.

This commit is contained in:
Nicolas George 2012-01-19 19:38:11 +01:00
parent 0c3577bfd9
commit 1fa88f343a
2 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,7 @@ version next:
- rv34: frame-level multi-threading - rv34: frame-level multi-threading
- optimized iMDCT transform on x86 using SSE for for mpegaudiodec - optimized iMDCT transform on x86 using SSE for for mpegaudiodec
- Improved PGS subtitle decoder - Improved PGS subtitle decoder
- dumpgraph option to lavfi device
version 0.9: version 0.9:

View File

@ -41,6 +41,7 @@
typedef struct { typedef struct {
AVClass *class; ///< class for private options AVClass *class; ///< class for private options
char *graph_str; char *graph_str;
char *dump_graph;
AVFilterGraph *graph; AVFilterGraph *graph;
AVFilterContext **sinks; AVFilterContext **sinks;
int *sink_stream_map; int *sink_stream_map;
@ -230,6 +231,13 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx,
if ((ret = avfilter_graph_config(lavfi->graph, avctx)) < 0) if ((ret = avfilter_graph_config(lavfi->graph, avctx)) < 0)
FAIL(ret); FAIL(ret);
if (lavfi->dump_graph) {
char *dump = avfilter_graph_dump(lavfi->graph, lavfi->dump_graph);
fputs(dump, stderr);
fflush(stderr);
av_free(dump);
}
/* fill each stream with the information in the corresponding sink */ /* fill each stream with the information in the corresponding sink */
for (i = 0; i < avctx->nb_streams; i++) { for (i = 0; i < avctx->nb_streams; i++) {
AVFilterLink *link = lavfi->sinks[lavfi->stream_sink_map[i]]->inputs[0]; AVFilterLink *link = lavfi->sinks[lavfi->stream_sink_map[i]]->inputs[0];
@ -329,6 +337,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
static const AVOption options[] = { static const AVOption options[] = {
{ "graph", "Libavfilter graph", OFFSET(graph_str), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC }, { "graph", "Libavfilter graph", OFFSET(graph_str), 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 },
{ NULL }, { NULL },
}; };