diff --git a/configure.ac b/configure.ac index f22e5849c0..339a53d433 100644 --- a/configure.ac +++ b/configure.ac @@ -432,6 +432,14 @@ GST_CHECK_FEATURE(HTTP, [http plugins], gsthttpsrc, [ AC_SUBST(GST_HTTPSRC_GET_TYPE) ]) +dnl *** Jack *** +translit(dnm, m, l) AM_CONDITIONAL(USE_LCS, true) +GST_CHECK_FEATURE(LCS, Lcs, lcs, [ + PKG_CHECK_MODULES(LCS, lcs, HAVE_LCS="yes", HAVE_LCS="no") + AC_SUBST(LCS_CFLAGS) + AC_SUBST(LCS_LIBS) +]) + dnl *** Jack *** translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true) GST_CHECK_FEATURE(JACK, Jack, jack, [ @@ -796,6 +804,7 @@ ext/hermes/Makefile ext/http/Makefile ext/jack/Makefile ext/jpeg/Makefile +ext/lcs/Makefile ext/ladspa/Makefile ext/lame/Makefile ext/mad/Makefile diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c index 6b2c485483..2c8b8a01f3 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -318,7 +318,7 @@ gst_alsa_request_new_pad (GstElement *element, GstPadTemplate *templ, const gcha GList *l; GstAlsaPad *pad; - g_return_val_if_fail (this = GST_ALSA(element), NULL); + g_return_val_if_fail ((this = GST_ALSA(element)), NULL); /* you can't request a pad if the non-request pad is connected */ g_return_val_if_fail (this->data_interleaved == FALSE || @@ -510,22 +510,22 @@ gst_alsa_change_state(GstElement *element) static gboolean gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps) { - gint law, endianness, width, depth; + gint law, endianness, width, depth, channels; gboolean sign; gint format = -1; const gchar* format_name; - format_name = gst_caps_get_string(caps, "format"); + gst_caps_get_string(caps, "format", &format_name); if (format_name == NULL) { return FALSE; } else if (strcmp(format_name, "int")==0) { - width = gst_caps_get_int (caps, "width"); - depth = gst_caps_get_int (caps, "depth"); + gst_caps_get_int (caps, "width", &width); + gst_caps_get_int (caps, "depth", &depth); - law = gst_caps_get_int (caps, "law"); - endianness = gst_caps_get_int (caps, "endianness"); - sign = gst_caps_get_boolean (caps, "signed"); + gst_caps_get_int (caps, "law", &law); + gst_caps_get_int (caps, "endianness", &endianness); + gst_caps_get_boolean (caps, "signed", &sign); if (law == 0) { if (width == 8) { @@ -585,7 +585,11 @@ gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps) return FALSE; } } else if (strcmp(format_name, "float")==0) { - if (strcmp(gst_caps_get_string(caps, "layout"), "gfloat")==0) { + const gchar *layout; + + gst_caps_get_string(caps, "layout", &layout); + + if (strcmp(layout, "gfloat")==0) { format = SND_PCM_FORMAT_FLOAT; } else { return FALSE; @@ -597,10 +601,12 @@ gst_alsa_parse_caps (GstAlsa *this, GstCaps *caps) } this->format = format; - this->rate = gst_caps_get_int(caps, "rate"); + gst_caps_get_int(caps, "rate", &this->rate); + gst_caps_get_int(caps, "channels", &channels); + if (this->data_interleaved) - this->channels = gst_caps_get_int(caps, "channels"); - else if (gst_caps_get_int(caps, "channels") != 1) + this->channels = channels; + else if (channels != 1) return FALSE; return TRUE; diff --git a/ext/vorbis/vorbisenc.c b/ext/vorbis/vorbisenc.c index 7f2698e9e8..ce2a852d97 100644 --- a/ext/vorbis/vorbisenc.c +++ b/ext/vorbis/vorbisenc.c @@ -119,8 +119,8 @@ gst_vorbisenc_sinkconnect (GstPad * pad, GstCaps * caps) if (!GST_CAPS_IS_FIXED (caps)) return GST_PAD_CONNECT_DELAYED; - vorbisenc->channels = gst_caps_get_int (caps, "channels"); - vorbisenc->frequency = gst_caps_get_int (caps, "rate"); + gst_caps_get_int (caps, "channels", &vorbisenc->channels); + gst_caps_get_int (caps, "rate", &vorbisenc->frequency); gst_vorbisenc_setup (vorbisenc); @@ -165,8 +165,10 @@ gst_vorbisenc_setup (VorbisEnc * vorbisenc) /* add a comment */ vorbis_comment_init (&vorbisenc->vc); vorbis_comment_add (&vorbisenc->vc, (gchar *)comment); + /* gst_element_send_event (GST_ELEMENT (vorbisenc), gst_event_new_info ("comment", GST_PROPS_STRING (comment), NULL)); + */ /* set up the analysis state and auxiliary encoding storage */ vorbis_analysis_init (&vorbisenc->vd, &vorbisenc->vi); diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index a5dfd1eab8..7889bbe915 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -40,8 +40,8 @@ gst_audio_frame_byte_size (GstPad* pad) /* ERROR: could not get caps of pad */ return 0; - width = gst_caps_get_int (caps, "width"); - channels = gst_caps_get_int (caps, "channels"); + gst_caps_get_int (caps, "width", &width); + gst_caps_get_int (caps, "channels", &channels); return (width / 8) * channels; } @@ -73,6 +73,7 @@ gst_audio_frame_rate (GstPad *pad) */ { GstCaps *caps = NULL; + gint rate; /* get caps of pad */ caps = GST_PAD_CAPS (pad); @@ -80,8 +81,10 @@ gst_audio_frame_rate (GstPad *pad) if (caps == NULL) /* ERROR: could not get caps of pad */ return 0; - else - return gst_caps_get_int (caps, "rate"); + else { + gst_caps_get_int (caps, "rate", &rate); + return rate; + } } double @@ -95,7 +98,7 @@ gst_audio_length (GstPad* pad, GstBuffer* buf) long bytes = 0; int width = 0; int channels = 0; - long rate = 0L; + int rate = 0; double length; @@ -111,9 +114,9 @@ gst_audio_length (GstPad* pad, GstBuffer* buf) else { bytes = GST_BUFFER_SIZE (buf); - width = gst_caps_get_int (caps, "width"); - channels = gst_caps_get_int (caps, "channels"); - rate = gst_caps_get_int (caps, "rate"); + gst_caps_get_int (caps, "width", &width); + gst_caps_get_int (caps, "channels", &channels); + gst_caps_get_int (caps, "rate", &rate); length = (bytes * 8.0) / (double) (rate * channels * width); } @@ -134,8 +137,10 @@ gst_audio_highest_sample_value (GstPad* pad) /* FIXME : Please change this to a better warning method ! */ if (caps == NULL) printf ("WARNING: gstaudio: could not get caps of pad !\n"); - width = gst_caps_get_int (caps, "width"); - is_signed = gst_caps_get_boolean (caps, "signed"); + + gst_caps_get_int (caps, "width", &width); + gst_caps_get_boolean (caps, "signed", &is_signed); + if (is_signed) --width; /* example : 16 bit, signed : samples between -32768 and 32767 */ return ((long) (1 << width)); diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index 8913551781..bd48f18908 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -141,39 +141,52 @@ gst_adder_get_type(void) { static gboolean gst_adder_parse_caps (GstAdder *adder, GstCaps *caps) { - const gchar *format = gst_caps_get_string (caps, "format"); + const gchar *format; + + gst_caps_get_string (caps, "format", &format); if (adder->format == GST_ADDER_FORMAT_UNSET) { /* the caps haven't been set yet at all, so we need to go ahead and set all the relevant values. */ if (strcmp (format, "int") == 0) { adder->format = GST_ADDER_FORMAT_INT; - adder->width = gst_caps_get_int (caps, "width"); - adder->depth = gst_caps_get_int (caps, "depth"); - adder->law = gst_caps_get_int (caps, "law"); - adder->endianness = gst_caps_get_int (caps, "endianness"); - adder->is_signed = gst_caps_get_int (caps, "signed"); - adder->channels = gst_caps_get_int (caps, "channels"); + gst_caps_get_int (caps, "width", &adder->width); + gst_caps_get_int (caps, "depth", &adder->depth); + gst_caps_get_int (caps, "law", &adder->law); + gst_caps_get_int (caps, "endianness", &adder->endianness); + gst_caps_get_boolean (caps, "signed", &adder->is_signed); + gst_caps_get_int (caps, "channels", &adder->channels); } else if (strcmp (format, "float") == 0) { adder->format = GST_ADDER_FORMAT_FLOAT; - adder->layout = gst_caps_get_string (caps, "layout"); - adder->intercept = gst_caps_get_float (caps, "intercept"); - adder->slope = gst_caps_get_float (caps, "slope"); - adder->channels = gst_caps_get_int (caps, "channels"); + gst_caps_get_string (caps, "layout", &adder->layout); + gst_caps_get_float (caps, "intercept", &adder->intercept); + gst_caps_get_float (caps, "slope", &adder->slope); + gst_caps_get_int (caps, "channels", &adder->channels); } } else { /* otherwise, a previously-connected pad has set all the values. we should barf if some of the attempted new values don't match. */ if (strcmp (format, "int") == 0) { + gint width, channels; + gboolean is_signed; + + gst_caps_get_int (caps, "width", &width); + gst_caps_get_int (caps, "channels", &channels); + gst_caps_get_boolean (caps, "signed", &is_signed); + if ((adder->format != GST_ADDER_FORMAT_INT) || - (adder->width != gst_caps_get_int (caps, "width")) || - (adder->channels != gst_caps_get_int (caps, "channels")) || - (adder->is_signed != gst_caps_get_int (caps, "signed"))) { + (adder->width != width) || + (adder->channels != channels) || + (adder->is_signed != is_signed)) { return FALSE; } } else if (strcmp (format, "float") == 0) { + gint channels; + + gst_caps_get_int (caps, "channels", &channels); + if ((adder->format != GST_ADDER_FORMAT_FLOAT) || - (adder->channels != gst_caps_get_int (caps, "channels"))) { + (adder->channels != channels)) { return FALSE; } } else { diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index b6dc59686f..246a26bb40 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -166,12 +166,15 @@ gst_audioscale_sinkconnect (GstPad * pad, GstCaps * caps) { Audioscale *audioscale; resample_t *r; + gint rate; audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad)); r = audioscale->resample; - r->i_rate = gst_caps_get_int (caps, "rate"); - r->channels = gst_caps_get_int (caps, "channels"); + gst_caps_get_int (caps, "rate", &rate); + gst_caps_get_int (caps, "channels", &r->channels); + + r->i_rate = rate; resample_reinit(r); /*g_print("audioscale: unsupported scaling method %d\n", audioscale->method); */ diff --git a/gst/sine/Makefile.am b/gst/sine/Makefile.am index e14b7f83d2..364146bdab 100644 --- a/gst/sine/Makefile.am +++ b/gst/sine/Makefile.am @@ -10,7 +10,7 @@ libgstsinesrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) noinst_HEADERS = gstsinesrc.h if HAVE_GTK -noinst_PROGRAMS = demo-dparams +noinst_PROGRAMS = demo_dparams endif demo_dparams_SOURCES = demo-dparams.c diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index b4922d5d2a..4d24a3056b 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -191,9 +191,9 @@ gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps) return GST_PAD_CONNECT_DELAYED; } - videoscale->width = gst_caps_get_int (caps, "width"); - videoscale->height = gst_caps_get_int (caps, "height"); - videoscale->format = gst_caps_get_int (caps, "format"); + gst_caps_get_int (caps, "width", &videoscale->width); + gst_caps_get_int (caps, "height", &videoscale->height); + gst_caps_get_int (caps, "format", &videoscale->format); gst_videoscale_setup(videoscale); @@ -256,7 +256,7 @@ gst_videoscale_chain (GstPad *pad, GstBuffer *buf) size = GST_BUFFER_SIZE(buf); if(!videoscale->scale_cc){ - videoscale->format = gst_caps_get_int (gst_pad_get_caps(pad), "format"); + gst_caps_get_int (gst_pad_get_caps(pad), "format", &videoscale->format); gst_videoscale_setup(videoscale); } GST_DEBUG (0,"gst_videoscale_chain: got buffer of %ld bytes in '%s'",size, diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 60d411909b..b4adec6ee5 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -137,18 +137,19 @@ volume_parse_caps (GstVolume *filter, GstCaps *caps) g_return_val_if_fail(filter!=NULL,-1); g_return_val_if_fail(caps!=NULL,-1); - format = gst_caps_get_string(caps, "format"); + gst_caps_get_string (caps, "format", &format); - filter->rate = gst_caps_get_int (caps, "rate"); - filter->channels = gst_caps_get_int (caps, "channels"); + gst_caps_get_int (caps, "rate", &filter->rate); + gst_caps_get_int (caps, "channels", &filter->channels); if (strcmp(format, "int")==0) { filter->format = GST_VOLUME_FORMAT_INT; - filter->width = gst_caps_get_int (caps, "width"); - filter->depth = gst_caps_get_int (caps, "depth"); - filter->law = gst_caps_get_int (caps, "law"); - filter->endianness = gst_caps_get_int (caps, "endianness"); - filter->is_signed = gst_caps_get_int (caps, "signed"); + gst_caps_get_int (caps, "width", &filter->width); + gst_caps_get_int (caps, "depth", &filter->depth); + gst_caps_get_int (caps, "law", &filter->law); + gst_caps_get_int (caps, "endianness", &filter->endianness); + gst_caps_get_int (caps, "signed", &filter->is_signed); + if (!filter->silent) { g_print ("Volume : channels %d, rate %d\n", filter->channels, filter->rate); @@ -157,9 +158,10 @@ volume_parse_caps (GstVolume *filter, GstCaps *caps) } } else if (strcmp(format, "float")==0) { filter->format = GST_VOLUME_FORMAT_FLOAT; - filter->layout = gst_caps_get_string(caps, "layout"); - filter->intercept = gst_caps_get_float(caps, "intercept"); - filter->slope = gst_caps_get_float(caps, "slope"); + gst_caps_get_string (caps, "layout", &filter->layout); + gst_caps_get_float (caps, "intercept", &filter->intercept); + gst_caps_get_float (caps, "slope", &filter->slope); + if (!filter->silent) { g_print ("Volume : channels %d, rate %d\n", filter->channels, filter->rate); diff --git a/sys/v4l/gstv4lmjpegsink.c b/sys/v4l/gstv4lmjpegsink.c index ebb051e507..09960101ca 100644 --- a/sys/v4l/gstv4lmjpegsink.c +++ b/sys/v4l/gstv4lmjpegsink.c @@ -191,8 +191,8 @@ gst_v4lmjpegsink_sinkconnect (GstPad *pad, for (caps = vscapslist; caps != NULL; caps = vscapslist = vscapslist->next) { - v4lmjpegsink->width = gst_caps_get_int (caps, "width"); - v4lmjpegsink->height = gst_caps_get_int (caps, "height"); + gst_caps_get_int (caps, "width", &v4lmjpegsink->width); + gst_caps_get_int (caps, "height", &v4lmjpegsink->height); if (!gst_v4lmjpegsink_set_playback(v4lmjpegsink, v4lmjpegsink->width, v4lmjpegsink->height, diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index e7126db7af..ebe0b3b3ad 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -187,53 +187,62 @@ gst_v4lsrc_srcconnect (GstPad *pad, /* TODO: caps = gst_caps_normalize(capslist); */ for (caps = vscapslist ; caps != NULL ; caps = vscapslist = vscapslist->next) { + guint32 fourcc; + gint depth; + + gst_caps_get_fourcc_int (caps, "format", &fourcc); + if (v4lsrc->palette > 0) { switch (v4lsrc->palette) { case VIDEO_PALETTE_YUV420P: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('I','4','2','0') && - gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('I','Y','U','V')) + if (fourcc != GST_MAKE_FOURCC('I','4','2','0') && + fourcc != GST_MAKE_FOURCC('I','Y','U','V')) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5; goto try_caps; case VIDEO_PALETTE_YUV422: case VIDEO_PALETTE_YUYV: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('Y','U','Y','2')) + if (fourcc != GST_MAKE_FOURCC('Y','U','Y','2')) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2; goto try_caps; case VIDEO_PALETTE_UYVY: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('U','Y','V','Y')) + if (fourcc != GST_MAKE_FOURCC('U','Y','V','Y')) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2; goto try_caps; case VIDEO_PALETTE_YUV411: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('Y','4','1','P')) + if (fourcc != GST_MAKE_FOURCC('Y','4','1','P')) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5; goto try_caps; case VIDEO_PALETTE_RGB555: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') || - gst_caps_get_int(caps, "depth") != 15) + depth = gst_caps_get_int (caps, "depth", &depth); + if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') || + depth != 15) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2; goto try_caps; case VIDEO_PALETTE_RGB565: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') || - gst_caps_get_int(caps, "depth") != 16) + depth = gst_caps_get_int (caps, "depth", &depth); + if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') || + depth != 16) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 2; goto try_caps; case VIDEO_PALETTE_RGB24: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') || - gst_caps_get_int(caps, "depth") != 24) + depth = gst_caps_get_int (caps, "depth", &depth); + if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') || + depth != 24) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 3; goto try_caps; case VIDEO_PALETTE_RGB32: - if (gst_caps_get_fourcc_int (caps, "format") != GST_MAKE_FOURCC('R','G','B',' ') || - gst_caps_get_int(caps, "depth") != 32) + depth = gst_caps_get_int (caps, "depth", &depth); + if (fourcc != GST_MAKE_FOURCC('R','G','B',' ') || + depth != 32) goto try_next; v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 4; goto try_caps; @@ -243,7 +252,7 @@ gst_v4lsrc_srcconnect (GstPad *pad, } else { - switch (gst_caps_get_fourcc_int(caps, "format")) + switch (fourcc) { case GST_MAKE_FOURCC('I','4','2','0'): case GST_MAKE_FOURCC('I','Y','U','V'): @@ -263,7 +272,8 @@ gst_v4lsrc_srcconnect (GstPad *pad, v4lsrc->buffer_size = v4lsrc->width * v4lsrc->height * 1.5; goto try_caps; case GST_MAKE_FOURCC('R','G','B',' '): - switch (gst_caps_get_int(caps, "depth")) + depth = gst_caps_get_int (caps, "depth", &depth); + switch (depth) { case 15: palette = VIDEO_PALETTE_RGB555; @@ -301,24 +311,32 @@ gst_v4lsrc_srcconnect (GstPad *pad, continue; /* try to connect the pad/caps with the actual width/height */ - if (palette >= VIDEO_PALETTE_RGB565 && palette <= VIDEO_PALETTE_RGB555) + if (palette >= VIDEO_PALETTE_RGB565 && palette <= VIDEO_PALETTE_RGB555) { + gint depth; + gint bpp; + + gst_caps_get_int(caps, "bpp", &bpp), + gst_caps_get_int(caps, "depth", &depth), + newcaps = gst_caps_new("v4lsrc_caps", "video/raw", gst_props_new( - "format", GST_PROPS_FOURCC(gst_caps_get_fourcc_int(caps, "format")), + "format", GST_PROPS_FOURCC(fourcc), "width", GST_PROPS_INT(v4lsrc->width), "height", GST_PROPS_INT(v4lsrc->height), - "bpp", GST_PROPS_INT(gst_caps_get_int(caps, "bpp")), - "depth", GST_PROPS_INT(gst_caps_get_int(caps, "depth")), + "bpp", GST_PROPS_INT(bpp), + "depth", GST_PROPS_INT(depth), NULL ) ); - else + } + else { newcaps = gst_caps_new("v4lsrc_caps", "video/raw", gst_props_new( - "format", GST_PROPS_FOURCC(gst_caps_get_fourcc_int(caps, "format")), + "format", GST_PROPS_FOURCC(fourcc), "width", GST_PROPS_INT(v4lsrc->width), "height", GST_PROPS_INT(v4lsrc->height), NULL ) ); + } gst_caps_debug (newcaps, "new caps to set on v4lsrc's src pad"); @@ -442,7 +460,6 @@ static GstElementStateReturn gst_v4lsrc_change_state (GstElement *element) { GstV4lSrc *v4lsrc; - GstElementStateReturn parent_value; gint transition = GST_STATE_TRANSITION (element); guint32 fourcc; gint depth=0, bpp=0; @@ -491,6 +508,8 @@ gst_v4lsrc_change_state (GstElement *element) case VIDEO_PALETTE_UYVY: fourcc = GST_MAKE_FOURCC('U','Y','V','Y'); break; + default: + return GST_STATE_FAILURE; } if (bpp && depth) caps = gst_caps_new("v4lsrc_caps",