diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-08-22 01:36:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-05-01 11:28:38 +0200 |
commit | 4bef502d4d7fb95f0afb4ac8cb293315d35bb3da (patch) | |
tree | f9f9a7fba4a45b86eb779e1d86aef598924290cd /lib/rbcodec/metadata | |
parent | 9b363c6cedc31f135e831a1b57dcf08578d34ee7 (diff) | |
download | rockbox-4bef502d4d7fb95f0afb4ac8cb293315d35bb3da.tar.gz rockbox-4bef502d4d7fb95f0afb4ac8cb293315d35bb3da.zip |
rbcodec refactoring: autoresumable
Moved to playback.c, since it doesn't use metadata from the music file.
Change-Id: I5c3ad7750d94b36754f64eb302f96ec163785cb9
Reviewed-on: http://gerrit.rockbox.org/142
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/metadata')
-rw-r--r-- | lib/rbcodec/metadata/metadata.c | 65 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.h | 4 |
2 files changed, 0 insertions, 69 deletions
diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index 6837e97316..3fe9860441 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c | |||
@@ -25,7 +25,6 @@ | |||
25 | 25 | ||
26 | #include "debug.h" | 26 | #include "debug.h" |
27 | #include "logf.h" | 27 | #include "logf.h" |
28 | #include "settings.h" | ||
29 | #include "cuesheet.h" | 28 | #include "cuesheet.h" |
30 | #include "metadata.h" | 29 | #include "metadata.h" |
31 | 30 | ||
@@ -571,67 +570,3 @@ void fill_metadata_from_path(struct mp3entry *id3, const char *trackname) | |||
571 | strlcpy(id3->path, trackname, sizeof (id3->path)); | 570 | strlcpy(id3->path, trackname, sizeof (id3->path)); |
572 | } | 571 | } |
573 | #endif /* CONFIG_CODEC == SWCODEC */ | 572 | #endif /* CONFIG_CODEC == SWCODEC */ |
574 | |||
575 | #ifndef __PCTOOL__ | ||
576 | #ifdef HAVE_TAGCACHE | ||
577 | #if CONFIG_CODEC == SWCODEC | ||
578 | |||
579 | enum { AUTORESUMABLE_UNKNOWN = 0, AUTORESUMABLE_TRUE, AUTORESUMABLE_FALSE }; | ||
580 | |||
581 | bool autoresumable(struct mp3entry *id3) | ||
582 | { | ||
583 | char *endp, *path; | ||
584 | size_t len; | ||
585 | bool is_resumable; | ||
586 | |||
587 | if (id3->autoresumable) /* result cached? */ | ||
588 | return id3->autoresumable == AUTORESUMABLE_TRUE; | ||
589 | |||
590 | is_resumable = false; | ||
591 | |||
592 | if (id3->path) | ||
593 | { | ||
594 | for (path = global_settings.autoresume_paths; | ||
595 | *path; /* search terms left? */ | ||
596 | path++) | ||
597 | { | ||
598 | if (*path == ':') /* Skip empty search patterns */ | ||
599 | continue; | ||
600 | |||
601 | /* FIXME: As soon as strcspn or strchrnul are made available in | ||
602 | the core, the following can be made more efficient. */ | ||
603 | endp = strchr(path, ':'); | ||
604 | if (endp) | ||
605 | len = endp - path; | ||
606 | else | ||
607 | len = strlen(path); | ||
608 | |||
609 | /* Note: At this point, len is always > 0 */ | ||
610 | |||
611 | if (strncasecmp(id3->path, path, len) == 0) | ||
612 | { | ||
613 | /* Full directory-name matches only. Trailing '/' in | ||
614 | search path OK. */ | ||
615 | if (id3->path[len] == '/' || id3->path[len - 1] == '/') | ||
616 | { | ||
617 | is_resumable = true; | ||
618 | break; | ||
619 | } | ||
620 | } | ||
621 | path += len - 1; | ||
622 | } | ||
623 | } | ||
624 | |||
625 | /* cache result */ | ||
626 | id3->autoresumable = | ||
627 | is_resumable ? AUTORESUMABLE_TRUE : AUTORESUMABLE_FALSE; | ||
628 | |||
629 | logf("autoresumable: %s is%s resumable", | ||
630 | id3->path, is_resumable ? "" : " not"); | ||
631 | |||
632 | return is_resumable; | ||
633 | } | ||
634 | |||
635 | #endif /* SWCODEC */ | ||
636 | #endif /* HAVE_TAGCACHE */ | ||
637 | #endif /* __PCTOOL__ */ | ||
diff --git a/lib/rbcodec/metadata/metadata.h b/lib/rbcodec/metadata/metadata.h index 5a1c17bc11..6d711aff28 100644 --- a/lib/rbcodec/metadata/metadata.h +++ b/lib/rbcodec/metadata/metadata.h | |||
@@ -344,10 +344,6 @@ bool rbcodec_format_is_atomic(int afmt); | |||
344 | bool format_buffers_with_offset(int afmt); | 344 | bool format_buffers_with_offset(int afmt); |
345 | #endif | 345 | #endif |
346 | 346 | ||
347 | #ifdef HAVE_TAGCACHE | ||
348 | bool autoresumable(struct mp3entry *id3); | ||
349 | #endif | ||
350 | |||
351 | #endif | 347 | #endif |
352 | 348 | ||
353 | 349 | ||