[gst-devel] flac patch to compile under glib2

Andy Wingo apwingo at eos.ncsu.edu
Thu Oct 25 10:25:09 CEST 2001


hey folks,

the attached patch allows me to compile flac under glib2. ok to commit?

wingo.
-------------- next part --------------
? flac.patch
Index: flacdec.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/flac/flacdec.c,v
retrieving revision 1.3
diff -u -r1.3 flacdec.c
--- flacdec.c	2001/08/01 22:44:35	1.3
+++ flacdec.c	2001/10/25 17:22:28
@@ -1,4 +1,4 @@
-/* Gnome-Streamer
+/* GStreamer
  * Copyright (C) <1999> Erik Walthinsen <omega at cse.ogi.edu>
  *
  * This library is free software; you can redistribute it and/or
@@ -67,22 +67,23 @@
 static GstElementClass *parent_class = NULL;
 //static guint gst_flacdec_signals[LAST_SIGNAL] = { 0 };
 
-GtkType
+GType
 flacdec_get_type(void) {
-  static GtkType flacdec_type = 0;
+  static GType flacdec_type = 0;
 
   if (!flacdec_type) {
-    static const GtkTypeInfo flacdec_info = {
-      "FlacDec",
-      sizeof(FlacDec),
+    static const GTypeInfo flacdec_info = {
       sizeof(FlacDecClass),
-      (GtkClassInitFunc)gst_flacdec_class_init,
-      (GtkObjectInitFunc)gst_flacdec_init,
-      (GtkArgSetFunc)NULL,
-      (GtkArgGetFunc)NULL,
-      (GtkClassInitFunc)NULL,
+      NULL,
+      NULL,
+      (GClassInitFunc)gst_flacdec_class_init,
+      NULL,
+      NULL,
+      sizeof(FlacDec),
+      0,
+      (GInstanceInitFunc)gst_flacdec_init,
     };
-    flacdec_type = gtk_type_unique(GST_TYPE_ELEMENT,&flacdec_info);
+    flacdec_type = g_type_register_static (GST_TYPE_FLACDEC, "FlacDec", &flacdec_info, 0);
   }
   return flacdec_type;
 }
@@ -94,7 +95,7 @@
 
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = gtk_type_class(GST_TYPE_ELEMENT);
+  parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 }
 
 static void 
Index: flacdec.h
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/flac/flacdec.h,v
retrieving revision 1.1
diff -u -r1.1 flacdec.h
--- flacdec.h	2001/06/17 19:44:50	1.1
+++ flacdec.h	2001/10/25 17:22:28
@@ -32,16 +32,11 @@
 #endif /* __cplusplus */
 
 
-#define GST_TYPE_FLACDEC \
-  (flacdec_get_type())
-#define GST_FLACDEC(obj) \
-  (GTK_CHECK_CAST((obj),GST_TYPE_FLACDEC,FlacDec))
-#define GST_FLACDEC_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_FLACDEC,FlacDec))
-#define GST_IS_FLACDEC(obj) \
-  (GTK_CHECK_TYPE((obj),GST_TYPE_FLACDEC))
-#define GST_IS_FLACDEC_CLASS(obj) \
-  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FLACDEC))
+#define GST_TYPE_FLACDEC flacdec_get_type()
+#define GST_FLACDEC(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_FLACDEC, FlacDec)
+#define GST_FLACDEC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_FLACDEC, FlacDec)
+#define GST_IS_FLACDEC(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, GST_TYPE_FLACDEC)
+#define GST_IS_FLACDEC_CLASS(obj) G_TYPE_CHECK_CLASS_TYPE(klass, GST_TYPE_FLACDEC)
 
 typedef struct _FlacDec FlacDec;
 typedef struct _FlacDecClass FlacDecClass;
@@ -64,7 +59,7 @@
   GstElementClass parent_class;
 };
 
-GtkType flacdec_get_type(void);
+GType flacdec_get_type(void);
 
 
 #ifdef __cplusplus
Index: flacenc.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/flac/flacenc.c,v
retrieving revision 1.5
diff -u -r1.5 flacenc.c
--- flacenc.c	2001/08/06 20:20:30	1.5
+++ flacenc.c	2001/10/25 17:22:28
@@ -51,8 +51,8 @@
 
 static void	gst_flacenc_chain		(GstPad *pad, GstBuffer *buf);
 
-static void     gst_flacenc_get_arg           	(GtkObject *object, GtkArg *arg, guint id);
-static void     gst_flacenc_set_arg           	(GtkObject *object, GtkArg *arg, guint id);
+static void     gst_flacenc_set_property        (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void     gst_flacenc_get_property        (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
 
 static FLAC__StreamEncoderWriteStatus 
 		gst_flacenc_write_callback 	(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, 
@@ -63,23 +63,24 @@
 static GstElementClass *parent_class = NULL;
 //static guint gst_flacenc_signals[LAST_SIGNAL] = { 0 };
 
-GtkType
+GType
 flacenc_get_type (void)
 {
-  static GtkType flacenc_type = 0;
+  static GType flacenc_type = 0;
 
   if (!flacenc_type) {
-    static const GtkTypeInfo flacenc_info = {
-      "FlacEnc",
-      sizeof(FlacEnc),
+    static const GTypeInfo flacenc_info = {
       sizeof(FlacEncClass),
-      (GtkClassInitFunc)gst_flacenc_class_init,
-      (GtkObjectInitFunc)gst_flacenc_init,
-      (GtkArgSetFunc)NULL,
-      (GtkArgGetFunc)NULL,
-      (GtkClassInitFunc)NULL,
+      NULL,
+      NULL,
+      (GClassInitFunc)gst_flacenc_class_init,
+      NULL,
+      NULL,
+      sizeof(FlacEnc),
+      0,
+      (GInstanceInitFunc)gst_flacenc_init,
     };
-    flacenc_type = gtk_type_unique(GST_TYPE_ELEMENT,&flacenc_info);
+    flacenc_type = g_type_register_static (GST_TYPE_FLACENC, "FlacEnc", &flacenc_info, 0);
   }
   return flacenc_type;
 }
@@ -87,16 +88,17 @@
 static void
 gst_flacenc_class_init (FlacEncClass *klass)
 {
-  GtkObjectClass *gtkobject_class;
+  GObjectClass *gobject_class;
   GstElementClass *gstelement_class;
 
-  gtkobject_class = (GtkObjectClass*)klass;
+  gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
-
-  parent_class = gtk_type_class(GST_TYPE_ELEMENT);
 
-  gtkobject_class->set_arg = gst_flacenc_set_arg;
-  gtkobject_class->get_arg = gst_flacenc_get_arg;
+  parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+  
+  // we have no properties atm so this is a bit silly
+  gobject_class->set_property = gst_flacenc_set_property;
+  gobject_class->get_property = gst_flacenc_get_property;
 }
 
 static void
@@ -219,34 +221,29 @@
 }
 
 static void
-gst_flacenc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+gst_flacenc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
-  FlacEnc *flacenc;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_FLACENC (object));
-
-  flacenc = GST_FLACENC (object);
-
-  switch (id) {
-    default:
-      break;
+  FlacEnc *this;
+  
+  this = (FlacEnc *)object;
+  switch (prop_id) {
+  default:
+    GST_DEBUG(0, "Unknown arg %d\n", prop_id);
+    return;
   }
 }
 
 static void
-gst_flacenc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+gst_flacenc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 {
-  FlacEnc *flacenc;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_FLACENC (object));
-
-  flacenc = GST_FLACENC (object);
-
-  switch (id) {
-    default:
-      break;
+  FlacEnc *this;
+  
+  this = (FlacEnc *)object;
+  
+  switch (prop_id) {
+  default:
+    GST_DEBUG(0, "Unknown arg %d\n", prop_id);
+    break;
   }
 }
 
Index: flacenc.h
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/flac/flacenc.h,v
retrieving revision 1.3
diff -u -r1.3 flacenc.h
--- flacenc.h	2001/06/18 19:20:15	1.3
+++ flacenc.h	2001/10/25 17:22:28
@@ -1,4 +1,4 @@
-/* Gnome-Streamer
+/* GStreamer
  * Copyright (C) <1999> Erik Walthinsen <omega at cse.ogi.edu>
  *
  * This library is free software; you can redistribute it and/or
@@ -31,16 +31,11 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#define GST_TYPE_FLACENC \
-  (flacenc_get_type())
-#define GST_FLACENC(obj) \
-  (GTK_CHECK_CAST((obj),GST_TYPE_FLACENC,FlacEnc))
-#define GST_FLACENC_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_FLACENC,FlacEnc))
-#define GST_IS_FLACENC(obj) \
-  (GTK_CHECK_TYPE((obj),GST_TYPE_FLACENC))
-#define GST_IS_FLACENC_CLASS(obj) \
-  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_FLACENC))
+#define GST_TYPE_FLACENC flacenc_get_type()
+#define GST_FLACENC(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_FLACENC, FlacEnc)
+#define GST_FLACENC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_FLACENC, FlacEnc)
+#define GST_IS_FLACENC(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, GST_TYPE_FLACENC)
+#define GST_IS_FLACENC_CLASS(obj) G_TYPE_CHECK_CLASS_TYPE(klass, GST_TYPE_FLACENC)
 
 typedef struct _FlacEnc FlacEnc;
 typedef struct _FlacEncClass FlacEncClass;
@@ -62,7 +57,7 @@
   GstElementClass parent_class;
 };
 
-GtkType flacenc_get_type(void);
+GType flacenc_get_type(void);
 
 
 #ifdef __cplusplus


More information about the gstreamer-devel mailing list