summaryrefslogtreecommitdiffstats
path: root/ext/flac
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-01-13 22:27:25 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-01-13 22:27:25 +0000
commit97454065ce4921877100d0f829d4638438424dfe (patch)
treeb7fba2905e195b55f136e65332777fb96fee3d65 /ext/flac
parent1ea946d2d26998d7056d233548d88b57322ffdcf (diff)
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...
Diffstat (limited to 'ext/flac')
-rw-r--r--ext/flac/gstflacdec.c2
-rw-r--r--ext/flac/gstflacenc.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index d7619b55..97a2fab9 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -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",
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c
index 8167f776..004a2bb1 100644
--- a/ext/flac/gstflacenc.c
+++ b/ext/flac/gstflacenc.c
@@ -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();