From a252ebb531f5a5b4f8a82b2a6085fdcbb2a97ce7 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Fri, 8 Aug 2025 10:28:19 +0200 Subject: [PATCH] Cleanup: Remove deprecated movie formats code This patch removes code handling the now-deprecated movie formats. Pull Request: https://projects.blender.org/blender/blender/pulls/144188 --- .../blender/blenkernel/intern/image_format.cc | 45 +++---------------- .../blenloader/intern/versioning_420.cc | 5 ++- .../blender/imbuf/movie/intern/movie_util.cc | 20 --------- .../blender/imbuf/movie/intern/movie_write.cc | 16 +------ source/blender/makesdna/DNA_scene_types.h | 12 ++--- source/creator/creator_args.cc | 2 +- 6 files changed, 18 insertions(+), 82 deletions(-) diff --git a/source/blender/blenkernel/intern/image_format.cc b/source/blender/blenkernel/intern/image_format.cc index 8f3738f3e85..ea0ec5d9f43 100644 --- a/source/blender/blenkernel/intern/image_format.cc +++ b/source/blender/blenkernel/intern/image_format.cc @@ -303,26 +303,12 @@ bool BKE_imtype_is_image(const char imtype) bool BKE_imtype_is_multi_layer_image(const char imtype) { - switch (imtype) { - case R_IMF_IMTYPE_MULTILAYER: - return true; - } - return false; + return imtype == R_IMF_IMTYPE_MULTILAYER; } bool BKE_imtype_is_movie(const char imtype) { - switch (imtype) { - case R_IMF_IMTYPE_AVIRAW: - case R_IMF_IMTYPE_AVIJPEG: - case R_IMF_IMTYPE_FFMPEG: - case R_IMF_IMTYPE_H264: - case R_IMF_IMTYPE_THEORA: - case R_IMF_IMTYPE_XVID: - case R_IMF_IMTYPE_AV1: - return true; - } - return false; + return imtype == R_IMF_IMTYPE_FFMPEG; } bool BKE_imtype_supports_compress(const char imtype) @@ -339,7 +325,6 @@ bool BKE_imtype_supports_quality(const char imtype) switch (imtype) { case R_IMF_IMTYPE_JPEG90: case R_IMF_IMTYPE_JP2: - case R_IMF_IMTYPE_AVIJPEG: case R_IMF_IMTYPE_WEBP: return true; } @@ -475,12 +460,6 @@ char BKE_imtype_from_arg(const char *imtype_arg) if (STREQ(imtype_arg, "RAWTGA")) { return R_IMF_IMTYPE_RAWTGA; } - if (STREQ(imtype_arg, "AVIRAW")) { - return R_IMF_IMTYPE_AVIRAW; - } - if (STREQ(imtype_arg, "AVIJPEG")) { - return R_IMF_IMTYPE_AVIJPEG; - } if (STREQ(imtype_arg, "PNG")) { return R_IMF_IMTYPE_PNG; } @@ -552,14 +531,7 @@ static int image_path_ext_from_imformat_impl(const char imtype, else if (imtype == R_IMF_IMTYPE_RADHDR) { r_ext[ext_num++] = ".hdr"; } - else if (ELEM(imtype, - R_IMF_IMTYPE_PNG, - R_IMF_IMTYPE_FFMPEG, - R_IMF_IMTYPE_H264, - R_IMF_IMTYPE_THEORA, - R_IMF_IMTYPE_XVID, - R_IMF_IMTYPE_AV1)) - { + else if (ELEM(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG)) { r_ext[ext_num++] = ".png"; } else if (imtype == R_IMF_IMTYPE_DDS) { @@ -615,7 +587,7 @@ static int image_path_ext_from_imformat_impl(const char imtype, } #endif else { - /* Handles: #R_IMF_IMTYPE_AVIRAW, #R_IMF_IMTYPE_AVIJPEG, #R_IMF_IMTYPE_JPEG90 etc. */ + /* Handles: #R_IMF_IMTYPE_JPEG90 etc. */ r_ext[ext_num++] = ".jpg"; r_ext[ext_num++] = ".jpeg"; } @@ -775,14 +747,7 @@ void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf) else if (imtype == R_IMF_IMTYPE_RADHDR) { ibuf->ftype = IMB_FTYPE_RADHDR; } - else if (ELEM(imtype, - R_IMF_IMTYPE_PNG, - R_IMF_IMTYPE_FFMPEG, - R_IMF_IMTYPE_H264, - R_IMF_IMTYPE_THEORA, - R_IMF_IMTYPE_XVID, - R_IMF_IMTYPE_AV1)) - { + else if (ELEM(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG)) { ibuf->ftype = IMB_FTYPE_PNG; if (imtype == R_IMF_IMTYPE_PNG) { diff --git a/source/blender/blenloader/intern/versioning_420.cc b/source/blender/blenloader/intern/versioning_420.cc index b7fe02c24ce..9d7568c0de1 100644 --- a/source/blender/blenloader/intern/versioning_420.cc +++ b/source/blender/blenloader/intern/versioning_420.cc @@ -586,7 +586,10 @@ void do_versions_after_linking_420(FileData *fd, Main *bmain) static void image_settings_avi_to_ffmpeg(Scene *scene) { - if (ELEM(scene->r.im_format.imtype, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG)) { + /* R_IMF_IMTYPE_AVIRAW and R_IMF_IMTYPE_AVIJPEG. */ + constexpr char deprecated_avi_raw_imtype = 15; + constexpr char deprecated_avi_jpeg_imtype = 16; + if (ELEM(scene->r.im_format.imtype, deprecated_avi_raw_imtype, deprecated_avi_jpeg_imtype)) { scene->r.im_format.imtype = R_IMF_IMTYPE_FFMPEG; } } diff --git a/source/blender/imbuf/movie/intern/movie_util.cc b/source/blender/imbuf/movie/intern/movie_util.cc index 42199f7cecc..3e8ab725e10 100644 --- a/source/blender/imbuf/movie/intern/movie_util.cc +++ b/source/blender/imbuf/movie/intern/movie_util.cc @@ -547,26 +547,6 @@ void MOV_validate_output_settings(RenderData *rd, const ImageFormatData *imf) rd->ffcodecdata.type = FFMPEG_MPEG2; } } - else if (imf->imtype == R_IMF_IMTYPE_H264) { - if (rd->ffcodecdata.codec_id_get() != FFMPEG_CODEC_ID_H264) { - ffmpeg_preset_set(rd, FFMPEG_PRESET_H264); - } - } - else if (imf->imtype == R_IMF_IMTYPE_XVID) { - if (rd->ffcodecdata.codec_id_get() != FFMPEG_CODEC_ID_MPEG4) { - ffmpeg_preset_set(rd, FFMPEG_PRESET_XVID); - } - } - else if (imf->imtype == R_IMF_IMTYPE_THEORA) { - if (rd->ffcodecdata.codec_id_get() != FFMPEG_CODEC_ID_THEORA) { - ffmpeg_preset_set(rd, FFMPEG_PRESET_THEORA); - } - } - else if (imf->imtype == R_IMF_IMTYPE_AV1) { - if (rd->ffcodecdata.codec_id_get() != FFMPEG_CODEC_ID_AV1) { - ffmpeg_preset_set(rd, FFMPEG_PRESET_AV1); - } - } #else UNUSED_VARS(rd, imf); #endif diff --git a/source/blender/imbuf/movie/intern/movie_write.cc b/source/blender/imbuf/movie/intern/movie_write.cc index 79a90489338..3b7709f8f67 100644 --- a/source/blender/imbuf/movie/intern/movie_write.cc +++ b/source/blender/imbuf/movie/intern/movie_write.cc @@ -1728,18 +1728,6 @@ static void ffmpeg_movie_close(MovieWriter *context) #endif /* WITH_FFMPEG */ -static bool is_imtype_ffmpeg(const char imtype) -{ - return ELEM(imtype, - R_IMF_IMTYPE_AVIRAW, - R_IMF_IMTYPE_AVIJPEG, - R_IMF_IMTYPE_FFMPEG, - R_IMF_IMTYPE_H264, - R_IMF_IMTYPE_XVID, - R_IMF_IMTYPE_THEORA, - R_IMF_IMTYPE_AV1); -} - MovieWriter *MOV_write_begin(const char imtype, const Scene *scene, const RenderData *rd, @@ -1749,7 +1737,7 @@ MovieWriter *MOV_write_begin(const char imtype, bool preview, const char *suffix) { - if (!is_imtype_ffmpeg(imtype)) { + if (imtype != R_IMF_IMTYPE_FFMPEG) { BKE_report(reports, RPT_ERROR, "Image format is not a movie format"); return nullptr; } @@ -1804,7 +1792,7 @@ void MOV_filepath_from_settings(char filepath[/*FILE_MAX*/ 1024], ReportList *reports) { #ifdef WITH_FFMPEG - if (is_imtype_ffmpeg(rd->im_format.imtype)) { + if (rd->im_format.imtype == R_IMF_IMTYPE_FFMPEG) { ffmpeg_get_filepath(filepath, scene, rd, preview, suffix, reports); return; } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index ff9f5017382..7169fdc22e4 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -533,8 +533,8 @@ enum { // R_MOVIE = 5, /* DEPRECATED */ R_IMF_IMTYPE_IRIZ = 7, R_IMF_IMTYPE_RAWTGA = 14, - R_IMF_IMTYPE_AVIRAW = 15, - R_IMF_IMTYPE_AVIJPEG = 16, + /* R_IMF_IMTYPE_AVIRAW = 15, DEPRECATED */ + /* R_IMF_IMTYPE_AVIJPEG = 16, DEPRECATED */ R_IMF_IMTYPE_PNG = 17, // R_IMF_IMTYPE_AVICODEC = 18, /* DEPRECATED */ // R_IMF_IMTYPE_QUICKTIME = 19, /* DEPRECATED */ @@ -549,12 +549,12 @@ enum { R_IMF_IMTYPE_MULTILAYER = 28, R_IMF_IMTYPE_DDS = 29, R_IMF_IMTYPE_JP2 = 30, - R_IMF_IMTYPE_H264 = 31, - R_IMF_IMTYPE_XVID = 32, - R_IMF_IMTYPE_THEORA = 33, + /* R_IMF_IMTYPE_H264 = 31, DEPRECATED */ + /* R_IMF_IMTYPE_XVID = 32, DEPRECATED */ + /* R_IMF_IMTYPE_THEORA = 33, DEPRECATED */ R_IMF_IMTYPE_PSD = 34, R_IMF_IMTYPE_WEBP = 35, - R_IMF_IMTYPE_AV1 = 36, + /* R_IMF_IMTYPE_AV1 = 36, DEPRECATED */ R_IMF_IMTYPE_INVALID = 255, }; diff --git a/source/creator/creator_args.cc b/source/creator/creator_args.cc index 1bf9f637cf8..dcf6ceec366 100644 --- a/source/creator/creator_args.cc +++ b/source/creator/creator_args.cc @@ -2026,7 +2026,7 @@ static const char arg_handle_image_type_set_doc[] = "\n" "\tSet the render format.\n" "\tValid options are:\n" - "\t'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'AVIRAW' 'AVIJPEG' 'PNG' 'BMP' 'HDR' 'TIFF'.\n" + "\t'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'PNG' 'BMP' 'HDR' 'TIFF'.\n" "\n" "\tFormats that can be compiled into Blender, not available on all systems:\n" "\t'OPEN_EXR' 'OPEN_EXR_MULTILAYER' 'FFMPEG' 'CINEON' 'DPX' 'JP2' 'WEBP'.";