GNOME Bugzilla – Bug 711211
avfvideosrc: use input device formats to set/get caps instead of session presets
Last modified: 2014-05-04 10:25:37 UTC
Use input device formats to set/get caps instead of session presets. This has the benefit to report acurately supported capture resolution and framerates.
Created attachment 258644 [details] [review] [PATCH 1/2] avfvideosrc: use input device formats to set/get caps instead of session presets
Created attachment 258645 [details] [review] [PATCH 2/2] avfvideosrc: minor cosmetic
Created attachment 258929 [details] [review] [PATCH 1/2] avfvideosrc: use input device formats to set/get caps instead of session presets Warn user if caps cannot be set and return correct value in set_caps function.
Review of attachment 258929 [details] [review]: ::: sys/applemedia/avfvideosrc.m @@ +351,3 @@ + found_framerate = TRUE; + device.activeVideoMinFrameDuration = rate.minFrameDuration; + device.activeVideoMaxFrameDuration = rate.maxFrameDuration; This API is only available in OS X 10.9 and IOS 7.0, so you should these property using key-value coding [1] either with try catch or with runtime detection of the current version [2] [1] https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/Protocols/NSKeyValueCoding_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/setValue:forKey: [2] https://developer.apple.com/library/mac/documentation/developertools/conceptual/cross_development/Using/using.html
The combination of possible height/width does not match the template anymore and the number is them is big enough to start using ranges in the pad template for width and height.
Review of attachment 258929 [details] [review]: ::: sys/applemedia/avfvideosrc.m @@ +309,3 @@ + } + + gst_caps_append (result, GST_AVF_CAPS_NEW (gstformat, dimensions.width, dimensions.height, fps_n, fps_d)); Ideally we should try to priporitize the format with the highest resolution (instead of the smallest like it happens now).
(In reply to comment #4) > Review of attachment 258929 [details] [review]: > > ::: sys/applemedia/avfvideosrc.m > @@ +351,3 @@ > + found_framerate = TRUE; > + device.activeVideoMinFrameDuration = rate.minFrameDuration; > + device.activeVideoMaxFrameDuration = rate.maxFrameDuration; > > This API is only available in OS X 10.9 and IOS 7.0, so you should these > property using key-value coding [1] either with try catch or with runtime > detection of the current version [2] The whole API using device formats and activeFormat is available from OS X 10.7 (according to the documentation) and from IOS 7.0. So if we want to support iOS < 7.0 we need to keep the old code using the session presets. The question is, do we want to support other version of IOS other than 7.0 ? considering the maintenance burden of having both code path. > > [1] > https://developer.apple.com/library/mac/documentation/cocoa/reference/foundation/Protocols/NSKeyValueCoding_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/setValue:forKey: > > [2] > https://developer.apple.com/library/mac/documentation/developertools/conceptual/cross_development/Using/using.html Thanks for the helpful links.
(In reply to comment #8) > (In reply to comment #4) > > Review of attachment 258929 [details] [review] [details]: > > > > ::: sys/applemedia/avfvideosrc.m > > @@ +351,3 @@ > > + found_framerate = TRUE; > > + device.activeVideoMinFrameDuration = rate.minFrameDuration; > > + device.activeVideoMaxFrameDuration = rate.maxFrameDuration; > > > > This API is only available in OS X 10.9 and IOS 7.0, so you should these > > property using key-value coding [1] either with try catch or with runtime > > detection of the current version [2] > > The whole API using device formats and activeFormat is available from OS X 10.7 In OS X we only care about >= 10.7 for this element, the property that's only available from 10.9 is activeVideoMaxFrameDuration. > (according to the documentation) and from IOS 7.0. So if we want to support iOS > < 7.0 we need to keep the old code using the session presets. For iOS we should try to support as much versions of the SDK as we can. We only need to have 2 different code paths for setCaps and getCaps here and if possible do it at runtime rather than at compile time with __IPHONE_OS_VERSION_MIN_REQUIRED
Created attachment 259079 [details] [review] avfvideosrc: use input device formats to set/get caps if available
commit 752d74b31f2eee5912d3659fee60315e64d3e156 Author: Matthieu Bouron <matthieu.bouron@collabora.com> Date: Thu Oct 31 13:03:58 2013 +0000 avfvideosrc: use input device formats to set/get caps if available https://bugzilla.gnome.org/show_bug.cgi?id=711211