mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
inter: Port to 1.0 API
Also remove a lot of empty, non-implemented methods
This commit is contained in:
parent
b7d63d3fb1
commit
b1fcf14da5
9 changed files with 112 additions and 1051 deletions
|
@ -314,7 +314,7 @@ GST_PLUGINS_NONPORTED=" aiff \
|
|||
cdxaparse \
|
||||
dccp faceoverlay \
|
||||
fieldanalysis freeverb frei0r \
|
||||
hdvparse inter ivfparse jp2kdecimator \
|
||||
hdvparse ivfparse jp2kdecimator \
|
||||
kate librfb \
|
||||
mpegpsmux mve mxf mythtv nsf nuvdemux \
|
||||
patchdetect real \
|
||||
|
|
|
@ -57,30 +57,14 @@ static void gst_inter_audio_sink_set_property (GObject * object,
|
|||
guint property_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_audio_sink_get_property (GObject * object,
|
||||
guint property_id, GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_audio_sink_dispose (GObject * object);
|
||||
static void gst_inter_audio_sink_finalize (GObject * object);
|
||||
|
||||
static GstCaps *gst_inter_audio_sink_get_caps (GstBaseSink * sink);
|
||||
static gboolean gst_inter_audio_sink_set_caps (GstBaseSink * sink,
|
||||
GstCaps * caps);
|
||||
static GstFlowReturn gst_inter_audio_sink_buffer_alloc (GstBaseSink * sink,
|
||||
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
||||
static void gst_inter_audio_sink_get_times (GstBaseSink * sink,
|
||||
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
|
||||
static gboolean gst_inter_audio_sink_start (GstBaseSink * sink);
|
||||
static gboolean gst_inter_audio_sink_stop (GstBaseSink * sink);
|
||||
static gboolean gst_inter_audio_sink_unlock (GstBaseSink * sink);
|
||||
static gboolean gst_inter_audio_sink_event (GstBaseSink * sink,
|
||||
GstEvent * event);
|
||||
static GstFlowReturn gst_inter_audio_sink_preroll (GstBaseSink * sink,
|
||||
GstBuffer * buffer);
|
||||
static GstFlowReturn gst_inter_audio_sink_render (GstBaseSink * sink,
|
||||
GstBuffer * buffer);
|
||||
static GstStateChangeReturn gst_inter_audio_sink_async_play (GstBaseSink *
|
||||
sink);
|
||||
static gboolean gst_inter_audio_sink_activate_pull (GstBaseSink * sink,
|
||||
gboolean active);
|
||||
static gboolean gst_inter_audio_sink_unlock_stop (GstBaseSink * sink);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -94,28 +78,25 @@ static GstStaticPadTemplate gst_inter_audio_sink_sink_template =
|
|||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, " "rate = (int) 48000, " "channels = (int) 2")
|
||||
GST_STATIC_CAPS ("audio/x-raw, format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"rate = (int) 48000, channels = (int) 2")
|
||||
);
|
||||
|
||||
|
||||
/* class initialization */
|
||||
|
||||
#define DEBUG_INIT(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_audio_sink_debug_category, "interaudiosink", 0, \
|
||||
"debug category for interaudiosink element");
|
||||
|
||||
GST_BOILERPLATE_FULL (GstInterAudioSink, gst_inter_audio_sink, GstBaseSink,
|
||||
GST_TYPE_BASE_SINK, DEBUG_INIT);
|
||||
G_DEFINE_TYPE (GstInterAudioSink, gst_inter_audio_sink, GST_TYPE_BASE_SINK);
|
||||
|
||||
static void
|
||||
gst_inter_audio_sink_base_init (gpointer g_class)
|
||||
gst_inter_audio_sink_class_init (GstInterAudioSinkClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_audio_sink_debug_category,
|
||||
"interaudiosink", 0, "debug category for interaudiosink element");
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_audio_sink_sink_template));
|
||||
|
||||
|
@ -124,41 +105,15 @@ gst_inter_audio_sink_base_init (gpointer g_class)
|
|||
"Sink/Audio",
|
||||
"Virtual audio sink for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_audio_sink_class_init (GstInterAudioSinkClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_inter_audio_sink_set_property;
|
||||
gobject_class->get_property = gst_inter_audio_sink_get_property;
|
||||
gobject_class->dispose = gst_inter_audio_sink_dispose;
|
||||
gobject_class->finalize = gst_inter_audio_sink_finalize;
|
||||
base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_get_caps);
|
||||
base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_set_caps);
|
||||
if (0)
|
||||
base_sink_class->buffer_alloc =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_sink_buffer_alloc);
|
||||
base_sink_class->get_times =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_sink_get_times);
|
||||
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_start);
|
||||
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_stop);
|
||||
base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_unlock);
|
||||
if (0)
|
||||
base_sink_class->event = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_event);
|
||||
//if (0)
|
||||
base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_preroll);
|
||||
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_inter_audio_sink_render);
|
||||
if (0)
|
||||
base_sink_class->async_play =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_sink_async_play);
|
||||
if (0)
|
||||
base_sink_class->activate_pull =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_sink_activate_pull);
|
||||
base_sink_class->unlock_stop =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_sink_unlock_stop);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CHANNEL,
|
||||
g_param_spec_string ("channel", "Channel",
|
||||
|
@ -167,8 +122,7 @@ gst_inter_audio_sink_class_init (GstInterAudioSinkClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_inter_audio_sink_init (GstInterAudioSink * interaudiosink,
|
||||
GstInterAudioSinkClass * interaudiosink_class)
|
||||
gst_inter_audio_sink_init (GstInterAudioSink * interaudiosink)
|
||||
{
|
||||
interaudiosink->channel = g_strdup ("default");
|
||||
}
|
||||
|
@ -206,16 +160,6 @@ gst_inter_audio_sink_get_property (GObject * object, guint property_id,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_audio_sink_dispose (GObject * object)
|
||||
{
|
||||
/* GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (object); */
|
||||
|
||||
/* clean up as possible. may be called multiple times */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_audio_sink_finalize (GObject * object)
|
||||
{
|
||||
|
@ -224,33 +168,10 @@ gst_inter_audio_sink_finalize (GObject * object)
|
|||
/* clean up object here */
|
||||
g_free (interaudiosink->channel);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gst_inter_audio_sink_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_inter_audio_sink_get_caps (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_audio_sink_buffer_alloc (GstBaseSink * sink, guint64 offset,
|
||||
guint size, GstCaps * caps, GstBuffer ** buf)
|
||||
{
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_audio_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
|
||||
GstClockTime * start, GstClockTime * end)
|
||||
|
@ -302,39 +223,18 @@ gst_inter_audio_sink_stop (GstBaseSink * sink)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_sink_unlock (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_sink_event (GstBaseSink * sink, GstEvent * event)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_audio_sink_preroll (GstBaseSink * sink, GstBuffer * buffer)
|
||||
{
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
||||
{
|
||||
GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
|
||||
int n;
|
||||
|
||||
GST_DEBUG ("render %d", GST_BUFFER_SIZE (buffer));
|
||||
GST_DEBUG ("render %d", gst_buffer_get_size (buffer));
|
||||
|
||||
g_mutex_lock (interaudiosink->surface->mutex);
|
||||
n = gst_adapter_available (interaudiosink->surface->audio_adapter) / 4;
|
||||
#define SIZE 1600
|
||||
if (n > (1600 * 3)) {
|
||||
if (n > (SIZE * 3)) {
|
||||
GST_WARNING ("flushing 800 samples");
|
||||
gst_adapter_flush (interaudiosink->surface->audio_adapter, (SIZE / 2) * 4);
|
||||
n -= (SIZE / 2);
|
||||
|
@ -345,24 +245,3 @@ gst_inter_audio_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_inter_audio_sink_async_play (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return GST_STATE_CHANGE_SUCCESS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_sink_activate_pull (GstBaseSink * sink, gboolean active)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_sink_unlock_stop (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,12 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstinteraudiosrc.h"
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstbasesrc.h>
|
||||
#include "gstinteraudiosrc.h"
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_inter_audio_src_debug_category);
|
||||
|
@ -54,33 +57,19 @@ static void gst_inter_audio_src_set_property (GObject * object,
|
|||
guint property_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_audio_src_get_property (GObject * object,
|
||||
guint property_id, GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_audio_src_dispose (GObject * object);
|
||||
static void gst_inter_audio_src_finalize (GObject * object);
|
||||
|
||||
static GstCaps *gst_inter_audio_src_get_caps (GstBaseSrc * src);
|
||||
static gboolean gst_inter_audio_src_set_caps (GstBaseSrc * src, GstCaps * caps);
|
||||
static gboolean gst_inter_audio_src_negotiate (GstBaseSrc * src);
|
||||
static gboolean gst_inter_audio_src_newsegment (GstBaseSrc * src);
|
||||
static gboolean gst_inter_audio_src_start (GstBaseSrc * src);
|
||||
static gboolean gst_inter_audio_src_stop (GstBaseSrc * src);
|
||||
static void
|
||||
gst_inter_audio_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
||||
GstClockTime * start, GstClockTime * end);
|
||||
static gboolean gst_inter_audio_src_is_seekable (GstBaseSrc * src);
|
||||
static gboolean gst_inter_audio_src_unlock (GstBaseSrc * src);
|
||||
static gboolean gst_inter_audio_src_event (GstBaseSrc * src, GstEvent * event);
|
||||
static GstFlowReturn
|
||||
gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||
GstBuffer ** buf);
|
||||
static gboolean gst_inter_audio_src_do_seek (GstBaseSrc * src,
|
||||
GstSegment * segment);
|
||||
static gboolean gst_inter_audio_src_query (GstBaseSrc * src, GstQuery * query);
|
||||
static gboolean gst_inter_audio_src_check_get_range (GstBaseSrc * src);
|
||||
static void gst_inter_audio_src_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
static gboolean gst_inter_audio_src_unlock_stop (GstBaseSrc * src);
|
||||
static gboolean
|
||||
gst_inter_audio_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||
GstSegment * segment);
|
||||
static GstCaps *gst_inter_audio_src_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -94,27 +83,24 @@ static GstStaticPadTemplate gst_inter_audio_src_src_template =
|
|||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, " "rate = (int) 48000, " "channels = (int) 2")
|
||||
GST_STATIC_CAPS ("audio/x-raw, format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"rate = (int) 48000, channels = (int) 2")
|
||||
);
|
||||
|
||||
|
||||
/* class initialization */
|
||||
|
||||
#define DEBUG_INIT(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_audio_src_debug_category, "interaudiosrc", 0, \
|
||||
"debug category for interaudiosrc element");
|
||||
|
||||
GST_BOILERPLATE_FULL (GstInterAudioSrc, gst_inter_audio_src, GstBaseSrc,
|
||||
GST_TYPE_BASE_SRC, DEBUG_INIT);
|
||||
G_DEFINE_TYPE (GstInterAudioSrc, gst_inter_audio_src, GST_TYPE_BASE_SRC);
|
||||
|
||||
static void
|
||||
gst_inter_audio_src_base_init (gpointer g_class)
|
||||
gst_inter_audio_src_class_init (GstInterAudioSrcClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_audio_src_debug_category, "interaudiosrc",
|
||||
0, "debug category for interaudiosrc element");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_audio_src_src_template));
|
||||
|
@ -124,47 +110,17 @@ gst_inter_audio_src_base_init (gpointer g_class)
|
|||
"Source/Audio",
|
||||
"Virtual audio source for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_audio_src_class_init (GstInterAudioSrcClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_inter_audio_src_set_property;
|
||||
gobject_class->get_property = gst_inter_audio_src_get_property;
|
||||
gobject_class->dispose = gst_inter_audio_src_dispose;
|
||||
gobject_class->finalize = gst_inter_audio_src_finalize;
|
||||
base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_src_get_caps);
|
||||
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_audio_src_set_caps);
|
||||
if (0)
|
||||
base_src_class->negotiate =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_src_negotiate);
|
||||
base_src_class->newsegment =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_src_newsegment);
|
||||
base_src_class->start = GST_DEBUG_FUNCPTR (gst_inter_audio_src_start);
|
||||
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_inter_audio_src_stop);
|
||||
base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_audio_src_get_times);
|
||||
if (0)
|
||||
base_src_class->is_seekable =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_src_is_seekable);
|
||||
base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_audio_src_unlock);
|
||||
base_src_class->event = GST_DEBUG_FUNCPTR (gst_inter_audio_src_event);
|
||||
base_src_class->create = GST_DEBUG_FUNCPTR (gst_inter_audio_src_create);
|
||||
if (0)
|
||||
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_inter_audio_src_do_seek);
|
||||
base_src_class->query = GST_DEBUG_FUNCPTR (gst_inter_audio_src_query);
|
||||
if (0)
|
||||
base_src_class->check_get_range =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_src_check_get_range);
|
||||
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_inter_audio_src_fixate);
|
||||
if (0)
|
||||
base_src_class->unlock_stop =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_src_unlock_stop);
|
||||
if (0)
|
||||
base_src_class->prepare_seek_segment =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_audio_src_prepare_seek_segment);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CHANNEL,
|
||||
g_param_spec_string ("channel", "Channel",
|
||||
|
@ -173,8 +129,7 @@ gst_inter_audio_src_class_init (GstInterAudioSrcClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_inter_audio_src_init (GstInterAudioSrc * interaudiosrc,
|
||||
GstInterAudioSrcClass * interaudiosrc_class)
|
||||
gst_inter_audio_src_init (GstInterAudioSrc * interaudiosrc)
|
||||
{
|
||||
gst_base_src_set_format (GST_BASE_SRC (interaudiosrc), GST_FORMAT_TIME);
|
||||
gst_base_src_set_live (GST_BASE_SRC (interaudiosrc), TRUE);
|
||||
|
@ -216,16 +171,6 @@ gst_inter_audio_src_get_property (GObject * object, guint property_id,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_audio_src_dispose (GObject * object)
|
||||
{
|
||||
/* GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (object); */
|
||||
|
||||
/* clean up as possible. may be called multiple times */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_audio_src_finalize (GObject * object)
|
||||
{
|
||||
|
@ -234,18 +179,7 @@ gst_inter_audio_src_finalize (GObject * object)
|
|||
/* clean up object here */
|
||||
g_free (interaudiosrc->channel);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_inter_audio_src_get_caps (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "get_caps");
|
||||
|
||||
return NULL;
|
||||
G_OBJECT_CLASS (gst_inter_audio_src_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -263,30 +197,13 @@ gst_inter_audio_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
|||
ret = gst_structure_get_int (structure, "rate", &sample_rate);
|
||||
if (ret) {
|
||||
interaudiosrc->sample_rate = sample_rate;
|
||||
|
||||
ret = gst_pad_set_caps (src->srcpad, caps);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_negotiate (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "negotiate");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_newsegment (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "newsegment");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_start (GstBaseSrc * src)
|
||||
|
@ -340,41 +257,6 @@ gst_inter_audio_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_is_seekable (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "is_seekable");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_unlock (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "unlock");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_event (GstBaseSrc * src, GstEvent * event)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
gboolean ret;
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "event");
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define SIZE 1600
|
||||
|
||||
|
@ -406,14 +288,12 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
g_mutex_unlock (interaudiosrc->surface->mutex);
|
||||
|
||||
if (n < SIZE) {
|
||||
GstBuffer *newbuf = gst_buffer_new_and_alloc (SIZE * 4);
|
||||
GstBuffer *newbuf = gst_buffer_new_and_alloc ((SIZE - n) * 4);
|
||||
|
||||
GST_WARNING ("creating %d samples of silence", SIZE - n);
|
||||
memset (GST_BUFFER_DATA (newbuf) + n * 4, 0, SIZE * 4 - n * 4);
|
||||
if (buffer) {
|
||||
memcpy (GST_BUFFER_DATA (newbuf), GST_BUFFER_DATA (buffer), n * 4);
|
||||
gst_buffer_unref (buffer);
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
newbuf = gst_buffer_append (newbuf, buffer);
|
||||
buffer = newbuf;
|
||||
}
|
||||
n = SIZE;
|
||||
|
@ -434,7 +314,6 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
if (interaudiosrc->n_samples == 0) {
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (GST_BASE_SRC_PAD (interaudiosrc)));
|
||||
interaudiosrc->n_samples += n;
|
||||
|
||||
*buf = buffer;
|
||||
|
@ -442,15 +321,6 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_do_seek (GstBaseSrc * src, GstSegment * segment)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "do_seek");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_query (GstBaseSrc * src, GstQuery * query)
|
||||
|
@ -479,29 +349,22 @@ gst_inter_audio_src_query (GstBaseSrc * src, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
|
||||
ret = GST_BASE_SRC_CLASS (gst_inter_audio_src_parent_class)->query (src,
|
||||
query);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_check_get_range (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "get_range");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
static GstCaps *
|
||||
gst_inter_audio_src_fixate (GstBaseSrc * src, GstCaps * caps)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
GstStructure *structure;
|
||||
|
||||
caps = gst_caps_make_writable (caps);
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "fixate");
|
||||
|
@ -509,25 +372,5 @@ gst_inter_audio_src_fixate (GstBaseSrc * src, GstCaps * caps)
|
|||
gst_structure_fixate_field_nearest_int (structure, "channels", 2);
|
||||
gst_structure_fixate_field_nearest_int (structure, "rate", 48000);
|
||||
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_unlock_stop (GstBaseSrc * src)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "stop");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_audio_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||
GstSegment * segment)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "seek_segment");
|
||||
|
||||
return FALSE;
|
||||
return caps;
|
||||
}
|
||||
|
|
|
@ -53,28 +53,13 @@ static void gst_inter_sub_sink_set_property (GObject * object,
|
|||
guint property_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_sub_sink_get_property (GObject * object,
|
||||
guint property_id, GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_sub_sink_dispose (GObject * object);
|
||||
static void gst_inter_sub_sink_finalize (GObject * object);
|
||||
|
||||
static GstCaps *gst_inter_sub_sink_get_caps (GstBaseSink * sink);
|
||||
static gboolean gst_inter_sub_sink_set_caps (GstBaseSink * sink,
|
||||
GstCaps * caps);
|
||||
static GstFlowReturn gst_inter_sub_sink_buffer_alloc (GstBaseSink * sink,
|
||||
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
||||
static void gst_inter_sub_sink_get_times (GstBaseSink * sink,
|
||||
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
|
||||
static gboolean gst_inter_sub_sink_start (GstBaseSink * sink);
|
||||
static gboolean gst_inter_sub_sink_stop (GstBaseSink * sink);
|
||||
static gboolean gst_inter_sub_sink_unlock (GstBaseSink * sink);
|
||||
static gboolean gst_inter_sub_sink_event (GstBaseSink * sink, GstEvent * event);
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_sink_preroll (GstBaseSink * sink, GstBuffer * buffer);
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_sink_render (GstBaseSink * sink, GstBuffer * buffer);
|
||||
static GstStateChangeReturn gst_inter_sub_sink_async_play (GstBaseSink * sink);
|
||||
static gboolean gst_inter_sub_sink_activate_pull (GstBaseSink * sink,
|
||||
gboolean active);
|
||||
static gboolean gst_inter_sub_sink_unlock_stop (GstBaseSink * sink);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -94,17 +79,17 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
|
||||
/* class initialization */
|
||||
|
||||
#define DEBUG_INIT(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_sub_sink_debug_category, "intersubsink", 0, \
|
||||
"debug category for intersubsink element");
|
||||
|
||||
GST_BOILERPLATE_FULL (GstInterSubSink, gst_inter_sub_sink, GstBaseSink,
|
||||
GST_TYPE_BASE_SINK, DEBUG_INIT);
|
||||
G_DEFINE_TYPE (GstInterSubSink, gst_inter_sub_sink, GST_TYPE_BASE_SINK);
|
||||
|
||||
static void
|
||||
gst_inter_sub_sink_base_init (gpointer g_class)
|
||||
gst_inter_sub_sink_class_init (GstInterSubSinkClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_sub_sink_debug_category, "intersubsink", 0,
|
||||
"debug category for intersubsink element");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_sub_sink_sink_template));
|
||||
|
@ -114,39 +99,13 @@ gst_inter_sub_sink_base_init (gpointer g_class)
|
|||
"Sink/Subtitle",
|
||||
"Virtual subtitle sink for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_sub_sink_class_init (GstInterSubSinkClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_inter_sub_sink_set_property;
|
||||
gobject_class->get_property = gst_inter_sub_sink_get_property;
|
||||
gobject_class->dispose = gst_inter_sub_sink_dispose;
|
||||
gobject_class->finalize = gst_inter_sub_sink_finalize;
|
||||
base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_get_caps);
|
||||
base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_set_caps);
|
||||
if (0)
|
||||
base_sink_class->buffer_alloc =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_sink_buffer_alloc);
|
||||
base_sink_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_get_times);
|
||||
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_start);
|
||||
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_stop);
|
||||
base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_unlock);
|
||||
if (0)
|
||||
base_sink_class->event = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_event);
|
||||
base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_preroll);
|
||||
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_inter_sub_sink_render);
|
||||
if (0)
|
||||
base_sink_class->async_play =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_sink_async_play);
|
||||
if (0)
|
||||
base_sink_class->activate_pull =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_sink_activate_pull);
|
||||
base_sink_class->unlock_stop =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_sink_unlock_stop);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CHANNEL,
|
||||
g_param_spec_string ("channel", "Channel",
|
||||
|
@ -156,8 +115,7 @@ gst_inter_sub_sink_class_init (GstInterSubSinkClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_inter_sub_sink_init (GstInterSubSink * intersubsink,
|
||||
GstInterSubSinkClass * intersubsink_class)
|
||||
gst_inter_sub_sink_init (GstInterSubSink * intersubsink)
|
||||
{
|
||||
|
||||
intersubsink->channel = g_strdup ("default");
|
||||
|
@ -199,50 +157,6 @@ gst_inter_sub_sink_get_property (GObject * object, guint property_id,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_sub_sink_dispose (GObject * object)
|
||||
{
|
||||
/* GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (object); */
|
||||
|
||||
/* clean up as possible. may be called multiple times */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_sub_sink_finalize (GObject * object)
|
||||
{
|
||||
/* GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (object); */
|
||||
|
||||
/* clean up object here */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_inter_sub_sink_get_caps (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size,
|
||||
GstCaps * caps, GstBuffer ** buf)
|
||||
{
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_sub_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
|
||||
GstClockTime * start, GstClockTime * end)
|
||||
|
@ -293,27 +207,6 @@ gst_inter_sub_sink_stop (GstBaseSink * sink)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_sink_unlock (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_sink_event (GstBaseSink * sink, GstEvent * event)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_sink_preroll (GstBaseSink * sink, GstBuffer * buffer)
|
||||
{
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
||||
{
|
||||
|
@ -329,24 +222,3 @@ gst_inter_sub_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_inter_sub_sink_async_play (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return GST_STATE_CHANGE_SUCCESS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_sink_activate_pull (GstBaseSink * sink, gboolean active)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_sink_unlock_stop (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -54,33 +54,15 @@ static void gst_inter_sub_src_set_property (GObject * object,
|
|||
guint property_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_sub_src_get_property (GObject * object,
|
||||
guint property_id, GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_sub_src_dispose (GObject * object);
|
||||
static void gst_inter_sub_src_finalize (GObject * object);
|
||||
|
||||
static GstCaps *gst_inter_sub_src_get_caps (GstBaseSrc * src);
|
||||
static gboolean gst_inter_sub_src_set_caps (GstBaseSrc * src, GstCaps * caps);
|
||||
static gboolean gst_inter_sub_src_negotiate (GstBaseSrc * src);
|
||||
static gboolean gst_inter_sub_src_newsegment (GstBaseSrc * src);
|
||||
static gboolean gst_inter_sub_src_start (GstBaseSrc * src);
|
||||
static gboolean gst_inter_sub_src_stop (GstBaseSrc * src);
|
||||
static void
|
||||
gst_inter_sub_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
||||
GstClockTime * start, GstClockTime * end);
|
||||
static gboolean gst_inter_sub_src_is_seekable (GstBaseSrc * src);
|
||||
static gboolean gst_inter_sub_src_unlock (GstBaseSrc * src);
|
||||
static gboolean gst_inter_sub_src_event (GstBaseSrc * src, GstEvent * event);
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||
GstBuffer ** buf);
|
||||
static gboolean gst_inter_sub_src_do_seek (GstBaseSrc * src,
|
||||
GstSegment * segment);
|
||||
static gboolean gst_inter_sub_src_query (GstBaseSrc * src, GstQuery * query);
|
||||
static gboolean gst_inter_sub_src_check_get_range (GstBaseSrc * src);
|
||||
static void gst_inter_sub_src_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
static gboolean gst_inter_sub_src_unlock_stop (GstBaseSrc * src);
|
||||
static gboolean
|
||||
gst_inter_sub_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||
GstSegment * segment);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -100,17 +82,17 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
|
||||
/* class initialization */
|
||||
|
||||
#define DEBUG_INIT(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_sub_src_debug_category, "intersubsrc", 0, \
|
||||
"debug category for intersubsrc element");
|
||||
|
||||
GST_BOILERPLATE_FULL (GstInterSubSrc, gst_inter_sub_src, GstBaseSrc,
|
||||
GST_TYPE_BASE_SRC, DEBUG_INIT);
|
||||
G_DEFINE_TYPE (GstInterSubSrc, gst_inter_sub_src, GST_TYPE_BASE_SRC);
|
||||
|
||||
static void
|
||||
gst_inter_sub_src_base_init (gpointer g_class)
|
||||
gst_inter_sub_src_class_init (GstInterSubSrcClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_sub_src_debug_category, "intersubsrc", 0,
|
||||
"debug category for intersubsrc element");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_sub_src_src_template));
|
||||
|
@ -120,48 +102,13 @@ gst_inter_sub_src_base_init (gpointer g_class)
|
|||
"Source/Subtitle",
|
||||
"Virtual subtitle source for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_sub_src_class_init (GstInterSubSrcClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_inter_sub_src_set_property;
|
||||
gobject_class->get_property = gst_inter_sub_src_get_property;
|
||||
gobject_class->dispose = gst_inter_sub_src_dispose;
|
||||
gobject_class->finalize = gst_inter_sub_src_finalize;
|
||||
if (0)
|
||||
base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_sub_src_get_caps);
|
||||
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_sub_src_set_caps);
|
||||
if (0)
|
||||
base_src_class->negotiate = GST_DEBUG_FUNCPTR (gst_inter_sub_src_negotiate);
|
||||
if (0)
|
||||
base_src_class->newsegment =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_src_newsegment);
|
||||
base_src_class->start = GST_DEBUG_FUNCPTR (gst_inter_sub_src_start);
|
||||
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_inter_sub_src_stop);
|
||||
base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_sub_src_get_times);
|
||||
if (0)
|
||||
base_src_class->is_seekable =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_src_is_seekable);
|
||||
base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_sub_src_unlock);
|
||||
base_src_class->event = GST_DEBUG_FUNCPTR (gst_inter_sub_src_event);
|
||||
base_src_class->create = GST_DEBUG_FUNCPTR (gst_inter_sub_src_create);
|
||||
if (0)
|
||||
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_inter_sub_src_do_seek);
|
||||
base_src_class->query = GST_DEBUG_FUNCPTR (gst_inter_sub_src_query);
|
||||
if (0)
|
||||
base_src_class->check_get_range =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_src_check_get_range);
|
||||
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_inter_sub_src_fixate);
|
||||
if (0)
|
||||
base_src_class->unlock_stop =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_src_unlock_stop);
|
||||
if (0)
|
||||
base_src_class->prepare_seek_segment =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_sub_src_prepare_seek_segment);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CHANNEL,
|
||||
g_param_spec_string ("channel", "Channel",
|
||||
|
@ -170,8 +117,7 @@ gst_inter_sub_src_class_init (GstInterSubSrcClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_inter_sub_src_init (GstInterSubSrc * intersubsrc,
|
||||
GstInterSubSrcClass * intersubsrc_class)
|
||||
gst_inter_sub_src_init (GstInterSubSrc * intersubsrc)
|
||||
{
|
||||
|
||||
intersubsrc->srcpad =
|
||||
|
@ -216,66 +162,6 @@ gst_inter_sub_src_get_property (GObject * object, guint property_id,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_sub_src_dispose (GObject * object)
|
||||
{
|
||||
/* GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (object); */
|
||||
|
||||
/* clean up as possible. may be called multiple times */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_sub_src_finalize (GObject * object)
|
||||
{
|
||||
/* GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (object); */
|
||||
|
||||
/* clean up object here */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_inter_sub_src_get_caps (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "get_caps");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "set_caps");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_negotiate (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "negotiate");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_newsegment (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "newsegment");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_start (GstBaseSrc * src)
|
||||
|
@ -329,41 +215,6 @@ gst_inter_sub_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_is_seekable (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "is_seekable");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_unlock (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "unlock");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_event (GstBaseSrc * src, GstEvent * event)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
gboolean ret;
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "event");
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||
|
@ -388,15 +239,16 @@ gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
g_mutex_unlock (intersubsrc->surface->mutex);
|
||||
|
||||
if (buffer == NULL) {
|
||||
guint8 *data;
|
||||
GstMapInfo map;
|
||||
|
||||
buffer = gst_buffer_new_and_alloc (1);
|
||||
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
data[0] = 0;
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
map.data[0] = 0;
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
}
|
||||
|
||||
buffer = gst_buffer_make_metadata_writable (buffer);
|
||||
buffer = gst_buffer_make_writable (buffer);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buffer) =
|
||||
gst_util_uint64_scale_int (GST_SECOND, intersubsrc->n_frames,
|
||||
|
@ -412,75 +264,9 @@ gst_inter_sub_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
if (intersubsrc->n_frames == 0) {
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (GST_BASE_SRC_PAD (intersubsrc)));
|
||||
intersubsrc->n_frames++;
|
||||
|
||||
*buf = buffer;
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_do_seek (GstBaseSrc * src, GstSegment * segment)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "do_seek");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_query (GstBaseSrc * src, GstQuery * query)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
gboolean ret;
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "query");
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_check_get_range (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "get_range");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_sub_src_fixate (GstBaseSrc * src, GstCaps * caps)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "fixate");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_unlock_stop (GstBaseSrc * src)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "stop");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_sub_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||
GstSegment * segment)
|
||||
{
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "seek_segment");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ gst_inter_test_create_pipeline_vts (GstInterTest * intertest)
|
|||
|
||||
g_string_append (pipe_desc, "videotestsrc name=source num-buffers=100 ! ");
|
||||
g_string_append (pipe_desc,
|
||||
"video/x-raw-yuv,format=(fourcc)I420,width=320,height=240 ! ");
|
||||
"video/x-raw,format=(string)I420,width=320,height=240 ! ");
|
||||
g_string_append (pipe_desc, "timeoverlay ! ");
|
||||
g_string_append (pipe_desc, "intervideosink name=sink sync=true ");
|
||||
g_string_append (pipe_desc,
|
||||
|
@ -454,7 +454,6 @@ gst_inter_test_handle_message (GstBus * bus, GstMessage * message,
|
|||
case GST_MESSAGE_ELEMENT:
|
||||
case GST_MESSAGE_SEGMENT_START:
|
||||
case GST_MESSAGE_SEGMENT_DONE:
|
||||
case GST_MESSAGE_DURATION:
|
||||
case GST_MESSAGE_LATENCY:
|
||||
case GST_MESSAGE_ASYNC_START:
|
||||
case GST_MESSAGE_ASYNC_DONE:
|
||||
|
|
|
@ -55,30 +55,14 @@ static void gst_inter_video_sink_set_property (GObject * object,
|
|||
guint property_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_video_sink_get_property (GObject * object,
|
||||
guint property_id, GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_video_sink_dispose (GObject * object);
|
||||
static void gst_inter_video_sink_finalize (GObject * object);
|
||||
|
||||
static GstCaps *gst_inter_video_sink_get_caps (GstBaseSink * sink);
|
||||
static gboolean gst_inter_video_sink_set_caps (GstBaseSink * sink,
|
||||
GstCaps * caps);
|
||||
static GstFlowReturn gst_inter_video_sink_buffer_alloc (GstBaseSink * sink,
|
||||
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
|
||||
static void gst_inter_video_sink_get_times (GstBaseSink * sink,
|
||||
GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
|
||||
static gboolean gst_inter_video_sink_start (GstBaseSink * sink);
|
||||
static gboolean gst_inter_video_sink_stop (GstBaseSink * sink);
|
||||
static gboolean gst_inter_video_sink_unlock (GstBaseSink * sink);
|
||||
static gboolean gst_inter_video_sink_event (GstBaseSink * sink,
|
||||
GstEvent * event);
|
||||
static GstFlowReturn gst_inter_video_sink_preroll (GstBaseSink * sink,
|
||||
GstBuffer * buffer);
|
||||
static GstFlowReturn gst_inter_video_sink_render (GstBaseSink * sink,
|
||||
GstBuffer * buffer);
|
||||
static GstStateChangeReturn gst_inter_video_sink_async_play (GstBaseSink *
|
||||
sink);
|
||||
static gboolean gst_inter_video_sink_activate_pull (GstBaseSink * sink,
|
||||
gboolean active);
|
||||
static gboolean gst_inter_video_sink_unlock_stop (GstBaseSink * sink);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -92,23 +76,23 @@ static GstStaticPadTemplate gst_inter_video_sink_sink_template =
|
|||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
|
||||
);
|
||||
|
||||
|
||||
/* class initialization */
|
||||
|
||||
#define DEBUG_INIT(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_video_sink_debug_category, "intervideosink", 0, \
|
||||
"debug category for intervideosink element");
|
||||
|
||||
GST_BOILERPLATE_FULL (GstInterVideoSink, gst_inter_video_sink, GstBaseSink,
|
||||
GST_TYPE_BASE_SINK, DEBUG_INIT);
|
||||
G_DEFINE_TYPE (GstInterVideoSink, gst_inter_video_sink, GST_TYPE_BASE_SINK);
|
||||
|
||||
static void
|
||||
gst_inter_video_sink_base_init (gpointer g_class)
|
||||
gst_inter_video_sink_class_init (GstInterVideoSinkClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_video_sink_debug_category,
|
||||
"intervideosink", 0, "debug category for intervideosink element");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_video_sink_sink_template));
|
||||
|
@ -118,41 +102,15 @@ gst_inter_video_sink_base_init (gpointer g_class)
|
|||
"Sink/Video",
|
||||
"Virtual video sink for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_video_sink_class_init (GstInterVideoSinkClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSinkClass *base_sink_class = GST_BASE_SINK_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_inter_video_sink_set_property;
|
||||
gobject_class->get_property = gst_inter_video_sink_get_property;
|
||||
gobject_class->dispose = gst_inter_video_sink_dispose;
|
||||
gobject_class->finalize = gst_inter_video_sink_finalize;
|
||||
base_sink_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_video_sink_get_caps);
|
||||
base_sink_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_video_sink_set_caps);
|
||||
if (0)
|
||||
base_sink_class->buffer_alloc =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_sink_buffer_alloc);
|
||||
base_sink_class->get_times =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_sink_get_times);
|
||||
base_sink_class->start = GST_DEBUG_FUNCPTR (gst_inter_video_sink_start);
|
||||
base_sink_class->stop = GST_DEBUG_FUNCPTR (gst_inter_video_sink_stop);
|
||||
base_sink_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_video_sink_unlock);
|
||||
if (0)
|
||||
base_sink_class->event = GST_DEBUG_FUNCPTR (gst_inter_video_sink_event);
|
||||
//if (0)
|
||||
base_sink_class->preroll = GST_DEBUG_FUNCPTR (gst_inter_video_sink_preroll);
|
||||
base_sink_class->render = GST_DEBUG_FUNCPTR (gst_inter_video_sink_render);
|
||||
if (0)
|
||||
base_sink_class->async_play =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_sink_async_play);
|
||||
if (0)
|
||||
base_sink_class->activate_pull =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_sink_activate_pull);
|
||||
base_sink_class->unlock_stop =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_sink_unlock_stop);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CHANNEL,
|
||||
g_param_spec_string ("channel", "Channel",
|
||||
|
@ -161,8 +119,7 @@ gst_inter_video_sink_class_init (GstInterVideoSinkClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_inter_video_sink_init (GstInterVideoSink * intervideosink,
|
||||
GstInterVideoSinkClass * intervideosink_class)
|
||||
gst_inter_video_sink_init (GstInterVideoSink * intervideosink)
|
||||
{
|
||||
intervideosink->channel = g_strdup ("default");
|
||||
}
|
||||
|
@ -200,16 +157,6 @@ gst_inter_video_sink_get_property (GObject * object, guint property_id,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_video_sink_dispose (GObject * object)
|
||||
{
|
||||
/* GstInterVideoSink *intervideosink = GST_INTER_VIDEO_SINK (object); */
|
||||
|
||||
/* clean up as possible. may be called multiple times */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_video_sink_finalize (GObject * object)
|
||||
{
|
||||
|
@ -218,33 +165,10 @@ gst_inter_video_sink_finalize (GObject * object)
|
|||
/* clean up object here */
|
||||
g_free (intervideosink->channel);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gst_inter_video_sink_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_inter_video_sink_get_caps (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_sink_set_caps (GstBaseSink * sink, GstCaps * caps)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_video_sink_buffer_alloc (GstBaseSink * sink, guint64 offset,
|
||||
guint size, GstCaps * caps, GstBuffer ** buf)
|
||||
{
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_video_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
|
||||
GstClockTime * start, GstClockTime * end)
|
||||
|
@ -295,28 +219,6 @@ gst_inter_video_sink_stop (GstBaseSink * sink)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_sink_unlock (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_sink_event (GstBaseSink * sink, GstEvent * event)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_video_sink_preroll (GstBaseSink * sink, GstBuffer * buffer)
|
||||
{
|
||||
//return gst_inter_video_sink_render (sink, buffer);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_video_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
||||
{
|
||||
|
@ -332,24 +234,3 @@ gst_inter_video_sink_render (GstBaseSink * sink, GstBuffer * buffer)
|
|||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_inter_video_sink_async_play (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return GST_STATE_CHANGE_SUCCESS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_sink_activate_pull (GstBaseSink * sink, gboolean active)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_sink_unlock_stop (GstBaseSink * sink)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -54,33 +54,18 @@ static void gst_inter_video_src_set_property (GObject * object,
|
|||
guint property_id, const GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_video_src_get_property (GObject * object,
|
||||
guint property_id, GValue * value, GParamSpec * pspec);
|
||||
static void gst_inter_video_src_dispose (GObject * object);
|
||||
static void gst_inter_video_src_finalize (GObject * object);
|
||||
|
||||
static GstCaps *gst_inter_video_src_get_caps (GstBaseSrc * src);
|
||||
static gboolean gst_inter_video_src_set_caps (GstBaseSrc * src, GstCaps * caps);
|
||||
static gboolean gst_inter_video_src_negotiate (GstBaseSrc * src);
|
||||
static gboolean gst_inter_video_src_newsegment (GstBaseSrc * src);
|
||||
static gboolean gst_inter_video_src_start (GstBaseSrc * src);
|
||||
static gboolean gst_inter_video_src_stop (GstBaseSrc * src);
|
||||
static void
|
||||
gst_inter_video_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
||||
GstClockTime * start, GstClockTime * end);
|
||||
static gboolean gst_inter_video_src_is_seekable (GstBaseSrc * src);
|
||||
static gboolean gst_inter_video_src_unlock (GstBaseSrc * src);
|
||||
static gboolean gst_inter_video_src_event (GstBaseSrc * src, GstEvent * event);
|
||||
static GstFlowReturn
|
||||
gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||
GstBuffer ** buf);
|
||||
static gboolean gst_inter_video_src_do_seek (GstBaseSrc * src,
|
||||
GstSegment * segment);
|
||||
static gboolean gst_inter_video_src_query (GstBaseSrc * src, GstQuery * query);
|
||||
static gboolean gst_inter_video_src_check_get_range (GstBaseSrc * src);
|
||||
static void gst_inter_video_src_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
static gboolean gst_inter_video_src_unlock_stop (GstBaseSrc * src);
|
||||
static gboolean
|
||||
gst_inter_video_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||
GstSegment * segment);
|
||||
static GstCaps *gst_inter_video_src_fixate (GstBaseSrc * src, GstCaps * caps);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -94,23 +79,23 @@ static GstStaticPadTemplate gst_inter_video_src_src_template =
|
|||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
|
||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("I420"))
|
||||
);
|
||||
|
||||
|
||||
/* class initialization */
|
||||
|
||||
#define DEBUG_INIT(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_video_src_debug_category, "intervideosrc", 0, \
|
||||
"debug category for intervideosrc element");
|
||||
|
||||
GST_BOILERPLATE_FULL (GstInterVideoSrc, gst_inter_video_src, GstBaseSrc,
|
||||
GST_TYPE_BASE_SRC, DEBUG_INIT);
|
||||
G_DEFINE_TYPE (GstInterVideoSrc, gst_inter_video_src, GST_TYPE_BASE_SRC);
|
||||
|
||||
static void
|
||||
gst_inter_video_src_base_init (gpointer g_class)
|
||||
gst_inter_video_src_class_init (GstInterVideoSrcClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_inter_video_src_debug_category, "intervideosrc",
|
||||
0, "debug category for intervideosrc element");
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_video_src_src_template));
|
||||
|
@ -120,49 +105,16 @@ gst_inter_video_src_base_init (gpointer g_class)
|
|||
"Source/Video",
|
||||
"Virtual video source for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_inter_video_src_class_init (GstInterVideoSrcClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstBaseSrcClass *base_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_inter_video_src_set_property;
|
||||
gobject_class->get_property = gst_inter_video_src_get_property;
|
||||
gobject_class->dispose = gst_inter_video_src_dispose;
|
||||
gobject_class->finalize = gst_inter_video_src_finalize;
|
||||
if (0)
|
||||
base_src_class->get_caps = GST_DEBUG_FUNCPTR (gst_inter_video_src_get_caps);
|
||||
base_src_class->set_caps = GST_DEBUG_FUNCPTR (gst_inter_video_src_set_caps);
|
||||
if (0)
|
||||
base_src_class->negotiate =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_src_negotiate);
|
||||
if (0)
|
||||
base_src_class->newsegment =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_src_newsegment);
|
||||
base_src_class->start = GST_DEBUG_FUNCPTR (gst_inter_video_src_start);
|
||||
base_src_class->stop = GST_DEBUG_FUNCPTR (gst_inter_video_src_stop);
|
||||
base_src_class->get_times = GST_DEBUG_FUNCPTR (gst_inter_video_src_get_times);
|
||||
if (0)
|
||||
base_src_class->is_seekable =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_src_is_seekable);
|
||||
base_src_class->unlock = GST_DEBUG_FUNCPTR (gst_inter_video_src_unlock);
|
||||
base_src_class->event = GST_DEBUG_FUNCPTR (gst_inter_video_src_event);
|
||||
base_src_class->create = GST_DEBUG_FUNCPTR (gst_inter_video_src_create);
|
||||
if (0)
|
||||
base_src_class->do_seek = GST_DEBUG_FUNCPTR (gst_inter_video_src_do_seek);
|
||||
base_src_class->query = GST_DEBUG_FUNCPTR (gst_inter_video_src_query);
|
||||
if (0)
|
||||
base_src_class->check_get_range =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_src_check_get_range);
|
||||
base_src_class->fixate = GST_DEBUG_FUNCPTR (gst_inter_video_src_fixate);
|
||||
if (0)
|
||||
base_src_class->unlock_stop =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_src_unlock_stop);
|
||||
if (0)
|
||||
base_src_class->prepare_seek_segment =
|
||||
GST_DEBUG_FUNCPTR (gst_inter_video_src_prepare_seek_segment);
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_CHANNEL,
|
||||
g_param_spec_string ("channel", "Channel",
|
||||
|
@ -172,8 +124,7 @@ gst_inter_video_src_class_init (GstInterVideoSrcClass * klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_inter_video_src_init (GstInterVideoSrc * intervideosrc,
|
||||
GstInterVideoSrcClass * intervideosrc_class)
|
||||
gst_inter_video_src_init (GstInterVideoSrc * intervideosrc)
|
||||
{
|
||||
gst_base_src_set_format (GST_BASE_SRC (intervideosrc), GST_FORMAT_TIME);
|
||||
gst_base_src_set_live (GST_BASE_SRC (intervideosrc), TRUE);
|
||||
|
@ -214,16 +165,6 @@ gst_inter_video_src_get_property (GObject * object, guint property_id,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_video_src_dispose (GObject * object)
|
||||
{
|
||||
/* GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (object); */
|
||||
|
||||
/* clean up as possible. may be called multiple times */
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_video_src_finalize (GObject * object)
|
||||
{
|
||||
|
@ -232,65 +173,24 @@ gst_inter_video_src_finalize (GObject * object)
|
|||
/* clean up object here */
|
||||
g_free (intervideosrc->channel);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gst_inter_video_src_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_inter_video_src_get_caps (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "get_caps");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_set_caps (GstBaseSrc * src, GstCaps * caps)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
gboolean ret;
|
||||
GstVideoFormat format;
|
||||
int width, height;
|
||||
int fps_n, fps_d;
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "set_caps");
|
||||
|
||||
ret = gst_video_format_parse_caps (caps, &format, &width, &height);
|
||||
ret &= gst_video_parse_caps_framerate (caps, &fps_n, &fps_d);
|
||||
if (!gst_video_info_from_caps (&intervideosrc->info, caps))
|
||||
return FALSE;
|
||||
|
||||
if (ret) {
|
||||
intervideosrc->format = format;
|
||||
intervideosrc->width = width;
|
||||
intervideosrc->height = height;
|
||||
intervideosrc->fps_n = fps_n;
|
||||
intervideosrc->fps_d = fps_d;
|
||||
GST_DEBUG ("fps %d/%d", fps_n, fps_d);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return gst_pad_set_caps (src->srcpad, caps);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_negotiate (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "negotiate");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_newsegment (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "newsegment");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_start (GstBaseSrc * src)
|
||||
|
@ -344,41 +244,6 @@ gst_inter_video_src_get_times (GstBaseSrc * src, GstBuffer * buffer,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_is_seekable (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "is_seekable");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_unlock (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "unlock");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_event (GstBaseSrc * src, GstEvent * event)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
gboolean ret;
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "event");
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||
|
@ -386,7 +251,6 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
GstBuffer *buffer;
|
||||
guint8 *data;
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "create");
|
||||
|
||||
|
@ -404,44 +268,41 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
g_mutex_unlock (intervideosrc->surface->mutex);
|
||||
|
||||
if (buffer == NULL) {
|
||||
GstMapInfo map;
|
||||
|
||||
buffer =
|
||||
gst_buffer_new_and_alloc (gst_video_format_get_size
|
||||
(intervideosrc->format, intervideosrc->width, intervideosrc->height));
|
||||
gst_buffer_new_and_alloc (GST_VIDEO_INFO_SIZE (&intervideosrc->info));
|
||||
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
memset (data, 16,
|
||||
gst_video_format_get_row_stride (intervideosrc->format, 0,
|
||||
intervideosrc->width) *
|
||||
gst_video_format_get_component_height (intervideosrc->format, 0,
|
||||
intervideosrc->height));
|
||||
gst_buffer_map (buffer, &map, GST_MAP_WRITE);
|
||||
memset (map.data, 16, GST_VIDEO_INFO_COMP_STRIDE (&intervideosrc->info, 0) *
|
||||
GST_VIDEO_INFO_COMP_HEIGHT (&intervideosrc->info, 0));
|
||||
|
||||
memset (data + gst_video_format_get_component_offset (intervideosrc->format,
|
||||
1, intervideosrc->width, intervideosrc->height),
|
||||
memset (map.data + GST_VIDEO_INFO_COMP_OFFSET (&intervideosrc->info, 1),
|
||||
128,
|
||||
2 * gst_video_format_get_row_stride (intervideosrc->format, 1,
|
||||
intervideosrc->width) *
|
||||
gst_video_format_get_component_height (intervideosrc->format, 1,
|
||||
intervideosrc->height));
|
||||
2 * GST_VIDEO_INFO_COMP_STRIDE (&intervideosrc->info, 1) *
|
||||
GST_VIDEO_INFO_COMP_HEIGHT (&intervideosrc->info, 1));
|
||||
gst_buffer_unmap (buffer, &map);
|
||||
}
|
||||
|
||||
buffer = gst_buffer_make_metadata_writable (buffer);
|
||||
buffer = gst_buffer_make_writable (buffer);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buffer) =
|
||||
gst_util_uint64_scale_int (GST_SECOND * intervideosrc->n_frames,
|
||||
intervideosrc->fps_d, intervideosrc->fps_n);
|
||||
GST_VIDEO_INFO_FPS_D (&intervideosrc->info),
|
||||
GST_VIDEO_INFO_FPS_N (&intervideosrc->info));
|
||||
GST_DEBUG_OBJECT (intervideosrc, "create ts %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
||||
GST_BUFFER_DURATION (buffer) =
|
||||
gst_util_uint64_scale_int (GST_SECOND * (intervideosrc->n_frames + 1),
|
||||
intervideosrc->fps_d,
|
||||
intervideosrc->fps_n) - GST_BUFFER_TIMESTAMP (buffer);
|
||||
GST_VIDEO_INFO_FPS_D (&intervideosrc->info),
|
||||
GST_VIDEO_INFO_FPS_N (&intervideosrc->info)) -
|
||||
GST_BUFFER_TIMESTAMP (buffer);
|
||||
GST_BUFFER_OFFSET (buffer) = intervideosrc->n_frames;
|
||||
GST_BUFFER_OFFSET_END (buffer) = -1;
|
||||
GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
if (intervideosrc->n_frames == 0) {
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (GST_BASE_SRC_PAD (intervideosrc)));
|
||||
intervideosrc->n_frames++;
|
||||
|
||||
*buf = buffer;
|
||||
|
@ -449,43 +310,7 @@ gst_inter_video_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_do_seek (GstBaseSrc * src, GstSegment * segment)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "do_seek");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_query (GstBaseSrc * src, GstQuery * query)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
gboolean ret;
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "query");
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_check_get_range (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "get_range");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
static GstCaps *
|
||||
gst_inter_video_src_fixate (GstBaseSrc * src, GstCaps * caps)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
@ -509,25 +334,5 @@ gst_inter_video_src_fixate (GstBaseSrc * src, GstCaps * caps)
|
|||
if (gst_structure_has_field (structure, "interlaced"))
|
||||
gst_structure_fixate_field_boolean (structure, "interlaced", FALSE);
|
||||
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_unlock_stop (GstBaseSrc * src)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "stop");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_inter_video_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
||||
GstSegment * segment)
|
||||
{
|
||||
GstInterVideoSrc *intervideosrc = GST_INTER_VIDEO_SRC (src);
|
||||
|
||||
GST_DEBUG_OBJECT (intervideosrc, "seek_segment");
|
||||
|
||||
return FALSE;
|
||||
return caps;
|
||||
}
|
||||
|
|
|
@ -43,12 +43,8 @@ struct _GstInterVideoSrc
|
|||
|
||||
char *channel;
|
||||
|
||||
GstVideoFormat format;
|
||||
int fps_n;
|
||||
int fps_d;
|
||||
GstVideoInfo info;
|
||||
int n_frames;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct _GstInterVideoSrcClass
|
||||
|
|
Loading…
Reference in a new issue