History

fftools/ffprobe: Make pix_fmt output bitexact

It is currently not due to endianness. This forced to add workarounds with sed in fate/mxf.mak (which are removed in this commit). This is supposed to fix the enhanced-flv-hevc-hdr10 test on big endian systems.

Andreas Rheinhardt committed 1 year ago

Commit f47c8bc1 parent 2657e163 files · +30 −9Browse files

Showing the changes to fftools (1 of 3 files). Show all

Unified · Split

fftools/ffprobe.c+27−6
@@ -2651,6 +2651,31 @@ static void print_private_data(WriterContext *w, void *priv_data) · 2650 unmodified lines
26512651 }
26522652 }
26532653
2654+static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt)
2655+{
2656+ const char *s = av_get_pix_fmt_name(pix_fmt);
2657+ enum AVPixelFormat swapped_pix_fmt;
2658+
2659+ if (!s) {
2660+ print_str_opt("pix_fmt", "unknown");
2661+ } else if (!do_bitexact ||
2662+ (swapped_pix_fmt = av_pix_fmt_swap_endianness(pix_fmt)) == AV_PIX_FMT_NONE) {
2663+ print_str ("pix_fmt", s);
2664+ } else {
2665+ const char *s2 = av_get_pix_fmt_name(swapped_pix_fmt);
2666+ char buf[128];
2667+ size_t i = 0;
2668+
2669+ while (s[i] && s[i] == s2[i])
2670+ i++;
2671+
2672+ memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
2673+ buf[i] = '\0';
2674+
2675+ print_str ("pix_fmt", buf);
2676+ }
2677+}
2678+
26542679 static void print_color_range(WriterContext *w, enum AVColorRange color_range)
26552680 {
26562681 const char *val = av_color_range_name(color_range);
@@ -2959,9 +2984,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, · 302 unmodified lines
29592984 print_int("crop_bottom", frame->crop_bottom);
29602985 print_int("crop_left", frame->crop_left);
29612986 print_int("crop_right", frame->crop_right);
2962− s = av_get_pix_fmt_name(frame->format);
2963− if (s) print_str ("pix_fmt", s);
2964− else print_str_opt("pix_fmt", "unknown");
2987+ print_pixel_format(w, frame->format);
29652988 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);
29662989 if (sar.num) {
29672990 print_q("sample_aspect_ratio", sar, ':');
@@ -3360,9 +3383,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id · 392 unmodified lines
33603383 print_str_opt("sample_aspect_ratio", "N/A");
33613384 print_str_opt("display_aspect_ratio", "N/A");
33623385 }
3363− s = av_get_pix_fmt_name(par->format);
3364− if (s) print_str ("pix_fmt", s);
3365− else print_str_opt("pix_fmt", "unknown");
3386+ print_pixel_format(w, par->format);
33663387 print_int("level", par->level);
33673388
33683389 print_color_range(w, par->color_range);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t