diff --git a/sys/applemedia/vtapi.c b/sys/applemedia/vtapi.c index 683ead79d3..0316893919 100644 --- a/sys/applemedia/vtapi.c +++ b/sys/applemedia/vtapi.c @@ -21,7 +21,11 @@ #include "dynapi-internal.h" -#define VT_FRAMEWORK_PATH "/System/Library/PrivateFrameworks/" \ +#include + +#define VT_FRAMEWORK_PATH "/System/Library/Frameworks/" \ + "VideoToolbox.framework/VideoToolbox" +#define VT_FRAMEWORK_PATH_OLD "/System/Library/PrivateFrameworks/" \ "VideoToolbox.framework/VideoToolbox" G_DEFINE_TYPE (GstVTApi, gst_vt_api, GST_TYPE_DYN_API); @@ -48,15 +52,11 @@ gst_vt_api_obtain (GError ** error) SYM_SPEC (VTCompressionSessionCreate), SYM_SPEC (VTCompressionSessionEncodeFrame), SYM_SPEC (VTCompressionSessionInvalidate), - SYM_SPEC (VTCompressionSessionRelease), - SYM_SPEC (VTCompressionSessionRetain), SYM_SPEC (VTCompressionSessionSetProperty), SYM_SPEC (VTDecompressionSessionCreate), SYM_SPEC (VTDecompressionSessionDecodeFrame), SYM_SPEC (VTDecompressionSessionInvalidate), - SYM_SPEC (VTDecompressionSessionRelease), - SYM_SPEC (VTDecompressionSessionRetain), SYM_SPEC (VTDecompressionSessionWaitForAsynchronousFrames), SYM_SPEC (kVTCompressionPropertyKey_AllowTemporalCompression), @@ -82,7 +82,18 @@ gst_vt_api_obtain (GError ** error) {NULL, 0}, }; + GstVTApi *result; + GModule *module; - return _gst_dyn_api_new (gst_vt_api_get_type (), VT_FRAMEWORK_PATH, symbols, - error); + module = g_module_open (VT_FRAMEWORK_PATH, 0); + if (module != NULL) { + result = _gst_dyn_api_new (gst_vt_api_get_type (), VT_FRAMEWORK_PATH, + symbols, error); + g_module_close (module); + } else { + result = _gst_dyn_api_new (gst_vt_api_get_type (), VT_FRAMEWORK_PATH_OLD, + symbols, error); + } + + return result; } diff --git a/sys/applemedia/vtapi.h b/sys/applemedia/vtapi.h index cc3076edb1..b0ca2cfbfa 100644 --- a/sys/applemedia/vtapi.h +++ b/sys/applemedia/vtapi.h @@ -87,10 +87,6 @@ struct _GstVTApi void * sourceFrameRefCon); void (* VTCompressionSessionInvalidate) (VTCompressionSessionRef session); - void (* VTCompressionSessionRelease) - (VTCompressionSessionRef session); - VTCompressionSessionRef (* VTCompressionSessionRetain) - (VTCompressionSessionRef session); VTStatus (* VTCompressionSessionSetProperty) (VTCompressionSessionRef session, CFStringRef propName, CFTypeRef propValue); @@ -107,10 +103,6 @@ struct _GstVTApi gsize unk2, gsize unk3); void (* VTDecompressionSessionInvalidate) (VTDecompressionSessionRef session); - void (* VTDecompressionSessionRelease) - (VTDecompressionSessionRef session); - VTDecompressionSessionRef (* VTDecompressionSessionRetain) - (VTDecompressionSessionRef session); VTStatus (* VTDecompressionSessionWaitForAsynchronousFrames) (VTDecompressionSessionRef session); diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c index 48e48bd033..51613a451c 100644 --- a/sys/applemedia/vtdec.c +++ b/sys/applemedia/vtdec.c @@ -361,8 +361,8 @@ gst_vtdec_create_format_description_from_codec_data (GstVTDec * self, status = self->ctx->cm-> FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom (NULL, - self->details->format_id, self->vinfo.width, self->vinfo.height, - 'avcC', map.data, map.size, NULL, &fmt_desc); + self->details->format_id, self->vinfo.width, self->vinfo.height, 'avcC', + map.data, map.size, NULL, &fmt_desc); gst_buffer_unmap (codec_data, &map); @@ -409,8 +409,10 @@ static void gst_vtdec_destroy_session (GstVTDec * self, VTDecompressionSessionRef * session) { self->ctx->vt->VTDecompressionSessionInvalidate (*session); - self->ctx->vt->VTDecompressionSessionRelease (*session); - *session = NULL; + if (*session != NULL) { + CFRelease (*session); + *session = NULL; + } } static GstFlowReturn diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c index 73adc22df2..5078095626 100644 --- a/sys/applemedia/vtenc.c +++ b/sys/applemedia/vtenc.c @@ -553,8 +553,10 @@ static void gst_vtenc_destroy_session (GstVTEnc * self, VTCompressionSessionRef * session) { self->ctx->vt->VTCompressionSessionInvalidate (*session); - self->ctx->vt->VTCompressionSessionRelease (*session); - *session = NULL; + if (*session != NULL) { + CFRelease (*session); + *session = NULL; + } } typedef struct