1
/* -*- Mode: C; c-basic-offset: 4 -*- */
3
* Copyright (C) 2002 David I. Lehn
4
* Copyright (C) 2004 Johan Dahlin
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
21
* Author: David I. Lehn <dlehn@users.sourceforge.net>
25
/* define this for all source files that don't run init_pygobject()
26
* before including pygobject.h */
27
#define NO_IMPORT_PYGOBJECT
36
#include <gst/gsterror.h>
37
#include <gst/gsttypefind.h>
38
#include <gst/gsttagsetter.h>
40
#include <gst/controller/gstcontroller.h>
41
#include <gst/dataprotocol/dataprotocol.h>
42
#include <gst/base/gstadapter.h>
43
#include <gst/base/gstbasesrc.h>
44
#include <gst/base/gstpushsrc.h>
45
#include <gst/base/gstbasesink.h>
46
#include <gst/base/gstbasetransform.h>
47
#include <gst/base/gstcollectpads.h>
48
#include <gst/base/gsttypefindhelper.h>
50
#include <gst/net/gstnet.h>
52
#include "pygstvalue.h"
53
#include "pygstminiobject.h"
54
#include "pygstexception.h"
56
/* These headers have been included directly to get around multiple
57
* GetAttrString calls */
59
#include <frameobject.h>
61
GST_DEBUG_CATEGORY_EXTERN (python_debug);
62
GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
63
#define GST_CAT_DEFAULT pygst_debug
65
/* This function checks if a former Python code threw an exception and if
66
* so, transforms this exception into an error on the given GstElement.
67
* This allows code run on the element to just raise an exception instead of
68
* returning GStreamer specific return values.
69
* The exception is cleared afterwards.
72
_pygst_element_check_error (GstElement *element)
74
PyObject *type, *value, *traceback, *lineno, *msg, *typemsg;
77
if (!PyErr_Occurred())
80
PyErr_Fetch (&type, &value, &traceback);
82
frame = (PyFrameObject *) PyObject_GetAttrString (traceback, "tb_frame");
83
lineno = PyObject_GetAttrString (traceback, "tb_lineno");
88
msg = PyObject_Str (value);
89
typemsg = PyObject_Str (type);
90
if (msg && PyString_Check (msg)) {
91
gst_element_message_full (element, GST_MESSAGE_ERROR,
93
GST_LIBRARY_ERROR_FAILED,
94
g_strdup (PyString_AsString (msg)),
95
typemsg ? g_strconcat (PyString_AsString (typemsg),
96
": ", PyString_AsString (msg), NULL)
97
: g_strdup (PyString_AsString (msg)),
98
frame ? PyString_AsString(frame->f_code->co_filename) : "???",
99
frame ? PyString_AsString(frame->f_code->co_name) : "???",
100
lineno ? PyInt_AsLong (lineno) : 0);
102
gst_element_message_full (element, GST_MESSAGE_ERROR,
104
GST_LIBRARY_ERROR_TOO_LAZY,
106
frame ? PyString_AsString(frame->f_code->co_filename) : "???",
107
frame ? PyString_AsString(frame->f_code->co_name) : "???",
108
lineno ? PyInt_AsLong (lineno) : 0);
120
#ifdef pyg_register_class_init
121
PyTypeObject PyGstPadTemplate_Type;
123
add_templates (gpointer gclass, PyObject *templates)
128
if (pygobject_check(templates, &PyGstPadTemplate_Type)) {
129
gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (pygobject_get (templates)));
133
if (!PyTuple_Check(templates)) {
134
PyErr_SetString(PyExc_TypeError, "__gsttemplates__ attribute neither a tuple nor a GstPadTemplate!");
137
len = PyTuple_Size(templates);
141
for (i = 0; i < len; i++) {
142
templ = (PyGObject*) PyTuple_GetItem(templates, i);
143
if (!pygobject_check(templ, &PyGstPadTemplate_Type)) {
144
PyErr_SetString(PyExc_TypeError, "entries for __gsttemplates__ must be of type GstPadTemplate");
149
for (i = 0; i < len; i++) {
150
templ = (PyGObject*) PyTuple_GetItem(templates, i);
151
gst_element_class_add_pad_template (gclass, GST_PAD_TEMPLATE (templ->obj));
157
_pygst_element_set_details (gpointer gclass, PyObject *details)
159
GstElementDetails gstdetails = { 0, };
161
if (!PyTuple_Check (details)) {
162
PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be a tuple");
165
if (PyTuple_Size (details) != 4) {
166
PyErr_SetString(PyExc_TypeError, "__gstdetails__ must be contain 4 elements");
169
if (!PyArg_ParseTuple (details, "ssss", &gstdetails.longname, &gstdetails.klass,
170
&gstdetails.description, &gstdetails.author)) {
171
PyErr_SetString (PyExc_TypeError, "__gstdetails__ must be contain 4 strings");
174
gst_element_class_set_details (gclass, &gstdetails);
179
_pygst_element_init (gpointer gclass, PyTypeObject *pyclass)
181
PyObject *templates, *details;
183
templates = PyDict_GetItemString(pyclass->tp_dict, "__gsttemplates__");
185
if (add_templates(gclass, templates) != 0)
190
details = PyDict_GetItemString(pyclass->tp_dict, "__gstdetails__");
192
if (_pygst_element_set_details (gclass, details) != 0)
194
PyDict_DelItemString(pyclass->tp_dict, "__gstdetails__");
204
pygst_debug_log (PyObject *pyobject, PyObject *string, GstDebugLevel level,
205
gboolean isgstobject)
211
PyFrameObject *frame;
212
GObject *object = NULL;
214
if (!PyArg_ParseTuple(string, "s:gst.debug_log", &str)) {
215
PyErr_SetString(PyExc_TypeError, "Need a string!");
219
frame = PyEval_GetFrame();
220
function = PyString_AsString(frame->f_code->co_name);
221
filename = g_path_get_basename(PyString_AsString(frame->f_code->co_filename));
222
lineno = PyCode_Addr2Line(frame->f_code, frame->f_lasti);
223
/* gst_debug_log : category, level, file, function, line, object, format, va_list */
225
object = G_OBJECT (pygobject_get (pyobject));
226
gst_debug_log (python_debug, level, filename, function, lineno, object, "%s", str);
240
gstelementfactory.override
246
gststructure.override
254
/* FIXME: new in pygtk-2.6 */
255
#ifdef pyg_register_class_init
256
pyg_register_class_init (GST_TYPE_ELEMENT, _pygst_element_init);
258
if (!pygst_value_init())
260
gst_controller_init(NULL, NULL);
265
import gobject.GObject as PyGObject_Type
290
gst_error_get_message
294
gst_debug_log_default
295
gst_iterator_new_list
297
gst_clock_id_compare_func
299
gst_util_set_value_from_string
300
gst_print_element_args
303
gst_mini_object_replace
306
gst_implements_interface_cast
307
gst_implements_interface_check
308
gst_plugin_get_module
313
Magic to be able to use bugfixes of new releases without having to use
318
#if (GST_VERSION_MICRO < 5)
319
# if (GST_VERSION_MICRO < 4)
320
# if (GST_VERSION_MICRO < 3)
321
#warning Version smaller than .3
322
/* API added between 0.10.2 and 0.10.3 */
323
gst_bin_iterate_sources
324
gst_bin_find_unconnected_pad
325
gst_buffer_is_metadata_writable
326
gst_buffer_make_metadata_writable
327
gst_parse_bin_from_description
329
#warning Version smaller than .4
330
/* API added between 0.10.3 and 0.10.4 */
331
gst_bus_enable_sync_message_emission
332
gst_bus_disable_sync_message_emission
333
gst_pipeline_set_auto_flush_bus
334
gst_pipeline_get_auto_flush_bus
335
gst_query_set_formats
336
gst_query_new_formats
337
gst_query_parse_formats_length
338
gst_query_parse_formats_nth
339
gst_type_find_helper_for_buffer
341
GstBaseSrc__do_check_get_range
342
GstBaseSrc__proxy_do_check_get_range
344
#warning Version smaller than .5
345
/* API Added between 0.10.4 and 0.10.5 */
349
override-slot GstPluginFeature.tp_repr
351
_wrap_gst_plugin_feature_tp_repr(PyObject *self)
355
GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self));
357
repr = g_strdup_printf ("<%s %s @ 0x%lx>",
358
self->ob_type->tp_name, gst_plugin_feature_get_name (feature),
360
ret = PyString_FromString(repr);
365
override-slot GstPluginFeature.tp_str
367
_wrap_gst_plugin_feature_tp_str(PyObject *self)
371
GstPluginFeature *feature = GST_PLUGIN_FEATURE (pygobject_get (self));
373
repr = g_strdup_printf ("<%s %s (%d)>",
374
self->ob_type->tp_name, gst_plugin_feature_get_name (feature),
375
gst_plugin_feature_get_rank (feature));
376
ret = PyString_FromString(repr);
382
override gst_type_find_factory_get_caps noargs
384
_wrap_gst_type_find_factory_get_caps(PyGObject *self)
386
GstCaps *ret = (GstCaps*)gst_type_find_factory_get_caps(GST_TYPE_FIND_FACTORY(self->obj));
387
return pyg_boxed_new(GST_TYPE_CAPS, ret, TRUE, TRUE);
390
override-attr GError.domain
392
_wrap_gst_g_error__get_domain(PyGObject *self, void *closure)
394
return PyString_FromString(g_quark_to_string(((GError*)self->obj)->domain));
397
override-slot GError.tp_str
399
_wrap_gst_g_error_tp_str(PyGObject *self)
401
GError *error = (GError*)self->obj;
402
return PyString_FromString(gst_error_get_message (error->domain,
406
override-attr GstDate.day
408
_wrap_gst_date__get_day(PyGObject *self, void *closure)
410
return PyInt_FromLong(g_date_get_day((GDate*)self->obj));
414
_wrap_gst_date__set_day(PyGObject *self, PyObject *value, void *closure)
416
GDate *date = (GDate *) self->obj;
418
if (!(PyInt_Check(value)))
421
g_date_set_day(date, (int) PyInt_AsLong(value));
425
override-attr GstDate.month
427
_wrap_gst_date__get_month(PyGObject *self, void *closure)
429
return PyInt_FromLong(g_date_get_month((GDate*)self->obj));
432
_wrap_gst_date__set_month(PyGObject *self, PyObject *value, void *closure)
434
GDate *date = (GDate *) self->obj;
436
if (!(PyInt_Check(value)))
439
g_date_set_month(date, (int) PyInt_AsLong(value));
443
override-attr GstDate.year
445
_wrap_gst_date__get_year(PyGObject *self, void *closure)
447
return PyInt_FromLong(g_date_get_year((GDate*)self->obj));
450
_wrap_gst_date__set_year(PyGObject *self, PyObject *value, void *closure)
452
GDate *date = (GDate *) self->obj;
454
if (!(PyInt_Check(value)))
457
g_date_set_year(date, (int) PyInt_AsLong(value));
461
override-slot GstDate.tp_repr
463
_wrap_gst_date_tp_repr(PyGObject *self)
465
GDate *date = (GDate *) self->obj;
467
return PyString_FromFormat ("<GstDate: %2d/%2d/%4d>",
468
g_date_get_day(date),
469
g_date_get_month(date),
470
g_date_get_year(date));
473
override gst_registry_get_path_list
475
_wrap_gst_registry_get_path_list (PyGObject *self)
477
GstRegistry *registry;
482
registry = GST_REGISTRY (self->obj);
484
paths = gst_registry_get_path_list (registry);
486
list = PyList_New (g_list_length(paths));
487
for (l = paths, i = 0; l; l = l->next, ++i) {
488
gchar *path = (gchar *) l->data;
489
PyList_SetItem (list, i, PyString_FromString(path));
497
override gst_registry_get_plugin_list
499
_wrap_gst_registry_get_plugin_list (PyGObject *self)
501
GstRegistry *registry;
506
registry = GST_REGISTRY (self->obj);
508
plugins = gst_registry_get_plugin_list (registry);
510
list = PyList_New (g_list_length(plugins));
511
for (l = plugins, i = 0; l; l = l->next, ++i) {
512
GstPlugin *plugin = (GstPlugin *) l->data;
513
PyObject *object = pygstobject_new (G_OBJECT (plugin));
514
gst_object_unref (plugin);
516
PyList_SetItem (list, i, object);
518
g_list_free (plugins);
524
override gst_registry_get_feature_list kwargs
526
_wrap_gst_registry_get_feature_list (PyGObject *self, PyObject *args, PyObject *kwargs)
528
static char *kwlist[] = { "type", NULL };
529
PyObject *py_type = NULL;
532
GstRegistry *registry;
538
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
539
"O:GstRegistry.get_feature_list", kwlist, &py_type))
541
if ((type = pyg_type_from_object(py_type)) == 0)
544
registry = GST_REGISTRY (self->obj);
546
features = gst_registry_get_feature_list (registry, type);
548
list = PyList_New (g_list_length(features));
549
for (l = features, i = 0; l; l = l->next, ++i) {
550
GstPluginFeature *feature = (GstPluginFeature *) l->data;
551
PyList_SetItem (list, i, pygobject_new (G_OBJECT (feature)));
552
gst_object_unref (feature);
554
g_list_free (features);
560
override gst_registry_get_feature_list_by_plugin kwargs
562
_wrap_gst_registry_get_feature_list_by_plugin (PyGObject *self, PyObject *args, PyObject *kwargs)
564
static char *kwlist[] = { "name", NULL };
567
GstRegistry *registry;
572
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
573
"s:GstRegistry.get_feature_list_by_plugin", kwlist, &name))
576
registry = GST_REGISTRY (self->obj);
578
features = gst_registry_get_feature_list_by_plugin (registry, name);
580
list = PyList_New (g_list_length(features));
581
for (l = features, i = 0; l; l = l->next, ++i) {
582
GstPluginFeature *feature = (GstPluginFeature *) l->data;
583
PyList_SetItem (list, i, pygobject_new (G_OBJECT (feature)));
585
g_list_free (features);
591
override gst_xml_new noargs
593
extern PyObject * libxml_xmlDocPtrWrap(xmlDocPtr doc);
594
extern PyObject * libxml_xmlNodePtrWrap(xmlNodePtr node);
596
/* libxml2 available check */
598
_gst_get_libxml2_module(void)
600
PyObject *xml = NULL;
602
xml = PyImport_ImportModule("libxml2");
605
PyErr_SetString(PyExc_RuntimeError,"libxml2 bindings required");
613
_wrap_gst_xml_new(PyGObject *self)
615
PyObject *xml = _gst_get_libxml2_module();
620
self->obj = (GObject *)gst_xml_new();
623
PyErr_SetString(PyExc_RuntimeError, "could not create GstXML object");
627
pygobject_register_wrapper((PyObject *)self);
632
override gst_xml_get_topelements noargs
634
_wrap_gst_xml_get_topelements(PyGObject *self)
636
GList *l, *xml_elements;
640
xml_elements = gst_xml_get_topelements(GST_XML(self->obj));
641
py_list = PyList_New(g_list_length(xml_elements));
642
for (l = xml_elements, i = 0; l; l = l->next, ++i) {
643
GstElement *element = (GstElement*)l->data;
644
PyList_SetItem(py_list, i, pygstobject_new(G_OBJECT(element)));
645
gst_object_unref (element);
651
override gst_xml_parse_memory kwargs
653
_wrap_gst_xml_parse_memory(PyGObject *self, PyObject *args, PyObject *kwargs)
655
static char *kwlist[] = { "buffer", "root", NULL };
660
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
661
"s#|s:GstXML.parse_memory",
662
kwlist, &buffer, &buffer_len, &root))
665
ret = gst_xml_parse_memory(GST_XML(self->obj),
666
buffer, buffer_len, root);
668
return PyBool_FromLong(ret);
671
override gst_tag_setter_get_tag_list noargs
673
_wrap_gst_tag_setter_get_tag_list(PyGObject *self)
677
ret = (GstTagList*)gst_tag_setter_get_tag_list(GST_TAG_SETTER(self->obj));
678
/* pyg_boxed_new handles NULL checking */
679
return pyg_boxed_new(GST_TYPE_TAG_LIST, ret, TRUE, TRUE);
682
override gst_element_register kwargs
685
_pygst_get_plugin(void)
687
PyObject *dict = NULL, *module = NULL, *pyplugin = NULL;
690
if (!(module = PyImport_ImportModule ("gst")))
692
if (!(dict = PyModule_GetDict (module)))
694
if (!(pyplugin = PyDict_GetItemString (dict, "__plugin__")))
696
ret = pyg_boxed_get (pyplugin, GstPlugin);
708
_wrap_gst_element_register(PyObject *self, PyObject *args, PyObject *kwargs)
710
static char *kwlist[] = { "type", "elementname", "rank", NULL };
711
PyObject *py_type = NULL;
712
guint rank = GST_RANK_NONE;
713
char *elementname = NULL;
717
/* FIXME: can we make the name optional, too? Anyone know a good default? */
718
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os|I:element_register", kwlist,
719
&py_type, &elementname, &rank))
721
if ((type = pyg_type_from_object(py_type)) == 0)
724
ret = gst_element_register(_pygst_get_plugin(), elementname, rank, type);
725
return PyBool_FromLong(ret);
728
override-attr GError.domain
730
_wrap_gst_g_error__get_domain(PyGObject *self, void *closure)
732
return PyString_FromString(g_quark_to_string(((GError*)self->obj)->domain));
735
override-slot GError.tp_str
737
_wrap_gst_g_error_tp_str(PyGObject *self)
739
GError *error = (GError*)self->obj;
740
return PyString_FromString(gst_error_get_message (error->domain,
744
override gst_uri_handler_get_protocols noargs
746
_wrap_gst_uri_handler_get_protocols (PyGObject *self)
752
tab = gst_uri_handler_get_protocols (GST_URI_HANDLER (self->obj));
758
len = g_strv_length (tab);
759
ret = PyList_New(len);
760
for (i = 0; i < len; i++) {
761
PyList_SetItem(ret, i, PyString_FromString(tab[i]));
767
override gst_flow_get_name kwargs
769
_wrap_gst_flow_get_name(PyObject *self, PyObject *args, PyObject *kwargs)
771
static char *kwlist[] = { "ret", NULL };
772
PyObject *py_ret = NULL;
777
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gst_flow_get_name", kwlist, &py_ret))
779
if (pyg_enum_get_value(GST_TYPE_FLOW_RETURN, py_ret, (gint *)&flow))
781
ret = gst_flow_get_name(flow);
783
nret = g_strdup(ret);
784
return PyString_FromString(nret);
791
override gst_log args
793
_wrap_gst_log (PyObject *whatever, PyObject *string)
795
return pygst_debug_log (whatever, string, GST_LEVEL_LOG, FALSE);
798
override gst_debug args
800
_wrap_gst_debug (PyObject *whatever, PyObject *string)
802
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, FALSE);
805
override gst_info args
807
_wrap_gst_info (PyObject *whatever, PyObject *string)
809
return pygst_debug_log (whatever, string, GST_LEVEL_INFO, FALSE);
812
override gst_warning args
814
_wrap_gst_warning (PyObject *whatever, PyObject *string)
816
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, FALSE);
819
override gst_error args
821
_wrap_gst_error (PyObject *whatever, PyObject *string)
823
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, FALSE);
827
override gst_object_log args
829
_wrap_gst_object_log (PyObject *whatever, PyObject *string)
831
return pygst_debug_log (whatever, string, GST_LEVEL_LOG, TRUE);
834
override gst_object_debug args
836
_wrap_gst_object_debug (PyObject *whatever, PyObject *string)
838
return pygst_debug_log (whatever, string, GST_LEVEL_DEBUG, TRUE);
841
override gst_object_info args
843
_wrap_gst_object_info (PyObject *whatever, PyObject *string)
845
return pygst_debug_log (whatever, string, GST_LEVEL_INFO, TRUE);
848
override gst_object_warning args
850
_wrap_gst_object_warning (PyObject *whatever, PyObject *string)
852
return pygst_debug_log (whatever, string, GST_LEVEL_WARNING, TRUE);
855
override gst_object_error args
857
_wrap_gst_object_error (PyObject *whatever, PyObject *string)
859
return pygst_debug_log (whatever, string, GST_LEVEL_ERROR, TRUE);
862
override GST_TIME_ARGS kwargs
864
_wrap_GST_TIME_ARGS(PyObject *self, PyObject *args, PyObject *kwargs)
866
static char *kwlist[] = { "time", NULL };
867
PyObject *py_time = NULL;
872
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:time_to_string", kwlist, &py_time))
874
time = PyInt_AsUnsignedLongLongMask(py_time);
875
if (GST_CLOCK_TIME_IS_VALID (time))
876
ret = g_strdup_printf("%"GST_TIME_FORMAT, GST_TIME_ARGS(time));
878
ret = g_strdup ("CLOCK_TIME_NONE");
885
if (!(string = PyString_FromString(ret))) {
893
override gst_type_find_factory_get_list noargs
895
_wrap_gst_type_find_factory_get_list (PyObject *self)
901
list = gst_type_find_factory_get_list ();
903
py_list = PyList_New(g_list_length(list));
904
for (l = list; l ; l = g_list_next(l), i++) {
905
GstTypeFindFactory *fact = (GstTypeFindFactory*) l->data;
907
PyList_SetItem(py_list, i,
908
pygstobject_new (G_OBJECT (fact)));
915
override gst_get_gst_version noargs
917
_wrap_gst_get_gst_version (PyObject *self)
919
guint major, minor, micro, nano;
922
gst_version (&major, &minor, µ, &nano);
923
py_tuple = PyTuple_New(4);
924
PyTuple_SetItem(py_tuple, 0, PyInt_FromLong(major));
925
PyTuple_SetItem(py_tuple, 1, PyInt_FromLong(minor));
926
PyTuple_SetItem(py_tuple, 2, PyInt_FromLong(micro));
927
PyTuple_SetItem(py_tuple, 3, PyInt_FromLong(nano));
932
override gst_get_pygst_version noargs
934
_wrap_gst_get_pygst_version (PyObject *self)
938
py_tuple = Py_BuildValue ("(iiii)", PYGST_MAJOR_VERSION, PYGST_MINOR_VERSION,
939
PYGST_MICRO_VERSION, PYGST_NANO_VERSION);
944
override gst_clock_get_calibration noargs
946
_wrap_gst_clock_get_calibration (PyGObject * self)
949
GstClockTime internal;
950
GstClockTime external;
951
GstClockTime rate_num;
952
GstClockTime rate_denom;
954
gst_clock_get_calibration (GST_CLOCK (self->obj),
960
ret = PyTuple_New(4);
961
PyTuple_SetItem(ret, 0, PyLong_FromUnsignedLongLong(internal));
962
PyTuple_SetItem(ret, 1, PyLong_FromUnsignedLongLong(external));
963
PyTuple_SetItem(ret, 2, PyLong_FromUnsignedLongLong(rate_num));
964
PyTuple_SetItem(ret, 3, PyLong_FromUnsignedLongLong(rate_denom));
969
override gst_type_find_helper_for_buffer kwargs
971
_wrap_gst_type_find_helper_for_buffer (PyObject *self, PyObject *args, PyObject *kwargs)
973
static char *kwlist[] = { "object", "buffer", NULL };
974
PyGObject *py_object;
975
PyGstMiniObject *py_buffer;
977
GstTypeFindProbability prob = 0;
978
GstCaps *caps = NULL;
980
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!:type_find_helper_for_buffer",
981
kwlist, &PyGstObject_Type, &py_object,
982
&PyGstBuffer_Type, &py_buffer))
985
caps = gst_type_find_helper_for_buffer (GST_OBJECT (py_object->obj),
986
GST_BUFFER (py_buffer->obj),
988
py_ret = PyTuple_New(2);
990
PyTuple_SetItem(py_ret, 0, pyg_boxed_new (GST_TYPE_CAPS, caps, FALSE, TRUE));
993
PyTuple_SetItem(py_ret, 0, Py_None);
997
PyTuple_SetItem(py_ret, 1, pyg_enum_from_gtype(GST_TYPE_TYPE_FIND_PROBABILITY, prob));
1000
PyTuple_SetItem(py_ret, 1, Py_None);