summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-08-14 13:19:22 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-08-14 13:19:22 +0000
commit49180592255f31ed9fb973f251365708e6e39b3a (patch)
tree441848c8886cdb922400f8d480f92e85567548f7
parentee44c8da529e3491d0aba9bbdbc6fd1bc379f8a3 (diff)
downloadrockbox-49180592255f31ed9fb973f251365708e6e39b3a.tar.gz
rockbox-49180592255f31ed9fb973f251365708e6e39b3a.zip
properties plugin: Make the ID3 info available on HWCODEC targets too.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14334 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/properties.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index b2dcc4beca..932e5bc71e 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -34,11 +34,9 @@ char str_filecount[64];
34char str_date[64]; 34char str_date[64];
35char str_time[64]; 35char str_time[64];
36 36
37#if (CONFIG_CODEC == SWCODEC)
38char str_title[MAX_PATH]; 37char str_title[MAX_PATH];
39char str_artist[MAX_PATH]; 38char str_artist[MAX_PATH];
40char str_album[MAX_PATH]; 39char str_album[MAX_PATH];
41#endif
42 40
43int num_properties; 41int num_properties;
44 42
@@ -69,6 +67,7 @@ static bool file_properties(char* selected_file)
69 char tstr[MAX_PATH]; 67 char tstr[MAX_PATH];
70 DIR* dir; 68 DIR* dir;
71 struct dirent* entry; 69 struct dirent* entry;
70 struct mp3entry id3;
72 71
73 char* ptr = rb->strrchr(selected_file, '/') + 1; 72 char* ptr = rb->strrchr(selected_file, '/') + 1;
74 int dirlen = (ptr - selected_file); 73 int dirlen = (ptr - selected_file);
@@ -99,24 +98,24 @@ static bool file_properties(char* selected_file)
99 num_properties = 5; 98 num_properties = 5;
100 99
101#if (CONFIG_CODEC == SWCODEC) 100#if (CONFIG_CODEC == SWCODEC)
102 struct mp3entry id3;
103 int fd = rb->open(selected_file, O_RDONLY); 101 int fd = rb->open(selected_file, O_RDONLY);
104 if (fd >= 0) 102 if (fd >= 0 &&
103 rb->get_metadata(&id3, fd, selected_file, false))
104#else
105 if (!rb->mp3info(&id3, selected_file, false))
106#endif
105 { 107 {
106 if (rb->get_metadata(&id3, fd, selected_file, false)) 108 rb->snprintf(str_artist, sizeof str_artist,
107 { 109 "Artist: %s", id3.artist ? id3.artist : "");
108 rb->snprintf(str_artist, sizeof str_artist, 110 rb->snprintf(str_title, sizeof str_title,
109 "Artist: %s", id3.artist ? id3.artist : ""); 111 "Title: %s", id3.title ? id3.title : "");
110 rb->snprintf(str_title, sizeof str_title, 112 rb->snprintf(str_album, sizeof str_album,
111 "Title: %s", id3.title ? id3.title : ""); 113 "Album: %s", id3.album ? id3.album : "");
112 rb->snprintf(str_album, sizeof str_album, 114 num_properties += 3;
113 "Album: %s", id3.album ? id3.album : "");
114 num_properties += 3;
115 }
116 rb->close(fd);
117 } 115 }
116#if (CONFIG_CODEC == SWCODEC)
117 rb->close(fd);
118#endif 118#endif
119
120 found = true; 119 found = true;
121 break; 120 break;
122 } 121 }
@@ -236,7 +235,6 @@ char * get_props(int selected_item, void* data, char *buffer)
236 case 4: 235 case 4:
237 rb->strcpy(buffer, its_a_dir ? "" : str_time); 236 rb->strcpy(buffer, its_a_dir ? "" : str_time);
238 break; 237 break;
239#if (CONFIG_CODEC == SWCODEC)
240 case 5: 238 case 5:
241 rb->strcpy(buffer, its_a_dir ? "" : str_artist); 239 rb->strcpy(buffer, its_a_dir ? "" : str_artist);
242 break; 240 break;
@@ -246,7 +244,6 @@ char * get_props(int selected_item, void* data, char *buffer)
246 case 7: 244 case 7:
247 rb->strcpy(buffer, its_a_dir ? "" : str_album); 245 rb->strcpy(buffer, its_a_dir ? "" : str_album);
248 break; 246 break;
249#endif
250 default: 247 default:
251 rb->strcpy(buffer, "ERROR"); 248 rb->strcpy(buffer, "ERROR");
252 break; 249 break;