forked from enlightenment/efl
parent
ec19c6f700
commit
84553cfb4a
|
@ -5,9 +5,9 @@
|
||||||
#include "emotion_gstreamer_pipeline.h"
|
#include "emotion_gstreamer_pipeline.h"
|
||||||
|
|
||||||
|
|
||||||
static void dvd_pad_added_cb (GstElement *dvddemuxer,
|
static void dvd_pad_added_cb (GstElement *dvddemuxer,
|
||||||
GObject *new_pad,
|
GObject *new_pad,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
static void dvd_no_more_pads_cb (GstElement *dvddemuxer,
|
static void dvd_no_more_pads_cb (GstElement *dvddemuxer,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
@ -16,7 +16,7 @@ static int no_more_pads = 0;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
emotion_pipeline_dvd_build (void *video, const char *device)
|
emotion_pipeline_dvd_build(void *video, const char *device)
|
||||||
{
|
{
|
||||||
GstElement *dvdreadsrc;
|
GstElement *dvdreadsrc;
|
||||||
GstElement *dvddemux;
|
GstElement *dvddemux;
|
||||||
|
@ -25,205 +25,216 @@ emotion_pipeline_dvd_build (void *video, const char *device)
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
if (!ev) return 0;
|
if (!ev) return 0;
|
||||||
|
|
||||||
dvdreadsrc = gst_element_factory_make ("dvdreadsrc", "src");
|
dvdreadsrc = gst_element_factory_make("dvdreadsrc", "src");
|
||||||
if (!dvdreadsrc)
|
if (!dvdreadsrc)
|
||||||
goto failure_dvdreadsrc;
|
goto failure_dvdreadsrc;
|
||||||
if (device)
|
if (device)
|
||||||
g_object_set (G_OBJECT (dvdreadsrc), "device", device, NULL);
|
g_object_set(G_OBJECT(dvdreadsrc), "device", device, NULL);
|
||||||
|
|
||||||
dvddemux = gst_element_factory_make ("dvddemux", "dvddemux");
|
dvddemux = gst_element_factory_make("dvddemux", "dvddemux");
|
||||||
if (!dvddemux)
|
if (!dvddemux)
|
||||||
goto failure_dvddemux;
|
goto failure_dvddemux;
|
||||||
g_signal_connect (dvddemux, "pad-added",
|
g_signal_connect(dvddemux, "pad-added",
|
||||||
G_CALLBACK (dvd_pad_added_cb), ev);
|
G_CALLBACK(dvd_pad_added_cb), ev);
|
||||||
g_signal_connect (dvddemux, "no-more-pads",
|
g_signal_connect(dvddemux, "no-more-pads",
|
||||||
G_CALLBACK (dvd_no_more_pads_cb), ev);
|
G_CALLBACK(dvd_no_more_pads_cb), ev);
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (ev->pipeline), dvdreadsrc, dvddemux, NULL);
|
gst_bin_add_many(GST_BIN(ev->pipeline), dvdreadsrc, dvddemux, NULL);
|
||||||
if (!gst_element_link (dvdreadsrc, dvddemux))
|
if (!gst_element_link(dvdreadsrc, dvddemux))
|
||||||
goto failure_link;
|
goto failure_link;
|
||||||
|
|
||||||
if (!emotion_pipeline_pause (ev->pipeline))
|
if (!emotion_pipeline_pause(ev->pipeline))
|
||||||
goto failure_gstreamer_pause;
|
goto failure_gstreamer_pause;
|
||||||
|
|
||||||
while (no_more_pads == 0) {
|
while (no_more_pads == 0)
|
||||||
g_print ("toto\n");}
|
{
|
||||||
|
g_print("toto\n");
|
||||||
|
}
|
||||||
no_more_pads = 0;
|
no_more_pads = 0;
|
||||||
|
|
||||||
/* We get the informations of streams */
|
/* We get the informations of streams */
|
||||||
ecore_list_first_goto (ev->video_sinks);
|
ecore_list_first_goto(ev->video_sinks);
|
||||||
ecore_list_first_goto (ev->audio_sinks);
|
ecore_list_first_goto(ev->audio_sinks);
|
||||||
|
|
||||||
{
|
{
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
gpointer data;
|
gpointer data;
|
||||||
|
|
||||||
it = gst_element_iterate_src_pads (dvddemux);
|
it = gst_element_iterate_src_pads(dvddemux);
|
||||||
while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
|
while (gst_iterator_next(it, &data) == GST_ITERATOR_OK)
|
||||||
GstPad *pad;
|
{
|
||||||
GstCaps *caps;
|
GstPad *pad;
|
||||||
gchar *str;
|
GstCaps *caps;
|
||||||
|
gchar *str;
|
||||||
|
|
||||||
pad = GST_PAD (data);
|
pad = GST_PAD(data);
|
||||||
|
|
||||||
caps = gst_pad_get_caps (pad);
|
caps = gst_pad_get_caps(pad);
|
||||||
str = gst_caps_to_string (caps);
|
str = gst_caps_to_string(caps);
|
||||||
g_print ("caps !! %s\n", str);
|
g_print("caps !! %s\n", str);
|
||||||
/* video stream */
|
/* video stream */
|
||||||
if (g_str_has_prefix (str, "video/mpeg")) {
|
if (g_str_has_prefix(str, "video/mpeg"))
|
||||||
Emotion_Video_Sink *vsink;
|
{
|
||||||
GstPad *sink_pad;
|
Emotion_Video_Sink *vsink;
|
||||||
GstCaps *sink_caps;
|
GstPad *sink_pad;
|
||||||
|
GstCaps *sink_caps;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_next (ev->video_sinks);
|
vsink = (Emotion_Video_Sink *)ecore_list_next(ev->video_sinks);
|
||||||
sink_pad = gst_element_get_pad (gst_bin_get_by_name (GST_BIN (ev->pipeline), "mpeg2dec"), "src");
|
sink_pad = gst_element_get_pad(gst_bin_get_by_name(GST_BIN(ev->pipeline), "mpeg2dec"), "src");
|
||||||
sink_caps = gst_pad_get_caps (sink_pad);
|
sink_caps = gst_pad_get_caps(sink_pad);
|
||||||
str = gst_caps_to_string (sink_caps);
|
str = gst_caps_to_string(sink_caps);
|
||||||
g_print (" ** caps v !! %s\n", str);
|
g_print(" ** caps v !! %s\n", str);
|
||||||
|
|
||||||
emotion_video_sink_fill (vsink, sink_pad, sink_caps);
|
emotion_video_sink_fill(vsink, sink_pad, sink_caps);
|
||||||
|
|
||||||
gst_caps_unref (sink_caps);
|
gst_caps_unref(sink_caps);
|
||||||
gst_object_unref (sink_pad);
|
gst_object_unref(sink_pad);
|
||||||
}
|
}
|
||||||
/* audio stream */
|
/* audio stream */
|
||||||
else if (g_str_has_prefix (str, "audio/")) {
|
else if (g_str_has_prefix(str, "audio/"))
|
||||||
Emotion_Audio_Sink *asink;
|
{
|
||||||
GstPad *sink_pad;
|
Emotion_Audio_Sink *asink;
|
||||||
GstCaps *sink_caps;
|
GstPad *sink_pad;
|
||||||
|
GstCaps *sink_caps;
|
||||||
|
|
||||||
asink = (Emotion_Audio_Sink *)ecore_list_next (ev->audio_sinks);
|
asink = (Emotion_Audio_Sink *)ecore_list_next(ev->audio_sinks);
|
||||||
sink_pad = gst_element_get_pad (gst_bin_get_by_name (GST_BIN (ev->pipeline), "a52dec"), "src");
|
sink_pad = gst_element_get_pad(gst_bin_get_by_name(GST_BIN(ev->pipeline), "a52dec"), "src");
|
||||||
sink_caps = gst_pad_get_caps (sink_pad);
|
sink_caps = gst_pad_get_caps(sink_pad);
|
||||||
|
|
||||||
emotion_audio_sink_fill (asink, sink_pad, sink_caps);
|
emotion_audio_sink_fill(asink, sink_pad, sink_caps);
|
||||||
}
|
}
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref(caps);
|
||||||
g_free (str);
|
g_free(str);
|
||||||
gst_object_unref (pad);
|
gst_object_unref(pad);
|
||||||
}
|
}
|
||||||
gst_iterator_free (it);
|
gst_iterator_free(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The first vsink is a valid Emotion_Video_Sink * */
|
/* The first vsink is a valid Emotion_Video_Sink * */
|
||||||
/* If no video stream is found, it's a visualisation sink */
|
/* If no video stream is found, it's a visualisation sink */
|
||||||
{
|
{
|
||||||
Emotion_Video_Sink *vsink;
|
Emotion_Video_Sink *vsink;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_first_goto (ev->video_sinks);
|
vsink = (Emotion_Video_Sink *)ecore_list_first_goto(ev->video_sinks);
|
||||||
if (vsink && vsink->sink) {
|
if (vsink && vsink->sink)
|
||||||
g_object_set (G_OBJECT (vsink->sink), "sync", TRUE, NULL);
|
{
|
||||||
g_object_set (G_OBJECT (vsink->sink), "signal-handoffs", TRUE, NULL);
|
g_object_set(G_OBJECT(vsink->sink), "sync", TRUE, NULL);
|
||||||
g_signal_connect (G_OBJECT (vsink->sink),
|
g_object_set(G_OBJECT(vsink->sink), "signal-handoffs", TRUE, NULL);
|
||||||
"handoff",
|
g_signal_connect(G_OBJECT(vsink->sink),
|
||||||
G_CALLBACK (cb_handoff), ev);
|
"handoff",
|
||||||
}
|
G_CALLBACK(cb_handoff), ev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
failure_gstreamer_pause:
|
failure_gstreamer_pause:
|
||||||
failure_link:
|
failure_link:
|
||||||
gst_element_set_state (ev->pipeline, GST_STATE_NULL);
|
gst_element_set_state(ev->pipeline, GST_STATE_NULL);
|
||||||
gst_bin_remove (GST_BIN (ev->pipeline), dvddemux);
|
gst_bin_remove(GST_BIN(ev->pipeline), dvddemux);
|
||||||
failure_dvddemux:
|
failure_dvddemux:
|
||||||
gst_bin_remove (GST_BIN (ev->pipeline), dvdreadsrc);
|
gst_bin_remove(GST_BIN(ev->pipeline), dvdreadsrc);
|
||||||
failure_dvdreadsrc:
|
failure_dvdreadsrc:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dvd_pad_added_cb (GstElement *dvddemuxer,
|
dvd_pad_added_cb(GstElement *dvddemuxer,
|
||||||
GObject *new_pad,
|
GObject *new_pad,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
Emotion_Gstreamer_Video *ev;
|
Emotion_Gstreamer_Video *ev;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)user_data;
|
ev = (Emotion_Gstreamer_Video *)user_data;
|
||||||
caps = gst_pad_get_caps (GST_PAD (new_pad));
|
caps = gst_pad_get_caps(GST_PAD(new_pad));
|
||||||
str = gst_caps_to_string (caps);
|
str = gst_caps_to_string(caps);
|
||||||
/* video stream */
|
/* video stream */
|
||||||
if (g_str_has_prefix (str, "video/mpeg")) {
|
if (g_str_has_prefix(str, "video/mpeg"))
|
||||||
Emotion_Video_Sink *vsink;
|
{
|
||||||
GstElement *queue;
|
Emotion_Video_Sink *vsink;
|
||||||
GstElement *decoder;
|
GstElement *queue;
|
||||||
GstPad *videopad;
|
GstElement *decoder;
|
||||||
|
GstPad *videopad;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)malloc (sizeof (Emotion_Video_Sink));
|
vsink = (Emotion_Video_Sink *)malloc(sizeof(Emotion_Video_Sink));
|
||||||
if (!vsink) return;
|
if (!vsink) return;
|
||||||
if (!ecore_list_append (ev->video_sinks, vsink)) {
|
if (!ecore_list_append(ev->video_sinks, vsink))
|
||||||
free(vsink);
|
{
|
||||||
return;
|
free(vsink);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
queue = gst_element_factory_make("queue", NULL);
|
||||||
decoder = gst_element_factory_make ("mpeg2dec", "mpeg2dec");
|
decoder = gst_element_factory_make("mpeg2dec", "mpeg2dec");
|
||||||
vsink->sink = gst_element_factory_make ("fakesink", "videosink");
|
vsink->sink = gst_element_factory_make("fakesink", "videosink");
|
||||||
gst_bin_add_many (GST_BIN (ev->pipeline), queue, decoder, vsink->sink, NULL);
|
gst_bin_add_many(GST_BIN(ev->pipeline), queue, decoder, vsink->sink, NULL);
|
||||||
gst_element_link (queue, decoder);
|
gst_element_link(queue, decoder);
|
||||||
gst_element_link (decoder, vsink->sink);
|
gst_element_link(decoder, vsink->sink);
|
||||||
videopad = gst_element_get_pad (queue, "sink");
|
videopad = gst_element_get_pad(queue, "sink");
|
||||||
gst_pad_link (GST_PAD (new_pad), videopad);
|
gst_pad_link(GST_PAD(new_pad), videopad);
|
||||||
gst_object_unref (videopad);
|
gst_object_unref(videopad);
|
||||||
if (ecore_list_count(ev->video_sinks) == 1) {
|
if (ecore_list_count(ev->video_sinks) == 1)
|
||||||
ev->ratio = (double)vsink->width / (double)vsink->height;
|
{
|
||||||
}
|
ev->ratio = (double)vsink->width / (double)vsink->height;
|
||||||
gst_element_set_state (queue, GST_STATE_PAUSED);
|
}
|
||||||
gst_element_set_state (decoder, GST_STATE_PAUSED);
|
gst_element_set_state(queue, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (vsink->sink, GST_STATE_PAUSED);
|
gst_element_set_state(decoder, GST_STATE_PAUSED);
|
||||||
}
|
gst_element_set_state(vsink->sink, GST_STATE_PAUSED);
|
||||||
|
}
|
||||||
/* audio stream */
|
/* audio stream */
|
||||||
else if (g_str_has_prefix (str, "audio/")) {
|
else if (g_str_has_prefix(str, "audio/"))
|
||||||
Emotion_Audio_Sink *asink;
|
{
|
||||||
GstElement *queue;
|
Emotion_Audio_Sink *asink;
|
||||||
GstElement *decoder;
|
GstElement *queue;
|
||||||
GstElement *conv;
|
GstElement *decoder;
|
||||||
GstElement *resample;
|
GstElement *conv;
|
||||||
GstElement *volume;
|
GstElement *resample;
|
||||||
GstPad *audiopad;
|
GstElement *volume;
|
||||||
double vol;
|
GstPad *audiopad;
|
||||||
|
double vol;
|
||||||
|
|
||||||
asink = (Emotion_Audio_Sink *)malloc (sizeof (Emotion_Audio_Sink));
|
asink = (Emotion_Audio_Sink *)malloc(sizeof(Emotion_Audio_Sink));
|
||||||
if (!asink) return;
|
if (!asink) return;
|
||||||
if (!ecore_list_append (ev->audio_sinks, asink)) {
|
if (!ecore_list_append(ev->audio_sinks, asink))
|
||||||
free(asink);
|
{
|
||||||
return;
|
free(asink);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
queue = gst_element_factory_make ("queue", NULL);
|
queue = gst_element_factory_make("queue", NULL);
|
||||||
decoder = gst_element_factory_make ("a52dec", "a52dec");
|
decoder = gst_element_factory_make("a52dec", "a52dec");
|
||||||
conv = gst_element_factory_make ("audioconvert", NULL);
|
conv = gst_element_factory_make("audioconvert", NULL);
|
||||||
resample = gst_element_factory_make ("audioresample", NULL);
|
resample = gst_element_factory_make("audioresample", NULL);
|
||||||
volume = gst_element_factory_make ("volume", "volume");
|
volume = gst_element_factory_make("volume", "volume");
|
||||||
g_object_get (G_OBJECT (volume), "volume", &vol, NULL);
|
g_object_get(G_OBJECT(volume), "volume", &vol, NULL);
|
||||||
ev->volume = vol / 10.0;
|
ev->volume = vol / 10.0;
|
||||||
|
|
||||||
/* FIXME: must manage several audio streams */
|
/* FIXME: must manage several audio streams */
|
||||||
asink->sink = gst_element_factory_make ("fakesink", NULL);
|
asink->sink = gst_element_factory_make("fakesink", NULL);
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (ev->pipeline),
|
gst_bin_add_many(GST_BIN(ev->pipeline),
|
||||||
queue, decoder, conv, resample, volume, asink->sink, NULL);
|
queue, decoder, conv, resample, volume, asink->sink, NULL);
|
||||||
gst_element_link_many (queue, decoder, conv, resample, volume, asink->sink, NULL);
|
gst_element_link_many(queue, decoder, conv, resample, volume, asink->sink, NULL);
|
||||||
|
|
||||||
audiopad = gst_element_get_pad (queue, "sink");
|
audiopad = gst_element_get_pad(queue, "sink");
|
||||||
gst_pad_link (GST_PAD (new_pad), audiopad);
|
gst_pad_link(GST_PAD(new_pad), audiopad);
|
||||||
gst_object_unref (audiopad);
|
gst_object_unref(audiopad);
|
||||||
|
|
||||||
gst_element_set_state (queue, GST_STATE_PAUSED);
|
gst_element_set_state(queue, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (decoder, GST_STATE_PAUSED);
|
gst_element_set_state(decoder, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (conv, GST_STATE_PAUSED);
|
gst_element_set_state(conv, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (resample, GST_STATE_PAUSED);
|
gst_element_set_state(resample, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (volume, GST_STATE_PAUSED);
|
gst_element_set_state(volume, GST_STATE_PAUSED);
|
||||||
gst_element_set_state (asink->sink, GST_STATE_PAUSED);
|
gst_element_set_state(asink->sink, GST_STATE_PAUSED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dvd_no_more_pads_cb (GstElement *dvddemuxer,
|
dvd_no_more_pads_cb(GstElement *dvddemuxer,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
no_more_pads = 1;
|
no_more_pads = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "emotion_gstreamer_pipeline.h"
|
#include "emotion_gstreamer_pipeline.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
emotion_pipeline_file_build (void *video, const char *file)
|
emotion_pipeline_file_build(void *video, const char *file)
|
||||||
{
|
{
|
||||||
GstElement *filesrc;
|
GstElement *filesrc;
|
||||||
GstElement *decodebin;
|
GstElement *decodebin;
|
||||||
|
@ -14,50 +14,51 @@ emotion_pipeline_file_build (void *video, const char *file)
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
if (!ev) return 0;
|
if (!ev) return 0;
|
||||||
|
|
||||||
filesrc = gst_element_factory_make ("filesrc", "src");
|
filesrc = gst_element_factory_make("filesrc", "src");
|
||||||
if (!filesrc)
|
if (!filesrc)
|
||||||
goto failure_filesrc;
|
goto failure_filesrc;
|
||||||
g_object_set (G_OBJECT (filesrc), "location", file, NULL);
|
g_object_set(G_OBJECT(filesrc), "location", file, NULL);
|
||||||
|
|
||||||
decodebin = gst_element_factory_make ("decodebin", "decodebin");
|
decodebin = gst_element_factory_make("decodebin", "decodebin");
|
||||||
if (!decodebin)
|
if (!decodebin)
|
||||||
goto failure_decodebin;
|
goto failure_decodebin;
|
||||||
g_signal_connect (decodebin, "new-decoded-pad",
|
g_signal_connect(decodebin, "new-decoded-pad",
|
||||||
G_CALLBACK (file_new_decoded_pad_cb), ev);
|
G_CALLBACK(file_new_decoded_pad_cb), ev);
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (ev->pipeline), filesrc, decodebin, NULL);
|
gst_bin_add_many(GST_BIN(ev->pipeline), filesrc, decodebin, NULL);
|
||||||
if (!gst_element_link (filesrc, decodebin))
|
if (!gst_element_link(filesrc, decodebin))
|
||||||
goto failure_link;
|
goto failure_link;
|
||||||
|
|
||||||
if (!emotion_pipeline_pause (ev->pipeline))
|
if (!emotion_pipeline_pause(ev->pipeline))
|
||||||
goto failure_gstreamer_pause;
|
goto failure_gstreamer_pause;
|
||||||
|
|
||||||
emotion_streams_sinks_get (ev, decodebin);
|
emotion_streams_sinks_get(ev, decodebin);
|
||||||
|
|
||||||
/* The first vsink is a valid Emotion_Video_Sink * */
|
/* The first vsink is a valid Emotion_Video_Sink * */
|
||||||
/* If no video stream is found, it's a visualisation sink */
|
/* If no video stream is found, it's a visualisation sink */
|
||||||
{
|
{
|
||||||
Emotion_Video_Sink *vsink;
|
Emotion_Video_Sink *vsink;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_first_goto (ev->video_sinks);
|
vsink = (Emotion_Video_Sink *)ecore_list_first_goto(ev->video_sinks);
|
||||||
if (vsink && vsink->sink) {
|
if (vsink && vsink->sink)
|
||||||
g_object_set (G_OBJECT (vsink->sink), "sync", TRUE, NULL);
|
{
|
||||||
g_object_set (G_OBJECT (vsink->sink), "signal-handoffs", TRUE, NULL);
|
g_object_set(G_OBJECT(vsink->sink), "sync", TRUE, NULL);
|
||||||
g_signal_connect (G_OBJECT (vsink->sink),
|
g_object_set(G_OBJECT(vsink->sink), "signal-handoffs", TRUE, NULL);
|
||||||
"handoff",
|
g_signal_connect(G_OBJECT(vsink->sink),
|
||||||
G_CALLBACK (cb_handoff), ev);
|
"handoff",
|
||||||
}
|
G_CALLBACK(cb_handoff), ev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
failure_gstreamer_pause:
|
failure_gstreamer_pause:
|
||||||
failure_link:
|
failure_link:
|
||||||
gst_element_set_state (ev->pipeline, GST_STATE_NULL);
|
gst_element_set_state(ev->pipeline, GST_STATE_NULL);
|
||||||
gst_bin_remove (GST_BIN (ev->pipeline), decodebin);
|
gst_bin_remove(GST_BIN(ev->pipeline), decodebin);
|
||||||
failure_decodebin:
|
failure_decodebin:
|
||||||
gst_bin_remove (GST_BIN (ev->pipeline), filesrc);
|
gst_bin_remove(GST_BIN(ev->pipeline), filesrc);
|
||||||
failure_filesrc:
|
failure_filesrc:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "emotion_gstreamer_pipeline.h"
|
#include "emotion_gstreamer_pipeline.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
emotion_pipeline_uri_build (void *video, const char *uri)
|
emotion_pipeline_uri_build(void *video, const char *uri)
|
||||||
{
|
{
|
||||||
GstElement *src;
|
GstElement *src;
|
||||||
GstElement *decodebin;
|
GstElement *decodebin;
|
||||||
|
@ -16,50 +16,51 @@ emotion_pipeline_uri_build (void *video, const char *uri)
|
||||||
|
|
||||||
if (gst_uri_protocol_is_supported(GST_URI_SRC, uri))
|
if (gst_uri_protocol_is_supported(GST_URI_SRC, uri))
|
||||||
goto failure_src;
|
goto failure_src;
|
||||||
src = gst_element_make_from_uri (GST_URI_SRC, uri, "src");
|
src = gst_element_make_from_uri(GST_URI_SRC, uri, "src");
|
||||||
if (!src)
|
if (!src)
|
||||||
goto failure_src;
|
goto failure_src;
|
||||||
g_object_set (G_OBJECT (src), "location", uri, NULL);
|
g_object_set(G_OBJECT(src), "location", uri, NULL);
|
||||||
|
|
||||||
decodebin = gst_element_factory_make ("decodebin", "decodebin");
|
decodebin = gst_element_factory_make("decodebin", "decodebin");
|
||||||
if (!decodebin)
|
if (!decodebin)
|
||||||
goto failure_decodebin;
|
goto failure_decodebin;
|
||||||
g_signal_connect (decodebin, "new-decoded-pad",
|
g_signal_connect(decodebin, "new-decoded-pad",
|
||||||
G_CALLBACK (file_new_decoded_pad_cb), ev);
|
G_CALLBACK(file_new_decoded_pad_cb), ev);
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (ev->pipeline), src, decodebin, NULL);
|
gst_bin_add_many(GST_BIN(ev->pipeline), src, decodebin, NULL);
|
||||||
if (!gst_element_link (src, decodebin))
|
if (!gst_element_link(src, decodebin))
|
||||||
goto failure_link;
|
goto failure_link;
|
||||||
|
|
||||||
if (!emotion_pipeline_pause (ev->pipeline))
|
if (!emotion_pipeline_pause(ev->pipeline))
|
||||||
goto failure_gstreamer_pause;
|
goto failure_gstreamer_pause;
|
||||||
|
|
||||||
emotion_streams_sinks_get (ev, decodebin);
|
emotion_streams_sinks_get(ev, decodebin);
|
||||||
|
|
||||||
/* The first vsink is a valid Emotion_Video_Sink * */
|
/* The first vsink is a valid Emotion_Video_Sink * */
|
||||||
/* If no video stream is found, it's a visualisation sink */
|
/* If no video stream is found, it's a visualisation sink */
|
||||||
{
|
{
|
||||||
Emotion_Video_Sink *vsink;
|
Emotion_Video_Sink *vsink;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_first_goto (ev->video_sinks);
|
vsink = (Emotion_Video_Sink *)ecore_list_first_goto(ev->video_sinks);
|
||||||
if (vsink && vsink->sink) {
|
if (vsink && vsink->sink)
|
||||||
g_object_set (G_OBJECT (vsink->sink), "sync", TRUE, NULL);
|
{
|
||||||
g_object_set (G_OBJECT (vsink->sink), "signal-handoffs", TRUE, NULL);
|
g_object_set(G_OBJECT(vsink->sink), "sync", TRUE, NULL);
|
||||||
g_signal_connect (G_OBJECT (vsink->sink),
|
g_object_set(G_OBJECT(vsink->sink), "signal-handoffs", TRUE, NULL);
|
||||||
"handoff",
|
g_signal_connect(G_OBJECT(vsink->sink),
|
||||||
G_CALLBACK (cb_handoff), ev);
|
"handoff",
|
||||||
}
|
G_CALLBACK(cb_handoff), ev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
failure_gstreamer_pause:
|
failure_gstreamer_pause:
|
||||||
failure_link:
|
failure_link:
|
||||||
gst_element_set_state (ev->pipeline, GST_STATE_NULL);
|
gst_element_set_state(ev->pipeline, GST_STATE_NULL);
|
||||||
gst_bin_remove (GST_BIN (ev->pipeline), decodebin);
|
gst_bin_remove(GST_BIN(ev->pipeline), decodebin);
|
||||||
failure_decodebin:
|
failure_decodebin:
|
||||||
gst_bin_remove (GST_BIN (ev->pipeline), src);
|
gst_bin_remove(GST_BIN(ev->pipeline), src);
|
||||||
failure_src:
|
failure_src:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue