diff options
-rw-r--r-- | apps/lang/english.lang | 10 | ||||
-rw-r--r-- | apps/recorder/recording.c | 31 | ||||
-rw-r--r-- | firmware/export/mpeg.h | 2 | ||||
-rw-r--r-- | firmware/mpeg.c | 23 |
4 files changed, 26 insertions, 40 deletions
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 7ab205f9f7..c1541cf947 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -1366,3 +1366,13 @@ id: LANG_ID3_NO_INFO | |||
1366 | desc: ID3 info is missing | 1366 | desc: ID3 info is missing |
1367 | eng: "<no info>" | 1367 | eng: "<no info>" |
1368 | new: | 1368 | new: |
1369 | |||
1370 | id: LANG_RECORDING_TIME | ||
1371 | desc: Display of recorded time | ||
1372 | eng: "Time:" | ||
1373 | new: | ||
1374 | |||
1375 | id: LANG_RECORDING_SIZE | ||
1376 | desc: Display of recorded file size | ||
1377 | eng: "Size:" | ||
1378 | new: | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index e301cd322e..0e78b2c66b 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -125,16 +125,6 @@ void adjust_cursor(void) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | unsigned int frame_times[] = | ||
129 | { | ||
130 | 2612, /* 44.1kHz */ | ||
131 | 2400, /* 48kHz */ | ||
132 | 3600, /* 32kHz */ | ||
133 | 2612, /* 22.05kHz */ | ||
134 | 2400, /* 24kHz */ | ||
135 | 3200 /* 16kHz */ | ||
136 | }; | ||
137 | |||
138 | static char *create_filename(void) | 128 | static char *create_filename(void) |
139 | { | 129 | { |
140 | static char fname[32]; | 130 | static char fname[32]; |
@@ -165,7 +155,6 @@ bool recording_screen(void) | |||
165 | unsigned long seconds; | 155 | unsigned long seconds; |
166 | unsigned long last_seconds = 0; | 156 | unsigned long last_seconds = 0; |
167 | int hours, minutes; | 157 | int hours, minutes; |
168 | unsigned long val; | ||
169 | 158 | ||
170 | cursor = 0; | 159 | cursor = 0; |
171 | mpeg_init_recording(); | 160 | mpeg_init_recording(); |
@@ -349,9 +338,7 @@ bool recording_screen(void) | |||
349 | { | 338 | { |
350 | timeout = current_tick + HZ/10; | 339 | timeout = current_tick + HZ/10; |
351 | 340 | ||
352 | seconds = mpeg_num_recorded_frames(); | 341 | seconds = mpeg_recorded_time() / HZ; |
353 | seconds *= frame_times[global_settings.rec_frequency]; | ||
354 | seconds /= 100000; | ||
355 | 342 | ||
356 | update_countdown--; | 343 | update_countdown--; |
357 | if(update_countdown == 0 || seconds > last_seconds) | 344 | if(update_countdown == 0 || seconds > last_seconds) |
@@ -361,19 +348,17 @@ bool recording_screen(void) | |||
361 | 348 | ||
362 | lcd_clear_display(); | 349 | lcd_clear_display(); |
363 | 350 | ||
364 | /* DEBUG: Read the current frame */ | ||
365 | mas_readmem(MAS_BANK_D0, 0xfd0, &val, 1); | ||
366 | |||
367 | snprintf(buf, 32, "%05x:%05x:%05x", | ||
368 | mpeg_num_recorded_frames(), val, record_start_frame); | ||
369 | lcd_puts(0, 0, buf); | ||
370 | |||
371 | hours = seconds / 3600; | 351 | hours = seconds / 3600; |
372 | minutes = (seconds - (hours * 3600)) / 60; | 352 | minutes = (seconds - (hours * 3600)) / 60; |
373 | snprintf(buf, 32, "%02d:%02d:%02d %s", | 353 | snprintf(buf, 32, "%s %02d:%02d:%02d", |
374 | hours, minutes, seconds%60, | 354 | str(LANG_RECORDING_TIME), |
355 | hours, minutes, seconds%60); | ||
356 | lcd_puts(0, 0, buf); | ||
357 | |||
358 | snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE), | ||
375 | num2max5(mpeg_num_recorded_bytes(), buf2)); | 359 | num2max5(mpeg_num_recorded_bytes(), buf2)); |
376 | lcd_puts(0, 1, buf); | 360 | lcd_puts(0, 1, buf); |
361 | |||
377 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); | 362 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); |
378 | 363 | ||
379 | /* Show mic gain if input source is Mic */ | 364 | /* Show mic gain if input source is Mic */ |
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index 9b7388c544..69bacc5c7b 100644 --- a/firmware/export/mpeg.h +++ b/firmware/export/mpeg.h | |||
@@ -85,7 +85,7 @@ void mpeg_record(char *filename); | |||
85 | void mpeg_set_recording_options(int frequency, int quality, | 85 | void mpeg_set_recording_options(int frequency, int quality, |
86 | int source, int channel_mode); | 86 | int source, int channel_mode); |
87 | void mpeg_set_recording_gain(int left, int right, int mic); | 87 | void mpeg_set_recording_gain(int left, int right, int mic); |
88 | unsigned long mpeg_num_recorded_frames(void); | 88 | unsigned long mpeg_recorded_time(void); |
89 | unsigned long mpeg_num_recorded_bytes(void); | 89 | unsigned long mpeg_num_recorded_bytes(void); |
90 | #endif | 90 | #endif |
91 | void mpeg_get_debugdata(struct mpeg_debug *dbgdata); | 91 | void mpeg_get_debugdata(struct mpeg_debug *dbgdata); |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index d86b51fbd3..0518dd24e0 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -482,8 +482,8 @@ static int lowest_watermark_level; /* Debug value to observe the buffer | |||
482 | #ifdef HAVE_MAS3587F | 482 | #ifdef HAVE_MAS3587F |
483 | static bool is_recording; /* We are recording */ | 483 | static bool is_recording; /* We are recording */ |
484 | static bool stop_pending; | 484 | static bool stop_pending; |
485 | unsigned long record_start_frame; /* Frame number where | 485 | unsigned long record_start_time; /* Value of current_tick when recording |
486 | recording started */ | 486 | was started */ |
487 | static bool saving; /* We are saving the buffer to disk */ | 487 | static bool saving; /* We are saving the buffer to disk */ |
488 | #endif | 488 | #endif |
489 | 489 | ||
@@ -2133,7 +2133,6 @@ static void init_playback(void) | |||
2133 | void mpeg_record(char *filename) | 2133 | void mpeg_record(char *filename) |
2134 | { | 2134 | { |
2135 | num_rec_bytes = 0; | 2135 | num_rec_bytes = 0; |
2136 | is_recording = true; | ||
2137 | queue_post(&mpeg_queue, MPEG_RECORD, (void*)filename); | 2136 | queue_post(&mpeg_queue, MPEG_RECORD, (void*)filename); |
2138 | } | 2137 | } |
2139 | 2138 | ||
@@ -2155,9 +2154,10 @@ static void start_recording(void) | |||
2155 | 2154 | ||
2156 | sleep(20); | 2155 | sleep(20); |
2157 | 2156 | ||
2158 | /* Read the current frame */ | 2157 | /* Store the current time */ |
2159 | mas_readmem(MAS_BANK_D0, 0xfd0, &record_start_frame, 1); | 2158 | record_start_time = current_tick; |
2160 | 2159 | ||
2160 | is_recording = true; | ||
2161 | stop_pending = false; | 2161 | stop_pending = false; |
2162 | saving = false; | 2162 | saving = false; |
2163 | } | 2163 | } |
@@ -2182,21 +2182,12 @@ static void stop_recording(void) | |||
2182 | drain_dma_buffer(); | 2182 | drain_dma_buffer(); |
2183 | } | 2183 | } |
2184 | 2184 | ||
2185 | unsigned long mpeg_num_recorded_frames(void) | 2185 | unsigned long mpeg_recorded_time(void) |
2186 | { | 2186 | { |
2187 | unsigned long val; | ||
2188 | |||
2189 | if(is_recording) | 2187 | if(is_recording) |
2190 | { | 2188 | return current_tick - record_start_time; |
2191 | /* Read the current frame */ | ||
2192 | mas_readmem(MAS_BANK_D0, 0xfd0, &val, 1); | ||
2193 | |||
2194 | return val - record_start_frame; | ||
2195 | } | ||
2196 | else | 2189 | else |
2197 | { | ||
2198 | return 0; | 2190 | return 0; |
2199 | } | ||
2200 | } | 2191 | } |
2201 | 2192 | ||
2202 | unsigned long mpeg_num_recorded_bytes(void) | 2193 | unsigned long mpeg_num_recorded_bytes(void) |