initial python bindings
[platform/upstream/gstreamer.git] / gst / gstreamermodule.c
1 /* -*- Mode: C; c-basic-offset: 4 -*- */
2 /* gst-python
3  * Copyright (C) 2002 David I. Lehn
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  * 
20  * Author: David I. Lehn <dlehn@vt.edu>
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 /* include this first, before NO_IMPORT_PYGOBJECT is defined */
28 #include <pygobject.h>
29
30 void pygstreamer_register_classes (PyObject *d);
31 void pygstreamer_add_constants(PyObject *module, const gchar *strip_prefix);
32                 
33 extern PyMethodDef pygstreamer_functions[];
34
35 DL_EXPORT(void)
36 init_gstreamer (void)
37 {
38         PyObject *m, *d;
39
40         init_pygobject ();
41         gst_init(NULL,NULL);
42
43         m = Py_InitModule ("_gstreamer", pygstreamer_functions);
44         d = PyModule_GetDict (m);
45
46         pygstreamer_register_classes (d);
47         pygstreamer_add_constants (m, "GSTREAMER_");
48         
49         if (PyErr_Occurred ()) {
50                 Py_FatalError ("can't initialize module gstreamer");
51         }
52 }