MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / show_packet

Function show_packet

fftools/ffprobe.c:1264–1319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262}
1263
1264static void show_packet(AVTextFormatContext *tfc, InputFile *ifile, AVPacket *pkt, int packet_idx)
1265{
1266 AVStream *st = ifile->streams[pkt->stream_index].st;
1267 AVBPrint pbuf;
1268 const char *s;
1269
1270 av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
1271
1272 avtext_print_section_header(tfc, NULL, SECTION_ID_PACKET);
1273
1274 s = av_get_media_type_string(st->codecpar->codec_type);
1275 if (s) print_str ("codec_type", s);
1276 else print_str_opt("codec_type", "unknown");
1277 print_int("stream_index", pkt->stream_index);
1278 print_ts ("pts", pkt->pts);
1279 print_time("pts_time", pkt->pts, &st->time_base);
1280 print_ts ("dts", pkt->dts);
1281 print_time("dts_time", pkt->dts, &st->time_base);
1282 print_duration_ts("duration", pkt->duration);
1283 print_duration_time("duration_time", pkt->duration, &st->time_base);
1284 print_val("size", pkt->size, unit_byte_str);
1285 if (pkt->pos != -1) print_fmt ("pos", "%"PRId64, pkt->pos);
1286 else print_str_opt("pos", "N/A");
1287 print_fmt("flags", "%c%c%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
1288 pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_',
1289 pkt->flags & AV_PKT_FLAG_CORRUPT ? 'C' : '_');
1290 if (do_show_data)
1291 avtext_print_data(tfc, "data", pkt->data, pkt->size);
1292 avtext_print_data_hash(tfc, "data_hash", pkt->data, pkt->size);
1293
1294 if (pkt->side_data_elems) {
1295 size_t size;
1296 const uint8_t *side_metadata;
1297
1298 side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
1299 if (side_metadata && size && do_show_packet_tags) {
1300 AVDictionary *dict = NULL;
1301 if (av_packet_unpack_dictionary(side_metadata, size, &dict) >= 0)
1302 show_tags(tfc, dict, SECTION_ID_PACKET_TAGS);
1303 av_dict_free(&dict);
1304 }
1305
1306 avtext_print_section_header(tfc, NULL, SECTION_ID_PACKET_SIDE_DATA_LIST);
1307 for (int i = 0; i < pkt->side_data_elems; i++) {
1308 print_pkt_side_data(tfc, st->codecpar, &pkt->side_data[i],
1309 SECTION_ID_PACKET_SIDE_DATA);
1310 avtext_print_section_footer(tfc);
1311 }
1312 avtext_print_section_footer(tfc);
1313 }
1314
1315 avtext_print_section_footer(tfc);
1316
1317 av_bprint_finalize(&pbuf, NULL);
1318 fflush(stdout);
1319}
1320
1321static void show_subtitle(AVTextFormatContext *tfc, AVSubtitle *sub, AVStream *stream,

Callers 1

read_interval_packetsFunction · 0.85

Calls 12

av_bprint_initFunction · 0.85
av_get_media_type_stringFunction · 0.85
avtext_print_dataFunction · 0.85
avtext_print_data_hashFunction · 0.85
av_packet_get_side_dataFunction · 0.85
show_tagsFunction · 0.85
av_dict_freeFunction · 0.85
print_pkt_side_dataFunction · 0.85
av_bprint_finalizeFunction · 0.85

Tested by

no test coverage detected