Commit 97454065 authored by Wim Taymans's avatar Wim Taymans

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...
parent 1ea946d2
......@@ -151,7 +151,8 @@ RTP_DIR=
endif
if USE_SDL
SDL_DIR=sdl
#SDL_DIR=sdl
SDL_DIR=
else
SDL_DIR=
endif
......
......@@ -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));
......
......@@ -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) {
......
......@@ -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
......
......@@ -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",
......
......@@ -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();
......
......@@ -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 */
......
......@@ -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 (
......
......@@ -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() ) {
......
......@@ -77,8 +77,7 @@ GST_PADTEMPLATE_FACTORY (src_factory_templ,
"auparse_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
//"law", GST_PROPS_INT_RANGE (0, 2),
"law", GST_PROPS_INT (0),
"law", GST_PROPS_INT_RANGE (0, 1),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_LIST(
GST_PROPS_BOOLEAN (FALSE),
......@@ -152,7 +151,6 @@ gst_parseau_init (GstParseAu *parseau)
{
parseau->sinkpad = gst_pad_new_from_template (
GST_PADTEMPLATE_GET (sink_factory_templ), "sink");
gst_pad_set_caps (parseau->sinkpad, gst_pad_get_padtemplate_caps (parseau->sinkpad));
gst_element_add_pad (GST_ELEMENT (parseau), parseau->sinkpad);
gst_pad_set_chain_function (parseau->sinkpad, gst_parseau_chain);
......@@ -174,6 +172,8 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf)
gchar *data;
glong size;
GstCaps* tempcaps;
gint law, depth;
gboolean sign;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
......@@ -222,38 +222,44 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf)
GST_DEBUG (0, "offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
parseau->offset,parseau->size,parseau->encoding,
parseau->frequency,parseau->channels);
tempcaps = gst_caps_copy (gst_pad_get_padtemplate_caps (parseau->srcpad));
gst_caps_set (tempcaps, "format", GST_PROPS_STRING ("int"));
gst_caps_set (tempcaps, "rate", GST_PROPS_INT (parseau->frequency));
gst_caps_set (tempcaps, "channels", GST_PROPS_INT (parseau->channels));
switch (parseau->encoding) {
case 1:
gst_caps_set (tempcaps, "law", GST_PROPS_INT (1));
gst_caps_set (tempcaps, "depth", GST_PROPS_INT (8));
gst_caps_set (tempcaps, "width", GST_PROPS_INT (8));
gst_caps_set (tempcaps, "signed", GST_PROPS_BOOLEAN (FALSE));
law = 1;
depth = 8;
sign = FALSE;
break;
case 2:
gst_caps_set (tempcaps, "law", GST_PROPS_INT (0));
gst_caps_set (tempcaps, "depth", GST_PROPS_INT (8));
gst_caps_set (tempcaps, "width", GST_PROPS_INT (8));
gst_caps_set (tempcaps, "signed", GST_PROPS_BOOLEAN (TRUE));
law = 0;
depth = 8;
sign = TRUE;
break;
case 3:
gst_caps_set (tempcaps, "law", GST_PROPS_INT (0));
gst_caps_set (tempcaps, "depth", GST_PROPS_INT (16));
gst_caps_set (tempcaps, "width", GST_PROPS_INT (16));
gst_caps_set (tempcaps, "signed", GST_PROPS_BOOLEAN (TRUE));
law = 0;
depth = 16;
sign = TRUE;
break;
default:
g_warning ("help!, dont know how to deal with this format yet\n");
return;
}
gst_pad_set_caps (parseau->srcpad, tempcaps);
tempcaps = GST_CAPS_NEW ("auparse_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"rate", GST_PROPS_INT (parseau->frequency),
"channels", GST_PROPS_INT (parseau->channels),
"law", GST_PROPS_INT (law),
"depth", GST_PROPS_INT (depth),
"width", GST_PROPS_INT (depth),
"signed", GST_PROPS_BOOLEAN (sign));
if (!gst_pad_try_set_caps (parseau->srcpad, tempcaps)) {
gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (parseau), "could not set audio caps");
return;
}
newbuf = gst_buffer_new ();
GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size-(parseau->offset));
......@@ -266,7 +272,6 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf)
return;
}
gst_pad_push (parseau->srcpad, buf);
}
......
......@@ -50,19 +50,19 @@ GstPad *gst_avi_decoder_get_audio_srcpad(GstAviDecoder *avi_decoder, guint pad_n
switch (strf->format) {
case GST_RIFF_WAVE_FORMAT_PCM:
newpad = gst_pad_new("audio_00", GST_PAD_SRC);
gst_pad_set_caps (newpad, gst_caps_new (
gst_pad_try_set_caps (newpad,
GST_CAPS_NEW (
"avidecoder_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 ((gint)strf->size),
"depth", GST_PROPS_INT ((gint)strf->size),
"rate", GST_PROPS_INT ((gint)strf->rate),
"channels", GST_PROPS_INT ((gint)strf->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 ((gint)strf->size),
"depth", GST_PROPS_INT ((gint)strf->size),
"rate", GST_PROPS_INT ((gint)strf->rate),
"channels", GST_PROPS_INT ((gint)strf->channels)
));
avi_decoder->audio_pad[pad_nr] = newpad;
return newpad;
......
......@@ -245,10 +245,6 @@ gst_avi_decoder_new_pad (GstElement *element, GstPad *pad, GstAviDecoder *avi_de
}
if (!new_element && (media_type == AVI_TYPE_VIDEO)) {
gst_pad_disconnect (pad, gst_element_get_pad (type, "sink"));
new_element = gst_elementfactory_make ("windec", "decoder");
padname = "src";
}
else if (!new_element && (media_type == AVI_TYPE_AUDIO)) {
......
......@@ -300,10 +300,10 @@ gst_avi_demux_strf_vids (GstAviDemux *avi_demux)
GST_PADTEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d",
avi_demux->num_video_pads));
gst_pad_set_caps (srcpad, gst_caps_new (
gst_pad_try_set_caps (srcpad,
GST_CAPS_NEW (
"avidec_video_src",
"video/avi",
gst_props_new (
"format", GST_PROPS_STRING ("strf_vids"),
"size", GST_PROPS_INT (GUINT32_FROM_LE (strf->size)),
"width", GST_PROPS_INT (GUINT32_FROM_LE (strf->width)),
......@@ -315,8 +315,8 @@ gst_avi_demux_strf_vids (GstAviDemux *avi_demux)
"xpels_meter", GST_PROPS_INT (GUINT32_FROM_LE (strf->xpels_meter)),
"ypels_meter", GST_PROPS_INT (GUINT32_FROM_LE (strf->ypels_meter)),
"num_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->num_colors)),
"imp_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->imp_colors)),
NULL)));
"imp_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->imp_colors))
));
avi_demux->video_pad[avi_demux->num_video_pads++] = srcpad;
gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad);
......@@ -343,18 +343,18 @@ gst_avi_demux_strf_auds (GstAviDemux *avi_demux)
GST_PADTEMPLATE_GET (src_audio_templ), g_strdup_printf ("audio_%02d",
avi_demux->num_audio_pads));
gst_pad_set_caps (srcpad, gst_caps_new (
gst_pad_try_set_caps (srcpad,
GST_CAPS_NEW (
"avidec_audio_src",
"video/avi",
gst_props_new (
"format", GST_PROPS_STRING ("strf_auds"),
"fmt", GST_PROPS_INT (GUINT16_FROM_LE (strf->format)),
"channels", GST_PROPS_INT (GUINT16_FROM_LE (strf->channels)),
"rate", GST_PROPS_INT (GUINT32_FROM_LE (strf->rate)),
"av_bps", GST_PROPS_INT (GUINT32_FROM_LE (strf->av_bps)),
"blockalign", GST_PROPS_INT (GUINT16_FROM_LE (strf->blockalign)),
"size", GST_PROPS_INT (GUINT16_FROM_LE (strf->size)),
NULL)));
"size", GST_PROPS_INT (GUINT16_FROM_LE (strf->size))
));
avi_demux->audio_pad[avi_demux->num_audio_pads++] = srcpad;
gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad);
......@@ -383,10 +383,10 @@ gst_avi_demux_strf_iavs (GstAviDemux *avi_demux)
GST_PADTEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d",
avi_demux->num_video_pads));
gst_pad_set_caps (srcpad, gst_caps_new (
gst_pad_try_set_caps (srcpad,
GST_CAPS_NEW (
"avidec_iav_src",
"video/avi",
gst_props_new (
"format", GST_PROPS_STRING ("strf_iavs"),
"DVAAuxSrc", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxSrc)),
"DVAAuxCtl", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxCtl)),
......@@ -395,8 +395,8 @@ gst_avi_demux_strf_iavs (GstAviDemux *avi_demux)
"DVVAuxSrc", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVVAuxSrc)),
"DVVAuxCtl", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVVAuxCtl)),
"DVReserved1", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved1)),
"DVReserved2", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved2)),
NULL)));
"DVReserved2", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved2))
));
avi_demux->video_pad[avi_demux->num_video_pads++] = srcpad;
gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad);
......@@ -460,14 +460,14 @@ gst_avidemux_forall_pads (GstAviDemux *avi_demux, GFunc func, gpointer user_data
for(i=0; i<GST_AVI_DEMUX_MAX_AUDIO_PADS; i++) {
pad = avi_demux->audio_pad[i];
if (pad && GST_PAD_CONNECTED (pad)) {
if (pad && GST_PAD_IS_CONNECTED (pad)) {
(*func) (pad, user_data);
}
}
for(i=0; i<GST_AVI_DEMUX_MAX_VIDEO_PADS; i++) {
pad = avi_demux->video_pad[i];
if (pad && GST_PAD_CONNECTED (pad)) {
if (pad && GST_PAD_IS_CONNECTED (pad)) {
(*func) (pad, user_data);
}
}
......@@ -595,7 +595,7 @@ gst_avidemux_process_chunk (GstAviDemux *avi_demux, guint64 filepos,
GST_DEBUG (0,"gst_avi_demux_chain: tag found %08x size %08x\n",
chunkid, *chunksize);
if (GST_PAD_CONNECTED (avi_demux->video_pad[0])) {
if (GST_PAD_IS_CONNECTED (avi_demux->video_pad[0])) {
GstBuffer *buf;
if (*chunksize) {
......@@ -626,7 +626,7 @@ gst_avidemux_process_chunk (GstAviDemux *avi_demux, guint64 filepos,
GST_DEBUG (0,"gst_avi_demux_chain: tag found %08x size %08x\n",
chunkid, *chunksize);
if (GST_PAD_CONNECTED (avi_demux->audio_pad[0])) {
if (GST_PAD_IS_CONNECTED (avi_demux->audio_pad[0])) {
GstBuffer *buf;
if (*chunksize) {
......
......@@ -152,8 +152,8 @@ gst_avimux_init (GstAviMux *avimux)
avimux->aviheader = g_malloc0 (sizeof (gst_riff_avih));
}
static void
gst_avimux_newcaps (GstPad *pad, GstCaps *caps)
static GstPadConnectReturn
gst_avimux_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstAviMux *avimux;
const gchar* format = gst_caps_get_string (caps, "format");
......@@ -161,7 +161,7 @@ gst_avimux_newcaps (GstPad *pad, GstCaps *caps)
avimux = GST_AVIMUX (gst_pad_get_parent (pad));
GST_DEBUG (0, "avimux: newcaps triggered on %s (%d), %s\n", gst_pad_get_name (pad),
GST_DEBUG (0, "avimux: sinkconnect triggered on %s (%d), %s\n", gst_pad_get_name (pad),
padnum, format);
if (!strncmp (format, "strf_vids", 9)) {
......@@ -184,6 +184,7 @@ gst_avimux_newcaps (GstPad *pad, GstCaps *caps)
else if (!strncmp (format, "strf_auds", 9)) {
}
return GST_PAD_CONNECT_OK;
}
static GstPad*
......@@ -228,7 +229,7 @@ gst_avimux_request_new_pad (GstElement *element,
}
gst_pad_set_chain_function (newpad, gst_avimux_chain);
gst_pad_set_newcaps_function (newpad, gst_avimux_newcaps);
gst_pad_set_connect_function (newpad, gst_avimux_sinkconnect);
gst_element_add_pad (element, newpad);