summaryrefslogtreecommitdiff
path: root/src/modules/emotion/generic/Emotion_Generic_Plugin.h
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2013-12-21 15:00:30 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2013-12-21 15:02:52 -0200
commit376ca3f09b25b5b9b8f5ac43d9367fb3ef21aea1 (patch)
tree3b35b9c2a6a15454cf1df7050c40d1a987839585 /src/modules/emotion/generic/Emotion_Generic_Plugin.h
parentdd666a6ffdf8df737c1a5d56726581add464c05c (diff)
fix doc typo, ernno usage and add missing close().
- fix typo, it's slave not slayer... :-D - errno: you can't use errno to report error from failed mmap() if you do another call that sets errno after that, in that case fprintf(). So have a single print so we can use the errno value of the proper call. - although the slave generic player is not that important if it leaks its single shmfd, let's be pedantic and close it. Manpage says it is safe to close filedescriptor after mmap() worked.
Diffstat (limited to '')
-rw-r--r--src/modules/emotion/generic/Emotion_Generic_Plugin.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/modules/emotion/generic/Emotion_Generic_Plugin.h b/src/modules/emotion/generic/Emotion_Generic_Plugin.h
index b7fbd6378e..65e106c127 100644
--- a/src/modules/emotion/generic/Emotion_Generic_Plugin.h
+++ b/src/modules/emotion/generic/Emotion_Generic_Plugin.h
@@ -76,7 +76,7 @@ struct _Emotion_Generic_Video_Shared
76 /** 76 /**
77 * - "emotion" is the frame from where the Emotion process is reading pixels. 77 * - "emotion" is the frame from where the Emotion process is reading pixels.
78 * The player shouldn't touch this frame. 78 * The player shouldn't touch this frame.
79 * - "player" is the frame where the slayer process is writing pixels. 79 * - "player" is the frame where the slave process is writing pixels.
80 * The emotion process shouldn't touch this frame. 80 * The emotion process shouldn't touch this frame.
81 * - "last" is the last frame that was rendered by the player. Emotion will 81 * - "last" is the last frame that was rendered by the player. Emotion will
82 * use this frame the next time it will fetch pixels to Evas. 82 * use this frame the next time it will fetch pixels to Evas.
@@ -105,16 +105,17 @@ emotion_generic_shm_get(const char *shmname, Emotion_Generic_Video_Shared **vs,
105 shmfd = shm_open(shmname, O_RDWR, 0777); 105 shmfd = shm_open(shmname, O_RDWR, 0777);
106 if (shmfd == -1) 106 if (shmfd == -1)
107 { 107 {
108 fprintf(stderr, "player: could not open shm: %s\n", shmname); 108 fprintf(stderr, "player: could not open shm: %s: %s\n",
109 fprintf(stderr, "player: %s\n", strerror(errno)); 109 shmname, strerror(errno));
110 return 0; 110 return 0;
111 } 111 }
112 112
113 t_vs = mmap(NULL, sizeof(*t_vs), PROT_READ|PROT_WRITE, MAP_SHARED, shmfd, 0); 113 t_vs = mmap(NULL, sizeof(*t_vs), PROT_READ|PROT_WRITE, MAP_SHARED, shmfd, 0);
114 if (t_vs == MAP_FAILED) 114 if (t_vs == MAP_FAILED)
115 { 115 {
116 fprintf(stderr, "player: could not map shared memory.\n"); 116 fprintf(stderr, "player: could not map shared memory: %s\n",
117 fprintf(stderr, "player: %s\n", strerror(errno)); 117 strerror(errno));
118 close(shmfd);
118 return 0; 119 return 0;
119 } 120 }
120 size = t_vs->size; 121 size = t_vs->size;
@@ -122,10 +123,12 @@ emotion_generic_shm_get(const char *shmname, Emotion_Generic_Video_Shared **vs,
122 t_vs = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, shmfd, 0); 123 t_vs = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, shmfd, 0);
123 if (t_vs == MAP_FAILED) 124 if (t_vs == MAP_FAILED)
124 { 125 {
125 fprintf(stderr, "player: could not map shared memory.\n"); 126 fprintf(stderr, "player: could not map shared memory: %s\n",
126 fprintf(stderr, "player: %s\n", strerror(errno)); 127 strerror(errno));
128 close(shmfd);
127 return 0; 129 return 0;
128 } 130 }
131 close(shmfd);
129 132
130 vf->frames[0] = (unsigned char *)t_vs + sizeof(*t_vs); 133 vf->frames[0] = (unsigned char *)t_vs + sizeof(*t_vs);
131 vf->frames[1] = (unsigned char *)t_vs + sizeof(*t_vs) + t_vs->height * t_vs->width * t_vs->pitch; 134 vf->frames[1] = (unsigned char *)t_vs + sizeof(*t_vs) + t_vs->height * t_vs->width * t_vs->pitch;