GNOME Bugzilla – Bug 747378
avfvideosrc: orientation property
Last modified: 2018-11-03 13:33:22 UTC
Adding orientation property. According to docs: https://developer.apple.com/library/ios/qa/qa1744/_index.html "Clients may receive physically rotated CVPixelBuffers in their AVCaptureVideoDataOutput -captureOutput:didOutputSampleBuffer:fromConnection: delegate callback. All 4 AVCaptureVideoOrientation modes are supported, and rotation is hardware accelerated."
Created attachment 300991 [details] [review] avfvideosrc: Add orientation property
There's a GstVideoOrientation interface fwiw, and orientation may also be signalled in tags (don't think we have a meta for that yet).
(In reply to Tim-Philipp Müller from comment #2) > There's a GstVideoOrientation interface fwiw I actually did look for one, before introducing mine. GstVideoOrientation deals with hflip, vflip, hcenter, vcenter. Does this somehow represent 90-cw rotation? Also, Apple talks in terms of device orientation, in helpful terms of "portrait" and "landscape", so I'd rather offer this than "int rotation" (or even worse "float rotation" in radians :) cause, like, rotation from what? When someone records from an iPhone and says "Portrait", they understand right away what it means. > and orientation may also be signalled in tags (don't think we have a meta for that yet) I think attaching an orientation tag is a job of a GstElement that polls a position sensor. I think it'll be nice for GStreamer to have one, yes. (Curiously, in the Apple Technical Q&A linked above, they discuss that on AVCaptureMovieFileOutput they don't actually rotate buffers but rather set a transform matrix so the video gets rotated on playback.) In GStreamer, one could theoretically apply a glshader to rotate on playback too, but I just wanted to expose this unique hardware-accelerated feature of rotating the physical video buffer. We can always still use glshader when it serves our pipelines best.
Created attachment 301177 [details] [review] avfvideosrc: Add orientation property Ooops, g_value_set_int -> g_value_set_enum and g_value_get_int -> g_value_get_enum.
Created attachment 301179 [details] [review] avfvideosrc: Add orientation property Follow GStreamer style of enum names corresponding to the in-code names
Or... what's actually better? Either pick attachment 301179 [details] [review] or attachment 301177 [details] [review] (original "documenting" names).
Created attachment 301184 [details] [review] avfvideosrc: factor 'orientation' into caps Use the orientation early on, and also consider it when getting caps.
Created attachment 301188 [details] [review] avfvideosrc: factor 'orientation' into caps Oops, should test before submitting patches. This patch also takes out the [connection setVideoOrientation] out of gotSampleBuffer:... since then it only applies on the next buffer. Instead, change the connection as soon as the property is changed.
Created attachment 301239 [details] [review] avfvideosrc: factor 'orientation' into caps Rebase to apply on git master.
Created attachment 301337 [details] [review] avfvideosrc: Add orientation property Forgot to initialize orientation in init
Created attachment 301338 [details] [review] avfvideosrc: factor 'orientation' into caps Forgot to retain. (We're not using ARC in this file.)
Created attachment 301413 [details] [review] avfvideosrc: factor 'orientation' into caps Final version. Not retaining needed.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/231.