From 2caf314fd5d1a71961edb6cd523e498a78930ba1 Mon Sep 17 00:00:00 2001 From: Dan Church Date: Sun, 8 Dec 2024 11:25:20 -0600 Subject: [PATCH] Improve check to apply X265 API workaround Not a perfect check, since the commit in the x265 repo that introduces it doesn't bump the X265_BUILD constant like it probably should have. There's still a range of x265 commits from 2024-10-04 to 2024-11-12 where fceux will not build against the development version of x265. If that's the case, just update to the latest x265. Research shows: https://bitbucket.org/multicoreware/x265_git@c8c9d22075b26aa279b4d634c61889ca3d49656e: - X265_BUILD: 209 -> 210 - MAX_SCALABLE_LAYERS: undefined https://bitbucket.org/multicoreware/x265_git@c69c113960834400545bc4bce2830ff51dcb86b3: - API change introduced; workaround needed - X265_BUILD: 210 - MAX_SCALABLE_LAYERS: defined https://bitbucket.org/multicoreware/x265_git@78e5b703b186fe184bf91bb37df82f64059b3f61: - API change reverted; using our workaround now breaks the fceux build - X265_BUILD: 213 - MAX_SCALABLE_LAYERS: still defined https://bitbucket.org/multicoreware/x265_git@451add89e81d45134b9d41168ceeb5516bf62d0b: - X265_BUILD: 213 -> 214 - MAX_SCALABLE_LAYERS: still defined - Using our workaround still breaks the fceux build --- src/drivers/Qt/AviRecord.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/Qt/AviRecord.cpp b/src/drivers/Qt/AviRecord.cpp index 44400751..9e363f81 100644 --- a/src/drivers/Qt/AviRecord.cpp +++ b/src/drivers/Qt/AviRecord.cpp @@ -461,8 +461,8 @@ static int encode_frame( unsigned char *inBuf, int width, int height ) pic->stride[1] = width/2; pic->stride[2] = width/2; -#ifdef MAX_SCALABLE_LAYERS - /* Handle API changes for scalable layers output in x265 4.0 */ +#if X265_BUILD >= 210 && X265_BUILD <= 213 && defined(MAX_SCALABLE_LAYERS) + /* Handle temporary API changes for scalable layers output in x265 4.0 */ x265_picture *pics[MAX_SCALABLE_LAYERS] = {NULL}; pics[0] = pic; ret = x265_encoder_encode( hdl, &nal, &i_nal, pic, pics ); @@ -501,8 +501,8 @@ static int close(void) /* Flush delayed frames */ while( hdl != NULL ) { -#ifdef MAX_SCALABLE_LAYERS - /* Handle API changes for scalable layers output in x265 4.0 */ +#if X265_BUILD >= 210 && X265_BUILD <= 213 && defined(MAX_SCALABLE_LAYERS) + /* Handle temporary API changes for scalable layers output in x265 4.0 */ x265_picture *pics[MAX_SCALABLE_LAYERS] = {NULL}; pics[0] = pic; ret = x265_encoder_encode( hdl, &nal, &i_nal, pic, pics );