gstreamer/gst/tag.override

105 lines
2.7 KiB
Text
Raw Normal View History

/* -*- Mode: C; c-basic-offset: 4 -*- */
/* gst-python
* Copyright (C) 2008 <edward.hervey@collabora.co.uk>
*
* 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.
*/
%%
headers
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#define NO_IMPORT_PYGOBJECT
#include "common.h"
#include <gst/gst.h>
#include <gst/tag/tag.h>
#include <gst/tag/gsttagdemux.h>
#include "pygstminiobject.h"
GST_DEBUG_CATEGORY_EXTERN (pygst_debug);
#define GST_CAT_DEFAULT pygst_debug
/* Boonky define that allows for backwards compatibility with Python 2.4 */
#if PY_VERSION_HEX < 0x02050000
#define Py_ssize_t int
#endif
%%
modulename gst.tag
%%
import gobject.GObject as PyGObject_Type
import gst.Object as PyGstObject_Type
import gst.Structure as PyGstStructure_Type
import gst.Element as PyGstElement_Type
import gst.Pad as PyGstPad_Type
import gst.Buffer as PyGstBuffer_Type
import gst.Message as PyGstMessage_Type
import gst.SystemClock as PyGstSystemClock_Type
import gst.BaseTransform as PyGstBaseTransform_Type
import gst.BaseSink as PyGstBaseSink_Type
%%
include
gstversion.override
%%
ignore-glob
_*
*init
*_free
*_get_type
%%
override gst_tag_to_vorbis_comments
static PyObject *
_wrap_gst_tag_to_vorbis_comments(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *py_taglist;
const GstTagList *taglist;
const gchar *tag;
const GList *list;
const GList *l;
PyObject *py_list;
if (!PyArg_ParseTuple(args, "Os", &py_taglist, &tag))
return NULL;
if (pyg_boxed_check(py_taglist, GST_TYPE_TAG_LIST))
taglist = pyg_boxed_get(py_taglist, GstTagList);
else {
PyErr_SetString(PyExc_TypeError, "list should be a GstTagList");
return NULL;
}
pyg_begin_allow_threads;
list = gst_tag_to_vorbis_comments (taglist, tag);
pyg_end_allow_threads;
py_list = PyList_New(0);
for (l = list; l; l = l->next) {
gchar *pair = (gchar *)l->data;
PyObject *py_pair = PyString_FromString(pair);
PyList_Append(py_list, py_pair);
Py_DECREF(py_pair);
}
return py_list;
}