diff --git a/sys/applemedia/coremediabuffer.c b/sys/applemedia/coremediabuffer.c index 44c101f2d3..216f79e91d 100644 --- a/sys/applemedia/coremediabuffer.c +++ b/sys/applemedia/coremediabuffer.c @@ -34,7 +34,8 @@ gst_core_media_buffer_finalize (GstMiniObject * mini_object) if (self->image_buf != NULL) { GstCVApi *cv = self->ctx->cv; - cv->CVPixelBufferUnlockBaseAddress (self->image_buf, 0); + cv->CVPixelBufferUnlockBaseAddress (self->image_buf, + kCVPixelBufferLock_ReadOnly); } self->ctx->cm->FigSampleBufferRelease (self->sample_buf); g_object_unref (self->ctx); @@ -64,8 +65,10 @@ gst_core_media_buffer_new (GstCoreMediaCtx * ctx, CMSampleBufferRef sample_buf) CFGetTypeID (image_buf) == cv->CVPixelBufferGetTypeID ()) { pixel_buf = (CVPixelBufferRef) image_buf; - if (cv->CVPixelBufferLockBaseAddress (pixel_buf, 0) != kCVReturnSuccess) + if (cv->CVPixelBufferLockBaseAddress (pixel_buf, + kCVPixelBufferLock_ReadOnly) != kCVReturnSuccess) { goto error; + } if (cv->CVPixelBufferIsPlanar (pixel_buf)) { gint plane_count, plane_idx; diff --git a/sys/applemedia/corevideobuffer.c b/sys/applemedia/corevideobuffer.c index 7b90a70660..b605e1ddca 100644 --- a/sys/applemedia/corevideobuffer.c +++ b/sys/applemedia/corevideobuffer.c @@ -33,8 +33,10 @@ gst_core_video_buffer_finalize (GstMiniObject * mini_object) GstCoreVideoBuffer *self = GST_CORE_VIDEO_BUFFER_CAST (mini_object); GstCVApi *cv = self->ctx->cv; - if (self->pixbuf != NULL) - cv->CVPixelBufferUnlockBaseAddress (self->pixbuf, 0); + if (self->pixbuf != NULL) { + cv->CVPixelBufferUnlockBaseAddress (self->pixbuf, + kCVPixelBufferLock_ReadOnly); + } cv->CVBufferRelease (self->cvbuf); @@ -56,8 +58,10 @@ gst_core_video_buffer_new (GstCoreMediaCtx * ctx, CVBufferRef cvbuf) if (CFGetTypeID (cvbuf) == cv->CVPixelBufferGetTypeID ()) { pixbuf = (CVPixelBufferRef) cvbuf; - if (cv->CVPixelBufferLockBaseAddress (pixbuf, 0) != kCVReturnSuccess) + if (cv->CVPixelBufferLockBaseAddress (pixbuf, + kCVPixelBufferLock_ReadOnly) != kCVReturnSuccess) { goto error; + } data = cv->CVPixelBufferGetBaseAddress (pixbuf); size = cv->CVPixelBufferGetBytesPerRow (pixbuf) * cv->CVPixelBufferGetHeight (pixbuf); diff --git a/sys/applemedia/cvapi.h b/sys/applemedia/cvapi.h index 3d99e38ef8..444ded06fb 100644 --- a/sys/applemedia/cvapi.h +++ b/sys/applemedia/cvapi.h @@ -52,6 +52,11 @@ enum _CVPixelFormatType kCVPixelFormatType_422YpCbCr8 = '2vuy' }; +enum _CVPixelBufferLockFlags +{ + kCVPixelBufferLock_ReadOnly = 0x00000001 +}; + struct _GstCVApi { GstDynApi parent;