summaryrefslogtreecommitdiff
path: root/src/media.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-10-09 14:19:40 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-10-09 14:19:40 +0300
commit4bf163ecfac27c3dd86dff96df6f4647f9afe021 (patch)
treee360b25b9b420068e0650ed2caa57fed054a733c /src/media.c
parentbb7bc6fac4fec804846d11c7d77e1b553ba2be6a (diff)
Cleanup
Moved buffers out of player.c. Include MIME type with the data so the correct decoder can be chosen. Added stb_vorbis: https://github.com/nothings/stb
Diffstat (limited to 'src/media.c')
-rw-r--r--src/media.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/media.c b/src/media.c
index c447704b..c0d6d3de 100644
--- a/src/media.c
+++ b/src/media.c
@@ -182,13 +182,13 @@ void setData_Media(iMedia *d, iGmLinkId linkId, const iString *mime, const iBloc
182 else { 182 else {
183 audio = at_PtrArray(&d->audio, existing - 1); 183 audio = at_PtrArray(&d->audio, existing - 1);
184 iAssert(equal_String(&audio->props.mime, mime)); /* MIME cannot change */ 184 iAssert(equal_String(&audio->props.mime, mime)); /* MIME cannot change */
185 updateSourceData_Player(audio->player, data, append_PlayerUpdate); 185 updateSourceData_Player(audio->player, mime, data, append_PlayerUpdate);
186 if (!isStarted_Player(audio->player)) { 186 if (!isStarted_Player(audio->player)) {
187 /* Maybe the previous updates didn't have enough data. */ 187 /* Maybe the previous updates didn't have enough data. */
188 start_Player(audio->player); 188 start_Player(audio->player);
189 } 189 }
190 if (!isPartial) { 190 if (!isPartial) {
191 updateSourceData_Player(audio->player, NULL, complete_PlayerUpdate); 191 updateSourceData_Player(audio->player, NULL, NULL, complete_PlayerUpdate);
192 } 192 }
193 } 193 }
194 } 194 }
@@ -209,9 +209,9 @@ void setData_Media(iMedia *d, iGmLinkId linkId, const iString *mime, const iBloc
209 audio->props.linkId = linkId; /* TODO: use a hash? */ 209 audio->props.linkId = linkId; /* TODO: use a hash? */
210 audio->props.isPermanent = !allowHide; 210 audio->props.isPermanent = !allowHide;
211 set_String(&audio->props.mime, mime); 211 set_String(&audio->props.mime, mime);
212 updateSourceData_Player(audio->player, data, replace_PlayerUpdate); 212 updateSourceData_Player(audio->player, mime, data, replace_PlayerUpdate);
213 if (!isPartial) { 213 if (!isPartial) {
214 updateSourceData_Player(audio->player, NULL, complete_PlayerUpdate); 214 updateSourceData_Player(audio->player, NULL, NULL, complete_PlayerUpdate);
215 } 215 }
216 pushBack_PtrArray(&d->audio, audio); 216 pushBack_PtrArray(&d->audio, audio);
217 /* TEST: Start playing right away. */ 217 /* TEST: Start playing right away. */