? patch.txt
? gst/757769
Index: Makefile.am
===================================================================
RCS file: /cvs/gstreamer/gst-python/Makefile.am,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile.am
--- Makefile.am	27 Jul 2007 11:47:16 -0000	1.43
+++ Makefile.am	2 Nov 2007 13:59:12 -0000
@@ -1,12 +1,24 @@
 SUBDIRS = codegen gst examples testsuite pkgconfig
 
 win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
+common_cflags = $(PYGOBJECT_CFLAGS) $(GST_CFLAGS) $(GST_OPTION_CFLAGS) -fno-strict-aliasing
+common_libadd = $(GST_LIBS) $(GST_OPTION_LIBS)
+common_ldflags = -module -avoid-version
 
 debug:
 	echo $(win32)	
 
 ACLOCAL_AMFLAGS = -I common/m4
 
+pyexec_LTLIBRARIES = gstoption.la
+
+# GStreamer option bindings
+gstoption_la_CFLAGS = $(common_cflags)
+gstoption_la_LIBADD = $(common_libadd)
+gstoption_la_LDFLAGS = $(common_ldflags) \
+	-export-symbols-regex "^(initgstoption|_PyGObject_API).*"
+gstoption_la_SOURCES = gstoptionmodule.c
+
 EXTRA_DIST = \
 	gstltihooks.py \
 	pygst.py.in \
Index: gstoptionmodule.c
===================================================================
RCS file: gstoptionmodule.c
diff -N gstoptionmodule.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gstoptionmodule.c	2 Nov 2007 13:59:12 -0000
@@ -0,0 +1,50 @@
+/* -*- Mode: C; ; c-file-style: "k&r"; c-basic-offset: 4 -*- */
+/* gst-python
+ * Copyright (C) 2007 Johan Dahlin
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ * 
+ * Author: Johan Dahlin <johan@gnome.org>
+ */
+
+#include <Python.h>
+#include <pygobject.h>
+#include <gst/gst.h>
+
+static PyObject *
+_wrap_gstoption_get_group (PyObject *self)
+{
+  GOptionGroup *option_group;
+
+  option_group = gst_init_get_option_group();
+  return pyg_option_group_new(option_group);
+}
+
+static PyMethodDef pygstoption_functions[] = {
+    { "get_group", (PyCFunction)_wrap_gstoption_get_group, METH_NOARGS, NULL },
+    { NULL, NULL, 0, NULL }
+};
+
+DL_EXPORT(void)
+initgstoption (void)
+{
+     init_pygobject ();
+
+     if (!g_thread_supported ())
+       g_thread_init (NULL);
+
+     Py_InitModule ("gstoption", pygstoption_functions);
+}
Index: examples/option-parser.py
===================================================================
RCS file: examples/option-parser.py
diff -N examples/option-parser.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ examples/option-parser.py	2 Nov 2007 13:59:12 -0000
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+import sys
+
+import pygtk
+pygtk.require('2.0')
+
+from gobject.option import OptionParser, OptionGroup
+import pygst
+pygst.require('0.10')
+
+import gstoption
+
+def main(args):
+    parser = OptionParser()
+    parser.add_option('-v', '--verbose',
+                      action="store_true", dest="verbose",
+                      help="be verbose")
+    parser.add_option('', '--version',
+                      action="store_true", dest="version",
+                      default=False,
+                      help="show version information")
+
+    parser.add_option_group(gstoption.get_group())
+
+
+    options, args = parser.parse_args(args)
+
+    if options.verbose:
+        print 'Verbose mode'
+
+    import gst
+
+    if options.version:
+        print sys.version, gst.version()
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
