[FFmpeg-devel] [PATCH] libavdevice: fix compilation for Mac OS X 10.7-10.12, iOS < 11
Gnattu OC
gnattuoc at me.com
Wed Aug 21 04:09:49 EEST 2024
> On Aug 21, 2024, at 07:17, epirat07 at 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 <erikbsolem at 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 at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org <mailto:ffmpeg-devel at ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org <mailto:ffmpeg-devel-request at ffmpeg.org> with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list