From 3b47dd30d634d9797a170b372c765a22897aa3c3 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Wed, 12 May 2004 14:53:58 +0000 Subject: ext/audiofile/gstafsrc.c: Remove old debug output Original commit message from CVS: * ext/audiofile/gstafsrc.c: (gst_afsrc_get): Remove old debug output * ext/dv/gstdvdec.c: (gst_dvdec_quality_get_type), (gst_dvdec_class_init), (gst_dvdec_loop), (gst_dvdec_change_state), (gst_dvdec_set_property), (gst_dvdec_get_property): Change the quality setting to an enum, so it works from gst-launch Don't renegotiate a non-linked pad. Allows audio only decoding. * gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_getcaps), (gst_deinterlace_link), (gst_deinterlace_init): * gst/videodrop/gstvideodrop.c: (gst_videodrop_getcaps), (gst_videodrop_link): Some caps negotiation fixes --- ChangeLog | 14 ++++++++++++++ ext/audiofile/gstafsrc.c | 4 ++-- gst/deinterlace/gstdeinterlace.c | 19 ++++++++++++++++++- gst/videodrop/gstvideodrop.c | 28 ++++++++++++++++++++++------ 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 176a03be..9bf044d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-05-13 Jan Schmidt + * ext/audiofile/gstafsrc.c: (gst_afsrc_get): + Remove old debug output + * ext/dv/gstdvdec.c: (gst_dvdec_quality_get_type), + (gst_dvdec_class_init), (gst_dvdec_loop), (gst_dvdec_change_state), + (gst_dvdec_set_property), (gst_dvdec_get_property): + Change the quality setting to an enum, so it works from gst-launch + Don't renegotiate a non-linked pad. Allows audio only decoding. + * gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_getcaps), + (gst_deinterlace_link), (gst_deinterlace_init): + * gst/videodrop/gstvideodrop.c: (gst_videodrop_getcaps), + (gst_videodrop_link): + Some caps negotiation fixes + 2004-05-12 Stephane Loeuillet * ext/tarkin/gsttarkin.c : diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c index d0ce73f9..82f3a6bb 100644 --- a/ext/audiofile/gstafsrc.c +++ b/ext/audiofile/gstafsrc.c @@ -240,8 +240,8 @@ gst_afsrc_get (GstPad * pad) src->framestamp += gst_audio_frame_length (src->srcpad, buf); GST_BUFFER_TIMESTAMP (buf) = src->framestamp * 1E9 / gst_audio_frame_rate (src->srcpad); - printf ("DEBUG: afsrc: timestamp set on output buffer: %f sec\n", - GST_BUFFER_TIMESTAMP (buf) / 1E9); + /* printf ("DEBUG: afsrc: timestamp set on output buffer: %f sec\n", + GST_BUFFER_TIMESTAMP (buf) / 1E9); */ /* g_print("DEBUG: gstafsrc: pushed buffer of %ld bytes\n", readbytes); */ return GST_DATA (buf); diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 93a2bdb2..3c2941ba 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -139,6 +139,18 @@ gst_deinterlace_class_init (GstDeInterlaceClass * klass) gobject_class->set_property = gst_deinterlace_set_property; gobject_class->get_property = gst_deinterlace_get_property; } +static GstCaps * +gst_deinterlace_getcaps (GstPad * pad) +{ + GstDeInterlace *filter; + GstPad *otherpad; + + filter = GST_DEINTERLACE (gst_pad_get_parent (pad)); + + otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad; + + return gst_pad_get_allowed_caps (otherpad); +} static GstPadLinkReturn gst_deinterlace_link (GstPad * pad, const GstCaps * caps) @@ -146,10 +158,13 @@ gst_deinterlace_link (GstPad * pad, const GstCaps * caps) GstDeInterlace *filter; GstStructure *structure; GstPadLinkReturn ret; + GstPad *otherpad; filter = GST_DEINTERLACE (gst_pad_get_parent (pad)); - ret = gst_pad_try_set_caps (filter->srcpad, caps); + otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad; + + ret = gst_pad_try_set_caps (otherpad, caps); if (GST_PAD_LINK_FAILED (ret)) { return ret; } @@ -176,12 +191,14 @@ gst_deinterlace_init (GstDeInterlace * filter) (&deinterlace_sink_factory), "sink"); gst_pad_set_chain_function (filter->sinkpad, gst_deinterlace_chain); gst_pad_set_link_function (filter->sinkpad, gst_deinterlace_link); + gst_pad_set_getcaps_function (filter->sinkpad, gst_deinterlace_getcaps); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); filter->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&deinterlace_src_factory), "src"); gst_pad_set_link_function (filter->srcpad, gst_deinterlace_link); + gst_pad_set_getcaps_function (filter->srcpad, gst_deinterlace_getcaps); gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); filter->show_deinterlaced_area_only = FALSE; diff --git a/gst/videodrop/gstvideodrop.c b/gst/videodrop/gstvideodrop.c index e4f2e4ec..447a1bc7 100644 --- a/gst/videodrop/gstvideodrop.c +++ b/gst/videodrop/gstvideodrop.c @@ -162,9 +162,9 @@ gst_videodrop_getcaps (GstPad * pad) gst_structure_set (structure, "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL); } - if (negotiated) { - for (i = 0; i < gst_caps_get_size (caps); i++) { - structure = gst_caps_get_structure (caps, i); + if ((negotiated) && (videodrop->speed != 1.0)) { + for (i = 0; i < gst_caps_get_size (copy2); i++) { + structure = gst_caps_get_structure (copy2, i); gst_structure_set (structure, "framerate", G_TYPE_DOUBLE, otherfps * videodrop->speed, NULL); @@ -195,14 +195,30 @@ gst_videodrop_link (GstPad * pad, const GstCaps * caps) ret = gst_structure_get_double (structure, "framerate", &fps); if (!ret) return GST_PAD_LINK_REFUSED; + if (pad == videodrop->srcpad) { - videodrop->from_fps = fps; - } else { videodrop->to_fps = fps; + } else { + videodrop->from_fps = fps; } if (gst_pad_is_negotiated (otherpad)) { - gst_pad_renegotiate (otherpad); + /* + * Ensure that the other side talks the format we're trying to set + */ + GstCaps *newcaps = gst_caps_copy (caps); + + if (pad == videodrop->srcpad) { + gst_caps_set_simple (newcaps, + "framerate", G_TYPE_DOUBLE, videodrop->from_fps, NULL); + } else { + gst_caps_set_simple (newcaps, + "framerate", G_TYPE_DOUBLE, videodrop->to_fps, NULL); + } + ret = gst_pad_try_set_caps (otherpad, newcaps); + if (GST_PAD_LINK_FAILED (ret)) { + return GST_PAD_LINK_REFUSED; + } } return GST_PAD_LINK_OK; -- cgit v1.2.1