* 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 <edward.hervey@collabora.co.uk>
+
+ * configure.ac:
+ * gst/Makefile.am:
* gst/audio.defs:
* gst/audio.override:
* gst/audiomodule.c: (initaudio):
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
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)
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,
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 \
--- /dev/null
+;; -*- scheme -*-
+; object definitions ...
+(define-object VideoFilter
+ (in-module "Gst")
+ (parent "GstBaseTransform")
+ (c-name "GstVideoFilter")
+ (gtype-id "GST_TYPE_VIDEO_FILTER")
+)
+
+(define-object VideoSink
+ (in-module "Gst")
+ (parent "GstBaseSink")
+ (c-name "GstVideoSink")
+ (gtype-id "GST_TYPE_VIDEO_SINK")
+)
+
+;; Enumerations and flags ...
+
+(define-enum VideoFormat
+ (in-module "Gst")
+ (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")
+ (return-type "GType")
+)
+
+(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")
+ (parameters
+ '("GstPad*" "pad")
+ '("gint*" "width")
+ '("gint*" "height")
+ )
+)
+
+(define-function calculate_display_ratio
+ (c-name "gst_video_calculate_display_ratio")
+ (return-type "gboolean")
+ (parameters
+ '("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")
+ (return-type "gboolean")
+ (parameters
+ '("GstCaps*" "caps")
+ '("GstVideoFormat*" "format")
+ '("int*" "width")
+ '("int*" "height")
+ )
+)
+
+(define-function parse_caps_framerate
+ (c-name "gst_video_parse_caps_framerate")
+ (return-type "gboolean")
+ (parameters
+ '("GstCaps*" "caps")
+ '("int*" "fps_n")
+ '("int*" "fps_d")
+ )
+)
+
+(define-function parse_caps_pixel_aspect_ratio
+ (c-name "gst_video_parse_caps_pixel_aspect_ratio")
+ (return-type "gboolean")
+ (parameters
+ '("GstCaps*" "caps")
+ '("int*" "par_n")
+ '("int*" "par_d")
+ )
+)
+
+(define-method new_caps
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_new_caps")
+ (return-type "GstCaps*")
+ (parameters
+ '("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")
+ (parameters
+ '("guint32" "fourcc")
+ )
+)
+
+(define-method to_fourcc
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_to_fourcc")
+ (return-type "guint32")
+)
+
+(define-method is_rgb
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_is_rgb")
+ (return-type "gboolean")
+)
+
+(define-method is_yuv
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_is_yuv")
+ (return-type "gboolean")
+)
+
+(define-method has_alpha
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_has_alpha")
+ (return-type "gboolean")
+)
+
+(define-method get_row_stride
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_get_row_stride")
+ (return-type "int")
+ (parameters
+ '("int" "component")
+ '("int" "width")
+ )
+)
+
+(define-method get_pixel_stride
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_get_pixel_stride")
+ (return-type "int")
+ (parameters
+ '("int" "component")
+ )
+)
+
+(define-method get_component_width
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_get_component_width")
+ (return-type "int")
+ (parameters
+ '("int" "component")
+ '("int" "width")
+ )
+)
+
+(define-method get_component_height
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_get_component_height")
+ (return-type "int")
+ (parameters
+ '("int" "component")
+ '("int" "height")
+ )
+)
+
+(define-method get_component_offset
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_get_component_offset")
+ (return-type "int")
+ (parameters
+ '("int" "component")
+ '("int" "width")
+ '("int" "height")
+ )
+)
+
+(define-method get_size
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_get_size")
+ (return-type "int")
+ (parameters
+ '("int" "width")
+ '("int" "height")
+ )
+)
+
+(define-method convert
+ (of-object "GstVideoFormat")
+ (c-name "gst_video_format_convert")
+ (return-type "gboolean")
+ (parameters
+ '("int" "width")
+ '("int" "height")
+ '("int" "fps_n")
+ '("int" "fps_d")
+ '("GstFormat" "src_format")
+ '("gint64" "src_value")
+ '("GstFormat" "dest_format")
+ '("gint64*" "dest_value")
+ )
+)
+
+
--- /dev/null
+/* -*- 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/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
+#endif
+
+%%
+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
--- /dev/null
+/* -*- 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/video/video.h>
+#include <gst/video/gstvideosink.h>
+#include <gst/video/gstvideofilter.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");
+ }
+}