37
37
if (!PyArg_ParseTuple(args, "s:GstElement.get_pad_template", &name))
40
pyg_begin_allow_threads;
40
41
tmpl = gst_element_class_get_pad_template
41
42
(GST_ELEMENT_GET_CLASS (self->obj), name);
43
pyg_end_allow_threads;
44
46
ret = pygobject_new (G_OBJECT (tmpl));
141
if (!gst_element_link(GST_ELEMENT(element->obj),
142
GST_ELEMENT(element2->obj)))
144
pyg_begin_allow_threads;
145
res = gst_element_link(GST_ELEMENT(element->obj),
146
GST_ELEMENT(element2->obj));
147
pyg_end_allow_threads;
144
151
PyErr_Format(PyGstExc_LinkError,
145
152
"failed to link %s with %s",
246
256
if (!pad_name_from_object (srcpad, &srcpadname) ||
247
257
!pad_name_from_object (destpad, &destpadname))
260
pyg_begin_allow_threads;
249
261
ret = gst_element_link_pads(GST_ELEMENT(self->obj), srcpadname,
250
262
GST_ELEMENT(dest->obj), destpadname);
263
pyg_end_allow_threads;
252
265
PyErr_SetString(PyGstExc_LinkError, "link failed");
281
294
PyErr_SetString(PyExc_TypeError, "filtercaps should be a GstCaps");
297
pyg_begin_allow_threads;
284
298
ret = gst_element_link_pads_filtered(GST_ELEMENT(self->obj), srcpadname,
285
299
GST_ELEMENT(dest->obj), destpadname,
301
pyg_end_allow_threads;
288
303
PyErr_SetString(PyGstExc_LinkError, "link failed");
358
375
/* The pipeline unrefs the event, but we want to keep the ownership */
359
376
gst_event_ref(event);
378
pyg_begin_allow_threads;
361
379
ret = gst_element_send_event(GST_ELEMENT(self->obj), event);
380
pyg_end_allow_threads;
362
382
return PyBool_FromLong(ret);
366
385
override gst_element_query_position args
380
if (!(gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) {
400
pyg_begin_allow_threads;
401
res = gst_element_query_position(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur);
402
pyg_end_allow_threads;
381
405
PyErr_Format(PyGstExc_QueryError,
404
if (!(gst_element_query_duration(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur))) {
429
pyg_begin_allow_threads;
430
res = gst_element_query_duration(GST_ELEMENT (self->obj), (GstFormat*) &format, &cur);
431
pyg_end_allow_threads;
405
434
PyErr_Format(PyGstExc_QueryError,
419
448
PyObject *pfromformat, *pdestformat;
420
449
GstFormat srcformat, destformat;
421
450
gint64 fromval, dstval;
423
453
/* Input : src_format, src_val, dst_format */
424
454
/* Returns : dst_format, dst_val OR None */
440
if (!(gst_element_query_convert (GST_ELEMENT(self->obj),
470
pyg_begin_allow_threads;
471
res = gst_element_query_convert (GST_ELEMENT(self->obj),
441
472
srcformat, fromval,
442
&destformat, &dstval))) {
473
&destformat, &dstval);
474
pyg_end_allow_threads;
443
477
Py_INCREF(Py_None);
447
481
return Py_BuildValue("(OL)",
448
482
pyg_enum_from_gtype(GST_TYPE_FORMAT, destformat),
547
override GstElement__proxy_do_request_new_pad
549
_wrap_GstElement__proxy_do_request_new_pad(GstElement *self, GstPadTemplate*templ, const gchar*name)
551
PyGILState_STATE __py_state;
553
PyObject *py_templ = NULL;
560
__py_state = pyg_gil_state_ensure();
561
py_self = pygobject_new((GObject *) self);
563
if (PyErr_Occurred())
565
pyg_gil_state_release(__py_state);
569
py_templ = pygobject_new((GObject *) templ);
579
py_name = PyString_FromString(name);
581
if (PyErr_Occurred())
585
pyg_gil_state_release(__py_state);
590
py_args = PyTuple_New(2);
591
PyTuple_SET_ITEM(py_args, 0, py_templ);
592
PyTuple_SET_ITEM(py_args, 1, py_name);
594
py_method = PyObject_GetAttrString(py_self, "do_request_new_pad");
596
if (PyErr_Occurred())
600
pyg_gil_state_release(__py_state);
603
py_retval = PyObject_CallObject(py_method, py_args);
605
if (PyErr_Occurred())
607
Py_DECREF(py_method);
610
pyg_gil_state_release(__py_state);
613
if (!PyObject_TypeCheck(py_retval, &PyGObject_Type)) {
614
PyErr_SetString(PyExc_TypeError, "retval should be a GObject");
616
Py_DECREF(py_retval);
617
Py_DECREF(py_method);
620
pyg_gil_state_release(__py_state);
623
retval = (GstPad*) pygobject_get(py_retval);
624
g_object_ref((GObject *) retval);
627
Py_DECREF(py_retval);
628
Py_DECREF(py_method);
631
pyg_gil_state_release(__py_state);