forked from enlightenment/efl
parent
10bac60aa1
commit
ec19c6f700
|
@ -15,13 +15,15 @@ emotion_pipeline_pause (GstElement *pipeline)
|
|||
GstStateChangeReturn res;
|
||||
|
||||
res = gst_element_set_state((pipeline), GST_STATE_PAUSED);
|
||||
if (res == GST_STATE_CHANGE_FAILURE) {
|
||||
if (res == GST_STATE_CHANGE_FAILURE)
|
||||
{
|
||||
g_print("Emotion-Gstreamer ERROR: could not pause\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
res = gst_element_get_state((pipeline), NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||
if (res != GST_STATE_CHANGE_SUCCESS) {
|
||||
if (res != GST_STATE_CHANGE_SUCCESS)
|
||||
{
|
||||
g_print("Emotion-Gstreamer ERROR: could not complete pause\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,23 +45,26 @@ cb_handoff (GstElement *fakesrc,
|
|||
if (!ev)
|
||||
return;
|
||||
|
||||
if (!ev->video_mute) {
|
||||
if (!ev->video_mute)
|
||||
{
|
||||
if (!ev->obj_data)
|
||||
ev->obj_data = (void*) malloc (GST_BUFFER_SIZE(buffer) * sizeof(void));
|
||||
ev->obj_data = malloc(GST_BUFFER_SIZE(buffer) * sizeof(void));
|
||||
|
||||
memcpy(ev->obj_data, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer));
|
||||
buf[0] = GST_BUFFER_DATA(buffer);
|
||||
buf[1] = buffer;
|
||||
write(ev->fd_ev_write, buf, sizeof(buf));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Emotion_Audio_Sink *asink;
|
||||
asink = (Emotion_Audio_Sink *)ecore_list_index_goto(ev->audio_sinks, ev->audio_sink_nbr);
|
||||
_emotion_video_pos_update(ev->obj, ev->position, asink->length_time);
|
||||
}
|
||||
|
||||
query = gst_query_new_position(GST_FORMAT_TIME);
|
||||
if (gst_pad_query (gst_pad_get_peer (pad), query)) {
|
||||
if (gst_pad_query(gst_pad_get_peer(pad), query))
|
||||
{
|
||||
gint64 position;
|
||||
|
||||
gst_query_parse_position(query, NULL, &position);
|
||||
|
@ -82,14 +87,16 @@ file_new_decoded_pad_cb (GstElement *decodebin,
|
|||
caps = gst_pad_get_caps(new_pad);
|
||||
str = gst_caps_to_string(caps);
|
||||
/* video stream */
|
||||
if (g_str_has_prefix (str, "video/")) {
|
||||
if (g_str_has_prefix(str, "video/"))
|
||||
{
|
||||
Emotion_Video_Sink *vsink;
|
||||
GstElement *queue;
|
||||
GstPad *videopad;
|
||||
|
||||
vsink = (Emotion_Video_Sink *)malloc(sizeof(Emotion_Video_Sink));
|
||||
if (!vsink) return;
|
||||
if (!ecore_list_append (ev->video_sinks, vsink)) {
|
||||
if (!ecore_list_append(ev->video_sinks, vsink))
|
||||
{
|
||||
free(vsink);
|
||||
return;
|
||||
}
|
||||
|
@ -101,20 +108,23 @@ file_new_decoded_pad_cb (GstElement *decodebin,
|
|||
videopad = gst_element_get_pad(queue, "sink");
|
||||
gst_pad_link(new_pad, 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;
|
||||
}
|
||||
gst_element_set_state(queue, GST_STATE_PAUSED);
|
||||
gst_element_set_state(vsink->sink, GST_STATE_PAUSED);
|
||||
}
|
||||
/* audio stream */
|
||||
else if (g_str_has_prefix (str, "audio/")) {
|
||||
else if (g_str_has_prefix(str, "audio/"))
|
||||
{
|
||||
Emotion_Audio_Sink *asink;
|
||||
GstPad *audiopad;
|
||||
|
||||
asink = (Emotion_Audio_Sink *)malloc(sizeof(Emotion_Audio_Sink));
|
||||
if (!asink) return;
|
||||
if (!ecore_list_append (ev->audio_sinks, asink)) {
|
||||
if (!ecore_list_append(ev->audio_sinks, asink))
|
||||
{
|
||||
free(asink);
|
||||
return;
|
||||
}
|
||||
|
@ -139,7 +149,8 @@ emotion_video_sink_new (Emotion_Gstreamer_Video *ev)
|
|||
vsink = (Emotion_Video_Sink *)malloc(sizeof(Emotion_Video_Sink));
|
||||
if (!vsink) return NULL;
|
||||
|
||||
if (!ecore_list_append (ev->video_sinks, vsink)) {
|
||||
if (!ecore_list_append(ev->video_sinks, vsink))
|
||||
{
|
||||
free(vsink);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -151,7 +162,8 @@ emotion_video_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Video_Sink *vsink)
|
|||
{
|
||||
if (!ev || !vsink) return;
|
||||
|
||||
if (ecore_list_goto (ev->video_sinks, vsink)) {
|
||||
if (ecore_list_goto(ev->video_sinks, vsink))
|
||||
{
|
||||
ecore_list_remove(ev->video_sinks);
|
||||
free(vsink);
|
||||
}
|
||||
|
@ -168,7 +180,8 @@ emotion_visualization_sink_create (Emotion_Gstreamer_Video *ev, Emotion_Audio_Si
|
|||
if (!vsink) return NULL;
|
||||
|
||||
vsink->sink = gst_bin_get_by_name(GST_BIN(asink->sink), "vissink1");
|
||||
if (!vsink->sink) {
|
||||
if (!vsink->sink)
|
||||
{
|
||||
emotion_video_sink_free(ev, vsink);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -203,7 +216,8 @@ emotion_pipeline_cdda_track_count_get(void *video)
|
|||
bus = gst_element_get_bus(ev->pipeline);
|
||||
if (!bus) return tracks_count;
|
||||
|
||||
while (!done) {
|
||||
while (!done)
|
||||
{
|
||||
GstMessage *message;
|
||||
|
||||
message = gst_bus_pop(bus);
|
||||
|
@ -211,8 +225,10 @@ emotion_pipeline_cdda_track_count_get(void *video)
|
|||
/* All messages read, we're done */
|
||||
break;
|
||||
|
||||
switch (GST_MESSAGE_TYPE (message)) {
|
||||
case GST_MESSAGE_TAG: {
|
||||
switch (GST_MESSAGE_TYPE(message))
|
||||
{
|
||||
case GST_MESSAGE_TAG:
|
||||
{
|
||||
GstTagList *tags;
|
||||
|
||||
gst_message_parse_tag(message, &tags);
|
||||
|
@ -289,7 +305,8 @@ emotion_audio_sink_create (Emotion_Gstreamer_Video *ev, int index)
|
|||
GstElement *vis = NULL;
|
||||
char *vis_name;
|
||||
|
||||
switch (ev->vis) {
|
||||
switch (ev->vis)
|
||||
{
|
||||
case EMOTION_VIS_GOOM:
|
||||
vis_name = "goom";
|
||||
break;
|
||||
|
@ -350,7 +367,8 @@ emotion_audio_sink_create (Emotion_Gstreamer_Video *ev, int index)
|
|||
}
|
||||
|
||||
g_snprintf(buf, 128, "vis%d", index);
|
||||
if ((vis = gst_element_factory_make (vis_name, buf))) {
|
||||
if ((vis = gst_element_factory_make(vis_name, buf)))
|
||||
{
|
||||
GstElement *queue;
|
||||
GstElement *conv;
|
||||
GstElement *cspace;
|
||||
|
@ -393,7 +411,8 @@ emotion_audio_sink_create (Emotion_Gstreamer_Video *ev, int index)
|
|||
gst_object_unref(teepad);
|
||||
gst_object_unref(binpad);
|
||||
|
||||
if (visbin) {
|
||||
if (visbin)
|
||||
{
|
||||
binpad = gst_element_get_pad(visbin, "sink");
|
||||
teepad = gst_element_get_request_pad(tee, "src%d");
|
||||
gst_pad_link(teepad, binpad);
|
||||
|
@ -418,7 +437,8 @@ emotion_streams_sinks_get (Emotion_Gstreamer_Video *ev, GstElement *decoder)
|
|||
ecore_list_first_goto(ev->audio_sinks);
|
||||
|
||||
it = gst_element_iterate_src_pads(decoder);
|
||||
while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
|
||||
while (gst_iterator_next(it, &data) == GST_ITERATOR_OK)
|
||||
{
|
||||
GstPad *pad;
|
||||
GstCaps *caps;
|
||||
gchar *str;
|
||||
|
@ -430,7 +450,8 @@ emotion_streams_sinks_get (Emotion_Gstreamer_Video *ev, GstElement *decoder)
|
|||
g_print("caps !! %s\n", str);
|
||||
|
||||
/* video stream */
|
||||
if (g_str_has_prefix (str, "video/")) {
|
||||
if (g_str_has_prefix(str, "video/"))
|
||||
{
|
||||
Emotion_Video_Sink *vsink;
|
||||
|
||||
vsink = (Emotion_Video_Sink *)ecore_list_next(ev->video_sinks);
|
||||
|
@ -438,7 +459,8 @@ emotion_streams_sinks_get (Emotion_Gstreamer_Video *ev, GstElement *decoder)
|
|||
emotion_video_sink_fill(vsink, pad, caps);
|
||||
}
|
||||
/* audio stream */
|
||||
else if (g_str_has_prefix (str, "audio/")) {
|
||||
else if (g_str_has_prefix(str, "audio/"))
|
||||
{
|
||||
Emotion_Audio_Sink *asink;
|
||||
gint index;
|
||||
|
||||
|
@ -448,21 +470,25 @@ emotion_streams_sinks_get (Emotion_Gstreamer_Video *ev, GstElement *decoder)
|
|||
|
||||
index = ecore_list_index(ev->audio_sinks);
|
||||
|
||||
if (ecore_list_count (ev->video_sinks) == 0) {
|
||||
if (index == 1) {
|
||||
if (ecore_list_count(ev->video_sinks) == 0)
|
||||
{
|
||||
if (index == 1)
|
||||
{
|
||||
Emotion_Video_Sink *vsink;
|
||||
|
||||
vsink = emotion_visualization_sink_create(ev, asink);
|
||||
if (!vsink) goto finalize;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
gchar buf[128];
|
||||
GstElement *visbin;
|
||||
|
||||
g_snprintf(buf, 128, "visbin%d", index);
|
||||
visbin = gst_bin_get_by_name(GST_BIN(ev->pipeline), buf);
|
||||
if (visbin) {
|
||||
if (visbin)
|
||||
{
|
||||
GstPad *srcpad;
|
||||
GstPad *sinkpad;
|
||||
|
||||
|
@ -500,11 +526,13 @@ emotion_video_sink_fill (Emotion_Video_Sink *vsink, GstPad *pad, GstCaps *caps)
|
|||
vsink->fps_num = 1;
|
||||
vsink->fps_den = 1;
|
||||
val = gst_structure_get_value(structure, "framerate");
|
||||
if (val) {
|
||||
if (val)
|
||||
{
|
||||
vsink->fps_num = gst_value_get_fraction_numerator(val);
|
||||
vsink->fps_den = gst_value_get_fraction_denominator(val);
|
||||
}
|
||||
if (g_str_has_prefix(str, "video/x-raw-yuv")) {
|
||||
if (g_str_has_prefix(str, "video/x-raw-yuv"))
|
||||
{
|
||||
val = gst_structure_get_value(structure, "format");
|
||||
vsink->fourcc = gst_value_get_fourcc(val);
|
||||
}
|
||||
|
@ -514,7 +542,8 @@ emotion_video_sink_fill (Emotion_Video_Sink *vsink, GstPad *pad, GstCaps *caps)
|
|||
vsink->fourcc = 0;
|
||||
|
||||
query = gst_query_new_duration(GST_FORMAT_TIME);
|
||||
if (gst_pad_query (pad, query)) {
|
||||
if (gst_pad_query(pad, query))
|
||||
{
|
||||
gint64 time;
|
||||
|
||||
gst_query_parse_duration(query, NULL, &time);
|
||||
|
@ -536,7 +565,8 @@ emotion_audio_sink_fill (Emotion_Audio_Sink *asink, GstPad *pad, GstCaps *caps)
|
|||
gst_structure_get_int(structure, "rate", &asink->samplerate);
|
||||
|
||||
query = gst_query_new_duration(GST_FORMAT_TIME);
|
||||
if (gst_pad_query (pad, query)) {
|
||||
if (gst_pad_query(pad, query))
|
||||
{
|
||||
gint64 time;
|
||||
|
||||
gst_query_parse_duration(query, NULL, &time);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
|
||||
static Emotion_Audio_Sink *_emotion_audio_sink_new (Emotion_Gstreamer_Video *ev);
|
||||
|
||||
static void _emotion_audio_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink);
|
||||
|
||||
int
|
||||
|
@ -23,7 +22,8 @@ emotion_pipeline_cdda_build (void *video, const char * device, unsigned int trac
|
|||
if (!ev) return 0;
|
||||
|
||||
cdiocddasrc = gst_element_factory_make("cdiocddasrc", "src");
|
||||
if (!cdiocddasrc) {
|
||||
if (!cdiocddasrc)
|
||||
{
|
||||
g_print("cdiocddasrc element missing. Install it.\n");
|
||||
goto failure_cdiocddasrc;
|
||||
}
|
||||
|
@ -70,7 +70,8 @@ emotion_pipeline_cdda_build (void *video, const char * device, unsigned int trac
|
|||
gst_caps_unref(caps);
|
||||
|
||||
query = gst_query_new_duration(GST_FORMAT_TIME);
|
||||
if (gst_pad_query (pad, query)) {
|
||||
if (gst_pad_query(pad, query))
|
||||
{
|
||||
gint64 time;
|
||||
|
||||
gst_query_parse_duration(query, NULL, &time);
|
||||
|
@ -106,7 +107,8 @@ _emotion_audio_sink_new (Emotion_Gstreamer_Video *ev)
|
|||
asink = (Emotion_Audio_Sink *)malloc(sizeof(Emotion_Audio_Sink));
|
||||
if (!asink) return NULL;
|
||||
|
||||
if (!ecore_list_append (ev->audio_sinks, asink)) {
|
||||
if (!ecore_list_append(ev->audio_sinks, asink))
|
||||
{
|
||||
free(asink);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -118,7 +120,8 @@ _emotion_audio_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink
|
|||
{
|
||||
if (!ev || !asink) return;
|
||||
|
||||
if (ecore_list_goto (ev->audio_sinks, asink)) {
|
||||
if (ecore_list_goto(ev->audio_sinks, asink))
|
||||
{
|
||||
ecore_list_remove(ev->audio_sinks);
|
||||
free(asink);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue