forked from enlightenment/efl
emotion: make preroll work and try to really turn off audio when mutted.
SVN revision: 60663
This commit is contained in:
parent
e2b7d34bfa
commit
dadaf6f420
|
@ -1163,11 +1163,14 @@ em_audio_channel_name_get(void *video __UNUSED__,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#define GST_PLAY_FLAG_AUDIO (1 << 1)
|
||||
|
||||
static void
|
||||
em_audio_channel_mute_set(void *video,
|
||||
int mute)
|
||||
{
|
||||
Emotion_Gstreamer_Video *ev;
|
||||
int flags;
|
||||
|
||||
ev = (Emotion_Gstreamer_Video *)video;
|
||||
|
||||
|
@ -1176,10 +1179,16 @@ em_audio_channel_mute_set(void *video,
|
|||
|
||||
ev->audio_mute = mute;
|
||||
|
||||
if (mute)
|
||||
g_object_set(G_OBJECT(ev->pipeline), "mute", 1, NULL);
|
||||
else
|
||||
g_object_set(G_OBJECT(ev->pipeline), "mute", 0, NULL);
|
||||
g_object_set(G_OBJECT(ev->pipeline), "mute", !!mute, NULL);
|
||||
/* This code should stop the decoding of only the audio stream, but everything stop :"( */
|
||||
/* g_object_get(G_OBJECT(ev->pipeline), "flags", &flags, NULL); */
|
||||
/* if (mute) */
|
||||
/* flags &= ~GST_PLAY_FLAG_AUDIO; */
|
||||
/* else */
|
||||
/* flags |= GST_PLAY_FLAG_AUDIO; */
|
||||
/* g_object_set(G_OBJECT(ev->pipeline), "flags", flags, NULL); */
|
||||
/* g_object_get(G_OBJECT(ev->pipeline), "flags", &flags, NULL); */
|
||||
/* fprintf(stderr, "flags-n: %x\n", flags); */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -50,14 +50,15 @@ struct _EvasVideoSinkPrivate {
|
|||
// to deadlocks because render() holds the stream lock.
|
||||
//
|
||||
// Protected by the buffer mutex
|
||||
gboolean unlocked;
|
||||
Eina_Bool unlocked : 1;
|
||||
Eina_Bool preroll : 1;
|
||||
};
|
||||
|
||||
#define _do_init(bla) \
|
||||
GST_DEBUG_CATEGORY_INIT(evas_video_sink_debug, \
|
||||
"evassink", \
|
||||
"emotion-sink", \
|
||||
0, \
|
||||
"evas video sink")
|
||||
"emotion video sink")
|
||||
|
||||
GST_BOILERPLATE_FULL(EvasVideoSink,
|
||||
evas_video_sink,
|
||||
|
@ -96,6 +97,8 @@ evas_video_sink_init(EvasVideoSink* sink, EvasVideoSinkClass* klass __UNUSED__)
|
|||
priv->format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||
priv->data_cond = g_cond_new();
|
||||
priv->buffer_mutex = g_mutex_new();
|
||||
priv->preroll = EINA_FALSE;
|
||||
priv->unlocked = EINA_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -256,7 +259,7 @@ evas_video_sink_start(GstBaseSink* base_sink)
|
|||
res = FALSE;
|
||||
else
|
||||
{
|
||||
priv->unlocked = FALSE;
|
||||
priv->unlocked = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
g_mutex_unlock(priv->buffer_mutex);
|
||||
|
@ -305,6 +308,18 @@ evas_video_sink_unlock_stop(GstBaseSink* object)
|
|||
static GstFlowReturn
|
||||
evas_video_sink_preroll(GstBaseSink* bsink, GstBuffer* buffer)
|
||||
{
|
||||
GstBuffer *send;
|
||||
EvasVideoSink* sink;
|
||||
EvasVideoSinkPrivate* priv;
|
||||
|
||||
sink = EVAS_VIDEO_SINK(bsink);
|
||||
priv = sink->priv;
|
||||
|
||||
send = gst_buffer_ref(buffer);
|
||||
|
||||
priv->preroll = EINA_TRUE;
|
||||
|
||||
ecore_pipe_write(priv->p, &send, sizeof(buffer));
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
|
@ -326,6 +341,8 @@ evas_video_sink_render(GstBaseSink* bsink, GstBuffer* buffer)
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
priv->preroll = EINA_FALSE;
|
||||
|
||||
send = gst_buffer_ref(buffer);
|
||||
ret = ecore_pipe_write(priv->p, &send, sizeof(buffer));
|
||||
if (!ret)
|
||||
|
@ -500,6 +517,8 @@ static void evas_video_sink_render_handler(void *data,
|
|||
exit_point:
|
||||
gst_buffer_unref(buffer);
|
||||
|
||||
if (priv->preroll) return ;
|
||||
|
||||
g_mutex_lock(priv->buffer_mutex);
|
||||
|
||||
if (priv->unlocked) {
|
||||
|
@ -516,7 +535,7 @@ unlock_buffer_mutex(EvasVideoSinkPrivate* priv)
|
|||
{
|
||||
g_mutex_lock(priv->buffer_mutex);
|
||||
|
||||
priv->unlocked = TRUE;
|
||||
priv->unlocked = EINA_TRUE;
|
||||
g_cond_signal(priv->data_cond);
|
||||
g_mutex_unlock(priv->buffer_mutex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue