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

Unified · Split

3 files
  1. fftools/ffprobe.c +27 −6
  2. tests/fate/mxf.mak +2 −2
  3. tests/ref/fate/enhanced-flv-hevc-hdr10 +1 −1
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);
tests/fate/mxf.mak+2−2
@@ -29,7 +29,7 @@ fate-mxf-probe-dnxhd: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" · 28 unmodified lines
2929
3030 FATE_MXF_PROBE-$(call DEMDEC, MXF, JPEG2000) += fate-mxf-probe-j2k
3131 fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf
32−fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/rgb48../rgb48/"
32+fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
3333
3434 FATE_MXF_PROBE-$(call DEMDEC, MXF, DVVIDEO PCM_S16LE) += fate-mxf-probe-dv25
3535 fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-00005.mxf
@@ -37,7 +37,7 @@ fate-mxf-probe-dv25: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" · 1 unmodified line
3737
3838 FATE_MXF_PROBE-$(call DEMDEC, MXF, PRORES PCM_S24LE) += fate-mxf-probe-applehdr10
3939 fate-mxf-probe-applehdr10: SRC = $(TARGET_SAMPLES)/mxf/Meridian-Apple_ProResProxy-HDR10.mxf
40−fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/yuv422p10../yuv422p10/"
40+fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
4141
4242 # Tests remuxing ProRes as well as writing mastering display metadata.
4343 FATE_MXF_FFMPEG_FFPROBE-$(call REMUX, MXF, PRORES_DECODER) += fate-mxf-remux-applehdr10
tests/ref/fate/enhanced-flv-hevc-hdr10+1−1
@@ -25,7 +25,7 @@ crop_top=0 · 24 unmodified lines
2525 crop_bottom=0
2626 crop_left=0
2727 crop_right=0
28−pix_fmt=yuv420p10le
28+pix_fmt=yuv420p10
2929 sample_aspect_ratio=N/A
3030 pict_type=I
3131 interlaced_frame=0

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