syntax error in VERSION script

iron_guitarist1987 jtrinidadperez at gmail.com
Tue May 29 12:43:35 PDT 2012


I have made this element based on the smtpe. I have removed all the effects
and properties, so all it does is output it's input. When I try to compile
it I get the following error:


jtrinid at jtrinid-VirtualBox:~/projects/gst-plugins-vpef/ext/ntoone$ make
  CC     libvpefNTOONE_la-gstntoone.lo
gstntoone.c: In function 'gst_ntoone_setcaps':
gstntoone.c:153:3: warning: passing argument 3 of 'gst_structure_get_int'
from incompatible pointer type [enabled by default]
/usr/include/gstreamer-0.10/gst/gststructure.h:197:25: note: expected 'gint
*' but argument is of type 'struct GstPad **'
gstntoone.c:147:11: warning: variable 'otherpad' set but not used
[-Wunused-but-set-variable]
gstntoone.c: In function 'gst_ntoone_plugin_init':
gstntoone.c:382:3: warning: implicit declaration of function
'gst_ntoone_get_type' [-Wimplicit-function-declaration]
gstntoone.c:382:3: warning: nested extern declaration of
'gst_ntoone_get_type' [-Wnested-externs]
gstntoone.c: At top level:
gstntoone.c:124:1: warning: 'gst_ntoone_class_init' defined but not used
[-Wunused-function]
gstntoone.c:107:1: warning: 'gst_ntoone_base_init' defined but not used
[-Wunused-function]
gstntoone.c:172:1: warning: 'gst_ntoone_init' defined but not used
[-Wunused-function]
  CCLD   libvpefNTOONE.la
/usr/bin/ld:.libs/libvpefNTOONE.ver:2: syntax error in VERSION script
collect2: ld returned 1 exit status
make: *** [libvpefNTOONE.la] Error 1



Here is the code:

/* GStreamer
 * Copyright (C) <1999> Erik Walthinsen <omega at cse.ogi.edu>
 *
 * 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.
 */

/**
 * SECTION:element-ntoone
 * <refsect2>
 * <title>Sample pipelines</title>
 * |[
 * gst-launch -v videotestsrc pattern=1 ! ntoone name=s ! ffmpegcolorspace !
ximagesink videotestsrc ! s.
 * </refsect2>
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "gstntoone.h"
#include <gst/video/video.h>

#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
#define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2)
#define I420_V_ROWSTRIDE(width)
((GST_ROUND_UP_8(I420_Y_ROWSTRIDE(width)))/2)

#define I420_Y_OFFSET(w,h) (0)
#define I420_U_OFFSET(w,h)
(I420_Y_OFFSET(w,h)+(I420_Y_ROWSTRIDE(w)*GST_ROUND_UP_2(h)))
#define I420_V_OFFSET(w,h)
(I420_U_OFFSET(w,h)+(I420_U_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))

#define I420_SIZE(w,h)    
(I420_V_OFFSET(w,h)+(I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))

GST_DEBUG_CATEGORY_STATIC (gst_ntoone_debug);
#define GST_CAT_DEFAULT gst_ntoone_debug

static GstStaticPadTemplate gst_ntoone_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
    GST_PAD_SRC,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("ANY")
    );

static GstStaticPadTemplate gst_ntoone_sink1_template =
GST_STATIC_PAD_TEMPLATE ("sink1",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("ANY")
    );

static GstStaticPadTemplate gst_ntoone_sink2_template =
GST_STATIC_PAD_TEMPLATE ("sink2",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ("ANY")
    );


/* NTOONE signals and args */
enum
{
  /* FILL ME */
  LAST_SIGNAL
};



enum
{
  PROP_0,
  PROP_LAST
};



static void gst_ntoone_class_init (GstNTOONEClass * klass);
static void gst_ntoone_base_init (GstNTOONEClass * klass);
static void gst_ntoone_init (GstNTOONE * ntoone);
static void gst_ntoone_finalize (GstNTOONE * ntoone);

static GstFlowReturn gst_ntoone_collected (GstCollectPads * pads,
    GstNTOONE * ntoone);

static void gst_ntoone_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec);
static void gst_ntoone_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec);

static GstStateChangeReturn gst_ntoone_change_state (GstElement * element,
    GstStateChange transition);

static GstElementClass *parent_class = NULL;

static void
gst_ntoone_base_init (GstNTOONEClass * klass)
{
  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);

  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&gst_ntoone_sink1_template));
  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&gst_ntoone_sink2_template));
  gst_element_class_add_pad_template (element_class,
      gst_static_pad_template_get (&gst_ntoone_src_template));
  gst_element_class_set_details_simple (element_class, "NTOONE",
      "Template",
      "Two inputs and one output",
      "Jason Trinidad <jtrinidadperez at gmail.com>");
}

static void
gst_ntoone_class_init (GstNTOONEClass * klass)
{
  GObjectClass *gobject_class;
  GstElementClass *gstelement_class;

  gobject_class = (GObjectClass *) klass;
  gstelement_class = (GstElementClass *) klass;

  parent_class = g_type_class_peek_parent (klass);

  gobject_class->set_property = gst_ntoone_set_property;
  gobject_class->get_property = gst_ntoone_get_property;
  gobject_class->finalize = (GObjectFinalizeFunc) gst_ntoone_finalize;

  gstelement_class->change_state = GST_DEBUG_FUNCPTR
(gst_ntoone_change_state);
}

static gboolean
gst_ntoone_setcaps (GstPad * pad, GstCaps * caps)
{
  GstNTOONE *ntoone;
  GstStructure *structure;
  gboolean ret;
  GstPad *otherpad;

  ntoone = GST_NTOONE (GST_PAD_PARENT (pad));

  structure = gst_caps_get_structure (caps, 0);

  gst_structure_get_int (structure, "rate", &ntoone->srcpad);
  otherpad = (pad == ntoone->srcpad) ? ntoone->sinkpad1 : ntoone->srcpad;
  gst_object_unref (ntoone);

  /* for backward compat, we store these here */
  ntoone->fps = ((gdouble) ntoone->fps_num) / ntoone->fps_denom;

  /* figure out the duration in frames */
  ntoone->end_position = gst_util_uint64_scale (ntoone->duration,
      ntoone->fps_num, GST_SECOND * ntoone->fps_denom);

  GST_DEBUG_OBJECT (ntoone, "duration: %d frames", ntoone->end_position);

  ret = gst_pad_set_caps (pad, caps);

  return ret;
}

static void
gst_ntoone_init (GstNTOONE * ntoone)
{
  ntoone->sinkpad1 =
      gst_pad_new_from_static_template (&gst_ntoone_sink1_template,
"sink1");
  gst_pad_set_setcaps_function (ntoone->sinkpad1,
      GST_DEBUG_FUNCPTR (gst_ntoone_setcaps));
  gst_pad_set_getcaps_function (ntoone->sinkpad1,
      GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
  gst_element_add_pad (GST_ELEMENT (ntoone), ntoone->sinkpad1);

  ntoone->sinkpad2 =
      gst_pad_new_from_static_template (&gst_ntoone_sink2_template,
"sink2");
  gst_pad_set_setcaps_function (ntoone->sinkpad2,
      GST_DEBUG_FUNCPTR (gst_ntoone_setcaps));
  gst_pad_set_getcaps_function (ntoone->sinkpad2,
      GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
  gst_element_add_pad (GST_ELEMENT (ntoone), ntoone->sinkpad2);

  ntoone->srcpad =
      gst_pad_new_from_static_template (&gst_ntoone_src_template, "src");
  gst_element_add_pad (GST_ELEMENT (ntoone), ntoone->srcpad);

  ntoone->collect = gst_collect_pads_new ();
  gst_collect_pads_set_function (ntoone->collect,
      (GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_ntoone_collected),
ntoone);
  gst_collect_pads_start (ntoone->collect);

  gst_collect_pads_add_pad (ntoone->collect, ntoone->sinkpad1,
      sizeof (GstCollectData));
  gst_collect_pads_add_pad (ntoone->collect, ntoone->sinkpad2,
      sizeof (GstCollectData));
}

static void
gst_ntoone_finalize (GstNTOONE * ntoone)
{
  if (ntoone->collect) {
    gst_object_unref (ntoone->collect);
  }

  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) ntoone);
}

static void
gst_ntoone_reset (GstNTOONE * ntoone)
{
  ntoone->width = -1;
  ntoone->height = -1;
  ntoone->position = 0;
  ntoone->end_position = 0;
}


static GstFlowReturn
gst_ntoone_collected (GstCollectPads * pads, GstNTOONE * ntoone)
{
  GstBuffer *outbuf;
  GstClockTime ts;
  GstBuffer *in1 = NULL, *in2 = NULL;
  GSList *collected;

  if (G_UNLIKELY (ntoone->fps_num == 0))
    goto not_negotiated;

  if (!GST_PAD_CAPS (ntoone->sinkpad1) || !GST_PAD_CAPS (ntoone->sinkpad2))
    goto not_negotiated;

  ts = gst_util_uint64_scale_int (ntoone->position * GST_SECOND,
      ntoone->fps_denom, ntoone->fps_num);

  for (collected = pads->data; collected; collected = g_slist_next
(collected)) {
    GstCollectData *data;

    data = (GstCollectData *) collected->data;

    if (data->pad == ntoone->sinkpad1)
      in1 = gst_collect_pads_pop (pads, data);
    else if (data->pad == ntoone->sinkpad2)
      in2 = gst_collect_pads_pop (pads, data);
  }

  if (in1 == NULL) {
    /* if no input, make picture black */
    in1 = gst_buffer_new_and_alloc (I420_SIZE (ntoone->width,
ntoone->height));
  }
  if (in2 == NULL) {
    /* if no input, make picture white */
    in2 = gst_buffer_new_and_alloc (I420_SIZE (ntoone->width,
ntoone->height));
  }

  if (GST_BUFFER_SIZE (in1) != GST_BUFFER_SIZE (in2))
    goto input_formats_do_not_match;

  if (ntoone->position < ntoone->end_position) {
    outbuf = in1;

    /* set caps if not done yet */
    if (!GST_PAD_CAPS (ntoone->srcpad)) {
      GstCaps *caps;

      caps =
          gst_caps_copy (gst_static_caps_get
          (&gst_ntoone_src_template.static_caps));
      gst_caps_set_simple (caps, "width", G_TYPE_INT, ntoone->width,
"height",
          G_TYPE_INT, ntoone->height, "framerate", GST_TYPE_FRACTION,
          ntoone->fps_num, ntoone->fps_denom, NULL);

      gst_pad_set_caps (ntoone->srcpad, caps);

      gst_pad_push_event (ntoone->srcpad,
          gst_event_new_new_segment_full (FALSE,
              1.0, 1.0, GST_FORMAT_TIME, 0, -1, 0));

    }
    gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ntoone->srcpad));

  } else {
    outbuf = in2;
    gst_buffer_ref (in2);
  }

  ntoone->position++;

  if (in1)
    gst_buffer_unref (in1);
  if (in2)
    gst_buffer_unref (in2);

  GST_BUFFER_TIMESTAMP (outbuf) = ts;

  return gst_pad_push (ntoone->srcpad, outbuf);

  /* ERRORS */
not_negotiated:
  {
    GST_ELEMENT_ERROR (ntoone, CORE, NEGOTIATION, (NULL),
        ("No input format negotiated"));
    return GST_FLOW_NOT_NEGOTIATED;
  }
input_formats_do_not_match:
  {
    GST_ELEMENT_ERROR (ntoone, CORE, NEGOTIATION, (NULL),
        ("input formats don't match: %" GST_PTR_FORMAT " vs. %"
GST_PTR_FORMAT,
            GST_PAD_CAPS (ntoone->sinkpad1), GST_PAD_CAPS
(ntoone->sinkpad2)));
    return GST_FLOW_ERROR;
  }
}

static void
gst_ntoone_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}

static void
gst_ntoone_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec)
{
  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}

static GstStateChangeReturn
gst_ntoone_change_state (GstElement * element, GstStateChange transition)
{
  GstStateChangeReturn ret;
  GstNTOONE *ntoone;

  ntoone = GST_NTOONE (element);

  switch (transition) {
    case GST_STATE_CHANGE_READY_TO_PAUSED:
      gst_ntoone_reset (ntoone);
      GST_LOG_OBJECT (ntoone, "starting collectpads");
      gst_collect_pads_start (ntoone->collect);
      break;
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      GST_LOG_OBJECT (ntoone, "stopping collectpads");
      gst_collect_pads_stop (ntoone->collect);
      break;
    default:
      break;
  }

  ret = parent_class->change_state (element, transition);

  switch (transition) {
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      gst_ntoone_reset (ntoone);
      break;
    default:
      break;
  }
  return ret;
}

gboolean
gst_ntoone_plugin_init (GstPlugin * plugin)
{
  GST_DEBUG_CATEGORY_INIT (gst_ntoone_debug, "ntoone", 0,
      "NTOONE");

  return gst_element_register (plugin, "ntoone", GST_RANK_NONE,
GST_TYPE_NTOONE);
}


Any ideas? Thanks.


-----
The greatest trick the devil ever pulled was convincing the World that Java was better than C++.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/syntax-error-in-VERSION-script-tp4655137.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list