From: <rb...@fr...> - 2005-02-01 17:27:02
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: rbultje Date: Tue Feb 01 2005 09:26:56 PST Branch: BRANCH-THREADED Log message: * gst/gstelement.h: * gst/gstutils.c: (gst_element_populate_std_props), (gst_element_class_install_std_props): * gst/gstutils.h: Re-add gst_element_class_install_std_props, move to gstutils.h. Modified files: . : ChangeLog gst : gstelement.h gstutils.c gstutils.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.858.2.27&r2=1.858.2.28 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstelement.h.diff?r1=1.177.2.9&r2=1.177.2.10 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstutils.c.diff?r1=1.48.2.7&r2=1.48.2.8 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstutils.h.diff?r1=1.26.2.1&r2=1.26.2.2 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.858.2.27 retrieving revision 1.858.2.28 diff -u -d -r1.858.2.27 -r1.858.2.28 --- ChangeLog 26 Jan 2005 14:29:05 -0000 1.858.2.27 +++ ChangeLog 1 Feb 2005 17:26:43 -0000 1.858.2.28 @@ -1,3 +1,11 @@ +2005-02-01 Ronald S. Bultje <rb...@ro...> + + * gst/gstelement.h: + * gst/gstutils.c: (gst_element_populate_std_props), + (gst_element_class_install_std_props): + * gst/gstutils.h: + Re-add gst_element_class_install_std_props, move to gstutils.h. 2005-01-26 Wim Taymans <wi...@fl...> * gst/elements/gstidentity.c: (gst_identity_init), Index: gstelement.h RCS file: /cvs/gstreamer/gstreamer/gst/gstelement.h,v retrieving revision 1.177.2.9 retrieving revision 1.177.2.10 diff -u -d -r1.177.2.9 -r1.177.2.10 --- gstelement.h 18 Jan 2005 10:52:08 -0000 1.177.2.9 +++ gstelement.h 1 Feb 2005 17:26:44 -0000 1.177.2.10 @@ -273,8 +273,6 @@ /* class stuff */ void gst_element_class_add_pad_template (GstElementClass * klass, GstPadTemplate * templ); -void gst_element_class_install_std_props (GstElementClass * klass, - const gchar * first_name, ...); void gst_element_class_set_details (GstElementClass * klass, const GstElementDetails * details); GstPadTemplate *gst_element_class_get_pad_template (GstElementClass * Index: gstutils.c RCS file: /cvs/gstreamer/gstreamer/gst/gstutils.c,v retrieving revision 1.48.2.7 retrieving revision 1.48.2.8 diff -u -d -r1.48.2.7 -r1.48.2.8 --- gstutils.c 18 Jan 2005 10:52:08 -0000 1.48.2.7 +++ gstutils.c 1 Feb 2005 17:26:44 -0000 1.48.2.8 @@ -1416,3 +1416,122 @@ va_end (args); } +static void +gst_element_populate_std_props (GObjectClass * klass, const gchar * prop_name, + guint arg_id, GParamFlags flags) +{ + GQuark prop_id = g_quark_from_string (prop_name); + GParamSpec *pspec; + static GQuark fd_id = 0; + static GQuark blocksize_id; + static GQuark bytesperread_id; + static GQuark dump_id; + static GQuark filesize_id; + static GQuark mmapsize_id; + static GQuark location_id; + static GQuark offset_id; + static GQuark silent_id; + static GQuark touch_id; + if (!fd_id) { + fd_id = g_quark_from_static_string ("fd"); + blocksize_id = g_quark_from_static_string ("blocksize"); + bytesperread_id = g_quark_from_static_string ("bytesperread"); + dump_id = g_quark_from_static_string ("dump"); + filesize_id = g_quark_from_static_string ("filesize"); + mmapsize_id = g_quark_from_static_string ("mmapsize"); + location_id = g_quark_from_static_string ("location"); + offset_id = g_quark_from_static_string ("offset"); + silent_id = g_quark_from_static_string ("silent"); + touch_id = g_quark_from_static_string ("touch"); + } + if (prop_id == fd_id) { + pspec = g_param_spec_int ("fd", "File-descriptor", + "File-descriptor for the file being read", 0, G_MAXINT, 0, flags); + } else if (prop_id == blocksize_id) { + pspec = g_param_spec_ulong ("blocksize", "Block Size", + "Block size to read per buffer", 0, G_MAXULONG, 4096, flags); + } else if (prop_id == bytesperread_id) { + pspec = g_param_spec_int ("bytesperread", "Bytes per read", + "Number of bytes to read per buffer", G_MININT, G_MAXINT, 0, flags); + } else if (prop_id == dump_id) { + pspec = g_param_spec_boolean ("dump", "Dump", + "Dump bytes to stdout", FALSE, flags); + } else if (prop_id == filesize_id) { + pspec = g_param_spec_int64 ("filesize", "File Size", + "Size of the file being read", 0, G_MAXINT64, 0, flags); + } else if (prop_id == mmapsize_id) { + pspec = g_param_spec_ulong ("mmapsize", "mmap() Block Size", + "Size in bytes of mmap()d regions", 0, G_MAXULONG, 4 * 1048576, flags); + } else if (prop_id == location_id) { + pspec = g_param_spec_string ("location", "File Location", + "Location of the file to read", NULL, flags); + } else if (prop_id == offset_id) { + pspec = g_param_spec_int64 ("offset", "File Offset", + "Byte offset of current read pointer", 0, G_MAXINT64, 0, flags); + } else if (prop_id == silent_id) { + pspec = g_param_spec_boolean ("silent", "Silent", "Don't produce events", + FALSE, flags); + } else if (prop_id == touch_id) { + pspec = g_param_spec_boolean ("touch", "Touch read data", + "Touch data to force disk read before " "push ()", TRUE, flags); + } else { + g_warning ("Unknown - 'standard' property '%s' id %d from klass %s", + prop_name, arg_id, g_type_name (G_OBJECT_CLASS_TYPE (klass))); + pspec = NULL; + if (pspec) { + g_object_class_install_property (klass, arg_id, pspec); +} +/** + * gst_element_class_install_std_props: + * @klass: the #GstElementClass to add the properties to. + * @first_name: the name of the first property. + * in a NULL terminated + * @...: the id and flags of the first property, followed by + * further 'name', 'id', 'flags' triplets and terminated by NULL. + * + * Adds a list of standardized properties with types to the @klass. + * the id is for the property switch in your get_prop method, and + * the flags determine readability / writeability. + **/ +void +gst_element_class_install_std_props (GstElementClass * klass, + const gchar * first_name, ...) + const char *name; + va_list args; + g_return_if_fail (GST_IS_ELEMENT_CLASS (klass)); + va_start (args, first_name); + name = first_name; + while (name) { + int arg_id = va_arg (args, int); + int flags = va_arg (args, int); + gst_element_populate_std_props ((GObjectClass *) klass, name, arg_id, + flags); + name = va_arg (args, char *); + va_end (args); Index: gstutils.h RCS file: /cvs/gstreamer/gstreamer/gst/gstutils.h,v retrieving revision 1.26.2.1 retrieving revision 1.26.2.2 diff -u -d -r1.26.2.1 -r1.26.2.2 --- gstutils.h 8 Dec 2004 17:40:36 -0000 1.26.2.1 +++ gstutils.h 1 Feb 2005 17:26:44 -0000 1.26.2.2 @@ -257,6 +257,10 @@ void gst_element_unlink_pads (GstElement *src, const gchar *srcpadname, GstElement *dest, const gchar *destpadname); +/* element class functions */ +void gst_element_class_install_std_props (GstElementClass * klass, + const gchar * first_name, ...); /* pad functions */ gboolean gst_pad_can_link (GstPad *srcpad, GstPad *sinkpad); gboolean gst_pad_can_link_filtered (GstPad *srcpad, GstPad *sinkpad, const GstCaps *filtercaps); |