applemedia: switch vtapi to CFTypeRef style typedefs

This commit is contained in:
Ole André Vadla Ravnås 2010-11-02 23:08:30 +01:00
parent 2e349576eb
commit c6b32b42de
5 changed files with 56 additions and 54 deletions

View file

@ -31,8 +31,8 @@ typedef enum _VTStatus VTStatus;
typedef guint32 VTFormatId; typedef guint32 VTFormatId;
typedef struct _VTCompressionSession VTCompressionSession; typedef CFTypeRef VTCompressionSessionRef;
typedef struct _VTDecompressionSession VTDecompressionSession; typedef CFTypeRef VTDecompressionSessionRef;
typedef struct _VTCompressionOutputCallback VTCompressionOutputCallback; typedef struct _VTCompressionOutputCallback VTCompressionOutputCallback;
typedef struct _VTDecompressionOutputCallback VTDecompressionOutputCallback; typedef struct _VTDecompressionOutputCallback VTDecompressionOutputCallback;
@ -69,48 +69,50 @@ struct _GstVTApi
GstDynApi parent; GstDynApi parent;
VTStatus (* VTCompressionSessionCompleteFrames) VTStatus (* VTCompressionSessionCompleteFrames)
(VTCompressionSession * session, CMTime completeUntilDisplayTimestamp); (VTCompressionSessionRef session, CMTime completeUntilDisplayTimestamp);
VTStatus (* VTCompressionSessionCopyProperty) VTStatus (* VTCompressionSessionCopyProperty)
(VTCompressionSession * session, CFTypeRef key, void* unk, (VTCompressionSessionRef session, CFTypeRef key, void* unk,
CFTypeRef * value); CFTypeRef * value);
VTStatus (* VTCompressionSessionCopySupportedPropertyDictionary) VTStatus (* VTCompressionSessionCopySupportedPropertyDictionary)
(VTCompressionSession * session, CFDictionaryRef * dict); (VTCompressionSessionRef session, CFDictionaryRef * dict);
VTStatus (* VTCompressionSessionCreate) VTStatus (* VTCompressionSessionCreate)
(CFAllocatorRef allocator, gint width, gint height, VTFormatId formatId, (CFAllocatorRef allocator, gint width, gint height, VTFormatId formatId,
gsize unk1, CFDictionaryRef sourcePixelBufferAttributes, gsize unk2, gsize unk1, CFDictionaryRef sourcePixelBufferAttributes, gsize unk2,
VTCompressionOutputCallback outputCallback, VTCompressionOutputCallback outputCallback,
VTCompressionSession ** session); VTCompressionSessionRef * session);
VTStatus (* VTCompressionSessionEncodeFrame) VTStatus (* VTCompressionSessionEncodeFrame)
(VTCompressionSession * session, CVPixelBufferRef pixelBuffer, (VTCompressionSessionRef session, CVPixelBufferRef pixelBuffer,
CMTime displayTimestamp, CMTime displayDuration, CMTime displayTimestamp, CMTime displayDuration,
CFDictionaryRef frameOptions, void * sourceTrackingCallback, CFDictionaryRef frameOptions, void * sourceTrackingCallback,
void * sourceFrameRefCon); void * sourceFrameRefCon);
void (* VTCompressionSessionInvalidate) void (* VTCompressionSessionInvalidate)
(VTCompressionSession * session); (VTCompressionSessionRef session);
void (* VTCompressionSessionRelease) void (* VTCompressionSessionRelease)
(VTCompressionSession * session); (VTCompressionSessionRef session);
VTCompressionSession * (* VTCompressionSessionRetain) VTCompressionSessionRef (* VTCompressionSessionRetain)
(VTCompressionSession * session); (VTCompressionSessionRef session);
VTStatus (* VTCompressionSessionSetProperty) VTStatus (* VTCompressionSessionSetProperty)
(VTCompressionSession * session, CFStringRef propName, (VTCompressionSessionRef session, CFStringRef propName,
CFTypeRef propValue); CFTypeRef propValue);
VTStatus (* VTDecompressionSessionCreate) VTStatus (* VTDecompressionSessionCreate)
(CFAllocatorRef allocator, CMFormatDescriptionRef videoFormatDescription, (CFAllocatorRef allocator,
CFTypeRef sessionOptions, CFDictionaryRef destinationPixelBufferAttributes, CMFormatDescriptionRef videoFormatDescription,
CFTypeRef sessionOptions,
CFDictionaryRef destinationPixelBufferAttributes,
VTDecompressionOutputCallback * outputCallback, VTDecompressionOutputCallback * outputCallback,
VTDecompressionSession ** session); VTDecompressionSessionRef * session);
VTStatus (* VTDecompressionSessionDecodeFrame) VTStatus (* VTDecompressionSessionDecodeFrame)
(VTDecompressionSession * session, CMSampleBufferRef sbuf, gsize unk1, (VTDecompressionSessionRef session, CMSampleBufferRef sbuf, gsize unk1,
gsize unk2, gsize unk3); gsize unk2, gsize unk3);
void (* VTDecompressionSessionInvalidate) void (* VTDecompressionSessionInvalidate)
(VTDecompressionSession * session); (VTDecompressionSessionRef session);
void (* VTDecompressionSessionRelease) void (* VTDecompressionSessionRelease)
(VTDecompressionSession * session); (VTDecompressionSessionRef session);
VTDecompressionSession * (* VTDecompressionSessionRetain) VTDecompressionSessionRef (* VTDecompressionSessionRetain)
(VTDecompressionSession * session); (VTDecompressionSessionRef session);
VTStatus (* VTDecompressionSessionWaitForAsynchronousFrames) VTStatus (* VTDecompressionSessionWaitForAsynchronousFrames)
(VTDecompressionSession * session); (VTDecompressionSessionRef session);
CFStringRef * kVTCompressionPropertyKey_AllowTemporalCompression; CFStringRef * kVTCompressionPropertyKey_AllowTemporalCompression;
CFStringRef * kVTCompressionPropertyKey_AverageDataRate; CFStringRef * kVTCompressionPropertyKey_AverageDataRate;

View file

@ -40,10 +40,10 @@ static CMFormatDescriptionRef gst_vtdec_create_format_description
static CMFormatDescriptionRef static CMFormatDescriptionRef
gst_vtdec_create_format_description_from_codec_data (GstVTDec * self, gst_vtdec_create_format_description_from_codec_data (GstVTDec * self,
GstBuffer * codec_data); GstBuffer * codec_data);
static VTDecompressionSession *gst_vtdec_create_session (GstVTDec * self, static VTDecompressionSessionRef gst_vtdec_create_session (GstVTDec * self,
CMFormatDescriptionRef fmt_desc); CMFormatDescriptionRef fmt_desc);
static void gst_vtdec_destroy_session (GstVTDec * self, static void gst_vtdec_destroy_session (GstVTDec * self,
VTDecompressionSession ** session); VTDecompressionSessionRef * session);
static GstFlowReturn gst_vtdec_decode_buffer (GstVTDec * self, GstBuffer * buf); static GstFlowReturn gst_vtdec_decode_buffer (GstVTDec * self, GstBuffer * buf);
static void gst_vtdec_output_frame (void *data, gsize unk1, VTStatus result, static void gst_vtdec_output_frame (void *data, gsize unk1, VTStatus result,
gsize unk2, CVBufferRef cvbuf); gsize unk2, CVBufferRef cvbuf);
@ -333,10 +333,10 @@ gst_vtdec_create_format_description_from_codec_data (GstVTDec * self,
return NULL; return NULL;
} }
static VTDecompressionSession * static VTDecompressionSessionRef
gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc) gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc)
{ {
VTDecompressionSession *session = NULL; VTDecompressionSessionRef session = NULL;
GstCVApi *cv = self->ctx->cv; GstCVApi *cv = self->ctx->cv;
CFMutableDictionaryRef pb_attrs; CFMutableDictionaryRef pb_attrs;
VTDecompressionOutputCallback callback; VTDecompressionOutputCallback callback;
@ -367,7 +367,7 @@ gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc)
} }
static void static void
gst_vtdec_destroy_session (GstVTDec * self, VTDecompressionSession ** session) gst_vtdec_destroy_session (GstVTDec * self, VTDecompressionSessionRef * session)
{ {
self->ctx->vt->VTDecompressionSessionInvalidate (*session); self->ctx->vt->VTDecompressionSessionInvalidate (*session);
self->ctx->vt->VTDecompressionSessionRelease (*session); self->ctx->vt->VTDecompressionSessionRelease (*session);

View file

@ -67,7 +67,7 @@ struct _GstVTDec
gint caps_width, caps_height; gint caps_width, caps_height;
gint caps_fps_n, caps_fps_d; gint caps_fps_n, caps_fps_d;
CMFormatDescriptionRef fmt_desc; CMFormatDescriptionRef fmt_desc;
VTDecompressionSession * session; VTDecompressionSessionRef session;
GstBuffer * cur_inbuf; GstBuffer * cur_inbuf;
GstFlowReturn cur_flowret; GstFlowReturn cur_flowret;

View file

@ -54,27 +54,27 @@ static void gst_vtenc_clear_cached_caps_downstream (GstVTEnc * self);
static GstFlowReturn gst_vtenc_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_vtenc_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_vtenc_src_event (GstPad * pad, GstEvent * event); static gboolean gst_vtenc_src_event (GstPad * pad, GstEvent * event);
static VTCompressionSession *gst_vtenc_create_session (GstVTEnc * self); static VTCompressionSessionRef gst_vtenc_create_session (GstVTEnc * self);
static void gst_vtenc_destroy_session (GstVTEnc * self, static void gst_vtenc_destroy_session (GstVTEnc * self,
VTCompressionSession ** session); VTCompressionSessionRef * session);
static void gst_vtenc_session_dump_properties (GstVTEnc * self, static void gst_vtenc_session_dump_properties (GstVTEnc * self,
VTCompressionSession * session); VTCompressionSessionRef session);
static void gst_vtenc_session_configure_usage (GstVTEnc * self, static void gst_vtenc_session_configure_usage (GstVTEnc * self,
VTCompressionSession * session, gint usage); VTCompressionSessionRef session, gint usage);
static void gst_vtenc_session_configure_expected_framerate (GstVTEnc * self, static void gst_vtenc_session_configure_expected_framerate (GstVTEnc * self,
VTCompressionSession * session, gdouble framerate); VTCompressionSessionRef session, gdouble framerate);
static void gst_vtenc_session_configure_expected_duration (GstVTEnc * self, static void gst_vtenc_session_configure_expected_duration (GstVTEnc * self,
VTCompressionSession * session, gdouble duration); VTCompressionSessionRef session, gdouble duration);
static void gst_vtenc_session_configure_max_keyframe_interval (GstVTEnc * self, static void gst_vtenc_session_configure_max_keyframe_interval (GstVTEnc * self,
VTCompressionSession * session, gint interval); VTCompressionSessionRef session, gint interval);
static void gst_vtenc_session_configure_max_keyframe_interval_duration static void gst_vtenc_session_configure_max_keyframe_interval_duration
(GstVTEnc * self, VTCompressionSession * session, gdouble duration); (GstVTEnc * self, VTCompressionSessionRef session, gdouble duration);
static void gst_vtenc_session_configure_bitrate (GstVTEnc * self, static void gst_vtenc_session_configure_bitrate (GstVTEnc * self,
VTCompressionSession * session, guint bitrate); VTCompressionSessionRef session, guint bitrate);
static VTStatus gst_vtenc_session_configure_property_int (GstVTEnc * self, static VTStatus gst_vtenc_session_configure_property_int (GstVTEnc * self,
VTCompressionSession * session, CFStringRef name, gint value); VTCompressionSessionRef session, CFStringRef name, gint value);
static VTStatus gst_vtenc_session_configure_property_double (GstVTEnc * self, static VTStatus gst_vtenc_session_configure_property_double (GstVTEnc * self,
VTCompressionSession * session, CFStringRef name, gdouble value); VTCompressionSessionRef session, CFStringRef name, gdouble value);
static GstFlowReturn gst_vtenc_encode_frame (GstVTEnc * self, GstBuffer * buf); static GstFlowReturn gst_vtenc_encode_frame (GstVTEnc * self, GstBuffer * buf);
static VTStatus gst_vtenc_output_buffer (void *data, int a2, int a3, int a4, static VTStatus gst_vtenc_output_buffer (void *data, int a2, int a3, int a4,
@ -327,7 +327,7 @@ gst_vtenc_sink_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstVTEnc *self = GST_VTENC_CAST (GST_PAD_PARENT (pad)); GstVTEnc *self = GST_VTENC_CAST (GST_PAD_PARENT (pad));
GstStructure *structure; GstStructure *structure;
VTCompressionSession *session; VTCompressionSessionRef session;
GST_OBJECT_LOCK (self); GST_OBJECT_LOCK (self);
@ -478,10 +478,10 @@ gst_vtenc_src_event (GstPad * pad, GstEvent * event)
return ret; return ret;
} }
static VTCompressionSession * static VTCompressionSessionRef
gst_vtenc_create_session (GstVTEnc * self) gst_vtenc_create_session (GstVTEnc * self)
{ {
VTCompressionSession *session = NULL; VTCompressionSessionRef session = NULL;
GstCVApi *cv = self->ctx->cv; GstCVApi *cv = self->ctx->cv;
GstVTApi *vt = self->ctx->vt; GstVTApi *vt = self->ctx->vt;
CFMutableDictionaryRef pb_attrs; CFMutableDictionaryRef pb_attrs;
@ -557,7 +557,7 @@ beach:
} }
static void static void
gst_vtenc_destroy_session (GstVTEnc * self, VTCompressionSession ** session) gst_vtenc_destroy_session (GstVTEnc * self, VTCompressionSessionRef * session)
{ {
self->ctx->vt->VTCompressionSessionInvalidate (*session); self->ctx->vt->VTCompressionSessionInvalidate (*session);
self->ctx->vt->VTCompressionSessionRelease (*session); self->ctx->vt->VTCompressionSessionRelease (*session);
@ -568,7 +568,7 @@ typedef struct
{ {
GstVTEnc *self; GstVTEnc *self;
GstVTApi *vt; GstVTApi *vt;
VTCompressionSession *session; VTCompressionSessionRef session;
} GstVTDumpPropCtx; } GstVTDumpPropCtx;
static void static void
@ -609,7 +609,7 @@ gst_vtenc_session_dump_property (CFStringRef prop_name,
static void static void
gst_vtenc_session_dump_properties (GstVTEnc * self, gst_vtenc_session_dump_properties (GstVTEnc * self,
VTCompressionSession * session) VTCompressionSessionRef session)
{ {
GstVTDumpPropCtx dpc = { self, self->ctx->vt, session }; GstVTDumpPropCtx dpc = { self, self->ctx->vt, session };
CFDictionaryRef dict; CFDictionaryRef dict;
@ -631,7 +631,7 @@ error:
static void static void
gst_vtenc_session_configure_usage (GstVTEnc * self, gst_vtenc_session_configure_usage (GstVTEnc * self,
VTCompressionSession * session, gint usage) VTCompressionSessionRef session, gint usage)
{ {
gst_vtenc_session_configure_property_int (self, session, gst_vtenc_session_configure_property_int (self, session,
*(self->ctx->vt->kVTCompressionPropertyKey_Usage), usage); *(self->ctx->vt->kVTCompressionPropertyKey_Usage), usage);
@ -639,7 +639,7 @@ gst_vtenc_session_configure_usage (GstVTEnc * self,
static void static void
gst_vtenc_session_configure_expected_framerate (GstVTEnc * self, gst_vtenc_session_configure_expected_framerate (GstVTEnc * self,
VTCompressionSession * session, gdouble framerate) VTCompressionSessionRef session, gdouble framerate)
{ {
gst_vtenc_session_configure_property_double (self, session, gst_vtenc_session_configure_property_double (self, session,
*(self->ctx->vt->kVTCompressionPropertyKey_ExpectedFrameRate), framerate); *(self->ctx->vt->kVTCompressionPropertyKey_ExpectedFrameRate), framerate);
@ -647,7 +647,7 @@ gst_vtenc_session_configure_expected_framerate (GstVTEnc * self,
static void static void
gst_vtenc_session_configure_expected_duration (GstVTEnc * self, gst_vtenc_session_configure_expected_duration (GstVTEnc * self,
VTCompressionSession * session, gdouble duration) VTCompressionSessionRef session, gdouble duration)
{ {
gst_vtenc_session_configure_property_double (self, session, gst_vtenc_session_configure_property_double (self, session,
*(self->ctx->vt->kVTCompressionPropertyKey_ExpectedDuration), duration); *(self->ctx->vt->kVTCompressionPropertyKey_ExpectedDuration), duration);
@ -655,7 +655,7 @@ gst_vtenc_session_configure_expected_duration (GstVTEnc * self,
static void static void
gst_vtenc_session_configure_max_keyframe_interval (GstVTEnc * self, gst_vtenc_session_configure_max_keyframe_interval (GstVTEnc * self,
VTCompressionSession * session, gint interval) VTCompressionSessionRef session, gint interval)
{ {
gst_vtenc_session_configure_property_int (self, session, gst_vtenc_session_configure_property_int (self, session,
*(self->ctx->vt->kVTCompressionPropertyKey_MaxKeyFrameInterval), *(self->ctx->vt->kVTCompressionPropertyKey_MaxKeyFrameInterval),
@ -664,7 +664,7 @@ gst_vtenc_session_configure_max_keyframe_interval (GstVTEnc * self,
static void static void
gst_vtenc_session_configure_max_keyframe_interval_duration (GstVTEnc * self, gst_vtenc_session_configure_max_keyframe_interval_duration (GstVTEnc * self,
VTCompressionSession * session, gdouble duration) VTCompressionSessionRef session, gdouble duration)
{ {
gst_vtenc_session_configure_property_double (self, session, gst_vtenc_session_configure_property_double (self, session,
*(self->ctx->vt->kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration), *(self->ctx->vt->kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration),
@ -673,7 +673,7 @@ gst_vtenc_session_configure_max_keyframe_interval_duration (GstVTEnc * self,
static void static void
gst_vtenc_session_configure_bitrate (GstVTEnc * self, gst_vtenc_session_configure_bitrate (GstVTEnc * self,
VTCompressionSession * session, guint bitrate) VTCompressionSessionRef session, guint bitrate)
{ {
gst_vtenc_session_configure_property_int (self, session, gst_vtenc_session_configure_property_int (self, session,
*(self->ctx->vt->kVTCompressionPropertyKey_AverageDataRate), bitrate); *(self->ctx->vt->kVTCompressionPropertyKey_AverageDataRate), bitrate);
@ -681,7 +681,7 @@ gst_vtenc_session_configure_bitrate (GstVTEnc * self,
static VTStatus static VTStatus
gst_vtenc_session_configure_property_int (GstVTEnc * self, gst_vtenc_session_configure_property_int (GstVTEnc * self,
VTCompressionSession * session, CFStringRef name, gint value) VTCompressionSessionRef session, CFStringRef name, gint value)
{ {
CFNumberRef num; CFNumberRef num;
VTStatus status; VTStatus status;
@ -699,7 +699,7 @@ gst_vtenc_session_configure_property_int (GstVTEnc * self,
static VTStatus static VTStatus
gst_vtenc_session_configure_property_double (GstVTEnc * self, gst_vtenc_session_configure_property_double (GstVTEnc * self,
VTCompressionSession * session, CFStringRef name, gdouble value) VTCompressionSessionRef session, CFStringRef name, gdouble value)
{ {
CFNumberRef num; CFNumberRef num;
VTStatus status; VTStatus status;
@ -758,7 +758,7 @@ gst_vtenc_encode_frame (GstVTEnc * self, GstBuffer * buf)
gst_vtenc_clear_cached_caps_downstream (self); gst_vtenc_clear_cached_caps_downstream (self);
if (self->reset_on_force_keyframe) { if (self->reset_on_force_keyframe) {
VTCompressionSession *session; VTCompressionSessionRef session;
gst_vtenc_destroy_session (self, &self->session); gst_vtenc_destroy_session (self, &self->session);

View file

@ -74,7 +74,7 @@ struct _GstVTEnc
gint negotiated_fps_n, negotiated_fps_d; gint negotiated_fps_n, negotiated_fps_d;
gint caps_width, caps_height; gint caps_width, caps_height;
gint caps_fps_n, caps_fps_d; gint caps_fps_n, caps_fps_d;
VTCompressionSession * session; VTCompressionSessionRef session;
CFMutableDictionaryRef options; CFMutableDictionaryRef options;
GstBuffer * cur_inbuf; GstBuffer * cur_inbuf;