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

[email protected] Wed, 31 Dec 2008 05:07: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:07:12 UTC

Log message:
* configure.ac:
* gst/Makefile.am:
* gst/video.defs:
* gst/video.override:
* gst/videomodule.c: (initvideo):
Wrap gst-plugins-base's video helper library.
Partially fixes #565762

Modified files:
    .               : ChangeLog configure.ac
    gst             : Makefile.am
Added files:
    gst             : video.defs video.override videomodule.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/ChangeLog.diff?r1=1.704&r2=1.705
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/configure.ac.diff?r1=1.178&r2=1.179
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/Makefile.am.diff?r1=1.83&r2=1.84
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/video.defs?rev=1.1&content-type=text/vnd.viewcvs-markup
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/video.override?rev=1.1&content-type=text/vnd.viewcvs-markup
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-python/gst/videomodule.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.704
retrieving revision 1.705
diff -u -d -r1.704 -r1.705
--- ChangeLog	31 Dec 2008 12:01:01 -0000	1.704
+++ ChangeLog	31 Dec 2008 13:06:57 -0000	1.705
@@ -2,6 +2,16 @@
 
 	* configure.ac:
 	* gst/Makefile.am:
+	* gst/video.defs:
+	* gst/video.override:
+	* gst/videomodule.c: (initvideo):
+	Wrap gst-plugins-base's video helper library.
+	Partially fixes #565762
+
+2008-12-31  Edward Hervey  <[email protected]>
+	* configure.ac:
+	* gst/Makefile.am:
 	* gst/audio.defs:
 	* gst/audio.override:
 	* gst/audiomodule.c: (initaudio):
Index: configure.ac
RCS file: /cvs/gstreamer/gst-python/configure.ac,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- configure.ac	31 Dec 2008 12:01:01 -0000	1.178
+++ configure.ac	31 Dec 2008 13:06:58 -0000	1.179
@@ -185,6 +185,7 @@
   if test $GST_PB_MINOR_VERSION -ge "22"
   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])
   fi
 else
@@ -201,6 +202,7 @@
   IGNORE_GST_PB_0_10_18=""
   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])
 fi
 AC_DEFINE_UNQUOTED(HAVE_VIDEO_ORIENTATION_INTERFACE, 1, [We can use the videoorientation interface])
 AC_SUBST(IGNORE_GST_0_10_13)
@@ -217,6 +219,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)
 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.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- Makefile.am	31 Dec 2008 12:01:02 -0000	1.83
+++ Makefile.am	31 Dec 2008 13:06:58 -0000	1.84
@@ -127,6 +127,29 @@
 endif
+# GStreamer video bindings
+VIDEO_OVERRIDES = video.override
+VIDEO_DEFS = video.defs
+CLEANFILES += video.c
+EXTRA_DIST += $(VIDEO_DEFS) $(VIDEO_OVERRIDES)
+defs_DATA += $(VIDEO_DEFS)
+GEN_FILES += $(VIDEO_DEFS)
+if HAVE_GST_VIDEO
+ video_lib = video.la
+ pygstexec_LTLIBRARIES += $(video_lib)
+ video_la_CFLAGS = $(common_cflags) $(GST_PLUGINS_BASE_CFLAGS)
+ video_la_LIBADD = $(common_libadd) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-0.10
+ video_la_LDFLAGS = $(common_ldflags) \
+	-export-symbols-regex "^(initvideo|_PyGObject_API).*" $(GST_PLUGINS_BASE_LIBS)
+ video_la_SOURCES = videomodule.c gst-argtypes.c pygstminiobject.c
+ nodist_video_la_SOURCES = video.c
+video.c: $(VIDEO_DEFS) $(VIDEO_OVERRIDES) $(GEN_FILES)
+endif
 .defs.c: 
 	($(PYTHON) $(top_srcdir)/codegen/codegen.py \
 		--load-types $(srcdir)/arg-types.py \
--- NEW FILE: video.defs ---
;; -*- scheme -*-
; object definitions ...
(define-object VideoFilter
  (in-module "Gst")
  (parent "GstBaseTransform")
  (c-name "GstVideoFilter")
  (gtype-id "GST_TYPE_VIDEO_FILTER")
)

(define-object VideoSink
  (parent "GstBaseSink")
  (c-name "GstVideoSink")
  (gtype-id "GST_TYPE_VIDEO_SINK")
;; Enumerations and flags ...
(define-enum VideoFormat
  (c-name "GstVideoFormat")
  (gtype-id "GST_TYPE_VIDEO_FORMAT")
  (values
    '("unknown" "GST_VIDEO_FORMAT_UNKNOWN")
    '("i420" "GST_VIDEO_FORMAT_I420")
    '("yv12" "GST_VIDEO_FORMAT_YV12")
    '("yuy2" "GST_VIDEO_FORMAT_YUY2")
    '("uyvy" "GST_VIDEO_FORMAT_UYVY")
    '("ayuv" "GST_VIDEO_FORMAT_AYUV")
    '("rgbx" "GST_VIDEO_FORMAT_RGBx")
    '("bgrx" "GST_VIDEO_FORMAT_BGRx")
    '("xrgb" "GST_VIDEO_FORMAT_xRGB")
    '("xbgr" "GST_VIDEO_FORMAT_xBGR")
    '("rgba" "GST_VIDEO_FORMAT_RGBA")
    '("bgra" "GST_VIDEO_FORMAT_BGRA")
    '("argb" "GST_VIDEO_FORMAT_ARGB")
    '("abgr" "GST_VIDEO_FORMAT_ABGR")
    '("rgb" "GST_VIDEO_FORMAT_RGB")
    '("bgr" "GST_VIDEO_FORMAT_BGR")
    '("y41b" "GST_VIDEO_FORMAT_Y41B")
    '("y42b" "GST_VIDEO_FORMAT_Y42B")
  )
;; From gstvideofilter.h
(define-function gst_video_filter_get_type
  (c-name "gst_video_filter_get_type")
  (return-type "GType")
;; From gstvideosink.h
(define-function gst_video_sink_get_type
  (c-name "gst_video_sink_get_type")
(define-function video_sink_center_rect
  (c-name "gst_video_sink_center_rect")
  (return-type "none")
  (parameters
    '("GstVideoRectangle" "src")
    '("GstVideoRectangle" "dst")
    '("GstVideoRectangle*" "result")
    '("gboolean" "scaling")
;; From video.h
(define-function get_size
  (c-name "gst_video_get_size")
  (return-type "gboolean")
    '("GstPad*" "pad")
    '("gint*" "width")
    '("gint*" "height")
(define-function calculate_display_ratio
  (c-name "gst_video_calculate_display_ratio")
    '("guint*" "dar_n")
    '("guint*" "dar_d")
    '("guint" "video_width")
    '("guint" "video_height")
    '("guint" "video_par_n")
    '("guint" "video_par_d")
    '("guint" "display_par_n")
    '("guint" "display_par_d")
(define-function format_parse_caps
  (c-name "gst_video_format_parse_caps")
    '("GstCaps*" "caps")
    '("GstVideoFormat*" "format")
    '("int*" "width")
    '("int*" "height")
(define-function parse_caps_framerate
  (c-name "gst_video_parse_caps_framerate")
    '("int*" "fps_n")
    '("int*" "fps_d")
(define-function parse_caps_pixel_aspect_ratio
  (c-name "gst_video_parse_caps_pixel_aspect_ratio")
    '("int*" "par_n")
    '("int*" "par_d")
(define-method new_caps
  (of-object "GstVideoFormat")
  (c-name "gst_video_format_new_caps")
  (return-type "GstCaps*")
    '("int" "width")
    '("int" "height")
    '("int" "framerate_n")
    '("int" "framerate_d")
    '("int" "par_n")
    '("int" "par_d")
(define-function format_from_fourcc
  (c-name "gst_video_format_from_fourcc")
  (return-type "GstVideoFormat")
    '("guint32" "fourcc")
(define-method to_fourcc
  (c-name "gst_video_format_to_fourcc")
  (return-type "guint32")
(define-method is_rgb
  (c-name "gst_video_format_is_rgb")
(define-method is_yuv
  (c-name "gst_video_format_is_yuv")
(define-method has_alpha
  (c-name "gst_video_format_has_alpha")
(define-method get_row_stride
  (c-name "gst_video_format_get_row_stride")
  (return-type "int")
    '("int" "component")
(define-method get_pixel_stride
  (c-name "gst_video_format_get_pixel_stride")
(define-method get_component_width
  (c-name "gst_video_format_get_component_width")
(define-method get_component_height
  (c-name "gst_video_format_get_component_height")
(define-method get_component_offset
  (c-name "gst_video_format_get_component_offset")
(define-method get_size
  (c-name "gst_video_format_get_size")
(define-method convert
  (c-name "gst_video_format_convert")
    '("int" "fps_n")
    '("int" "fps_d")
    '("GstFormat" "src_format")
    '("gint64" "src_value")
    '("GstFormat" "dest_format")
    '("gint64*" "dest_value")
--- NEW FILE: video.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/video/video.h>
#include <gst/video/gstvideofilter.h>
#include <gst/video/gstvideosink.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.video
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: videomodule.c ---
 * Copyright (C) 2008 Edward Hervey <[email protected]>
#include "config.h"
/* include this first, before NO_IMPORT_PYGOBJECT is defined */
#include <pygobject.h>
void pyvideo_register_classes (PyObject *d);
void pyvideo_add_constants(PyObject *module, const gchar *strip_prefix);
		
extern PyMethodDef pyvideo_functions[];
GST_DEBUG_CATEGORY (pygst_debug); /* for python code */
DL_EXPORT(void)
initvideo (void)
{
	PyObject *m, *d;
	init_pygobject ();
	m = Py_InitModule ("video", pyvideo_functions);
	d = PyModule_GetDict (m);
	pyvideo_register_classes (d);
	pyvideo_add_constants (m, "GST_");
	
	if (PyErr_Occurred ()) {
	    PyErr_Print ();
	    Py_FatalError ("can't initialize module gst.video");
	}
}

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