#include "dynapi-internal.h"
-#define VT_FRAMEWORK_PATH "/System/Library/PrivateFrameworks/" \
+#include <gmodule.h>
+
+#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);
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),
{NULL, 0},
};
+ GstVTApi *result;
+ GModule *module;
+
+ 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 _gst_dyn_api_new (gst_vt_api_get_type (), VT_FRAMEWORK_PATH, symbols,
- error);
+ return result;
}
void * sourceFrameRefCon);
void (* VTCompressionSessionInvalidate)
(VTCompressionSessionRef session);
- void (* VTCompressionSessionRelease)
- (VTCompressionSessionRef session);
- VTCompressionSessionRef (* VTCompressionSessionRetain)
- (VTCompressionSessionRef session);
VTStatus (* VTCompressionSessionSetProperty)
(VTCompressionSessionRef session, CFStringRef propName,
CFTypeRef propValue);
gsize unk2, gsize unk3);
void (* VTDecompressionSessionInvalidate)
(VTDecompressionSessionRef session);
- void (* VTDecompressionSessionRelease)
- (VTDecompressionSessionRef session);
- VTDecompressionSessionRef (* VTDecompressionSessionRetain)
- (VTDecompressionSessionRef session);
VTStatus (* VTDecompressionSessionWaitForAsynchronousFrames)
(VTDecompressionSessionRef session);
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);
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
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