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.
This commit is contained in:
David Schleef 2004-01-02 07:09:23 +00:00
parent 39a338d51c
commit 6c1b114eed
11 changed files with 82 additions and 79 deletions

View file

@ -1,3 +1,55 @@
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:

View file

@ -200,6 +200,7 @@ gst_esdmon_init(GTypeInstance *instance, gpointer g_class)
gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (esdmon), "src"),
"src");
gst_pad_set_get_function(esdmon->srcpad, gst_esdmon_get);
gst_pad_use_explicit_caps (esdmon->srcpad);
gst_element_add_pad(GST_ELEMENT(esdmon), esdmon->srcpad);
esdmon->fd = -1;
@ -256,8 +257,7 @@ gst_esdmon_get (GstPad *pad)
if (!GST_PAD_CAPS (pad)) {
gint sign = (esdmon->depth == 8 ? FALSE : TRUE);
/* set caps on src pad */
/* FIXME: do this dynamically */
if (gst_pad_try_set_caps (esdmon->srcpad,
if (gst_pad_set_explicit_caps (esdmon->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, sign,

View file

@ -190,6 +190,7 @@ gst_flacdec_init (FlacDec *flacdec)
gst_pad_set_query_function (flacdec->srcpad, gst_flacdec_src_query);
gst_pad_set_event_mask_function (flacdec->srcpad, gst_flacdec_get_src_event_masks);
gst_pad_set_event_function (flacdec->srcpad, gst_flacdec_src_event);
gst_pad_use_explicit_caps (flacdec->srcpad);
flacdec->decoder = FLAC__seekable_stream_decoder_new ();
flacdec->total_samples = 0;
@ -473,7 +474,7 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder *decoder,
}
if (!GST_PAD_CAPS (flacdec->srcpad)) {
gst_pad_try_set_caps (flacdec->srcpad,
gst_pad_set_explicit_caps (flacdec->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, TRUE,

View file

@ -228,6 +228,7 @@ gst_gdk_pixbuf_init (GstGdkPixbuf *filter)
gst_pad_set_getcaps_function (filter->sinkpad, gst_gdk_pixbuf_sink_getcaps);
filter->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get( &gst_gdk_pixbuf_src_template), "src");
gst_pad_use_explicit_caps (filter->srcpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
@ -278,7 +279,7 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstData *_data)
"height", G_TYPE_INT, filter->height,
"framerate", G_TYPE_DOUBLE, 0., NULL);
gst_pad_try_set_caps(filter->srcpad, caps);
gst_pad_set_explicit_caps (filter->srcpad, caps);
}
outbuf = gst_buffer_new();

View file

@ -167,6 +167,7 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
gst_pad_set_chain_function(jpegdec->sinkpad,gst_jpegdec_chain);
gst_pad_set_link_function(jpegdec->sinkpad, gst_jpegdec_link);
jpegdec->srcpad = gst_pad_new_from_template (jpegdec_src_template, "src");
gst_pad_use_explicit_caps (jpegdec->srcpad);
gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->srcpad);
/* initialize the jpegdec decoder state */
@ -201,6 +202,7 @@ gst_jpegdec_link (GstPad *pad, const GstCaps *caps)
{
GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad));
GstStructure *structure;
GstCaps *srccaps;
structure = gst_caps_get_structure (caps, 0);
@ -208,14 +210,18 @@ gst_jpegdec_link (GstPad *pad, const GstCaps *caps)
gst_structure_get_int (structure, "width", &jpegdec->width);
gst_structure_get_int (structure, "height", &jpegdec->height);
caps = gst_caps_new_simple ("video/x-raw-yuv",
srccaps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'),
"width", G_TYPE_INT, jpegdec->width,
"height", G_TYPE_INT, jpegdec->height,
"framerate", G_TYPE_DOUBLE, jpegdec->fps,
NULL);
return gst_pad_try_set_caps (jpegdec->srcpad, caps);
/* at this point, we're pretty sure that this will be the output
* format, so we'll set it. */
gst_pad_set_explicit_caps (jpegdec->srcpad, srccaps);
return GST_PAD_LINK_OK;
}
/* shamelessly ripped from jpegutils.c in mjpegtools */
@ -404,7 +410,7 @@ gst_jpegdec_chain (GstPad *pad, GstData *_data)
jpegdec->line[2] = g_realloc(jpegdec->line[2], height*sizeof(char*));
jpegdec->height = height;
gst_pad_try_set_caps (jpegdec->srcpad,
gst_pad_set_explicit_caps (jpegdec->srcpad,
gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I','4','2','0'),
"width", G_TYPE_INT, width,

View file

@ -188,6 +188,7 @@ gst_mikmod_init (GstMikMod *filter)
gst_static_pad_template_get (&mikmod_sink_factory),"sink");
filter->srcpad = gst_pad_new_from_template(
gst_static_pad_template_get (&mikmod_src_factory),"src");
gst_pad_use_explicit_caps (filter->srcpad);
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
@ -226,7 +227,7 @@ gst_mikmod_negotiate (GstMikMod *mikmod)
sign = FALSE;
}
return gst_pad_try_set_caps (mikmod->srcpad,
return gst_pad_set_explicit_caps (mikmod->srcpad,
gst_caps_new_simple ( "audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, sign,

View file

@ -138,6 +138,7 @@ gst_speexdec_init (GstSpeexDec *speexdec)
gst_pad_set_link_function (speexdec->sinkpad, gst_speexdec_sinkconnect);
speexdec->srcpad = gst_pad_new_from_template (speexdec_src_template, "src");
gst_pad_use_explicit_caps (speexdec->srcpad);
gst_element_add_pad (GST_ELEMENT (speexdec), speexdec->srcpad);
}
@ -154,7 +155,7 @@ gst_speexdec_sinkconnect (GstPad *pad, const GstCaps *caps)
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "rate", &rate);
if (gst_pad_try_set_caps (speexdec->srcpad,
if (gst_pad_set_explicit_caps (speexdec->srcpad,
gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER,
"signed", G_TYPE_BOOLEAN, TRUE,

View file

@ -135,6 +135,7 @@ gst_auparse_init (GstAuParse *auparse)
auparse->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_auparse_src_template), "src");
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
gst_pad_use_explicit_caps (auparse->srcpad);
auparse->offset = 0;
auparse->size = 0;
@ -251,9 +252,8 @@ gst_auparse_chain (GstPad *pad, GstData *_data)
"signed", G_TYPE_BOOLEAN, sign, NULL);
}
if (gst_pad_try_set_caps (auparse->srcpad, tempcaps) <= 0) {
if (!gst_pad_set_explicit_caps (auparse->srcpad, tempcaps)) {
gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (auparse), "could not set audio caps");
return;
}

View file

@ -868,12 +868,6 @@ gst_matroska_demux_add_stream (GstMatroskaDemux *demux)
/* the pad in here */
context->pad = gst_pad_new_from_template (templ, padname);
if (caps != NULL) {
if (gst_pad_try_set_caps (context->pad, caps) <= 0) {
GST_WARNING ("Failed to set caps on next element for %s",
padname);
}
}
g_free (padname);
/* set some functions */
@ -887,9 +881,12 @@ gst_matroska_demux_add_stream (GstMatroskaDemux *demux)
gst_matroska_demux_get_src_query_types);
gst_pad_set_query_function (context->pad,
gst_matroska_demux_handle_src_query);
gst_pad_use_explicit_caps (context->pad);
gst_element_add_pad (GST_ELEMENT (demux), context->pad);
gst_pad_set_explicit_caps (context->pad, caps);
/* tadaah! */
return TRUE;
}

View file

@ -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);
}

View file

@ -202,6 +202,7 @@ gst_wavparse_init (GstWavParse *wavparse)
gst_pad_set_query_function (wavparse->srcpad, gst_wavparse_pad_query);
gst_pad_set_event_function (wavparse->srcpad, gst_wavparse_srcpad_event);
gst_pad_set_event_mask_function (wavparse->srcpad, gst_wavparse_get_event_masks);
gst_pad_use_explicit_caps (wavparse->srcpad);
gst_element_set_loop_function (GST_ELEMENT (wavparse), gst_wavparse_loop);
@ -656,10 +657,7 @@ gst_wavparse_parse_fmt (GstWavParse *wavparse)
return;
}
if (gst_pad_try_set_caps (wavparse->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (wavparse), "Could not set caps");
return;
}
gst_pad_set_explicit_caps (wavparse->srcpad, caps);
GST_DEBUG ("frequency %d, channels %d",
wavparse->rate, wavparse->channels);