diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2002-01-13 22:27:25 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2002-01-13 22:27:25 +0000 |
commit | 97454065ce4921877100d0f829d4638438424dfe (patch) | |
tree | b7fba2905e195b55f136e65332777fb96fee3d65 /gst | |
parent | 1ea946d2d26998d7056d233548d88b57322ffdcf (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 'gst')
-rw-r--r-- | gst/auparse/gstparseau.c | 51 | ||||
-rw-r--r-- | gst/avi/audiocodecs.c | 22 | ||||
-rw-r--r-- | gst/avi/gstavidecoder.c | 4 | ||||
-rw-r--r-- | gst/avi/gstavidemux.c | 32 | ||||
-rw-r--r-- | gst/avi/gstavimux.c | 9 | ||||
-rw-r--r-- | gst/avi/gstavitypes.c | 15 | ||||
-rw-r--r-- | gst/cutter/gstcutter.c | 24 | ||||
-rw-r--r-- | gst/flx/gstflxdec.c | 177 | ||||
-rw-r--r-- | gst/flx/gstflxdec.h | 19 | ||||
-rw-r--r-- | gst/law/alaw-decode.c | 8 | ||||
-rw-r--r-- | gst/law/alaw-encode.c | 6 | ||||
-rw-r--r-- | gst/law/mulaw-decode.c | 6 | ||||
-rw-r--r-- | gst/law/mulaw-encode.c | 6 | ||||
-rw-r--r-- | gst/level/gstlevel.c | 25 | ||||
-rw-r--r-- | gst/median/gstmedian.c | 35 | ||||
-rw-r--r-- | gst/udp/gstudpsink.c | 16 | ||||
-rw-r--r-- | gst/udp/gstudpsrc.c | 2 | ||||
-rw-r--r-- | gst/wavparse/gstwavparse.c | 28 |
18 files changed, 243 insertions, 242 deletions
diff --git a/gst/auparse/gstparseau.c b/gst/auparse/gstparseau.c index 782148d7..92466582 100644 --- a/gst/auparse/gstparseau.c +++ b/gst/auparse/gstparseau.c @@ -77,8 +77,7 @@ GST_PADTEMPLATE_FACTORY (src_factory_templ, "auparse_src", "audio/raw", "format", GST_PROPS_STRING ("int"), - //"law", GST_PROPS_INT_RANGE (0, 2), - "law", GST_PROPS_INT (0), + "law", GST_PROPS_INT_RANGE (0, 1), "endianness", GST_PROPS_INT (G_BYTE_ORDER), "signed", GST_PROPS_LIST( GST_PROPS_BOOLEAN (FALSE), @@ -152,7 +151,6 @@ gst_parseau_init (GstParseAu *parseau) { parseau->sinkpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (sink_factory_templ), "sink"); - gst_pad_set_caps (parseau->sinkpad, gst_pad_get_padtemplate_caps (parseau->sinkpad)); gst_element_add_pad (GST_ELEMENT (parseau), parseau->sinkpad); gst_pad_set_chain_function (parseau->sinkpad, gst_parseau_chain); @@ -174,6 +172,8 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf) gchar *data; glong size; GstCaps* tempcaps; + gint law, depth; + gboolean sign; g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); @@ -222,38 +222,44 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf) GST_DEBUG (0, "offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n", parseau->offset,parseau->size,parseau->encoding, parseau->frequency,parseau->channels); - - tempcaps = gst_caps_copy (gst_pad_get_padtemplate_caps (parseau->srcpad)); - gst_caps_set (tempcaps, "format", GST_PROPS_STRING ("int")); - gst_caps_set (tempcaps, "rate", GST_PROPS_INT (parseau->frequency)); - gst_caps_set (tempcaps, "channels", GST_PROPS_INT (parseau->channels)); - switch (parseau->encoding) { case 1: - gst_caps_set (tempcaps, "law", GST_PROPS_INT (1)); - gst_caps_set (tempcaps, "depth", GST_PROPS_INT (8)); - gst_caps_set (tempcaps, "width", GST_PROPS_INT (8)); - gst_caps_set (tempcaps, "signed", GST_PROPS_BOOLEAN (FALSE)); + law = 1; + depth = 8; + sign = FALSE; break; case 2: - gst_caps_set (tempcaps, "law", GST_PROPS_INT (0)); - gst_caps_set (tempcaps, "depth", GST_PROPS_INT (8)); - gst_caps_set (tempcaps, "width", GST_PROPS_INT (8)); - gst_caps_set (tempcaps, "signed", GST_PROPS_BOOLEAN (TRUE)); + law = 0; + depth = 8; + sign = TRUE; break; case 3: - gst_caps_set (tempcaps, "law", GST_PROPS_INT (0)); - gst_caps_set (tempcaps, "depth", GST_PROPS_INT (16)); - gst_caps_set (tempcaps, "width", GST_PROPS_INT (16)); - gst_caps_set (tempcaps, "signed", GST_PROPS_BOOLEAN (TRUE)); + law = 0; + depth = 16; + sign = TRUE; break; default: g_warning ("help!, dont know how to deal with this format yet\n"); return; } - gst_pad_set_caps (parseau->srcpad, tempcaps); + tempcaps = GST_CAPS_NEW ("auparse_src", + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "rate", GST_PROPS_INT (parseau->frequency), + "channels", GST_PROPS_INT (parseau->channels), + "law", GST_PROPS_INT (law), + "depth", GST_PROPS_INT (depth), + "width", GST_PROPS_INT (depth), + "signed", GST_PROPS_BOOLEAN (sign)); + + if (!gst_pad_try_set_caps (parseau->srcpad, tempcaps)) { + gst_buffer_unref (buf); + gst_element_error (GST_ELEMENT (parseau), "could not set audio caps"); + return; + } newbuf = gst_buffer_new (); GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size-(parseau->offset)); @@ -266,7 +272,6 @@ gst_parseau_chain (GstPad *pad, GstBuffer *buf) return; } - gst_pad_push (parseau->srcpad, buf); } diff --git a/gst/avi/audiocodecs.c b/gst/avi/audiocodecs.c index 9415055c..3414ab7f 100644 --- a/gst/avi/audiocodecs.c +++ b/gst/avi/audiocodecs.c @@ -50,19 +50,19 @@ GstPad *gst_avi_decoder_get_audio_srcpad(GstAviDecoder *avi_decoder, guint pad_n switch (strf->format) { case GST_RIFF_WAVE_FORMAT_PCM: newpad = gst_pad_new("audio_00", GST_PAD_SRC); - gst_pad_set_caps (newpad, gst_caps_new ( + gst_pad_try_set_caps (newpad, + GST_CAPS_NEW ( "avidecoder_caps", "audio/raw", - gst_props_new ( - "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 ((gint)strf->size), - "depth", GST_PROPS_INT ((gint)strf->size), - "rate", GST_PROPS_INT ((gint)strf->rate), - "channels", GST_PROPS_INT ((gint)strf->channels), - NULL))); + "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 ((gint)strf->size), + "depth", GST_PROPS_INT ((gint)strf->size), + "rate", GST_PROPS_INT ((gint)strf->rate), + "channels", GST_PROPS_INT ((gint)strf->channels) + )); avi_decoder->audio_pad[pad_nr] = newpad; return newpad; diff --git a/gst/avi/gstavidecoder.c b/gst/avi/gstavidecoder.c index 85024139..b91473e6 100644 --- a/gst/avi/gstavidecoder.c +++ b/gst/avi/gstavidecoder.c @@ -245,10 +245,6 @@ gst_avi_decoder_new_pad (GstElement *element, GstPad *pad, GstAviDecoder *avi_de } if (!new_element && (media_type == AVI_TYPE_VIDEO)) { - gst_pad_disconnect (pad, gst_element_get_pad (type, "sink")); - - new_element = gst_elementfactory_make ("windec", "decoder"); - padname = "src"; } else if (!new_element && (media_type == AVI_TYPE_AUDIO)) { diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 6c5888ed..1be29e1b 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -300,10 +300,10 @@ gst_avi_demux_strf_vids (GstAviDemux *avi_demux) GST_PADTEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d", avi_demux->num_video_pads)); - gst_pad_set_caps (srcpad, gst_caps_new ( + gst_pad_try_set_caps (srcpad, + GST_CAPS_NEW ( "avidec_video_src", "video/avi", - gst_props_new ( "format", GST_PROPS_STRING ("strf_vids"), "size", GST_PROPS_INT (GUINT32_FROM_LE (strf->size)), "width", GST_PROPS_INT (GUINT32_FROM_LE (strf->width)), @@ -315,8 +315,8 @@ gst_avi_demux_strf_vids (GstAviDemux *avi_demux) "xpels_meter", GST_PROPS_INT (GUINT32_FROM_LE (strf->xpels_meter)), "ypels_meter", GST_PROPS_INT (GUINT32_FROM_LE (strf->ypels_meter)), "num_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->num_colors)), - "imp_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->imp_colors)), - NULL))); + "imp_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->imp_colors)) + )); avi_demux->video_pad[avi_demux->num_video_pads++] = srcpad; gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad); @@ -343,18 +343,18 @@ gst_avi_demux_strf_auds (GstAviDemux *avi_demux) GST_PADTEMPLATE_GET (src_audio_templ), g_strdup_printf ("audio_%02d", avi_demux->num_audio_pads)); - gst_pad_set_caps (srcpad, gst_caps_new ( + gst_pad_try_set_caps (srcpad, + GST_CAPS_NEW ( "avidec_audio_src", "video/avi", - gst_props_new ( "format", GST_PROPS_STRING ("strf_auds"), "fmt", GST_PROPS_INT (GUINT16_FROM_LE (strf->format)), "channels", GST_PROPS_INT (GUINT16_FROM_LE (strf->channels)), "rate", GST_PROPS_INT (GUINT32_FROM_LE (strf->rate)), "av_bps", GST_PROPS_INT (GUINT32_FROM_LE (strf->av_bps)), "blockalign", GST_PROPS_INT (GUINT16_FROM_LE (strf->blockalign)), - "size", GST_PROPS_INT (GUINT16_FROM_LE (strf->size)), - NULL))); + "size", GST_PROPS_INT (GUINT16_FROM_LE (strf->size)) + )); avi_demux->audio_pad[avi_demux->num_audio_pads++] = srcpad; gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad); @@ -383,10 +383,10 @@ gst_avi_demux_strf_iavs (GstAviDemux *avi_demux) GST_PADTEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d", avi_demux->num_video_pads)); - gst_pad_set_caps (srcpad, gst_caps_new ( + gst_pad_try_set_caps (srcpad, + GST_CAPS_NEW ( "avidec_iav_src", "video/avi", - gst_props_new ( "format", GST_PROPS_STRING ("strf_iavs"), "DVAAuxSrc", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxSrc)), "DVAAuxCtl", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxCtl)), @@ -395,8 +395,8 @@ gst_avi_demux_strf_iavs (GstAviDemux *avi_demux) "DVVAuxSrc", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVVAuxSrc)), "DVVAuxCtl", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVVAuxCtl)), "DVReserved1", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved1)), - "DVReserved2", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved2)), - NULL))); + "DVReserved2", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved2)) + )); avi_demux->video_pad[avi_demux->num_video_pads++] = srcpad; gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad); @@ -460,14 +460,14 @@ gst_avidemux_forall_pads (GstAviDemux *avi_demux, GFunc func, gpointer user_data for(i=0; i<GST_AVI_DEMUX_MAX_AUDIO_PADS; i++) { pad = avi_demux->audio_pad[i]; - if (pad && GST_PAD_CONNECTED (pad)) { + if (pad && GST_PAD_IS_CONNECTED (pad)) { (*func) (pad, user_data); } } for(i=0; i<GST_AVI_DEMUX_MAX_VIDEO_PADS; i++) { pad = avi_demux->video_pad[i]; - if (pad && GST_PAD_CONNECTED (pad)) { + if (pad && GST_PAD_IS_CONNECTED (pad)) { (*func) (pad, user_data); } } @@ -595,7 +595,7 @@ gst_avidemux_process_chunk (GstAviDemux *avi_demux, guint64 filepos, GST_DEBUG (0,"gst_avi_demux_chain: tag found %08x size %08x\n", chunkid, *chunksize); - if (GST_PAD_CONNECTED (avi_demux->video_pad[0])) { + if (GST_PAD_IS_CONNECTED (avi_demux->video_pad[0])) { GstBuffer *buf; if (*chunksize) { @@ -626,7 +626,7 @@ gst_avidemux_process_chunk (GstAviDemux *avi_demux, guint64 filepos, GST_DEBUG (0,"gst_avi_demux_chain: tag found %08x size %08x\n", chunkid, *chunksize); - if (GST_PAD_CONNECTED (avi_demux->audio_pad[0])) { + if (GST_PAD_IS_CONNECTED (avi_demux->audio_pad[0])) { GstBuffer *buf; if (*chunksize) { diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index c7e81019..540e2a7b 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -152,8 +152,8 @@ gst_avimux_init (GstAviMux *avimux) avimux->aviheader = g_malloc0 (sizeof (gst_riff_avih)); } -static void -gst_avimux_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_avimux_sinkconnect (GstPad *pad, GstCaps *caps) { GstAviMux *avimux; const gchar* format = gst_caps_get_string (caps, "format"); @@ -161,7 +161,7 @@ gst_avimux_newcaps (GstPad *pad, GstCaps *caps) avimux = GST_AVIMUX (gst_pad_get_parent (pad)); - GST_DEBUG (0, "avimux: newcaps triggered on %s (%d), %s\n", gst_pad_get_name (pad), + GST_DEBUG (0, "avimux: sinkconnect triggered on %s (%d), %s\n", gst_pad_get_name (pad), padnum, format); if (!strncmp (format, "strf_vids", 9)) { @@ -184,6 +184,7 @@ gst_avimux_newcaps (GstPad *pad, GstCaps *caps) else if (!strncmp (format, "strf_auds", 9)) { } + return GST_PAD_CONNECT_OK; } static GstPad* @@ -228,7 +229,7 @@ gst_avimux_request_new_pad (GstElement *element, } gst_pad_set_chain_function (newpad, gst_avimux_chain); - gst_pad_set_newcaps_function (newpad, gst_avimux_newcaps); + gst_pad_set_connect_function (newpad, gst_avimux_sinkconnect); gst_element_add_pad (element, newpad); return newpad; diff --git a/gst/avi/gstavitypes.c b/gst/avi/gstavitypes.c index b43f2a0c..e0862130 100644 --- a/gst/avi/gstavitypes.c +++ b/gst/avi/gstavitypes.c @@ -170,8 +170,8 @@ gst_avi_types_class_init (GstAviTypesClass *klass) gobject_class->get_property = gst_avi_types_get_property; } -static void -gst_avi_types_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_avi_types_sinkconnect (GstPad *pad, GstCaps *caps) { GstAviTypes *avi_types; const gchar *format; @@ -196,6 +196,9 @@ gst_avi_types_newcaps (GstPad *pad, GstCaps *caps) "format", GST_PROPS_STRING ("NTSC"), NULL)); default: + /* else we simply don't convert, and hope there is a native decoder + * available */ + newcaps = caps; break; } } @@ -243,9 +246,11 @@ gst_avi_types_newcaps (GstPad *pad, GstCaps *caps) } if (newcaps) { - gst_pad_set_caps (avi_types->srcpad, newcaps); + gst_pad_try_set_caps (avi_types->srcpad, newcaps); avi_types->type_found = TRUE; + return GST_PAD_CONNECT_OK; } + return GST_PAD_CONNECT_REFUSED; } static void @@ -254,7 +259,7 @@ gst_avi_types_init (GstAviTypes *avi_types) avi_types->sinkpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (sink_templ), "sink"); gst_element_add_pad (GST_ELEMENT (avi_types), avi_types->sinkpad); - gst_pad_set_newcaps_function (avi_types->sinkpad, gst_avi_types_newcaps); + gst_pad_set_connect_function (avi_types->sinkpad, gst_avi_types_sinkconnect); gst_pad_set_chain_function (avi_types->sinkpad, gst_avi_types_chain); avi_types->srcpad = gst_pad_new_from_template ( @@ -271,7 +276,7 @@ gst_avi_types_chain (GstPad *pad, GstBuffer *buffer) avi_types = GST_AVI_TYPES (gst_pad_get_parent (pad)); - if (GST_PAD_CONNECTED (avi_types->srcpad)) + if (GST_PAD_IS_CONNECTED (avi_types->srcpad)) gst_pad_push (avi_types->srcpad, buffer); else gst_buffer_unref (buffer); diff --git a/gst/cutter/gstcutter.c b/gst/cutter/gstcutter.c index 48c3439b..e14da5fe 100644 --- a/gst/cutter/gstcutter.c +++ b/gst/cutter/gstcutter.c @@ -88,27 +88,6 @@ void gst_cutter_get_caps (GstPad *pad, GstCutter* filter); static GstElementClass *parent_class = NULL; static guint gst_cutter_signals[LAST_SIGNAL] = { 0 }; -static GstPadNegotiateReturn -cutter_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstCutter* filter = GST_CUTTER (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps); -} - -static GstPadNegotiateReturn -cutter_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstCutter* filter = GST_CUTTER (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); -} GType gst_cutter_get_type(void) { @@ -180,9 +159,6 @@ gst_cutter_init (GstCutter *filter) filter->pre_length = 0.2; filter->pre_run_length = 0.0; filter->pre_buffer = NULL; - - gst_pad_set_negotiate_function (filter->sinkpad,cutter_negotiate_sink); - gst_pad_set_negotiate_function (filter->srcpad,cutter_negotiate_src); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); gst_pad_set_chain_function (filter->sinkpad, gst_cutter_chain); diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index 5fd5eb23..95e55cc6 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -22,6 +22,8 @@ #include "flx_fmt.h" #include "gstflxdec.h" +#define JIFFIE (1000000/70) + static GstCaps* flxdec_typefind(GstBuffer *buf, gpointer private); /* flx element information */ @@ -89,6 +91,9 @@ static void gst_flxdec_init (GstFlxDec *flxdec); static void gst_flxdec_loop (GstElement *element); +static GstElementStateReturn + gst_flxdec_change_state (GstElement *element); + static void gst_flxdec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); @@ -108,10 +113,10 @@ flxdec_typefind (GstBuffer *buf, gpointer private) guchar *data = GST_BUFFER_DATA(buf); GstCaps *new; - // check magic + /* check magic */ if ((data[4] == 0x11 || data[4] == 0x12 || data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) { - // check the frame type of the first frame + /* check the frame type of the first frame */ if ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1) { g_print("GstFlxDec: found supported flx format\n"); new = gst_caps_new("flxdec_typefind","video/fli", NULL); @@ -158,6 +163,7 @@ gst_flxdec_class_init (GstFlxDecClass *klass) gobject_class->set_property = NULL; gobject_class->get_property = NULL; + gstelement_class->change_state = gst_flxdec_change_state; } @@ -175,9 +181,9 @@ gst_flxdec_init(GstFlxDec *flxdec) gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad); flxdec->buf = NULL; - flxdec->offset = 0; - flxdec->new_buf = TRUE; - + flxdec->bs = NULL; + flxdec->frame = NULL; + flxdec->delta = NULL; } static void @@ -428,15 +434,13 @@ flx_get_data(GstFlxDec *flxdec, gulong size) g_return_val_if_fail (flxdec != NULL, NULL); - if (flxdec->new_buf) { - retbuf = gst_pad_pullregion(flxdec->sinkpad, - GST_REGION_OFFSET_LEN, 0, size); - flxdec->new_buf = FALSE; - flxdec->offset = size; - } else { - retbuf = gst_pad_pullregion(flxdec->sinkpad, GST_REGION_OFFSET_LEN, - flxdec->offset, size); - flxdec->offset += size; + retbuf = gst_bytestream_read (flxdec->bs, size); + if (!retbuf) { + GstEvent *event; + guint32 remaining; + + gst_bytestream_get_status (flxdec->bs, &remaining, &event); + gst_pad_event_default (flxdec->sinkpad, event); } return retbuf; @@ -461,33 +465,41 @@ gst_flxdec_loop (GstElement *element) flxdec = GST_FLXDEC(element); - databuf = flx_get_data(flxdec, FlxHeaderSize); - - g_return_if_fail (databuf != NULL); + if (flxdec->state == GST_FLXDEC_READ_HEADER) { + databuf = flx_get_data(flxdec, FlxHeaderSize); - data = GST_BUFFER_DATA(databuf); + data = GST_BUFFER_DATA(databuf); - memcpy((char *) &flxdec->hdr, data, sizeof(FlxHeader)); + memcpy((char *) &flxdec->hdr, data, sizeof(FlxHeader)); - gst_buffer_unref (databuf); + gst_buffer_unref (databuf); - flxh = &flxdec->hdr; + flxh = &flxdec->hdr; - // check header - if (flxh->type != FLX_MAGICHDR_FLI && + /* check header */ + if (flxh->type != FLX_MAGICHDR_FLI && flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) return; - g_print("GstFlxDec: size : %d\n", flxh->size); - g_print("GstFlxDec: frames : %d\n", flxh->frames); - g_print("GstFlxDec: width : %d\n", flxh->width); - g_print("GstFlxDec: height : %d\n", flxh->height); - g_print("GstFlxDec: depth : %d\n", flxh->depth); - g_print("GstFlxDec: speed : %d\n", flxh->speed); - - gst_pad_set_caps (flxdec->srcpad, + g_print("GstFlxDec: size : %d\n", flxh->size); + g_print("GstFlxDec: frames : %d\n", flxh->frames); + g_print("GstFlxDec: width : %d\n", flxh->width); + g_print("GstFlxDec: height : %d\n", flxh->height); + g_print("GstFlxDec: depth : %d\n", flxh->depth); + g_print("GstFlxDec: speed : %d\n", flxh->speed); + + flxdec->next_time = 0; + + if (flxh->type == FLX_MAGICHDR_FLI) { + flxdec->frame_time = JIFFIE * flxh->speed; + } + else { + flxdec->frame_time = flxh->speed * 1000; + } + + gst_pad_try_set_caps (flxdec->srcpad, gst_caps_new ( "src_video", "video/raw", @@ -503,41 +515,37 @@ gst_flxdec_loop (GstElement *element) "height", GST_PROPS_INT (flxh->height), NULL))); - if (flxh->depth <= 8) - flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height); - - if (flxh->type == FLX_MAGICHDR_FLC || - flxh->type == FLX_MAGICHDR_FLX) { - g_print("GstFlxDec: (FLC) aspect_dx : %d\n", - flxh->aspect_dx); - g_print("GstFlxDec: (FLC) aspect_dy : %d\n", - flxh->aspect_dy); - g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", - flxh->oframe1); - g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", - flxh->oframe2); - } + if (flxh->depth <= 8) + flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height); + + if (flxh->type == FLX_MAGICHDR_FLC || + flxh->type == FLX_MAGICHDR_FLX) { + g_print("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx); + g_print("GstFlxDec: (FLC) aspect_dy : %d\n", flxh->aspect_dy); + g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1); + g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2); + } - flxdec->size = (flxh->width * flxh->height); + flxdec->size = (flxh->width * flxh->height); - // create delta and output frame - flxdec->frame = gst_buffer_new(); - flxdec->delta = gst_buffer_new(); - GST_BUFFER_DATA(flxdec->frame) = g_malloc(flxdec->size); - GST_BUFFER_SIZE(flxdec->frame) = flxdec->size; - GST_BUFFER_DATA(flxdec->delta) = g_malloc(flxdec->size); - GST_BUFFER_SIZE(flxdec->delta) = flxdec->size; - - do - { + /* create delta and output frame */ + flxdec->frame = gst_buffer_new(); + flxdec->delta = gst_buffer_new(); + GST_BUFFER_DATA(flxdec->frame) = g_malloc(flxdec->size); + GST_BUFFER_SIZE(flxdec->frame) = flxdec->size; + GST_BUFFER_DATA(flxdec->delta) = g_malloc(flxdec->size); + GST_BUFFER_SIZE(flxdec->delta) = flxdec->size; + + flxdec->state = GST_FLXDEC_PLAYING; + } + else if (flxdec->state == GST_FLXDEC_PLAYING) { databuf = flx_get_data(flxdec, FlxFrameChunkSize); flxfh = (FlxFrameChunk *) GST_BUFFER_DATA(databuf); - switch(flxfh->id) - { + switch(flxfh->id) { case FLX_FRAME_TYPE: buf = flx_get_data(flxdec, flxfh->size-FlxFrameChunkSize); @@ -546,43 +554,74 @@ gst_flxdec_loop (GstElement *element) if (((FlxFrameType *)chunk)->chunks == 0) break; - // create 32 bits output frame + /* create 32 bits output frame */ flxdec->out = gst_buffer_new(); GST_BUFFER_DATA(flxdec->out) = g_malloc(flxdec->size * 4); GST_BUFFER_SIZE(flxdec->out) = flxdec->size * 4; - // decode chunks + /* decode chunks */ flx_decode_chunks(flxdec, ((FlxFrameType *)chunk)->chunks, GST_BUFFER_DATA(buf) + FlxFrameTypeSize, GST_BUFFER_DATA(flxdec->frame)); - // destroy input buffer + /* destroy input buffer*/ gst_buffer_unref(buf); - // save copy of the current frame for possible delta. + /* save copy of the current frame for possible delta. */ memcpy(GST_BUFFER_DATA(flxdec->delta), GST_BUFFER_DATA(flxdec->frame), GST_BUFFER_SIZE(flxdec->delta)); - // convert current frame. + /* convert current frame. */ flx_colorspace_convert(flxdec->converter, GST_BUFFER_DATA(flxdec->frame), GST_BUFFER_DATA(flxdec->out)); + GST_BUFFER_TIMESTAMP (flxdec->out) = flxdec->next_time; + flxdec->next_time += flxdec->frame_time; + gst_pad_push(flxdec->srcpad, flxdec->out); break; } - // destroy header buffer + /* destroy header buffer */ gst_buffer_unref(databuf); + } +} + +static GstElementStateReturn +gst_flxdec_change_state (GstElement *element) +{ + GstFlxDec *flxdec; + + flxdec = GST_FLXDEC(element); - gst_element_yield (element); + switch (GST_STATE_TRANSITION (element)) { + case GST_STATE_NULL_TO_READY: + flxdec->bs = gst_bytestream_new (flxdec->sinkpad); + break; + case GST_STATE_READY_TO_PAUSED: + flxdec->state = GST_FLXDEC_READ_HEADER; + break; + case GST_STATE_PAUSED_TO_PLAYING: + break; + case GST_STATE_PLAYING_TO_PAUSED: + break; + case GST_STATE_PAUSED_TO_READY: + gst_buffer_unref (flxdec->frame); + gst_buffer_unref (flxdec->delta); + break; + case GST_STATE_READY_TO_NULL: + gst_bytestream_destroy (flxdec->bs); + break; } - while (TRUE); + + parent_class->change_state (element); + return GST_STATE_SUCCESS; } static void @@ -622,6 +661,12 @@ plugin_init (GModule *module, GstPlugin *plugin) GstElementFactory *factory; GstTypeFactory *type; + /* this filter needs the bytestream package */ + if (!gst_library_load("gstbytestream")) { + gst_info("flxdec:: could not load support library: 'gstbytestream'\n"); + return FALSE; + } + factory = gst_elementfactory_new("flxdec", GST_TYPE_FLXDEC, &flxdec_details); g_return_val_if_fail(factory != NULL, FALSE); diff --git a/gst/flx/gstflxdec.h b/gst/flx/gstflxdec.h index cc4c94db..5b06252d 100644 --- a/gst/flx/gstflxdec.h +++ b/gst/flx/gstflxdec.h @@ -23,23 +23,35 @@ #include <gst/gst.h> #include "flx_color.h" +#include <gst/bytestream/bytestream.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +typedef enum { + GST_FLXDEC_READ_HEADER, + GST_FLXDEC_PLAYING, +} GstFlxDecState; + /* Definition of structure storing data for this element. */ typedef struct _GstFlxDec GstFlxDec; + struct _GstFlxDec { GstElement element; GstPad *sinkpad,*srcpad; - gboolean active, new_meta, new_buf; + gboolean active, new_meta; GstBuffer *buf, *out, *delta, *frame; - gulong offset, size; + GstByteStream *bs; + gulong size; + GstFlxDecState state; + glong frame_time; + gint64 next_time; FlxColorSpaceConverter *converter; @@ -64,9 +76,6 @@ struct _GstFlxDecClass { #define GST_IS_FLXDEC_CLASS(obj) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLXDEC)) -#define FLXDEC_BUFSIZE(buf, offset) \ - ((GST_BUFFER_OFFSET(buf) + GST_BUFFER_SIZE(buf)) - offset) - /* Standard function returning type information. */ GType gst_flxdec_get_type(void); diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index 872d5335..23dd6084 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -46,7 +46,8 @@ static void gst_alawdec_chain (GstPad *pad, GstBuffer *buf); static GstElementClass *parent_class = NULL; //static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; - +// +/* static GstPadNegotiateReturn alawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) { @@ -65,7 +66,7 @@ alawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) gst_caps_set(tempcaps,"width",GST_PROPS_INT(16)); gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(TRUE)); - if (gst_pad_set_caps (alawdec->srcpad, tempcaps)) + if (gst_pad_try_set_caps (alawdec->srcpad, tempcaps)) { return GST_PAD_NEGOTIATE_AGREE; } @@ -74,6 +75,7 @@ alawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) return GST_PAD_NEGOTIATE_FAIL; } } +*/ GType gst_alawdec_get_type(void) { @@ -115,7 +117,7 @@ gst_alawdec_init (GstALawDec *alawdec) { alawdec->sinkpad = gst_pad_new_from_template(alawdec_sink_template,"sink"); alawdec->srcpad = gst_pad_new_from_template(alawdec_src_template,"src"); - gst_pad_set_negotiate_function(alawdec->sinkpad, alawdec_negotiate_sink); + //gst_pad_set_negotiate_function(alawdec->sinkpad, alawdec_negotiate_sink); gst_element_add_pad(GST_ELEMENT(alawdec),alawdec->sinkpad); gst_pad_set_chain_function(alawdec->sinkpad,gst_alawdec_chain); diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index ab54bd16..ed4f6851 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -47,6 +47,7 @@ static void gst_alawenc_chain (GstPad *pad, GstBuffer *buf); static GstElementClass *parent_class = NULL; //static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; +/* static GstPadNegotiateReturn alawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) { @@ -65,7 +66,7 @@ alawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) gst_caps_set(tempcaps,"width",GST_PROPS_INT(8)); gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(FALSE)); - if (gst_pad_set_caps (alawenc->srcpad, tempcaps)) + if (gst_pad_try_set_caps (alawenc->srcpad, tempcaps)) { return GST_PAD_NEGOTIATE_AGREE; } @@ -74,6 +75,7 @@ alawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) return GST_PAD_NEGOTIATE_FAIL; } } +*/ GType gst_alawenc_get_type(void) { @@ -115,7 +117,7 @@ gst_alawenc_init (GstALawEnc *alawenc) { alawenc->sinkpad = gst_pad_new_from_template(alawenc_sink_template,"sink"); alawenc->srcpad = gst_pad_new_from_template(alawenc_src_template,"src"); - gst_pad_set_negotiate_function(alawenc->sinkpad, alawenc_negotiate_sink); + //gst_pad_set_negotiate_function(alawenc->sinkpad, alawenc_negotiate_sink); gst_element_add_pad(GST_ELEMENT(alawenc),alawenc->sinkpad); gst_pad_set_chain_function(alawenc->sinkpad,gst_alawenc_chain); diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index d93c6904..8e27c8fc 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -46,6 +46,7 @@ static void gst_mulawdec_chain (GstPad *pad, GstBuffer *buf); static GstElementClass *parent_class = NULL; //static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; +/* static GstPadNegotiateReturn mulawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) { @@ -64,7 +65,7 @@ mulawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) gst_caps_set(tempcaps,"width",GST_PROPS_INT(16)); gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(TRUE)); - if (gst_pad_set_caps (mulawdec->srcpad, tempcaps)) + if (gst_pad_try_set_caps (mulawdec->srcpad, tempcaps)) { return GST_PAD_NEGOTIATE_AGREE; } @@ -73,6 +74,7 @@ mulawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) return GST_PAD_NEGOTIATE_FAIL; } } +*/ GType gst_mulawdec_get_type(void) { @@ -114,7 +116,7 @@ gst_mulawdec_init (GstMuLawDec *mulawdec) { mulawdec->sinkpad = gst_pad_new_from_template(mulawdec_sink_template,"sink"); mulawdec->srcpad = gst_pad_new_from_template(mulawdec_src_template,"src"); - gst_pad_set_negotiate_function(mulawdec->sinkpad, mulawdec_negotiate_sink); + //gst_pad_set_negotiate_function(mulawdec->sinkpad, mulawdec_negotiate_sink); gst_element_add_pad(GST_ELEMENT(mulawdec),mulawdec->sinkpad); gst_pad_set_chain_function(mulawdec->sinkpad,gst_mulawdec_chain); diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index 40d868d9..3c88121c 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -46,6 +46,7 @@ static void gst_mulawenc_chain (GstPad *pad, GstBuffer *buf); static GstElementClass *parent_class = NULL; //static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; +/* static GstPadNegotiateReturn mulawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) { @@ -64,7 +65,7 @@ mulawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) gst_caps_set(tempcaps,"width",GST_PROPS_INT(8)); gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(FALSE)); - if (gst_pad_set_caps (mulawenc->srcpad, tempcaps)) + if (gst_pad_try_set_caps (mulawenc->srcpad, tempcaps)) { return GST_PAD_NEGOTIATE_AGREE; } @@ -73,6 +74,7 @@ mulawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) return GST_PAD_NEGOTIATE_FAIL; } } +*/ GType gst_mulawenc_get_type(void) { @@ -114,7 +116,7 @@ gst_mulawenc_init (GstMuLawEnc *mulawenc) { mulawenc->sinkpad = gst_pad_new_from_template(mulawenc_sink_template,"sink"); mulawenc->srcpad = gst_pad_new_from_template(mulawenc_src_template,"src"); - gst_pad_set_negotiate_function(mulawenc->sinkpad, mulawenc_negotiate_sink); + //gst_pad_set_negotiate_function(mulawenc->sinkpad, mulawenc_negotiate_sink); gst_element_add_pad(GST_ELEMENT(mulawenc),mulawenc->sinkpad); gst_pad_set_chain_function(mulawenc->sinkpad,gst_mulawenc_chain); diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c index cd839a32..4b24ce81 100644 --- a/gst/level/gstlevel.c +++ b/gst/level/gstlevel.c @@ -99,28 +99,6 @@ static void inline gst_level_fast_8bit_chain (gint8* data, gint8** out_data, static GstElementClass *parent_class = NULL; //static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; -static GstPadNegotiateReturn -level_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstLevel* filter = GST_LEVEL (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps); -} - -static GstPadNegotiateReturn -level_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstLevel* filter = GST_LEVEL (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy(pad,filter->srcpad,caps); -} - GType gst_level_get_type(void) { static GType level_type = 0; @@ -162,9 +140,6 @@ gst_level_init (GstLevel *filter) filter->sinkpad = gst_pad_new_from_template(level_sink_factory (),"sink"); filter->srcpad = gst_pad_new_from_template(level_src_factory (),"src"); - gst_pad_set_negotiate_function(filter->sinkpad,level_negotiate_sink); - gst_pad_set_negotiate_function(filter->srcpad,level_negotiate_src); - gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_pad_set_chain_function(filter->sinkpad,gst_level_chain); filter->srcpad = gst_pad_new("src",GST_PAD_SRC); diff --git a/gst/median/gstmedian.c b/gst/median/gstmedian.c index f0e836af..89a9a8c2 100644 --- a/gst/median/gstmedian.c +++ b/gst/median/gstmedian.c @@ -80,28 +80,6 @@ static void gst_median_get_property (GObject *object, guint prop_id, GValue *val static GstElementClass *parent_class = NULL; //static guint gst_median_signals[LAST_SIGNAL] = { 0 }; -static GstPadNegotiateReturn -median_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstMedian* filter = GST_MEDIAN (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy (pad, filter->sinkpad, caps); -} - -static GstPadNegotiateReturn -median_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) -{ - GstMedian* filter = GST_MEDIAN (gst_pad_get_parent (pad)); - - if (*caps==NULL) - return GST_PAD_NEGOTIATE_FAIL; - - return gst_pad_negotiate_proxy (pad, filter->srcpad, caps); -} - GType gst_median_get_type (void) { @@ -146,29 +124,32 @@ gst_median_class_init (GstMedianClass *klass) gobject_class->get_property = gst_median_get_property; } -static void -gst_median_newcaps (GstPad *pad, GstCaps *caps) +static gboolean +gst_median_sinkconnect (GstPad *pad, GstCaps *caps) { GstMedian *filter; filter = GST_MEDIAN (gst_pad_get_parent (pad)); + if (!GST_CAPS_IS_FIXED (caps)) + return GST_PAD_CONNECT_DELAYED; + filter->width = gst_caps_get_int (caps, "width"); filter->height = gst_caps_get_int (caps, "height"); + + return GST_PAD_CONNECT_OK; } void gst_median_init (GstMedian *median) { median->sinkpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (median_sink_factory), "sink"); - gst_pad_set_negotiate_function (median->sinkpad, median_negotiate_sink); - gst_pad_set_newcaps_function (median->sinkpad, gst_median_newcaps); + gst_pad_set_connect_function (median->sinkpad, gst_median_sinkconnect); gst_pad_set_chain_function (median->sinkpad, gst_median_chain); gst_element_add_pad (GST_ELEMENT (median), median->sinkpad); median->srcpad = gst_pad_new_from_template ( GST_PADTEMPLATE_GET (median_src_factory), "src"); - gst_pad_set_negotiate_function (median->srcpad, median_negotiate_src); gst_element_add_pad (GST_ELEMENT (median), median->srcpad); median->filtersize = 5; diff --git a/gst/udp/gstudpsink.c b/gst/udp/gstudpsink.c index 81d7a952..9d4143e2 100644 --- a/gst/udp/gstudpsink.c +++ b/gst/udp/gstudpsink.c @@ -111,8 +111,8 @@ gst_udpsink_class_init (GstUDPSink *klass) } -static void -gst_udpsink_newcaps (GstPad *pad, GstCaps *caps) +static GstPadConnectReturn +gst_udpsink_sinkconnect (GstPad *pad, GstCaps *caps) { GstUDPSink *udpsink; struct sockaddr_in serv_addr; @@ -127,15 +127,15 @@ gst_udpsink_newcaps (GstPad *pad, GstCaps *caps) fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (fd < 0) { - perror("socket"); - return; + perror("socket"); + return GST_PAD_CONNECT_REFUSED; } memset(&serv_addr, 0, sizeof(serv_addr)); /* its a name rather than an ipnum */ serverhost = gethostbyname(udpsink->host); if (serverhost == (struct hostent *)0) { perror("gethostbyname"); - return; + return GST_PAD_CONNECT_REFUSED; } memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length); @@ -145,7 +145,7 @@ gst_udpsink_newcaps (GstPad *pad, GstCaps *caps) if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) { g_printerr ("udpsink: connect to %s port %d failed: %s\n", udpsink->host, udpsink->port, sys_errlist[errno]); - return; + return GST_PAD_CONNECT_REFUSED; } f = fdopen (dup (fd), "wb"); @@ -159,6 +159,8 @@ gst_udpsink_newcaps (GstPad *pad, GstCaps *caps) fclose (f); close (fd); + + return GST_PAD_CONNECT_OK; } static void @@ -168,7 +170,7 @@ gst_udpsink_init (GstUDPSink *udpsink) udpsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); gst_element_add_pad (GST_ELEMENT (udpsink), udpsink->sinkpad); gst_pad_set_chain_function (udpsink->sinkpad, gst_udpsink_chain); - gst_pad_set_newcaps_function (udpsink->sinkpad, gst_udpsink_newcaps); + gst_pad_set_connect_function (udpsink->sinkpad, gst_udpsink_sinkconnect); udpsink->host = g_strdup (UDP_DEFAULT_HOST); udpsink->port = UDP_DEFAULT_PORT; diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 4400a064..7bd5df83 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -161,7 +161,7 @@ gst_udpsrc_get (GstPad *pad) doc = xmlParseMemory(buf, ret); caps = gst_caps_load_thyself(doc->xmlRootNode); - gst_pad_set_caps (udpsrc->srcpad, caps); + gst_pad_try_set_caps (udpsrc->srcpad, caps); #endif outbuf = NULL; diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 2e57da83..fc0e0984 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -256,21 +256,19 @@ gst_parsewav_chain (GstPad *pad, GstBuffer *buf) format = (GstParseWavFormat *)((guchar *) GST_BUFFER_DATA (buf) + fmt->offset); /* set the caps on the src pad */ - gst_pad_set_caps (parsewav->srcpad, gst_caps_new ( - "parsewav_src", - "audio/raw", - gst_props_new ( - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), //FIXME - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_BOOLEAN (TRUE), //FIXME - "width", GST_PROPS_INT (format->wBitsPerSample), - "depth", GST_PROPS_INT (format->wBitsPerSample), - "rate", GST_PROPS_INT (format->dwSamplesPerSec), - "channels", GST_PROPS_INT (format->wChannels), - NULL - ) - )); + gst_pad_try_set_caps (parsewav->srcpad, + GST_CAPS_NEW ( + "parsewav_src", + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), //FIXME + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_BOOLEAN (TRUE), //FIXME + "width", GST_PROPS_INT (format->wBitsPerSample), + "depth", GST_PROPS_INT (format->wBitsPerSample), + "rate", GST_PROPS_INT (format->dwSamplesPerSec), + "channels", GST_PROPS_INT (format->wChannels) + )); parsewav->bps = format->wBlockAlign; GST_DEBUG (0, "frequency %d, channels %d\n", |