summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/lib/emotion/Emotion.h4
-rw-r--r--src/lib/emotion/emotion_webcam.c36
5 files changed, 39 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index e0e0cec..0893f79 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -306,6 +306,8 @@ Pierre Le Magourou <pierre.lemagourou@openwide.fr>
306Hugo Camboulive <hugo.camboulive@zodiacaerospace.com> 306Hugo Camboulive <hugo.camboulive@zodiacaerospace.com>
307Sohyun Kim <anna1014.kim@samsung.com> 307Sohyun Kim <anna1014.kim@samsung.com>
308Leandro Dorileo <dorileo@profusion.mobi> 308Leandro Dorileo <dorileo@profusion.mobi>
309Michael Bouchaud (yoz) <yoz@efl.so>
310Aymeric Dumaz <aymeric.dumaz@gmail.com>
309 311
310Ethumb 312Ethumb
311------ 313------
diff --git a/ChangeLog b/ChangeLog
index cb4ea4e..0fec054 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-10-10 Michael Bouchaud (yoz)
2
3 * Emotion: add two events to trigger webcam plug and unplug
4
12013-10-04 ChunEon Park (Hermet) 52013-10-04 ChunEon Park (Hermet)
2 6
3 * Eina: fix eina_file_map_lines() to not drop of one character in the last line. 7 * Eina: fix eina_file_map_lines() to not drop of one character in the last line.
diff --git a/NEWS b/NEWS
index fc83666..173dd1b 100644
--- a/NEWS
+++ b/NEWS
@@ -424,6 +424,7 @@ Fixes:
424 * Emotion: 424 * Emotion:
425 - Fix memory leak in gstreamer_ecore_x_check. 425 - Fix memory leak in gstreamer_ecore_x_check.
426 - Fix backend priority order. 426 - Fix backend priority order.
427 - Add two events to trigger webcam plug and unplug
427 * Ethumb: 428 * Ethumb:
428 - Fix memory leak in error case. 429 - Fix memory leak in error case.
429 * Eeze: 430 * Eeze:
diff --git a/src/lib/emotion/Emotion.h b/src/lib/emotion/Emotion.h
index 454ee0f..34d1cc3 100644
--- a/src/lib/emotion/Emotion.h
+++ b/src/lib/emotion/Emotion.h
@@ -1287,7 +1287,9 @@ EAPI Evas_Object *emotion_object_image_get(const Evas_Object *obj);
1287 1287
1288typedef struct _Emotion_Webcam Emotion_Webcam; /**< Webcam description */ 1288typedef struct _Emotion_Webcam Emotion_Webcam; /**< Webcam description */
1289 1289
1290EAPI extern int EMOTION_WEBCAM_UPDATE; /**< Ecore_Event triggered when a new webcam is plugged in */ 1290EAPI extern int EMOTION_WEBCAM_UPDATE; /**< Ecore_Event triggered when a new webcam is plugged or unplugged */
1291EAPI extern int EMOTION_WEBCAM_ADD; /**< Ecore_Event triggered when a new webcam is plugged in @since 1.8*/
1292EAPI extern int EMOTION_WEBCAM_DEL; /**< Ecore_Event triggered when a webcam is unplugged @since 1.8 */
1291 1293
1292/** 1294/**
1293 * @brief Get a list of active and available webcam 1295 * @brief Get a list of active and available webcam
diff --git a/src/lib/emotion/emotion_webcam.c b/src/lib/emotion/emotion_webcam.c
index 52e6b5b..6302742 100644
--- a/src/lib/emotion/emotion_webcam.c
+++ b/src/lib/emotion/emotion_webcam.c
@@ -19,6 +19,8 @@
19#include "emotion_private.h" 19#include "emotion_private.h"
20 20
21EAPI int EMOTION_WEBCAM_UPDATE = 0; 21EAPI int EMOTION_WEBCAM_UPDATE = 0;
22EAPI int EMOTION_WEBCAM_ADD = 0;
23EAPI int EMOTION_WEBCAM_DEL = 0;
22 24
23typedef struct _Emotion_Webcams Emotion_Webcams; 25typedef struct _Emotion_Webcams Emotion_Webcams;
24 26
@@ -89,7 +91,7 @@ emotion_webcam_destroy(Emotion_Webcam *ew)
89#ifdef HAVE_EEZE 91#ifdef HAVE_EEZE
90static Eeze_Udev_Watch *eeze_watcher = NULL; 92static Eeze_Udev_Watch *eeze_watcher = NULL;
91 93
92static void 94static Eina_Bool
93_emotion_check_device(Emotion_Webcam *ew) 95_emotion_check_device(Emotion_Webcam *ew)
94{ 96{
95#ifdef HAVE_V4L2 97#ifdef HAVE_V4L2
@@ -99,7 +101,7 @@ _emotion_check_device(Emotion_Webcam *ew)
99 int fd = -1; 101 int fd = -1;
100#endif 102#endif
101 103
102 if (!ew) return; 104 if (!ew) return EINA_FALSE;
103#ifdef HAVE_V4L2 105#ifdef HAVE_V4L2
104 if (!ew->device) goto on_error; 106 if (!ew->device) goto on_error;
105 107
@@ -125,7 +127,7 @@ _emotion_check_device(Emotion_Webcam *ew)
125 127
126 if (fd >= 0) close(fd); 128 if (fd >= 0) close(fd);
127 129
128 return; 130 return EINA_TRUE;
129 131
130 on_error: 132 on_error:
131#endif 133#endif
@@ -137,6 +139,7 @@ _emotion_check_device(Emotion_Webcam *ew)
137#ifdef HAVE_V4L2 139#ifdef HAVE_V4L2
138 if (fd > 0) close(fd); 140 if (fd > 0) close(fd);
139#endif 141#endif
142 return EINA_FALSE;
140} 143}
141 144
142static Emotion_Webcam * 145static Emotion_Webcam *
@@ -183,6 +186,21 @@ _emotion_enumerate_all_webcams(void)
183} 186}
184 187
185static void 188static void
189_emotion_webcam_remove_cb(void *user_data, void *func_data EINA_UNUSED)
190{
191 Emotion_Webcam *webcam;
192
193 /* called at the end of EMOTION_WEBCAM_ADD event, to prevent the free */
194 if (!user_data)
195 return;
196
197 webcam = user_data;
198
199 EINA_REFCOUNT_UNREF(webcam)
200 emotion_webcam_destroy(webcam);
201}
202
203static void
186_emotion_eeze_events(const char *syspath, 204_emotion_eeze_events(const char *syspath,
187 Eeze_Udev_Event ev, 205 Eeze_Udev_Event ev,
188 void *data EINA_UNUSED, 206 void *data EINA_UNUSED,
@@ -196,9 +214,10 @@ _emotion_eeze_events(const char *syspath,
196 EINA_LIST_FOREACH(_emotion_webcams->webcams, l, check) 214 EINA_LIST_FOREACH(_emotion_webcams->webcams, l, check)
197 if (check->syspath == syspath) 215 if (check->syspath == syspath)
198 { 216 {
199 _emotion_webcams->webcams = eina_list_remove_list(_emotion_webcams->webcams, l); 217 _emotion_webcams->webcams =
200 EINA_REFCOUNT_UNREF(check) 218 eina_list_remove_list(_emotion_webcams->webcams, l);
201 emotion_webcam_destroy(check); 219 ecore_event_add(EMOTION_WEBCAM_DEL, check,
220 _emotion_webcam_remove_cb, check);
202 break ; 221 break ;
203 } 222 }
204 } 223 }
@@ -207,7 +226,8 @@ _emotion_eeze_events(const char *syspath,
207 Emotion_Webcam *test; 226 Emotion_Webcam *test;
208 227
209 test = _emotion_webcam_new(syspath); 228 test = _emotion_webcam_new(syspath);
210 if (test) _emotion_check_device(test); 229 if ((test) && (_emotion_check_device(test)))
230 ecore_event_add(EMOTION_WEBCAM_ADD, test, NULL, NULL);
211 } 231 }
212 ecore_event_add(EMOTION_WEBCAM_UPDATE, NULL, NULL, NULL); 232 ecore_event_add(EMOTION_WEBCAM_UPDATE, NULL, NULL, NULL);
213} 233}
@@ -217,6 +237,8 @@ _emotion_eeze_events(const char *syspath,
217Eina_Bool emotion_webcam_init(void) 237Eina_Bool emotion_webcam_init(void)
218{ 238{
219 EMOTION_WEBCAM_UPDATE = ecore_event_type_new(); 239 EMOTION_WEBCAM_UPDATE = ecore_event_type_new();
240 EMOTION_WEBCAM_ADD = ecore_event_type_new();
241 EMOTION_WEBCAM_DEL = ecore_event_type_new();
220 242
221 eet_init(); 243 eet_init();
222 _emotion_webcams_edds_new(); 244 _emotion_webcams_edds_new();