Wrap gst-plugins-base's tag helper library.

Original commit message from CVS:
* configure.ac:
* gst/Makefile.am:
* gst/tag.defs:
* gst/tag.override:
* gst/tagmodule.c: (inittag):
Wrap gst-plugins-base's tag helper library.
Partially fixes #565762
This commit is contained in:
Edward Hervey 2008-12-31 13:32:58 +00:00
parent 8aa05d4cd7
commit 4e04dc11c8
6 changed files with 374 additions and 0 deletions

View file

@ -1,3 +1,13 @@
2008-12-31 Edward Hervey <edward.hervey@collabora.co.uk>
* configure.ac:
* gst/Makefile.am:
* gst/tag.defs:
* gst/tag.override:
* gst/tagmodule.c: (inittag):
Wrap gst-plugins-base's tag helper library.
Partially fixes #565762
2008-12-31 Edward Hervey <edward.hervey@collabora.co.uk>
* configure.ac:

View file

@ -186,6 +186,7 @@ then
then
AC_DEFINE_UNQUOTED(HAVE_GST_AUDIO, 1, [We can use the gst-audio library])
AC_DEFINE_UNQUOTED(HAVE_GST_VIDEO, 1, [We can use the gst-video library])
AC_DEFINE_UNQUOTED(HAVE_GST_TAG, 1, [We can use the gst-tag library])
fi
else
@ -203,6 +204,7 @@ else
AC_DEFINE_UNQUOTED(HAVE_PLUGINS_INSTALL, 1, [We can use the plugins-install methods])
AC_DEFINE_UNQUOTED(HAVE_GST_AUDIO, 1, [We can use the gst-audio library])
AC_DEFINE_UNQUOTED(HAVE_GST_VIDEO, 1, [We can use the gst-video library])
AC_DEFINE_UNQUOTED(HAVE_GST_TAG, 1, [We can use the gst-tag library])
fi
AC_DEFINE_UNQUOTED(HAVE_VIDEO_ORIENTATION_INTERFACE, 1, [We can use the videoorientation interface])
AC_SUBST(IGNORE_GST_0_10_13)
@ -220,6 +222,7 @@ AC_SUBST(HAVE_VIDEO_ORIENTATION)
AC_SUBST(HAVE_PLUGINS_INSTALL)
AM_CONDITIONAL(HAVE_GST_AUDIO, $HAVE_GST_AUDIO)
AM_CONDITIONAL(HAVE_GST_VIDEO, $HAVE_GST_VIDEO)
AM_CONDITIONAL(HAVE_GST_TAG, $HAVE_GST_TAG)
dnl check for gstreamer-base; uninstalled is selected preferentially
PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ,

View file

@ -149,6 +149,28 @@ video.c: $(VIDEO_DEFS) $(VIDEO_OVERRIDES) $(GEN_FILES)
endif
# GStreamer tag bindings
TAG_OVERRIDES = tag.override
TAG_DEFS = tag.defs
CLEANFILES += tag.c
EXTRA_DIST += $(TAG_DEFS) $(TAG_OVERRIDES)
defs_DATA += $(TAG_DEFS)
GEN_FILES += $(TAG_DEFS)
if HAVE_GST_TAG
tag_lib = tag.la
pygstexec_LTLIBRARIES += $(tag_lib)
tag_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS)
tag_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgsttag-0.10
tag_la_LDFLAGS = $(common_ldflags) \
-export-symbols-regex "^(inittag|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS)
tag_la_SOURCES = tagmodule.c gst-argtypes.c pygstminiobject.c
nodist_tag_la_SOURCES = tag.c
tag.c: $(TAG_DEFS) $(TAG_OVERRIDES) $(GEN_FILES)
endif
.defs.c:
($(PYTHON) $(top_srcdir)/codegen/codegen.py \

219
gst/tag.defs Normal file
View file

@ -0,0 +1,219 @@
;; -*- scheme -*-
; object definitions ...
(define-object TagDemux
(in-module "Gst")
(parent "GstElement")
(c-name "GstTagDemux")
(gtype-id "GST_TYPE_TAG_DEMUX")
)
;; Enumerations and flags ...
(define-enum TagDemuxResult
(in-module "Gst")
(c-name "GstTagDemuxResult")
(gtype-id "GST_TYPE_TAG_DEMUX_RESULT")
(values
'("broken-tag" "GST_TAG_DEMUX_RESULT_BROKEN_TAG")
'("again" "GST_TAG_DEMUX_RESULT_AGAIN")
'("ok" "GST_TAG_DEMUX_RESULT_OK")
)
)
(define-enum TagImageType
(in-module "Gst")
(c-name "GstTagImageType")
(gtype-id "GST_TYPE_TAG_IMAGE_TYPE")
(values
'("none" "GST_TAG_IMAGE_TYPE_NONE")
'("undefined" "GST_TAG_IMAGE_TYPE_UNDEFINED")
'("front-cover" "GST_TAG_IMAGE_TYPE_FRONT_COVER")
'("back-cover" "GST_TAG_IMAGE_TYPE_BACK_COVER")
'("leaflet-page" "GST_TAG_IMAGE_TYPE_LEAFLET_PAGE")
'("medium" "GST_TAG_IMAGE_TYPE_MEDIUM")
'("lead-artist" "GST_TAG_IMAGE_TYPE_LEAD_ARTIST")
'("artist" "GST_TAG_IMAGE_TYPE_ARTIST")
'("conductor" "GST_TAG_IMAGE_TYPE_CONDUCTOR")
'("band-orchestra" "GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA")
'("composer" "GST_TAG_IMAGE_TYPE_COMPOSER")
'("lyricist" "GST_TAG_IMAGE_TYPE_LYRICIST")
'("recording-location" "GST_TAG_IMAGE_TYPE_RECORDING_LOCATION")
'("during-recording" "GST_TAG_IMAGE_TYPE_DURING_RECORDING")
'("during-performance" "GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE")
'("video-capture" "GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE")
'("fish" "GST_TAG_IMAGE_TYPE_FISH")
'("illustration" "GST_TAG_IMAGE_TYPE_ILLUSTRATION")
'("band-artist-logo" "GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO")
'("publisher-studio-logo" "GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO")
)
)
;; From gsttagdemux.h
(define-function demux_get_type
(c-name "gst_tag_demux_get_type")
(return-type "GType")
)
;; From tag.h
(define-function image_type_get_type
(c-name "gst_tag_image_type_get_type")
(return-type "GType")
)
(define-function from_vorbis_tag
(c-name "gst_tag_from_vorbis_tag")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "vorbis_tag")
)
)
(define-function to_vorbis_tag
(c-name "gst_tag_to_vorbis_tag")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "gst_tag")
)
)
(define-function gst_vorbis_tag_add
(c-name "gst_vorbis_tag_add")
(return-type "none")
(parameters
'("GstTagList*" "list")
'("const-gchar*" "tag")
'("const-gchar*" "value")
)
)
(define-function to_vorbis_comments
(c-name "gst_tag_to_vorbis_comments")
(return-type "GList*")
(parameters
'("const-GstTagList*" "list")
'("const-gchar*" "tag")
)
)
(define-function list_from_vorbiscomment_buffer
(c-name "gst_tag_list_from_vorbiscomment_buffer")
(return-type "GstTagList*")
(parameters
'("const-GstBuffer*" "buffer")
'("const-guint8*" "id_data")
'("const-guint" "id_data_length")
'("gchar**" "vendor_string")
)
)
(define-method to_vorbiscomment_buffer
(of-object "GstTagList")
(c-name "gst_tag_list_to_vorbiscomment_buffer")
(return-type "GstBuffer*")
(parameters
'("const-guint8*" "id_data")
'("const-guint" "id_data_length")
'("const-gchar*" "vendor_string")
)
)
(define-function id3_genre_count
(c-name "gst_tag_id3_genre_count")
(return-type "guint")
)
(define-function id3_genre_get
(c-name "gst_tag_id3_genre_get")
(return-type "const-gchar*")
(parameters
'("const-guint" "id")
)
)
(define-function list_new_from_id3v1
(c-name "gst_tag_list_new_from_id3v1")
(return-type "GstTagList*")
(parameters
'("const-guint8*" "data")
)
)
(define-function from_id3_tag
(c-name "gst_tag_from_id3_tag")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "id3_tag")
)
)
(define-function from_id3_user_tag
(c-name "gst_tag_from_id3_user_tag")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "type")
'("const-gchar*" "id3_user_tag")
)
)
(define-function to_id3_tag
(c-name "gst_tag_to_id3_tag")
(return-type "const-gchar*")
(parameters
'("const-gchar*" "gst_tag")
)
)
(define-method add_id3_image
(of-object "GstTagList")
(c-name "gst_tag_list_add_id3_image")
(return-type "gboolean")
(parameters
'("const-guint8*" "image_data")
'("guint" "image_data_len")
'("guint" "id3_picture_type")
)
)
(define-function parse_extended_comment
(c-name "gst_tag_parse_extended_comment")
(return-type "gboolean")
(parameters
'("const-gchar*" "ext_comment")
'("gchar**" "key")
'("gchar**" "lang")
'("gchar**" "value")
'("gboolean" "fail_if_no_key")
)
)
(define-function freeform_string_to_utf8
(c-name "gst_tag_freeform_string_to_utf8")
(return-type "gchar*")
(parameters
'("const-gchar*" "data")
'("gint" "size")
'("const-gchar**" "env_vars")
)
)
(define-function image_data_to_image_buffer
(c-name "gst_tag_image_data_to_image_buffer")
(return-type "GstBuffer*")
(parameters
'("const-guint8*" "image_data")
'("guint" "image_data_len")
'("GstTagImageType" "image_type")
)
)
(define-function register_musicbrainz_tags
(c-name "gst_tag_register_musicbrainz_tags")
(return-type "none")
)

64
gst/tag.override Normal file
View file

@ -0,0 +1,64 @@
/* -*- 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

56
gst/tagmodule.c Normal file
View file

@ -0,0 +1,56 @@
/* -*- Mode: C; c-basic-offset: 4 -*- */
/* gst-python
* Copyright (C) 2008 Edward Hervey <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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.h>
#include <gst/gst.h>
#include <gst/tag/tag.h>
void pytag_register_classes (PyObject *d);
void pytag_add_constants(PyObject *module, const gchar *strip_prefix);
extern PyMethodDef pytag_functions[];
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
DL_EXPORT(void)
inittag (void)
{
PyObject *m, *d;
init_pygobject ();
/* Initialize tag library */
gst_tag_register_musicbrainz_tags ();
m = Py_InitModule ("tag", pytag_functions);
d = PyModule_GetDict (m);
pytag_register_classes (d);
pytag_add_constants (m, "GST_");
if (PyErr_Occurred ()) {
PyErr_Print ();
Py_FatalError ("can't initialize module gst.tag");
}
}