diff options
author | Marton Balint <cus@passwd.hu> | 2015-10-24 15:13:25 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2015-10-30 20:47:43 +0100 |
commit | d9611864c2b7acbab97b7d54024494e721ccc171 (patch) | |
tree | 4a58934cb43b2dbebf07024c058da02a15c1cc0d | |
parent | 47af5db721ed5ba70387e28cc4664e3fcb2b3356 (diff) | |
download | ffmpeg-d9611864c2b7acbab97b7d54024494e721ccc171.tar.gz |
ffprobe: add support for printing packet strings metadata as packet tags
ffprobe.xsd already contains the tag element.
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r-- | ffprobe.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -77,6 +77,7 @@ static int do_show_format_tags = 0; static int do_show_frame_tags = 0; static int do_show_program_tags = 0; static int do_show_stream_tags = 0; +static int do_show_packet_tags = 0; static int show_value_unit = 0; static int use_value_prefix = 0; @@ -135,6 +136,7 @@ typedef enum { SECTION_ID_LIBRARY_VERSION, SECTION_ID_LIBRARY_VERSIONS, SECTION_ID_PACKET, + SECTION_ID_PACKET_TAGS, SECTION_ID_PACKETS, SECTION_ID_PACKETS_AND_FRAMES, SECTION_ID_PACKET_SIDE_DATA_LIST, @@ -178,7 +180,8 @@ static struct section sections[] = { [SECTION_ID_LIBRARY_VERSION] = { SECTION_ID_LIBRARY_VERSION, "library_version", 0, { -1 } }, [SECTION_ID_PACKETS] = { SECTION_ID_PACKETS, "packets", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET, -1} }, [SECTION_ID_PACKETS_AND_FRAMES] = { SECTION_ID_PACKETS_AND_FRAMES, "packets_and_frames", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET, -1} }, - [SECTION_ID_PACKET] = { SECTION_ID_PACKET, "packet", 0, { SECTION_ID_PACKET_SIDE_DATA_LIST, -1 } }, + [SECTION_ID_PACKET] = { SECTION_ID_PACKET, "packet", 0, { SECTION_ID_PACKET_TAGS, SECTION_ID_PACKET_SIDE_DATA_LIST, -1 } }, + [SECTION_ID_PACKET_TAGS] = { SECTION_ID_PACKET_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, { -1 }, .element_name = "tag", .unique_name = "packet_tags" }, [SECTION_ID_PACKET_SIDE_DATA_LIST] ={ SECTION_ID_PACKET_SIDE_DATA_LIST, "side_data_list", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PACKET_SIDE_DATA, -1 } }, [SECTION_ID_PACKET_SIDE_DATA] = { SECTION_ID_PACKET_SIDE_DATA, "side_data", 0, { -1 } }, [SECTION_ID_PIXEL_FORMATS] = { SECTION_ID_PIXEL_FORMATS, "pixel_formats", SECTION_FLAG_IS_ARRAY, { SECTION_ID_PIXEL_FORMAT, -1 } }, @@ -1762,6 +1765,16 @@ static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pk if (pkt->side_data_elems) { int i; + int size; + const uint8_t *side_metadata; + + side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size); + if (side_metadata && size && do_show_packet_tags) { + AVDictionary *dict = NULL; + if (av_packet_unpack_dictionary(side_metadata, size, &dict) >= 0) + 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]; @@ -3177,6 +3190,7 @@ int main(int argc, char **argv) SET_DO_SHOW(FRAME_TAGS, frame_tags); SET_DO_SHOW(PROGRAM_TAGS, program_tags); SET_DO_SHOW(STREAM_TAGS, stream_tags); + SET_DO_SHOW(PACKET_TAGS, packet_tags); if (do_bitexact && (do_show_program_version || do_show_library_versions)) { av_log(NULL, AV_LOG_ERROR, |