1
0
Fork 0
forked from len0rd/rockbox

New filename generation based on date/time

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2863 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-11-20 00:02:52 +00:00
parent d3d1583adb
commit 6100dd099b
2 changed files with 21 additions and 3 deletions

View file

@ -37,6 +37,8 @@
#include "status.h" #include "status.h"
#include "menu.h" #include "menu.h"
#include "sound_menu.h" #include "sound_menu.h"
#include "timefuncs.h"
#include "debug.h"
bool f2_rec_screen(void); bool f2_rec_screen(void);
bool f3_rec_screen(void); bool f3_rec_screen(void);
@ -129,6 +131,22 @@ unsigned int frame_times[] =
3200 /* 16kHz */ 3200 /* 16kHz */
}; };
static char *create_filename(void)
{
static char fname[32];
struct tm * tm;
tm = get_time();
/* Create a filename: RYYMMDDHHMMSS.mp3 */
snprintf(fname, 32, "/R%02d%02d%02d%02d%02d%02d.mp3",
tm->tm_year-2000, tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
DEBUGF("Filename: %s\n", fname);
return fname;
}
bool recording_screen(void) bool recording_screen(void)
{ {
int button; int button;
@ -164,7 +182,7 @@ bool recording_screen(void)
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
lcd_getstringsize("M", &w, &h); lcd_getstringsize("M", &w, &h);
lcd_setmargins(w, 8); lcd_setmargins(w, 8);
while(!done) while(!done)
{ {
button = button_get(false); button = button_get(false);
@ -190,7 +208,7 @@ bool recording_screen(void)
if(!mpeg_status()) if(!mpeg_status())
{ {
have_recorded = true; have_recorded = true;
mpeg_record(""); mpeg_record(create_filename());
status_set_playmode(STATUS_RECORD); status_set_playmode(STATUS_RECORD);
update_countdown = 1; /* Update immediately */ update_countdown = 1; /* Update immediately */
last_seconds = 0; last_seconds = 0;

View file

@ -1598,7 +1598,7 @@ static void mpeg_thread(void)
{ {
case MPEG_RECORD: case MPEG_RECORD:
DEBUGF("Recording...\n"); DEBUGF("Recording...\n");
mpeg_file = open("/RECORD.MP3", mpeg_file = open((char *)ev.data,
O_WRONLY | O_TRUNC | O_CREAT); O_WRONLY | O_TRUNC | O_CREAT);
if(mpeg_file < 0) if(mpeg_file < 0)
panicf("recfile: %d", mpeg_file); panicf("recfile: %d", mpeg_file);