> On Aug 21, 2024, at 07:17, epira...@gmail.com wrote: > > > > On 21 Aug 2024, at 0:43, Erik Bråthen Solem wrote: > >> avfoundation.m uses constants prefixed with AVMediaType on Mac OS X > 10.6. >> In 10.7 through 10.12 their type was NSString*, but starting with 10.13 a >> new AVMediaType struct type was introduced. In avfoundation.m, the function >> getDevicesWithMediaType takes this struct as parameter, which breaks support >> for Mac OS X 10.7 through 10.12. By typedef-ing AVMediaType to NSString* for >> these versions, the code compiles. Prior to 10.15 the value is passed to a >> function that takes AVMediaType on 10.13+ and NSString* on <= 10.12. The >> same API change was introduced in iOS starting with iOS 11. >> > > Hi, thanks for the patch. Conceptually looks fine to me. > > See my remark below: > >> Signed-off-by: Erik Bråthen Solem <erikbso...@hotmail.com> >> --- >> libavdevice/avfoundation.m | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m >> index c5a09c6563..779bc767d6 100644 >> --- a/libavdevice/avfoundation.m >> +++ b/libavdevice/avfoundation.m >> @@ -763,6 +763,10 @@ static int get_audio_config(AVFormatContext *s) >> return 0; >> } >> >> +#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || >> (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300)) >> +typedef NSString* AVMediaType; >> +#endif > > I do not think this is the proper guard here? You want to check *_MAX_ALLOWED > if you want to check the SDK version, > which is what controls these change (as the SDK changed) not the minimum > version you target when compiling.
This depends on use case though. For example, compiling on high version SDK, but targeting low version SDK and selectively load high version symbols during the runtime should not use *_MAX_ALLOWED because that will disable higher version symbols at build time which prevents the usage of the runtime version check. > >> + >> static NSArray* getDevicesWithMediaType(AVMediaType mediaType) { >> #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || >> (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)) >> NSMutableArray *deviceTypes = nil; >> -- >> 2.46.0 >> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org <mailto:ffmpeg-devel-requ...@ffmpeg.org> with > subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".