Commit 7edbcfb7 authored by Baptiste Coudurier's avatar Baptiste Coudurier

In dump_format, print streams not associated with any program.

Fixes issue #1366.

Originally committed as revision 20306 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent cbd8a722
...@@ -2902,6 +2902,9 @@ void dump_format(AVFormatContext *ic, ...@@ -2902,6 +2902,9 @@ void dump_format(AVFormatContext *ic,
int is_output) int is_output)
{ {
int i; int i;
uint8_t *printed = av_mallocz(ic->nb_streams);
if (ic->nb_streams && !printed)
return;
av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n", av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
is_output ? "Output" : "Input", is_output ? "Output" : "Input",
...@@ -2940,19 +2943,25 @@ void dump_format(AVFormatContext *ic, ...@@ -2940,19 +2943,25 @@ void dump_format(AVFormatContext *ic,
av_log(NULL, AV_LOG_INFO, "\n"); av_log(NULL, AV_LOG_INFO, "\n");
} }
if(ic->nb_programs) { if(ic->nb_programs) {
int j, k; int j, k, total = 0;
for(j=0; j<ic->nb_programs; j++) { for(j=0; j<ic->nb_programs; j++) {
AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata, AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata,
"name", NULL, 0); "name", NULL, 0);
av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id, av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
name ? name->value : ""); name ? name->value : "");
for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) {
dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output); dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output);
} printed[ic->programs[j]->stream_index[k]] = 1;
} else { }
total += ic->programs[j]->nb_stream_indexes;
}
if (total < ic->nb_streams)
av_log(NULL, AV_LOG_INFO, " No Program\n");
}
for(i=0;i<ic->nb_streams;i++) for(i=0;i<ic->nb_streams;i++)
if (!printed[i])
dump_stream_format(ic, i, index, is_output); dump_stream_format(ic, i, index, is_output);
}
if (ic->metadata) { if (ic->metadata) {
AVMetadataTag *tag=NULL; AVMetadataTag *tag=NULL;
av_log(NULL, AV_LOG_INFO, " Metadata\n"); av_log(NULL, AV_LOG_INFO, " Metadata\n");
...@@ -2960,7 +2969,7 @@ void dump_format(AVFormatContext *ic, ...@@ -2960,7 +2969,7 @@ void dump_format(AVFormatContext *ic,
av_log(NULL, AV_LOG_INFO, " %-16s: %s\n", tag->key, tag->value); av_log(NULL, AV_LOG_INFO, " %-16s: %s\n", tag->key, tag->value);
} }
} }
av_free(printed);
} }
#if LIBAVFORMAT_VERSION_MAJOR < 53 #if LIBAVFORMAT_VERSION_MAJOR < 53
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment