bilboed gst-python: gst-python/ gst-python/gst/

[email protected] Wed, 31 Dec 2008 05:33:12 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-python
Changes by:     bilboed
Date:           Wed Dec 31 2008  13:33:12 UTC

Log message:
* 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

Modified files:
    .               : ChangeLog configure.ac
    gst             : Makefile.am
Added files:
    gst             : tag.defs tag.override tagmodule.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/ChangeLog.diff?r1=1.705&r2=1.706
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/configure.ac.diff?r1=1.179&r2=1.180
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/Makefile.am.diff?r1=1.84&r2=1.85
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/tag.defs?rev=1.1&content-type=text/vnd.viewcvs-markup
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/tag.override?rev=1.1&content-type=text/vnd.viewcvs-markup
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/tagmodule.c?rev=1.1&content-type=text/vnd.viewcvs-markup

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-python/ChangeLog,v
retrieving revision 1.705
retrieving revision 1.706
diff -u -d -r1.705 -r1.706
--- ChangeLog	31 Dec 2008 13:06:57 -0000	1.705
+++ ChangeLog	31 Dec 2008 13:32:57 -0000	1.706
@@ -2,6 +2,16 @@
 
 	* 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  <[email protected]>
+	* configure.ac:
+	* gst/Makefile.am:
 	* gst/video.defs:
 	* gst/video.override:
 	* gst/videomodule.c: (initvideo):
Index: configure.ac
RCS file: /cvs/gstreamer/gst-python/configure.ac,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- configure.ac	31 Dec 2008 13:06:58 -0000	1.179
+++ configure.ac	31 Dec 2008 13:32:57 -0000	1.180
@@ -186,6 +186,7 @@
   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 @@
   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_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,
Index: Makefile.am
RCS file: /cvs/gstreamer/gst-python/gst/Makefile.am,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- Makefile.am	31 Dec 2008 13:06:58 -0000	1.84
+++ Makefile.am	31 Dec 2008 13:32:57 -0000	1.85
@@ -149,6 +149,28 @@
 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 \
--- NEW FILE: tag.defs ---
;; -*- 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
  (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
  (c-name "GstTagImageType")
  (gtype-id "GST_TYPE_TAG_IMAGE_TYPE")
    '("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")
(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")
    '("const-gchar*" "gst_tag")
(define-function gst_vorbis_tag_add
  (c-name "gst_vorbis_tag_add")
  (return-type "none")
    '("GstTagList*" "list")
    '("const-gchar*" "tag")
    '("const-gchar*" "value")
(define-function to_vorbis_comments
  (c-name "gst_tag_to_vorbis_comments")
  (return-type "GList*")
    '("const-GstTagList*" "list")
(define-function list_from_vorbiscomment_buffer
  (c-name "gst_tag_list_from_vorbiscomment_buffer")
  (return-type "GstTagList*")
    '("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*")
    '("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")
    '("const-guint" "id")
(define-function list_new_from_id3v1
  (c-name "gst_tag_list_new_from_id3v1")
    '("const-guint8*" "data")
(define-function from_id3_tag
  (c-name "gst_tag_from_id3_tag")
    '("const-gchar*" "id3_tag")
(define-function from_id3_user_tag
  (c-name "gst_tag_from_id3_user_tag")
    '("const-gchar*" "type")
    '("const-gchar*" "id3_user_tag")
(define-function to_id3_tag
  (c-name "gst_tag_to_id3_tag")
(define-method add_id3_image
  (c-name "gst_tag_list_add_id3_image")
  (return-type "gboolean")
    '("const-guint8*" "image_data")
    '("guint" "image_data_len")
    '("guint" "id3_picture_type")
(define-function parse_extended_comment
  (c-name "gst_tag_parse_extended_comment")
    '("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*")
    '("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")
    '("GstTagImageType" "image_type")
(define-function register_musicbrainz_tags
  (c-name "gst_tag_register_musicbrainz_tags")
--- NEW FILE: tag.override ---
/* -*- Mode: C; c-basic-offset: 4 -*- */
/* gst-python
 * Copyright (C) 2008 <[email protected]>
 *
 * 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
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
--- NEW FILE: tagmodule.c ---
 * Copyright (C) 2008 Edward Hervey <[email protected]>
#include "config.h"
/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.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");
	}
}

------------------------------------------------------------------------------