mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 06:58:49 +00:00
Synchronizing my changes.
Original commit message from CVS: Synchronizing my changes.
This commit is contained in:
parent
07441f0139
commit
2e2a90accc
4 changed files with 408 additions and 442 deletions
|
@ -140,7 +140,7 @@ gst_play_pipeline_setup (GstPlay *play)
|
||||||
gst_element_get_pad (video_queue, "sink"),
|
gst_element_get_pad (video_queue, "sink"),
|
||||||
"sink");
|
"sink");
|
||||||
|
|
||||||
video_switch = gst_element_factory_make ("videoswitch",
|
video_switch = gst_element_factory_make ("switch",
|
||||||
"video_switch");
|
"video_switch");
|
||||||
if (!GST_IS_ELEMENT (video_switch))
|
if (!GST_IS_ELEMENT (video_switch))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -149,9 +149,10 @@ gst_play_pipeline_setup (GstPlay *play)
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (work_thread), video_switch);
|
gst_bin_add (GST_BIN (work_thread), video_switch);
|
||||||
|
|
||||||
/* Connecting autoplugger to video switch and video switch to video output */
|
/* Connecting autoplugger to video switch and video switch to video output
|
||||||
gst_element_link (autoplugger, video_switch);
|
gst_element_link (autoplugger, video_switch);
|
||||||
gst_element_link (video_switch, video_thread);
|
gst_element_link (video_switch, video_thread);*/
|
||||||
|
gst_element_link (autoplugger, video_thread);
|
||||||
|
|
||||||
/* Creating our audio output bin
|
/* Creating our audio output bin
|
||||||
{ queue ! volume ! tee ! { queue ! goom } ! fakesink } */
|
{ queue ! volume ! tee ! { queue ! goom } ! fakesink } */
|
||||||
|
@ -261,8 +262,7 @@ gst_play_tick_callback (GstPlay *play)
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
|
|
||||||
if (!GST_IS_PLAY (play))
|
if (!GST_IS_PLAY (play)) {
|
||||||
{
|
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -275,8 +275,7 @@ gst_play_tick_callback (GstPlay *play)
|
||||||
|
|
||||||
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -299,8 +298,7 @@ gst_play_get_length_callback (GstPlay *play)
|
||||||
video_sink_element = g_hash_table_lookup (play->priv->elements,
|
video_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||||
"video_sink_element");
|
"video_sink_element");
|
||||||
if (!GST_IS_ELEMENT (audio_sink_element) &&
|
if (!GST_IS_ELEMENT (audio_sink_element) &&
|
||||||
!GST_IS_ELEMENT (video_sink_element))
|
!GST_IS_ELEMENT (video_sink_element)) {
|
||||||
{
|
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -311,8 +309,7 @@ gst_play_get_length_callback (GstPlay *play)
|
||||||
q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format,
|
q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format,
|
||||||
&value);
|
&value);
|
||||||
|
|
||||||
if (q)
|
if (q) {
|
||||||
{
|
|
||||||
play->priv->length_nanos = value;
|
play->priv->length_nanos = value;
|
||||||
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
|
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
|
||||||
0,play->priv->length_nanos);
|
0,play->priv->length_nanos);
|
||||||
|
@ -323,8 +320,7 @@ gst_play_get_length_callback (GstPlay *play)
|
||||||
play->priv->get_length_attempt++;
|
play->priv->get_length_attempt++;
|
||||||
|
|
||||||
/* We try 16 times */
|
/* We try 16 times */
|
||||||
if (play->priv->get_length_attempt > 15)
|
if (play->priv->get_length_attempt > 15) {
|
||||||
{
|
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -343,10 +339,8 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
||||||
|
|
||||||
play = GST_PLAY (element);
|
play = GST_PLAY (element);
|
||||||
|
|
||||||
if (state == GST_STATE_PLAYING)
|
if (state == GST_STATE_PLAYING) {
|
||||||
{
|
if (play->priv->tick_id) {
|
||||||
if (play->priv->tick_id)
|
|
||||||
{
|
|
||||||
g_source_remove (play->priv->tick_id);
|
g_source_remove (play->priv->tick_id);
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -357,8 +351,7 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
||||||
|
|
||||||
play->priv->get_length_attempt = 0;
|
play->priv->get_length_attempt = 0;
|
||||||
|
|
||||||
if (play->priv->length_id)
|
if (play->priv->length_id) {
|
||||||
{
|
|
||||||
g_source_remove (play->priv->length_id);
|
g_source_remove (play->priv->length_id);
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -388,26 +381,22 @@ gst_play_dispose (GObject *object)
|
||||||
|
|
||||||
play = GST_PLAY (object);
|
play = GST_PLAY (object);
|
||||||
|
|
||||||
if (play->priv->length_id)
|
if (play->priv->length_id) {
|
||||||
{
|
|
||||||
g_source_remove (play->priv->length_id);
|
g_source_remove (play->priv->length_id);
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->priv->tick_id)
|
if (play->priv->tick_id) {
|
||||||
{
|
|
||||||
g_source_remove (play->priv->tick_id);
|
g_source_remove (play->priv->tick_id);
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->priv->location)
|
if (play->priv->location) {
|
||||||
{
|
|
||||||
g_free (play->priv->location);
|
g_free (play->priv->location);
|
||||||
play->priv->location = NULL;
|
play->priv->location = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->priv->elements)
|
if (play->priv->elements) {
|
||||||
{
|
|
||||||
g_hash_table_destroy (play->priv->elements);
|
g_hash_table_destroy (play->priv->elements);
|
||||||
play->priv->elements = NULL;
|
play->priv->elements = NULL;
|
||||||
}
|
}
|
||||||
|
@ -560,29 +549,43 @@ gst_play_get_location (GstPlay *play)
|
||||||
gboolean
|
gboolean
|
||||||
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
||||||
{
|
{
|
||||||
GstElement *audio_sink_element;
|
GstElement *audio_sink_element, *video_sink_element;
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||||
|
|
||||||
|
g_message ("trying to seek");
|
||||||
|
|
||||||
if (time_nanos < 0LL)
|
if (time_nanos < 0LL)
|
||||||
time_nanos = 0LL;
|
time_nanos = 0LL;
|
||||||
|
|
||||||
audio_sink_element = g_hash_table_lookup (play->priv->elements,
|
audio_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||||
"audio_sink_element");
|
"audio_sink_element");
|
||||||
if (GST_IS_ELEMENT (audio_sink_element))
|
video_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||||
{
|
"video_sink_element");
|
||||||
|
|
||||||
|
if (GST_IS_ELEMENT (audio_sink_element) &&
|
||||||
|
GST_IS_ELEMENT (video_sink_element)) {
|
||||||
gboolean s = FALSE;
|
gboolean s = FALSE;
|
||||||
GstClock *clock = gst_bin_get_clock (GST_BIN (play));
|
|
||||||
s = gst_element_seek (audio_sink_element, GST_FORMAT_TIME |
|
s = gst_element_seek (audio_sink_element, GST_FORMAT_TIME |
|
||||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
||||||
time_nanos);
|
time_nanos);
|
||||||
if (s)
|
if (!s) {
|
||||||
{
|
s = gst_element_seek (video_sink_element, GST_FORMAT_TIME |
|
||||||
|
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
||||||
|
time_nanos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s) {
|
||||||
|
GstClock *clock = gst_bin_get_clock (GST_BIN (play));
|
||||||
play->priv->time_nanos = gst_clock_get_time (clock);
|
play->priv->time_nanos = gst_clock_get_time (clock);
|
||||||
|
g_message ("seek succeeded");
|
||||||
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
|
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
|
||||||
0,play->priv->time_nanos);
|
0,play->priv->time_nanos);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_message ("seek failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -676,15 +679,13 @@ gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
|
||||||
|
|
||||||
video_sink_element = gst_play_get_sink_element (play, video_sink,
|
video_sink_element = gst_play_get_sink_element (play, video_sink,
|
||||||
GST_PLAY_SINK_TYPE_VIDEO);
|
GST_PLAY_SINK_TYPE_VIDEO);
|
||||||
if (GST_IS_ELEMENT (video_sink_element))
|
if (GST_IS_ELEMENT (video_sink_element)) {
|
||||||
{
|
|
||||||
g_hash_table_replace (play->priv->elements, "video_sink_element",
|
g_hash_table_replace (play->priv->elements, "video_sink_element",
|
||||||
video_sink_element);
|
video_sink_element);
|
||||||
g_signal_connect (G_OBJECT (video_sink_element), "have_video_size",
|
g_signal_connect (G_OBJECT (video_sink_element), "have_video_size",
|
||||||
G_CALLBACK (gst_play_have_video_size), play);
|
G_CALLBACK (gst_play_have_video_size), play);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,8 +743,7 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
||||||
|
|
||||||
audio_sink_element = gst_play_get_sink_element (play, audio_sink,
|
audio_sink_element = gst_play_get_sink_element (play, audio_sink,
|
||||||
GST_PLAY_SINK_TYPE_AUDIO);
|
GST_PLAY_SINK_TYPE_AUDIO);
|
||||||
if (GST_IS_ELEMENT (audio_sink_element))
|
if (GST_IS_ELEMENT (audio_sink_element)) {
|
||||||
{
|
|
||||||
g_hash_table_replace (play->priv->elements, "audio_sink_element",
|
g_hash_table_replace (play->priv->elements, "audio_sink_element",
|
||||||
audio_sink_element);
|
audio_sink_element);
|
||||||
}
|
}
|
||||||
|
@ -763,15 +763,14 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
||||||
gboolean
|
gboolean
|
||||||
gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
||||||
{
|
{
|
||||||
GstElement *old_vis_element, *vis_thread, *vis_queue, *video_switch;
|
GstElement *old_vis_element, *vis_thread, *vis_queue/*, *video_switch*/;
|
||||||
gboolean was_playing = FALSE;
|
gboolean was_playing = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||||
|
|
||||||
/* We bring back the pipeline to READY */
|
/* We bring back the pipeline to READY */
|
||||||
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
|
||||||
{
|
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
||||||
was_playing = TRUE;
|
was_playing = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -787,17 +786,17 @@ gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
||||||
vis_queue = g_hash_table_lookup (play->priv->elements, "vis_queue");
|
vis_queue = g_hash_table_lookup (play->priv->elements, "vis_queue");
|
||||||
if (!GST_IS_ELEMENT (vis_queue))
|
if (!GST_IS_ELEMENT (vis_queue))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
video_switch = g_hash_table_lookup (play->priv->elements, "video_switch");
|
/*video_switch = g_hash_table_lookup (play->priv->elements, "video_switch");
|
||||||
if (!GST_IS_ELEMENT (video_switch))
|
if (!GST_IS_ELEMENT (video_switch))
|
||||||
return FALSE;
|
return FALSE;*/
|
||||||
|
|
||||||
/* Unlinking, removing the old element then adding and linking the new one */
|
/* Unlinking, removing the old element then adding and linking the new one */
|
||||||
gst_element_unlink (vis_queue, old_vis_element);
|
gst_element_unlink (vis_queue, old_vis_element);
|
||||||
gst_element_unlink (old_vis_element, video_switch);
|
/*gst_element_unlink (old_vis_element, video_switch);*/
|
||||||
gst_bin_remove (GST_BIN (vis_thread), old_vis_element);
|
gst_bin_remove (GST_BIN (vis_thread), old_vis_element);
|
||||||
gst_bin_add (GST_BIN (vis_thread), vis_element);
|
gst_bin_add (GST_BIN (vis_thread), vis_element);
|
||||||
gst_element_link (vis_queue, vis_element);
|
gst_element_link (vis_queue, vis_element);
|
||||||
gst_element_link (vis_element, video_switch);
|
/*gst_element_link (vis_element, video_switch);*/
|
||||||
|
|
||||||
if (was_playing)
|
if (was_playing)
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
||||||
|
@ -833,8 +832,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
|
||||||
if (!GST_IS_PAD (audio_tee_pad2))
|
if (!GST_IS_PAD (audio_tee_pad2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
|
||||||
{
|
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
||||||
was_playing = TRUE;
|
was_playing = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -845,13 +843,9 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
|
||||||
connected = FALSE;
|
connected = FALSE;
|
||||||
|
|
||||||
if ((connect) && (!connected))
|
if ((connect) && (!connected))
|
||||||
{
|
|
||||||
gst_pad_link (audio_tee_pad2, vis_thread_pad);
|
gst_pad_link (audio_tee_pad2, vis_thread_pad);
|
||||||
}
|
|
||||||
else if ((!connect) && (connected))
|
else if ((!connect) && (connected))
|
||||||
{
|
|
||||||
gst_pad_unlink (audio_tee_pad2, vis_thread_pad);
|
gst_pad_unlink (audio_tee_pad2, vis_thread_pad);
|
||||||
}
|
|
||||||
|
|
||||||
if (was_playing)
|
if (was_playing)
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
||||||
|
@ -883,8 +877,7 @@ gst_play_get_sink_element (GstPlay *play,
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||||
|
|
||||||
if (!GST_IS_BIN (element))
|
if (!GST_IS_BIN (element)) {
|
||||||
{
|
|
||||||
/* since its not a bin, we'll presume this
|
/* since its not a bin, we'll presume this
|
||||||
* element is a sink element */
|
* element is a sink element */
|
||||||
return element;
|
return element;
|
||||||
|
@ -894,59 +887,45 @@ gst_play_get_sink_element (GstPlay *play,
|
||||||
|
|
||||||
/* traverse all elements looking for a src pad */
|
/* traverse all elements looking for a src pad */
|
||||||
|
|
||||||
while (elements)
|
while (elements) {
|
||||||
{
|
|
||||||
|
|
||||||
element = GST_ELEMENT (elements->data);
|
element = GST_ELEMENT (elements->data);
|
||||||
|
|
||||||
/* Recursivity :) */
|
/* Recursivity :) */
|
||||||
|
|
||||||
if (GST_IS_BIN (element))
|
if (GST_IS_BIN (element)) {
|
||||||
{
|
|
||||||
element = gst_play_get_sink_element (play, element, sink_type);
|
element = gst_play_get_sink_element (play, element, sink_type);
|
||||||
if (GST_IS_ELEMENT (element))
|
if (GST_IS_ELEMENT (element))
|
||||||
{
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
pads = gst_element_get_pad_list (element);
|
pads = gst_element_get_pad_list (element);
|
||||||
has_src = FALSE;
|
has_src = FALSE;
|
||||||
has_correct_type = FALSE;
|
has_correct_type = FALSE;
|
||||||
while (pads)
|
while (pads) {
|
||||||
{
|
|
||||||
/* check for src pad */
|
/* check for src pad */
|
||||||
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC)
|
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
|
||||||
{
|
|
||||||
has_src = TRUE;
|
has_src = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* If not a src pad checking caps */
|
/* If not a src pad checking caps */
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
caps = gst_pad_get_caps (GST_PAD (pads->data));
|
caps = gst_pad_get_caps (GST_PAD (pads->data));
|
||||||
while (caps)
|
while (caps) {
|
||||||
{
|
|
||||||
gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
|
gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
|
||||||
if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||||
"audio/x-raw-int") == 0)
|
"audio/x-raw-int") == 0) {
|
||||||
{
|
|
||||||
has_audio_cap = TRUE;
|
has_audio_cap = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||||
"video/x-raw-yuv") == 0) ||
|
"video/x-raw-yuv") == 0) ||
|
||||||
(g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
(g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||||
"video/x-raw-rgb") == 0))
|
"video/x-raw-rgb") == 0)) {
|
||||||
|
|
||||||
{
|
|
||||||
has_video_cap = TRUE;
|
has_video_cap = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sink_type)
|
switch (sink_type) {
|
||||||
{
|
|
||||||
case GST_PLAY_SINK_TYPE_AUDIO:
|
case GST_PLAY_SINK_TYPE_AUDIO:
|
||||||
if (has_audio_cap)
|
if (has_audio_cap)
|
||||||
has_correct_type = TRUE;
|
has_correct_type = TRUE;
|
||||||
|
@ -962,19 +941,24 @@ gst_play_get_sink_element (GstPlay *play,
|
||||||
default:
|
default:
|
||||||
has_correct_type = FALSE;
|
has_correct_type = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = caps->next;
|
caps = caps->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!has_src) && (has_correct_type))
|
if ((!has_src) && (has_correct_type))
|
||||||
{
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
elements = g_list_next (elements);
|
elements = g_list_next (elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we didn't find a sink element */
|
/* we didn't find a sink element */
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,8 +981,7 @@ gst_play_get_type (void)
|
||||||
{
|
{
|
||||||
static GType play_type = 0;
|
static GType play_type = 0;
|
||||||
|
|
||||||
if (!play_type)
|
if (!play_type) {
|
||||||
{
|
|
||||||
static const GTypeInfo play_info = {
|
static const GTypeInfo play_info = {
|
||||||
sizeof (GstPlayClass),
|
sizeof (GstPlayClass),
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#ifndef __GST_PLAY_H__
|
#ifndef __GST_PLAY_H__
|
||||||
#define __GST_PLAY_H__
|
#define __GST_PLAY_H__
|
||||||
|
|
||||||
#include <gst/gstpipeline.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define GST_TYPE_PLAY (gst_play_get_type())
|
#define GST_TYPE_PLAY (gst_play_get_type())
|
||||||
#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
|
#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
|
||||||
|
|
|
@ -140,7 +140,7 @@ gst_play_pipeline_setup (GstPlay *play)
|
||||||
gst_element_get_pad (video_queue, "sink"),
|
gst_element_get_pad (video_queue, "sink"),
|
||||||
"sink");
|
"sink");
|
||||||
|
|
||||||
video_switch = gst_element_factory_make ("videoswitch",
|
video_switch = gst_element_factory_make ("switch",
|
||||||
"video_switch");
|
"video_switch");
|
||||||
if (!GST_IS_ELEMENT (video_switch))
|
if (!GST_IS_ELEMENT (video_switch))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -149,9 +149,10 @@ gst_play_pipeline_setup (GstPlay *play)
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (work_thread), video_switch);
|
gst_bin_add (GST_BIN (work_thread), video_switch);
|
||||||
|
|
||||||
/* Connecting autoplugger to video switch and video switch to video output */
|
/* Connecting autoplugger to video switch and video switch to video output
|
||||||
gst_element_link (autoplugger, video_switch);
|
gst_element_link (autoplugger, video_switch);
|
||||||
gst_element_link (video_switch, video_thread);
|
gst_element_link (video_switch, video_thread);*/
|
||||||
|
gst_element_link (autoplugger, video_thread);
|
||||||
|
|
||||||
/* Creating our audio output bin
|
/* Creating our audio output bin
|
||||||
{ queue ! volume ! tee ! { queue ! goom } ! fakesink } */
|
{ queue ! volume ! tee ! { queue ! goom } ! fakesink } */
|
||||||
|
@ -261,8 +262,7 @@ gst_play_tick_callback (GstPlay *play)
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
|
|
||||||
if (!GST_IS_PLAY (play))
|
if (!GST_IS_PLAY (play)) {
|
||||||
{
|
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -275,8 +275,7 @@ gst_play_tick_callback (GstPlay *play)
|
||||||
|
|
||||||
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -299,8 +298,7 @@ gst_play_get_length_callback (GstPlay *play)
|
||||||
video_sink_element = g_hash_table_lookup (play->priv->elements,
|
video_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||||
"video_sink_element");
|
"video_sink_element");
|
||||||
if (!GST_IS_ELEMENT (audio_sink_element) &&
|
if (!GST_IS_ELEMENT (audio_sink_element) &&
|
||||||
!GST_IS_ELEMENT (video_sink_element))
|
!GST_IS_ELEMENT (video_sink_element)) {
|
||||||
{
|
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -311,8 +309,7 @@ gst_play_get_length_callback (GstPlay *play)
|
||||||
q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format,
|
q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format,
|
||||||
&value);
|
&value);
|
||||||
|
|
||||||
if (q)
|
if (q) {
|
||||||
{
|
|
||||||
play->priv->length_nanos = value;
|
play->priv->length_nanos = value;
|
||||||
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
|
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
|
||||||
0,play->priv->length_nanos);
|
0,play->priv->length_nanos);
|
||||||
|
@ -323,8 +320,7 @@ gst_play_get_length_callback (GstPlay *play)
|
||||||
play->priv->get_length_attempt++;
|
play->priv->get_length_attempt++;
|
||||||
|
|
||||||
/* We try 16 times */
|
/* We try 16 times */
|
||||||
if (play->priv->get_length_attempt > 15)
|
if (play->priv->get_length_attempt > 15) {
|
||||||
{
|
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -343,10 +339,8 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
||||||
|
|
||||||
play = GST_PLAY (element);
|
play = GST_PLAY (element);
|
||||||
|
|
||||||
if (state == GST_STATE_PLAYING)
|
if (state == GST_STATE_PLAYING) {
|
||||||
{
|
if (play->priv->tick_id) {
|
||||||
if (play->priv->tick_id)
|
|
||||||
{
|
|
||||||
g_source_remove (play->priv->tick_id);
|
g_source_remove (play->priv->tick_id);
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -357,8 +351,7 @@ gst_play_state_change (GstElement *element, GstElementState old,
|
||||||
|
|
||||||
play->priv->get_length_attempt = 0;
|
play->priv->get_length_attempt = 0;
|
||||||
|
|
||||||
if (play->priv->length_id)
|
if (play->priv->length_id) {
|
||||||
{
|
|
||||||
g_source_remove (play->priv->length_id);
|
g_source_remove (play->priv->length_id);
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
}
|
}
|
||||||
|
@ -388,26 +381,22 @@ gst_play_dispose (GObject *object)
|
||||||
|
|
||||||
play = GST_PLAY (object);
|
play = GST_PLAY (object);
|
||||||
|
|
||||||
if (play->priv->length_id)
|
if (play->priv->length_id) {
|
||||||
{
|
|
||||||
g_source_remove (play->priv->length_id);
|
g_source_remove (play->priv->length_id);
|
||||||
play->priv->length_id = 0;
|
play->priv->length_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->priv->tick_id)
|
if (play->priv->tick_id) {
|
||||||
{
|
|
||||||
g_source_remove (play->priv->tick_id);
|
g_source_remove (play->priv->tick_id);
|
||||||
play->priv->tick_id = 0;
|
play->priv->tick_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->priv->location)
|
if (play->priv->location) {
|
||||||
{
|
|
||||||
g_free (play->priv->location);
|
g_free (play->priv->location);
|
||||||
play->priv->location = NULL;
|
play->priv->location = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->priv->elements)
|
if (play->priv->elements) {
|
||||||
{
|
|
||||||
g_hash_table_destroy (play->priv->elements);
|
g_hash_table_destroy (play->priv->elements);
|
||||||
play->priv->elements = NULL;
|
play->priv->elements = NULL;
|
||||||
}
|
}
|
||||||
|
@ -560,29 +549,43 @@ gst_play_get_location (GstPlay *play)
|
||||||
gboolean
|
gboolean
|
||||||
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
||||||
{
|
{
|
||||||
GstElement *audio_sink_element;
|
GstElement *audio_sink_element, *video_sink_element;
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||||
|
|
||||||
|
g_message ("trying to seek");
|
||||||
|
|
||||||
if (time_nanos < 0LL)
|
if (time_nanos < 0LL)
|
||||||
time_nanos = 0LL;
|
time_nanos = 0LL;
|
||||||
|
|
||||||
audio_sink_element = g_hash_table_lookup (play->priv->elements,
|
audio_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||||
"audio_sink_element");
|
"audio_sink_element");
|
||||||
if (GST_IS_ELEMENT (audio_sink_element))
|
video_sink_element = g_hash_table_lookup (play->priv->elements,
|
||||||
{
|
"video_sink_element");
|
||||||
|
|
||||||
|
if (GST_IS_ELEMENT (audio_sink_element) &&
|
||||||
|
GST_IS_ELEMENT (video_sink_element)) {
|
||||||
gboolean s = FALSE;
|
gboolean s = FALSE;
|
||||||
GstClock *clock = gst_bin_get_clock (GST_BIN (play));
|
|
||||||
s = gst_element_seek (audio_sink_element, GST_FORMAT_TIME |
|
s = gst_element_seek (audio_sink_element, GST_FORMAT_TIME |
|
||||||
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
||||||
time_nanos);
|
time_nanos);
|
||||||
if (s)
|
if (!s) {
|
||||||
{
|
s = gst_element_seek (video_sink_element, GST_FORMAT_TIME |
|
||||||
|
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
|
||||||
|
time_nanos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s) {
|
||||||
|
GstClock *clock = gst_bin_get_clock (GST_BIN (play));
|
||||||
play->priv->time_nanos = gst_clock_get_time (clock);
|
play->priv->time_nanos = gst_clock_get_time (clock);
|
||||||
|
g_message ("seek succeeded");
|
||||||
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
|
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
|
||||||
0,play->priv->time_nanos);
|
0,play->priv->time_nanos);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
g_message ("seek failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -676,15 +679,13 @@ gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
|
||||||
|
|
||||||
video_sink_element = gst_play_get_sink_element (play, video_sink,
|
video_sink_element = gst_play_get_sink_element (play, video_sink,
|
||||||
GST_PLAY_SINK_TYPE_VIDEO);
|
GST_PLAY_SINK_TYPE_VIDEO);
|
||||||
if (GST_IS_ELEMENT (video_sink_element))
|
if (GST_IS_ELEMENT (video_sink_element)) {
|
||||||
{
|
|
||||||
g_hash_table_replace (play->priv->elements, "video_sink_element",
|
g_hash_table_replace (play->priv->elements, "video_sink_element",
|
||||||
video_sink_element);
|
video_sink_element);
|
||||||
g_signal_connect (G_OBJECT (video_sink_element), "have_video_size",
|
g_signal_connect (G_OBJECT (video_sink_element), "have_video_size",
|
||||||
G_CALLBACK (gst_play_have_video_size), play);
|
G_CALLBACK (gst_play_have_video_size), play);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,8 +743,7 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
||||||
|
|
||||||
audio_sink_element = gst_play_get_sink_element (play, audio_sink,
|
audio_sink_element = gst_play_get_sink_element (play, audio_sink,
|
||||||
GST_PLAY_SINK_TYPE_AUDIO);
|
GST_PLAY_SINK_TYPE_AUDIO);
|
||||||
if (GST_IS_ELEMENT (audio_sink_element))
|
if (GST_IS_ELEMENT (audio_sink_element)) {
|
||||||
{
|
|
||||||
g_hash_table_replace (play->priv->elements, "audio_sink_element",
|
g_hash_table_replace (play->priv->elements, "audio_sink_element",
|
||||||
audio_sink_element);
|
audio_sink_element);
|
||||||
}
|
}
|
||||||
|
@ -763,15 +763,14 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
||||||
gboolean
|
gboolean
|
||||||
gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
||||||
{
|
{
|
||||||
GstElement *old_vis_element, *vis_thread, *vis_queue, *video_switch;
|
GstElement *old_vis_element, *vis_thread, *vis_queue/*, *video_switch*/;
|
||||||
gboolean was_playing = FALSE;
|
gboolean was_playing = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||||
|
|
||||||
/* We bring back the pipeline to READY */
|
/* We bring back the pipeline to READY */
|
||||||
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
|
||||||
{
|
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
||||||
was_playing = TRUE;
|
was_playing = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -787,17 +786,17 @@ gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
|
||||||
vis_queue = g_hash_table_lookup (play->priv->elements, "vis_queue");
|
vis_queue = g_hash_table_lookup (play->priv->elements, "vis_queue");
|
||||||
if (!GST_IS_ELEMENT (vis_queue))
|
if (!GST_IS_ELEMENT (vis_queue))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
video_switch = g_hash_table_lookup (play->priv->elements, "video_switch");
|
/*video_switch = g_hash_table_lookup (play->priv->elements, "video_switch");
|
||||||
if (!GST_IS_ELEMENT (video_switch))
|
if (!GST_IS_ELEMENT (video_switch))
|
||||||
return FALSE;
|
return FALSE;*/
|
||||||
|
|
||||||
/* Unlinking, removing the old element then adding and linking the new one */
|
/* Unlinking, removing the old element then adding and linking the new one */
|
||||||
gst_element_unlink (vis_queue, old_vis_element);
|
gst_element_unlink (vis_queue, old_vis_element);
|
||||||
gst_element_unlink (old_vis_element, video_switch);
|
/*gst_element_unlink (old_vis_element, video_switch);*/
|
||||||
gst_bin_remove (GST_BIN (vis_thread), old_vis_element);
|
gst_bin_remove (GST_BIN (vis_thread), old_vis_element);
|
||||||
gst_bin_add (GST_BIN (vis_thread), vis_element);
|
gst_bin_add (GST_BIN (vis_thread), vis_element);
|
||||||
gst_element_link (vis_queue, vis_element);
|
gst_element_link (vis_queue, vis_element);
|
||||||
gst_element_link (vis_element, video_switch);
|
/*gst_element_link (vis_element, video_switch);*/
|
||||||
|
|
||||||
if (was_playing)
|
if (was_playing)
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
||||||
|
@ -833,8 +832,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
|
||||||
if (!GST_IS_PAD (audio_tee_pad2))
|
if (!GST_IS_PAD (audio_tee_pad2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
|
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
|
||||||
{
|
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
|
||||||
was_playing = TRUE;
|
was_playing = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -845,13 +843,9 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
|
||||||
connected = FALSE;
|
connected = FALSE;
|
||||||
|
|
||||||
if ((connect) && (!connected))
|
if ((connect) && (!connected))
|
||||||
{
|
|
||||||
gst_pad_link (audio_tee_pad2, vis_thread_pad);
|
gst_pad_link (audio_tee_pad2, vis_thread_pad);
|
||||||
}
|
|
||||||
else if ((!connect) && (connected))
|
else if ((!connect) && (connected))
|
||||||
{
|
|
||||||
gst_pad_unlink (audio_tee_pad2, vis_thread_pad);
|
gst_pad_unlink (audio_tee_pad2, vis_thread_pad);
|
||||||
}
|
|
||||||
|
|
||||||
if (was_playing)
|
if (was_playing)
|
||||||
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
|
||||||
|
@ -883,8 +877,7 @@ gst_play_get_sink_element (GstPlay *play,
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||||
|
|
||||||
if (!GST_IS_BIN (element))
|
if (!GST_IS_BIN (element)) {
|
||||||
{
|
|
||||||
/* since its not a bin, we'll presume this
|
/* since its not a bin, we'll presume this
|
||||||
* element is a sink element */
|
* element is a sink element */
|
||||||
return element;
|
return element;
|
||||||
|
@ -894,59 +887,45 @@ gst_play_get_sink_element (GstPlay *play,
|
||||||
|
|
||||||
/* traverse all elements looking for a src pad */
|
/* traverse all elements looking for a src pad */
|
||||||
|
|
||||||
while (elements)
|
while (elements) {
|
||||||
{
|
|
||||||
|
|
||||||
element = GST_ELEMENT (elements->data);
|
element = GST_ELEMENT (elements->data);
|
||||||
|
|
||||||
/* Recursivity :) */
|
/* Recursivity :) */
|
||||||
|
|
||||||
if (GST_IS_BIN (element))
|
if (GST_IS_BIN (element)) {
|
||||||
{
|
|
||||||
element = gst_play_get_sink_element (play, element, sink_type);
|
element = gst_play_get_sink_element (play, element, sink_type);
|
||||||
if (GST_IS_ELEMENT (element))
|
if (GST_IS_ELEMENT (element))
|
||||||
{
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
pads = gst_element_get_pad_list (element);
|
pads = gst_element_get_pad_list (element);
|
||||||
has_src = FALSE;
|
has_src = FALSE;
|
||||||
has_correct_type = FALSE;
|
has_correct_type = FALSE;
|
||||||
while (pads)
|
while (pads) {
|
||||||
{
|
|
||||||
/* check for src pad */
|
/* check for src pad */
|
||||||
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC)
|
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
|
||||||
{
|
|
||||||
has_src = TRUE;
|
has_src = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* If not a src pad checking caps */
|
/* If not a src pad checking caps */
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
caps = gst_pad_get_caps (GST_PAD (pads->data));
|
caps = gst_pad_get_caps (GST_PAD (pads->data));
|
||||||
while (caps)
|
while (caps) {
|
||||||
{
|
|
||||||
gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
|
gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
|
||||||
if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||||
"audio/x-raw-int") == 0)
|
"audio/x-raw-int") == 0) {
|
||||||
{
|
|
||||||
has_audio_cap = TRUE;
|
has_audio_cap = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
if ((g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||||
"video/x-raw-yuv") == 0) ||
|
"video/x-raw-yuv") == 0) ||
|
||||||
(g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
(g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||||
"video/x-raw-rgb") == 0))
|
"video/x-raw-rgb") == 0)) {
|
||||||
|
|
||||||
{
|
|
||||||
has_video_cap = TRUE;
|
has_video_cap = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sink_type)
|
switch (sink_type) {
|
||||||
{
|
|
||||||
case GST_PLAY_SINK_TYPE_AUDIO:
|
case GST_PLAY_SINK_TYPE_AUDIO:
|
||||||
if (has_audio_cap)
|
if (has_audio_cap)
|
||||||
has_correct_type = TRUE;
|
has_correct_type = TRUE;
|
||||||
|
@ -962,19 +941,24 @@ gst_play_get_sink_element (GstPlay *play,
|
||||||
default:
|
default:
|
||||||
has_correct_type = FALSE;
|
has_correct_type = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = caps->next;
|
caps = caps->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!has_src) && (has_correct_type))
|
if ((!has_src) && (has_correct_type))
|
||||||
{
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
elements = g_list_next (elements);
|
elements = g_list_next (elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we didn't find a sink element */
|
/* we didn't find a sink element */
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,8 +981,7 @@ gst_play_get_type (void)
|
||||||
{
|
{
|
||||||
static GType play_type = 0;
|
static GType play_type = 0;
|
||||||
|
|
||||||
if (!play_type)
|
if (!play_type) {
|
||||||
{
|
|
||||||
static const GTypeInfo play_info = {
|
static const GTypeInfo play_info = {
|
||||||
sizeof (GstPlayClass),
|
sizeof (GstPlayClass),
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#ifndef __GST_PLAY_H__
|
#ifndef __GST_PLAY_H__
|
||||||
#define __GST_PLAY_H__
|
#define __GST_PLAY_H__
|
||||||
|
|
||||||
#include <gst/gstpipeline.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#define GST_TYPE_PLAY (gst_play_get_type())
|
#define GST_TYPE_PLAY (gst_play_get_type())
|
||||||
#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
|
#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
|
||||||
|
|
Loading…
Reference in a new issue