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
This commit is contained in:
Linus Nielsen Feltzing 2003-02-14 02:48:12 +00:00
parent ebe0752469
commit 1fcd31d3ff
4 changed files with 26 additions and 40 deletions

View file

@ -1366,3 +1366,13 @@ id: LANG_ID3_NO_INFO
desc: ID3 info is missing desc: ID3 info is missing
eng: "<no info>" eng: "<no info>"
new: 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:

View file

@ -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 *create_filename(void)
{ {
static char fname[32]; static char fname[32];
@ -165,7 +155,6 @@ bool recording_screen(void)
unsigned long seconds; unsigned long seconds;
unsigned long last_seconds = 0; unsigned long last_seconds = 0;
int hours, minutes; int hours, minutes;
unsigned long val;
cursor = 0; cursor = 0;
mpeg_init_recording(); mpeg_init_recording();
@ -349,9 +338,7 @@ bool recording_screen(void)
{ {
timeout = current_tick + HZ/10; timeout = current_tick + HZ/10;
seconds = mpeg_num_recorded_frames(); seconds = mpeg_recorded_time() / HZ;
seconds *= frame_times[global_settings.rec_frequency];
seconds /= 100000;
update_countdown--; update_countdown--;
if(update_countdown == 0 || seconds > last_seconds) if(update_countdown == 0 || seconds > last_seconds)
@ -361,19 +348,17 @@ bool recording_screen(void)
lcd_clear_display(); 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; hours = seconds / 3600;
minutes = (seconds - (hours * 3600)) / 60; minutes = (seconds - (hours * 3600)) / 60;
snprintf(buf, 32, "%02d:%02d:%02d %s", snprintf(buf, 32, "%s %02d:%02d:%02d",
hours, minutes, seconds%60, 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)); num2max5(mpeg_num_recorded_bytes(), buf2));
lcd_puts(0, 1, buf); lcd_puts(0, 1, buf);
peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
/* Show mic gain if input source is Mic */ /* Show mic gain if input source is Mic */

View file

@ -85,7 +85,7 @@ void mpeg_record(char *filename);
void mpeg_set_recording_options(int frequency, int quality, void mpeg_set_recording_options(int frequency, int quality,
int source, int channel_mode); int source, int channel_mode);
void mpeg_set_recording_gain(int left, int right, int mic); 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); unsigned long mpeg_num_recorded_bytes(void);
#endif #endif
void mpeg_get_debugdata(struct mpeg_debug *dbgdata); void mpeg_get_debugdata(struct mpeg_debug *dbgdata);

View file

@ -482,8 +482,8 @@ static int lowest_watermark_level; /* Debug value to observe the buffer
#ifdef HAVE_MAS3587F #ifdef HAVE_MAS3587F
static bool is_recording; /* We are recording */ static bool is_recording; /* We are recording */
static bool stop_pending; static bool stop_pending;
unsigned long record_start_frame; /* Frame number where unsigned long record_start_time; /* Value of current_tick when recording
recording started */ was started */
static bool saving; /* We are saving the buffer to disk */ static bool saving; /* We are saving the buffer to disk */
#endif #endif
@ -2133,7 +2133,6 @@ static void init_playback(void)
void mpeg_record(char *filename) void mpeg_record(char *filename)
{ {
num_rec_bytes = 0; num_rec_bytes = 0;
is_recording = true;
queue_post(&mpeg_queue, MPEG_RECORD, (void*)filename); queue_post(&mpeg_queue, MPEG_RECORD, (void*)filename);
} }
@ -2155,9 +2154,10 @@ static void start_recording(void)
sleep(20); sleep(20);
/* Read the current frame */ /* Store the current time */
mas_readmem(MAS_BANK_D0, 0xfd0, &record_start_frame, 1); record_start_time = current_tick;
is_recording = true;
stop_pending = false; stop_pending = false;
saving = false; saving = false;
} }
@ -2182,22 +2182,13 @@ static void stop_recording(void)
drain_dma_buffer(); drain_dma_buffer();
} }
unsigned long mpeg_num_recorded_frames(void) unsigned long mpeg_recorded_time(void)
{ {
unsigned long val;
if(is_recording) if(is_recording)
{ return current_tick - record_start_time;
/* Read the current frame */
mas_readmem(MAS_BANK_D0, 0xfd0, &val, 1);
return val - record_start_frame;
}
else else
{
return 0; return 0;
} }
}
unsigned long mpeg_num_recorded_bytes(void) unsigned long mpeg_num_recorded_bytes(void)
{ {