Commit ad381ac9 authored by Stefano Sabatini's avatar Stefano Sabatini

ffprobe: fix chapter printing, fix JSON output

Make writer_print_chapter_header() set the internal values *before* the
private writer callback is called, otherwise the accessed internal values
will be wrong.

Fix regression introduced in fa6cb2fd.

Found-By: Daemon404
parent a5e83a5d
...@@ -252,14 +252,14 @@ static inline void writer_print_footer(WriterContext *wctx) ...@@ -252,14 +252,14 @@ static inline void writer_print_footer(WriterContext *wctx)
static inline void writer_print_chapter_header(WriterContext *wctx, static inline void writer_print_chapter_header(WriterContext *wctx,
const char *chapter) const char *chapter)
{ {
if (wctx->writer->print_chapter_header)
wctx->writer->print_chapter_header(wctx, chapter);
wctx->nb_section = 0; wctx->nb_section = 0;
wctx->multiple_sections = !strcmp(chapter, "packets") || !strcmp(chapter, "frames" ) || wctx->multiple_sections = !strcmp(chapter, "packets") || !strcmp(chapter, "frames" ) ||
!strcmp(chapter, "packets_and_frames") || !strcmp(chapter, "packets_and_frames") ||
!strcmp(chapter, "streams") || !strcmp(chapter, "library_versions"); !strcmp(chapter, "streams") || !strcmp(chapter, "library_versions");
wctx->is_fmt_chapter = !strcmp(chapter, "format"); wctx->is_fmt_chapter = !strcmp(chapter, "format");
if (wctx->writer->print_chapter_header)
wctx->writer->print_chapter_header(wctx, chapter);
} }
static inline void writer_print_chapter_footer(WriterContext *wctx, static inline void writer_print_chapter_footer(WriterContext *wctx,
......
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