mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
inter: Add channel property
The channel property allows multiple intersrc/sink pairs to find each other. It's a free-form text string that must match among various inter elements. Also fixed up documentation and latency handling.
This commit is contained in:
parent
9aa9903430
commit
67f546968c
11 changed files with 236 additions and 73 deletions
|
@ -19,14 +19,21 @@
|
|||
/**
|
||||
* SECTION:element-gstinteraudiosink
|
||||
*
|
||||
* The interaudiosink element does FIXME stuff.
|
||||
* The interaudiosink element is an audio sink element. It is used
|
||||
* in connection with a interaudiosrc element in a different pipeline,
|
||||
* similar to intervideosink and intervideosrc.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Example launch line</title>
|
||||
* |[
|
||||
* gst-launch -v fakesrc ! interaudiosink ! FIXME ! fakesink
|
||||
* gst-launch -v audiotestsrc ! queue ! interaudiosink
|
||||
* ]|
|
||||
* FIXME Describe what the pipeline does.
|
||||
*
|
||||
* The interaudiosink element cannot be used effectively with gst-launch,
|
||||
* as it requires a second pipeline in the application to receive the
|
||||
* audio.
|
||||
* See the gstintertest.c example in the gst-plugins-bad source code for
|
||||
* more details.
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
@ -91,8 +98,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
|
||||
"depth = (int) 16, " "rate = (int) 48000, " "channels = (int) 2")
|
||||
);
|
||||
|
||||
|
||||
|
@ -113,8 +119,11 @@ gst_inter_audio_sink_base_init (gpointer g_class)
|
|||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_inter_audio_sink_sink_template);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "FIXME Long name",
|
||||
"Generic", "FIXME Description", "FIXME <fixme@example.com>");
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Internal audio sink",
|
||||
"Sink/Audio",
|
||||
"Virtual audio sink for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -163,16 +172,20 @@ static void
|
|||
gst_inter_audio_sink_init (GstInterAudioSink * interaudiosink,
|
||||
GstInterAudioSinkClass * interaudiosink_class)
|
||||
{
|
||||
interaudiosink->surface = gst_inter_surface_get ("default");
|
||||
interaudiosink->channel = g_strdup ("default");
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_audio_sink_set_property (GObject * object, guint property_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (object); */
|
||||
GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_free (interaudiosink->channel);
|
||||
interaudiosink->channel = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -183,9 +196,12 @@ void
|
|||
gst_inter_audio_sink_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (object); */
|
||||
GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_value_set_string (value, interaudiosink->channel);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -261,6 +277,11 @@ gst_inter_audio_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
|
|||
static gboolean
|
||||
gst_inter_audio_sink_start (GstBaseSink * sink)
|
||||
{
|
||||
GstInterAudioSink *interaudiosink = GST_INTER_AUDIO_SINK (sink);
|
||||
|
||||
GST_DEBUG ("start");
|
||||
|
||||
interaudiosink->surface = gst_inter_surface_get (interaudiosink->channel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -276,6 +297,9 @@ gst_inter_audio_sink_stop (GstBaseSink * sink)
|
|||
gst_adapter_clear (interaudiosink->surface->audio_adapter);
|
||||
g_mutex_unlock (interaudiosink->surface->mutex);
|
||||
|
||||
gst_inter_surface_unref (interaudiosink->surface);
|
||||
interaudiosink->surface = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ struct _GstInterAudioSink
|
|||
GstBaseSink base_interaudiosink;
|
||||
|
||||
GstInterSurface *surface;
|
||||
char *channel;
|
||||
|
||||
int fps_n;
|
||||
int fps_d;
|
||||
|
|
|
@ -19,14 +19,19 @@
|
|||
/**
|
||||
* SECTION:element-gstinteraudiosrc
|
||||
*
|
||||
* The interaudiosrc element does FIXME stuff.
|
||||
* The interaudiosrc element is an audio source element. It is used
|
||||
* in connection with a interaudiosink element in a different pipeline.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Example launch line</title>
|
||||
* |[
|
||||
* gst-launch -v fakesrc ! interaudiosrc ! FIXME ! fakesink
|
||||
* gst-launch -v interaudiosrc ! queue ! audiosink
|
||||
* ]|
|
||||
* FIXME Describe what the pipeline does.
|
||||
*
|
||||
* The interaudiosrc element cannot be used effectively with gst-launch,
|
||||
* as it requires a second pipeline in the application to send audio.
|
||||
* See the gstintertest.c example in the gst-plugins-bad source code for
|
||||
* more details.
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
@ -93,8 +98,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
|||
"endianness = (int) BYTE_ORDER, "
|
||||
"signed = (boolean) true, "
|
||||
"width = (int) 16, "
|
||||
"depth = (int) 16, "
|
||||
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
|
||||
"depth = (int) 16, " "rate = (int) 48000, " "channels = (int) 2")
|
||||
);
|
||||
|
||||
|
||||
|
@ -115,8 +119,11 @@ gst_inter_audio_src_base_init (gpointer g_class)
|
|||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_inter_audio_src_src_template);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "FIXME Long name",
|
||||
"Generic", "FIXME Description", "FIXME <fixme@example.com>");
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Internal audio source",
|
||||
"Source/Audio",
|
||||
"Virtual audio source for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -175,16 +182,20 @@ gst_inter_audio_src_init (GstInterAudioSrc * interaudiosrc,
|
|||
gst_base_src_set_live (GST_BASE_SRC (interaudiosrc), TRUE);
|
||||
gst_base_src_set_blocksize (GST_BASE_SRC (interaudiosrc), -1);
|
||||
|
||||
interaudiosrc->surface = gst_inter_surface_get ("default");
|
||||
interaudiosrc->channel = g_strdup ("default");
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_audio_src_set_property (GObject * object, guint property_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (object); */
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_free (interaudiosrc->channel);
|
||||
interaudiosrc->channel = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -195,9 +206,12 @@ void
|
|||
gst_inter_audio_src_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (object); */
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_value_set_string (value, interaudiosrc->channel);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -282,6 +296,8 @@ gst_inter_audio_src_start (GstBaseSrc * src)
|
|||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "start");
|
||||
|
||||
interaudiosrc->surface = gst_inter_surface_get (interaudiosrc->channel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -292,6 +308,9 @@ gst_inter_audio_src_stop (GstBaseSrc * src)
|
|||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "stop");
|
||||
|
||||
gst_inter_surface_unref (interaudiosrc->surface);
|
||||
interaudiosrc->surface = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -346,12 +365,20 @@ 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");
|
||||
|
||||
return TRUE;
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define SIZE 1600
|
||||
|
||||
static GstFlowReturn
|
||||
gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
||||
GstBuffer ** buf)
|
||||
|
@ -366,31 +393,31 @@ gst_inter_audio_src_create (GstBaseSrc * src, guint64 offset, guint size,
|
|||
|
||||
g_mutex_lock (interaudiosrc->surface->mutex);
|
||||
n = gst_adapter_available (interaudiosrc->surface->audio_adapter) / 4;
|
||||
if (n > 1600 * 2) {
|
||||
GST_DEBUG ("flushing %d samples", 800);
|
||||
gst_adapter_flush (interaudiosrc->surface->audio_adapter, 800 * 4);
|
||||
n -= 800;
|
||||
if (n > SIZE * 2) {
|
||||
GST_DEBUG ("flushing %d samples", SIZE / 2);
|
||||
gst_adapter_flush (interaudiosrc->surface->audio_adapter, (SIZE / 2) * 4);
|
||||
n -= (SIZE / 2);
|
||||
}
|
||||
if (n > 1600)
|
||||
n = 1600;
|
||||
if (n > SIZE)
|
||||
n = SIZE;
|
||||
if (n > 0) {
|
||||
buffer = gst_adapter_take_buffer (interaudiosrc->surface->audio_adapter,
|
||||
n * 4);
|
||||
}
|
||||
g_mutex_unlock (interaudiosrc->surface->mutex);
|
||||
|
||||
if (n < 1600) {
|
||||
GstBuffer *newbuf = gst_buffer_new_and_alloc (1600 * 4);
|
||||
if (n < SIZE) {
|
||||
GstBuffer *newbuf = gst_buffer_new_and_alloc (SIZE * 4);
|
||||
|
||||
GST_DEBUG ("creating %d samples of silence", 1600 - n);
|
||||
memset (GST_BUFFER_DATA (newbuf) + n * 4, 0, 1600 * 4 - n * 4);
|
||||
GST_DEBUG ("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);
|
||||
}
|
||||
buffer = newbuf;
|
||||
}
|
||||
n = 1600;
|
||||
n = SIZE;
|
||||
|
||||
GST_BUFFER_OFFSET (buffer) = interaudiosrc->n_samples;
|
||||
GST_BUFFER_OFFSET_END (buffer) = interaudiosrc->n_samples + n;
|
||||
|
@ -430,10 +457,34 @@ static gboolean
|
|||
gst_inter_audio_src_query (GstBaseSrc * src, GstQuery * query)
|
||||
{
|
||||
GstInterAudioSrc *interaudiosrc = GST_INTER_AUDIO_SRC (src);
|
||||
gboolean ret;
|
||||
|
||||
GST_DEBUG_OBJECT (interaudiosrc, "query");
|
||||
|
||||
return TRUE;
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_LATENCY:{
|
||||
GstClockTime min_latency, max_latency;
|
||||
|
||||
min_latency = 30 * gst_util_uint64_scale_int (GST_SECOND, SIZE, 48000);
|
||||
|
||||
max_latency = min_latency;
|
||||
|
||||
GST_ERROR_OBJECT (src,
|
||||
"report latency min %" GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (min_latency), GST_TIME_ARGS (max_latency));
|
||||
|
||||
gst_query_set_latency (query,
|
||||
gst_base_src_is_live (src), min_latency, max_latency);
|
||||
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -39,6 +39,7 @@ struct _GstInterAudioSrc
|
|||
GstBaseSrc base_interaudiosrc;
|
||||
|
||||
GstInterSurface *surface;
|
||||
char *channel;
|
||||
|
||||
guint64 n_samples;
|
||||
int sample_rate;
|
||||
|
|
|
@ -19,14 +19,19 @@
|
|||
/**
|
||||
* SECTION:element-gstintersubsink
|
||||
*
|
||||
* The intersubsink element does FIXME stuff.
|
||||
* The intersubsink element is a subtitle sink element. It is used
|
||||
* in connection with a intersubsrc element in a different pipeline.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Example launch line</title>
|
||||
* |[
|
||||
* gst-launch -v fakesrc ! intersubsink ! FIXME ! fakesink
|
||||
* gst-launch -v ... ! intersubsink
|
||||
* ]|
|
||||
* FIXME Describe what the pipeline does.
|
||||
*
|
||||
* The intersubsink element cannot be used effectively with gst-launch,
|
||||
* as it requires a second pipeline in the application to send audio.
|
||||
* See the gstintertest.c example in the gst-plugins-bad source code for
|
||||
* more details.
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
@ -73,7 +78,8 @@ static gboolean gst_inter_sub_sink_unlock_stop (GstBaseSink * sink);
|
|||
|
||||
enum
|
||||
{
|
||||
PROP_0
|
||||
PROP_0,
|
||||
PROP_CHANNEL
|
||||
};
|
||||
|
||||
/* pad templates */
|
||||
|
@ -103,8 +109,11 @@ gst_inter_sub_sink_base_init (gpointer g_class)
|
|||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_inter_sub_sink_sink_template));
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "FIXME Long name",
|
||||
"Generic", "FIXME Description", "FIXME <fixme@example.com>");
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Internal subtitle sink",
|
||||
"Sink/Subtitle",
|
||||
"Virtual subtitle sink for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -139,6 +148,11 @@ gst_inter_sub_sink_class_init (GstInterSubSinkClass * klass)
|
|||
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",
|
||||
"Channel name to match inter src and sink elements",
|
||||
"default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,7 +160,7 @@ gst_inter_sub_sink_init (GstInterSubSink * intersubsink,
|
|||
GstInterSubSinkClass * intersubsink_class)
|
||||
{
|
||||
|
||||
intersubsink->surface = gst_inter_surface_get ("default");
|
||||
intersubsink->channel = g_strdup ("default");
|
||||
|
||||
intersubsink->fps_n = 1;
|
||||
intersubsink->fps_d = 1;
|
||||
|
@ -156,9 +170,13 @@ void
|
|||
gst_inter_sub_sink_set_property (GObject * object, guint property_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (object); */
|
||||
GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_free (intersubsink->channel);
|
||||
intersubsink->channel = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -169,9 +187,12 @@ void
|
|||
gst_inter_sub_sink_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (object); */
|
||||
GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_value_set_string (value, intersubsink->channel);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -247,6 +268,9 @@ gst_inter_sub_sink_get_times (GstBaseSink * sink, GstBuffer * buffer,
|
|||
static gboolean
|
||||
gst_inter_sub_sink_start (GstBaseSink * sink)
|
||||
{
|
||||
GstInterSubSink *intersubsink = GST_INTER_SUB_SINK (sink);
|
||||
|
||||
intersubsink->surface = gst_inter_surface_get (intersubsink->channel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -263,6 +287,9 @@ gst_inter_sub_sink_stop (GstBaseSink * sink)
|
|||
intersubsink->surface->sub_buffer = NULL;
|
||||
g_mutex_unlock (intersubsink->surface->mutex);
|
||||
|
||||
gst_inter_surface_unref (intersubsink->surface);
|
||||
intersubsink->surface = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ struct _GstInterSubSink
|
|||
|
||||
GstPad *sinkpad;
|
||||
GstInterSurface *surface;
|
||||
char *channel;
|
||||
|
||||
int fps_n;
|
||||
int fps_d;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
*
|
||||
* The intersubsrc element cannot be used effectively with gst-launch,
|
||||
* as it requires a second pipeline in the application to send subtitles.
|
||||
* See the gstintertest.c example in the gst-plugins-bad source code for
|
||||
* more details.
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
@ -82,7 +84,8 @@ gst_inter_sub_src_prepare_seek_segment (GstBaseSrc * src, GstEvent * seek,
|
|||
|
||||
enum
|
||||
{
|
||||
PROP_0
|
||||
PROP_0,
|
||||
PROP_CHANNEL
|
||||
};
|
||||
|
||||
/* pad templates */
|
||||
|
@ -113,9 +116,10 @@ gst_inter_sub_src_base_init (gpointer g_class)
|
|||
gst_static_pad_template_get (&gst_inter_sub_src_src_template));
|
||||
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Inter-pipeline subtitle source",
|
||||
"Source/Subtitle", "Inter-pipeline subtitle source",
|
||||
"David Schleef <ds@entropywave.com>");
|
||||
"Internal subtitle source",
|
||||
"Source/Subtitle",
|
||||
"Virtual subtitle source for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -159,7 +163,10 @@ gst_inter_sub_src_class_init (GstInterSubSrcClass * klass)
|
|||
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",
|
||||
"Channel name to match inter src and sink elements",
|
||||
"default", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -173,16 +180,20 @@ gst_inter_sub_src_init (GstInterSubSrc * intersubsrc,
|
|||
gst_base_src_set_format (GST_BASE_SRC (intersubsrc), GST_FORMAT_TIME);
|
||||
gst_base_src_set_live (GST_BASE_SRC (intersubsrc), TRUE);
|
||||
|
||||
intersubsrc->surface = gst_inter_surface_get ("default");
|
||||
intersubsrc->channel = g_strdup ("default");
|
||||
}
|
||||
|
||||
void
|
||||
gst_inter_sub_src_set_property (GObject * object, guint property_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (object); */
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_free (intersubsrc->channel);
|
||||
intersubsrc->channel = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -193,9 +204,12 @@ void
|
|||
gst_inter_sub_src_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
/* GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (object); */
|
||||
GstInterSubSrc *intersubsrc = GST_INTER_SUB_SRC (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_CHANNEL:
|
||||
g_value_set_string (value, intersubsrc->channel);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
@ -270,6 +284,8 @@ gst_inter_sub_src_start (GstBaseSrc * src)
|
|||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "start");
|
||||
|
||||
intersubsrc->surface = gst_inter_surface_get (intersubsrc->channel);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -280,6 +296,9 @@ gst_inter_sub_src_stop (GstBaseSrc * src)
|
|||
|
||||
GST_DEBUG_OBJECT (intersubsrc, "stop");
|
||||
|
||||
gst_inter_surface_unref (intersubsrc->surface);
|
||||
intersubsrc->surface = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -334,10 +353,16 @@ 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");
|
||||
|
||||
return TRUE;
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -409,10 +434,16 @@ 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");
|
||||
|
||||
return TRUE;
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -40,6 +40,7 @@ struct _GstInterSubSrc
|
|||
|
||||
GstPad *srcpad;
|
||||
GstInterSurface *surface;
|
||||
char *channel;
|
||||
|
||||
int rate;
|
||||
int n_frames;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* GstInterTest
|
||||
* Copyright (C) 2011 FIXME <fixme@example.com>
|
||||
* Copyright (C) 2011 David Schleef <ds@schleef.org>
|
||||
* Copyright (C) 2010 Entropy Wave Inc
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -86,7 +86,7 @@ main (int argc, char *argv[])
|
|||
g_thread_init (NULL);
|
||||
#endif
|
||||
|
||||
context = g_option_context_new ("- FIXME");
|
||||
context = g_option_context_new ("- Internal src/sink test");
|
||||
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
|
||||
g_option_context_add_group (context, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (context, &argc, &argv, &error)) {
|
||||
|
@ -188,14 +188,14 @@ gst_inter_test_create_pipeline_vts (GstInterTest * intertest)
|
|||
|
||||
pipe_desc = g_string_new ("");
|
||||
|
||||
g_string_append (pipe_desc, "videotestsrc name=source num-buffers=10000 ! ");
|
||||
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 ! ");
|
||||
g_string_append (pipe_desc, "timeoverlay ! ");
|
||||
g_string_append (pipe_desc, "intervideosink name=sink sync=true ");
|
||||
g_string_append (pipe_desc,
|
||||
"audiotestsrc samplesperbuffer=1600 num-buffers=100 ! ");
|
||||
g_string_append (pipe_desc, "interaudiosink ");
|
||||
"audiotestsrc samplesperbuffer=1600 num-buffers=100 ! audioconvert ! ");
|
||||
g_string_append (pipe_desc, "interaudiosink sync=true ");
|
||||
|
||||
if (verbose)
|
||||
g_print ("pipeline: %s\n", pipe_desc->str);
|
||||
|
@ -232,7 +232,7 @@ gst_inter_test_create_pipeline_server (GstInterTest * intertest)
|
|||
g_string_append (pipe_desc, "intervideosrc ! queue ! ");
|
||||
g_string_append (pipe_desc, "xvimagesink name=sink ");
|
||||
g_string_append (pipe_desc, "interaudiosrc ! queue ! ");
|
||||
g_string_append (pipe_desc, "alsasink latency-time=100000000 ");
|
||||
g_string_append (pipe_desc, "alsasink ");
|
||||
|
||||
if (verbose)
|
||||
g_print ("pipeline: %s\n", pipe_desc->str);
|
||||
|
@ -337,7 +337,7 @@ gst_inter_test_handle_paused_to_ready (GstInterTest * intertest)
|
|||
static void
|
||||
gst_inter_test_handle_ready_to_null (GstInterTest * intertest)
|
||||
{
|
||||
g_main_loop_quit (intertest->main_loop);
|
||||
//g_main_loop_quit (intertest->main_loop);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,20 @@
|
|||
/**
|
||||
* SECTION:element-gstintervideosink
|
||||
*
|
||||
* The intervideosink element does FIXME stuff.
|
||||
* The intervideosink element is a video sink element. It is used
|
||||
* in connection with an intervideosrc element in a different pipeline,
|
||||
* similar to interaudiosink and interaudiosrc.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Example launch line</title>
|
||||
* |[
|
||||
* gst-launch -v fakesrc ! intervideosink ! FIXME ! fakesink
|
||||
* gst-launch -v videotestsrc ! intervideosink
|
||||
* ]|
|
||||
* FIXME Describe what the pipeline does.
|
||||
*
|
||||
* The intervideosink element cannot be used effectively with gst-launch,
|
||||
* as it requires a second pipeline in the application to send video to.
|
||||
* See the gstintertest.c example in the gst-plugins-bad source code for
|
||||
* more details.
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
@ -107,8 +113,11 @@ gst_inter_video_sink_base_init (gpointer g_class)
|
|||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_inter_video_sink_sink_template);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "FIXME Long name",
|
||||
"Generic", "FIXME Description", "FIXME <fixme@example.com>");
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Internal video sink",
|
||||
"Sink/Video",
|
||||
"Virtual video sink for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -155,8 +164,6 @@ static void
|
|||
gst_inter_video_sink_init (GstInterVideoSink * intervideosink,
|
||||
GstInterVideoSinkClass * intervideosink_class)
|
||||
{
|
||||
intervideosink->surface = gst_inter_surface_get ("default");
|
||||
|
||||
intervideosink->channel = g_strdup ("default");
|
||||
}
|
||||
|
||||
|
|
|
@ -19,14 +19,18 @@
|
|||
/**
|
||||
* SECTION:element-gstintervideosrc
|
||||
*
|
||||
* The intervideosrc element does FIXME stuff.
|
||||
* The intervideosrc element is a video source element. It is used
|
||||
* in connection with a intervideosink element in a different pipeline,
|
||||
* similar to interaudiosink and interaudiosrc.
|
||||
*
|
||||
* <refsect2>
|
||||
* <title>Example launch line</title>
|
||||
* |[
|
||||
* gst-launch -v fakesrc ! intervideosrc ! FIXME ! fakesink
|
||||
* gst-launch -v intervideosrc ! queue ! xvimagesink
|
||||
* ]|
|
||||
* FIXME Describe what the pipeline does.
|
||||
*
|
||||
* The intersubsrc element cannot be used effectively with gst-launch,
|
||||
* as it requires a second pipeline in the application to send subtitles.
|
||||
* </refsect2>
|
||||
*/
|
||||
|
||||
|
@ -111,8 +115,11 @@ gst_inter_video_src_base_init (gpointer g_class)
|
|||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_inter_video_src_src_template);
|
||||
|
||||
gst_element_class_set_details_simple (element_class, "FIXME Long name",
|
||||
"Generic", "FIXME Description", "FIXME <fixme@example.com>");
|
||||
gst_element_class_set_details_simple (element_class,
|
||||
"Internal video source",
|
||||
"Source/Video",
|
||||
"Virtual video source for internal process communication",
|
||||
"David Schleef <ds@schleef.org>");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -361,10 +368,16 @@ 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");
|
||||
|
||||
return TRUE;
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->event (src, event);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -450,10 +463,16 @@ 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");
|
||||
|
||||
return TRUE;
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
default:
|
||||
ret = GST_BASE_SRC_CLASS (parent_class)->query (src, query);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue