You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
ffprobe: refactor pkt side data printing
This commit is contained in:
63
ffprobe.c
63
ffprobe.c
@@ -1759,6 +1759,31 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_pkt_side_data(WriterContext *w,
|
||||||
|
const AVPacketSideData *side_data,
|
||||||
|
int nb_side_data,
|
||||||
|
SectionID id_data_list,
|
||||||
|
SectionID id_data)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
|
||||||
|
for (i = 0; i < nb_side_data; i++) {
|
||||||
|
const AVPacketSideData *sd = &side_data[i];
|
||||||
|
const char *name = av_packet_side_data_name(sd->type);
|
||||||
|
|
||||||
|
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA);
|
||||||
|
print_str("side_data_type", name ? name : "unknown");
|
||||||
|
print_int("side_data_size", sd->size);
|
||||||
|
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
||||||
|
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
||||||
|
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
||||||
|
}
|
||||||
|
writer_print_section_footer(w);
|
||||||
|
}
|
||||||
|
writer_print_section_footer(w);
|
||||||
|
}
|
||||||
|
|
||||||
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
|
static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int packet_idx)
|
||||||
{
|
{
|
||||||
char val_str[128];
|
char val_str[128];
|
||||||
@@ -1788,7 +1813,6 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
|
|||||||
print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
|
print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
|
||||||
|
|
||||||
if (pkt->side_data_elems) {
|
if (pkt->side_data_elems) {
|
||||||
int i;
|
|
||||||
int size;
|
int size;
|
||||||
const uint8_t *side_metadata;
|
const uint8_t *side_metadata;
|
||||||
|
|
||||||
@@ -1799,20 +1823,10 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
|
|||||||
show_tags(w, dict, SECTION_ID_PACKET_TAGS);
|
show_tags(w, dict, SECTION_ID_PACKET_TAGS);
|
||||||
av_dict_free(&dict);
|
av_dict_free(&dict);
|
||||||
}
|
}
|
||||||
writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA_LIST);
|
|
||||||
for (i = 0; i < pkt->side_data_elems; i++) {
|
print_pkt_side_data(w, pkt->side_data, pkt->side_data_elems,
|
||||||
AVPacketSideData *sd = &pkt->side_data[i];
|
SECTION_ID_PACKET_SIDE_DATA_LIST,
|
||||||
const char *name = av_packet_side_data_name(sd->type);
|
SECTION_ID_PACKET_SIDE_DATA);
|
||||||
writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA);
|
|
||||||
print_str("side_data_type", name ? name : "unknown");
|
|
||||||
print_int("side_data_size", sd->size);
|
|
||||||
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
|
||||||
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
|
||||||
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
|
||||||
}
|
|
||||||
writer_print_section_footer(w);
|
|
||||||
}
|
|
||||||
writer_print_section_footer(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_show_data)
|
if (do_show_data)
|
||||||
@@ -2357,22 +2371,9 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
|
|||||||
ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS);
|
ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS);
|
||||||
|
|
||||||
if (stream->nb_side_data) {
|
if (stream->nb_side_data) {
|
||||||
int i;
|
print_pkt_side_data(w, stream->side_data, stream->nb_side_data,
|
||||||
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
|
SECTION_ID_STREAM_SIDE_DATA_LIST,
|
||||||
for (i = 0; i < stream->nb_side_data; i++) {
|
SECTION_ID_STREAM_SIDE_DATA);
|
||||||
AVPacketSideData *sd = &stream->side_data[i];
|
|
||||||
const char *name = av_packet_side_data_name(sd->type);
|
|
||||||
|
|
||||||
writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA);
|
|
||||||
print_str("side_data_type", name ? name : "unknown");
|
|
||||||
print_int("side_data_size", sd->size);
|
|
||||||
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX && sd->size >= 9*4) {
|
|
||||||
writer_print_integers(w, "displaymatrix", sd->data, 9, " %11d", 3, 4, 1);
|
|
||||||
print_int("rotation", av_display_rotation_get((int32_t *)sd->data));
|
|
||||||
}
|
|
||||||
writer_print_section_footer(w);
|
|
||||||
}
|
|
||||||
writer_print_section_footer(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writer_print_section_footer(w);
|
writer_print_section_footer(w);
|
||||||
|
Reference in New Issue
Block a user