After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 711211 - avfvideosrc: use input device formats to set/get caps instead of session presets
avfvideosrc: use input device formats to set/get caps instead of session presets
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 709174
Blocks: 711432
 
 
Reported: 2013-10-31 13:51 UTC by Matthieu Bouron
Modified: 2014-05-04 10:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH 1/2] avfvideosrc: use input device formats to set/get caps instead of session presets (6.42 KB, patch)
2013-10-31 13:53 UTC, Matthieu Bouron
none Details | Review
[PATCH 2/2] avfvideosrc: minor cosmetic (1.02 KB, patch)
2013-10-31 13:53 UTC, Matthieu Bouron
committed Details | Review
[PATCH 1/2] avfvideosrc: use input device formats to set/get caps instead of session presets (7.65 KB, patch)
2013-11-04 14:13 UTC, Matthieu Bouron
none Details | Review
avfvideosrc: use input device formats to set/get caps if available (14.43 KB, patch)
2013-11-06 14:04 UTC, Matthieu Bouron
committed Details | Review

Description Matthieu Bouron 2013-10-31 13:51: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.
Comment 1 Matthieu Bouron 2013-10-31 13:53:21 UTC
Created attachment 258644 [details] [review]
[PATCH 1/2] avfvideosrc: use input device formats to set/get caps instead of session presets
Comment 2 Matthieu Bouron 2013-10-31 13:53:46 UTC
Created attachment 258645 [details] [review]
[PATCH 2/2] avfvideosrc: minor cosmetic
Comment 3 Matthieu Bouron 2013-11-04 14:13:31 UTC
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.
Comment 4 Andoni Morales 2013-11-05 16:00:35 UTC
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
Comment 5 Andoni Morales 2013-11-05 16:01:42 UTC
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.
Comment 6 Andoni Morales 2013-11-05 16:18:41 UTC
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).
Comment 7 Andoni Morales 2013-11-05 16:18:43 UTC
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).
Comment 8 Matthieu Bouron 2013-11-05 16:44:33 UTC
(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.
Comment 9 Andoni Morales 2013-11-05 17:33:12 UTC
(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
Comment 10 Matthieu Bouron 2013-11-06 14:04:07 UTC
Created attachment 259079 [details] [review]
avfvideosrc: use input device formats to set/get caps if available
Comment 11 Andoni Morales 2013-11-07 14:33:10 UTC
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