- if (do_show_streams)
- show_streams(wctx, fmt_ctx);
- if (do_show_chapters)
- show_chapters(wctx, fmt_ctx);
- if (do_show_format)
- show_format(wctx, fmt_ctx);
-
- end:
- close_input_file(&fmt_ctx);
- av_freep(&nb_streams_frames);
- av_freep(&nb_streams_packets);
- av_freep(&selected_streams);
+ }
+
+ if (do_read_frames || do_read_packets) {
+ if (do_show_frames && do_show_packets &&
+ wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
+ section_id = SECTION_ID_PACKETS_AND_FRAMES;
+ else if (do_show_packets && !do_show_frames)
+ section_id = SECTION_ID_PACKETS;
+ else // (!do_show_packets && do_show_frames)
+ section_id = SECTION_ID_FRAMES;
+ if (do_show_frames || do_show_packets)
+ writer_print_section_header(wctx, section_id);
+ read_packets(wctx, fmt_ctx);
+ if (do_show_frames || do_show_packets)
+ writer_print_section_footer(wctx);
+ }
+ if (do_show_streams)
+ show_streams(wctx, fmt_ctx);
+ if (do_show_chapters)
+ show_chapters(wctx, fmt_ctx);
+ if (do_show_format)
+ show_format(wctx, fmt_ctx);
+
+end:
+ close_input_file(&fmt_ctx);
+ av_freep(&nb_streams_frames);
+ av_freep(&nb_streams_packets);
+ av_freep(&selected_streams);