From 031e4b873856e1b018312c678c66744da3300254 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 4 Jun 2005 12:14:46 +0000 Subject: New recording feature: Don't split every 24 hours if timesplit is off, but only split when the filesize approaches the 2GB limit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6562 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/recording.c | 10 ++++++++-- apps/settings.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index d443f62..111995c 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -92,6 +92,8 @@ bool f3_rec_screen(void); #define SOURCE_LINE 1 #define SOURCE_SPDIF 2 +#define MAX_FILE_SIZE 0x7FF00000 /* 2 GB - 1 MB */ + const char* const freq_str[6] = { "44.1kHz", @@ -670,6 +672,7 @@ bool recording_screen(void) if(update_countdown == 0 || seconds > last_seconds) { unsigned int dseconds, dhours, dminutes; + unsigned long num_recorded_bytes; int pos = 0; update_countdown = 5; @@ -685,6 +688,7 @@ bool recording_screen(void) lcd_puts(0, 0, buf); dseconds = rec_timesplit_seconds(); + num_recorded_bytes = mpeg_num_recorded_bytes(); if(audio_stat & AUDIO_STATUS_PRERECORD) { @@ -708,7 +712,7 @@ bool recording_screen(void) else { output_dyn_value(buf2, sizeof buf2, - mpeg_num_recorded_bytes(), + num_recorded_bytes, byte_units, true); snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), buf2); @@ -719,7 +723,9 @@ bool recording_screen(void) /* We will do file splitting regardless, since the OFF setting really means 24 hours. This is to make sure that the recorded files don't get too big. */ - if (audio_stat && (seconds >= dseconds)) + if (audio_stat && + ((global_settings.rec_timesplit && (seconds >= dseconds)) + || (num_recorded_bytes >= MAX_FILE_SIZE))) { mpeg_new_file(rec_create_filename(path_buffer)); update_countdown = 1; diff --git a/apps/settings.c b/apps/settings.c index 4f09f93..03b2dc5 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1532,7 +1532,7 @@ bool set_option(const char* string, void* variable, enum optiontype type, /* This array holds the record timer interval lengths, in seconds */ static const unsigned long rec_timer_seconds[] = { - 24L*60*60, /* OFF really means 24 hours, to avoid >2Gbyte files */ + 0, /* 0 means OFF */ 5*60, /* 00:05 */ 10*60, /* 00:10 */ 15*60, /* 00:15 */ -- cgit v1.1