From: David S. <ds...@pd...> - 2004-02-14 02:20:08
|
CVS Root: /home/cvs/gstreamer Module: gst-plugins Changes by: ds Date: Fri Feb 13 2004 18:17:52 PST Log message: * gst/silence/gstsilence.c: (gst_silence_class_init), (gst_silence_set_clock), (gst_silence_get), (gst_silence_set_property), (gst_silence_get_property): * gst/silence/gstsilence.h: Add sync property. * gst/sine/gstsinesrc.c: (gst_sinesrc_class_init), (gst_sinesrc_init), (gst_sinesrc_set_clock), (gst_sinesrc_get), (gst_sinesrc_set_property), (gst_sinesrc_get_property): * gst/sine/gstsinesrc.h: Add sync property. Modified files: . : ChangeLog gst/silence : gstsilence.c gstsilence.h gst/sine : gstsinesrc.c gstsinesrc.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.302&r2=1.303 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/silence/gstsilence.c.diff?r1=1.17&r2=1.18 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/silence/gstsilence.h.diff?r1=1.3&r2=1.4 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/sine/gstsinesrc.c.diff?r1=1.37&r2=1.38 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/sine/gstsinesrc.h.diff?r1=1.10&r2=1.11 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.302 retrieving revision 1.303 diff -u -d -r1.302 -r1.303 --- ChangeLog 13 Feb 2004 21:06:00 -0000 1.302 +++ ChangeLog 14 Feb 2004 02:17:40 -0000 1.303 @@ -1,5 +1,16 @@ 2004-02-13 David Schleef <ds...@sc...> + * gst/silence/gstsilence.c: (gst_silence_class_init), + (gst_silence_set_clock), (gst_silence_get), + (gst_silence_set_property), (gst_silence_get_property): + * gst/silence/gstsilence.h: Add sync property. + * gst/sine/gstsinesrc.c: (gst_sinesrc_class_init), + (gst_sinesrc_init), (gst_sinesrc_set_clock), (gst_sinesrc_get), + (gst_sinesrc_set_property), (gst_sinesrc_get_property): + * gst/sine/gstsinesrc.h: Add sync property. + +2004-02-13 David Schleef <ds...@sc...> + * gst/intfloat/gstint2float.c: (conv_f32_s16), (gst_int2float_chain_gint16): Change stdint usage to glib types. Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.302 retrieving revision 1.303 diff -u -d -r1.302 -r1.303 --- ChangeLog 13 Feb 2004 21:06:00 -0000 1.302 +++ ChangeLog 14 Feb 2004 02:17:40 -0000 1.303 @@ -1,5 +1,16 @@ 2004-02-13 David Schleef <ds...@sc...> + * gst/silence/gstsilence.c: (gst_silence_class_init), + (gst_silence_set_clock), (gst_silence_get), + (gst_silence_set_property), (gst_silence_get_property): + * gst/silence/gstsilence.h: Add sync property. + * gst/sine/gstsinesrc.c: (gst_sinesrc_class_init), + (gst_sinesrc_init), (gst_sinesrc_set_clock), (gst_sinesrc_get), + (gst_sinesrc_set_property), (gst_sinesrc_get_property): + * gst/sine/gstsinesrc.h: Add sync property. + +2004-02-13 David Schleef <ds...@sc...> + * gst/intfloat/gstint2float.c: (conv_f32_s16), (gst_int2float_chain_gint16): Change stdint usage to glib types. Index: gstsilence.c =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/silence/gstsilence.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- gstsilence.c 2 Feb 2004 17:23:30 -0000 1.17 +++ gstsilence.c 14 Feb 2004 02:17:40 -0000 1.18 @@ -35,7 +35,8 @@ enum { ARG_0, - ARG_BYTESPERREAD + ARG_BYTESPERREAD, + ARG_SYNC }; /* elementfactory information */ @@ -79,6 +80,7 @@ GParamSpec *pspec); static GstElementStateReturn gst_silence_change_state (GstElement *element); +static void gst_silence_set_clock (GstElement *element, GstClock *clock); static GstData *gst_silence_get (GstPad *pad); static GstPadLinkReturn @@ -141,11 +143,25 @@ g_param_spec_ulong("bytes_per_read","Bytes per read", "Bytes per buffer in one cycle", 0,G_MAXULONG,0,G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, + g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", + TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_silence_set_property; gobject_class->get_property = gst_silence_get_property; gstelement_class->change_state = gst_silence_change_state; + gstelement_class->set_clock = gst_silence_set_clock; +} + +static void +gst_silence_set_clock (GstElement *element, GstClock *clock) +{ + GstSilence *silence; + + silence = GST_SILENCE (element); + + gst_object_replace ((GstObject **)&silence->clock, (GstObject *)clock); } static void @@ -267,6 +283,9 @@ buf = gst_buffer_new_and_alloc (src->bytes_per_read); GST_BUFFER_OFFSET (buf) = src->offset; GST_BUFFER_TIMESTAMP (buf) = src->timestamp; + if (src->sync && src->clock) { + gst_element_wait (GST_ELEMENT (src), GST_BUFFER_TIMESTAMP (buf)); + } GST_BUFFER_DURATION (buf) = tdiff; GST_BUFFER_SIZE (buf) = src->bytes_per_read; @@ -296,6 +315,9 @@ case ARG_BYTESPERREAD: src->bytes_per_read = g_value_get_ulong (value); break; + case ARG_SYNC: + src->sync = g_value_get_boolean (value); + break; default: break; } @@ -318,6 +340,9 @@ case ARG_BYTESPERREAD: g_value_set_ulong (value, src->bytes_per_read); break; + case ARG_SYNC: + g_value_set_boolean (value, src->sync); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; Index: gstsilence.h =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/silence/gstsilence.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstsilence.h 14 Dec 2003 21:22:34 -0000 1.3 +++ gstsilence.h 14 Feb 2004 02:17:40 -0000 1.4 @@ -45,6 +45,7 @@ GstPad *srcpad; glong bytes_per_read; + gboolean sync; gint law; gint frequency; gint channels; @@ -52,6 +53,8 @@ guint64 samples; guint64 offset; guint64 timestamp; + + GstClock *clock; }; struct _GstSilenceClass { Index: gstsilence.c =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/silence/gstsilence.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- gstsilence.c 2 Feb 2004 17:23:30 -0000 1.17 +++ gstsilence.c 14 Feb 2004 02:17:40 -0000 1.18 @@ -35,7 +35,8 @@ enum { ARG_0, - ARG_BYTESPERREAD + ARG_BYTESPERREAD, + ARG_SYNC }; /* elementfactory information */ @@ -79,6 +80,7 @@ GParamSpec *pspec); static GstElementStateReturn gst_silence_change_state (GstElement *element); +static void gst_silence_set_clock (GstElement *element, GstClock *clock); static GstData *gst_silence_get (GstPad *pad); static GstPadLinkReturn @@ -141,11 +143,25 @@ g_param_spec_ulong("bytes_per_read","Bytes per read", "Bytes per buffer in one cycle", 0,G_MAXULONG,0,G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, + g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", + TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_silence_set_property; gobject_class->get_property = gst_silence_get_property; gstelement_class->change_state = gst_silence_change_state; + gstelement_class->set_clock = gst_silence_set_clock; +} + +static void +gst_silence_set_clock (GstElement *element, GstClock *clock) +{ + GstSilence *silence; + + silence = GST_SILENCE (element); + + gst_object_replace ((GstObject **)&silence->clock, (GstObject *)clock); } static void @@ -267,6 +283,9 @@ buf = gst_buffer_new_and_alloc (src->bytes_per_read); GST_BUFFER_OFFSET (buf) = src->offset; GST_BUFFER_TIMESTAMP (buf) = src->timestamp; + if (src->sync && src->clock) { + gst_element_wait (GST_ELEMENT (src), GST_BUFFER_TIMESTAMP (buf)); + } GST_BUFFER_DURATION (buf) = tdiff; GST_BUFFER_SIZE (buf) = src->bytes_per_read; @@ -296,6 +315,9 @@ case ARG_BYTESPERREAD: src->bytes_per_read = g_value_get_ulong (value); break; + case ARG_SYNC: + src->sync = g_value_get_boolean (value); + break; default: break; } @@ -318,6 +340,9 @@ case ARG_BYTESPERREAD: g_value_set_ulong (value, src->bytes_per_read); break; + case ARG_SYNC: + g_value_set_boolean (value, src->sync); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; Index: gstsilence.h =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/silence/gstsilence.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstsilence.h 14 Dec 2003 21:22:34 -0000 1.3 +++ gstsilence.h 14 Feb 2004 02:17:40 -0000 1.4 @@ -45,6 +45,7 @@ GstPad *srcpad; glong bytes_per_read; + gboolean sync; gint law; gint frequency; gint channels; @@ -52,6 +53,8 @@ guint64 samples; guint64 offset; guint64 timestamp; + + GstClock *clock; }; struct _GstSilenceClass { Index: gstsinesrc.c =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/sine/gstsinesrc.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- gstsinesrc.c 12 Feb 2004 18:18:51 -0000 1.37 +++ gstsinesrc.c 14 Feb 2004 02:17:40 -0000 1.38 @@ -52,6 +52,7 @@ ARG_SAMPLES_PER_BUFFER, ARG_FREQ, ARG_VOLUME, + ARG_SYNC }; static GstStaticPadTemplate gst_sinesrc_src_template = @@ -86,6 +87,7 @@ const GstCaps *caps); static GstElementStateReturn gst_sinesrc_change_state (GstElement *element); +static void gst_sinesrc_set_clock (GstElement *element, GstClock *clock); static void gst_sinesrc_update_freq (const GValue *value, gpointer data); @@ -159,12 +161,16 @@ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME, g_param_spec_double ("volume", "Volume", "Volume", 0.0, 1.0, 0.8, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, + g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", + TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_sinesrc_set_property; gobject_class->get_property = gst_sinesrc_get_property; gobject_class->dispose = gst_sinesrc_dispose; gstelement_class->change_state = gst_sinesrc_change_state; + gstelement_class->set_clock = gst_sinesrc_set_clock; } static void @@ -182,6 +188,7 @@ src->samplerate = 44100; src->volume = 1.0; src->freq = 440.0; + src->sync = TRUE; src->table_pos = 0.0; src->table_size = 1024; @@ -228,6 +235,14 @@ GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); } +static void +gst_sinesrc_set_clock (GstElement *element, GstClock *clock) +{ + GstSineSrc *sinesrc = GST_SINESRC (element); + + gst_object_replace ((GstObject **)&sinesrc->clock, (GstObject *)clock); +} + static GstCaps * gst_sinesrc_src_fixate (GstPad *pad, const GstCaps *caps) { @@ -345,6 +360,11 @@ buf = gst_buffer_new_and_alloc (src->samples_per_buffer * 2); GST_BUFFER_TIMESTAMP(buf) = src->timestamp; + if (src->sync) { + if (src->clock) { + gst_element_wait (GST_ELEMENT(src), GST_BUFFER_TIMESTAMP (buf)); + } + } GST_BUFFER_OFFSET (buf) = src->offset; GST_BUFFER_DURATION (buf) = tdiff; @@ -430,6 +450,9 @@ gst_dpman_bypass_dparam (src->dpman, "volume"); src->volume = g_value_get_double (value); break; + case ARG_SYNC: + src->sync = g_value_get_boolean (value); + break; default: break; } @@ -458,6 +481,9 @@ case ARG_VOLUME: g_value_set_double (value, src->volume); break; + case ARG_SYNC: + g_value_set_boolean (value, src->sync); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; Index: gstsinesrc.h =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/sine/gstsinesrc.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- gstsinesrc.h 15 Jan 2004 21:05:17 -0000 1.10 +++ gstsinesrc.h 14 Feb 2004 02:17:40 -0000 1.11 @@ -57,6 +57,7 @@ /* parameters */ gdouble volume; gdouble freq; + gboolean sync; /* lookup table data */ gdouble *table_data; @@ -79,6 +80,8 @@ gdouble accumulator; gboolean tags_pushed; + + GstClock *clock; }; struct _GstSineSrcClass { Index: gstsinesrc.c =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/sine/gstsinesrc.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- gstsinesrc.c 12 Feb 2004 18:18:51 -0000 1.37 +++ gstsinesrc.c 14 Feb 2004 02:17:40 -0000 1.38 @@ -52,6 +52,7 @@ ARG_SAMPLES_PER_BUFFER, ARG_FREQ, ARG_VOLUME, + ARG_SYNC }; static GstStaticPadTemplate gst_sinesrc_src_template = @@ -86,6 +87,7 @@ const GstCaps *caps); static GstElementStateReturn gst_sinesrc_change_state (GstElement *element); +static void gst_sinesrc_set_clock (GstElement *element, GstClock *clock); static void gst_sinesrc_update_freq (const GValue *value, gpointer data); @@ -159,12 +161,16 @@ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VOLUME, g_param_spec_double ("volume", "Volume", "Volume", 0.0, 1.0, 0.8, G_PARAM_READWRITE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC, + g_param_spec_boolean ("sync", "Sync", "Synchronize to clock", + TRUE, G_PARAM_READWRITE)); gobject_class->set_property = gst_sinesrc_set_property; gobject_class->get_property = gst_sinesrc_get_property; gobject_class->dispose = gst_sinesrc_dispose; gstelement_class->change_state = gst_sinesrc_change_state; + gstelement_class->set_clock = gst_sinesrc_set_clock; } static void @@ -182,6 +188,7 @@ src->samplerate = 44100; src->volume = 1.0; src->freq = 440.0; + src->sync = TRUE; src->table_pos = 0.0; src->table_size = 1024; @@ -228,6 +235,14 @@ GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object)); } +static void +gst_sinesrc_set_clock (GstElement *element, GstClock *clock) +{ + GstSineSrc *sinesrc = GST_SINESRC (element); + + gst_object_replace ((GstObject **)&sinesrc->clock, (GstObject *)clock); +} + static GstCaps * gst_sinesrc_src_fixate (GstPad *pad, const GstCaps *caps) { @@ -345,6 +360,11 @@ buf = gst_buffer_new_and_alloc (src->samples_per_buffer * 2); GST_BUFFER_TIMESTAMP(buf) = src->timestamp; + if (src->sync) { + if (src->clock) { + gst_element_wait (GST_ELEMENT(src), GST_BUFFER_TIMESTAMP (buf)); + } + } GST_BUFFER_OFFSET (buf) = src->offset; GST_BUFFER_DURATION (buf) = tdiff; @@ -430,6 +450,9 @@ gst_dpman_bypass_dparam (src->dpman, "volume"); src->volume = g_value_get_double (value); break; + case ARG_SYNC: + src->sync = g_value_get_boolean (value); + break; default: break; } @@ -458,6 +481,9 @@ case ARG_VOLUME: g_value_set_double (value, src->volume); break; + case ARG_SYNC: + g_value_set_boolean (value, src->sync); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; Index: gstsinesrc.h =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/gst/sine/gstsinesrc.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- gstsinesrc.h 15 Jan 2004 21:05:17 -0000 1.10 +++ gstsinesrc.h 14 Feb 2004 02:17:40 -0000 1.11 @@ -57,6 +57,7 @@ /* parameters */ gdouble volume; gdouble freq; + gboolean sync; /* lookup table data */ gdouble *table_data; @@ -79,6 +80,8 @@ gdouble accumulator; gboolean tags_pushed; + + GstClock *clock; }; struct _GstSineSrcClass { |