diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Makefile.am | 3 | ||||
-rw-r--r-- | ext/aalib/gstaasink.c | 26 | ||||
-rw-r--r-- | ext/dv/gstdvdec.c | 4 | ||||
-rw-r--r-- | ext/esd/esdsink.c | 22 | ||||
-rw-r--r-- | ext/flac/gstflacdec.c | 2 | ||||
-rw-r--r-- | ext/flac/gstflacenc.c | 12 | ||||
-rw-r--r-- | ext/jpeg/gstjpegdec.c | 14 | ||||
-rw-r--r-- | ext/ladspa/gstladspa.c | 18 | ||||
-rw-r--r-- | ext/mikmod/gstmikmod.c | 87 |
9 files changed, 89 insertions, 99 deletions
diff --git a/ext/Makefile.am b/ext/Makefile.am index bd24b637..4676b25b 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/aalib/gstaasink.c b/ext/aalib/gstaasink.c index 83d9687f..7d41010e 100644 --- a/ext/aalib/gstaasink.c +++ b/ext/aalib/gstaasink.c @@ -70,10 +70,12 @@ GST_PADTEMPLATE_FACTORY (sink_template, static void gst_aasink_class_init (GstAASinkClass *klass); static void gst_aasink_init (GstAASink *aasink); -static void gst_aasink_chain (GstPad *pad, GstBuffer *buf); +static void gst_aasink_chain (GstPad *pad, GstBuffer *buf); -static void gst_aasink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_aasink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_aasink_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec); +static void gst_aasink_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec); static GstElementStateReturn gst_aasink_change_state (GstElement *element); @@ -87,7 +89,12 @@ gst_aasink_get_type (void) if (!aasink_type) { static const GTypeInfo aasink_info = { - sizeof(GstAASinkClass), NULL, NULL, (GClassInitFunc)gst_aasink_class_init, NULL, NULL, + sizeof(GstAASinkClass), + NULL, + NULL, + (GClassInitFunc) gst_aasink_class_init, + NULL, + NULL, sizeof(GstAASink), 0, (GInstanceInitFunc)gst_aasink_init, @@ -224,14 +231,17 @@ gst_aasink_class_init (GstAASinkClass *klass) gstelement_class->change_state = gst_aasink_change_state; } -static void -gst_aasink_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_aasink_sinkconnect (GstPad *pad, GstCaps *caps) { GstAASink *aasink; gulong print_format; aasink = GST_AASINK (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + aasink->width = gst_caps_get_int (caps, "width"); aasink->height = gst_caps_get_int (caps, "height"); @@ -241,6 +251,8 @@ gst_aasink_newcaps (GstPad *pad, GstCaps *caps) g_signal_emit( G_OBJECT (aasink), gst_aasink_signals[SIGNAL_HAVE_SIZE], 0, aasink->width, aasink->height); + + return GST_PAD_CONNECT_OK; } static void @@ -250,7 +262,7 @@ gst_aasink_init (GstAASink *aasink) GST_PADTEMPLATE_GET (sink_template), "sink"); gst_element_add_pad (GST_ELEMENT (aasink), aasink->sinkpad); gst_pad_set_chain_function (aasink->sinkpad, gst_aasink_chain); - gst_pad_set_newcaps_function (aasink->sinkpad, gst_aasink_newcaps); + gst_pad_set_connect_function (aasink->sinkpad, gst_aasink_sinkconnect); aasink->clock = gst_clock_get_system(); gst_clock_register(aasink->clock, GST_OBJECT(aasink)); diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index 4ea06b80..8fff3320 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -236,11 +236,9 @@ gst_dvdec_init(GstDVDec *dvdec) gst_element_add_pad(GST_ELEMENT(dvdec),dvdec->sinkpad); dvdec->videosrcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET(video_src_temp), "video"); - //gst_pad_set_caps (dvdec->videosrcpad, gst_pad_get_padtemplate_caps (dvdec->videosrcpad)); gst_element_add_pad(GST_ELEMENT(dvdec),dvdec->videosrcpad); // dvdec->audiosrcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET(audio_src_temp), "audio"); -// gst_pad_set_caps (dvdec->audiosrcpad, gst_pad_get_padtemplate_caps (dvdec->audiosrcpad)); // gst_element_add_pad(GST_ELEMENT(dvdec),dvdec->audiosrcpad); gst_element_set_loop_function (GST_ELEMENT(dvdec), gst_dvdec_loop); @@ -291,7 +289,7 @@ gst_dvdec_loop (GstElement *element) } if (!GST_PAD_CAPS (dvdec->videosrcpad)) { - gst_pad_set_caps (dvdec->videosrcpad, gst_pad_get_padtemplate_caps (dvdec->videosrcpad)); + gst_pad_try_set_caps (dvdec->videosrcpad, gst_pad_get_padtemplate_caps (dvdec->videosrcpad)); } if (!dvdec->pool) { diff --git a/ext/esd/esdsink.c b/ext/esd/esdsink.c index 16a056b7..b0aba3cb 100644 --- a/ext/esd/esdsink.c +++ b/ext/esd/esdsink.c @@ -86,12 +86,14 @@ static gboolean gst_esdsink_open_audio (GstEsdsink *sink); static void gst_esdsink_close_audio (GstEsdsink *sink); static GstElementStateReturn gst_esdsink_change_state (GstElement *element); static gboolean gst_esdsink_sync_parms (GstEsdsink *esdsink); -static void gst_esdsink_newcaps (GstPad *pad, GstCaps *caps); +static GstPadConnectReturn gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps); static void gst_esdsink_chain (GstPad *pad, GstBuffer *buf); -static void gst_esdsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gst_esdsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gst_esdsink_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec); +static void gst_esdsink_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec); #define GST_TYPE_ESDSINK_DEPTHS (gst_esdsink_depths_get_type()) static GType @@ -190,7 +192,7 @@ gst_esdsink_init(GstEsdsink *esdsink) GST_PADTEMPLATE_GET (sink_factory), "sink"); gst_element_add_pad(GST_ELEMENT(esdsink), esdsink->sinkpad); gst_pad_set_chain_function(esdsink->sinkpad, GST_DEBUG_FUNCPTR(gst_esdsink_chain)); - gst_pad_set_newcaps_function(esdsink->sinkpad, gst_esdsink_newcaps); + gst_pad_set_connect_function(esdsink->sinkpad, gst_esdsink_sinkconnect); esdsink->mute = FALSE; esdsink->fd = -1; @@ -215,18 +217,24 @@ gst_esdsink_sync_parms (GstEsdsink *esdsink) return gst_esdsink_open_audio (esdsink); } -static void -gst_esdsink_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps) { GstEsdsink *esdsink; esdsink = GST_ESDSINK (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + esdsink->depth = gst_caps_get_int (caps, "depth"); esdsink->channels = gst_caps_get_int (caps, "channels"); esdsink->frequency = gst_caps_get_int (caps, "rate"); - gst_esdsink_sync_parms (esdsink); + if (gst_esdsink_sync_parms (esdsink)) + return GST_PAD_CONNECT_OK; + + return GST_PAD_CONNECT_REFUSED; } static void diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index d7619b55..97a2fab9 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -184,7 +184,7 @@ gst_flacdec_write (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, flacdec = GST_FLACDEC (client_data); if (!GST_PAD_CAPS (flacdec->srcpad)) { - gst_pad_set_caps (flacdec->srcpad, + gst_pad_try_set_caps (flacdec->srcpad, GST_CAPS_NEW ( "flac_caps", "audio/raw", diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 8167f776..004a2bb1 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -100,13 +100,16 @@ gst_flacenc_class_init (FlacEncClass *klass) gobject_class->get_property = gst_flacenc_get_property; } -static void -gst_flacenc_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps) { FlacEnc *flacenc; flacenc = GST_FLACENC (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + flacenc->channels = gst_caps_get_int (caps, "channels"); flacenc->depth = gst_caps_get_int (caps, "depth"); flacenc->sample_rate = gst_caps_get_int (caps, "rate"); @@ -114,6 +117,8 @@ gst_flacenc_newcaps (GstPad *pad, GstCaps *caps) FLAC__stream_encoder_set_bits_per_sample (flacenc->encoder, flacenc->depth); FLAC__stream_encoder_set_sample_rate (flacenc->encoder, flacenc->sample_rate); FLAC__stream_encoder_set_channels (flacenc->encoder, flacenc->channels); + + return GST_PAD_CONNECT_OK; } static void @@ -122,10 +127,9 @@ gst_flacenc_init (FlacEnc *flacenc) flacenc->sinkpad = gst_pad_new_from_template (enc_sink_template, "sink"); gst_element_add_pad(GST_ELEMENT(flacenc),flacenc->sinkpad); gst_pad_set_chain_function(flacenc->sinkpad,gst_flacenc_chain); - gst_pad_set_newcaps_function (flacenc->sinkpad, gst_flacenc_newcaps); + gst_pad_set_connect_function (flacenc->sinkpad, gst_flacenc_sinkconnect); flacenc->srcpad = gst_pad_new_from_template (enc_src_template, "src"); - gst_pad_set_caps (flacenc->srcpad, gst_pad_get_padtemplate_caps (flacenc->srcpad)); gst_element_add_pad(GST_ELEMENT(flacenc),flacenc->srcpad); flacenc->encoder = FLAC__stream_encoder_new(); diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c index 025338fe..6184d490 100644 --- a/ext/jpeg/gstjpegdec.c +++ b/ext/jpeg/gstjpegdec.c @@ -173,7 +173,7 @@ gst_jpegdec_chain (GstPad *pad, GstBuffer *buf) jpegdec = GST_JPEGDEC (GST_OBJECT_PARENT (pad)); - if (!GST_PAD_CONNECTED (jpegdec->srcpad)) { + if (!GST_PAD_IS_CONNECTED (jpegdec->srcpad)) { gst_buffer_unref (buf); return; } @@ -220,14 +220,14 @@ gst_jpegdec_chain (GstPad *pad, GstBuffer *buf) jpegdec->line[2] = g_realloc(jpegdec->line[2], height*sizeof(char*)); jpegdec->height = height; - gst_pad_set_caps (jpegdec->srcpad, gst_caps_new ( + gst_pad_try_set_caps (jpegdec->srcpad, + GST_CAPS_NEW ( "jpegdec_caps", "video/raw", - gst_props_new ( - "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), - "width", GST_PROPS_INT (width), - "height", GST_PROPS_INT (height), - NULL))); + "format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')), + "width", GST_PROPS_INT (width), + "height", GST_PROPS_INT (height) + )); } /* mind the swap, jpeglib outputs blue chroma first */ diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c index b83f0268..53f1d5e3 100644 --- a/ext/ladspa/gstladspa.c +++ b/ext/ladspa/gstladspa.c @@ -85,9 +85,9 @@ static GstPadTemplate *srctempl, *sinktempl; static void gst_ladspa_class_init (GstLADSPAClass *klass); static void gst_ladspa_init (GstLADSPA *ladspa); -static GstPadNegotiateReturn gst_ladspa_negotiate_sink_mono (GstPad *pad, GstCaps **caps, gpointer *data); -static GstPadNegotiateReturn gst_ladspa_negotiate_src_mono (GstPad *pad, GstCaps **caps, gpointer *data); -static GstPadNegotiateReturn gst_ladspa_negotiate_src_get_mono (GstPad *pad, GstCaps **caps, gpointer *data); +//static GstPadNegotiateReturn gst_ladspa_negotiate_sink_mono (GstPad *pad, GstCaps **caps, gpointer *data); +//static GstPadNegotiateReturn gst_ladspa_negotiate_src_mono (GstPad *pad, GstCaps **caps, gpointer *data); +//static GstPadNegotiateReturn gst_ladspa_negotiate_src_get_mono (GstPad *pad, GstCaps **caps, gpointer *data); static void gst_ladspa_force_caps(GstLADSPA *ladspa, GstPad *pad); static void gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); @@ -347,9 +347,9 @@ gst_ladspa_init (GstLADSPA *ladspa) // mono chain if (sinkcount==1 && srccount==1){ //g_print("inplace mono chain mode\n"); - gst_pad_set_negotiate_function (ladspa->sinkpads[0], gst_ladspa_negotiate_sink_mono); + //gst_pad_set_negotiate_function (ladspa->sinkpads[0], gst_ladspa_negotiate_sink_mono); gst_pad_set_chain_function(ladspa->sinkpads[0],gst_ladspa_chain_inplace_mono); - gst_pad_set_negotiate_function (ladspa->srcpads[0], gst_ladspa_negotiate_src_mono); + //gst_pad_set_negotiate_function (ladspa->srcpads[0], gst_ladspa_negotiate_src_mono); } // mono get (no sink pads) @@ -359,7 +359,7 @@ gst_ladspa_init (GstLADSPA *ladspa) ladspa->samplerate = 44100; ladspa->buffersize = 64; gst_pad_set_get_function(ladspa->srcpads[0],gst_ladspa_get_mono); - gst_pad_set_negotiate_function (ladspa->srcpads[0], gst_ladspa_negotiate_src_get_mono); + //gst_pad_set_negotiate_function (ladspa->srcpads[0], gst_ladspa_negotiate_src_get_mono); gst_ladspa_instantiate(ladspa); } @@ -370,12 +370,13 @@ gst_ladspa_init (GstLADSPA *ladspa) ladspa->samplerate = 44100; ladspa->buffersize = 64; gst_pad_set_get_function(ladspa->srcpads[0],gst_ladspa_get); - gst_pad_set_negotiate_function (ladspa->srcpads[0], gst_ladspa_negotiate_src_get_mono); + //gst_pad_set_negotiate_function (ladspa->srcpads[0], gst_ladspa_negotiate_src_get_mono); gst_ladspa_instantiate(ladspa); ladspa->buffers = g_new0(GstBuffer*,oclass->numsrcpads); } } +#if 0 static GstPadNegotiateReturn gst_ladspa_negotiate_src_mono (GstPad *pad, GstCaps **caps, gpointer *data) { @@ -416,12 +417,13 @@ gst_ladspa_negotiate_src_get_mono (GstPad *pad, GstCaps **caps, gpointer *data) } return GST_PAD_NEGOTIATE_FAIL; } +#endif static void gst_ladspa_force_caps(GstLADSPA *ladspa, GstPad *pad) { // g_print("forcing caps\n"); - gst_pad_set_caps (pad, gst_caps_new ( + gst_pad_try_set_caps (pad, gst_caps_new ( "ladspa_src_caps", "audio/raw", gst_props_new ( diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c index a2b5038d..037187fa 100644 --- a/ext/mikmod/gstmikmod.c +++ b/ext/mikmod/gstmikmod.c @@ -170,9 +170,6 @@ static GstElementStateReturn gst_mikmod_change_state (GstElement *element); -static GstPadNegotiateReturn mikmod_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data); -static GstPadNegotiateReturn mikmod_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data); - static GstElementClass *parent_class = NULL; #define GST_TYPE_MIKMOD_MIXFREQ (gst_mikmod_mixfreq_get_type()) @@ -194,29 +191,6 @@ gst_mikmod_mixfreq_get_type (void) return mikmod_mixfreq_type; } -static GstPadNegotiateReturn -mikmod_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstMikMod* filter = GST_MIKMOD (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps); -} - -static GstPadNegotiateReturn -mikmod_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstMikMod* filter = GST_MIKMOD (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); -} - - GType gst_mikmod_get_type(void) { static GType mikmod_type = 0; @@ -302,6 +276,7 @@ gst_mikmod_class_init (GstMikModClass *klass) gobject_class->set_property = gst_mikmod_set_property; gobject_class->get_property = gst_mikmod_get_property; + gstelement_class->change_state = gst_mikmod_change_state; } @@ -312,15 +287,12 @@ gst_mikmod_init (GstMikMod *filter) filter->sinkpad = gst_pad_new_from_template(mikmod_sink_factory (),"sink"); filter->srcpad = gst_pad_new_from_template(mikmod_src_factory (),"src"); - /*gst_pad_set_negotiate_function(filter->sinkpad,mikmod_negotiate_sink); - gst_pad_set_negotiate_function(filter->srcpad,mikmod_negotiate_src);*/ - gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); gst_element_set_loop_function (GST_ELEMENT (filter), gst_mikmod_loop); - filter->Buffer = gst_buffer_new(); + filter->Buffer = NULL; filter->stereo = TRUE; filter->surround = TRUE; @@ -351,26 +323,20 @@ gst_mikmod_loop (GstElement *element) srcpad = mikmod->srcpad; mikmod->Buffer = NULL; - while ((buffer_in = gst_pad_pull( mikmod->sinkpad ))) /*&& GST_BUFFER_SIZE(buffer_tmp) != 0 && GST_BUFFER_SIZE(buffer_tmp) != -1 ) */ - { - if ( GST_IS_EVENT (buffer_in) ) - { + while ((buffer_in = gst_pad_pull( mikmod->sinkpad ))) { + if ( GST_IS_EVENT (buffer_in) ) { GstEvent *event = GST_EVENT (buffer_in); - if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) - break; + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) + break; } - /*if ( GST_BUFFER_SIZE(buffer_in) != 0 && GST_BUFFER_SIZE(buffer_in) != -1 ) - {*/ - if ( mikmod->Buffer ) - { - mikmod->Buffer = gst_buffer_append( mikmod->Buffer, buffer_in ); - gst_buffer_unref( buffer_in ); - } - else - mikmod->Buffer = buffer_in; - /* }*/ + if ( mikmod->Buffer ) { + mikmod->Buffer = gst_buffer_append( mikmod->Buffer, buffer_in ); + gst_buffer_unref( buffer_in ); + } + else + mikmod->Buffer = buffer_in; } if ( mikmod->_16bit ) @@ -385,24 +351,23 @@ gst_mikmod_loop (GstElement *element) reader = GST_READER_new( mikmod ); module = Player_LoadGeneric ( reader, 64, 0 ); + gst_buffer_unref (mikmod->Buffer); + if ( ! Player_Active() ) Player_Start(module); - gst_pad_set_caps (mikmod->srcpad, gst_caps_new ( - "mikmod_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 (mode16bits), - "depth", GST_PROPS_INT (mode16bits), - "rate", GST_PROPS_INT (mikmod->mixfreq), - "channels", GST_PROPS_INT (2), - NULL - ) - )); + gst_pad_try_set_caps (mikmod->srcpad, + GST_CAPS_NEW ( + "mikmod_src", + "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 (mode16bits), + "depth", GST_PROPS_INT (mode16bits), + "rate", GST_PROPS_INT (mikmod->mixfreq), + "channels", GST_PROPS_INT (2))); do { if ( Player_Active() ) { |