Commit 242b113f authored by Olivier Crête's avatar Olivier Crête

Use GstPushSrc as a base class

parent e2383f9b
......@@ -50,9 +50,7 @@ GST_DEBUG_CATEGORY_STATIC (nicesrc_debug);
static GstFlowReturn
gst_nice_src_create (
GstBaseSrc *basesrc,
guint64 offset,
guint length,
GstPushSrc *basesrc,
GstBuffer **buffer);
static gboolean
......@@ -93,7 +91,7 @@ GST_STATIC_PAD_TEMPLATE (
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
G_DEFINE_TYPE (GstNiceSrc, gst_nice_src, GST_TYPE_BASE_SRC);
G_DEFINE_TYPE (GstNiceSrc, gst_nice_src, GST_TYPE_PUSH_SRC);
enum
{
......@@ -106,6 +104,7 @@ enum
static void
gst_nice_src_class_init (GstNiceSrcClass *klass)
{
GstPushSrcClass *gstpushsrc_class;
GstBaseSrcClass *gstbasesrc_class;
GstElementClass *gstelement_class;
GObjectClass *gobject_class;
......@@ -113,8 +112,10 @@ gst_nice_src_class_init (GstNiceSrcClass *klass)
GST_DEBUG_CATEGORY_INIT (nicesrc_debug, "nicesrc",
0, "libnice source");
gstpushsrc_class = (GstPushSrcClass *) klass;
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_nice_src_create);
gstbasesrc_class = (GstBaseSrcClass *) klass;
gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_nice_src_create);
gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_nice_src_unlock);
gstbasesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_nice_src_unlock_stop);
......@@ -262,17 +263,13 @@ gst_nice_src_unlock_stop (GstBaseSrc *src)
static GstFlowReturn
gst_nice_src_create (
GstBaseSrc *basesrc,
guint64 offset,
guint length,
GstPushSrc *basesrc,
GstBuffer **buffer)
{
GstNiceSrc *nicesrc = GST_NICE_SRC (basesrc);
GST_LOG_OBJECT (nicesrc, "create called");
nicesrc->offset = offset;
GST_OBJECT_LOCK (basesrc);
if (nicesrc->unlocked) {
GST_OBJECT_UNLOCK (basesrc);
......
......@@ -39,7 +39,7 @@
#define _GSTNICESRC_H
#include <gst/gst.h>
#include <gst/base/gstbasesrc.h>
#include <gst/base/gstpushsrc.h>
#include <nice/nice.h>
......@@ -60,15 +60,13 @@ typedef struct _GstNiceSrc GstNiceSrc;
struct _GstNiceSrc
{
GstBaseSrc parent;
GstPushSrc parent;
GstPad *srcpad;
NiceAgent *agent;
guint stream_id;
guint component_id;
GMainContext *mainctx;
GMainLoop *mainloop;
guint64 offset;
GstFlowReturn flow_ret;
GQueue *outbufs;
gboolean unlocked;
GSource *idle_source;
......@@ -78,7 +76,7 @@ typedef struct _GstNiceSrcClass GstNiceSrcClass;
struct _GstNiceSrcClass
{
GstBaseSrcClass parent_class;
GstPushSrcClass parent_class;
};
GType gst_nice_src_get_type (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment