diff options
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r-- | firmware/mpeg.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 8700745a53..d2aa13b446 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -301,6 +301,7 @@ static void set_elapsed(struct mp3entry* id3) | |||
301 | 301 | ||
302 | static bool paused; /* playback is paused */ | 302 | static bool paused; /* playback is paused */ |
303 | #ifdef SIMULATOR | 303 | #ifdef SIMULATOR |
304 | static bool is_playing = false; | ||
304 | static bool playing = false; | 305 | static bool playing = false; |
305 | static bool play_pending = false; | 306 | static bool play_pending = false; |
306 | #else | 307 | #else |
@@ -1303,7 +1304,7 @@ void mpeg_play(int offset) | |||
1303 | int steps=0; | 1304 | int steps=0; |
1304 | 1305 | ||
1305 | do { | 1306 | do { |
1306 | trackname = playlist_next( steps, NULL ); | 1307 | trackname = playlist_peek( steps ); |
1307 | if (!trackname) | 1308 | if (!trackname) |
1308 | break; | 1309 | break; |
1309 | if(mp3info(&taginfo, trackname)) { | 1310 | if(mp3info(&taginfo, trackname)) { |
@@ -1311,8 +1312,10 @@ void mpeg_play(int offset) | |||
1311 | steps++; | 1312 | steps++; |
1312 | continue; | 1313 | continue; |
1313 | } | 1314 | } |
1315 | playlist_next(steps); | ||
1314 | taginfo.offset = offset; | 1316 | taginfo.offset = offset; |
1315 | set_elapsed(&taginfo); | 1317 | set_elapsed(&taginfo); |
1318 | is_playing = true; | ||
1316 | playing = true; | 1319 | playing = true; |
1317 | break; | 1320 | break; |
1318 | } while(1); | 1321 | } while(1); |
@@ -1326,6 +1329,7 @@ void mpeg_stop(void) | |||
1326 | #ifndef SIMULATOR | 1329 | #ifndef SIMULATOR |
1327 | queue_post(&mpeg_queue, MPEG_STOP, NULL); | 1330 | queue_post(&mpeg_queue, MPEG_STOP, NULL); |
1328 | #else | 1331 | #else |
1332 | is_playing = false; | ||
1329 | playing = false; | 1333 | playing = false; |
1330 | #endif | 1334 | #endif |
1331 | } | 1335 | } |
@@ -1335,6 +1339,7 @@ void mpeg_pause(void) | |||
1335 | #ifndef SIMULATOR | 1339 | #ifndef SIMULATOR |
1336 | queue_post(&mpeg_queue, MPEG_PAUSE, NULL); | 1340 | queue_post(&mpeg_queue, MPEG_PAUSE, NULL); |
1337 | #else | 1341 | #else |
1342 | is_playing = false; | ||
1338 | playing = false; | 1343 | playing = false; |
1339 | paused = true; | 1344 | paused = true; |
1340 | #endif | 1345 | #endif |
@@ -1345,6 +1350,7 @@ void mpeg_resume(void) | |||
1345 | #ifndef SIMULATOR | 1350 | #ifndef SIMULATOR |
1346 | queue_post(&mpeg_queue, MPEG_RESUME, NULL); | 1351 | queue_post(&mpeg_queue, MPEG_RESUME, NULL); |
1347 | #else | 1352 | #else |
1353 | is_playing = true; | ||
1348 | playing = true; | 1354 | playing = true; |
1349 | paused = false; | 1355 | paused = false; |
1350 | #endif | 1356 | #endif |
@@ -1360,15 +1366,17 @@ void mpeg_next(void) | |||
1360 | int index; | 1366 | int index; |
1361 | 1367 | ||
1362 | do { | 1368 | do { |
1363 | file = playlist_next(steps, &index); | 1369 | file = playlist_peek(steps); |
1364 | if(!file) | 1370 | if(!file) |
1365 | break; | 1371 | break; |
1366 | if(mp3info(&taginfo, file)) { | 1372 | if(mp3info(&taginfo, file)) { |
1367 | steps++; | 1373 | steps++; |
1368 | continue; | 1374 | continue; |
1369 | } | 1375 | } |
1376 | index = playlist_next(steps); | ||
1370 | current_track_counter++; | 1377 | current_track_counter++; |
1371 | taginfo.index = index; | 1378 | taginfo.index = index; |
1379 | is_playing = true; | ||
1372 | playing = true; | 1380 | playing = true; |
1373 | break; | 1381 | break; |
1374 | } while(1); | 1382 | } while(1); |
@@ -1385,15 +1393,17 @@ void mpeg_prev(void) | |||
1385 | int index; | 1393 | int index; |
1386 | 1394 | ||
1387 | do { | 1395 | do { |
1388 | file = playlist_next(steps, &index); | 1396 | file = playlist_peek(steps); |
1389 | if(!file) | 1397 | if(!file) |
1390 | break; | 1398 | break; |
1391 | if(mp3info(&taginfo, file)) { | 1399 | if(mp3info(&taginfo, file)) { |
1392 | steps--; | 1400 | steps--; |
1393 | continue; | 1401 | continue; |
1394 | } | 1402 | } |
1403 | index = playlist_next(steps); | ||
1395 | current_track_counter++; | 1404 | current_track_counter++; |
1396 | taginfo.index = index; | 1405 | taginfo.index = index; |
1406 | is_playing = true; | ||
1397 | playing = true; | 1407 | playing = true; |
1398 | break; | 1408 | break; |
1399 | } while(1); | 1409 | } while(1); |