GNOME Bugzilla – Bug 727885
coremediabuffer: handle stride alignment
Last modified: 2014-04-24 10:29:02 UTC
This following patch make the coremedia buffers handle the stride alignment of the CVPixel buffers through the use of the video meta API. It is based on the corevideobuffer code. Properly handle the stride alignment is required by iosavassetsrc (which i'm currently porting to 1.0). It changes the API of coremediabuffer, so an element can decide wether or not to use the video meta API (according to downstream capabilities). GstBuffer * gst_core_media_buffer_new (CMSampleBufferRef sample_buf); -> GstBuffer * gst_core_media_buffer_new (CMSampleBufferRef sample_buf, gboolean use_video_meta); Also, If the video meta API is not used and the cv pixel buffer contains padding, the core media buffer frame is copied to a SYSMEM buffer frame, thus removing the padding. In this case a regular GstBuffer is returned by the function (not a GstCoreMediaBuffer). This fallback method can be provided as a separate public function so it is the element responsability of removing the padding. In this case the gst_core_media_buffer_new method must return somehow the fact that the underlying buffer contains padding to avoid an unnecessary copy. Note: this is work in progress, every element using coremedia buffers (vtenc, avfvideosrc) won't compile. What do you think ?
Created attachment 273876 [details] [review] WIP coremediabuffer: handle stride alignment
Review of attachment 273876 [details] [review]: Looks good for now ::: sys/applemedia/coremediabuffer.c @@ -112,0 +123,58 @@ + + n_planes = 1; + stride[0] = CVPixelBufferGetBytesPerRow (pixel_buf); ... 55 more ... I think you can use NULL for the allocator and it will use the default allocator
Review of attachment 273876 [details] [review]: ::: sys/applemedia/coremediabuffer.c @@ -85,1 +100,1 @@ - if (CVPixelBufferLockBaseAddress (pixel_buf, + has_padding = FALSE; *has_padding = FALSE; Fixed locally.
Created attachment 274343 [details] [review] coremediabuffer: handle stride alignment
commit e728ee820868518a717342d4bc6b00d1f01b33b0 Author: Matthieu Bouron <matthieu.bouron@collabora.com> Date: Wed Apr 9 10:55:03 2014 +0100 coremediabuffer: handle stride alignment Handle stride alignment through the use of the video meta API. The code is based on the corevideobuffer implementation. If the video meta API is not supported and the underlying buffer contains padding, the core media buffer is copied to a system memory buffer. https://bugzilla.gnome.org/show_bug.cgi?id=727885