Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Bœsch <clement@stupeflix.com>2016-06-23 14:36:18 +0300
committerClément Bœsch <clement@stupeflix.com>2016-06-23 14:48:14 +0300
commitccf942a0c25eab26948efd9574e87bf3eec4f344 (patch)
tree2252b43a4c2f5faa3e5929158c8fdb2394b58335 /ffprobe.c
parent78f5589b29803b783258e53ec5f4d0fd52325946 (diff)
ffprobe: refactor pkt side data printing
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/ffprobe.c b/ffprobe.c
index a7e329c107..0c4dd9c6e5 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1759,6 +1759,31 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
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)
{
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' : '_');
if (pkt->side_data_elems) {
- int i;
int size;
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);
av_dict_free(&dict);
}
- writer_print_section_header(w, SECTION_ID_PACKET_SIDE_DATA_LIST);
- for (i = 0; i < pkt->side_data_elems; i++) {
- AVPacketSideData *sd = &pkt->side_data[i];
- const char *name = av_packet_side_data_name(sd->type);
- 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);
+
+ print_pkt_side_data(w, pkt->side_data, pkt->side_data_elems,
+ SECTION_ID_PACKET_SIDE_DATA_LIST,
+ SECTION_ID_PACKET_SIDE_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);
if (stream->nb_side_data) {
- int i;
- writer_print_section_header(w, SECTION_ID_STREAM_SIDE_DATA_LIST);
- for (i = 0; i < stream->nb_side_data; i++) {
- 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);
+ print_pkt_side_data(w, stream->side_data, stream->nb_side_data,
+ SECTION_ID_STREAM_SIDE_DATA_LIST,
+ SECTION_ID_STREAM_SIDE_DATA);
}
writer_print_section_footer(w);