diff --git a/libobs/graphics/graphics-ffmpeg.c b/libobs/graphics/graphics-ffmpeg.c index a3a14a7bd..e2caab47f 100644 --- a/libobs/graphics/graphics-ffmpeg.c +++ b/libobs/graphics/graphics-ffmpeg.c @@ -116,9 +116,10 @@ fail: #endif static void *ffmpeg_image_copy_data_straight(struct ffmpeg_image *info, - AVFrame *frame) + AVFrame *frame, + size_t channel_bits) { - const size_t linesize = (size_t)info->cx * 4; + const size_t linesize = (size_t)info->cx * 4 * channel_bits / 8; const size_t totalsize = info->cy * linesize; void *data = bmalloc(totalsize); @@ -369,12 +370,18 @@ static void *ffmpeg_image_reformat_frame(struct ffmpeg_image *info, } if (info->format == AV_PIX_FMT_BGR0) { - data = ffmpeg_image_copy_data_straight(info, frame); + data = ffmpeg_image_copy_data_straight(info, frame, 8); + + } else if (info->format == AV_PIX_FMT_RGBAF16LE) { + data = ffmpeg_image_copy_data_straight(info, frame, 16); + + } else if (info->format == AV_PIX_FMT_RGBAF32LE) { + data = ffmpeg_image_copy_data_straight(info, frame, 32); } else if (info->format == AV_PIX_FMT_RGBA || info->format == AV_PIX_FMT_BGRA) { if (alpha_mode == GS_IMAGE_ALPHA_STRAIGHT) { - data = ffmpeg_image_copy_data_straight(info, frame); + data = ffmpeg_image_copy_data_straight(info, frame, 8); } else { const size_t linesize = (size_t)info->cx * 4; const size_t totalsize = info->cy * linesize; @@ -611,6 +618,10 @@ static inline enum gs_color_format convert_format(enum AVPixelFormat format) return GS_BGRX; case AV_PIX_FMT_RGBA64BE: return GS_RGBA16; + case AV_PIX_FMT_RGBAF16LE: + return GS_RGBA16F; + case AV_PIX_FMT_RGBAF32LE: + return GS_RGBA32F; default: return GS_BGRX; }