mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
applemedia: port vtapi to run on OS X 10.8
This commit is contained in:
parent
57ff02f485
commit
af6df7292c
4 changed files with 28 additions and 21 deletions
|
@ -21,7 +21,11 @@
|
|||
|
||||
#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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,9 +409,11 @@ static void
|
|||
gst_vtdec_destroy_session (GstVTDec * self, VTDecompressionSessionRef * session)
|
||||
{
|
||||
self->ctx->vt->VTDecompressionSessionInvalidate (*session);
|
||||
self->ctx->vt->VTDecompressionSessionRelease (*session);
|
||||
if (*session != NULL) {
|
||||
CFRelease (*session);
|
||||
*session = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_vtdec_decode_buffer (GstVTDec * self, GstBuffer * buf)
|
||||
|
|
|
@ -553,9 +553,11 @@ static void
|
|||
gst_vtenc_destroy_session (GstVTEnc * self, VTCompressionSessionRef * session)
|
||||
{
|
||||
self->ctx->vt->VTCompressionSessionInvalidate (*session);
|
||||
self->ctx->vt->VTCompressionSessionRelease (*session);
|
||||
if (*session != NULL) {
|
||||
CFRelease (*session);
|
||||
*session = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue