mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
applemedia: switch vtapi to CFTypeRef style typedefs
This commit is contained in:
parent
2e349576eb
commit
c6b32b42de
5 changed files with 56 additions and 54 deletions
|
@ -31,8 +31,8 @@ typedef enum _VTStatus VTStatus;
|
|||
|
||||
typedef guint32 VTFormatId;
|
||||
|
||||
typedef struct _VTCompressionSession VTCompressionSession;
|
||||
typedef struct _VTDecompressionSession VTDecompressionSession;
|
||||
typedef CFTypeRef VTCompressionSessionRef;
|
||||
typedef CFTypeRef VTDecompressionSessionRef;
|
||||
typedef struct _VTCompressionOutputCallback VTCompressionOutputCallback;
|
||||
typedef struct _VTDecompressionOutputCallback VTDecompressionOutputCallback;
|
||||
|
||||
|
@ -69,48 +69,50 @@ struct _GstVTApi
|
|||
GstDynApi parent;
|
||||
|
||||
VTStatus (* VTCompressionSessionCompleteFrames)
|
||||
(VTCompressionSession * session, CMTime completeUntilDisplayTimestamp);
|
||||
(VTCompressionSessionRef session, CMTime completeUntilDisplayTimestamp);
|
||||
VTStatus (* VTCompressionSessionCopyProperty)
|
||||
(VTCompressionSession * session, CFTypeRef key, void* unk,
|
||||
(VTCompressionSessionRef session, CFTypeRef key, void* unk,
|
||||
CFTypeRef * value);
|
||||
VTStatus (* VTCompressionSessionCopySupportedPropertyDictionary)
|
||||
(VTCompressionSession * session, CFDictionaryRef * dict);
|
||||
(VTCompressionSessionRef session, CFDictionaryRef * dict);
|
||||
VTStatus (* VTCompressionSessionCreate)
|
||||
(CFAllocatorRef allocator, gint width, gint height, VTFormatId formatId,
|
||||
gsize unk1, CFDictionaryRef sourcePixelBufferAttributes, gsize unk2,
|
||||
VTCompressionOutputCallback outputCallback,
|
||||
VTCompressionSession ** session);
|
||||
VTCompressionSessionRef * session);
|
||||
VTStatus (* VTCompressionSessionEncodeFrame)
|
||||
(VTCompressionSession * session, CVPixelBufferRef pixelBuffer,
|
||||
(VTCompressionSessionRef session, CVPixelBufferRef pixelBuffer,
|
||||
CMTime displayTimestamp, CMTime displayDuration,
|
||||
CFDictionaryRef frameOptions, void * sourceTrackingCallback,
|
||||
void * sourceFrameRefCon);
|
||||
void (* VTCompressionSessionInvalidate)
|
||||
(VTCompressionSession * session);
|
||||
(VTCompressionSessionRef session);
|
||||
void (* VTCompressionSessionRelease)
|
||||
(VTCompressionSession * session);
|
||||
VTCompressionSession * (* VTCompressionSessionRetain)
|
||||
(VTCompressionSession * session);
|
||||
(VTCompressionSessionRef session);
|
||||
VTCompressionSessionRef (* VTCompressionSessionRetain)
|
||||
(VTCompressionSessionRef session);
|
||||
VTStatus (* VTCompressionSessionSetProperty)
|
||||
(VTCompressionSession * session, CFStringRef propName,
|
||||
(VTCompressionSessionRef session, CFStringRef propName,
|
||||
CFTypeRef propValue);
|
||||
|
||||
VTStatus (* VTDecompressionSessionCreate)
|
||||
(CFAllocatorRef allocator, CMFormatDescriptionRef videoFormatDescription,
|
||||
CFTypeRef sessionOptions, CFDictionaryRef destinationPixelBufferAttributes,
|
||||
(CFAllocatorRef allocator,
|
||||
CMFormatDescriptionRef videoFormatDescription,
|
||||
CFTypeRef sessionOptions,
|
||||
CFDictionaryRef destinationPixelBufferAttributes,
|
||||
VTDecompressionOutputCallback * outputCallback,
|
||||
VTDecompressionSession ** session);
|
||||
VTDecompressionSessionRef * session);
|
||||
VTStatus (* VTDecompressionSessionDecodeFrame)
|
||||
(VTDecompressionSession * session, CMSampleBufferRef sbuf, gsize unk1,
|
||||
(VTDecompressionSessionRef session, CMSampleBufferRef sbuf, gsize unk1,
|
||||
gsize unk2, gsize unk3);
|
||||
void (* VTDecompressionSessionInvalidate)
|
||||
(VTDecompressionSession * session);
|
||||
(VTDecompressionSessionRef session);
|
||||
void (* VTDecompressionSessionRelease)
|
||||
(VTDecompressionSession * session);
|
||||
VTDecompressionSession * (* VTDecompressionSessionRetain)
|
||||
(VTDecompressionSession * session);
|
||||
(VTDecompressionSessionRef session);
|
||||
VTDecompressionSessionRef (* VTDecompressionSessionRetain)
|
||||
(VTDecompressionSessionRef session);
|
||||
VTStatus (* VTDecompressionSessionWaitForAsynchronousFrames)
|
||||
(VTDecompressionSession * session);
|
||||
(VTDecompressionSessionRef session);
|
||||
|
||||
CFStringRef * kVTCompressionPropertyKey_AllowTemporalCompression;
|
||||
CFStringRef * kVTCompressionPropertyKey_AverageDataRate;
|
||||
|
|
|
@ -40,10 +40,10 @@ static CMFormatDescriptionRef gst_vtdec_create_format_description
|
|||
static CMFormatDescriptionRef
|
||||
gst_vtdec_create_format_description_from_codec_data (GstVTDec * self,
|
||||
GstBuffer * codec_data);
|
||||
static VTDecompressionSession *gst_vtdec_create_session (GstVTDec * self,
|
||||
static VTDecompressionSessionRef gst_vtdec_create_session (GstVTDec * self,
|
||||
CMFormatDescriptionRef fmt_desc);
|
||||
static void gst_vtdec_destroy_session (GstVTDec * self,
|
||||
VTDecompressionSession ** session);
|
||||
VTDecompressionSessionRef * session);
|
||||
static GstFlowReturn gst_vtdec_decode_buffer (GstVTDec * self, GstBuffer * buf);
|
||||
static void gst_vtdec_output_frame (void *data, gsize unk1, VTStatus result,
|
||||
gsize unk2, CVBufferRef cvbuf);
|
||||
|
@ -333,10 +333,10 @@ gst_vtdec_create_format_description_from_codec_data (GstVTDec * self,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static VTDecompressionSession *
|
||||
static VTDecompressionSessionRef
|
||||
gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc)
|
||||
{
|
||||
VTDecompressionSession *session = NULL;
|
||||
VTDecompressionSessionRef session = NULL;
|
||||
GstCVApi *cv = self->ctx->cv;
|
||||
CFMutableDictionaryRef pb_attrs;
|
||||
VTDecompressionOutputCallback callback;
|
||||
|
@ -367,7 +367,7 @@ gst_vtdec_create_session (GstVTDec * self, CMFormatDescriptionRef fmt_desc)
|
|||
}
|
||||
|
||||
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->VTDecompressionSessionRelease (*session);
|
||||
|
|
|
@ -67,7 +67,7 @@ struct _GstVTDec
|
|||
gint caps_width, caps_height;
|
||||
gint caps_fps_n, caps_fps_d;
|
||||
CMFormatDescriptionRef fmt_desc;
|
||||
VTDecompressionSession * session;
|
||||
VTDecompressionSessionRef session;
|
||||
|
||||
GstBuffer * cur_inbuf;
|
||||
GstFlowReturn cur_flowret;
|
||||
|
|
|
@ -54,27 +54,27 @@ static void gst_vtenc_clear_cached_caps_downstream (GstVTEnc * self);
|
|||
static GstFlowReturn gst_vtenc_chain (GstPad * pad, GstBuffer * buf);
|
||||
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,
|
||||
VTCompressionSession ** session);
|
||||
VTCompressionSessionRef * session);
|
||||
static void gst_vtenc_session_dump_properties (GstVTEnc * self,
|
||||
VTCompressionSession * session);
|
||||
VTCompressionSessionRef session);
|
||||
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,
|
||||
VTCompressionSession * session, gdouble framerate);
|
||||
VTCompressionSessionRef session, gdouble framerate);
|
||||
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,
|
||||
VTCompressionSession * session, gint interval);
|
||||
VTCompressionSessionRef session, gint interval);
|
||||
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,
|
||||
VTCompressionSession * session, guint bitrate);
|
||||
VTCompressionSessionRef session, guint bitrate);
|
||||
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,
|
||||
VTCompressionSession * session, CFStringRef name, gdouble value);
|
||||
VTCompressionSessionRef session, CFStringRef name, gdouble value);
|
||||
|
||||
static GstFlowReturn gst_vtenc_encode_frame (GstVTEnc * self, GstBuffer * buf);
|
||||
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));
|
||||
GstStructure *structure;
|
||||
VTCompressionSession *session;
|
||||
VTCompressionSessionRef session;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
||||
|
@ -478,10 +478,10 @@ gst_vtenc_src_event (GstPad * pad, GstEvent * event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static VTCompressionSession *
|
||||
static VTCompressionSessionRef
|
||||
gst_vtenc_create_session (GstVTEnc * self)
|
||||
{
|
||||
VTCompressionSession *session = NULL;
|
||||
VTCompressionSessionRef session = NULL;
|
||||
GstCVApi *cv = self->ctx->cv;
|
||||
GstVTApi *vt = self->ctx->vt;
|
||||
CFMutableDictionaryRef pb_attrs;
|
||||
|
@ -557,7 +557,7 @@ beach:
|
|||
}
|
||||
|
||||
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->VTCompressionSessionRelease (*session);
|
||||
|
@ -568,7 +568,7 @@ typedef struct
|
|||
{
|
||||
GstVTEnc *self;
|
||||
GstVTApi *vt;
|
||||
VTCompressionSession *session;
|
||||
VTCompressionSessionRef session;
|
||||
} GstVTDumpPropCtx;
|
||||
|
||||
static void
|
||||
|
@ -609,7 +609,7 @@ gst_vtenc_session_dump_property (CFStringRef prop_name,
|
|||
|
||||
static void
|
||||
gst_vtenc_session_dump_properties (GstVTEnc * self,
|
||||
VTCompressionSession * session)
|
||||
VTCompressionSessionRef session)
|
||||
{
|
||||
GstVTDumpPropCtx dpc = { self, self->ctx->vt, session };
|
||||
CFDictionaryRef dict;
|
||||
|
@ -631,7 +631,7 @@ error:
|
|||
|
||||
static void
|
||||
gst_vtenc_session_configure_usage (GstVTEnc * self,
|
||||
VTCompressionSession * session, gint usage)
|
||||
VTCompressionSessionRef session, gint usage)
|
||||
{
|
||||
gst_vtenc_session_configure_property_int (self, session,
|
||||
*(self->ctx->vt->kVTCompressionPropertyKey_Usage), usage);
|
||||
|
@ -639,7 +639,7 @@ gst_vtenc_session_configure_usage (GstVTEnc * self,
|
|||
|
||||
static void
|
||||
gst_vtenc_session_configure_expected_framerate (GstVTEnc * self,
|
||||
VTCompressionSession * session, gdouble framerate)
|
||||
VTCompressionSessionRef session, gdouble framerate)
|
||||
{
|
||||
gst_vtenc_session_configure_property_double (self, session,
|
||||
*(self->ctx->vt->kVTCompressionPropertyKey_ExpectedFrameRate), framerate);
|
||||
|
@ -647,7 +647,7 @@ gst_vtenc_session_configure_expected_framerate (GstVTEnc * self,
|
|||
|
||||
static void
|
||||
gst_vtenc_session_configure_expected_duration (GstVTEnc * self,
|
||||
VTCompressionSession * session, gdouble duration)
|
||||
VTCompressionSessionRef session, gdouble duration)
|
||||
{
|
||||
gst_vtenc_session_configure_property_double (self, session,
|
||||
*(self->ctx->vt->kVTCompressionPropertyKey_ExpectedDuration), duration);
|
||||
|
@ -655,7 +655,7 @@ gst_vtenc_session_configure_expected_duration (GstVTEnc * self,
|
|||
|
||||
static void
|
||||
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,
|
||||
*(self->ctx->vt->kVTCompressionPropertyKey_MaxKeyFrameInterval),
|
||||
|
@ -664,7 +664,7 @@ gst_vtenc_session_configure_max_keyframe_interval (GstVTEnc * self,
|
|||
|
||||
static void
|
||||
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,
|
||||
*(self->ctx->vt->kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration),
|
||||
|
@ -673,7 +673,7 @@ gst_vtenc_session_configure_max_keyframe_interval_duration (GstVTEnc * self,
|
|||
|
||||
static void
|
||||
gst_vtenc_session_configure_bitrate (GstVTEnc * self,
|
||||
VTCompressionSession * session, guint bitrate)
|
||||
VTCompressionSessionRef session, guint bitrate)
|
||||
{
|
||||
gst_vtenc_session_configure_property_int (self, session,
|
||||
*(self->ctx->vt->kVTCompressionPropertyKey_AverageDataRate), bitrate);
|
||||
|
@ -681,7 +681,7 @@ gst_vtenc_session_configure_bitrate (GstVTEnc * self,
|
|||
|
||||
static VTStatus
|
||||
gst_vtenc_session_configure_property_int (GstVTEnc * self,
|
||||
VTCompressionSession * session, CFStringRef name, gint value)
|
||||
VTCompressionSessionRef session, CFStringRef name, gint value)
|
||||
{
|
||||
CFNumberRef num;
|
||||
VTStatus status;
|
||||
|
@ -699,7 +699,7 @@ gst_vtenc_session_configure_property_int (GstVTEnc * self,
|
|||
|
||||
static VTStatus
|
||||
gst_vtenc_session_configure_property_double (GstVTEnc * self,
|
||||
VTCompressionSession * session, CFStringRef name, gdouble value)
|
||||
VTCompressionSessionRef session, CFStringRef name, gdouble value)
|
||||
{
|
||||
CFNumberRef num;
|
||||
VTStatus status;
|
||||
|
@ -758,7 +758,7 @@ gst_vtenc_encode_frame (GstVTEnc * self, GstBuffer * buf)
|
|||
gst_vtenc_clear_cached_caps_downstream (self);
|
||||
|
||||
if (self->reset_on_force_keyframe) {
|
||||
VTCompressionSession *session;
|
||||
VTCompressionSessionRef session;
|
||||
|
||||
gst_vtenc_destroy_session (self, &self->session);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ struct _GstVTEnc
|
|||
gint negotiated_fps_n, negotiated_fps_d;
|
||||
gint caps_width, caps_height;
|
||||
gint caps_fps_n, caps_fps_d;
|
||||
VTCompressionSession * session;
|
||||
VTCompressionSessionRef session;
|
||||
CFMutableDictionaryRef options;
|
||||
|
||||
GstBuffer * cur_inbuf;
|
||||
|
|
Loading…
Reference in a new issue