1
0
Fork 0
forked from len0rd/rockbox

Remove the ID3 tag version priority setting on the grounds of it being pretty pointless. ID3v2 tags are superior to ID3v1 tags, and needs less seeking around to find.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14750 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thom Johansen 2007-09-19 10:40:55 +00:00
parent 547cffb90b
commit 294ec1d110
19 changed files with 38 additions and 73 deletions

View file

@ -2040,44 +2040,44 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_ID3_ORDER id: LANG_ID3_ORDER
desc: in playback settings screen desc: DEPRECATED
user: user:
<source> <source>
*: "ID3 Tag Priority" *: ""
</source> </source>
<dest> <dest>
*: "ID3 Tag Priority" *: ""
</dest> </dest>
<voice> <voice>
*: "ID3 Tag Priority" *: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_ID3_V1_FIRST id: LANG_ID3_V1_FIRST
desc: in playback settings screen desc: DEPRECATED
user: user:
<source> <source>
*: "V1 then V2" *: ""
</source> </source>
<dest> <dest>
*: "V1 then V2" *: ""
</dest> </dest>
<voice> <voice>
*: "Version 1 then version 2" *: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_ID3_V2_FIRST id: LANG_ID3_V2_FIRST
desc: in playback settings screen desc: DEPRECATED
user: user:
<source> <source>
*: "V2 then V1" *: ""
</source> </source>
<dest> <dest>
*: "V2 then V1" *: ""
</dest> </dest>
<voice> <voice>
*: "Version 2 then version 1" *: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -129,7 +129,6 @@ MENUITEM_SETTING(beep, &global_settings.beep ,NULL);
#ifdef HAVE_SPDIF_POWER #ifdef HAVE_SPDIF_POWER
MENUITEM_SETTING(spdif_enable, &global_settings.spdif_enable, NULL); MENUITEM_SETTING(spdif_enable, &global_settings.spdif_enable, NULL);
#endif #endif
MENUITEM_SETTING(id3_v1_first, &global_settings.id3_v1_first, NULL);
MENUITEM_SETTING(next_folder, &global_settings.next_folder, NULL); MENUITEM_SETTING(next_folder, &global_settings.next_folder, NULL);
int audioscrobbler_callback(int action,const struct menu_item_ex *this_item) int audioscrobbler_callback(int action,const struct menu_item_ex *this_item)
{ {
@ -187,7 +186,7 @@ MAKE_MENU(playback_menu_item,ID2P(LANG_PLAYBACK),0,
#ifdef HAVE_SPDIF_POWER #ifdef HAVE_SPDIF_POWER
&spdif_enable, &spdif_enable,
#endif #endif
&id3_v1_first, &next_folder, &audioscrobbler, &cuesheet &next_folder, &audioscrobbler, &cuesheet
#ifdef HAVE_HEADPHONE_DETECTION #ifdef HAVE_HEADPHONE_DETECTION
,&unplug_menu ,&unplug_menu
#endif #endif

View file

@ -93,8 +93,7 @@ unsigned int probe_file_format(const char *filename)
/* Get metadata for track - return false if parsing showed problems with the /* Get metadata for track - return false if parsing showed problems with the
* file that would prevent playback. * file that would prevent playback.
*/ */
bool get_metadata(struct mp3entry* id3, int fd, const char* trackname, bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
bool v1first)
{ {
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
unsigned char* buf; unsigned char* buf;
@ -111,7 +110,7 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname,
case AFMT_MPA_L1: case AFMT_MPA_L1:
case AFMT_MPA_L2: case AFMT_MPA_L2:
case AFMT_MPA_L3: case AFMT_MPA_L3:
if (!get_mp3_metadata(fd, id3, trackname, v1first)) if (!get_mp3_metadata(fd, id3, trackname))
{ {
return false; return false;
} }

View file

@ -23,8 +23,7 @@
#include "playback.h" #include "playback.h"
unsigned int probe_file_format(const char *filename); unsigned int probe_file_format(const char *filename);
bool get_metadata(struct mp3entry* id3, int fd, const char* trackname, bool get_metadata(struct mp3entry* id3, int fd, const char* trackname);
bool v1first);
#endif #endif

View file

@ -263,7 +263,6 @@ static size_t conf_watermark = 0; /* Level to trigger filebuf fill (A/C) FIXME *
static size_t conf_filechunk = 0; /* Largest chunk the codec accepts (A/C) FIXME */ static size_t conf_filechunk = 0; /* Largest chunk the codec accepts (A/C) FIXME */
static size_t conf_preseek = 0; /* Codec pre-seek margin (A/C) FIXME */ static size_t conf_preseek = 0; /* Codec pre-seek margin (A/C) FIXME */
static size_t buffer_margin = 0; /* Buffer margin aka anti-skip buffer (A/C-) */ static size_t buffer_margin = 0; /* Buffer margin aka anti-skip buffer (A/C-) */
static bool v1first = false; /* ID3 data control, true if V1 then V2 (A) */
#if MEM > 8 #if MEM > 8
static size_t high_watermark = 0; /* High watermark for rebuffer (A/V/other) */ static size_t high_watermark = 0; /* High watermark for rebuffer (A/V/other) */
#endif #endif
@ -395,11 +394,6 @@ bool mp3_is_playing(void)
return voice_is_playing; return voice_is_playing;
} }
void mpeg_id3_options(bool _v1first)
{
v1first = _v1first;
}
/* If voice could be swapped out - wait for it to return /* If voice could be swapped out - wait for it to return
* Used by buffer claming functions. * Used by buffer claming functions.
*/ */
@ -2744,7 +2738,7 @@ static bool audio_load_track(int offset, bool start_play, bool rebuffer)
/* Get track metadata if we don't already have it. */ /* Get track metadata if we don't already have it. */
if (!tracks[track_widx].taginfo_ready) if (!tracks[track_widx].taginfo_ready)
{ {
if (get_metadata(&(tracks[track_widx].id3),current_fd,trackname,v1first)) if (get_metadata(&(tracks[track_widx].id3),current_fd,trackname))
{ {
tracks[track_widx].taginfo_ready = true; tracks[track_widx].taginfo_ready = true;
if (start_play) if (start_play)
@ -2886,7 +2880,7 @@ static bool audio_read_next_metadata(void)
if (fd < 0) if (fd < 0)
return false; return false;
status = get_metadata(&(tracks[next_idx].id3),fd,trackname,v1first); status = get_metadata(&(tracks[next_idx].id3),fd,trackname);
/* Preload the glyphs in the tags */ /* Preload the glyphs in the tags */
if (status) if (status)
{ {

View file

@ -573,7 +573,7 @@ struct plugin_api {
#endif #endif
struct user_settings* global_settings; struct user_settings* global_settings;
struct system_status *global_status; struct system_status *global_status;
bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first); bool (*mp3info)(struct mp3entry *entry, const char *filename);
int (*count_mp3_frames)(int fd, int startpos, int filesize, int (*count_mp3_frames)(int fd, int startpos, int filesize,
void (*progressfunc)(int)); void (*progressfunc)(int));
int (*create_xing_header)(int fd, long startpos, long filesize, int (*create_xing_header)(int fd, long startpos, long filesize,
@ -620,8 +620,7 @@ struct plugin_api {
int (*codec_load_file)(const char* codec, struct codec_api *api); int (*codec_load_file)(const char* codec, struct codec_api *api);
const char *(*get_codec_filename)(int cod_spec); const char *(*get_codec_filename)(int cod_spec);
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname, bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
bool v1first);
#endif #endif
void (*led)(bool on); void (*led)(bool on);
}; };

View file

@ -100,9 +100,9 @@ static bool file_properties(char* selected_file)
#if (CONFIG_CODEC == SWCODEC) #if (CONFIG_CODEC == SWCODEC)
int fd = rb->open(selected_file, O_RDONLY); int fd = rb->open(selected_file, O_RDONLY);
if (fd >= 0 && if (fd >= 0 &&
rb->get_metadata(&id3, fd, selected_file, false)) rb->get_metadata(&id3, fd, selected_file))
#else #else
if (!rb->mp3info(&id3, selected_file, false)) if (!rb->mp3info(&id3, selected_file))
#endif #endif
{ {
rb->snprintf(str_artist, sizeof str_artist, rb->snprintf(str_artist, sizeof str_artist,

View file

@ -537,8 +537,7 @@ static enum plugin_status test_track(char* filename)
/* Clear the id3 struct */ /* Clear the id3 struct */
rb->memset(&track.id3, 0, sizeof(struct mp3entry)); rb->memset(&track.id3, 0, sizeof(struct mp3entry));
if (!rb->get_metadata(&(track.id3), fd, filename, if (!rb->get_metadata(&(track.id3), fd, filename))
rb->global_settings->id3_v1_first))
{ {
log_text("Cannot read metadata",true); log_text("Cannot read metadata",true);
return PLUGIN_ERROR; return PLUGIN_ERROR;

View file

@ -143,7 +143,7 @@ static bool vbr_fix(char *selected_file)
xingupdate(0); xingupdate(0);
rc = rb->mp3info(&entry, selected_file, false); rc = rb->mp3info(&entry, selected_file);
if(rc < 0) { if(rc < 0) {
fileerror(rc); fileerror(rc);
return true; return true;

View file

@ -722,8 +722,6 @@ void settings_apply(void)
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR) #if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
dac_line_in(global_settings.line_in); dac_line_in(global_settings.line_in);
#endif #endif
mpeg_id3_options(global_settings.id3_v1_first);
set_poweroff_timeout(global_settings.poweroff); set_poweroff_timeout(global_settings.poweroff);
set_battery_capacity(global_settings.battery_capacity); set_battery_capacity(global_settings.battery_capacity);

View file

@ -525,8 +525,6 @@ struct user_settings
bool line_in; /* false=off, true=active */ bool line_in; /* false=off, true=active */
bool id3_v1_first; /* true = ID3V1 has prio over ID3V2 tag */
/* playlist viewer settings */ /* playlist viewer settings */
bool playlist_viewer_icons; /* display icons on viewer */ bool playlist_viewer_icons; /* display icons on viewer */
bool playlist_viewer_indices; /* display playlist indices on viewer */ bool playlist_viewer_indices; /* display playlist indices on viewer */

View file

@ -757,9 +757,6 @@ const struct settings_list settings[] = {
"sort dirs", "alpha,oldest,newest", NULL, 3, "sort dirs", "alpha,oldest,newest", NULL, 3,
ID2P(LANG_SORT_ALPHA), ID2P(LANG_SORT_DATE), ID2P(LANG_SORT_ALPHA), ID2P(LANG_SORT_DATE),
ID2P(LANG_SORT_DATE_REVERSE)), ID2P(LANG_SORT_DATE_REVERSE)),
BOOL_SETTING(0, id3_v1_first, LANG_ID3_ORDER, false,
"id3 tag priority", "v2-v1,v1-v2",
LANG_ID3_V1_FIRST, LANG_ID3_V2_FIRST, mpeg_id3_options),
#ifdef HAVE_RECORDING #ifdef HAVE_RECORDING
/* recording */ /* recording */

View file

@ -1660,7 +1660,7 @@ static void add_tagcache(char *path)
memset(&track, 0, sizeof(struct track_info)); memset(&track, 0, sizeof(struct track_info));
memset(&entry, 0, sizeof(struct temp_file_entry)); memset(&entry, 0, sizeof(struct temp_file_entry));
memset(&tracknumfix, 0, sizeof(tracknumfix)); memset(&tracknumfix, 0, sizeof(tracknumfix));
ret = get_metadata(&(track.id3), fd, path, false); ret = get_metadata(&(track.id3), fd, path);
close(fd); close(fd);
if (!ret) if (!ret)

View file

@ -652,7 +652,7 @@ int talk_file(const char* filename, bool enqueue)
if (p_thumbnail == NULL || size_for_thumbnail <= 0) if (p_thumbnail == NULL || size_for_thumbnail <= 0)
return -1; return -1;
if(mp3info(&info, filename, false)) /* use this to find real start */ if(mp3info(&info, filename)) /* use this to find real start */
{ {
return 0; /* failed to open, or invalid */ return 0; /* failed to open, or invalid */
} }

View file

@ -235,8 +235,8 @@ enum {
ID3_VER_2_4 ID3_VER_2_4
}; };
bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first); bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename);
bool mp3info(struct mp3entry *entry, const char *filename, bool v1first); bool mp3info(struct mp3entry *entry, const char *filename);
char* id3_get_num_genre(const unsigned int genre_num); char* id3_get_num_genre(const unsigned int genre_num);
char* id3_get_codec(const struct mp3entry* id3); char* id3_get_codec(const struct mp3entry* id3);
int getid3v2len(int fd); int getid3v2len(int fd);

View file

@ -55,7 +55,6 @@ unsigned long mpeg_get_last_header(void);
/* in order to keep the recording here, I have to expose this */ /* in order to keep the recording here, I have to expose this */
void rec_tick(void); void rec_tick(void);
void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */ void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
void mpeg_id3_options(bool _v1first);
void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)); void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3));
void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3, void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3,

View file

@ -1164,10 +1164,8 @@ static int getsonglength(int fd, struct mp3entry *entry)
* about an MP3 file and updates it's entry accordingly. * about an MP3 file and updates it's entry accordingly.
* *
Note, that this returns true for successful, false for error! */ Note, that this returns true for successful, false for error! */
bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first) bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename)
{ {
int v1found = false;
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
memset(entry, 0, sizeof(struct mp3entry)); memset(entry, 0, sizeof(struct mp3entry));
#endif #endif
@ -1180,10 +1178,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool
entry->tracknum = 0; entry->tracknum = 0;
entry->discnum = 0; entry->discnum = 0;
if(v1first) if (entry->id3v2len)
v1found = setid3v1title(fd, entry);
if (!v1found && entry->id3v2len)
setid3v2title(fd, entry); setid3v2title(fd, entry);
int len = getsonglength(fd, entry); int len = getsonglength(fd, entry);
if (len < 0) if (len < 0)
@ -1194,9 +1189,8 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool
the true size of the MP3 stream */ the true size of the MP3 stream */
entry->filesize -= entry->first_frame_offset; entry->filesize -= entry->first_frame_offset;
/* only seek to end of file if no id3v2 tags were found, /* only seek to end of file if no id3v2 tags were found */
and we already haven't looked for a v1 tag */ if (!entry->id3v2len) {
if (!v1first && !entry->id3v2len) {
setid3v1title(fd, entry); setid3v1title(fd, entry);
} }
@ -1209,7 +1203,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool
} }
/* Note, that this returns false for successful, true for error! */ /* Note, that this returns false for successful, true for error! */
bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) bool mp3info(struct mp3entry *entry, const char *filename)
{ {
int fd; int fd;
bool result; bool result;
@ -1218,7 +1212,7 @@ bool mp3info(struct mp3entry *entry, const char *filename, bool v1first)
if (fd < 0) if (fd < 0)
return true; return true;
result = !get_mp3_metadata(fd, entry, filename, v1first); result = !get_mp3_metadata(fd, entry, filename);
close(fd); close(fd);

View file

@ -127,8 +127,6 @@ static bool (*cuesheet_callback)(const char *filename) = NULL;
static const char mpeg_thread_name[] = "mpeg"; static const char mpeg_thread_name[] = "mpeg";
static unsigned int mpeg_errno; static unsigned int mpeg_errno;
static bool v1first = false;
static bool playing = false; /* We are playing an MP3 stream */ static bool playing = false; /* We are playing an MP3 stream */
static bool is_playing = false; /* We are (attempting to) playing MP3 files */ static bool is_playing = false; /* We are (attempting to) playing MP3 files */
static bool paused; /* playback is paused */ static bool paused; /* playback is paused */
@ -922,7 +920,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename)
/* grab id3 tag of new file and /* grab id3 tag of new file and
remember where in memory it starts */ remember where in memory it starts */
if(mp3info(&track->id3, filename, v1first)) if(mp3info(&track->id3, filename))
{ {
DEBUGF("Bad mp3\n"); DEBUGF("Bad mp3\n");
return NULL; return NULL;
@ -2098,11 +2096,6 @@ static void mpeg_thread(void)
} }
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */
void mpeg_id3_options(bool _v1first)
{
v1first = _v1first;
}
struct mp3entry* audio_current_track() struct mp3entry* audio_current_track()
{ {
#ifdef SIMULATOR #ifdef SIMULATOR
@ -2707,7 +2700,7 @@ void audio_play(long offset)
trackname = playlist_peek( steps ); trackname = playlist_peek( steps );
if (!trackname) if (!trackname)
break; break;
if(mp3info(&taginfo, trackname, v1first)) { if(mp3info(&taginfo, trackname)) {
/* bad mp3, move on */ /* bad mp3, move on */
if(++steps > playlist_amount()) if(++steps > playlist_amount())
break; break;
@ -2793,7 +2786,7 @@ void audio_next(void)
file = playlist_peek(steps); file = playlist_peek(steps);
if(!file) if(!file)
break; break;
if(mp3info(&taginfo, file, v1first)) { if(mp3info(&taginfo, file)) {
if(++steps > playlist_amount()) if(++steps > playlist_amount())
break; break;
continue; continue;
@ -2822,7 +2815,7 @@ void audio_prev(void)
file = playlist_peek(steps); file = playlist_peek(steps);
if(!file) if(!file)
break; break;
if(mp3info(&taginfo, file, v1first)) { if(mp3info(&taginfo, file)) {
steps--; steps--;
continue; continue;
} }

View file

@ -218,9 +218,6 @@ related to audio playback.
set to \setting{Off}. set to \setting{Off}.
} }
\item[ID3 Tag Priority.] Select which version of ID3 tag to use if both are
present.
\item[Auto-Change Directory. ]Control what Rockbox does when it reaches the end \item[Auto-Change Directory. ]Control what Rockbox does when it reaches the end
of a directory. If \setting{Auto-Change Directory} is set to \setting{Yes}, of a directory. If \setting{Auto-Change Directory} is set to \setting{Yes},
Rockbox will continue to the next directory. If Rockbox will continue to the next directory. If