? gstrealvideodec.h
? real.diff
Index: Makefile.am
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/real/Makefile.am,v
retrieving revision 1.1
diff -u -3 -p -b -B -d -r1.1 Makefile.am
--- Makefile.am	1 Jan 2007 17:47:53 -0000	1.1
+++ Makefile.am	2 Jan 2007 17:59:27 -0000
@@ -1,6 +1,6 @@
 plugin_LTLIBRARIES = libgstreal.la 
 
-libgstreal_la_SOURCES = gstreal.c
+libgstreal_la_SOURCES = gstreal.c gstrealvideodec.h
 
 libgstreal_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS)
 libgstreal_la_LIBADD = $(GST_BASE_LIBS)
Index: gstreal.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/real/gstreal.c,v
retrieving revision 1.2
diff -u -3 -p -b -B -d -r1.2 gstreal.c
--- gstreal.c	2 Jan 2007 11:06:48 -0000	1.2
+++ gstreal.c	2 Jan 2007 17:59:27 -0000
@@ -32,17 +32,12 @@
 #include <dlfcn.h>
 #include <string.h>
 
-#define GST_TYPE_REAL_DEC            (gst_realdec_get_type())
-#define GST_REAL_DEC(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_REAL_DEC,GstRealDec))
-#define GST_REAL_DEC_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_REAL_DEC,GstRealDecClass))
-
-GST_DEBUG_CATEGORY_STATIC (realdec_debug);
-#define GST_CAT_DEFAULT realdec_debug
+#include "gstrealvideodec.h"
 
-typedef struct _GstRealDec GstRealDec;
-typedef struct _GstRealDecClass GstRealDecClass;
+GST_DEBUG_CATEGORY_STATIC (real_video_dec_debug);
+#define GST_CAT_DEFAULT real_video_dec_debug
 
-static GstElementDetails realdec_details =
+static GstElementDetails real_video_dec_details =
 GST_ELEMENT_DETAILS ("RealVideo decoder",
     "Codec/Decoder", "Decoder for RealVideo streams",
     "Lutz Mueller <lutz@topfrose.de>");
@@ -71,19 +66,19 @@ enum
 
 typedef enum
 {
-  GST_REAL_DEC_VERSION_2 = 2,
-  GST_REAL_DEC_VERSION_3 = 3,
-  GST_REAL_DEC_VERSION_4 = 4
-} GstRealDecVersion;
+  GST_REAL_VIDEO_DEC_VERSION_2 = 2,
+  GST_REAL_VIDEO_DEC_VERSION_3 = 3,
+  GST_REAL_VIDEO_DEC_VERSION_4 = 4
+} GstRealVideoDecVersion;
 
-struct _GstRealDec
+struct _GstRealVideoDec
 {
   GstElement parent;
 
   GstPad *src, *snk;
 
   /* Caps */
-  GstRealDecVersion version;
+  GstRealVideoDecVersion version;
   guint width, height;
   gint format, subformat;
   gint framerate_num, framerate_denom;
@@ -113,15 +108,15 @@ struct _GstRealDec
   gchar *path_rv20, *path_rv30, *path_rv40;
 };
 
-struct _GstRealDecClass
+struct _GstRealVideoDecClass
 {
   GstElementClass parent_class;
 };
 
-GST_BOILERPLATE (GstRealDec, gst_realdec, GstElement, GST_TYPE_ELEMENT);
+GST_BOILERPLATE (GstRealVideoDec, gst_real_video_dec, GstElement, GST_TYPE_ELEMENT);
 
 static GstFlowReturn
-gst_realdec_alloc_buffer (GstRealDec * dec, GstClockTime timestamp,
+gst_real_video_dec_alloc_buffer (GstRealVideoDec * dec, GstClockTime timestamp,
     GstBuffer ** buf)
 {
   GstFlowReturn ret;
@@ -135,7 +130,7 @@ gst_realdec_alloc_buffer (GstRealDec * d
   /* Fix timestamp. */
   b = gst_adapter_peek (dec->adapter, 4);
   switch (dec->version) {
-    case GST_REAL_DEC_VERSION_2:
+    case GST_REAL_VIDEO_DEC_VERSION_2:
     {
 
       /*
@@ -148,7 +143,7 @@ gst_realdec_alloc_buffer (GstRealDec * d
       seq = ((b[1] & 0x7f) << 6) + ((b[2] & 0xfc) >> 2);
       break;
     }
-    case GST_REAL_DEC_VERSION_3:
+    case GST_REAL_VIDEO_DEC_VERSION_3:
     {
       /*
        * Bit  1- 2: ?
@@ -162,7 +157,7 @@ gst_realdec_alloc_buffer (GstRealDec * d
       seq = ((b[1] & 0x0f) << 9) + (b[2] << 1) + ((b[3] & 0x80) >> 7);
       break;
     }
-    case GST_REAL_DEC_VERSION_4:
+    case GST_REAL_VIDEO_DEC_VERSION_4:
     {
       /*
        * Bit     1: skip packet if 1
@@ -245,7 +240,7 @@ unknown_frame_type:
 }
 
 static GstFlowReturn
-gst_realdec_decode (GstRealDec * dec, GstBuffer * in, guint offset)
+gst_real_video_dec_decode (GstRealVideoDec * dec, GstBuffer * in, guint offset)
 {
   guint32 result;
   GstBuffer *out = NULL;
@@ -351,8 +346,8 @@ gst_realdec_decode (GstRealDec * dec, Gs
       gst_adapter_available (dec->adapter);
 
   /* Some buffers need to be skipped. */
-  if (((dec->version == GST_REAL_DEC_VERSION_3) && (*buf & 0x20)) ||
-      ((dec->version == GST_REAL_DEC_VERSION_4) && (*buf & 0x80))) {
+  if (((dec->version == GST_REAL_VIDEO_DEC_VERSION_3) && (*buf & 0x20)) ||
+      ((dec->version == GST_REAL_VIDEO_DEC_VERSION_4) && (*buf & 0x80))) {
     dec->fragment_count--;
     dec->length -= len;
   } else {
@@ -367,7 +362,7 @@ gst_realdec_decode (GstRealDec * dec, Gs
     guint32 tin[6] = { 0, 0, 0, 0, 0, 0 }
     , tout[5];
 
-    if ((ret = gst_realdec_alloc_buffer (dec, timestamp, &out)) != GST_FLOW_OK)
+    if ((ret = gst_real_video_dec_alloc_buffer (dec, timestamp, &out)) != GST_FLOW_OK)
       return ret;
 
     /* Decode */
@@ -411,7 +406,7 @@ gst_realdec_decode (GstRealDec * dec, Gs
     if (n > 0) {
       GST_LOG_OBJECT (dec, "Data left in the adapter: %d", n);
       in = gst_adapter_take_buffer (dec->adapter, n);
-      ret = gst_realdec_decode (dec, in, 0);
+      ret = gst_real_video_dec_decode (dec, in, 0);
       gst_buffer_unref (in);
       if (ret != GST_FLOW_OK)
         return ret;
@@ -461,9 +456,9 @@ could_not_push:
 }
 
 static GstFlowReturn
-gst_realdec_chain (GstPad * pad, GstBuffer * in)
+gst_real_video_dec_chain (GstPad * pad, GstBuffer * in)
 {
-  GstRealDec *dec = GST_REAL_DEC (GST_PAD_PARENT (pad));
+  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (GST_PAD_PARENT (pad));
   guint8 flags, *buf = GST_BUFFER_DATA (in);
   guint len = GST_BUFFER_SIZE (in);
   GstFlowReturn ret;
@@ -481,7 +476,7 @@ gst_realdec_chain (GstPad * pad, GstBuff
     return GST_FLOW_OK;
   }
 
-  ret = gst_realdec_decode (dec, in, 1);
+  ret = gst_real_video_dec_decode (dec, in, 1);
   gst_buffer_unref (in);
   if (ret != GST_FLOW_OK)
     return ret;
@@ -497,9 +492,9 @@ not_enough_data:
 }
 
 static gboolean
-gst_realdec_activate_push (GstPad * pad, gboolean active)
+gst_real_video_dec_activate_push (GstPad * pad, gboolean active)
 {
-  GstRealDec *dec = GST_REAL_DEC (GST_PAD_PARENT (pad));
+  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (GST_PAD_PARENT (pad));
 
   gst_adapter_clear (dec->adapter);
 
@@ -507,9 +502,9 @@ gst_realdec_activate_push (GstPad * pad,
 }
 
 static gboolean
-gst_realdec_setcaps (GstPad * pad, GstCaps * caps)
+gst_real_video_dec_setcaps (GstPad * pad, GstCaps * caps)
 {
-  GstRealDec *dec = GST_REAL_DEC (GST_PAD_PARENT (pad));
+  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (GST_PAD_PARENT (pad));
   GstStructure *s = gst_caps_get_structure (caps, 0);
   gchar *path;
   gint version, res;
@@ -530,13 +525,13 @@ gst_realdec_setcaps (GstPad * pad, GstCa
   GST_LOG_OBJECT (dec, "Setting version to %d", version);
 
   switch (dec->version) {
-    case GST_REAL_DEC_VERSION_2:
+    case GST_REAL_VIDEO_DEC_VERSION_2:
       path = dec->path_rv20 ? dec->path_rv20 : DEFAULT_PATH_RV20;
       break;
-    case GST_REAL_DEC_VERSION_3:
+    case GST_REAL_VIDEO_DEC_VERSION_3:
       path = dec->path_rv30 ? dec->path_rv30 : DEFAULT_PATH_RV30;
       break;
-    case GST_REAL_DEC_VERSION_4:
+    case GST_REAL_VIDEO_DEC_VERSION_4:
       path = dec->path_rv40 ? dec->path_rv40 : DEFAULT_PATH_RV40;
       break;
     default:
@@ -661,13 +656,13 @@ could_not_set_caps:
 }
 
 static void
-gst_realdec_init (GstRealDec * dec, GstRealDecClass * klass)
+gst_real_video_dec_init (GstRealVideoDec * dec, GstRealVideoDecClass * klass)
 {
   dec->snk =
       gst_pad_new_from_template (gst_static_pad_template_get (&snk_t), "sink");
-  gst_pad_set_setcaps_function (dec->snk, gst_realdec_setcaps);
-  gst_pad_set_chain_function (dec->snk, gst_realdec_chain);
-  gst_pad_set_activatepush_function (dec->snk, gst_realdec_activate_push);
+  gst_pad_set_setcaps_function (dec->snk, gst_real_video_dec_setcaps);
+  gst_pad_set_chain_function (dec->snk, gst_real_video_dec_chain);
+  gst_pad_set_activatepush_function (dec->snk, gst_real_video_dec_activate_push);
   gst_element_add_pad (GST_ELEMENT (dec), dec->snk);
 
   dec->src =
@@ -678,19 +673,19 @@ gst_realdec_init (GstRealDec * dec, GstR
 }
 
 static void
-gst_realdec_base_init (gpointer g_class)
+gst_real_video_dec_base_init (gpointer g_class)
 {
   GstElementClass *ec = GST_ELEMENT_CLASS (g_class);
 
   gst_element_class_add_pad_template (ec, gst_static_pad_template_get (&snk_t));
   gst_element_class_add_pad_template (ec, gst_static_pad_template_get (&src_t));
-  gst_element_class_set_details (ec, &realdec_details);
+  gst_element_class_set_details (ec, &real_video_dec_details);
 }
 
 static void
-gst_realdec_finalize (GObject * object)
+gst_real_video_dec_finalize (GObject * object)
 {
-  GstRealDec *dec = GST_REAL_DEC (object);
+  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
 
   if (dec->context) {
     dec->free (dec->context);
@@ -722,10 +717,10 @@ gst_realdec_finalize (GObject * object)
 }
 
 static void
-gst_realdec_set_property (GObject * object, guint prop_id,
+gst_real_video_dec_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
-  GstRealDec *dec = GST_REAL_DEC (object);
+  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
 
   /* Changing the location of the .so supposes it's not being done
    * in a state greater than READY !
@@ -754,10 +749,10 @@ gst_realdec_set_property (GObject * obje
 }
 
 static void
-gst_realdec_get_property (GObject * object, guint prop_id,
+gst_real_video_dec_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
 {
-  GstRealDec *dec = GST_REAL_DEC (object);
+  GstRealVideoDec *dec = GST_REAL_VIDEO_DEC (object);
 
   switch (prop_id) {
     case PROP_PATH_RV20:
@@ -779,13 +774,13 @@ gst_realdec_get_property (GObject * obje
 }
 
 static void
-gst_realdec_class_init (GstRealDecClass * klass)
+gst_real_video_dec_class_init (GstRealVideoDecClass * klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  object_class->set_property = gst_realdec_set_property;
-  object_class->get_property = gst_realdec_get_property;
-  object_class->finalize = gst_realdec_finalize;
+  object_class->set_property = gst_real_video_dec_set_property;
+  object_class->get_property = gst_real_video_dec_get_property;
+  object_class->finalize = gst_real_video_dec_finalize;
 
   g_object_class_install_property (object_class, PROP_PATH_RV20,
       g_param_spec_string ("path_rv20", "Path to rv20 driver",
@@ -797,13 +792,13 @@ gst_realdec_class_init (GstRealDecClass 
       g_param_spec_string ("path_rv40", "Path to rv40 driver",
           "Path to rv40 driver", DEFAULT_PATH_RV40, G_PARAM_READWRITE));
 
-  GST_DEBUG_CATEGORY_INIT (realdec_debug, "realdec", 0, "REAL decoder");
+  GST_DEBUG_CATEGORY_INIT (real_video_dec_debug, "realvideodec", 0, "REAL video decoder");
 }
 
 static gboolean
 plugin_init (GstPlugin * p)
 {
-  if (!gst_element_register (p, "realdec", GST_RANK_PRIMARY, GST_TYPE_REAL_DEC))
+  if (!gst_element_register (p, "realvideodec", GST_RANK_PRIMARY, GST_TYPE_REAL_VIDEO_DEC))
     return FALSE;
   return TRUE;
 }
