summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/modules/generic/emotion_generic.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2011-12-30 14:17:56 +0000
committerVincent Torri <vincent.torri@gmail.com>2011-12-30 14:17:56 +0000
commit5924c8bacc90eb3413205b5a7159f0dfe3c63532 (patch)
treecb1e0372bbd872897e24ec80e8fbd10c2d72930e /legacy/emotion/src/modules/generic/emotion_generic.c
parentacc4439060acbbcd155e9095dacdf0e3cced3665 (diff)
Emotion: use eina_semaphore API and update EFL versions
SVN revision: 66696
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/modules/generic/emotion_generic.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/legacy/emotion/src/modules/generic/emotion_generic.c b/legacy/emotion/src/modules/generic/emotion_generic.c
index ef7a4c21f8..bf440f4650 100644
--- a/legacy/emotion/src/modules/generic/emotion_generic.c
+++ b/legacy/emotion/src/modules/generic/emotion_generic.c
@@ -178,17 +178,11 @@ _create_shm_data(Emotion_Generic_Video *ev, const char *shmname)
178 vs->frame.last = 2; 178 vs->frame.last = 2;
179 vs->frame.next = 2; 179 vs->frame.next = 2;
180 vs->frame_drop = 0; 180 vs->frame_drop = 0;
181#ifdef _WIN32 181 if (!eina_semaphore_new(&vs->lock, 1))
182 /* FIXME: maximum count for the semaphore: 10. Is it sufficient ? */
183 vs->lock = CreateSemaphore(NULL, 1, 10, NULL);
184 if (!vs->lock)
185 { 182 {
186 ERR("can not create semaphore"); 183 ERR("can not create semaphore");
187 return EINA_FALSE; 184 return EINA_FALSE;
188 } 185 }
189#else
190 sem_init(&vs->lock, 1, 1);
191#endif
192 ev->frame.frames[0] = (unsigned char *)vs + sizeof(*vs); 186 ev->frame.frames[0] = (unsigned char *)vs + sizeof(*vs);
193 ev->frame.frames[1] = (unsigned char *)vs + sizeof(*vs) + vs->height * vs->width * vs->pitch; 187 ev->frame.frames[1] = (unsigned char *)vs + sizeof(*vs) + vs->height * vs->width * vs->pitch;
194 ev->frame.frames[2] = (unsigned char *)vs + sizeof(*vs) + 2 * vs->height * vs->width * vs->pitch; 188 ev->frame.frames[2] = (unsigned char *)vs + sizeof(*vs) + 2 * vs->height * vs->width * vs->pitch;
@@ -483,12 +477,7 @@ static void
483_player_file_closed(Emotion_Generic_Video *ev) 477_player_file_closed(Emotion_Generic_Video *ev)
484{ 478{
485 INF("Closed previous file."); 479 INF("Closed previous file.");
486#ifdef _WIN32 480 eina_semaphore_free(&ev->shared->lock);
487 CloseHandle(ev->shared->lock);
488#else
489 sem_destroy(&ev->shared->lock);
490#endif
491
492 ev->closing = EINA_FALSE; 481 ev->closing = EINA_FALSE;
493 482
494 if (ev->opening) 483 if (ev->opening)
@@ -1257,21 +1246,13 @@ static int
1257em_bgra_data_get(void *data, unsigned char **bgra_data) 1246em_bgra_data_get(void *data, unsigned char **bgra_data)
1258{ 1247{
1259 Emotion_Generic_Video *ev = data; 1248 Emotion_Generic_Video *ev = data;
1260#ifdef _WIN32
1261 DWORD res;
1262#endif
1263 1249
1264 if (!ev || !ev->file_ready) 1250 if (!ev || !ev->file_ready)
1265 return 0; 1251 return 0;
1266 1252
1267 // lock frame here 1253 // lock frame here
1268#ifdef _WIN32 1254 if (!eina_semaphore_lock(&ev->shared->lock))
1269 res = WaitForSingleObject(ev->shared->lock, 0L);
1270 if (res != WAIT_OBJECT_0)
1271 return 0; 1255 return 0;
1272#else
1273 sem_wait(&ev->shared->lock);
1274#endif
1275 1256
1276 // send current frame to emotion 1257 // send current frame to emotion
1277 if (ev->shared->frame.emotion != ev->shared->frame.last) 1258 if (ev->shared->frame.emotion != ev->shared->frame.last)
@@ -1286,11 +1267,7 @@ em_bgra_data_get(void *data, unsigned char **bgra_data)
1286 ev->shared->frame_drop = 0; 1267 ev->shared->frame_drop = 0;
1287 1268
1288 // unlock frame here 1269 // unlock frame here
1289#ifdef _WIN32 1270 eina_semaphore_release(&ev->shared->lock, 1);
1290 ReleaseSemaphore(ev->shared->lock, 1, NULL);
1291#else
1292 sem_post(&ev->shared->lock);
1293#endif
1294 ev->drop = 0; 1271 ev->drop = 0;
1295 1272
1296 return 1; 1273 return 1;