android: Make it ready for androgenizer
[platform/upstream/gst-plugins-good.git] / gst / flx / gstflxdec.c
index 1b8d448..627aad1 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+/**
+ * SECTION:element-flxdec
+ *
+ * This element decodes fli/flc/flx-video into raw video
+ */
+/*
+ * http://www.coolutils.com/Formats/FLI
+ * http://woodshole.er.usgs.gov/operations/modeling/flc.html
+ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 GST_DEBUG_CATEGORY_STATIC (flxdec_debug);
 #define GST_CAT_DEFAULT flxdec_debug
 
-/* flx element information */
-static GstElementDetails flxdec_details = {
-  "FLX Decoder",
-  "Codec/Decoder/Audio",
-  "FLX decoder",
-  "Sepp Wijnands <mrrazz@garbage-coderz.net>, Zeeshan Ali <zeenix@gmail.com>"
-};
-
-/* Flx signals and args */
-enum
-{
-  /* FILL ME */
-  LAST_SIGNAL
-};
-
-enum
-{
-  ARG_0
-};
-
 /* input */
 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
@@ -69,6 +58,7 @@ static GstStaticPadTemplate src_video_factory = GST_STATIC_PAD_TEMPLATE ("src",
 static void gst_flxdec_class_init (GstFlxDecClass * klass);
 static void gst_flxdec_base_init (GstFlxDecClass * klass);
 static void gst_flxdec_init (GstFlxDec * flxdec);
+static void gst_flxdec_dispose (GstFlxDec * flxdec);
 
 static GstFlowReturn gst_flxdec_chain (GstPad * pad, GstBuffer * buf);
 
@@ -79,12 +69,6 @@ static gboolean gst_flxdec_src_query_handler (GstPad * pad, GstQuery * query);
 static gboolean gst_flxdec_src_event_handler (GstPad * pad, GstEvent * event);
 static gboolean gst_flxdec_sink_event_handler (GstPad * pad, GstEvent * event);
 
-static void gst_flxdec_set_property (GObject * object, guint prop_id,
-    const GValue * value, GParamSpec * pspec);
-static void gst_flxdec_get_property (GObject * object, guint prop_id,
-    GValue * value, GParamSpec * pspec);
-
-
 static void flx_decode_color (GstFlxDec *, guchar *, guchar *, gint);
 static void flx_decode_brun (GstFlxDec *, guchar *, guchar *);
 static void flx_decode_delta_fli (GstFlxDec *, guchar *, guchar *);
@@ -123,7 +107,10 @@ gst_flxdec_base_init (GstFlxDecClass * klass)
 {
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
 
-  gst_element_class_set_details (gstelement_class, &flxdec_details);
+  gst_element_class_set_details_simple (gstelement_class, "FLX video decoder",
+      "Codec/Decoder/Video",
+      "FLC/FLI/FLX video decoder",
+      "Sepp Wijnands <mrrazz@garbage-coderz.net>, Zeeshan Ali <zeenix@gmail.com>");
   gst_element_class_add_pad_template (gstelement_class,
       gst_static_pad_template_get (&sink_factory));
   gst_element_class_add_pad_template (gstelement_class,
@@ -139,12 +126,11 @@ gst_flxdec_class_init (GstFlxDecClass * klass)
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
-  GST_DEBUG_CATEGORY_INIT (flxdec_debug, "flxdec", 0, "FLX video decoder");
+  gobject_class->dispose = (GObjectFinalizeFunc) gst_flxdec_dispose;
 
-  gobject_class->set_property = gst_flxdec_set_property;
-  gobject_class->get_property = gst_flxdec_get_property;
+  GST_DEBUG_CATEGORY_INIT (flxdec_debug, "flxdec", 0, "FLX video decoder");
 
   gstelement_class->change_state = gst_flxdec_change_state;
 }
@@ -152,16 +138,12 @@ gst_flxdec_class_init (GstFlxDecClass * klass)
 static void
 gst_flxdec_init (GstFlxDec * flxdec)
 {
-  flxdec->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
-      "sink");
+  flxdec->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
   gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->sinkpad);
   gst_pad_set_chain_function (flxdec->sinkpad, gst_flxdec_chain);
   gst_pad_set_event_function (flxdec->sinkpad, gst_flxdec_sink_event_handler);
 
-  flxdec->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&src_video_factory), "src");
+  flxdec->srcpad = gst_pad_new_from_static_template (&src_video_factory, "src");
   gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->srcpad);
   gst_pad_set_query_function (flxdec->srcpad, gst_flxdec_src_query_handler);
   gst_pad_set_event_function (flxdec->srcpad, gst_flxdec_src_event_handler);
@@ -174,6 +156,17 @@ gst_flxdec_init (GstFlxDec * flxdec)
   flxdec->adapter = gst_adapter_new ();
 }
 
+static void
+gst_flxdec_dispose (GstFlxDec * flxdec)
+{
+  if (flxdec->adapter) {
+    g_object_unref (flxdec->adapter);
+    flxdec->adapter = NULL;
+  }
+
+  G_OBJECT_CLASS (parent_class)->dispose ((GObject *) flxdec);
+}
+
 static gboolean
 gst_flxdec_src_query_handler (GstPad * pad, GstQuery * query)
 {
@@ -362,7 +355,7 @@ flx_decode_brun (GstFlxDec * flxdec, guchar * data, guchar * dest)
 static void
 flx_decode_delta_fli (GstFlxDec * flxdec, guchar * data, guchar * dest)
 {
-  gulong count, packets, lines, start_line, start_l;
+  gulong count, packets, lines, start_line;
   guchar *start_p, x;
 
   g_return_if_fail (flxdec != NULL);
@@ -379,7 +372,6 @@ flx_decode_delta_fli (GstFlxDec * flxdec, guchar * data, guchar * dest)
   /* start position of delta */
   dest += (flxdec->hdr.width * start_line);
   start_p = dest;
-  start_l = lines;
 
   while (lines--) {
     /* packet count */
@@ -684,37 +676,6 @@ gst_flxdec_change_state (GstElement * element, GstStateChange transition)
   return ret;
 }
 
-static void
-gst_flxdec_set_property (GObject * object, guint prop_id, const GValue * value,
-    GParamSpec * pspec)
-{
-  GstFlxDec *flxdec;
-
-  g_return_if_fail (GST_IS_FLXDEC (object));
-  flxdec = GST_FLXDEC (object);
-
-  switch (prop_id) {
-    default:
-      break;
-  }
-}
-
-static void
-gst_flxdec_get_property (GObject * object, guint prop_id, GValue * value,
-    GParamSpec * pspec)
-{
-  GstFlxDec *flxdec;
-
-  g_return_if_fail (GST_IS_FLXDEC (object));
-  flxdec = GST_FLXDEC (object);
-
-  switch (prop_id) {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
@@ -725,5 +686,5 @@ plugin_init (GstPlugin * plugin)
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
     GST_VERSION_MINOR,
     "flxdec",
-    "FLX video decoder",
+    "FLC/FLI/FLX video decoder",
     plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)