summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 944775d6e1..997a374410 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1379,6 +1379,64 @@ static bool audio_init_codec(struct track_info *track_info,
1379 (void)track_info; /* When codec buffering isn't supported */ 1379 (void)track_info; /* When codec buffering isn't supported */
1380} 1380}
1381 1381
1382#ifdef HAVE_TAGCACHE
1383/* Check settings for whether the file should be autoresumed */
1384enum { AUTORESUMABLE_UNKNOWN = 0, AUTORESUMABLE_TRUE, AUTORESUMABLE_FALSE };
1385static bool autoresumable(struct mp3entry *id3)
1386{
1387 char *endp, *path;
1388 size_t len;
1389 bool is_resumable;
1390
1391 if (id3->autoresumable) /* result cached? */
1392 return id3->autoresumable == AUTORESUMABLE_TRUE;
1393
1394 is_resumable = false;
1395
1396 if (id3->path)
1397 {
1398 for (path = global_settings.autoresume_paths;
1399 *path; /* search terms left? */
1400 path++)
1401 {
1402 if (*path == ':') /* Skip empty search patterns */
1403 continue;
1404
1405 /* FIXME: As soon as strcspn or strchrnul are made available in
1406 the core, the following can be made more efficient. */
1407 endp = strchr(path, ':');
1408 if (endp)
1409 len = endp - path;
1410 else
1411 len = strlen(path);
1412
1413 /* Note: At this point, len is always > 0 */
1414
1415 if (strncasecmp(id3->path, path, len) == 0)
1416 {
1417 /* Full directory-name matches only. Trailing '/' in
1418 search path OK. */
1419 if (id3->path[len] == '/' || id3->path[len - 1] == '/')
1420 {
1421 is_resumable = true;
1422 break;
1423 }
1424 }
1425 path += len - 1;
1426 }
1427 }
1428
1429 /* cache result */
1430 id3->autoresumable =
1431 is_resumable ? AUTORESUMABLE_TRUE : AUTORESUMABLE_FALSE;
1432
1433 logf("autoresumable: %s is%s resumable",
1434 id3->path, is_resumable ? "" : " not");
1435
1436 return is_resumable;
1437}
1438#endif /* HAVE_TAGCACHE */
1439
1382/* Start the codec for the current track scheduled to be decoded */ 1440/* Start the codec for the current track scheduled to be decoded */
1383static bool audio_start_codec(bool auto_skip) 1441static bool audio_start_codec(bool auto_skip)
1384{ 1442{