summaryrefslogtreecommitdiff
path: root/src/media.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/media.c')
-rw-r--r--src/media.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/media.c b/src/media.c
index cd3dfb82..8bd635a5 100644
--- a/src/media.c
+++ b/src/media.c
@@ -154,12 +154,13 @@ void clear_Media(iMedia *d) {
154 clear_PtrArray(&d->audio); 154 clear_PtrArray(&d->audio);
155} 155}
156 156
157void setData_Media(iMedia *d, iGmLinkId linkId, const iString *mime, const iBlock *data, 157iBool setData_Media(iMedia *d, iGmLinkId linkId, const iString *mime, const iBlock *data,
158 int flags) { 158 int flags) {
159 const iBool isPartial = (flags & partialData_MediaFlag) != 0; 159 const iBool isPartial = (flags & partialData_MediaFlag) != 0;
160 const iBool allowHide = (flags & allowHide_MediaFlag) != 0; 160 const iBool allowHide = (flags & allowHide_MediaFlag) != 0;
161 const iBool isDeleting = (!mime || !data); 161 const iBool isDeleting = (!mime || !data);
162 iMediaId existing = findLinkImage_Media(d, linkId); 162 iMediaId existing = findLinkImage_Media(d, linkId);
163 iBool isNew = iFalse;
163 if (existing) { 164 if (existing) {
164 iGmImage *img; 165 iGmImage *img;
165 if (isDeleting) { 166 if (isDeleting) {
@@ -205,6 +206,7 @@ void setData_Media(iMedia *d, iGmLinkId linkId, const iString *mime, const iBloc
205 if (!isPartial) { 206 if (!isPartial) {
206 makeTexture_GmImage(img); 207 makeTexture_GmImage(img);
207 } 208 }
209 isNew = iTrue;
208 } 210 }
209 else if (startsWith_String(mime, "audio/")) { 211 else if (startsWith_String(mime, "audio/")) {
210 iGmAudio *audio = new_GmAudio(); 212 iGmAudio *audio = new_GmAudio();
@@ -219,8 +221,10 @@ void setData_Media(iMedia *d, iGmLinkId linkId, const iString *mime, const iBloc
219 /* Start playing right away. */ 221 /* Start playing right away. */
220 start_Player(audio->player); 222 start_Player(audio->player);
221 postCommandf_App("media.player.started player:%p", audio->player); 223 postCommandf_App("media.player.started player:%p", audio->player);
224 isNew = iTrue;
222 } 225 }
223 } 226 }
227 return isNew;
224} 228}
225 229
226iMediaId findLinkImage_Media(const iMedia *d, iGmLinkId linkId) { 230iMediaId findLinkImage_Media(const iMedia *d, iGmLinkId linkId) {