From b57f255f26e8f8cb337b0049b0a96ab1f3f1037f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 19 Oct 2014 14:51:40 +0200 Subject: [PATCH] vtenc: VTCompressionSessionPrepareToEncodeFrames only exists since 10.9.6 Check with configure for it instead of using one of the availability macros as those wouldn't work as expected with minor versions. --- configure.ac | 10 ++++++++++ sys/applemedia/vtenc.c | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index c305646..af0435a 100644 --- a/configure.ac +++ b/configure.ac @@ -504,6 +504,16 @@ AC_CHECK_HEADER(AVFoundation/AVFoundation.h, HAVE_AVFOUNDATION="yes", HAVE_AVFOU AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, HAVE_IOS="yes", HAVE_IOS="no", [-]) AC_CHECK_HEADER(VideoToolbox/VideoToolbox.h, HAVE_VIDEOTOOLBOX="yes", HAVE_VIDEOTOOLBOX="no", [-]) +if test "x$HAVE_VIDEOTOOLBOX" = "xyes"; then + old_LIBS=$LIBS + LIBS="$LIBS -framework VideoToolbox" + AC_CHECK_FUNC(VTCompressionSessionPrepareToEncodeFrames, [ + AC_DEFINE(HAVE_VIDEOTOOLBOX_10_9_6, 1, [Define if building with VideoToolbox >= 10.9.6]) + ], [ + ]) + LIBS=$old_LIBS +fi + AM_CONDITIONAL(HAVE_AVFOUNDATION, test "x$HAVE_AVFOUNDATION" = "xyes") if test "x$HAVE_AVFOUNDATION" = "xyes"; then AC_DEFINE(HAVE_AVFOUNDATION, 1, [Define if building with AVFoundation]) diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c index 40eb4a2..13c9412 100644 --- a/sys/applemedia/vtenc.c +++ b/sys/applemedia/vtenc.c @@ -492,12 +492,16 @@ gst_vtenc_create_session (GstVTEnc * self) gst_vtenc_session_configure_bitrate (self, session, gst_vtenc_get_bitrate (self)); - status = VTCompressionSessionPrepareToEncodeFrames (session); - if (status != noErr) { - GST_ERROR_OBJECT (self, - "VTCompressionSessionPrepareToEncodeFrames() returned: %d", - (int) status); +#ifdef HAVE_VIDEOTOOLBOX_10_9_6 + if (VTCompressionSessionPrepareToEncodeFrames) { + status = VTCompressionSessionPrepareToEncodeFrames (session); + if (status != noErr) { + GST_ERROR_OBJECT (self, + "VTCompressionSessionPrepareToEncodeFrames() returned: %d", + (int) status); + } } +#endif beach: CFRelease (pb_attrs); -- 2.7.4