mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-27 05:00:37 +00:00
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>
This commit is contained in:
parent
47af5db721
commit
d9611864c2
16
ffprobe.c
16
ffprobe.c
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user