Commit ab8b6967 authored by David Schleef's avatar David Schleef

Convert elements to use gst_pad_use_explicit_caps() where appropriate.

Original commit message from CVS:
Convert elements to use gst_pad_use_explicit_caps() where appropriate.
parent 9e9bd201
2004-01-01 David Schleef <ds@schleef.org>
Convert elements to use gst_pad_use_explicit_caps() where
appropriate:
* ext/a52dec/gsta52dec.c: (gst_a52dec_init), (gst_a52dec_reneg):
* ext/audiofile/gstafparse.c: (gst_afparse_init),
(gst_afparse_open_file):
* ext/audiofile/gstafsrc.c: (gst_afsrc_init),
(gst_afsrc_open_file):
* ext/esd/esdmon.c: (gst_esdmon_init), (gst_esdmon_get):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_chain):
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop):
* ext/flac/gstflacdec.c: (gst_flacdec_init), (gst_flacdec_write):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_init),
(gst_gdk_pixbuf_chain):
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_init), (gst_jpegdec_link),
(gst_jpegdec_chain):
* ext/mad/gstmad.c: (gst_mad_init), (gst_mad_chain):
* ext/mikmod/gstmikmod.c: (gst_mikmod_init),
(gst_mikmod_negotiate):
* ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_init),
(gst_mpeg2dec_negotiate_format):
* ext/mpeg2enc/gstmpeg2enc.cc:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_push):
* ext/speex/gstspeexdec.c: (gst_speexdec_init),
(gst_speexdec_sinkconnect):
* ext/swfdec/gstswfdec.c: (gst_swfdec_loop), (gst_swfdec_init):
* ext/vorbis/vorbisfile.c: (gst_vorbisfile_init),
(gst_vorbisfile_new_link):
* gst/ac3parse/gstac3parse.c: (gst_ac3parse_init),
(gst_ac3parse_chain):
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_add_audio_stream),
(gst_asf_demux_setup_pad):
* gst/auparse/gstauparse.c: (gst_auparse_init),
(gst_auparse_chain):
* gst/id3/gstid3types.c: (gst_id3types_loop):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream):
* gst/mpeg1videoparse/gstmp1videoparse.c: (gst_mp1videoparse_init),
(mp1videoparse_parse_seq):
* gst/mpegaudioparse/gstmpegaudioparse.c: (gst_mp3parse_init),
(bpf_from_header):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_parse_syshead),
(gst_mpeg_demux_parse_pes), (gst_mpeg_demux_lpcm_set_caps):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_send_data):
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(gst_qtdemux_add_stream):
* gst/realmedia/rmdemux.c: (gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_init),
(gst_wavparse_parse_fmt):
2004-01-01 Ronald Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
......
......@@ -150,6 +150,7 @@ gst_afparse_init (GstAFParse *afparse)
{
afparse->srcpad = gst_pad_new_from_template (
gst_element_get_pad_template (GST_ELEMENT (afparse), "src"), "src");
gst_pad_use_explicit_caps (afparse->srcpad);
gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad);
afparse->sinkpad = gst_pad_new_from_template (
......@@ -381,7 +382,7 @@ gst_afparse_open_file (GstAFParse *afparse)
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_try_set_caps (afparse->srcpad,
gst_pad_set_explicit_caps (afparse->srcpad,
gst_caps_new_simple (
"audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
......
......@@ -179,6 +179,7 @@ gst_afsrc_init (GstAFSrc *afsrc)
afsrc->srcpad = gst_pad_new_from_template (
gst_element_get_pad_template (GST_ELEMENT (afsrc), "src"), "src");
gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad);
gst_pad_use_explicit_caps (afsrc->srcpad);
gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get);
afsrc->bytes_per_read = 4096;
......@@ -339,8 +340,7 @@ gst_afsrc_open_file (GstAFSrc *src)
}
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_try_set_caps (src->srcpad,
gst_pad_set_explicit_caps (src->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, src->is_signed,
......
......@@ -106,8 +106,6 @@ static void gst_mpeg2enc_loop (GstElement *element);
static GstPadLinkReturn
gst_mpeg2enc_sink_link (GstPad *pad,
const GstCaps *caps);
static GstCaps *
gst_mpeg2enc_src_getcaps (GstPad *pad);
static GstElementStateReturn
gst_mpeg2enc_change_state (GstElement *element);
......@@ -214,7 +212,7 @@ gst_mpeg2enc_init (GstMpeg2enc *enc)
enc->srcpad = gst_pad_new_from_template (
gst_element_class_get_pad_template (klass, "src"), "src");
gst_pad_set_getcaps_function (enc->srcpad, gst_mpeg2enc_src_getcaps);
gst_pad_use_explicit_caps (enc->srcpad);
gst_element_add_pad (element, enc->srcpad);
enc->options = new GstMpeg2EncOptions ();
......@@ -249,7 +247,7 @@ gst_mpeg2enc_loop (GstElement *element)
/* and set caps on other side */
caps = enc->encoder->getFormat ();
if (gst_pad_try_set_caps (enc->srcpad, caps) <= 0) {
if (gst_pad_set_explicit_caps (enc->srcpad, caps) <= 0) {
gst_element_error (element,
"Failed to set up encoder properly");
delete enc->encoder;
......@@ -278,19 +276,6 @@ gst_mpeg2enc_sink_link (GstPad *pad,
return GST_PAD_LINK_OK;
}
static GstCaps *
gst_mpeg2enc_src_getcaps (GstPad *pad)
{
GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad));
if (enc->encoder) {
return enc->encoder->getFormat ();
}
return gst_caps_copy (gst_pad_template_get_caps (
gst_element_get_pad_template (gst_pad_get_parent (pad), "src")));
}
static void
gst_mpeg2enc_get_property (GObject *object,
guint prop_id,
......
......@@ -158,27 +158,6 @@ gst_swfdec_class_init(GstSwfdecClass *klass)
gstelement_class->change_state = gst_swfdec_change_state;
}
static GstCaps *gst_swfdec_videosrc_getcaps(GstPad *pad)
{
GstSwfdec *swfdec;
GstCaps *caps;
swfdec = GST_SWFDEC (gst_pad_get_parent (pad));
caps = gst_caps_copy (gst_pad_template_get_caps (
gst_static_pad_template_get (&video_template_factory)));
if (swfdec->height) {
gst_caps_set_simple (caps,
"framerate", G_TYPE_DOUBLE, swfdec->frame_rate,
"height",G_TYPE_INT,swfdec->height,
"width",G_TYPE_INT,swfdec->width,
NULL);
}
return caps;
}
static void
gst_swfdec_loop(GstElement *element)
{
......@@ -217,14 +196,22 @@ gst_swfdec_loop(GstElement *element)
}
if(ret==SWF_CHANGE){
GstCaps *caps;
swfdec_decoder_get_image_size(swfdec->state,
&swfdec->width, &swfdec->height);
swfdec_decoder_get_rate(swfdec->state, &swfdec->rate);
swfdec->interval = GST_SECOND / swfdec->rate;
GST_DEBUG_CAPS ("caps", gst_swfdec_videosrc_getcaps(swfdec->videopad));
gst_pad_try_set_caps(swfdec->videopad,
gst_swfdec_videosrc_getcaps(swfdec->videopad));
caps = gst_caps_copy (gst_pad_get_pad_template_caps (
swfdec->videopad));
gst_caps_set_simple (caps,
"framerate", G_TYPE_DOUBLE, (double)swfdec->frame_rate,
"height",G_TYPE_INT,swfdec->height,
"width",G_TYPE_INT,swfdec->width,
NULL);
gst_pad_set_explicit_caps(swfdec->videopad, caps);
return;
}
......@@ -280,8 +267,7 @@ gst_swfdec_init (GstSwfdec *swfdec)
"video_00");
gst_pad_set_query_function (swfdec->videopad,
GST_DEBUG_FUNCPTR (gst_swfdec_src_query));
gst_pad_set_getcaps_function (swfdec->videopad,
GST_DEBUG_FUNCPTR (gst_swfdec_videosrc_getcaps));
gst_pad_use_explicit_caps (swfdec->videopad);
gst_element_add_pad(GST_ELEMENT(swfdec), swfdec->videopad);
swfdec->audiopad = gst_pad_new_from_template(
......
......@@ -151,6 +151,7 @@ gst_mp1videoparse_init (Mp1VideoParse *mp1videoparse)
mp1videoparse->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&src_factory), "src");
gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->srcpad);
gst_pad_use_explicit_caps (mp1videoparse->srcpad);
mp1videoparse->partialbuf = NULL;
mp1videoparse->need_resync = FALSE;
......@@ -209,11 +210,7 @@ mp1videoparse_parse_seq (Mp1VideoParse *mp1videoparse, GstBuffer *buf)
GST_DEBUG_CAPS ("New mpeg1videoparse caps", caps);
if (gst_pad_try_set_caps (mp1videoparse->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (mp1videoparse),
"mp1videoparse: failed to negotiate a new format");
return;
}
gst_pad_set_explicit_caps (mp1videoparse->srcpad, caps);
}
}
......
......@@ -290,6 +290,7 @@ gst_mp3parse_init (GstMPEGAudioParse *mp3parse)
mp3parse->srcpad = gst_pad_new_from_template(
gst_static_pad_template_get (&mp3_src_template), "src");
gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->srcpad);
gst_pad_use_explicit_caps (mp3parse->srcpad);
/*gst_pad_set_type_id(mp3parse->srcpad, mp3frametype); */
mp3parse->partialbuf = NULL;
......@@ -465,10 +466,7 @@ bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
bitrate != parse->bit_rate) {
GstCaps *caps = mp3_caps_create (layer, channels, bitrate, rate);
if (gst_pad_try_set_caps(parse->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (parse),
"mp3parse: failed to negotiate format with next element");
}
gst_pad_set_explicit_caps(parse->srcpad, caps);
parse->channels = channels;
parse->layer = layer;
......
......@@ -504,7 +504,7 @@ static void gst_qtdemux_loop_header (GstElement *element)
gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
NULL);
stream->fps = fps;
gst_pad_try_set_caps(stream->pad, stream->caps);
gst_pad_set_explicit_caps(stream->pad, stream->caps);
}
}
......@@ -522,52 +522,6 @@ static void gst_qtdemux_loop_header (GstElement *element)
}
static GstCaps *gst_qtdemux_src_getcaps(GstPad *pad)
{
GstQTDemux *qtdemux;
QtDemuxStream *stream;
GST_DEBUG ("gst_qtdemux_src_getcaps");
qtdemux = GST_QTDEMUX(gst_pad_get_parent(pad));
g_return_val_if_fail(GST_IS_QTDEMUX(qtdemux), NULL);
stream = GST_PAD_ELEMENT_PRIVATE (pad);
return gst_caps_copy(stream->caps);
}
#if 0
/* This function doesn't do anything useful, but might be useful later */
static GstPadLinkReturn
gst_qtdemux_src_link(GstPad *pad, GstCaps *caps)
{
GstQTDemux *qtdemux;
QtDemuxStream *stream;
int i;
GST_DEBUG ("gst_qtdemux_src_link");
qtdemux = GST_QTDEMUX(gst_pad_get_parent(pad));
GST_DEBUG ("looking for pad %p in qtdemux %p", pad, qtdemux);
g_return_val_if_fail(GST_IS_QTDEMUX(qtdemux), GST_PAD_LINK_REFUSED);
GST_DEBUG ("n_streams is %d", qtdemux->n_streams);
for(i=0;i<qtdemux->n_streams;i++){
stream = qtdemux->streams[i];
GST_DEBUG ("pad[%d] is %p", i, stream->pad);
if(stream->pad == pad){
return GST_PAD_LINK_OK;
}
}
GST_DEBUG ("Couldn't find stream cooresponding to pad\n");
return GST_PAD_LINK_REFUSED;
}
#endif
void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
{
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
......@@ -594,10 +548,7 @@ void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
qtdemux->n_audio_streams++;
}
gst_pad_set_getcaps_function(stream->pad, gst_qtdemux_src_getcaps);
#ifdef unused
gst_pad_set_link_function(stream->pad, gst_qtdemux_src_link);
#endif
gst_pad_use_explicit_caps (stream->pad);
GST_PAD_ELEMENT_PRIVATE(stream->pad) = stream;
qtdemux->streams[qtdemux->n_streams] = stream;
......@@ -607,12 +558,7 @@ void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
GST_DEBUG ("adding pad %p to qtdemux %p", stream->pad, qtdemux);
gst_element_add_pad(GST_ELEMENT (qtdemux), stream->pad);
/* Note: we need to have everything set up before calling try_set_caps */
if(stream->caps){
GST_DEBUG_CAPS ("setting caps",stream->caps);
gst_pad_try_set_caps(stream->pad, stream->caps);
}
gst_pad_set_explicit_caps(stream->pad, stream->caps);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment