Adjust debug level add AVPixelFormat Image::AVPixFormat(AVPixelFormat new_pixelformat)

This commit is contained in:
Isaac Connor
2025-02-22 23:19:05 +05:30
parent c698b611ed
commit e1898c483b
2 changed files with 36 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ std::list<const CodecData*> get_encoder_data(int wanted_codec, const std::string
}
}
if (wanted_codec and (enc_codecs[i].codec_id != wanted_codec)) {
Debug(1, "Not the right codec id %d %s != %d %s for %s",
Debug(4, "Not the right codec id %d %s != %d %s for %s",
chosen_codec_data->codec_id,
avcodec_get_name(chosen_codec_data->codec_id),
wanted_codec,

View File

@@ -5354,4 +5354,38 @@ AVPixelFormat Image::AVPixFormat() const {
}
}
AVPixelFormat Image::AVPixFormat(AVPixelFormat new_pixelformat) {
switch (new_pixelformat) {
case AV_PIX_FMT_YUVJ420P:
colours = ZM_COLOUR_YUVJ420P;
subpixelorder = ZM_SUBPIX_ORDER_YUVJ420P;
break;
case AV_PIX_FMT_YUV420P:
colours = ZM_COLOUR_YUV420P;
subpixelorder = ZM_SUBPIX_ORDER_YUV420P;
break;
case AV_PIX_FMT_RGBA:
colours = ZM_COLOUR_RGB32;
subpixelorder = ZM_SUBPIX_ORDER_RGBA;
break;
case AV_PIX_FMT_BGR24:
colours = ZM_COLOUR_RGB24;
subpixelorder = ZM_SUBPIX_ORDER_BGR;
break;
case AV_PIX_FMT_RGB24:
colours = ZM_COLOUR_RGB24;
subpixelorder = ZM_SUBPIX_ORDER_RGB;
break;
case AV_PIX_FMT_GRAY8:
colours = ZM_COLOUR_GRAY8;
subpixelorder = ZM_SUBPIX_ORDER_NONE;
break;
default:
Error("Unknown pixelformat %d %s", new_pixelformat, av_get_pix_fmt_name(new_pixelformat));
}
Debug(4, "Old size: %d, old pixelformat %d", size, imagePixFormat);
size = av_image_get_buffer_size(new_pixelformat, width, height, 32);
Debug(4, "New size: %d new pixelformat %d", size, new_pixelformat);
linesize = FFALIGN(av_image_get_linesize(new_pixelformat, width, 0), 32);
return imagePixFormat = new_pixelformat;
}