forked from len0rd/rockbox
Repair the no-spinup on start/split feature of recording. Recording directory selection broke it. Please only look at the disk during encoder loading opportunities in future additions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15853 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
655fa16a9d
commit
b0dd9eb5bc
1 changed files with 40 additions and 30 deletions
|
@ -592,17 +592,6 @@ static void adjust_cursor(void)
|
||||||
cursor = max_cursor;
|
cursor = max_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool check_dir(const char *folder)
|
|
||||||
{
|
|
||||||
if (strcmp(folder, "/") && !dir_exists(folder))
|
|
||||||
{
|
|
||||||
int rc = mkdir(folder);
|
|
||||||
if(rc < 0)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the list below must match enum audio_sources in audio.h */
|
/* the list below must match enum audio_sources in audio.h */
|
||||||
static const char* const prestr[] =
|
static const char* const prestr[] =
|
||||||
{
|
{
|
||||||
|
@ -617,15 +606,15 @@ char *rec_create_filename(char *buffer)
|
||||||
char ext[16];
|
char ext[16];
|
||||||
const char *pref = "R_";
|
const char *pref = "R_";
|
||||||
|
|
||||||
strcpy(buffer,global_settings.rec_directory);
|
/* Directory existence and writeablility should have already been
|
||||||
if (!check_dir(buffer))
|
* verified - do not pass NULL pointers to pcmrec */
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if((global_settings.rec_source > AUDIO_SRC_PLAYBACK) &&
|
if((unsigned)global_settings.rec_source < AUDIO_NUM_SOURCES)
|
||||||
(global_settings.rec_source < AUDIO_NUM_SOURCES))
|
|
||||||
{
|
{
|
||||||
pref = prestr[global_settings.rec_source];
|
pref = prestr[global_settings.rec_source];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strcpy(buffer, global_settings.rec_directory);
|
||||||
|
|
||||||
snprintf(ext, sizeof(ext), ".%s",
|
snprintf(ext, sizeof(ext), ".%s",
|
||||||
REC_FILE_ENDING(global_settings.rec_format));
|
REC_FILE_ENDING(global_settings.rec_format));
|
||||||
|
@ -652,7 +641,30 @@ static void rec_init_filename(void)
|
||||||
|
|
||||||
int rec_create_directory(void)
|
int rec_create_directory(void)
|
||||||
{
|
{
|
||||||
return check_dir(global_settings.rec_directory)?1:0;
|
int rc = 0;
|
||||||
|
const char * const folder = global_settings.rec_directory;
|
||||||
|
|
||||||
|
if (strcmp(folder, "/") && !dir_exists(folder))
|
||||||
|
{
|
||||||
|
rc = mkdir(folder);
|
||||||
|
|
||||||
|
if(rc < 0)
|
||||||
|
{
|
||||||
|
while (action_userabort(HZ) == false)
|
||||||
|
{
|
||||||
|
gui_syncsplash(0, "%s %s",
|
||||||
|
str(LANG_REC_DIR_NOT_WRITABLE),
|
||||||
|
str(LANG_OFF_ABORT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rec_status |= RCSTAT_CREATED_DIRECTORY;
|
||||||
|
rc = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rec_init_recording_options(struct audio_recording_options *options)
|
void rec_init_recording_options(struct audio_recording_options *options)
|
||||||
|
@ -872,17 +884,14 @@ bool recording_screen(bool no_source)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct audio_recording_options rec_options;
|
struct audio_recording_options rec_options;
|
||||||
if (check_dir(global_settings.rec_directory) == false)
|
rec_status = RCSTAT_IN_RECSCREEN;
|
||||||
|
|
||||||
|
if (rec_create_directory() < 0)
|
||||||
{
|
{
|
||||||
do {
|
rec_status = 0;
|
||||||
gui_syncsplash(0, "%s %s",
|
|
||||||
str(LANG_REC_DIR_NOT_WRITABLE),
|
|
||||||
str(LANG_OFF_ABORT));
|
|
||||||
} while (action_userabort(HZ) == false);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rec_status = RCSTAT_IN_RECSCREEN;
|
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
||||||
ata_set_led_enabled(false);
|
ata_set_led_enabled(false);
|
||||||
|
@ -911,9 +920,6 @@ bool recording_screen(bool no_source)
|
||||||
|
|
||||||
set_gain();
|
set_gain();
|
||||||
|
|
||||||
if(rec_create_directory() > 0)
|
|
||||||
rec_status |= RCSTAT_CREATED_DIRECTORY;
|
|
||||||
|
|
||||||
#if CONFIG_RTC == 0
|
#if CONFIG_RTC == 0
|
||||||
/* Create new filename for recording start */
|
/* Create new filename for recording start */
|
||||||
rec_init_filename();
|
rec_init_filename();
|
||||||
|
@ -1320,8 +1326,10 @@ bool recording_screen(bool no_source)
|
||||||
rec_init_recording_options(&rec_options);
|
rec_init_recording_options(&rec_options);
|
||||||
rec_set_recording_options(&rec_options);
|
rec_set_recording_options(&rec_options);
|
||||||
|
|
||||||
if(rec_create_directory() > 0)
|
if(rec_create_directory() < 0)
|
||||||
rec_status |= RCSTAT_CREATED_DIRECTORY;
|
{
|
||||||
|
goto rec_abort;
|
||||||
|
}
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC && CONFIG_RTC == 0
|
#if CONFIG_CODEC == SWCODEC && CONFIG_RTC == 0
|
||||||
/* If format changed, a new number is required */
|
/* If format changed, a new number is required */
|
||||||
|
@ -1861,6 +1869,8 @@ bool recording_screen(bool no_source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rec_abort:
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
rec_command(RECORDING_CMD_STOP);
|
rec_command(RECORDING_CMD_STOP);
|
||||||
audio_close_recording();
|
audio_close_recording();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue