[FFmpeg-devel] [PATCH] Add programs to ffprobe
Florent Tribouilloy
ftriboui at smartjog.com
Fri Jul 12 11:30:38 CEST 2013
Hi,
On 07/12/2013 09:08 AM, Stefano Sabatini wrote:
> On date Thursday 2013-07-11 11:29:01 +0200, Florent Tribouilloy encoded:
>> Option -show_programs for ffprobe will sort the output by programs
>>
>> Signed-off-by: Florent Tribouilloy<florent.tribouilloy at smartjog.com>
>> ---
>> ffprobe.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
>> 1 file changed, 58 insertions(+), 5 deletions(-)
>
> Missing doc/ffprobe.texi and ffprobe.xsd updates.
True :)
(Will do in next patch)
>> +static void show_program(WriterContext *w, AVFormatContext *fmt_ctx, AVProgram *program)
>> +{
>> + int i;
>> +
>> + writer_print_section_header(w, SECTION_ID_PROGRAM);
>> + print_int("program_id", program->id);
>
>> + for (i = 0; i< program->nb_stream_indexes; i++) {
>> + if (selected_streams[program->stream_index[i]])
>> + show_stream(w, fmt_ctx, program->stream_index[i]);
>> + }
>
> I dislike reprinting entirely the stream section here. You can simply
> print the corresponding stream ID.
I understand your point but does it make sense to print the programs
with their datas and the their corresponding stream IDs.
Then, each stream with their datas.
Does the program will be printed without the stream information?
Something like :
programs:
program:1:
data program1
program1_stream_id1
end_program
program:2:
data program2
program2_stream_id2
program2_stream_id3
end_program
programs
streams:
stream:1:
data stream1
end_stream
stream:2:
data stream2
end_stream
stream:3:
data stream3
end_stream
streams
?
Or directly print the streams section inside the program?
programs:
program:1:
data program1
stream:1
data stream1
end_stream
end_program
program:2:
data program2
stream:2
data stream2
end_stream
stream:3
data stream3
end_stream
end_program
programs
I did that due to av_dump_format(), wich try to print by program. I
thought it will be easier to parse.
>> + writer_print_section_footer(w);
>> +}
>> +
>> +static void show_programs(WriterContext *w, AVFormatContext *fmt_ctx)
>> +{
>> + int i;
>> +
>> + writer_print_section_header(w, SECTION_ID_PROGRAMS);
>> + for (i = 0; i< fmt_ctx->nb_programs; i++) {
>> + AVProgram *program = fmt_ctx->programs[i];
>
>> + if (!program)
>> + continue;
>
> Can this happen?
I hoped no... But, I was not sure so I prefered to check it.
I will remove it for the next patch.
>> +static int opt_show_programs(const char *opt, const char *arg)
>> +{
>> + have_show_programs = 1;
>> + mark_section_show_entries(SECTION_ID_PROGRAMS, 1, NULL);
>> + return 0;
>> +}
>> +
>> +static int opt_show_streams(const char *opt, const char *arg)
>> +{
>> + have_show_streams = 1;
>> + mark_section_show_entries(SECTION_ID_STREAMS, 1, NULL);
>> + return 0;
>> +}
>> +
>
> why this?
To print only the streams or only the programs.
(explanation above)
--
Florent Tribouilloy
Intern at smartjog
More information about the ffmpeg-devel
mailing list