summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/modules/gstreamer
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2008-12-20 16:31:55 +0000
committerVincent Torri <vincent.torri@gmail.com>2008-12-20 16:31:55 +0000
commitd945c93a081864a29736b6e93002a62b0be1d84c (patch)
tree87cdb4f50aaf86cea49c9a5c50d8d839684e84d8 /legacy/emotion/src/modules/gstreamer
parent02ced33a33642438153eb3a26a6380918261ea83 (diff)
use ecore_pipe in gstreamer module
SVN revision: 38251
Diffstat (limited to 'legacy/emotion/src/modules/gstreamer')
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c54
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h4
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c2
3 files changed, 15 insertions, 45 deletions
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
index 21722e5eec..d528deaf92 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
@@ -12,7 +12,7 @@
12 12
13/* Callbacks to get the eos */ 13/* Callbacks to get the eos */
14static int _eos_timer_fct (void *data); 14static int _eos_timer_fct (void *data);
15static int _em_fd_ev_active (void *data, Ecore_Fd_Handler *fdh); 15static void _em_buffer_read(void *data, void *buffer, unsigned int nbyte);
16static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data); 16static void _for_each_tag (GstTagList const* list, gchar const* tag, void *data);
17static void _free_metadata (Emotion_Gstreamer_Metadata *m); 17static void _free_metadata (Emotion_Gstreamer_Metadata *m);
18 18
@@ -274,18 +274,8 @@ em_init(Evas_Object *obj,
274 ev->volume = 0.8; 274 ev->volume = 0.8;
275 275
276 /* Create the file descriptors */ 276 /* Create the file descriptors */
277 if (pipe(fds) == 0) 277 ev->pipe = ecore_pipe_add (_em_buffer_read, ev);
278 { 278 if (!ev->pipe)
279 ev->fd_ev_read = fds[0];
280 ev->fd_ev_write = fds[1];
281 fcntl(ev->fd_ev_read, F_SETFL, O_NONBLOCK);
282 ev->fd_ev_handler = ecore_main_fd_handler_add(ev->fd_ev_read,
283 ECORE_FD_READ,
284 _em_fd_ev_active,
285 ev, NULL, NULL);
286 ecore_main_fd_handler_active_set(ev->fd_ev_handler, ECORE_FD_READ);
287 }
288 else
289 goto failure_pipe; 279 goto failure_pipe;
290 280
291 return 1; 281 return 1;
@@ -310,10 +300,7 @@ em_shutdown(void *video)
310 if (!ev) 300 if (!ev)
311 return 0; 301 return 0;
312 302
313 ecore_main_fd_handler_del(ev->fd_ev_handler); 303 ecore_pipe_del(ev->pipe);
314
315 close(ev->fd_ev_write);
316 close(ev->fd_ev_read);
317 304
318 /* FIXME: and the evas object ? */ 305 /* FIXME: and the evas object ? */
319 if (ev->obj_data) free(ev->obj_data); 306 if (ev->obj_data) free(ev->obj_data);
@@ -1426,33 +1413,18 @@ _free_metadata(Emotion_Gstreamer_Metadata *m)
1426 free(m); 1413 free(m);
1427} 1414}
1428 1415
1429static int 1416static void
1430_em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh) 1417_em_buffer_read(void *data, void *buf, unsigned int nbyte)
1431{ 1418{
1432 int fd;
1433 int len;
1434 void *buf[2];
1435 unsigned char *frame_data;
1436 Emotion_Gstreamer_Video *ev; 1419 Emotion_Gstreamer_Video *ev;
1437 GstBuffer *buffer; 1420 Emotion_Video_Sink *vsink;
1438 1421 GstBuffer *buffer;
1439 ev = data;
1440 fd = ecore_main_fd_handler_fd_get(fdh);
1441
1442 while ((len = read(fd, buf, sizeof(buf))) > 0)
1443 {
1444 if (len == sizeof(buf))
1445 {
1446 Emotion_Video_Sink *vsink;
1447 1422
1448 frame_data = buf[0]; 1423 ev = (Emotion_Gstreamer_Video *)data;
1449 buffer = buf[1]; 1424 buffer = *((GstBuffer **)buf);
1450 _emotion_frame_new(ev->obj); 1425 _emotion_frame_new(ev->obj);
1451 vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr); 1426 vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr);
1452 if (vsink) _emotion_video_pos_update(ev->obj, ev->position, vsink->length_time); 1427 if (vsink) _emotion_video_pos_update(ev->obj, ev->position, vsink->length_time);
1453 }
1454 }
1455 return 1;
1456} 1428}
1457 1429
1458static int 1430static int
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
index eb2fa82c5f..39845a2de4 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
@@ -84,9 +84,7 @@ struct _Emotion_Gstreamer_Video
84 volatile int seek_to; 84 volatile int seek_to;
85 volatile int get_poslen; 85 volatile int get_poslen;
86 86
87 int fd_ev_read; 87 Ecore_Pipe *pipe;
88 int fd_ev_write;
89 Ecore_Fd_Handler *fd_ev_handler;
90 88
91 Emotion_Gstreamer_Metadata *metadata; 89 Emotion_Gstreamer_Metadata *metadata;
92 90
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
index 8719615519..cf1e28b796 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer_pipeline.c
@@ -53,7 +53,7 @@ cb_handoff(GstElement *fakesrc,
53 memcpy(ev->obj_data, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer)); 53 memcpy(ev->obj_data, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer));
54 buf[0] = GST_BUFFER_DATA(buffer); 54 buf[0] = GST_BUFFER_DATA(buffer);
55 buf[1] = buffer; 55 buf[1] = buffer;
56 write(ev->fd_ev_write, buf, sizeof(buf)); 56 ecore_pipe_write(ev->pipe, buf, sizeof(buf));
57 } 57 }
58 else 58 else
59 { 59 {