From bc7dbd7b51411753ac1acc5ac61f67fd8ba069bb Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Tue, 11 Nov 2014 18:01:54 +0100 Subject: [PATCH] vtenc: enable the hw encoder on OSX --- sys/applemedia/vtenc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c index b5ae4ae..e02c182 100644 --- a/sys/applemedia/vtenc.c +++ b/sys/applemedia/vtenc.c @@ -520,9 +520,15 @@ static VTCompressionSessionRef gst_vtenc_create_session (GstVTEnc * self) { VTCompressionSessionRef session = NULL; - CFMutableDictionaryRef pb_attrs; + CFMutableDictionaryRef encoder_spec, pb_attrs; OSStatus status; + encoder_spec = + CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + gst_vtutil_dict_set_boolean (encoder_spec, + kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, true); + pb_attrs = CFDictionaryCreateMutable (NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); gst_vtutil_dict_set_i32 (pb_attrs, kCVPixelBufferWidthKey, @@ -532,8 +538,8 @@ gst_vtenc_create_session (GstVTEnc * self) status = VTCompressionSessionCreate (NULL, self->negotiated_width, self->negotiated_height, - self->details->format_id, NULL, pb_attrs, NULL, gst_vtenc_enqueue_buffer, - self, &session); + self->details->format_id, encoder_spec, pb_attrs, NULL, + gst_vtenc_enqueue_buffer, self, &session); GST_INFO_OBJECT (self, "VTCompressionSessionCreate for %d x %d => %d", self->negotiated_width, self->negotiated_height, (int) status); if (status != noErr) { @@ -587,6 +593,7 @@ gst_vtenc_create_session (GstVTEnc * self) #endif beach: + CFRelease (encoder_spec); CFRelease (pb_attrs); return session; -- 2.7.4