summaryrefslogtreecommitdiff
path: root/gst/gstmessage.override
blob: 2c825b0323b64153a7e40a6ea535ccbe0ea733c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* -*- Mode: C; ; c-file-style: "python" -*- */
/* gst-python
 * Copyright (C) 2005 Edward Hervey
 *
 * 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>
 */

%%
override gst_message_parse_state_changed noargs
static PyObject *
_wrap_gst_message_parse_state_changed (PyGstMiniObject *self)
{
  GstState	old;
  GstState	new;
  PyObject		*ret;

  /* Should raise an exception if it's not a state-changed message */
  if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_STATE_CHANGED) {
	  PyErr_SetString(PyExc_TypeError, "Message is not a state-changed message");
	  return NULL;
  }
  gst_message_parse_state_changed (GST_MESSAGE(self->obj), &old, &new);
  /* Return this as a tuple */
  ret = PyList_New(2);
  PyList_SET_ITEM(ret, 0, pyg_enum_from_gtype(GST_TYPE_STATE, old));
  PyList_SET_ITEM(ret, 1, pyg_enum_from_gtype(GST_TYPE_STATE, new));
  return ret;
}
%%
override gst_message_parse_segment_start noargs
static PyObject *
_wrap_gst_message_parse_segment_start (PyGstMiniObject *self)
{
  GstClockTime		timestart;
  PyObject		*ret;

  /* Should raise an exception if it's not a segment start message */
  if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_SEGMENT_START) {
	  PyErr_SetString(PyExc_TypeError, "Message is not a segment start message");
	  return NULL;
  }
  gst_message_parse_segment_start (GST_MESSAGE(self->obj), &timestart);
  /* Return this as a tuple */
  ret = PyLong_FromUnsignedLongLong(timestart);

  return ret;
}
%%
override gst_message_parse_segment_done noargs
static PyObject *
_wrap_gst_message_parse_segment_done (PyGstMiniObject *self)
{
  GstClockTime		timestart;
  PyObject		*ret;

  /* Should raise an exception if it's not a segment start message */
  if (GST_MESSAGE(self->obj)->type != GST_MESSAGE_SEGMENT_DONE) {
	  PyErr_SetString(PyExc_TypeError, "Message is not a segment done message");
	  return NULL;
  }
  gst_message_parse_segment_done (GST_MESSAGE(self->obj), &timestart);
  /* Return this as a tuple */
  ret = PyLong_FromUnsignedLongLong(timestart);

  return ret;
}
%%
override gst_message_parse_error noargs
static PyObject *
_wrap_gst_message_parse_error (PyGstMiniObject *self)
{
	PyObject	*ret;
	GError	*error;
	gchar	*debug;
	
	if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_ERROR) {
		PyErr_SetString(PyExc_TypeError, "Message is not an error message");
		return NULL;
	}

	gst_message_parse_error (GST_MESSAGE(self->obj), &error, &debug);

	ret = PyList_New(0);
	PyList_Append(ret, pyg_boxed_new (GST_TYPE_G_ERROR, error, TRUE, TRUE));
	if (debug != NULL) {
		PyList_Append(ret, PyString_FromString(debug));
	} else {
		Py_INCREF (Py_None);
		PyList_Append(ret, Py_None);
	}

	return ret;
}
%%
override gst_message_parse_warning noargs
static PyObject *
_wrap_gst_message_parse_warning (PyGstMiniObject *self)
{
	PyObject	*ret;
	GError		*warning;
	gchar	*debug;
	
	if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_WARNING) {
		PyErr_SetString(PyExc_TypeError, "Message is not an warning message");
		return NULL;
	}

	gst_message_parse_warning (GST_MESSAGE(self->obj), &warning, &debug);

	ret = PyList_New(0);
	PyList_Append(ret, pyg_boxed_new (GST_TYPE_G_ERROR, warning, TRUE, TRUE));
	if (debug != NULL)
		PyList_Append(ret, PyString_FromString(debug));

	return ret;
}
%%
override gst_message_parse_tag noargs
static PyObject *
_wrap_gst_message_parse_tag (PyGstMiniObject *self)
{
	PyObject	*ret;
	GstTagList	*taglist;
	
	if (GST_MESSAGE_TYPE(self->obj) != GST_MESSAGE_TAG) {
		PyErr_SetString(PyExc_TypeError, "Message is not an Tag message");
		return NULL;
	}

	gst_message_parse_tag (GST_MESSAGE(self->obj), &taglist);

	ret = pyg_boxed_new (GST_TYPE_TAG_LIST, taglist, TRUE, TRUE);

	return ret;
}