Emotion: use eina_semaphore API and update EFL versions

SVN revision: 66696
This commit is contained in:
Vincent Torri 2011-12-30 14:17:56 +00:00
parent acc4439060
commit 5924c8bacc
3 changed files with 8 additions and 36 deletions

View File

@ -7,7 +7,7 @@ AC_DEFUN([EMOTION_CHECK_DEP_XINE],
requirement=""
PKG_CHECK_MODULES([XINE],
[libxine >= 1.1.1 evas >= 0.9.9],
[libxine >= 1.1.1 evas >= 1.0.0],
[
have_dep="yes"
requirement="libxine"
@ -33,7 +33,7 @@ GST_MAJORMINOR=0.10
requirement=""
PKG_CHECK_MODULES([GSTREAMER],
[gstreamer-$GST_MAJORMINOR >= $GST_REQS gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPLUG_REQS gstreamer-video-$GST_MAJORMINOR >= $GSTPLUG_REQS evas >= 0.9.9],
[gstreamer-$GST_MAJORMINOR >= $GST_REQS gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPLUG_REQS gstreamer-video-$GST_MAJORMINOR >= $GSTPLUG_REQS evas >= 1.0.0 eina >= 1.1.99],
[
have_dep="yes"
requirement="gstreamer-$GST_MAJORMINOR gstreamer-plugins-base-$GST_MAJORMINOR"
@ -79,7 +79,7 @@ AC_DEFUN([EMOTION_CHECK_DEP_GENERIC],
requirement=""
PKG_CHECK_MODULES([GENERIC],
[evas >= 0.9.9],
[evas >= 1.0.0],
[
have_dep="yes"
],

View File

@ -93,12 +93,7 @@ struct _Emotion_Generic_Video_Shared
int last;
int next;
} frame;
/* FIXME: maybe abstracting that in Eina ? */
#ifdef _WIN32
HANDLE lock;
#else
sem_t lock;
#endif
Eina_Semaphore lock;
int frame_drop;
};

View File

@ -178,17 +178,11 @@ _create_shm_data(Emotion_Generic_Video *ev, const char *shmname)
vs->frame.last = 2;
vs->frame.next = 2;
vs->frame_drop = 0;
#ifdef _WIN32
/* FIXME: maximum count for the semaphore: 10. Is it sufficient ? */
vs->lock = CreateSemaphore(NULL, 1, 10, NULL);
if (!vs->lock)
if (!eina_semaphore_new(&vs->lock, 1))
{
ERR("can not create semaphore");
return EINA_FALSE;
}
#else
sem_init(&vs->lock, 1, 1);
#endif
ev->frame.frames[0] = (unsigned char *)vs + sizeof(*vs);
ev->frame.frames[1] = (unsigned char *)vs + sizeof(*vs) + vs->height * vs->width * vs->pitch;
ev->frame.frames[2] = (unsigned char *)vs + sizeof(*vs) + 2 * vs->height * vs->width * vs->pitch;
@ -483,12 +477,7 @@ static void
_player_file_closed(Emotion_Generic_Video *ev)
{
INF("Closed previous file.");
#ifdef _WIN32
CloseHandle(ev->shared->lock);
#else
sem_destroy(&ev->shared->lock);
#endif
eina_semaphore_free(&ev->shared->lock);
ev->closing = EINA_FALSE;
if (ev->opening)
@ -1257,21 +1246,13 @@ static int
em_bgra_data_get(void *data, unsigned char **bgra_data)
{
Emotion_Generic_Video *ev = data;
#ifdef _WIN32
DWORD res;
#endif
if (!ev || !ev->file_ready)
return 0;
// lock frame here
#ifdef _WIN32
res = WaitForSingleObject(ev->shared->lock, 0L);
if (res != WAIT_OBJECT_0)
if (!eina_semaphore_lock(&ev->shared->lock))
return 0;
#else
sem_wait(&ev->shared->lock);
#endif
// send current frame to emotion
if (ev->shared->frame.emotion != ev->shared->frame.last)
@ -1286,11 +1267,7 @@ em_bgra_data_get(void *data, unsigned char **bgra_data)
ev->shared->frame_drop = 0;
// unlock frame here
#ifdef _WIN32
ReleaseSemaphore(ev->shared->lock, 1, NULL);
#else
sem_post(&ev->shared->lock);
#endif
eina_semaphore_release(&ev->shared->lock, 1);
ev->drop = 0;
return 1;