summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2004-01-02 07:09:23 +0000
committerDavid Schleef <ds@schleef.org>2004-01-02 07:09:23 +0000
commit6c1b114eed9ec1bf3ffea9a63294e927e29cc2b8 (patch)
tree3c29572d6b4db945275248591c33c116864eeca5 /gst
parent39a338d51c31e3e77a4f00cbcf415c5822762ed0 (diff)
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.
Diffstat (limited to 'gst')
-rw-r--r--gst/auparse/gstauparse.c4
-rw-r--r--gst/matroska/matroska-demux.c9
-rw-r--r--gst/qtdemux/qtdemux.c60
-rw-r--r--gst/wavparse/gstwavparse.c8
4 files changed, 11 insertions, 70 deletions
diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c
index d4f50644..570a2b6b 100644
--- a/gst/auparse/gstauparse.c
+++ b/gst/auparse/gstauparse.c
@@ -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;
}
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 0d222fe7..d3764457 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -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;
}
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 659c968b..4361dd24 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -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);
}
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index e1b93a1b..406c2145 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -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,11 +657,8 @@ 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);
}