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
2651 }2651 }
2652}2652}
2653 2653
2654static 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
2654static void print_color_range(WriterContext *w, enum AVColorRange color_range)2679static void print_color_range(WriterContext *w, enum AVColorRange color_range)
2655{2680{
2656 const char *val = av_color_range_name(color_range);2681 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
2959 print_int("crop_bottom", frame->crop_bottom);2984 print_int("crop_bottom", frame->crop_bottom);
2960 print_int("crop_left", frame->crop_left);2985 print_int("crop_left", frame->crop_left);
2961 print_int("crop_right", frame->crop_right);2986 print_int("crop_right", frame->crop_right);
2962 s = av_get_pix_fmt_name(frame->format);2987 print_pixel_format(w, frame->format);
2963 if (s) print_str ("pix_fmt", s);
2964 else print_str_opt("pix_fmt", "unknown");
2965 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);2988 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);
2966 if (sar.num) {2989 if (sar.num) {
2967 print_q("sample_aspect_ratio", sar, ':');2990 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
3360 print_str_opt("sample_aspect_ratio", "N/A");3383 print_str_opt("sample_aspect_ratio", "N/A");
3361 print_str_opt("display_aspect_ratio", "N/A");3384 print_str_opt("display_aspect_ratio", "N/A");
3362 }3385 }
3363 s = av_get_pix_fmt_name(par->format);3386 print_pixel_format(w, par->format);
3364 if (s) print_str ("pix_fmt", s);
3365 else print_str_opt("pix_fmt", "unknown");
3366 print_int("level", par->level);3387 print_int("level", par->level);
3367 3388
3368 print_color_range(w, par->color_range);3389 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
29 29
30FATE_MXF_PROBE-$(call DEMDEC, MXF, JPEG2000) += fate-mxf-probe-j2k30FATE_MXF_PROBE-$(call DEMDEC, MXF, JPEG2000) += fate-mxf-probe-j2k
31fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf31fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf
32fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/rgb48../rgb48/"32fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
33 33
34FATE_MXF_PROBE-$(call DEMDEC, MXF, DVVIDEO PCM_S16LE) += fate-mxf-probe-dv2534FATE_MXF_PROBE-$(call DEMDEC, MXF, DVVIDEO PCM_S16LE) += fate-mxf-probe-dv25
35fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-00005.mxf35fate-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
37 37
38FATE_MXF_PROBE-$(call DEMDEC, MXF, PRORES PCM_S24LE) += fate-mxf-probe-applehdr1038FATE_MXF_PROBE-$(call DEMDEC, MXF, PRORES PCM_S24LE) += fate-mxf-probe-applehdr10
39fate-mxf-probe-applehdr10: SRC = $(TARGET_SAMPLES)/mxf/Meridian-Apple_ProResProxy-HDR10.mxf39fate-mxf-probe-applehdr10: SRC = $(TARGET_SAMPLES)/mxf/Meridian-Apple_ProResProxy-HDR10.mxf
40fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | sed -e "s/yuv422p10../yuv422p10/"40fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
41 41
42# Tests remuxing ProRes as well as writing mastering display metadata.42# Tests remuxing ProRes as well as writing mastering display metadata.
43FATE_MXF_FFMPEG_FFPROBE-$(call REMUX, MXF, PRORES_DECODER) += fate-mxf-remux-applehdr1043FATE_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
25crop_bottom=025crop_bottom=0
26crop_left=026crop_left=0
27crop_right=027crop_right=0
28pix_fmt=yuv420p10le28pix_fmt=yuv420p10
29sample_aspect_ratio=N/A29sample_aspect_ratio=N/A
30pict_type=I30pict_type=I
31interlaced_frame=031interlaced_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