Can you help me how to inherit gstdecodebin3 properly ??

HoonHee Lee hoonh83.lee at gmail.com
Sun Jan 21 23:09:43 UTC 2018


Dear All.
 
I am using decodebin3 in our target board.
And there are so many modifications in decodebin3 for our target board.
 
So, my purpose is that to inherit decodebin3 and all modifications for our
target will be moved to tvdecodebin.
I made gsttvdecodebin.c but, I encountered the error.
 
================================================================
make[1]: Entering directory
`/home/hoonheelee/work/jhbuild-gstreamer/build-1.12.gld4tv/gst-plugins-base/gst/playback'
  CC       libgstplayback_la-gstdecodebin3.lo
  CC       libgstplayback_la-gsttvdecodebin.lo
gsttvdecodebin.c:31:0: error: "GST_CAT_DEFAULT" redefined [-Werror]
 #define GST_CAT_DEFAULT tv_decodebin_debug
 ^
In file included from gsttvdecodebin.c:28:0:
gstdecodebin3.c:180:0: note: this is the location of the previous definition
 #define GST_CAT_DEFAULT decodebin3_debug
 ^
gsttvdecodebin.c:67:39: error: redefinition of 'parent_class'
 #define gst_tv_decodebin_parent_class parent_class
                                       ^
/home/hoonheelee/work/jhbuild-gstreamer/install-1.12.gld4tv/include/glib-2.0/gobject/gtype.h:1934:17:
note: in expansion of macro 'gst_tv_decodebin_parent_class'
 static gpointer type_name##_parent_class = NULL; \
                 ^
/home/hoonheelee/work/jhbuild-gstreamer/install-1.12.gld4tv/include/glib-2.0/gobject/gtype.h:1729:60:
note: in expansion of macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
 #define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)    
_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;}
_G_DEFINE_TYPE_EXTENDED_END()
                                                            ^
/home/hoonheelee/work/jhbuild-gstreamer/install-1.12.gld4tv/include/glib-2.0/gobject/gtype.h:1587:43:
note: in expansion of macro 'G_DEFINE_TYPE_EXTENDED'
 #define G_DEFINE_TYPE(TN, t_n, T_P)       G_DEFINE_TYPE_EXTENDED (TN, t_n,
T_P, 0, {})
                                           ^
gsttvdecodebin.c:68:1: note: in expansion of macro 'G_DEFINE_TYPE'
 G_DEFINE_TYPE (GstTVDecodebin, gst_tv_decodebin, GST_TYPE_DECODEBIN3);
 ^
In file included from gsttvdecodebin.c:28:0:
gstdecodebin3.c:452:37: note: previous definition of 'parent_class' was here
 #define gst_decodebin3_parent_class parent_class
                                     ^
/home/hoonheelee/work/jhbuild-gstreamer/install-1.12.gld4tv/include/glib-2.0/gobject/gtype.h:1934:17:
note: in expansion of macro 'gst_decodebin3_parent_class'
 static gpointer type_name##_parent_class = NULL; \
                 ^
/home/hoonheelee/work/jhbuild-gstreamer/install-1.12.gld4tv/include/glib-2.0/gobject/gtype.h:1729:60:
note: in expansion of macro '_G_DEFINE_TYPE_EXTENDED_BEGIN'
 #define G_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)    
_G_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;}
_G_DEFINE_TYPE_EXTENDED_END()
                                                            ^
/home/hoonheelee/work/jhbuild-gstreamer/install-1.12.gld4tv/include/glib-2.0/gobject/gtype.h:1587:43:
note: in expansion of macro 'G_DEFINE_TYPE_EXTENDED'
 #define G_DEFINE_TYPE(TN, t_n, T_P)       G_DEFINE_TYPE_EXTENDED (TN, t_n,
T_P, 0, {})
                                           ^
gstdecodebin3.c:453:1: note: in expansion of macro 'G_DEFINE_TYPE'
 G_DEFINE_TYPE (GstDecodebin3, gst_decodebin3, GST_TYPE_BIN);
 ^
cc1: all warnings being treated as errors
make[1]: *** [libgstplayback_la-gsttvdecodebin.lo] Error 1
make[1]: Leaving directory
`/home/hoonheelee/work/jhbuild-gstreamer/build-1.12.gld4tv/gst-plugins-base/gst/playback'
make: *** [all] Error 2
================================================================

 
This is tvdecodebin3.c
===========================================================
#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

#include <gst/gst.h>
#include "gstdecodebin3.c"

GST_DEBUG_CATEGORY (tv_decodebin_debug);
#define GST_CAT_DEFAULT tv_decodebin_debug

#define GST_TYPE_TV_DECODEBIN \
  (gst_tv_decodebin_get_type())
#define GST_TV_DECODEBIN(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TV_DECODEBIN,GstTVDecodebin))
#define GST_TV_DECODEBIN_CLASS(klass) \
 
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TV_DECODEBIN,GstTVDecodebinClass))
#define GST_IS_TV_DECODEBIN(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TV_DECODEBIN))
#define GST_IS_TV_DECODEBIN_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TV_DECODEBIN))
#define GST_TV_DECODEBIN_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS
((obj),GST_TYPE_TV_DECODEBIN,GstTVDecodebinClass))
#define GST_TV_DECODEBIN_CAST(obj) \
  ((GstTVDecodebin *)obj)

typedef struct _GstTVDecodebin GstTVDecodebin;
typedef struct _GstTVDecodebinClass GstTVDecodebinClass;
 
/**
 * GstTVDecodebin:
 *
 * Opaque #GstTVDecodebin data structure.
 */
struct _GstTVDecodebin
{
  GstDecodebin3 parent;
};

struct _GstTVDecodebinClass
{
  GstDecodebin3Class parent_class;
};

GType gst_tv_decodebin_get_type (void);
#define gst_tv_decodebin_parent_class parent_class
G_DEFINE_TYPE (GstTVDecodebin, gst_tv_decodebin, GST_TYPE_DECODEBIN3);

/* GObject */
static void gst_tv_decodebin_finalize (GObject * obj);

/* GstElement */
static GstStateChangeReturn
gst_tv_decodebin_change_state (GstElement * element, GstStateChange
transition);

static void
gst_tv_decodebin_finalize (GObject * obj)
{
  // GstTVDecodebin *tvdbin = GST_TV_DECODEBIN (obj);

  G_OBJECT_CLASS (parent_class)->finalize (obj);
}
 
static void
gst_tv_decodebin_class_init (GstTVDecodebinClass * klass)
{
  GObjectClass *gobject_class;
  GstElementClass *element_class;
  // GstTVDecodebinClass *tvdbin_class;

  gobject_class = (GObjectClass *) klass;
  element_class = (GstElementClass *) klass;
  // tvdbin_class = (GstTVDecodebinClass *) klass;

  gobject_class->finalize = gst_tv_decodebin_finalize;

  element_class->change_state =
      GST_DEBUG_FUNCPTR (gst_tv_decodebin_change_state);

  gst_element_class_set_static_metadata (element_class,
      "TV Decoder Bin 3", "Generic/Bin/Decoder",
      "Autoplug and decode to raw media",
      "HoonHee Lee <hoonhee.lee at lge.com>, DongYun Seo
<dongyun.seo at lge.com>");
}

static void
gst_tv_decodebin_init (GstTVDecodebin * tvdbin)
{

}
 
static GstStateChangeReturn
gst_tv_decodebin_change_state (GstElement * element, GstStateChange
transition)
{
  GstStateChangeReturn ret;
  // GstTVDecodebin *tvdbin = GST_TV_DECODEBIN (element);

  switch (transition) {
    case GST_STATE_CHANGE_READY_TO_PAUSED:
      // gst_hls_demux_reset (GST_ADAPTIVE_DEMUX_CAST (demux));
      break;
    default:
      break;
  }

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

  switch (transition) {
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      // gst_hls_demux_reset (GST_ADAPTIVE_DEMUX_CAST (demux));
      // g_hash_table_remove_all (demux->keys);
      break;
    default:
      break;
  }
  return ret;
}

gboolean
gst_tv_decodebin_plugin_init (GstPlugin * plugin)
{
  GST_DEBUG_CATEGORY_INIT (tv_decodebin_debug, "tvdecodebin3", 0,
      "tv decoder bin");

  return gst_element_register (plugin, "tvdecodebin", GST_RANK_NONE,
      GST_TYPE_TV_DECODEBIN);
}
===============================================================
 
Can you help me how to inherit decodebin3 and use properly ??
 
Thanks.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list