From 5455dbbf3d8542af5178b1312c89841089640f70 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 13 Jan 2002 22:27:25 +0000 Subject: [PATCH] Bring the plugins in sync with the new core capsnego system. Original commit message from CVS: Bring the plugins in sync with the new core capsnego system. Added some features, enhancements... --- ext/Makefile.am | 3 ++- ext/alsa/gstalsa.c | 10 ++++---- ext/cdparanoia/gstcdparanoia.c | 1 - ext/vorbis/vorbisdec.c | 22 ++++++++--------- ext/vorbis/vorbisenc.c | 15 ++++++++---- gst/audioscale/gstaudioscale.c | 41 ++++---------------------------- gst/sine/gstsinesrc.c | 43 +++++++++++----------------------- gst/videoscale/gstvideoscale.c | 22 +++++++++++------ gst/volume/gstvolume.c | 6 +++-- sys/v4l/gstv4lmjpegsink.c | 11 ++++++--- sys/v4l/gstv4lmjpegsrc.c | 8 +++++-- sys/v4l/gstv4lsrc.c | 9 ++++--- 12 files changed, 87 insertions(+), 104 deletions(-) diff --git a/ext/Makefile.am b/ext/Makefile.am index bd24b63787..4676b25ba0 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -151,7 +151,8 @@ RTP_DIR= endif if USE_SDL -SDL_DIR=sdl +#SDL_DIR=sdl +SDL_DIR= else SDL_DIR= endif diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c index ba99669fb5..e384ea2901 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -57,7 +57,7 @@ static GstPad* gst_alsa_request_new_pad (GstElement *element, GstPadTemplate *te static void gst_alsa_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_alsa_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static GstElementStateReturn gst_alsa_change_state(GstElement *element); -static GstPadNegotiateReturn gst_alsa_negotiate(GstPad *pad, GstCaps **caps, gpointer *user_data); +//static GstPadNegotiateReturn gst_alsa_negotiate(GstPad *pad, GstCaps **caps, gpointer *user_data); static GstCaps* gst_alsa_caps (GstAlsa *this); @@ -305,7 +305,7 @@ gst_alsa_init(GstAlsa *this) gst_element_add_pad(GST_ELEMENT(this), GST_ALSA_PAD(this->pads)->pad); - gst_pad_set_negotiate_function(GST_ALSA_PAD(this->pads)->pad, gst_alsa_negotiate); + //gst_pad_set_negotiate_function(GST_ALSA_PAD(this->pads)->pad, gst_alsa_negotiate); gst_element_set_loop_function(GST_ELEMENT(this), gst_alsa_loop); } @@ -358,7 +358,7 @@ gst_alsa_request_new_pad (GstElement *element, GstPadTemplate *templ, const gcha pad->channel = channel; pad->pad = gst_pad_new_from_template (templ, newname); gst_element_add_pad (GST_ELEMENT (this), pad->pad); - gst_pad_set_negotiate_function(pad->pad, gst_alsa_negotiate); + //gst_pad_set_negotiate_function(pad->pad, gst_alsa_negotiate); if (this->data_interleaved && this->pads) { gst_element_remove_pad (GST_ELEMENT (this), GST_ALSA_PAD(this->pads)->pad); @@ -715,6 +715,7 @@ gst_alsa_caps (GstAlsa *this) /* * Negotiates the caps, "borrowed" from gstosssink.c */ +#if 0 GstPadNegotiateReturn gst_alsa_negotiate(GstPad *pad, GstCaps **caps, gpointer *user_data) { @@ -766,6 +767,7 @@ gst_alsa_negotiate(GstPad *pad, GstCaps **caps, gpointer *user_data) return GST_PAD_NEGOTIATE_FAIL; } +#endif /* shamelessly stolen from pbd's audioengine. thanks, paul! */ static void @@ -878,7 +880,7 @@ gst_alsa_src_process (GstAlsa *this, snd_pcm_uframes_t frames) caps = gst_alsa_caps(this); l = this->pads; while (l) { - if (!gst_pad_set_caps (GST_ALSA_PAD(l)->pad, caps)) { + if (!gst_pad_try_set_caps (GST_ALSA_PAD(l)->pad, caps)) { g_print ("DANGER WILL ROBINSON!\n"); sleep(1); return FALSE; diff --git a/ext/cdparanoia/gstcdparanoia.c b/ext/cdparanoia/gstcdparanoia.c index 819653745d..f8adddb393 100644 --- a/ext/cdparanoia/gstcdparanoia.c +++ b/ext/cdparanoia/gstcdparanoia.c @@ -242,7 +242,6 @@ cdparanoia_init (CDParanoia *cdparanoia) cdparanoia->srcpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (cdparanoia_src_factory), "src"); gst_pad_set_get_function (cdparanoia->srcpad, cdparanoia_get); - gst_pad_set_caps (cdparanoia->srcpad, gst_pad_get_padtemplate_caps (cdparanoia->srcpad)); gst_element_add_pad (GST_ELEMENT (cdparanoia), cdparanoia->srcpad); cdparanoia->device = "/dev/cdrom"; diff --git a/ext/vorbis/vorbisdec.c b/ext/vorbis/vorbisdec.c index 4e3809f759..17ef93fd4a 100644 --- a/ext/vorbis/vorbisdec.c +++ b/ext/vorbis/vorbisdec.c @@ -300,18 +300,18 @@ gst_vorbisdec_loop (GstElement * element) gst_event_new_info ("bitrate_window", GST_PROPS_INT (vi.bitrate_window), NULL)); } - gst_pad_set_caps (vorbisdec->srcpad, - gst_caps_new ("vorbisdec_src", + gst_pad_try_set_caps (vorbisdec->srcpad, + GST_CAPS_NEW ("vorbisdec_src", "audio/raw", - gst_props_new ("format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), - "rate", GST_PROPS_INT (vi.rate), - "channels", GST_PROPS_INT (vi.channels), - NULL))); + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (TRUE), + "width", GST_PROPS_INT (16), + "depth", GST_PROPS_INT (16), + "rate", GST_PROPS_INT (vi.rate), + "channels", GST_PROPS_INT (vi.channels) + )); vorbisdec->convsize = 4096 / vi.channels; diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 124cd4bb15..6e6554f2b2 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -109,17 +109,25 @@ gst_vorbisenc_class_init (VorbisEncClass * klass) gobject_class->get_property = gst_vorbisenc_get_property; } -static void -gst_vorbisenc_newcaps (GstPad * pad, GstCaps * caps) +static GstPadConnectReturn +gst_vorbisenc_sinkconnect (GstPad * pad, GstCaps * caps) { VorbisEnc *vorbisenc; vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + vorbisenc->channels = gst_caps_get_int (caps, "channels"); vorbisenc->frequency = gst_caps_get_int (caps, "rate"); gst_vorbisenc_setup (vorbisenc); + + if (vorbisenc->setup) + return GST_PAD_CONNECT_OK; + + return GST_PAD_CONNECT_REFUSED; } static void @@ -128,10 +136,9 @@ gst_vorbisenc_init (VorbisEnc * vorbisenc) vorbisenc->sinkpad = gst_pad_new_from_template (enc_sink_template, "sink"); gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->sinkpad); gst_pad_set_chain_function (vorbisenc->sinkpad, gst_vorbisenc_chain); - gst_pad_set_newcaps_function (vorbisenc->sinkpad, gst_vorbisenc_newcaps); + gst_pad_set_connect_function (vorbisenc->sinkpad, gst_vorbisenc_sinkconnect); vorbisenc->srcpad = gst_pad_new_from_template (enc_src_template, "src"); - gst_pad_set_caps (vorbisenc->srcpad, gst_pad_get_padtemplate_caps (vorbisenc->srcpad)); gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->srcpad); vorbisenc->channels = 2; diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index 9e3189223d..8ac81796df 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -161,40 +161,8 @@ gst_audioscale_class_init (AudioscaleClass *klass) } -static GstPadNegotiateReturn -audioscale_negotiate_src (GstPad * pad, GstCaps ** caps, gpointer * data) -{ - Audioscale *audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad)); - - g_print ("audioscale_negotiate_src\n"); - - if (*caps == NULL) - return GST_PAD_NEGOTIATE_FAIL; - - *caps = gst_caps_copy_on_write (*caps); - gst_caps_set (*caps, "rate", GST_PROPS_INT_RANGE (8000, 48000)); - - return gst_pad_negotiate_proxy (pad, audioscale->sinkpad, caps); -} - -static GstPadNegotiateReturn -audioscale_negotiate_sink (GstPad * pad, GstCaps ** caps, gpointer * data) -{ - Audioscale *audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad)); - - g_print ("audioscale_negotiate_sink\n"); - - if (*caps == NULL) - return GST_PAD_NEGOTIATE_FAIL; - - *caps = gst_caps_copy_on_write (*caps); - gst_caps_set (*caps, "rate", GST_PROPS_INT (audioscale->targetfrequency)); - - return gst_pad_negotiate_proxy (pad, audioscale->srcpad, caps); -} - -static void -gst_audioscale_newcaps (GstPad * pad, GstCaps * caps) +static GstPadConnectReturn +gst_audioscale_sinkconnect (GstPad * pad, GstCaps * caps) { Audioscale *audioscale; resample_t *r; @@ -208,6 +176,7 @@ gst_audioscale_newcaps (GstPad * pad, GstCaps * caps) resample_reinit(r); //g_print("audioscale: unsupported scaling method %d\n", audioscale->method); + return GST_PAD_CONNECT_OK; } static void * @@ -228,13 +197,11 @@ gst_audioscale_init (Audioscale *audioscale) resample_t *r; audioscale->sinkpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (sink_template), "sink"); - gst_pad_set_negotiate_function (audioscale->sinkpad, audioscale_negotiate_sink); gst_element_add_pad(GST_ELEMENT(audioscale),audioscale->sinkpad); gst_pad_set_chain_function(audioscale->sinkpad,gst_audioscale_chain); - gst_pad_set_newcaps_function (audioscale->sinkpad, gst_audioscale_newcaps); + gst_pad_set_connect_function (audioscale->sinkpad, gst_audioscale_sinkconnect); audioscale->srcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (src_template), "src"); - gst_pad_set_negotiate_function (audioscale->srcpad, audioscale_negotiate_src); gst_element_add_pad(GST_ELEMENT(audioscale),audioscale->srcpad); diff --git a/gst/sine/gstsinesrc.c b/gst/sine/gstsinesrc.c index 9f88b51ce6..199be9ad1c 100644 --- a/gst/sine/gstsinesrc.c +++ b/gst/sine/gstsinesrc.c @@ -76,7 +76,7 @@ GST_PADTEMPLATE_FACTORY (sinesrc_src_factory, static void gst_sinesrc_class_init (GstSineSrcClass *klass); static void gst_sinesrc_init (GstSineSrc *src); -static void gst_sinesrc_newcaps (GstPad *pad, GstCaps *caps); +static void gst_sinesrc_sinkconnect (GstPad *pad, GstCaps *caps); static void gst_sinesrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_sinesrc_get_property (GObject *object, guint prop_id, @@ -162,7 +162,6 @@ gst_sinesrc_init (GstSineSrc *src) src->srcpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (sinesrc_src_factory), "src"); gst_element_add_pad(GST_ELEMENT(src), src->srcpad); - gst_pad_set_newcaps_function (src->srcpad, gst_sinesrc_newcaps); gst_pad_set_get_function(src->srcpad, gst_sinesrc_get); @@ -204,17 +203,6 @@ gst_sinesrc_init (GstSineSrc *src) } -static void -gst_sinesrc_newcaps (GstPad *pad, GstCaps *caps) -{ - GstSineSrc *src; - g_return_if_fail (pad != NULL); - g_return_if_fail (caps != NULL); - src = GST_SINESRC(gst_pad_get_parent (pad)); - src->samplerate = gst_caps_get_int (caps, "rate"); - gst_sinesrc_update_table_inc(src); -} - static GstBuffer * gst_sinesrc_get(GstPad *pad) { @@ -410,23 +398,20 @@ gst_sinesrc_force_caps(GstSineSrc *src) { src->newcaps=FALSE; - caps = gst_caps_new ( - "sinesrc_src_caps", - "audio/raw", - gst_props_new ( - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), - "width", GST_PROPS_INT (16), - "depth", GST_PROPS_INT (16), - "rate", GST_PROPS_INT (src->samplerate), - "channels", GST_PROPS_INT (1), - NULL - ) - ); + caps = GST_CAPS_NEW ( + "sinesrc_src_caps", + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (TRUE), + "width", GST_PROPS_INT (16), + "depth", GST_PROPS_INT (16), + "rate", GST_PROPS_INT (src->samplerate), + "channels", GST_PROPS_INT (1) + ); - gst_pad_set_caps (src->srcpad, caps); + gst_pad_try_set_caps (src->srcpad, caps); } static gboolean diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 5d5da452de..b146166cf6 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -145,6 +145,7 @@ gst_videoscale_class_init (GstVideoscaleClass *klass) } +/* static GstPadNegotiateReturn videoscale_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { @@ -176,15 +177,20 @@ videoscale_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) return GST_PAD_NEGOTIATE_AGREE; } +*/ -static void -gst_videoscale_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps) { GstVideoscale *videoscale; - GST_DEBUG(0,"gst_videoscale_newcaps\n"); + GST_DEBUG(0,"gst_videoscale_sinkconnect\n"); videoscale = GST_VIDEOSCALE (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) { + return GST_PAD_CONNECT_DELAYED; + } + videoscale->width = gst_caps_get_int (caps, "width"); videoscale->height = gst_caps_get_int (caps, "height"); videoscale->format = gst_caps_get_int (caps, "format"); @@ -195,7 +201,7 @@ gst_videoscale_newcaps (GstPad *pad, GstCaps *caps) videoscale->targetheight); GST_DEBUG(0,"width %d\n",videoscale->targetwidth); - gst_pad_set_caps (videoscale->srcpad, + gst_pad_try_set_caps (videoscale->srcpad, GST_CAPS_NEW ( "videoscale_src", "video/raw", @@ -203,6 +209,8 @@ gst_videoscale_newcaps (GstPad *pad, GstCaps *caps) "width", GST_PROPS_INT (videoscale->targetwidth), "height", GST_PROPS_INT (videoscale->targetheight) )); + + return GST_PAD_CONNECT_OK; } static void @@ -211,14 +219,14 @@ gst_videoscale_init (GstVideoscale *videoscale) GST_DEBUG(0,"gst_videoscale_init\n"); videoscale->sinkpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (sink_templ), "sink"); - gst_pad_set_negotiate_function(videoscale->sinkpad,videoscale_negotiate_sink); + //gst_pad_set_negotiate_function(videoscale->sinkpad,videoscale_negotiate_sink); gst_element_add_pad(GST_ELEMENT(videoscale),videoscale->sinkpad); gst_pad_set_chain_function(videoscale->sinkpad,gst_videoscale_chain); - gst_pad_set_newcaps_function(videoscale->sinkpad,gst_videoscale_newcaps); + gst_pad_set_connect_function(videoscale->sinkpad,gst_videoscale_sinkconnect); videoscale->srcpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (src_templ), "src"); - gst_pad_set_negotiate_function(videoscale->srcpad,videoscale_negotiate_src); + //gst_pad_set_negotiate_function(videoscale->srcpad,videoscale_negotiate_src); gst_element_add_pad(GST_ELEMENT(videoscale),videoscale->srcpad); videoscale->targetwidth = -1; diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 8771869ada..0cc95a248e 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -108,6 +108,7 @@ volume_get_bufferpool (GstPad *pad) return gst_pad_get_bufferpool (filter->srcpad); } +/* static GstPadNegotiateReturn volume_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { @@ -135,6 +136,7 @@ volume_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); } +*/ static gint volume_parse_caps (GstVolume *filter, GstCaps *caps) @@ -231,10 +233,10 @@ static void volume_init (GstVolume *filter) { filter->sinkpad = gst_pad_new_from_template(volume_sink_factory (),"sink"); - gst_pad_set_negotiate_function(filter->sinkpad,volume_negotiate_sink); + //gst_pad_set_negotiate_function(filter->sinkpad,volume_negotiate_sink); gst_pad_set_bufferpool_function(filter->sinkpad,volume_get_bufferpool); filter->srcpad = gst_pad_new_from_template(volume_src_factory (),"src"); - gst_pad_set_negotiate_function(filter->srcpad,volume_negotiate_src); + //gst_pad_set_negotiate_function(filter->srcpad,volume_negotiate_src); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c index bbbca44b6a..f02a162b78 100644 --- a/sys/v4l/gstv4lmjpegsink.c +++ b/sys/v4l/gstv4lmjpegsink.c @@ -155,14 +155,17 @@ gst_v4lmjpegsink_class_init (GstV4lMjpegSinkClass *klass) gstelement_class->change_state = gst_v4lmjpegsink_change_state; } -static void -gst_v4lmjpegsink_newcaps (GstPad *pad, +static GstPadConnectReturn +gst_v4lmjpegsink_sinkconnect (GstPad *pad, GstCaps *caps) { GstV4lMjpegSink *v4lmjpegsink; v4lmjpegsink = GST_V4LMJPEGSINK (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + v4lmjpegsink->width = gst_caps_get_int (caps, "width"); v4lmjpegsink->height = gst_caps_get_int (caps, "height"); @@ -173,6 +176,8 @@ gst_v4lmjpegsink_newcaps (GstPad *pad, g_signal_emit (G_OBJECT (v4lmjpegsink), gst_v4lmjpegsink_signals[SIGNAL_HAVE_SIZE], 0, v4lmjpegsink->width, v4lmjpegsink->height); + + return GST_PAD_CONNECT_OK; } @@ -182,7 +187,7 @@ gst_v4lmjpegsink_init (GstV4lMjpegSink *v4lmjpegsink) v4lmjpegsink->sinkpad = gst_pad_new_from_template(GST_PADTEMPLATE_GET (sink_template), "sink"); gst_element_add_pad (GST_ELEMENT (v4lmjpegsink), v4lmjpegsink->sinkpad); gst_pad_set_chain_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_chain); - gst_pad_set_newcaps_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_newcaps); + gst_pad_set_connect_function (v4lmjpegsink->sinkpad, gst_v4lmjpegsink_sinkconnect); v4lmjpegsink->clock = gst_clock_get_system(); gst_clock_register(v4lmjpegsink->clock, GST_OBJECT(v4lmjpegsink)); diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c index 8d05233cfc..88f9cc5e26 100644 --- a/sys/v4l/gstv4lmjpegsrc.c +++ b/sys/v4l/gstv4lmjpegsrc.c @@ -57,9 +57,11 @@ static void gst_v4lmjpegsrc_class_init (GstV4lMjpegSrcClass * static void gst_v4lmjpegsrc_init (GstV4lMjpegSrc *v4lmjpegsrc); /* pad/buffer functions */ +/* static GstPadNegotiateReturn gst_v4lmjpegsrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *user_data); + */ static GstCaps* gst_v4lmjpegsrc_create_caps (GstV4lMjpegSrc *v4lmjpegsrc); static GstBuffer* gst_v4lmjpegsrc_get (GstPad *pad); @@ -176,7 +178,7 @@ gst_v4lmjpegsrc_init (GstV4lMjpegSrc *v4lmjpegsrc) gst_element_add_pad(GST_ELEMENT(v4lmjpegsrc), v4lmjpegsrc->srcpad); gst_pad_set_get_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_get); - gst_pad_set_negotiate_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_negotiate); + //gst_pad_set_negotiate_function (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_negotiate); v4lmjpegsrc->bufferpool = gst_buffer_pool_new(); gst_buffer_pool_set_buffer_new_function(v4lmjpegsrc->bufferpool, gst_v4lmjpegsrc_buffer_new); @@ -205,6 +207,7 @@ gst_v4lmjpegsrc_init (GstV4lMjpegSrc *v4lmjpegsrc) +/* static GstPadNegotiateReturn gst_v4lmjpegsrc_negotiate (GstPad *pad, GstCaps **caps, @@ -223,6 +226,7 @@ gst_v4lmjpegsrc_negotiate (GstPad *pad, return GST_PAD_NEGOTIATE_FAIL; } +*/ static GstCaps* @@ -253,7 +257,7 @@ gst_v4lmjpegsrc_get (GstPad *pad) v4lmjpegsrc = GST_V4LMJPEGSRC (gst_pad_get_parent (pad)); if (v4lmjpegsrc->init) { - gst_pad_set_caps (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_create_caps (v4lmjpegsrc)); + gst_pad_try_set_caps (v4lmjpegsrc->srcpad, gst_v4lmjpegsrc_create_caps (v4lmjpegsrc)); v4lmjpegsrc->init = FALSE; } else { diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index 27f7c8d493..a0723a84a3 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -54,9 +54,10 @@ static void gst_v4lsrc_class_init (GstV4lSrcClass *klass); static void gst_v4lsrc_init (GstV4lSrc *v4lsrc); /* pad/buffer functions */ -static GstPadNegotiateReturn gst_v4lsrc_negotiate (GstPad *pad, +/*static GstPadNegotiateReturn gst_v4lsrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *user_data); + */ static GstCaps* gst_v4lsrc_create_caps (GstV4lSrc *v4lsrc); static GstBuffer* gst_v4lsrc_get (GstPad *pad); @@ -154,7 +155,7 @@ gst_v4lsrc_init (GstV4lSrc *v4lsrc) gst_element_add_pad(GST_ELEMENT(v4lsrc), v4lsrc->srcpad); gst_pad_set_get_function (v4lsrc->srcpad, gst_v4lsrc_get); - gst_pad_set_negotiate_function (v4lsrc->srcpad, gst_v4lsrc_negotiate); + //gst_pad_set_negotiate_function (v4lsrc->srcpad, gst_v4lsrc_negotiate); v4lsrc->bufferpool = gst_buffer_pool_new(); gst_buffer_pool_set_buffer_new_function(v4lsrc->bufferpool, gst_v4lsrc_buffer_new); @@ -171,6 +172,7 @@ gst_v4lsrc_init (GstV4lSrc *v4lsrc) } +#if 0 static GstPadNegotiateReturn gst_v4lsrc_negotiate (GstPad *pad, GstCaps **caps, @@ -255,6 +257,7 @@ gst_v4lsrc_negotiate (GstPad *pad, return GST_PAD_NEGOTIATE_FAIL; } +#endif static GstCaps* @@ -361,7 +364,7 @@ gst_v4lsrc_get (GstPad *pad) v4lsrc = GST_V4LSRC (gst_pad_get_parent (pad)); if (v4lsrc->init) { - gst_pad_set_caps (v4lsrc->srcpad, gst_v4lsrc_create_caps (v4lsrc)); + gst_pad_try_set_caps (v4lsrc->srcpad, gst_v4lsrc_create_caps (v4lsrc)); v4lsrc->init = FALSE; } else {