summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-20 00:02:52 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-20 00:02:52 +0000
commit6100dd099b870deb657372503aa8d0e673a315a6 (patch)
tree72e5acef16e02ff6e866ba1674628744d6da476e
parentd3d1583adbb1489e6d6e6c38dd018c77c0cfdcc1 (diff)
downloadrockbox-6100dd099b870deb657372503aa8d0e673a315a6.tar.gz
rockbox-6100dd099b870deb657372503aa8d0e673a315a6.zip
New filename generation based on date/time
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2863 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/recording.c22
-rw-r--r--firmware/mpeg.c2
2 files changed, 21 insertions, 3 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 491907666f..7a1a47f842 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -37,6 +37,8 @@
37#include "status.h" 37#include "status.h"
38#include "menu.h" 38#include "menu.h"
39#include "sound_menu.h" 39#include "sound_menu.h"
40#include "timefuncs.h"
41#include "debug.h"
40 42
41bool f2_rec_screen(void); 43bool f2_rec_screen(void);
42bool f3_rec_screen(void); 44bool f3_rec_screen(void);
@@ -129,6 +131,22 @@ unsigned int frame_times[] =
129 3200 /* 16kHz */ 131 3200 /* 16kHz */
130}; 132};
131 133
134static char *create_filename(void)
135{
136 static char fname[32];
137 struct tm * tm;
138
139 tm = get_time();
140
141 /* Create a filename: RYYMMDDHHMMSS.mp3 */
142 snprintf(fname, 32, "/R%02d%02d%02d%02d%02d%02d.mp3",
143 tm->tm_year-2000, tm->tm_mon, tm->tm_mday,
144 tm->tm_hour, tm->tm_min, tm->tm_sec);
145
146 DEBUGF("Filename: %s\n", fname);
147 return fname;
148}
149
132bool recording_screen(void) 150bool recording_screen(void)
133{ 151{
134 int button; 152 int button;
@@ -164,7 +182,7 @@ bool recording_screen(void)
164 lcd_setfont(FONT_UI); 182 lcd_setfont(FONT_UI);
165 lcd_getstringsize("M", &w, &h); 183 lcd_getstringsize("M", &w, &h);
166 lcd_setmargins(w, 8); 184 lcd_setmargins(w, 8);
167 185
168 while(!done) 186 while(!done)
169 { 187 {
170 button = button_get(false); 188 button = button_get(false);
@@ -190,7 +208,7 @@ bool recording_screen(void)
190 if(!mpeg_status()) 208 if(!mpeg_status())
191 { 209 {
192 have_recorded = true; 210 have_recorded = true;
193 mpeg_record(""); 211 mpeg_record(create_filename());
194 status_set_playmode(STATUS_RECORD); 212 status_set_playmode(STATUS_RECORD);
195 update_countdown = 1; /* Update immediately */ 213 update_countdown = 1; /* Update immediately */
196 last_seconds = 0; 214 last_seconds = 0;
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index dfd2785356..727e81b16e 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1598,7 +1598,7 @@ static void mpeg_thread(void)
1598 { 1598 {
1599 case MPEG_RECORD: 1599 case MPEG_RECORD:
1600 DEBUGF("Recording...\n"); 1600 DEBUGF("Recording...\n");
1601 mpeg_file = open("/RECORD.MP3", 1601 mpeg_file = open((char *)ev.data,
1602 O_WRONLY | O_TRUNC | O_CREAT); 1602 O_WRONLY | O_TRUNC | O_CREAT);
1603 if(mpeg_file < 0) 1603 if(mpeg_file < 0)
1604 panicf("recfile: %d", mpeg_file); 1604 panicf("recfile: %d", mpeg_file);