summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2011-08-03 14:23:51 +0000
committerCedric BAIL <cedric.bail@free.fr>2011-08-03 14:23:51 +0000
commitc33aaf812fa23ba8e0da77d702f181a7343bf08f (patch)
treed8247c9d2cb59c4efc908881b70eba37a6fbca70 /legacy/emotion/src/lib
parentbcf2d84237359b675eec49401adba82ac454dba7 (diff)
emotion: fix webcam detection.
SVN revision: 62054
Diffstat (limited to 'legacy/emotion/src/lib')
-rw-r--r--legacy/emotion/src/lib/Emotion.h6
-rw-r--r--legacy/emotion/src/lib/emotion_main.c13
2 files changed, 12 insertions, 7 deletions
diff --git a/legacy/emotion/src/lib/Emotion.h b/legacy/emotion/src/lib/Emotion.h
index 812e5df572..198f26a599 100644
--- a/legacy/emotion/src/lib/Emotion.h
+++ b/legacy/emotion/src/lib/Emotion.h
@@ -843,9 +843,11 @@ EAPI Eina_Bool emotion_object_extension_may_play_get(const char *file);
843 843
844typedef struct _Emotion_Webcam Emotion_Webcam; 844typedef struct _Emotion_Webcam Emotion_Webcam;
845 845
846extern int EMOTION_WEBCAM_UPDATE;
847
846EAPI const Eina_List *emotion_webcams_get(void); 848EAPI const Eina_List *emotion_webcams_get(void);
847EAPI const char *emotion_webcam_name_get(Emotion_Webcam *ew); 849EAPI const char *emotion_webcam_name_get(const Emotion_Webcam *ew);
848EAPI const char *emotion_webcam_device_get(Emotion_Webcam *ew); 850EAPI const char *emotion_webcam_device_get(const Emotion_Webcam *ew);
849 851
850/** 852/**
851 * @} 853 * @}
diff --git a/legacy/emotion/src/lib/emotion_main.c b/legacy/emotion/src/lib/emotion_main.c
index 9154ffcc26..f25fa37cfe 100644
--- a/legacy/emotion/src/lib/emotion_main.c
+++ b/legacy/emotion/src/lib/emotion_main.c
@@ -124,6 +124,8 @@ struct _Emotion_Webcam
124 const char *syspath; 124 const char *syspath;
125 const char *device; 125 const char *device;
126 const char *name; 126 const char *name;
127
128 const char *filename;
127}; 129};
128 130
129static int _emotion_webcams_count = 0; 131static int _emotion_webcams_count = 0;
@@ -150,8 +152,8 @@ _emotion_check_device(Emotion_Webcam *ew)
150 if (!ew) return ; 152 if (!ew) return ;
151 if (!ew->device) goto on_error; 153 if (!ew->device) goto on_error;
152 154
153 fd = open(ew->device, O_RDONLY); 155 fd = open(ew->filename, O_RDONLY);
154 if (!fd) goto on_error; 156 if (fd < 0) goto on_error;
155 157
156 if (ioctl(fd, VIDIOC_QUERYCAP, &caps) == -1) goto on_error; 158 if (ioctl(fd, VIDIOC_QUERYCAP, &caps) == -1) goto on_error;
157 159
@@ -173,7 +175,7 @@ _emotion_check_device(Emotion_Webcam *ew)
173 return ; 175 return ;
174 176
175 on_error: 177 on_error:
176 fprintf(stderr, "'%s' is not a webcam\n", ew->name); 178 fprintf(stderr, "'%s' is not a webcam ['%s']\n", ew->name, strerror(errno));
177 eina_stringshare_del(ew->syspath); 179 eina_stringshare_del(ew->syspath);
178 eina_stringshare_del(ew->device); 180 eina_stringshare_del(ew->device);
179 eina_stringshare_del(ew->name); 181 eina_stringshare_del(ew->name);
@@ -198,6 +200,7 @@ _emotion_webcam_new(const char *syspath)
198 snprintf(local, eina_stringshare_strlen(device) + 8, "v4l2://%s", device); 200 snprintf(local, eina_stringshare_strlen(device) + 8, "v4l2://%s", device);
199 test->device = eina_stringshare_add(local); 201 test->device = eina_stringshare_add(local);
200 eina_stringshare_del(device); 202 eina_stringshare_del(device);
203 test->filename = test->device + 7;
201 204
202 return test; 205 return test;
203} 206}
@@ -303,7 +306,7 @@ emotion_webcams_get(void)
303} 306}
304 307
305EAPI const char * 308EAPI const char *
306emotion_webcam_name_get(Emotion_Webcam *ew) 309emotion_webcam_name_get(const Emotion_Webcam *ew)
307{ 310{
308 if (!ew) return NULL; 311 if (!ew) return NULL;
309 312
@@ -315,7 +318,7 @@ emotion_webcam_name_get(Emotion_Webcam *ew)
315} 318}
316 319
317EAPI const char * 320EAPI const char *
318emotion_webcam_device_get(Emotion_Webcam *ew) 321emotion_webcam_device_get(const Emotion_Webcam *ew)
319{ 322{
320 if (!ew) return NULL; 323 if (!ew) return NULL;
321 324