videoaggregator: Add class property to disable caps scaling

Add preserve_update_caps_result boolean on the class to allow
sub-classes to disable videoaggregator removing sizes and framerate
from the update_caps() return result.
This commit is contained in:
Jan Schmidt 2015-05-10 18:55:16 +10:00
parent 70bae08cdd
commit 03aec73bd4
2 changed files with 17 additions and 7 deletions

View file

@ -28,7 +28,7 @@
* biggest incoming video stream and the framerate of the fastest incoming one.
*
* VideoAggregator will do colorspace conversion.
*
*
* Zorder for each input stream can be configured on the
* #GstVideoAggregatorPad.
*
@ -674,6 +674,7 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
GstCaps *caps, *peercaps, *info_caps;
GstStructure *s;
GstVideoInfo info;
int i;
if (GST_VIDEO_INFO_FPS_N (&vagg->info) != best_fps_n ||
GST_VIDEO_INFO_FPS_D (&vagg->info) != best_fps_d) {
@ -711,11 +712,8 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
caps = info_caps;
}
peercaps = gst_pad_peer_query_caps (agg->srcpad, NULL);
if (peercaps) {
GstCaps *tmp;
int i;
/* If the sub-class allows it, allow size/framerate changes */
if (!vagg_klass->preserve_update_caps_result) {
s = gst_caps_get_structure (caps, 0);
gst_structure_get (s, "width", G_TYPE_INT, &best_width, "height",
G_TYPE_INT, &best_height, NULL);
@ -726,6 +724,12 @@ gst_videoaggregator_update_src_caps (GstVideoAggregator * vagg)
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT, "framerate",
GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
}
}
peercaps = gst_pad_peer_query_caps (agg->srcpad, caps);
if (peercaps) {
GstCaps *tmp;
tmp = gst_caps_intersect (caps, peercaps);
GST_DEBUG_OBJECT (vagg, "intersecting %" GST_PTR_FORMAT

View file

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_VIDEO_AGGREGATOR_H__
#define __GST_VIDEO_AGGREGATOR_H__
@ -86,6 +86,9 @@ struct _GstVideoAggregator
* Notifies subclasses what caps format has been negotiated
* @find_best_format: Optional.
* Lets subclasses decide of the best common format to use.
* @preserve_update_caps_result: Sub-classes should set this to true if the return result
* of the update_caps() method should not be further modified
* by GstVideoAggregator by removing fields.
**/
struct _GstVideoAggregatorClass
{
@ -105,6 +108,9 @@ struct _GstVideoAggregatorClass
GstCaps * downstream_caps,
GstVideoInfo * best_info,
gboolean * at_least_one_alpha);
gboolean preserve_update_caps_result;
/* < private > */
gpointer _gst_reserved[GST_PADDING_LARGE];
};