Commit baea5562 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

add GStreamer bindings

2007-07-17  Juerg Billeter  <j@bitron.ch>

	* vapigen/valagidlparser.vala, vapi/glib-2.0.vala,
	  vapi/gstreamer-0.10.vala, vapi/packages/gstreamer-0.10/: add GStreamer
	  bindings

svn path=/trunk/; revision=358
parent 293a58b4
2007-07-17 Jürg Billeter <j@bitron.ch>
* vapigen/valagidlparser.vala, vapi/glib-2.0.vala,
vapi/gstreamer-0.10.vala, vapi/packages/gstreamer-0.10/: add GStreamer
bindings
2007-07-13 Jürg Billeter <j@bitron.ch>
* configure.ac: Post-release version bump
......
......@@ -558,7 +558,11 @@ namespace GLib {
public TypeClass class_ref ();
}
[ReferenceType]
public struct TypeInstance {
}
[ReferenceType]
public struct TypeClass {
[CCode (cname = "G_TYPE_FROM_CLASS")]
......@@ -577,7 +581,19 @@ namespace GLib {
[ReferenceType ()]
public struct ParamSpec {
}
[CCode (cprefix = "G_PARAM_")]
public enum ParamFlags {
READABLE,
WRITABLE,
CONSTRUCT,
CONSTRUCT_ONLY,
LAX_VALIDATION,
STATIC_NAME,
STATIC_NICK,
STATIC_BLURB
}
[ReferenceType ()]
public struct ObjectClass {
public ParamSpec[] list_properties (out int n_properties);
......@@ -593,6 +609,7 @@ namespace GLib {
public Object @ref ();
public void unref ();
public Object ref_sink ();
public void set (...);
}
public class InitiallyUnowned : Object {
......@@ -1373,7 +1390,7 @@ namespace GLib {
[CCode (cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
public struct FileUtils {
public static bool get_contents (string! filename, out string contents, out long length = null) throws FileError;
public static bool get_contents (string! filename, out string contents, out ulong length = null) throws FileError;
public static bool set_contents (string! filename, string contents, long length = -1) throws FileError;
public static bool test (string filename, FileTest test);
public static int open_tmp (string tmpl, out string name_used) throws FileError;
......
This diff is collapsed.
/* gstreamer-0.10-custom.vala
*
* Copyright (C) 2007 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Jürg Billeter <j@bitron.ch>
*/
[CCode (cheader_filename = "gst/gst.h")]
namespace Gst {
public void init (ref string[] args);
}
This diff is collapsed.
Gst cprefix="Gst" lower_case_cprefix="gst_" cheader_filename="gst/gst.h"
GstBin.priv hidden="1"
GstChildProxy::child_removed has_emitter="1"
GstElement::no_more_pads has_emitter="1"
gst_iterator_free hidden="1"
gst_iterator_next hidden="1"
gst_iterator_resync hidden="1"
GstPad.querytypefunc hidden="1"
gst_pad_set_query_type_function hidden="1"
GstPadTemplate::pad_created has_emitter="1"
diff -puNr gstreamer-0.10.13.orig/gst/gstbin.h gstreamer-0.10.13/gst/gstbin.h
--- gstreamer-0.10.13.orig/gst/gstbin.h 2007-05-23 17:25:37.000000000 +0100
+++ gstreamer-0.10.13/gst/gstbin.h 2007-07-15 11:32:50.000000000 +0100
@@ -49,7 +49,7 @@ G_BEGIN_DECLS
*/
typedef enum {
/* padding */
- GST_BIN_FLAG_LAST = (GST_ELEMENT_FLAG_LAST << 5)
+ GST_BIN_FLAG_LAST
} GstBinFlags;
typedef struct _GstBin GstBin;
diff -puNr gstreamer-0.10.13.orig/gst/gstbus.h gstreamer-0.10.13/gst/gstbus.h
--- gstreamer-0.10.13.orig/gst/gstbus.h 2007-02-28 14:42:41.000000000 +0000
+++ gstreamer-0.10.13/gst/gstbus.h 2007-07-15 11:33:59.000000000 +0100
@@ -48,9 +48,9 @@ G_BEGIN_DECLS
* The standard flags that a bus may have.
*/
typedef enum {
- GST_BUS_FLUSHING = (GST_OBJECT_FLAG_LAST << 0),
+ GST_BUS_FLUSHING,
/* padding */
- GST_BUS_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 1)
+ GST_BUS_FLAG_LAST
} GstBusFlags;
/**
diff -puNr gstreamer-0.10.13.orig/gst/gstevent.h gstreamer-0.10.13/gst/gstevent.h
--- gstreamer-0.10.13.orig/gst/gstevent.h 2007-02-28 14:42:41.000000000 +0000
+++ gstreamer-0.10.13/gst/gstevent.h 2007-07-15 16:28:18.000000000 +0100
@@ -110,27 +110,27 @@ typedef enum {
*/
/* NOTE: keep in sync with quark registration in gstevent.c */
typedef enum {
- GST_EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
+ GST_EVENT_UNKNOWN,
/* bidirectional events */
- GST_EVENT_FLUSH_START = GST_EVENT_MAKE_TYPE (1, FLAG(BOTH)),
- GST_EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (2, FLAG(BOTH) | FLAG(SERIALIZED)),
+ GST_EVENT_FLUSH_START,
+ GST_EVENT_FLUSH_STOP,
/* downstream serialized events */
- GST_EVENT_EOS = GST_EVENT_MAKE_TYPE (5, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
- GST_EVENT_NEWSEGMENT = GST_EVENT_MAKE_TYPE (6, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
- GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (7, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
- GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (8, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
+ GST_EVENT_EOS,
+ GST_EVENT_NEWSEGMENT,
+ GST_EVENT_TAG,
+ GST_EVENT_BUFFERSIZE,
/* upstream events */
- GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (15, FLAG(UPSTREAM)),
- GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (16, FLAG(UPSTREAM)),
- GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (17, FLAG(UPSTREAM)),
- GST_EVENT_LATENCY = GST_EVENT_MAKE_TYPE (18, FLAG(UPSTREAM)),
+ GST_EVENT_QOS,
+ GST_EVENT_SEEK,
+ GST_EVENT_NAVIGATION,
+ GST_EVENT_LATENCY,
/* custom events start here */
- GST_EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (32, FLAG(UPSTREAM)),
- GST_EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (32, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
- GST_EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (32, FLAG(DOWNSTREAM)),
- GST_EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (32, FLAG(BOTH) | FLAG(SERIALIZED)),
- GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (32, FLAG(BOTH))
+ GST_EVENT_CUSTOM_UPSTREAM,
+ GST_EVENT_CUSTOM_DOWNSTREAM,
+ GST_EVENT_CUSTOM_DOWNSTREAM_OOB,
+ GST_EVENT_CUSTOM_BOTH,
+ GST_EVENT_CUSTOM_BOTH_OOB
} GstEventType;
#undef FLAG
diff -puNr gstreamer-0.10.13.orig/gst/gstindex.h gstreamer-0.10.13/gst/gstindex.h
--- gstreamer-0.10.13.orig/gst/gstindex.h 2006-04-08 19:05:16.000000000 +0100
+++ gstreamer-0.10.13/gst/gstindex.h 2007-07-15 11:34:50.000000000 +0100
@@ -294,10 +294,10 @@ typedef gboolean (*GstIndexResolver)
* Flags for this index
*/
typedef enum {
- GST_INDEX_WRITABLE = (GST_OBJECT_FLAG_LAST << 0),
- GST_INDEX_READABLE = (GST_OBJECT_FLAG_LAST << 1),
+ GST_INDEX_WRITABLE,
+ GST_INDEX_READABLE,
- GST_INDEX_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
+ GST_INDEX_FLAG_LAST
} GstIndexFlags;
/**
diff -puNr gstreamer-0.10.13.orig/gst/gstpad.h gstreamer-0.10.13/gst/gstpad.h
--- gstreamer-0.10.13.orig/gst/gstpad.h 2007-05-24 15:08:47.000000000 +0100
+++ gstreamer-0.10.13/gst/gstpad.h 2007-07-15 11:35:39.000000000 +0100
@@ -486,13 +486,13 @@ typedef enum {
* Pad state flags
*/
typedef enum {
- GST_PAD_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
- GST_PAD_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
- GST_PAD_IN_GETCAPS = (GST_OBJECT_FLAG_LAST << 2),
- GST_PAD_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3),
- GST_PAD_BLOCKING = (GST_OBJECT_FLAG_LAST << 4),
+ GST_PAD_BLOCKED,
+ GST_PAD_FLUSHING,
+ GST_PAD_IN_GETCAPS,
+ GST_PAD_IN_SETCAPS,
+ GST_PAD_BLOCKING,
/* padding */
- GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 8)
+ GST_PAD_FLAG_LAST
} GstPadFlags;
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
diff -puNr gstreamer-0.10.13.orig/gst/gstpadtemplate.h gstreamer-0.10.13/gst/gstpadtemplate.h
--- gstreamer-0.10.13.orig/gst/gstpadtemplate.h 2007-02-28 14:42:42.000000000 +0000
+++ gstreamer-0.10.13/gst/gstpadtemplate.h 2007-07-15 11:36:28.000000000 +0100
@@ -103,9 +103,9 @@ typedef enum {
* Flags for the padtemplate
*/
typedef enum {
- GST_PAD_TEMPLATE_FIXED = (GST_OBJECT_FLAG_LAST << 0),
+ GST_PAD_TEMPLATE_FIXED,
/* padding */
- GST_PAD_TEMPLATE_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 4)
+ GST_PAD_TEMPLATE_FLAG_LAST
} GstPadTemplateFlags;
/**
......@@ -57,7 +57,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
string metadata;
long metadata_len;
ulong metadata_len;
FileUtils.get_contents (metadata_filename, out metadata, out metadata_len);
foreach (string line in metadata.split ("\n")) {
......@@ -434,7 +434,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (member.type == IdlNodeTypeId.FUNCTION) {
bool is_virtual = current_type_vfunc_map.lookup (member.name) != null;
var m = parse_function ((IdlNodeFunction) member, is_virtual);
var m = parse_function ((IdlNodeFunction) member, is_virtual, true);
if (m != null) {
iface.add_method (m);
}
......@@ -548,7 +548,7 @@ public class Vala.GIdlParser : CodeVisitor {
type.type_name = "ValueArray";
} else if (n == "time_t") {
type.type_name = "ulong";
} else if (n == "pid_t") {
} else if (n == "gint" || n == "pid_t") {
type.type_name = "int";
} else if (n == "FILE") {
type.namespace_name = "GLib";
......@@ -583,7 +583,7 @@ public class Vala.GIdlParser : CodeVisitor {
private void parse_type_string (TypeReference! type, string! n) {
// Generated GIDL misses explicit namespace specifier,
// so try to guess namespace
if (n.has_prefix ("H") || n.has_suffix ("Class") || n == "va_list" || n.has_prefix ("LOGFONT")) {
if (n.has_prefix ("H") || n.has_suffix ("Class") || n == "va_list" || n.has_prefix ("LOGFONT") || n.has_prefix ("xml")) {
// unsupported
type.type_name = "pointer";
} else if (n.has_prefix ("cairo")) {
......@@ -603,6 +603,19 @@ public class Vala.GIdlParser : CodeVisitor {
type.namespace_name = "GLib";
type.type_name = "SList";
}
} else if (n.has_prefix ("Gst")) {
type.namespace_name = "Gst";
type.type_name = n.offset ("Gst".len ());
if (type.type_name == "ClockTime") {
type.namespace_name = null;
type.type_name = "uint64";
} else if (type.type_name == "ClockTimeDiff") {
type.namespace_name = null;
type.type_name = "int64";
} else if (type.type_name == "ClockID" || type.type_name.has_prefix ("Xml")) {
type.namespace_name = null;
type.type_name = "pointer";
}
} else if (n.has_prefix ("Gtk")) {
type.namespace_name = "Gtk";
type.type_name = n.offset ("Gtk".len ());
......@@ -640,6 +653,9 @@ public class Vala.GIdlParser : CodeVisitor {
type.namespace_name = null;
type.type_name = "string";
type.array_rank = 1;
} else if (type.type_name == "StaticRecMutex") {
type.namespace_name = null;
type.type_name = "pointer";
}
} else {
var name_parts = n.split (".", 2);
......@@ -661,7 +677,7 @@ public class Vala.GIdlParser : CodeVisitor {
return type;
}
private Method parse_function (IdlNodeFunction! f, bool is_virtual = false) {
private Method parse_function (IdlNodeFunction! f, bool is_virtual = false, bool is_interface = false) {
weak IdlNode node = (IdlNode) f;
if (f.deprecated) {
......@@ -674,7 +690,7 @@ public class Vala.GIdlParser : CodeVisitor {
}
Method m;
if (f.is_constructor || node.name.has_prefix ("new")) {
if (!is_interface && (f.is_constructor || node.name.has_prefix ("new"))) {
m = new CreationMethod (node.name, current_source_reference);
if (m.name == "new") {
m.name = null;
......@@ -858,6 +874,18 @@ public class Vala.GIdlParser : CodeVisitor {
if (!field_node.readable) {
return null;
}
var attributes = get_attributes ("%s.%s".printf (current_data_type.name, node.name));
if (attributes != null) {
foreach (string attr in attributes) {
var nv = attr.split ("=", 2);
if (nv[0] == "hidden") {
if (eval (nv[1]) == "1") {
return null;
}
}
}
}
if (current_type_symbol_map != null) {
current_type_symbol_map.insert (node.name, "1");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment