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...
This commit is contained in:
Wim Taymans 2002-01-13 22:27:24 +00:00
parent 7709f4acba
commit 8693a11ba2
10 changed files with 39 additions and 34 deletions

View file

@ -151,7 +151,8 @@ RTP_DIR=
endif
if USE_SDL
SDL_DIR=sdl
#SDL_DIR=sdl
SDL_DIR=
else
SDL_DIR=
endif

View file

@ -150,7 +150,6 @@ gst_a52dec_init (GstA52Dec * a52dec)
/* create the sink and src pads */
a52dec->sinkpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (a52dec), a52dec->sinkpad);
gst_pad_set_caps (a52dec->sinkpad, gst_pad_get_padtemplate_caps (a52dec->sinkpad));
gst_element_set_loop_function ((GstElement *) a52dec, gst_a52dec_loop);
a52dec->srcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (src_factory), "src");
@ -341,17 +340,18 @@ gst_a52dec_reneg (GstPad * pad, int channels, int rate)
{
GST_INFO (GST_CAT_PLUGIN_INFO, "a52dec: reneg channels:%d rate:%d\n", channels, rate);
gst_pad_set_caps (pad, gst_caps_new ("a52dec_src_caps",
gst_pad_try_set_caps (pad,
GST_CAPS_NEW ("a52dec_src_caps",
"audio/raw",
gst_props_new ("format", GST_PROPS_STRING ("int"),
"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),
"channels", GST_PROPS_INT (channels),
"rate", GST_PROPS_INT (rate), NULL)
));
"rate", GST_PROPS_INT (rate))
);
}
static void

View file

@ -323,13 +323,16 @@ gst_lame_class_init (GstLameClass *klass)
gstelement_class->change_state = gst_lame_change_state;
}
static void
gst_lame_newcaps (GstPad *pad, GstCaps *caps)
static GstPadConnectReturn
gst_lame_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstLame *lame;
lame = GST_LAME (gst_pad_get_parent (pad));
if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_CONNECT_DELAYED;
lame->samplerate = gst_caps_get_int (caps, "rate");
lame->num_channels = gst_caps_get_int (caps, "channels");
@ -347,6 +350,10 @@ gst_lame_newcaps (GstPad *pad, GstCaps *caps)
gst_element_error (GST_ELEMENT (lame), "could not initialize encoder (wrong parameters?)");
lame->initialized = FALSE;
}
if (lame->initialized)
return GST_PAD_CONNECT_OK;
return GST_PAD_CONNECT_REFUSED;
}
static void
@ -357,11 +364,10 @@ gst_lame_init (GstLame *lame)
lame->sinkpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (gst_lame_sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (lame), lame->sinkpad);
gst_pad_set_chain_function (lame->sinkpad, gst_lame_chain);
gst_pad_set_newcaps_function (lame->sinkpad, gst_lame_newcaps);
gst_pad_set_connect_function (lame->sinkpad, gst_lame_sinkconnect);
lame->srcpad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (gst_lame_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (lame), lame->srcpad);
gst_pad_set_caps (lame->srcpad, gst_pad_get_padtemplate_caps (lame->srcpad));
GST_DEBUG (0, "setting up lame encoder\n");
lame->lgf = lame_init ();

View file

@ -129,7 +129,6 @@ gst_mad_init (GstMad *mad)
mad->sinkpad = gst_pad_new_from_template(
GST_PADTEMPLATE_GET (mad_sink_template_factory), "sink");
gst_element_add_pad(GST_ELEMENT(mad),mad->sinkpad);
gst_pad_set_caps (mad->sinkpad, gst_pad_get_padtemplate_caps (mad->sinkpad));
gst_pad_set_chain_function (mad->sinkpad, GST_DEBUG_FUNCPTR(gst_mad_chain));
mad->srcpad = gst_pad_new_from_template(
@ -272,7 +271,7 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
}
}
if (GST_PAD_CAPS (mad->srcpad) == NULL) {
gst_pad_set_caps (mad->srcpad,
gst_pad_try_set_caps (mad->srcpad,
gst_caps_new (
"mad_src",
"audio/raw",
@ -292,7 +291,7 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
NULL)));
}
if (GST_PAD_CONNECTED (mad->srcpad))
if (GST_PAD_IS_CONNECTED (mad->srcpad))
gst_pad_push (mad->srcpad, outbuffer);
else
gst_buffer_unref (outbuffer);

View file

@ -248,7 +248,7 @@ gst_mpeg2dec_vo_setup (vo_instance_t * instance, int width, int height)
mpeg2dec->width = width;
mpeg2dec->height = height;
gst_pad_set_caps (mpeg2dec->srcpad,
gst_pad_try_set_caps (mpeg2dec->srcpad,
gst_caps_new (
"mpeg2dec_caps",
"video/raw",

View file

@ -374,7 +374,7 @@ gst_siddec_loop (GstElement *element)
if (siddec->tune->load (siddec->tune_buffer, siddec->tune_len)) {
if (sidEmuInitializeSong (*siddec->engine, *siddec->tune, siddec->tune_number)) {
gst_pad_set_caps (siddec->srcpad,
gst_pad_try_set_caps (siddec->srcpad,
GST_CAPS_NEW (
"siddec_src",
"audio/raw",

View file

@ -256,7 +256,7 @@ gst_ac3parse_chain (GstPad *pad, GstBuffer *buf)
outbuf = gst_buffer_create_sub(ac3parse->partialbuf,offset,bpf);
offset += bpf;
if (ac3parse->skip == 0 && GST_PAD_CONNECTED(ac3parse->srcpad)) {
if (ac3parse->skip == 0 && GST_PAD_IS_CONNECTED(ac3parse->srcpad)) {
GST_DEBUG (0,"ac3parse: pushing buffer of %d bytes\n",GST_BUFFER_SIZE(outbuf));
gst_pad_push(ac3parse->srcpad,outbuf);
}

View file

@ -142,7 +142,6 @@ static void
gst_mp3parse_init (GstMPEGAudioParse *mp3parse)
{
mp3parse->sinkpad = gst_pad_new_from_template(sink_temp, "sink");
//gst_pad_set_caps(mp3parse->sinkpad, gst_pad_get_padtemplate_caps (mp3parse->sinkpad));
gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->sinkpad);
#if 1 // set this to one to use the old chaining code

View file

@ -353,7 +353,7 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
*/
if (outpad && *outpad == NULL) {
*outpad = gst_pad_new_from_template (newtemp, name);
gst_pad_set_caps (*outpad, gst_pad_get_padtemplate_caps (*outpad));
gst_pad_try_set_caps (*outpad, gst_pad_get_padtemplate_caps (*outpad));
gst_element_add_pad (GST_ELEMENT (mpeg_demux), (*outpad));
}
else {
@ -540,7 +540,7 @@ done:
}
/* create the buffer and send it off to the Other Side */
if (GST_PAD_CONNECTED(*outpad) && datalen > 0) {
if (GST_PAD_IS_CONNECTED(*outpad) && datalen > 0) {
/* if this is part of the buffer, create a subbuffer */
GST_DEBUG (0,"mpeg_demux::parse_packet: creating subbuffer len %d\n", datalen);
@ -737,7 +737,7 @@ gst_mpeg_demux_parse_pes (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
if (newtemp) {
/* create the pad and add it to self */
(*outpad) = gst_pad_new_from_template (newtemp, name);
gst_pad_set_caps((*outpad), gst_pad_get_padtemplate_caps (*outpad));
gst_pad_try_set_caps ((*outpad), gst_pad_get_padtemplate_caps (*outpad));
gst_element_add_pad(GST_ELEMENT(mpeg_demux),(*outpad));
}
else {
@ -748,7 +748,7 @@ gst_mpeg_demux_parse_pes (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
}
/* create the buffer and send it off to the Other Side */
if (GST_PAD_CONNECTED(*outpad)) {
if (GST_PAD_IS_CONNECTED(*outpad)) {
/* if this is part of the buffer, create a subbuffer */
GST_DEBUG (0,"mpeg_demux: creating subbuffer len %d\n", datalen);
@ -788,30 +788,30 @@ _forall_pads (GstMPEGDemux *mpeg_demux, GFunc fun, gpointer user_data)
for (i=0;i<NUM_PRIVATE_1_PADS;i++)
{
pad = mpeg_demux->private_1_pad[i];
if (pad && GST_PAD_CONNECTED(pad))
if (pad && GST_PAD_IS_CONNECTED(pad))
(*fun) (pad, user_data);
}
for (i=0;i<NUM_SUBTITLE_PADS;i++)
{
pad = mpeg_demux->subtitle_pad[i];
if (pad && GST_PAD_CONNECTED(pad))
if (pad && GST_PAD_IS_CONNECTED(pad))
(*fun) (pad, user_data);
}
pad = mpeg_demux->private_2_pad;
if (pad && GST_PAD_CONNECTED(pad))
if (pad && GST_PAD_IS_CONNECTED(pad))
(*fun) (pad, user_data);
for (i=0;i<NUM_VIDEO_PADS;i++)
{
pad = mpeg_demux->video_pad[i];
if (pad && GST_PAD_CONNECTED(pad))
if (pad && GST_PAD_IS_CONNECTED(pad))
(*fun) (pad, user_data);
}
for (i=0;i<NUM_AUDIO_PADS;i++)
{
pad = mpeg_demux->audio_pad[i];
if (pad && GST_PAD_CONNECTED(pad))
if (pad && GST_PAD_IS_CONNECTED(pad))
(*fun) (pad, user_data);
}
}

View file

@ -172,7 +172,7 @@ gst_mpeg_parse_send_data (GstMPEGParse *mpeg_parse, GstData *data)
if (!GST_PAD_CAPS (mpeg_parse->srcpad)) {
gboolean mpeg2 = GST_MPEG_PACKETIZE_IS_MPEG2 (mpeg_parse->packetize);
gst_pad_set_caps (mpeg_parse->srcpad,
gst_pad_try_set_caps (mpeg_parse->srcpad,
GST_CAPS_NEW (
"mpeg_parse_src",
"video/mpeg",