| @@ -2651,6 +2651,31 @@ static void print_private_data(WriterContext *w, void *priv_data) · 2650 unmodified lines |
| 2651 | 2651 | } |
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 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 | + |
| 2654 | 2679 | static void print_color_range(WriterContext *w, enum AVColorRange color_range) |
| 2655 | 2680 | { |
| 2656 | 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 | 2984 | print_int("crop_bottom", frame->crop_bottom); |
| 2960 | 2985 | print_int("crop_left", frame->crop_left); |
| 2961 | 2986 | 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); |
| 2965 | 2988 | sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame); |
| 2966 | 2989 | if (sar.num) { |
| 2967 | 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 | 3383 | print_str_opt("sample_aspect_ratio", "N/A"); |
| 3361 | 3384 | print_str_opt("display_aspect_ratio", "N/A"); |
| 3362 | 3385 | } |
| 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); |
| 3366 | 3387 | print_int("level", par->level); |
| 3367 | 3388 | |
| 3368 | 3389 | print_color_range(w, par->color_range); |