forked from enlightenment/efl
parent
0d3907acf3
commit
ac83d5a90b
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
@ -8,13 +11,10 @@
|
||||||
|
|
||||||
|
|
||||||
/* Callbacks to get the eos */
|
/* Callbacks to get the eos */
|
||||||
static int _eos_timer_fct (void *data);
|
static int _eos_timer_fct (void *data);
|
||||||
|
static int _em_fd_ev_active (void *data, Ecore_Fd_Handler *fdh);
|
||||||
static int _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh);
|
static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data);
|
||||||
|
static void _free_metadata (Emotion_Gstreamer_Metadata *m);
|
||||||
static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data);
|
|
||||||
|
|
||||||
static void _free_metadata (Emotion_Gstreamer_Metadata *m);
|
|
||||||
|
|
||||||
/* Interface */
|
/* Interface */
|
||||||
|
|
||||||
|
@ -224,8 +224,7 @@ static Emotion_Video_Module em_module =
|
||||||
em_speed_get, /* speed_get */
|
em_speed_get, /* speed_get */
|
||||||
em_eject, /* eject */
|
em_eject, /* eject */
|
||||||
em_meta_get, /* meta_get */
|
em_meta_get, /* meta_get */
|
||||||
|
NULL /* handle */
|
||||||
NULL /* handle */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned char
|
static unsigned char
|
||||||
|
@ -238,7 +237,7 @@ em_init(Evas_Object *obj,
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
|
||||||
if (!emotion_video)
|
if (!emotion_video)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ev = calloc(1, sizeof(Emotion_Gstreamer_Video));
|
ev = calloc(1, sizeof(Emotion_Gstreamer_Video));
|
||||||
if (!ev) return 0;
|
if (!ev) return 0;
|
||||||
|
@ -247,15 +246,15 @@ em_init(Evas_Object *obj,
|
||||||
ev->obj_data = NULL;
|
ev->obj_data = NULL;
|
||||||
|
|
||||||
/* Initialization of gstreamer */
|
/* Initialization of gstreamer */
|
||||||
if (!gst_init_check (NULL, NULL, &error))
|
if (!gst_init_check(NULL, NULL, &error))
|
||||||
goto failure_gstreamer;
|
goto failure_gstreamer;
|
||||||
|
|
||||||
/* We allocate the sinks lists */
|
/* We allocate the sinks lists */
|
||||||
ev->video_sinks = ecore_list_new ();
|
ev->video_sinks = ecore_list_new();
|
||||||
if (!ev->video_sinks)
|
if (!ev->video_sinks)
|
||||||
goto failure_video_sinks;
|
goto failure_video_sinks;
|
||||||
ecore_list_free_cb_set(ev->video_sinks, ECORE_FREE_CB(free));
|
ecore_list_free_cb_set(ev->video_sinks, ECORE_FREE_CB(free));
|
||||||
ev->audio_sinks = ecore_list_new ();
|
ev->audio_sinks = ecore_list_new();
|
||||||
if (!ev->audio_sinks)
|
if (!ev->audio_sinks)
|
||||||
goto failure_audio_sinks;
|
goto failure_audio_sinks;
|
||||||
ecore_list_free_cb_set(ev->audio_sinks, ECORE_FREE_CB(free));
|
ecore_list_free_cb_set(ev->audio_sinks, ECORE_FREE_CB(free));
|
||||||
|
@ -269,29 +268,29 @@ em_init(Evas_Object *obj,
|
||||||
ev->vis = EMOTION_VIS_GOOM;
|
ev->vis = EMOTION_VIS_GOOM;
|
||||||
|
|
||||||
/* Create the file descriptors */
|
/* Create the file descriptors */
|
||||||
if (pipe(fds) == 0) {
|
if (pipe(fds) == 0)
|
||||||
ev->fd_ev_read = fds[0];
|
{
|
||||||
ev->fd_ev_write = fds[1];
|
ev->fd_ev_read = fds[0];
|
||||||
fcntl(ev->fd_ev_read, F_SETFL, O_NONBLOCK);
|
ev->fd_ev_write = fds[1];
|
||||||
ev->fd_ev_handler = ecore_main_fd_handler_add(ev->fd_ev_read,
|
fcntl(ev->fd_ev_read, F_SETFL, O_NONBLOCK);
|
||||||
ECORE_FD_READ,
|
ev->fd_ev_handler = ecore_main_fd_handler_add(ev->fd_ev_read,
|
||||||
_em_fd_ev_active,
|
ECORE_FD_READ,
|
||||||
ev,
|
_em_fd_ev_active,
|
||||||
NULL, NULL);
|
ev, NULL, NULL);
|
||||||
ecore_main_fd_handler_active_set(ev->fd_ev_handler, ECORE_FD_READ);
|
ecore_main_fd_handler_active_set(ev->fd_ev_handler, ECORE_FD_READ);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto failure_pipe;
|
goto failure_pipe;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
failure_pipe:
|
failure_pipe:
|
||||||
ecore_list_destroy (ev->audio_sinks);
|
ecore_list_destroy(ev->audio_sinks);
|
||||||
failure_audio_sinks:
|
failure_audio_sinks:
|
||||||
ecore_list_destroy (ev->video_sinks);
|
ecore_list_destroy(ev->video_sinks);
|
||||||
failure_video_sinks:
|
failure_video_sinks:
|
||||||
failure_gstreamer:
|
failure_gstreamer:
|
||||||
free (ev);
|
free(ev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -313,8 +312,8 @@ em_shutdown(void *video)
|
||||||
/* FIXME: and the evas object ? */
|
/* FIXME: and the evas object ? */
|
||||||
if (ev->obj_data) free(ev->obj_data);
|
if (ev->obj_data) free(ev->obj_data);
|
||||||
|
|
||||||
ecore_list_destroy (ev->video_sinks);
|
ecore_list_destroy(ev->video_sinks);
|
||||||
ecore_list_destroy (ev->audio_sinks);
|
ecore_list_destroy(ev->audio_sinks);
|
||||||
|
|
||||||
free(ev);
|
free(ev);
|
||||||
|
|
||||||
|
@ -331,106 +330,119 @@ em_file_open(const char *file,
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
ev->pipeline = gst_pipeline_new ("pipeline");
|
ev->pipeline = gst_pipeline_new("pipeline");
|
||||||
if (!ev->pipeline)
|
if (!ev->pipeline)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ev->eos_bus = gst_pipeline_get_bus (GST_PIPELINE (ev->pipeline));
|
ev->eos_bus = gst_pipeline_get_bus(GST_PIPELINE(ev->pipeline));
|
||||||
if (!ev->eos_bus)
|
if (!ev->eos_bus)
|
||||||
{
|
{
|
||||||
gst_object_unref(ev->pipeline);
|
gst_object_unref(ev->pipeline);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evas Object */
|
/* Evas Object */
|
||||||
ev->obj = obj;
|
ev->obj = obj;
|
||||||
|
|
||||||
/* CD Audio */
|
/* CD Audio */
|
||||||
if (strstr (file,"cdda://")) {
|
if (strstr(file, "cdda://"))
|
||||||
const char *device = NULL;
|
{
|
||||||
unsigned int track = 1;
|
const char *device = NULL;
|
||||||
|
unsigned int track = 1;
|
||||||
|
|
||||||
device = file + strlen ("cdda://");
|
device = file + strlen("cdda://");
|
||||||
if (device[0] == '/') {
|
if (device[0] == '/')
|
||||||
char *tmp;
|
{
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
if ((tmp = strchr (device, '?')) || (tmp = strchr (device, '#'))) {
|
if ((tmp = strchr(device, '?')) || (tmp = strchr(device, '#')))
|
||||||
sscanf (tmp + 1,"%d", &track);
|
{
|
||||||
tmp[0] = '\0';
|
sscanf(tmp + 1, "%d", &track);
|
||||||
}
|
tmp[0] = '\0';
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
device = NULL;
|
else
|
||||||
sscanf (file,"cdda://%d", &track);
|
{
|
||||||
}
|
device = NULL;
|
||||||
fprintf (stderr, "[Emotion] [gst] build CD Audio pipeline\n");
|
sscanf(file, "cdda://%d", &track);
|
||||||
if (!(emotion_pipeline_cdda_build (ev, device, track))) {
|
}
|
||||||
fprintf (stderr, "[Emotion] [gst] error while building CD Audio pipeline\n");
|
fprintf(stderr, "[Emotion] [gst] build CD Audio pipeline\n");
|
||||||
gst_object_unref(ev->pipeline);
|
if (!(emotion_pipeline_cdda_build(ev, device, track)))
|
||||||
return 0;
|
{
|
||||||
}
|
fprintf(stderr, "[Emotion] [gst] error while building CD Audio pipeline\n");
|
||||||
}
|
gst_object_unref(ev->pipeline);
|
||||||
/* Dvd */
|
return 0;
|
||||||
else if (strstr (file, "dvd://")) {
|
}
|
||||||
|
}
|
||||||
fprintf (stderr, "[Emotion] [gst] build DVD pipeline \n");
|
/* Dvd */
|
||||||
if (!(emotion_pipeline_dvd_build (ev, NULL))) {
|
else if (strstr(file, "dvd://"))
|
||||||
fprintf (stderr, "[Emotion] [gst] error while building DVD pipeline\n");
|
{
|
||||||
gst_object_unref(ev->pipeline);
|
|
||||||
return 0;
|
fprintf(stderr, "[Emotion] [gst] build DVD pipeline\n");
|
||||||
}
|
if (!(emotion_pipeline_dvd_build(ev, NULL)))
|
||||||
}
|
{
|
||||||
/* http */
|
fprintf(stderr, "[Emotion] [gst] error while building DVD pipeline\n");
|
||||||
else if (strstr (file, "http://")) {
|
gst_object_unref(ev->pipeline);
|
||||||
fprintf (stderr, "[Emotion] [gst] build URI pipeline \n");
|
return 0;
|
||||||
if (!(emotion_pipeline_uri_build (ev, file))) {
|
}
|
||||||
fprintf (stderr, "[Emotion] [gst] error while building URI pipeline\n");
|
}
|
||||||
gst_object_unref(ev->pipeline);
|
/* http */
|
||||||
return 0;
|
else if (strstr(file, "http://"))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "[Emotion] [gst] build URI pipeline\n");
|
||||||
|
if (!(emotion_pipeline_uri_build(ev, file)))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "[Emotion] [gst] error while building URI pipeline\n");
|
||||||
|
gst_object_unref(ev->pipeline);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* Normal media file */
|
/* Normal media file */
|
||||||
else {
|
else
|
||||||
const char *filename;
|
{
|
||||||
|
const char *filename;
|
||||||
|
|
||||||
filename = strstr (file, "file://")
|
filename = strstr(file, "file://")
|
||||||
? file + strlen ("file://")
|
? file + strlen("file://")
|
||||||
: file;
|
: file;
|
||||||
|
|
||||||
fprintf (stderr, "[Emotion] [gst] build file pipeline \n");
|
fprintf(stderr, "[Emotion] [gst] build file pipeline\n");
|
||||||
if (!(emotion_pipeline_file_build (ev, filename))) {
|
if (!(emotion_pipeline_file_build(ev, filename)))
|
||||||
fprintf (stderr, "[Emotion] [gst] error while building File pipeline\n");
|
{
|
||||||
gst_object_unref(ev->pipeline);
|
fprintf(stderr, "[Emotion] [gst] error while building File pipeline\n");
|
||||||
return 0;
|
gst_object_unref(ev->pipeline);
|
||||||
}
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ev->position = 0.0;
|
ev->position = 0.0;
|
||||||
|
|
||||||
{
|
{
|
||||||
/* on recapitule : */
|
/* on recapitule : */
|
||||||
Emotion_Video_Sink *vsink;
|
Emotion_Video_Sink *vsink;
|
||||||
Emotion_Audio_Sink *asink;
|
Emotion_Audio_Sink *asink;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_first_goto (ev->video_sinks);
|
vsink = (Emotion_Video_Sink *)ecore_list_first_goto(ev->video_sinks);
|
||||||
if (vsink) {
|
if (vsink)
|
||||||
fprintf (stderr, "video : \n");
|
{
|
||||||
fprintf (stderr, " size : %dx%d\n", vsink->width, vsink->height);
|
fprintf(stderr, "video : \n");
|
||||||
fprintf (stderr, " fps : %d/%d\n", vsink->fps_num, vsink->fps_den);
|
fprintf(stderr, " size : %dx%d\n", vsink->width, vsink->height);
|
||||||
fprintf (stderr, " fourcc : %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS (vsink->fourcc));
|
fprintf(stderr, " fps : %d/%d\n", vsink->fps_num, vsink->fps_den);
|
||||||
fprintf (stderr, " length : %" GST_TIME_FORMAT "\n\n",
|
fprintf(stderr, " fourcc : %" GST_FOURCC_FORMAT "\n", GST_FOURCC_ARGS(vsink->fourcc));
|
||||||
GST_TIME_ARGS ((guint64)(vsink->length_time * GST_SECOND)));
|
fprintf(stderr, " length : %" GST_TIME_FORMAT "\n\n",
|
||||||
}
|
GST_TIME_ARGS((guint64)(vsink->length_time * GST_SECOND)));
|
||||||
|
}
|
||||||
|
|
||||||
asink = (Emotion_Audio_Sink *)ecore_list_first_goto (ev->audio_sinks);
|
asink = (Emotion_Audio_Sink *)ecore_list_first_goto(ev->audio_sinks);
|
||||||
if (asink) {
|
if (asink)
|
||||||
fprintf (stderr, "audio : \n");
|
{
|
||||||
fprintf (stderr, " chan : %d\n", asink->channels);
|
fprintf(stderr, "audio : \n");
|
||||||
fprintf (stderr, " rate : %d\n", asink->samplerate);
|
fprintf(stderr, " chan : %d\n", asink->channels);
|
||||||
fprintf (stderr, " length : %" GST_TIME_FORMAT "\n\n",
|
fprintf(stderr, " rate : %d\n", asink->samplerate);
|
||||||
GST_TIME_ARGS ((guint64)(asink->length_time * GST_SECOND)));
|
fprintf(stderr, " length : %" GST_TIME_FORMAT "\n\n",
|
||||||
|
GST_TIME_ARGS((guint64)(asink->length_time * GST_SECOND)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ev->metadata)
|
if (ev->metadata)
|
||||||
_free_metadata(ev->metadata);
|
_free_metadata(ev->metadata);
|
||||||
|
@ -451,32 +463,33 @@ em_file_close(void *video)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* we clear the sink lists */
|
/* we clear the sink lists */
|
||||||
ecore_list_clear (ev->video_sinks);
|
ecore_list_clear(ev->video_sinks);
|
||||||
ecore_list_clear (ev->audio_sinks);
|
ecore_list_clear(ev->audio_sinks);
|
||||||
|
|
||||||
/* shutdown eos */
|
/* shutdown eos */
|
||||||
if (ev->eos_timer) {
|
if (ev->eos_timer)
|
||||||
ecore_timer_del (ev->eos_timer);
|
{
|
||||||
ev->eos_timer = NULL;
|
ecore_timer_del(ev->eos_timer);
|
||||||
}
|
ev->eos_timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (ev->eos_bus)
|
if (ev->eos_bus)
|
||||||
{
|
{
|
||||||
gst_object_unref (GST_OBJECT (ev->eos_bus));
|
gst_object_unref(GST_OBJECT(ev->eos_bus));
|
||||||
ev->eos_bus = NULL;
|
ev->eos_bus = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ev->metadata)
|
if (ev->metadata)
|
||||||
{
|
{
|
||||||
_free_metadata(ev->metadata);
|
_free_metadata(ev->metadata);
|
||||||
ev->metadata = NULL;
|
ev->metadata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev->pipeline)
|
if (ev->pipeline)
|
||||||
{
|
{
|
||||||
gst_element_set_state (ev->pipeline, GST_STATE_NULL);
|
gst_element_set_state(ev->pipeline, GST_STATE_NULL);
|
||||||
gst_object_unref(ev->pipeline);
|
gst_object_unref(ev->pipeline);
|
||||||
ev->pipeline = NULL;
|
ev->pipeline = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,11 +500,11 @@ em_play(void *video,
|
||||||
Emotion_Gstreamer_Video *ev;
|
Emotion_Gstreamer_Video *ev;
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
gst_element_set_state (ev->pipeline, GST_STATE_PLAYING);
|
gst_element_set_state(ev->pipeline, GST_STATE_PLAYING);
|
||||||
ev->play = 1;
|
ev->play = 1;
|
||||||
|
|
||||||
/* eos */
|
/* eos */
|
||||||
ev->eos_timer = ecore_timer_add (0.1, _eos_timer_fct, ev);
|
ev->eos_timer = ecore_timer_add(0.1, _eos_timer_fct, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -502,12 +515,13 @@ em_stop(void *video)
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
/* shutdown eos */
|
/* shutdown eos */
|
||||||
if (ev->eos_timer) {
|
if (ev->eos_timer)
|
||||||
ecore_timer_del (ev->eos_timer);
|
{
|
||||||
ev->eos_timer = NULL;
|
ecore_timer_del(ev->eos_timer);
|
||||||
}
|
ev->eos_timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gst_element_set_state (ev->pipeline, GST_STATE_PAUSED);
|
gst_element_set_state(ev->pipeline, GST_STATE_PAUSED);
|
||||||
ev->play = 0;
|
ev->play = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,15 +535,17 @@ em_size_get(void *video,
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink) {
|
if (vsink)
|
||||||
if (width) *width = vsink->width;
|
{
|
||||||
if (height) *height = vsink->height;
|
if (width) *width = vsink->width;
|
||||||
}
|
if (height) *height = vsink->height;
|
||||||
else {
|
}
|
||||||
if (width) *width = 0;
|
else
|
||||||
if (height) *height = 0;
|
{
|
||||||
}
|
if (width) *width = 0;
|
||||||
|
if (height) *height = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -544,27 +560,27 @@ em_pos_set(void *video,
|
||||||
|
|
||||||
if (ev->seek_to_pos == pos) return;
|
if (ev->seek_to_pos == pos) return;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
asink = (Emotion_Audio_Sink *)ecore_list_index_goto (ev->video_sinks, ev->audio_sink_nbr);
|
asink = (Emotion_Audio_Sink *)ecore_list_index_goto(ev->video_sinks, ev->audio_sink_nbr);
|
||||||
|
|
||||||
if (vsink) {
|
if (vsink)
|
||||||
gst_element_seek(vsink->sink, 1.0,
|
{
|
||||||
GST_FORMAT_TIME,
|
gst_element_seek(vsink->sink, 1.0,
|
||||||
GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
|
GST_FORMAT_TIME,
|
||||||
GST_SEEK_TYPE_SET,
|
GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
|
||||||
(gint64)(pos * (double)GST_SECOND),
|
GST_SEEK_TYPE_SET,
|
||||||
GST_SEEK_TYPE_NONE,
|
(gint64)(pos * (double)GST_SECOND),
|
||||||
-1);
|
GST_SEEK_TYPE_NONE, -1);
|
||||||
}
|
}
|
||||||
if (asink) {
|
if (asink)
|
||||||
gst_element_seek(asink->sink, 1.0,
|
{
|
||||||
GST_FORMAT_TIME,
|
gst_element_seek(asink->sink, 1.0,
|
||||||
GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
|
GST_FORMAT_TIME,
|
||||||
GST_SEEK_TYPE_SET,
|
GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH,
|
||||||
(gint64)(pos * (double)GST_SECOND),
|
GST_SEEK_TYPE_SET,
|
||||||
GST_SEEK_TYPE_NONE,
|
(gint64)(pos * (double)GST_SECOND),
|
||||||
-1);
|
GST_SEEK_TYPE_NONE, -1);
|
||||||
}
|
}
|
||||||
ev->seek_to_pos = pos;
|
ev->seek_to_pos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,9 +604,9 @@ em_len_get(void *video)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink)
|
if (vsink)
|
||||||
return (double)vsink->length_time;
|
return (double)vsink->length_time;
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
@ -603,9 +619,9 @@ em_fps_num_get(void *video)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink)
|
if (vsink)
|
||||||
return vsink->fps_num;
|
return vsink->fps_num;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -618,9 +634,9 @@ em_fps_den_get(void *video)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink)
|
if (vsink)
|
||||||
return vsink->fps_den;
|
return vsink->fps_den;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -633,9 +649,9 @@ em_fps_get(void *video)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink)
|
if (vsink)
|
||||||
return (double)vsink->fps_num / (double)vsink->fps_den;
|
return (double)vsink->fps_num / (double)vsink->fps_den;
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
@ -677,7 +693,7 @@ em_video_handled(void *video)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
if (ecore_list_empty_is (ev->video_sinks))
|
if (ecore_list_empty_is(ev->video_sinks))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -690,7 +706,7 @@ em_audio_handled(void *video)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
if (ecore_list_empty_is (ev->audio_sinks))
|
if (ecore_list_empty_is(ev->audio_sinks))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -715,28 +731,30 @@ em_frame_done(void *video)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Emotion_Format
|
static Emotion_Format
|
||||||
em_format_get (void *video)
|
em_format_get(void *video)
|
||||||
{
|
{
|
||||||
Emotion_Gstreamer_Video *ev;
|
Emotion_Gstreamer_Video *ev;
|
||||||
Emotion_Video_Sink *vsink;
|
Emotion_Video_Sink *vsink;
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink) {
|
if (vsink)
|
||||||
switch (vsink->fourcc) {
|
{
|
||||||
case GST_MAKE_FOURCC ('I','4','2','0'):
|
switch (vsink->fourcc)
|
||||||
return EMOTION_FORMAT_I420;
|
{
|
||||||
case GST_MAKE_FOURCC ('Y','V','1','2'):
|
case GST_MAKE_FOURCC('I', '4', '2', '0'):
|
||||||
return EMOTION_FORMAT_YV12;
|
return EMOTION_FORMAT_I420;
|
||||||
case GST_MAKE_FOURCC ('Y','U','Y','2'):
|
case GST_MAKE_FOURCC('Y', 'V', '1', '2'):
|
||||||
return EMOTION_FORMAT_YUY2;
|
return EMOTION_FORMAT_YV12;
|
||||||
case GST_MAKE_FOURCC ('A','R','G','B'):
|
case GST_MAKE_FOURCC('Y', 'U', 'Y', '2'):
|
||||||
return EMOTION_FORMAT_BGRA;
|
return EMOTION_FORMAT_YUY2;
|
||||||
default:
|
case GST_MAKE_FOURCC('A', 'R', 'G', 'B'):
|
||||||
return EMOTION_FORMAT_NONE;
|
return EMOTION_FORMAT_BGRA;
|
||||||
}
|
default:
|
||||||
}
|
return EMOTION_FORMAT_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
return EMOTION_FORMAT_NONE;
|
return EMOTION_FORMAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,15 +766,17 @@ em_video_data_size_get(void *video, int *w, int *h)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink) {
|
if (vsink)
|
||||||
*w = vsink->width;
|
{
|
||||||
*h = vsink->height;
|
*w = vsink->width;
|
||||||
}
|
*h = vsink->height;
|
||||||
else {
|
}
|
||||||
*w = 0;
|
else
|
||||||
*h = 0;
|
{
|
||||||
}
|
*w = 0;
|
||||||
|
*h = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -774,30 +794,32 @@ em_yuv_rows_get(void *video,
|
||||||
|
|
||||||
if (ev->obj_data)
|
if (ev->obj_data)
|
||||||
{
|
{
|
||||||
if (em_format_get(video) == EMOTION_FORMAT_I420) {
|
if (em_format_get(video) == EMOTION_FORMAT_I420)
|
||||||
for (i = 0; i < h; i++)
|
{
|
||||||
yrows[i] = &ev->obj_data[i * w];
|
for (i = 0; i < h; i++)
|
||||||
|
yrows[i] = &ev->obj_data[i * w];
|
||||||
|
|
||||||
for (i = 0; i < (h / 2); i++)
|
for (i = 0; i < (h / 2); i++)
|
||||||
urows[i] = &ev->obj_data[h * w + i * (w / 2) ];
|
urows[i] = &ev->obj_data[h * w + i * (w / 2)];
|
||||||
|
|
||||||
for (i = 0; i < (h / 2); i++)
|
for (i = 0; i < (h / 2); i++)
|
||||||
vrows[i] = &ev->obj_data[h * w + h * (w /4) + i * (w / 2)];
|
vrows[i] = &ev->obj_data[h * w + h * (w /4) + i * (w / 2)];
|
||||||
}
|
}
|
||||||
else if (em_format_get(video) == EMOTION_FORMAT_YV12) {
|
else if (em_format_get(video) == EMOTION_FORMAT_YV12)
|
||||||
for (i = 0; i < h; i++)
|
{
|
||||||
yrows[i] = &ev->obj_data[i * w];
|
for (i = 0; i < h; i++)
|
||||||
|
yrows[i] = &ev->obj_data[i * w];
|
||||||
|
|
||||||
for (i = 0; i < (h / 2); i++)
|
for (i = 0; i < (h / 2); i++)
|
||||||
vrows[i] = &ev->obj_data[h * w + i * (w / 2) ];
|
vrows[i] = &ev->obj_data[h * w + i * (w / 2)];
|
||||||
|
|
||||||
for (i = 0; i < (h / 2); i++)
|
for (i = 0; i < (h / 2); i++)
|
||||||
urows[i] = &ev->obj_data[h * w + h * (w /4) + i * (w / 2)];
|
urows[i] = &ev->obj_data[h * w + h * (w /4) + i * (w / 2)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -810,10 +832,11 @@ em_bgra_data_get(void *video, unsigned char **bgra_data)
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)video;
|
ev = (Emotion_Gstreamer_Video *)video;
|
||||||
|
|
||||||
if (ev->obj_data && em_format_get(video) == EMOTION_FORMAT_BGRA) {
|
if (ev->obj_data && em_format_get(video) == EMOTION_FORMAT_BGRA)
|
||||||
*bgra_data = ev->obj_data;
|
{
|
||||||
return 1;
|
*bgra_data = ev->obj_data;
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,15 +987,15 @@ em_audio_channel_mute_set(void *video,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ev->audio_mute = mute;
|
ev->audio_mute = mute;
|
||||||
volume = gst_bin_get_by_name (GST_BIN (ev->pipeline), "volume");
|
volume = gst_bin_get_by_name(GST_BIN(ev->pipeline), "volume");
|
||||||
if (!volume) return;
|
if (!volume) return;
|
||||||
|
|
||||||
if (mute)
|
if (mute)
|
||||||
g_object_set (G_OBJECT (volume), "volume", 0.0, NULL);
|
g_object_set(G_OBJECT(volume), "volume", 0.0, NULL);
|
||||||
else
|
else
|
||||||
g_object_set (G_OBJECT (volume), "volume", ev->volume * 10.0, NULL);
|
g_object_set(G_OBJECT(volume), "volume", ev->volume * 10.0, NULL);
|
||||||
|
|
||||||
gst_object_unref (volume);
|
gst_object_unref(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -999,11 +1022,11 @@ em_audio_channel_volume_set(void *video,
|
||||||
if (vol > 1.0)
|
if (vol > 1.0)
|
||||||
vol = 1.0;
|
vol = 1.0;
|
||||||
ev->volume = vol;
|
ev->volume = vol;
|
||||||
volume = gst_bin_get_by_name (GST_BIN (ev->pipeline), "volume");
|
volume = gst_bin_get_by_name(GST_BIN(ev->pipeline), "volume");
|
||||||
if (!volume) return;
|
if (!volume) return;
|
||||||
g_object_set (G_OBJECT (volume), "volume",
|
g_object_set(G_OBJECT(volume), "volume",
|
||||||
vol * 10.0, NULL);
|
vol * 10.0, NULL);
|
||||||
gst_object_unref (volume);
|
gst_object_unref(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
|
@ -1130,8 +1153,6 @@ em_speed_get(void *video)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
em_eject(void *video)
|
em_eject(void *video)
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Emotion_Gstreamer_Video *ev;
|
Emotion_Gstreamer_Video *ev;
|
||||||
|
|
||||||
|
@ -1186,10 +1207,10 @@ module_open(Evas_Object *obj,
|
||||||
Emotion_Module_Options *opt)
|
Emotion_Module_Options *opt)
|
||||||
{
|
{
|
||||||
if (!module)
|
if (!module)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!em_module.init(obj, video, opt))
|
if (!em_module.init(obj, video, opt))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*module = &em_module;
|
*module = &em_module;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1203,7 +1224,7 @@ module_close(Emotion_Video_Module *module,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_for_each_tag (GstTagList const* list,
|
_for_each_tag(GstTagList const* list,
|
||||||
gchar const* tag,
|
gchar const* tag,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
@ -1217,83 +1238,83 @@ _for_each_tag (GstTagList const* list,
|
||||||
|
|
||||||
if (!ev || !ev->metadata) return;
|
if (!ev || !ev->metadata) return;
|
||||||
|
|
||||||
count = gst_tag_list_get_tag_size (list, tag);
|
count = gst_tag_list_get_tag_size(list, tag);
|
||||||
val = gst_tag_list_get_value_index (list, tag, 0);
|
val = gst_tag_list_get_value_index(list, tag, 0);
|
||||||
|
|
||||||
for ( i = 0; i < count; ++i)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (tag, GST_TAG_TITLE))
|
if (!strcmp(tag, GST_TAG_TITLE))
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
if (ev->metadata->title) g_free(ev->metadata->title);
|
if (ev->metadata->title) g_free(ev->metadata->title);
|
||||||
if (gst_tag_list_get_string (list, GST_TAG_TITLE, &str))
|
if (gst_tag_list_get_string(list, GST_TAG_TITLE, &str))
|
||||||
ev->metadata->title = str;
|
ev->metadata->title = str;
|
||||||
else
|
else
|
||||||
ev->metadata->title = NULL;
|
ev->metadata->title = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!strcmp (tag, GST_TAG_ALBUM))
|
if (!strcmp(tag, GST_TAG_ALBUM))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
if (ev->metadata->album) g_free(ev->metadata->album);
|
if (ev->metadata->album) g_free(ev->metadata->album);
|
||||||
if (gst_tag_list_get_string (list, GST_TAG_ALBUM, &str))
|
if (gst_tag_list_get_string(list, GST_TAG_ALBUM, &str))
|
||||||
ev->metadata->album = str;
|
ev->metadata->album = str;
|
||||||
else
|
else
|
||||||
ev->metadata->album = NULL;
|
ev->metadata->album = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!strcmp (tag, GST_TAG_ARTIST))
|
if (!strcmp(tag, GST_TAG_ARTIST))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
if (ev->metadata->artist) g_free( ev->metadata->artist);
|
if (ev->metadata->artist) g_free( ev->metadata->artist);
|
||||||
if (gst_tag_list_get_string (list, GST_TAG_ARTIST, &str))
|
if (gst_tag_list_get_string(list, GST_TAG_ARTIST, &str))
|
||||||
ev->metadata->artist = str;
|
ev->metadata->artist = str;
|
||||||
else
|
else
|
||||||
ev->metadata->artist = NULL;
|
ev->metadata->artist = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!strcmp (tag, GST_TAG_GENRE))
|
if (!strcmp(tag, GST_TAG_GENRE))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
if (ev->metadata->genre) g_free( ev->metadata->genre);
|
if (ev->metadata->genre) g_free( ev->metadata->genre);
|
||||||
if (gst_tag_list_get_string (list, GST_TAG_GENRE, &str))
|
if (gst_tag_list_get_string(list, GST_TAG_GENRE, &str))
|
||||||
ev->metadata->genre = str;
|
ev->metadata->genre = str;
|
||||||
else
|
else
|
||||||
ev->metadata->genre = NULL;
|
ev->metadata->genre = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!strcmp (tag, GST_TAG_COMMENT))
|
if (!strcmp(tag, GST_TAG_COMMENT))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
if (ev->metadata->comment) g_free(ev->metadata->comment);
|
if (ev->metadata->comment) g_free(ev->metadata->comment);
|
||||||
if (gst_tag_list_get_string (list, GST_TAG_COMMENT, &str))
|
if (gst_tag_list_get_string(list, GST_TAG_COMMENT, &str))
|
||||||
ev->metadata->comment = str;
|
ev->metadata->comment = str;
|
||||||
else
|
else
|
||||||
ev->metadata->comment = NULL;
|
ev->metadata->comment = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!strcmp (tag, GST_TAG_DATE))
|
if (!strcmp(tag, GST_TAG_DATE))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
const GValue *date;
|
const GValue *date;
|
||||||
if (ev->metadata->year) g_free(ev->metadata->year);
|
if (ev->metadata->year) g_free(ev->metadata->year);
|
||||||
date = gst_tag_list_get_value_index (list, GST_TAG_DATE, 0);
|
date = gst_tag_list_get_value_index(list, GST_TAG_DATE, 0);
|
||||||
if (date)
|
if (date)
|
||||||
str = g_strdup_value_contents (date);
|
str = g_strdup_value_contents(date);
|
||||||
else
|
else
|
||||||
str = NULL;
|
str = NULL;
|
||||||
ev->metadata->year = str;
|
ev->metadata->year = str;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp (tag, GST_TAG_TRACK_NUMBER))
|
if (!strcmp(tag, GST_TAG_TRACK_NUMBER))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
const GValue *track;
|
const GValue *track;
|
||||||
if (ev->metadata->count) g_free( ev->metadata->count);
|
if (ev->metadata->count) g_free( ev->metadata->count);
|
||||||
track = gst_tag_list_get_value_index (list, GST_TAG_TRACK_NUMBER, 0);
|
track = gst_tag_list_get_value_index(list, GST_TAG_TRACK_NUMBER, 0);
|
||||||
if (track)
|
if (track)
|
||||||
str = g_strdup_value_contents (track);
|
str = g_strdup_value_contents(track);
|
||||||
else
|
else
|
||||||
str = NULL;
|
str = NULL;
|
||||||
ev->metadata->count = str;
|
ev->metadata->count = str;
|
||||||
|
@ -1301,14 +1322,14 @@ _for_each_tag (GstTagList const* list,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GST_TAG_CDDA_CDDB_DISCID
|
#ifdef GST_TAG_CDDA_CDDB_DISCID
|
||||||
if (!strcmp (tag, GST_TAG_CDDA_CDDB_DISCID))
|
if (!strcmp(tag, GST_TAG_CDDA_CDDB_DISCID))
|
||||||
{
|
{
|
||||||
gchar *str;
|
gchar *str;
|
||||||
const GValue *discid;
|
const GValue *discid;
|
||||||
if (ev->metadata->disc_id) g_free(ev->metadata->disc_id);
|
if (ev->metadata->disc_id) g_free(ev->metadata->disc_id);
|
||||||
discid = gst_tag_list_get_value_index (list, GST_TAG_CDDA_CDDB_DISCID, 0);
|
discid = gst_tag_list_get_value_index(list, GST_TAG_CDDA_CDDB_DISCID, 0);
|
||||||
if (discid)
|
if (discid)
|
||||||
str = g_strdup_value_contents (discid);
|
str = g_strdup_value_contents(discid);
|
||||||
else
|
else
|
||||||
str = NULL;
|
str = NULL;
|
||||||
ev->metadata->disc_id = str;
|
ev->metadata->disc_id = str;
|
||||||
|
@ -1320,7 +1341,7 @@ _for_each_tag (GstTagList const* list,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_free_metadata (Emotion_Gstreamer_Metadata *m)
|
_free_metadata(Emotion_Gstreamer_Metadata *m)
|
||||||
{
|
{
|
||||||
if (!m) return;
|
if (!m) return;
|
||||||
|
|
||||||
|
@ -1334,7 +1355,6 @@ _free_metadata (Emotion_Gstreamer_Metadata *m)
|
||||||
if (m->disc_id) g_free(m->disc_id);
|
if (m->disc_id) g_free(m->disc_id);
|
||||||
|
|
||||||
free(m);
|
free(m);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1352,65 +1372,69 @@ _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
|
||||||
|
|
||||||
while ((len = read(fd, buf, sizeof(buf))) > 0)
|
while ((len = read(fd, buf, sizeof(buf))) > 0)
|
||||||
{
|
{
|
||||||
if (len == sizeof(buf))
|
if (len == sizeof(buf))
|
||||||
{
|
{
|
||||||
Emotion_Video_Sink *vsink;
|
Emotion_Video_Sink *vsink;
|
||||||
|
|
||||||
frame_data = buf[0];
|
frame_data = buf[0];
|
||||||
buffer = buf[1];
|
buffer = buf[1];
|
||||||
_emotion_frame_new(ev->obj);
|
_emotion_frame_new(ev->obj);
|
||||||
vsink = (Emotion_Video_Sink *)ecore_list_index_goto (ev->video_sinks, ev->video_sink_nbr);
|
vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
|
||||||
if (vsink) _emotion_video_pos_update(ev->obj, ev->position, vsink->length_time);
|
if (vsink) _emotion_video_pos_update(ev->obj, ev->position, vsink->length_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _eos_timer_fct (void *data)
|
static int
|
||||||
|
_eos_timer_fct(void *data)
|
||||||
{
|
{
|
||||||
Emotion_Gstreamer_Video *ev;
|
Emotion_Gstreamer_Video *ev;
|
||||||
GstMessage *msg;
|
GstMessage *msg;
|
||||||
|
|
||||||
ev = (Emotion_Gstreamer_Video *)data;
|
ev = (Emotion_Gstreamer_Video *)data;
|
||||||
while ((msg = gst_bus_poll (ev->eos_bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS | GST_MESSAGE_TAG, 0))) {
|
while ((msg = gst_bus_poll(ev->eos_bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS | GST_MESSAGE_TAG, 0)))
|
||||||
switch (GST_MESSAGE_TYPE(msg)) {
|
{
|
||||||
case GST_MESSAGE_ERROR: {
|
switch (GST_MESSAGE_TYPE(msg))
|
||||||
gchar *debug;
|
{
|
||||||
GError *err;
|
case GST_MESSAGE_ERROR:
|
||||||
|
{
|
||||||
|
gchar *debug;
|
||||||
|
GError *err;
|
||||||
|
|
||||||
gst_message_parse_error (msg, &err, &debug);
|
gst_message_parse_error(msg, &err, &debug);
|
||||||
g_free (debug);
|
g_free(debug);
|
||||||
|
|
||||||
g_print ("Error: %s\n", err->message);
|
g_print("Error: %s\n", err->message);
|
||||||
g_error_free (err);
|
g_error_free(err);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case GST_MESSAGE_EOS:
|
||||||
|
if (ev->eos_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(ev->eos_timer);
|
||||||
|
ev->eos_timer = NULL;
|
||||||
|
}
|
||||||
|
ev->play = 0;
|
||||||
|
_emotion_decode_stop(ev->obj);
|
||||||
|
_emotion_playback_finished(ev->obj);
|
||||||
|
break;
|
||||||
|
case GST_MESSAGE_TAG:
|
||||||
|
{
|
||||||
|
GstTagList *new_tags;
|
||||||
|
gst_message_parse_tag(msg, &new_tags);
|
||||||
|
if (new_tags)
|
||||||
|
{
|
||||||
|
gst_tag_list_foreach(new_tags, (GstTagForeachFunc)_for_each_tag, ev);
|
||||||
|
gst_tag_list_free(new_tags);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gst_message_unref(msg);
|
||||||
}
|
}
|
||||||
case GST_MESSAGE_EOS:
|
|
||||||
if (ev->eos_timer)
|
|
||||||
{
|
|
||||||
ecore_timer_del(ev->eos_timer);
|
|
||||||
ev->eos_timer = NULL;
|
|
||||||
}
|
|
||||||
ev->play = 0;
|
|
||||||
_emotion_decode_stop(ev->obj);
|
|
||||||
_emotion_playback_finished(ev->obj);
|
|
||||||
break;
|
|
||||||
case GST_MESSAGE_TAG:
|
|
||||||
{
|
|
||||||
GstTagList *new_tags;
|
|
||||||
gst_message_parse_tag (msg, &new_tags);
|
|
||||||
if (new_tags)
|
|
||||||
{
|
|
||||||
gst_tag_list_foreach (new_tags, (GstTagForeachFunc)_for_each_tag, ev);
|
|
||||||
gst_tag_list_free (new_tags);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
gst_message_unref (msg);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
#ifndef __EMOTION_GSTREAMER_H__
|
#ifndef __EMOTION_GSTREAMER_H__
|
||||||
#define __EMOTION_GSTREAMER_H__
|
#define __EMOTION_GSTREAMER_H__
|
||||||
|
|
||||||
|
@ -17,23 +20,23 @@ typedef struct _Emotion_Video_Sink Emotion_Video_Sink;
|
||||||
|
|
||||||
struct _Emotion_Video_Sink
|
struct _Emotion_Video_Sink
|
||||||
{
|
{
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
gdouble length_time;
|
gdouble length_time;
|
||||||
gint width;
|
gint width;
|
||||||
gint height;
|
gint height;
|
||||||
gint fps_num;
|
gint fps_num;
|
||||||
gint fps_den;
|
gint fps_den;
|
||||||
guint32 fourcc;
|
guint32 fourcc;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _Emotion_Audio_Sink Emotion_Audio_Sink;
|
typedef struct _Emotion_Audio_Sink Emotion_Audio_Sink;
|
||||||
|
|
||||||
struct _Emotion_Audio_Sink
|
struct _Emotion_Audio_Sink
|
||||||
{
|
{
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
gdouble length_time;
|
gdouble length_time;
|
||||||
gint channels;
|
gint channels;
|
||||||
gint samplerate;
|
gint samplerate;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _Emotion_Gstreamer_Metadata Emotion_Gstreamer_Metadata;
|
typedef struct _Emotion_Gstreamer_Metadata Emotion_Gstreamer_Metadata;
|
||||||
|
@ -55,52 +58,52 @@ typedef struct _Emotion_Gstreamer_Video Emotion_Gstreamer_Video;
|
||||||
|
|
||||||
struct _Emotion_Gstreamer_Video
|
struct _Emotion_Gstreamer_Video
|
||||||
{
|
{
|
||||||
/* Gstreamer elements */
|
/* Gstreamer elements */
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
|
|
||||||
/* eos */
|
/* eos */
|
||||||
GstBus *eos_bus;
|
GstBus *eos_bus;
|
||||||
Ecore_Timer *eos_timer;
|
Ecore_Timer *eos_timer;
|
||||||
|
|
||||||
/* Sinks */
|
/* Sinks */
|
||||||
Ecore_List *video_sinks;
|
Ecore_List *video_sinks;
|
||||||
Ecore_List *audio_sinks;
|
Ecore_List *audio_sinks;
|
||||||
|
|
||||||
int video_sink_nbr;
|
int video_sink_nbr;
|
||||||
int audio_sink_nbr;
|
int audio_sink_nbr;
|
||||||
|
|
||||||
/* Evas object */
|
/* Evas object */
|
||||||
Evas_Object *obj;
|
Evas_Object *obj;
|
||||||
unsigned char *obj_data;
|
unsigned char *obj_data;
|
||||||
|
|
||||||
/* Characteristics of stream */
|
/* Characteristics of stream */
|
||||||
double position;
|
double position;
|
||||||
double ratio;
|
double ratio;
|
||||||
double volume;
|
double volume;
|
||||||
|
|
||||||
volatile int seek_to;
|
volatile int seek_to;
|
||||||
volatile int get_poslen;
|
volatile int get_poslen;
|
||||||
volatile double seek_to_pos;
|
volatile double seek_to_pos;
|
||||||
|
|
||||||
int fd_ev_read;
|
int fd_ev_read;
|
||||||
int fd_ev_write;
|
int fd_ev_write;
|
||||||
Ecore_Fd_Handler *fd_ev_handler;
|
Ecore_Fd_Handler *fd_ev_handler;
|
||||||
|
|
||||||
Emotion_Gstreamer_Metadata *metadata;
|
Emotion_Gstreamer_Metadata *metadata;
|
||||||
|
|
||||||
Emotion_Vis vis;
|
Emotion_Vis vis;
|
||||||
|
|
||||||
unsigned char play : 1;
|
unsigned char play : 1;
|
||||||
unsigned char video_mute : 1;
|
unsigned char video_mute : 1;
|
||||||
unsigned char audio_mute : 1;
|
unsigned char audio_mute : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned char module_open(Evas_Object *obj,
|
unsigned char module_open(Evas_Object *obj,
|
||||||
Emotion_Video_Module **module,
|
Emotion_Video_Module **module,
|
||||||
void **video, Emotion_Module_Options *opt);
|
void **video, Emotion_Module_Options *opt);
|
||||||
|
|
||||||
void module_close (Emotion_Video_Module *module,
|
void module_close(Emotion_Video_Module *module,
|
||||||
void *video);
|
void *video);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __EMOTION_GSTREAMER_H__ */
|
#endif /* __EMOTION_GSTREAMER_H__ */
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
#ifndef __EMOTION_GSTREAMER_PIPELINE_H__
|
#ifndef __EMOTION_GSTREAMER_PIPELINE_H__
|
||||||
#define __EMOTION_GSTREAMER_PIPELINE_H__
|
#define __EMOTION_GSTREAMER_PIPELINE_H__
|
||||||
|
|
||||||
|
@ -5,29 +8,29 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
|
||||||
gboolean emotion_pipeline_pause (GstElement *pipeline);
|
gboolean emotion_pipeline_pause (GstElement *pipeline);
|
||||||
|
|
||||||
int emotion_pipeline_cdda_build (void *video, const char * device, unsigned int track);
|
int emotion_pipeline_cdda_build (void *video, const char * device, unsigned int track);
|
||||||
int emotion_pipeline_file_build (void *video, const char *file);
|
int emotion_pipeline_file_build (void *video, const char *file);
|
||||||
int emotion_pipeline_uri_build (void *video, const char *uri);
|
int emotion_pipeline_uri_build (void *video, const char *uri);
|
||||||
int emotion_pipeline_dvd_build (void *video, const char *device);
|
int emotion_pipeline_dvd_build (void *video, const char *device);
|
||||||
int emotion_pipeline_cdda_track_count_get(void *video);
|
int emotion_pipeline_cdda_track_count_get (void *video);
|
||||||
|
|
||||||
GstElement *emotion_audio_sink_create (Emotion_Gstreamer_Video *ev, int index);
|
GstElement *emotion_audio_sink_create (Emotion_Gstreamer_Video *ev, int index);
|
||||||
Emotion_Video_Sink *emotion_video_sink_new (Emotion_Gstreamer_Video *ev);
|
Emotion_Video_Sink *emotion_video_sink_new (Emotion_Gstreamer_Video *ev);
|
||||||
void emotion_video_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Video_Sink *vsink);
|
void emotion_video_sink_free (Emotion_Gstreamer_Video *ev, Emotion_Video_Sink *vsink);
|
||||||
Emotion_Video_Sink *emotion_visualization_sink_create (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink);
|
Emotion_Video_Sink *emotion_visualization_sink_create (Emotion_Gstreamer_Video *ev, Emotion_Audio_Sink *asink);
|
||||||
|
|
||||||
void emotion_streams_sinks_get (Emotion_Gstreamer_Video *ev, GstElement *decoder);
|
void emotion_streams_sinks_get (Emotion_Gstreamer_Video *ev, GstElement *decoder);
|
||||||
|
|
||||||
void emotion_video_sink_fill (Emotion_Video_Sink *vsink, GstPad *pad, GstCaps *caps);
|
void emotion_video_sink_fill (Emotion_Video_Sink *vsink, GstPad *pad, GstCaps *caps);
|
||||||
|
|
||||||
void emotion_audio_sink_fill (Emotion_Audio_Sink *asink, GstPad *pad, GstCaps *caps);
|
void emotion_audio_sink_fill (Emotion_Audio_Sink *asink, GstPad *pad, GstCaps *caps);
|
||||||
|
|
||||||
void cb_handoff (GstElement *fakesrc,
|
void cb_handoff (GstElement *fakesrc,
|
||||||
GstBuffer *buffer,
|
GstBuffer *buffer,
|
||||||
GstPad *pad,
|
GstPad *pad,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
void file_new_decoded_pad_cb (GstElement *decodebin,
|
void file_new_decoded_pad_cb (GstElement *decodebin,
|
||||||
GstPad *new_pad,
|
GstPad *new_pad,
|
||||||
|
|
Loading…
Reference in New Issue