summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-02-14 02:48:12 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-02-14 02:48:12 +0000
commit1fcd31d3ff0e8f2acf2351252b836239cc78a670 (patch)
tree7a710721c05da96f3342d699376adaaf06985f81
parentebe0752469021dfb09f2fb2b0752e192833e9f23 (diff)
downloadrockbox-1fcd31d3ff0e8f2acf2351252b836239cc78a670.zip
rockbox-1fcd31d3ff0e8f2acf2351252b836239cc78a670.tar.gz
rockbox-1fcd31d3ff0e8f2acf2351252b836239cc78a670.tar.bz2
rockbox-1fcd31d3ff0e8f2acf2351252b836239cc78a670.tar.xz
Fixed the 3-hour time display bug, plus some cosmetic changes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3253 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/lang/english.lang10
-rw-r--r--apps/recorder/recording.c31
-rw-r--r--firmware/export/mpeg.h2
-rw-r--r--firmware/mpeg.c23
4 files changed, 26 insertions, 40 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 7ab205f..c1541cf 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -1366,3 +1366,13 @@ id: LANG_ID3_NO_INFO
desc: ID3 info is missing
eng: "<no info>"
new:
+
+id: LANG_RECORDING_TIME
+desc: Display of recorded time
+eng: "Time:"
+new:
+
+id: LANG_RECORDING_SIZE
+desc: Display of recorded file size
+eng: "Size:"
+new:
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index e301cd3..0e78b2c 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -125,16 +125,6 @@ void adjust_cursor(void)
}
}
-unsigned int frame_times[] =
-{
- 2612, /* 44.1kHz */
- 2400, /* 48kHz */
- 3600, /* 32kHz */
- 2612, /* 22.05kHz */
- 2400, /* 24kHz */
- 3200 /* 16kHz */
-};
-
static char *create_filename(void)
{
static char fname[32];
@@ -165,7 +155,6 @@ bool recording_screen(void)
unsigned long seconds;
unsigned long last_seconds = 0;
int hours, minutes;
- unsigned long val;
cursor = 0;
mpeg_init_recording();
@@ -349,9 +338,7 @@ bool recording_screen(void)
{
timeout = current_tick + HZ/10;
- seconds = mpeg_num_recorded_frames();
- seconds *= frame_times[global_settings.rec_frequency];
- seconds /= 100000;
+ seconds = mpeg_recorded_time() / HZ;
update_countdown--;
if(update_countdown == 0 || seconds > last_seconds)
@@ -361,19 +348,17 @@ bool recording_screen(void)
lcd_clear_display();
- /* DEBUG: Read the current frame */
- mas_readmem(MAS_BANK_D0, 0xfd0, &val, 1);
-
- snprintf(buf, 32, "%05x:%05x:%05x",
- mpeg_num_recorded_frames(), val, record_start_frame);
- lcd_puts(0, 0, buf);
-
hours = seconds / 3600;
minutes = (seconds - (hours * 3600)) / 60;
- snprintf(buf, 32, "%02d:%02d:%02d %s",
- hours, minutes, seconds%60,
+ snprintf(buf, 32, "%s %02d:%02d:%02d",
+ str(LANG_RECORDING_TIME),
+ hours, minutes, seconds%60);
+ lcd_puts(0, 0, buf);
+
+ snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE),
num2max5(mpeg_num_recorded_bytes(), buf2));
lcd_puts(0, 1, buf);
+
peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
/* Show mic gain if input source is Mic */
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index 9b7388c..69bacc5 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -85,7 +85,7 @@ void mpeg_record(char *filename);
void mpeg_set_recording_options(int frequency, int quality,
int source, int channel_mode);
void mpeg_set_recording_gain(int left, int right, int mic);
-unsigned long mpeg_num_recorded_frames(void);
+unsigned long mpeg_recorded_time(void);
unsigned long mpeg_num_recorded_bytes(void);
#endif
void mpeg_get_debugdata(struct mpeg_debug *dbgdata);
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index d86b51f..0518dd2 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -482,8 +482,8 @@ static int lowest_watermark_level; /* Debug value to observe the buffer
#ifdef HAVE_MAS3587F
static bool is_recording; /* We are recording */
static bool stop_pending;
-unsigned long record_start_frame; /* Frame number where
- recording started */
+unsigned long record_start_time; /* Value of current_tick when recording
+ was started */
static bool saving; /* We are saving the buffer to disk */
#endif
@@ -2133,7 +2133,6 @@ static void init_playback(void)
void mpeg_record(char *filename)
{
num_rec_bytes = 0;
- is_recording = true;
queue_post(&mpeg_queue, MPEG_RECORD, (void*)filename);
}
@@ -2155,9 +2154,10 @@ static void start_recording(void)
sleep(20);
- /* Read the current frame */
- mas_readmem(MAS_BANK_D0, 0xfd0, &record_start_frame, 1);
+ /* Store the current time */
+ record_start_time = current_tick;
+ is_recording = true;
stop_pending = false;
saving = false;
}
@@ -2182,21 +2182,12 @@ static void stop_recording(void)
drain_dma_buffer();
}
-unsigned long mpeg_num_recorded_frames(void)
+unsigned long mpeg_recorded_time(void)
{
- unsigned long val;
-
if(is_recording)
- {
- /* Read the current frame */
- mas_readmem(MAS_BANK_D0, 0xfd0, &val, 1);
-
- return val - record_start_frame;
- }
+ return current_tick - record_start_time;
else
- {
return 0;
- }
}
unsigned long mpeg_num_recorded_bytes(void)