From c6572df9ff0b1e54b3ac904a8daea0a3a679f8cc Mon Sep 17 00:00:00 2001 From: Matthieu Bouron Date: Wed, 9 Apr 2014 11:47:12 +0100 Subject: [PATCH] avfvideosrc: check if downstream supports the video meta API Check if downstream supports the video meta API, so we can use it later with the core media buffers. https://bugzilla.gnome.org/show_bug.cgi?id=727953 --- sys/applemedia/avfvideosrc.m | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/applemedia/avfvideosrc.m b/sys/applemedia/avfvideosrc.m index 83cd9dbeca..bd911f9068 100644 --- a/sys/applemedia/avfvideosrc.m +++ b/sys/applemedia/avfvideosrc.m @@ -103,6 +103,8 @@ G_DEFINE_TYPE (GstAVFVideoSrc, gst_avf_video_src, GST_TYPE_PUSH_SRC); BOOL captureScreen; BOOL captureScreenCursor; BOOL captureScreenMouseClicks; + + BOOL useVideoMeta; } - (id)init; @@ -163,6 +165,7 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer captureScreen = NO; captureScreenCursor = NO; captureScreenMouseClicks = NO; + useVideoMeta = NO; #if !HAVE_IOS displayId = kCGDirectMainDisplay; #endif @@ -705,6 +708,14 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer return result; } +- (BOOL)decideAllocation:(GstQuery *)query +{ + useVideoMeta = gst_query_find_allocation_meta (query, + GST_VIDEO_META_API_TYPE, NULL); + + return YES; +} + - (BOOL)unlock { [bufQueueLock lock]; @@ -911,6 +922,8 @@ static gboolean gst_avf_video_src_start (GstBaseSrc * basesrc); static gboolean gst_avf_video_src_stop (GstBaseSrc * basesrc); static gboolean gst_avf_video_src_query (GstBaseSrc * basesrc, GstQuery * query); +static gboolean gst_avf_video_src_decide_allocation (GstBaseSrc * basesrc, + GstQuery * query); static gboolean gst_avf_video_src_unlock (GstBaseSrc * basesrc); static gboolean gst_avf_video_src_unlock_stop (GstBaseSrc * basesrc); static GstFlowReturn gst_avf_video_src_create (GstPushSrc * pushsrc, @@ -938,6 +951,7 @@ gst_avf_video_src_class_init (GstAVFVideoSrcClass * klass) gstbasesrc_class->query = gst_avf_video_src_query; gstbasesrc_class->unlock = gst_avf_video_src_unlock; gstbasesrc_class->unlock_stop = gst_avf_video_src_unlock_stop; + gstbasesrc_class->decide_allocation = gst_avf_video_src_decide_allocation; gstpushsrc_class->create = gst_avf_video_src_create; @@ -1144,6 +1158,18 @@ gst_avf_video_src_query (GstBaseSrc * basesrc, GstQuery * query) return ret; } +static gboolean +gst_avf_video_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) +{ + gboolean ret; + + OBJC_CALLOUT_BEGIN (); + ret = [GST_AVF_VIDEO_SRC_IMPL (basesrc) decideAllocation:query]; + OBJC_CALLOUT_END (); + + return ret; +} + static gboolean gst_avf_video_src_unlock (GstBaseSrc * basesrc) {