Commit 86a4771f authored by Wim Taymans's avatar Wim Taymans

remove buffer_alloc

parent 4dab93ed
......@@ -588,8 +588,6 @@ gst_visual_src_query (GstPad * pad, GstQuery * query)
static GstFlowReturn
get_buffer (GstVisual * visual, GstBuffer ** outbuf)
{
GstFlowReturn ret;
/* we don't know an output format yet, pick one */
if (GST_PAD_CAPS (visual->srcpad) == NULL) {
if (!gst_vis_src_negotiate (visual))
......@@ -599,17 +597,8 @@ get_buffer (GstVisual * visual, GstBuffer ** outbuf)
GST_DEBUG_OBJECT (visual, "allocating output buffer with caps %"
GST_PTR_FORMAT, GST_PAD_CAPS (visual->srcpad));
/* now allocate a buffer with the last negotiated format.
* Downstream could renegotiate a new format, which will trigger
* our setcaps function on the source pad. */
ret =
gst_pad_alloc_buffer_and_set_caps (visual->srcpad,
GST_BUFFER_OFFSET_NONE, visual->outsize,
GST_PAD_CAPS (visual->srcpad), outbuf);
/* no buffer allocated, we don't care why. */
if (ret != GST_FLOW_OK)
return ret;
*outbuf = gst_buffer_new_and_alloc (visual->outsize);
gst_buffer_set_caps (*outbuf, GST_PAD_CAPS (visual->srcpad));
return GST_FLOW_OK;
}
......
......@@ -331,8 +331,6 @@ static gboolean gst_base_text_overlay_video_event (GstPad * pad,
GstEvent * event);
static GstFlowReturn gst_base_text_overlay_video_chain (GstPad * pad,
GstBuffer * buffer);
static GstFlowReturn gst_base_text_overlay_video_bufferalloc (GstPad * pad,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buffer);
static gboolean gst_base_text_overlay_text_event (GstPad * pad,
GstEvent * event);
......@@ -622,8 +620,6 @@ gst_base_text_overlay_init (GstBaseTextOverlay * overlay,
GST_DEBUG_FUNCPTR (gst_base_text_overlay_video_event));
gst_pad_set_chain_function (overlay->video_sinkpad,
GST_DEBUG_FUNCPTR (gst_base_text_overlay_video_chain));
gst_pad_set_bufferalloc_function (overlay->video_sinkpad,
GST_DEBUG_FUNCPTR (gst_base_text_overlay_video_bufferalloc));
gst_element_add_pad (GST_ELEMENT (overlay), overlay->video_sinkpad);
template =
......@@ -2270,28 +2266,6 @@ gst_base_text_overlay_video_event (GstPad * pad, GstEvent * event)
return ret;
}
static GstFlowReturn
gst_base_text_overlay_video_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buffer)
{
GstBaseTextOverlay *overlay =
GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
GstFlowReturn ret = GST_FLOW_WRONG_STATE;
GstPad *allocpad;
GST_OBJECT_LOCK (overlay);
allocpad = overlay->srcpad ? gst_object_ref (overlay->srcpad) : NULL;
GST_OBJECT_UNLOCK (overlay);
if (allocpad) {
ret = gst_pad_alloc_buffer (allocpad, offset, size, caps, buffer);
gst_object_unref (allocpad);
}
gst_object_unref (overlay);
return ret;
}
/* Called with lock held */
static void
gst_base_text_overlay_pop_text (GstBaseTextOverlay * overlay)
......
......@@ -505,12 +505,8 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
}
GST_DEBUG ("Allocating buffer WxH = %dx%d", render->width, render->height);
ret =
gst_pad_alloc_buffer_and_set_caps (render->srcpad, GST_BUFFER_OFFSET_NONE,
render->width * render->height * 4, caps, &outbuf);
if (ret != GST_FLOW_OK)
goto done;
outbuf = gst_buffer_new_and_alloc (render->width * render->height * 4);
gst_buffer_set_caps (outbuf, caps);
gst_buffer_copy_into (outbuf, inbuf, GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
data = gst_buffer_map (outbuf, &size, NULL, GST_MAP_WRITE);
......
......@@ -1043,12 +1043,12 @@ static GstFlowReturn
theora_handle_image (GstTheoraDec * dec, th_ycbcr_buffer buf, GstBuffer ** out)
{
gint width, height, stride;
GstFlowReturn result;
int i, plane;
GstVideoFormat format;
guint8 *dest, *src;
gsize size;
guint8 *data;
guint vsize;
switch (dec->info.pixel_fmt) {
case TH_PF_444:
......@@ -1064,15 +1064,9 @@ theora_handle_image (GstTheoraDec * dec, th_ycbcr_buffer buf, GstBuffer ** out)
g_assert_not_reached ();
}
result =
gst_pad_alloc_buffer_and_set_caps (dec->srcpad, GST_BUFFER_OFFSET_NONE,
gst_video_format_get_size (format, dec->width, dec->height),
GST_PAD_CAPS (dec->srcpad), out);
if (G_UNLIKELY (result != GST_FLOW_OK)) {
GST_DEBUG_OBJECT (dec, "could not get buffer, reason: %s",
gst_flow_get_name (result));
return result;
}
vsize = gst_video_format_get_size (format, dec->width, dec->height);
*out = gst_buffer_new_and_alloc (vsize);
gst_buffer_set_caps (*out, GST_PAD_CAPS (dec->srcpad));
data = gst_buffer_map (*out, &size, NULL, GST_MAP_WRITE);
......
......@@ -913,11 +913,8 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
size);
/* alloc buffer for it */
result =
gst_pad_alloc_buffer_and_set_caps (vd->srcpad, GST_BUFFER_OFFSET_NONE,
size, GST_PAD_CAPS (vd->srcpad), &out);
if (G_UNLIKELY (result != GST_FLOW_OK))
goto done;
out = gst_buffer_new_and_alloc (size);
gst_buffer_set_caps (out, GST_PAD_CAPS (vd->srcpad));
/* get samples ready for reading now, should be sample_count */
#ifdef USE_TREMOLO
......
......@@ -820,15 +820,9 @@ gst_audio_resample_push_drain (GstAudioResample * resample, guint history_len)
if (out_len == 0)
return;
res =
gst_pad_alloc_buffer_and_set_caps (GST_BASE_TRANSFORM_SRC_PAD (resample),
GST_BUFFER_OFFSET_NONE, outsize,
GST_PAD_CAPS (GST_BASE_TRANSFORM_SRC_PAD (resample)), &outbuf);
if (G_UNLIKELY (res != GST_FLOW_OK)) {
GST_WARNING_OBJECT (resample, "failed allocating buffer of %d bytes",
outsize);
return;
}
outbuf = gst_buffer_new_and_alloc (outsize);
gst_buffer_set_caps (outbuf,
GST_PAD_CAPS (GST_BASE_TRANSFORM_SRC_PAD (resample)));
data = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE);
......
......@@ -1021,7 +1021,6 @@ static GstFlowReturn
gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
guint length, GstBuffer ** buffer)
{
GstFlowReturn res;
GstAudioTestSrc *src;
GstBuffer *buf;
GstClockTime next_time;
......@@ -1092,10 +1091,8 @@ gst_audio_test_src_create (GstBaseSrc * basesrc, guint64 offset,
bytes = src->generate_samples_per_buffer * src->sample_size * src->channels;
if ((res = gst_pad_alloc_buffer (basesrc->srcpad, src->next_sample,
bytes, GST_PAD_CAPS (basesrc->srcpad), &buf)) != GST_FLOW_OK) {
return res;
}
buf = gst_buffer_new_and_alloc (bytes);
gst_buffer_set_caps (buf, GST_PAD_CAPS (basesrc->srcpad));
next_byte = src->next_byte + (src->reverse ? (-bytes) : bytes);
next_time = gst_util_uint64_scale_int (next_sample, GST_SECOND,
......
......@@ -103,8 +103,6 @@ static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
enum
{
......@@ -312,48 +310,6 @@ gst_selector_pad_getcaps (GstPad * pad)
return caps;
}
static GstFlowReturn
gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf)
{
GstStreamSelector *sel;
GstFlowReturn result;
GstPad *active_sinkpad;
sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
active_sinkpad = gst_stream_selector_activate_sinkpad (sel, pad);
/* Fallback allocation for buffers from pads except the selected one */
if (pad != active_sinkpad) {
GST_DEBUG_OBJECT (sel,
"Pad %s:%s is not selected. Performing fallback allocation",
GST_DEBUG_PAD_NAME (pad));
*buf = NULL;
result = GST_FLOW_OK;
} else {
result = gst_pad_alloc_buffer (sel->srcpad, offset, size, caps, buf);
/* FIXME: HACK. If buffer alloc returns not-linked, perform a fallback
* allocation. This should NOT be necessary, because playbin should
* properly block the source pad from running until it's finished hooking
* everything up, but playbin needs refactoring first. */
if (result == GST_FLOW_NOT_LINKED) {
GST_DEBUG_OBJECT (sel,
"No peer pad yet - performing fallback allocation for pad %s:%s",
GST_DEBUG_PAD_NAME (pad));
*buf = NULL;
result = GST_FLOW_OK;
}
}
gst_object_unref (sel);
return result;
}
static GstFlowReturn
gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
{
......@@ -719,8 +675,6 @@ gst_stream_selector_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
gst_pad_set_iterate_internal_links_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_selector_pad_iterate_linked_pads));
gst_pad_set_bufferalloc_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_bufferalloc));
gst_pad_set_active (sinkpad, TRUE);
gst_element_add_pad (GST_ELEMENT (sel), sinkpad);
......
......@@ -550,26 +550,6 @@ done:
return ret;
}
static GstFlowReturn
gst_stream_synchronizer_sink_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf)
{
GstPad *opad;
GstFlowReturn ret = GST_FLOW_ERROR;
GST_LOG_OBJECT (pad, "Allocating buffer: size=%u", size);
opad = gst_stream_get_other_pad_from_pad (pad);
if (opad) {
ret = gst_pad_alloc_buffer (opad, offset, size, caps, buf);
gst_object_unref (opad);
}
GST_LOG_OBJECT (pad, "Allocation: %s", gst_flow_get_name (ret));
return ret;
}
static GstFlowReturn
gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
{
......@@ -727,8 +707,6 @@ gst_stream_synchronizer_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_event));
gst_pad_set_chain_function (stream->sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_chain));
gst_pad_set_bufferalloc_function (stream->sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_bufferalloc));
tmp = g_strdup_printf ("src_%d", self->current_stream_number);
stream->srcpad = gst_pad_new_from_static_template (&srctemplate, tmp);
......
......@@ -2099,7 +2099,6 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self)
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_getcaps));
gst_pad_set_acceptcaps_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_acceptcaps));
gst_pad_set_bufferalloc_function (self->subtitle_sinkpad, NULL);
proxypad = NULL;
it = gst_pad_iterate_internal_links (self->subtitle_sinkpad);
......
......@@ -1483,37 +1483,34 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
guint subtitle_len = strlen (subtitle);
/* +1 for terminating NUL character */
ret = gst_pad_alloc_buffer_and_set_caps (self->srcpad,
GST_BUFFER_OFFSET_NONE, subtitle_len + 1,
GST_PAD_CAPS (self->srcpad), &buf);
if (ret == GST_FLOW_OK) {
/* copy terminating NUL character as well */
gst_buffer_fill (buf, 0, subtitle, subtitle_len + 1);
gst_buffer_set_size (buf, subtitle_len);
GST_BUFFER_TIMESTAMP (buf) = self->state.start_time;
GST_BUFFER_DURATION (buf) = self->state.duration;
/* in some cases (e.g. tmplayer) we can only determine the duration
* of a text chunk from the timestamp of the next text chunk; in those
* cases, we probably want to limit the duration to something
* reasonable, so we don't end up showing some text for e.g. 40 seconds
* just because nothing else is being said during that time */
if (self->state.max_duration > 0 && GST_BUFFER_DURATION_IS_VALID (buf)) {
if (GST_BUFFER_DURATION (buf) > self->state.max_duration)
GST_BUFFER_DURATION (buf) = self->state.max_duration;
}
buf = gst_buffer_new_and_alloc (subtitle_len + 1);
gst_buffer_set_caps (buf, GST_PAD_CAPS (self->srcpad));
/* copy terminating NUL character as well */
gst_buffer_fill (buf, 0, subtitle, subtitle_len + 1);
gst_buffer_set_size (buf, subtitle_len);
GST_BUFFER_TIMESTAMP (buf) = self->state.start_time;
GST_BUFFER_DURATION (buf) = self->state.duration;
/* in some cases (e.g. tmplayer) we can only determine the duration
* of a text chunk from the timestamp of the next text chunk; in those
* cases, we probably want to limit the duration to something
* reasonable, so we don't end up showing some text for e.g. 40 seconds
* just because nothing else is being said during that time */
if (self->state.max_duration > 0 && GST_BUFFER_DURATION_IS_VALID (buf)) {
if (GST_BUFFER_DURATION (buf) > self->state.max_duration)
GST_BUFFER_DURATION (buf) = self->state.max_duration;
}
gst_segment_set_last_stop (&self->segment, GST_FORMAT_TIME,
self->state.start_time);
gst_segment_set_last_stop (&self->segment, GST_FORMAT_TIME,
self->state.start_time);
GST_DEBUG_OBJECT (self, "Sending text '%s', %" GST_TIME_FORMAT " + %"
GST_TIME_FORMAT, subtitle, GST_TIME_ARGS (self->state.start_time),
GST_TIME_ARGS (self->state.duration));
GST_DEBUG_OBJECT (self, "Sending text '%s', %" GST_TIME_FORMAT " + %"
GST_TIME_FORMAT, subtitle, GST_TIME_ARGS (self->state.start_time),
GST_TIME_ARGS (self->state.duration));
ret = gst_pad_push (self->srcpad, buf);
}
ret = gst_pad_push (self->srcpad, buf);
/* move this forward (the tmplayer parser needs this) */
if (self->state.duration != GST_CLOCK_TIME_NONE)
......
......@@ -1341,188 +1341,6 @@ gst_ximagesink_event (GstBaseSink * sink, GstEvent * event)
return TRUE;
}
/* Buffer management
*
* The buffer_alloc function must either return a buffer with given size and
* caps or create a buffer with different caps attached to the buffer. This
* last option is called reverse negotiation, ie, where the sink suggests a
* different format from the upstream peer.
*
* We try to do reverse negotiation when our geometry changes and we like a
* resized buffer.
*/
static GstFlowReturn
gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
{
GstXImageSink *ximagesink;
GstBuffer *ximage = NULL;
GstStructure *structure = NULL;
GstFlowReturn ret = GST_FLOW_OK;
GstCaps *alloc_caps;
gboolean alloc_unref = FALSE;
gint width, height;
GstVideoRectangle dst, src, result;
gboolean caps_accepted = FALSE;
ximagesink = GST_XIMAGESINK (bsink);
if (G_UNLIKELY (!caps)) {
GST_WARNING_OBJECT (ximagesink, "have no caps, doing fallback allocation");
*buf = NULL;
ret = GST_FLOW_OK;
goto beach;
}
/* This shouldn't really happen because state changes will fail
* if the xcontext can't be allocated */
if (!ximagesink->xcontext)
return GST_FLOW_ERROR;
GST_LOG_OBJECT (ximagesink,
"a buffer of %d bytes was requested with caps %" GST_PTR_FORMAT
" and offset %" G_GUINT64_FORMAT, size, caps, offset);
/* assume we're going to alloc what was requested, keep track of
* wheter we need to unref or not. When we suggest a new format
* upstream we will create a new caps that we need to unref. */
alloc_caps = caps;
alloc_unref = FALSE;
/* get struct to see what is requested */
structure = gst_caps_get_structure (caps, 0);
if (!gst_structure_get_int (structure, "width", &width) ||
!gst_structure_get_int (structure, "height", &height)) {
GST_WARNING_OBJECT (ximagesink, "invalid caps for buffer allocation %"
GST_PTR_FORMAT, caps);
ret = GST_FLOW_NOT_NEGOTIATED;
goto beach;
}
src.w = width;
src.h = height;
/* We take the flow_lock because the window might go away */
g_mutex_lock (ximagesink->flow_lock);
if (!ximagesink->xwindow) {
g_mutex_unlock (ximagesink->flow_lock);
goto alloc;
}
/* What is our geometry */
dst.w = ximagesink->xwindow->width;
dst.h = ximagesink->xwindow->height;
g_mutex_unlock (ximagesink->flow_lock);
if (ximagesink->keep_aspect) {
GST_LOG_OBJECT (ximagesink, "enforcing aspect ratio in reverse caps "
"negotiation");
gst_video_sink_center_rect (src, dst, &result, TRUE);
} else {
GST_LOG_OBJECT (ximagesink, "trying to resize to window geometry "
"ignoring aspect ratio");
result.x = result.y = 0;
result.w = dst.w;
result.h = dst.h;
}
/* We would like another geometry */
if (width != result.w || height != result.h) {
int nom, den;
GstCaps *desired_caps;
GstStructure *desired_struct;
/* make a copy of the incomming caps to create the new
* suggestion. We can't use make_writable because we might
* then destroy the original caps which we still need when the
* peer does not accept the suggestion. */
desired_caps = gst_caps_copy (caps);
desired_struct = gst_caps_get_structure (desired_caps, 0);
GST_DEBUG ("we would love to receive a %dx%d video", result.w, result.h);
gst_structure_set (desired_struct, "width", G_TYPE_INT, result.w, NULL);
gst_structure_set (desired_struct, "height", G_TYPE_INT, result.h, NULL);
/* PAR property overrides the X calculated one */
if (ximagesink->par) {
nom = gst_value_get_fraction_numerator (ximagesink->par);
den = gst_value_get_fraction_denominator (ximagesink->par);
gst_structure_set (desired_struct, "pixel-aspect-ratio",
GST_TYPE_FRACTION, nom, den, NULL);
} else if (ximagesink->xcontext->par) {
nom = gst_value_get_fraction_numerator (ximagesink->xcontext->par);
den = gst_value_get_fraction_denominator (ximagesink->xcontext->par);
gst_structure_set (desired_struct, "pixel-aspect-ratio",
GST_TYPE_FRACTION, nom, den, NULL);
}
/* see if peer accepts our new suggestion, if there is no peer, this
* function returns true. */
if (!ximagesink->xcontext->last_caps ||
!gst_caps_is_equal (desired_caps, ximagesink->xcontext->last_caps)) {
caps_accepted =
gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink),
desired_caps);
/* Suggestion failed, prevent future attempts for the same caps
* to fail as well. */
if (!caps_accepted)
gst_caps_replace (&ximagesink->xcontext->last_caps, desired_caps);
}
if (caps_accepted) {
/* we will not alloc a buffer of the new suggested caps. Make sure
* we also unref this new caps after we set it on the buffer. */
alloc_caps = desired_caps;
alloc_unref = TRUE;
width = result.w;
height = result.h;
GST_DEBUG ("peer pad accepts our desired caps %" GST_PTR_FORMAT,
desired_caps);
} else {
GST_DEBUG ("peer pad does not accept our desired caps %" GST_PTR_FORMAT,
desired_caps);
/* we alloc a buffer with the original incomming caps already in the
* width and height variables */
gst_caps_unref (desired_caps);
}
}
alloc:
if (gst_caps_is_equal (GST_PAD_CAPS (bsink->sinkpad), alloc_caps)) {
/* we negotiated this format before, use the pool */
if (ximagesink->pool) {
GST_LOG_OBJECT (ximagesink, "retrieving buffer from pool");
ret = gst_buffer_pool_acquire_buffer (ximagesink->pool, &ximage, NULL);
}
}
if (ximage == NULL) {
/* Something new make a new image a new one */
GST_LOG_OBJECT (ximagesink, "allocating new image");
ximage = gst_ximage_buffer_new (ximagesink, width, height);
}
/* Now we should have a ximage, set appropriate caps on it */
if (ximage) {
/* Make sure the buffer is cleared of any previously used flags */
GST_MINI_OBJECT_CAST (ximage)->flags = 0;
gst_buffer_set_caps (ximage, alloc_caps);
}
/* could be our new reffed suggestion or the original unreffed caps */
if (alloc_unref)
gst_caps_unref (alloc_caps);
*buf = ximage;
beach:
return ret;
}
/* Interfaces stuff */
static gboolean
......@@ -2006,8 +1824,6 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass)
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_getcaps);
gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_setcaps);
gstbasesink_class->buffer_alloc =
GST_DEBUG_FUNCPTR (gst_ximagesink_buffer_alloc);
gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_ximagesink_get_times);
gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_ximagesink_event);
......
......@@ -2019,252 +2019,6 @@ config_failed:
}
}
/* Buffer management */
static GstCaps *
gst_xvimage_sink_different_size_suggestion (GstXvImageSink * xvimagesink,
GstCaps * caps)
{
GstCaps *intersection;
GstCaps *new_caps;
GstStructure *s;
gint width, height;
gint par_n = 1, par_d = 1;
gint dar_n, dar_d;
gint w, h;
new_caps = gst_caps_copy (caps);
s = gst_caps_get_structure (new_caps, 0);
gst_structure_get_int (s, "width", &width);
gst_structure_get_int (s, "height", &height);
gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_n, &par_d);
gst_structure_remove_field (s, "width");
gst_structure_remove_field (s, "height");
gst_structure_remove_field (s, "pixel-aspect-ratio");
intersection = gst_caps_intersect (xvimagesink->xcontext->caps, new_caps);
gst_caps_unref (new_caps);
if (gst_caps_is_empty (intersection))
return intersection;
s = gst_caps_get_structure (intersection, 0);
gst_util_fraction_multiply (width, height, par_n, par_d, &dar_n, &dar_d);
/* xvimagesink supports all PARs */
gst_structure_fixate_field_nearest_int (s, "width", width);
gst_structure_fixate_field_nearest_int (s, "height", height);
gst_structure_get_int (s, "width", &w);
gst_structure_get_int (s, "height", &h);
gst_util_fraction_multiply (h, w, dar_n, dar_d, &par_n, &par_d);
gst_structure_set (s, "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d,
NULL);
return intersection;
}