From: Jan S. <th...@pd...> - 2004-05-12 14:54:11
|
CVS Root: /cvs/gstreamer Module: gst-plugins Changes by: thaytan Date: Wed May 12 2004 07:54:10 PDT Log message: * 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 Modified files: . : ChangeLog ext/audiofile : gstafsrc.c ext/dv : gstdvdec.c gst/deinterlace : gstdeinterlace.c gst/videodrop : gstvideodrop.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.642&r2=1.643 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/audiofile/gstafsrc.c.diff?r1=1.30&r2=1.31 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/dv/gstdvdec.c.diff?r1=1.63&r2=1.64 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/deinterlace/gstdeinterlace.c.diff?r1=1.23&r2=1.24 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/videodrop/gstvideodrop.c.diff?r1=1.13&r2=1.14 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.642 retrieving revision 1.643 diff -u -d -r1.642 -r1.643 --- a/ChangeLog 12 May 2004 10:19:19 -0000 1.642 +++ b/ChangeLog 12 May 2004 14:53:57 -0000 1.643 @@ -1,3 +1,17 @@ +2004-05-13 Jan Schmidt <th...@ma...> + * 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 <ste...@ti...> * ext/tarkin/gsttarkin.c : Index: gstafsrc.c RCS file: /cvs/gstreamer/gst-plugins/ext/audiofile/gstafsrc.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- a/gstafsrc.c 15 Mar 2004 19:31:45 -0000 1.30 +++ b/gstafsrc.c 12 May 2004 14:53:57 -0000 1.31 @@ -240,8 +240,8 @@ 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); Index: gstdvdec.c RCS file: /cvs/gstreamer/gst-plugins/ext/dv/gstdvdec.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- a/gstdvdec.c 10 May 2004 12:19:02 -0000 1.63 +++ b/gstdvdec.c 12 May 2004 14:53:57 -0000 1.64 @@ -67,6 +67,17 @@ /* FILL ME */ }; +const gint qualities[] = { + DV_QUALITY_DC, + DV_QUALITY_AC_1, + DV_QUALITY_AC_2, + DV_QUALITY_DC | DV_QUALITY_COLOR, + DV_QUALITY_AC_1 | DV_QUALITY_COLOR, + DV_QUALITY_AC_2 | DV_QUALITY_COLOR +}; +#define DV_QUALITY_DEFAULT 5 /* The PadFactory structures describe what pads the element has or * can have. They can be quite complex, but for this dvdec plugin * they are rather simple. @@ -138,14 +149,17 @@ static GType qtype = 0; if (qtype == 0) { - static const GFlagsValue values[] = { - {DV_QUALITY_COLOR, "DV_QUALITY_COLOR", "Color or monochrome decoding"}, - {DV_QUALITY_AC_1, "DV_QUALITY_AC_1", "AC 1 something"}, - {DV_QUALITY_AC_2, "DV_QUALITY_AC_2", "AC 2 something"}, - {0, NULL, NULL} + static const GEnumValue values[] = { + {0, "DV_QUALITY_FASTEST", "Fastest decoding, low-quality mono"}, + {1, "DV_QUALITY_AC_1", "Mono decoding using the first AC coefficient"}, + {2, "DV_QUALITY_AC_2", "Highest quality mono decoding"}, + {3, "DV_QUALITY_DC|DV_QUALITY_COLOUR", "Fastest colour decoding"}, + {4, "DV_QUALITY_AC_1|DV_QUALITY_COLOUR", + "Colour, using only the first AC coefficient"}, + {5, "DV_QUALITY_BEST", "Highest quality colour decoding"}, }; - qtype = g_flags_register_static ("GstDVDecQualityFlags", values); + qtype = g_enum_register_static ("GstDVDecQualityEnum", values); } return qtype; } @@ -268,8 +282,8 @@ g_param_spec_boolean ("clamp_chroma", "Clamp chroma", "Clamp chroma", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY, - g_param_spec_flags ("quality", "Quality", "Decoding quality", - GST_TYPE_DVDEC_QUALITY, DV_QUALITY_BEST, G_PARAM_READWRITE)); + g_param_spec_enum ("quality", "Quality", "Decoding quality", + GST_TYPE_DVDEC_QUALITY, DV_QUALITY_DEFAULT, G_PARAM_READWRITE)); gobject_class->set_property = gst_dvdec_set_property; gobject_class->get_property = gst_dvdec_get_property; @@ -772,7 +786,6 @@ guint8 *inframe; gint height; guint32 length, got_bytes; - GstFormat format; guint64 ts; gdouble fps; @@ -806,16 +819,6 @@ height = (dvdec->PAL ? PAL_HEIGHT : NTSC_HEIGHT); length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER); - if ((dvdec->framerate != fps) || (dvdec->height != height)) { - dvdec->height = height; - dvdec->framerate = fps; - - if (GST_PAD_LINK_FAILED (gst_pad_renegotiate (dvdec->videosrcpad))) { - GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL)); - return; - } - } if (length != dvdec->length) { dvdec->length = length; gst_bytestream_size_hint (dvdec->bs, length); @@ -828,9 +831,7 @@ return; - format = GST_FORMAT_TIME; - gst_pad_query (dvdec->videosrcpad, GST_QUERY_POSITION, &format, &ts); + ts = dvdec->next_ts; dvdec->next_ts += GST_SECOND / dvdec->framerate; dv_parse_packs (dvdec->decoder, GST_BUFFER_DATA (buf)); @@ -881,6 +882,16 @@ guint8 *outframe_ptrs[3]; gint outframe_pitches[3]; + if ((dvdec->framerate != fps) || (dvdec->height != height)) { + dvdec->height = height; + dvdec->framerate = fps; + if (GST_PAD_LINK_FAILED (gst_pad_renegotiate (dvdec->videosrcpad))) { + GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL)); + return; + } + } outbuf = gst_buffer_new_and_alloc ((720 * height) * dvdec->bpp); outframe = GST_BUFFER_DATA (outbuf); @@ -927,12 +938,12 @@ dvdec->bs = gst_bytestream_new (dvdec->sinkpad); dvdec->decoder = dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma); - dvdec->decoder->quality = dvdec->quality; + dvdec->decoder->quality = qualities[dvdec->quality]; /* * Enable this function call when libdv2 0.100 or higher is more * common */ - /* dv_set_quality (dvdec->decoder, dvdec->quality); */ + /* dv_set_quality (dvdec->decoder, qualities [dvdec->quality]); */ break; case GST_STATE_PAUSED_TO_PLAYING: @@ -977,7 +988,9 @@ dvdec->clamp_chroma = g_value_get_boolean (value); case ARG_QUALITY: - dvdec->quality = g_value_get_flags (value); + dvdec->quality = g_value_get_enum (value); + if ((dvdec->quality < 0) || (dvdec->quality > 5)) + dvdec->quality = 0; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1004,7 +1017,7 @@ g_value_set_boolean (value, dvdec->clamp_chroma); - g_value_set_flags (value, dvdec->quality); + g_value_set_enum (value, dvdec->quality); Index: gstdeinterlace.c RCS file: /cvs/gstreamer/gst-plugins/gst/deinterlace/gstdeinterlace.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- a/gstdeinterlace.c 15 Mar 2004 19:32:02 -0000 1.23 +++ b/gstdeinterlace.c 12 May 2004 14:53:57 -0000 1.24 @@ -139,6 +139,18 @@ 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 @@ GstDeInterlace *filter; GstStructure *structure; GstPadLinkReturn ret; filter = GST_DEINTERLACE (gst_pad_get_parent (pad)); - ret = gst_pad_try_set_caps (filter->srcpad, caps); + ret = gst_pad_try_set_caps (otherpad, caps); if (GST_PAD_LINK_FAILED (ret)) { return ret; @@ -176,12 +191,14 @@ (&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; Index: gstvideodrop.c RCS file: /cvs/gstreamer/gst-plugins/gst/videodrop/gstvideodrop.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- a/gstvideodrop.c 24 Mar 2004 02:12:30 -0000 1.13 +++ b/gstvideodrop.c 12 May 2004 14:53:58 -0000 1.14 @@ -162,9 +162,9 @@ 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 @@ 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 { + "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; |