Index: apps/recorder/recording.c
===================================================================
--- apps/recorder/recording.c (revision 13509)
+++ apps/recorder/recording.c (working copy)
@@ -503,11 +503,13 @@
{
char ext[16];
- if(global_settings.rec_directory)
- getcwd(buffer, MAX_PATH);
+ if (global_settings.rec_directory[0])
+ {
+ strncpy(buffer, global_settings.rec_directory, MAX_PATH);
+ }
else
- strncpy(buffer, rec_base_directory, MAX_PATH);
-
+ strncpy(buffer, REC_BASE_DIR, MAX_PATH);
+
snprintf(ext, sizeof(ext), ".%s",
REC_FILE_ENDING(global_settings.rec_format));
@@ -524,26 +526,33 @@
int rec_create_directory(void)
{
int rc;
+ char *folder;
+ /* Try to create the base directory if needed */
+ if (global_settings.rec_directory[0])
+ folder = global_settings.rec_directory;
+ else
+ folder = REC_BASE_DIR;
- /* Try to create the base directory if needed */
- if(global_settings.rec_directory == 0)
+ rc = mkdir(folder);
+ if(rc < 0 && errno != EEXIST)
{
- rc = mkdir(rec_base_directory);
- if(rc < 0 && errno != EEXIST)
- {
- gui_syncsplash(HZ * 2,
- "Can't create the %s directory. Error code %d.",
- rec_base_directory, rc);
- return -1;
- }
- else
- {
- /* If we have created the directory, we want the dir browser to
- be refreshed even if we haven't recorded anything */
- if(errno != EEXIST)
- return 1;
- }
+ gui_syncsplash(HZ * 2,
+ "Can't create the %s directory. Error code %d.",
+ folder, rc);
+ return -1;
}
+ else
+ {
+ /* If we have created the directory, we want the dir browser to
+ be refreshed even if we haven't recorded anything */
+ DIR* dir;
+ if(errno != EEXIST)
+ return 1;
+ dir = opendir(folder);
+ if (dir == NULL)
+ return 2;
+ closedir(dir);
+ }
return 0;
}
@@ -854,7 +863,18 @@
}
if(rec_create_directory() > 0)
- have_recorded = true;
+ {
+ /* dir doesnt exists and we cant create it */
+ while (!done)
+ {
+ gui_syncsplash(0, "%s %s",
+ str(LANG_REC_DIR_NOT_WRITABLE),
+ str(LANG_OFF_ABORT));
+ done = action_userabort(TIMEOUT_BLOCK);
+ }
+ goto exit_recscreen;
+ }
+
#ifdef HAVE_REMOTE_LCD
if (!remote_display_on)
{
@@ -1742,7 +1762,7 @@
break;
}
}
-
+exit_recscreen:
#if CONFIG_CODEC == SWCODEC
audio_stop_recording();
audio_close_recording();
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 13509)
+++ apps/lang/english.lang (working copy)
@@ -10980,3 +10980,45 @@
*: "List Acceleration Speed"
+
+ id: LANG_SET_AS_REC_DIR
+ desc:
+ user:
+
+ *: "Set As Recording Directory"
+
+
+ *: "Set As Recording Directory"
+
+
+ *: "Set As Recording Directory"
+
+
+
+ id: LANG_CLEAR_REC_DIR
+ desc:
+ user:
+
+ *: "Clear Recording Directory"
+
+
+ *: "Clear Recording Directory"
+
+
+ *: "Clear Recording Directory"
+
+
+
+ id: LANG_REC_DIR_NOT_WRITABLE
+ desc:
+ user:
+
+ *: "Can't write to recording directory"
+
+
+ *: "Can't write to recording directory"
+
+
+ *: "Can't write to recording directory"
+
+
Index: apps/settings.c
===================================================================
--- apps/settings.c (revision 13510)
+++ apps/settings.c (working copy)
@@ -76,9 +76,6 @@
struct user_settings global_settings;
struct system_status global_status;
-#ifdef HAVE_RECORDING
-const char rec_base_directory[] = REC_BASE_DIR;
-#endif
#if CONFIG_CODEC == SWCODEC
#include "pcmbuf.h"
#include "pcm_playback.h"
Index: apps/onplay.c
===================================================================
--- apps/onplay.c (revision 13509)
+++ apps/onplay.c (working copy)
@@ -1043,6 +1043,16 @@
MENUITEM_FUNCTION(set_backdrop_item, 0, ID2P(LANG_SET_AS_BACKDROP),
set_backdrop, NULL, clipboard_callback, Icon_NOICON);
#endif
+#ifdef HAVE_RECORDING
+static bool set_recdir(void)
+{
+ strncpy(global_settings.rec_directory,
+ selected_file, MAX_REC_DIR_PATH);
+ return false;
+}
+MENUITEM_FUNCTION(set_recdir_item, 0, ID2P(LANG_SET_AS_REC_DIR),
+ set_recdir, NULL, clipboard_callback, Icon_Recording);
+#endif
@@ -1090,6 +1100,10 @@
if ((this_item == &delete_dir_item)
)
return action;
+#ifdef HAVE_RECORDING
+ else if (this_item == &set_recdir_item)
+ return action;
+#endif
}
else if (selected_file
#ifdef HAVE_MULTIVOLUME
@@ -1135,7 +1149,10 @@
#if LCD_DEPTH > 1
&set_backdrop_item,
#endif
- &list_viewers_item, &create_dir_item, &properties_item
+ &list_viewers_item, &create_dir_item, &properties_item,
+#ifdef HAVE_RECORDING
+ &set_recdir_item,
+#endif
);
int onplay(char* file, int attr, int from)
{
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 13510)
+++ apps/settings.h (working copy)
@@ -59,7 +59,7 @@
#define PLUGIN_DIR ROCKBOX_DIR "/rocks"
#define VIEWERS_DIR ROCKBOX_DIR "/viewers"
#define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
-#define REC_BASE_DIR "/recordings"
+#define REC_BASE_DIR "/"
#define EQS_DIR ROCKBOX_DIR "/eqs"
#define CODECS_DIR ROCKBOX_DIR "/codecs"
#define RECPRESETS_DIR ROCKBOX_DIR "/recpresets"
@@ -70,8 +70,8 @@
#define FIXEDSETTINGSFILE ROCKBOX_DIR "/fixed.cfg"
#define MAX_FILENAME 32
+#define MAX_REC_DIR_PATH 64
-
#define BOOKMARK_NO 0
#define BOOKMARK_YES 1
#define BOOKMARK_ASK 2
@@ -170,6 +170,7 @@
/* show path types */
enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
+
/* Alarm settings */
#ifdef HAVE_RTC_ALARM
enum { ALARM_START_WPS = 0,
@@ -336,7 +337,7 @@
int crossfade_fade_out_duration; /* Fade out duration (0-15s) */
int crossfade_fade_out_mixmode; /* Fade out mode (0=crossfade,1=mix) */
#endif
-
+#ifdef HAVE_RECORDING
#if CONFIG_CODEC == SWCODEC
int rec_format; /* record format index */
#else
@@ -370,7 +371,8 @@
int rec_split_method; /* time/filesize */
int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
- int rec_directory; /* 0=base dir, 1=current dir */
+ int rec_directory_choice; /* Recording directory enum above.*/
+ char rec_directory[MAX_REC_DIR_PATH];
int cliplight; /* 0 = off
1 = main lcd
2 = main and remote lcd
@@ -403,7 +405,7 @@
int rec_agc_maxgain_line; /* AGC maximum line-in gain */
int rec_agc_cliptime; /* 0.2, 0.4, 0.6, 0.8, 1s */
#endif
-
+#endif /* HAVE_RECORDING */
/* device settings */
#ifdef HAVE_LCD_CONTRAST
@@ -735,8 +737,6 @@
/** global variables **/
extern long lasttime;
-/* Recording base directory */
-extern const char rec_base_directory[];
/* global settings */
extern struct user_settings global_settings;
/* global status */
Index: apps/menus/recording_menu.c
===================================================================
--- apps/menus/recording_menu.c (revision 13510)
+++ apps/menus/recording_menu.c (working copy)
@@ -313,19 +313,16 @@
MENUITEM_SETTING(rec_prerecord_time, &global_settings.rec_prerecord_time, NULL);
-static int recdirectory_func(void)
+
+static int clear_rec_directory(void)
{
- static const struct opt_items names[] = {
- { rec_base_directory, -1 },
- { STR(LANG_RECORD_CURRENT_DIR) }
- };
- return set_option(str(LANG_RECORD_DIRECTORY),
- &global_settings.rec_directory, INT,
- names, 2, NULL );
+ global_settings.rec_directory[0] = '\0';
+ gui_syncsplash(HZ, str(LANG_RESET_DONE_CLEAR));
+ return false;
}
-MENUITEM_FUNCTION(recdirectory, 0, ID2P(LANG_RECORD_DIRECTORY),
- recdirectory_func, NULL, NULL, Icon_Menu_setting);
-
+MENUITEM_FUNCTION(clear_rec_directory_item, 0, ID2P(LANG_CLEAR_REC_DIR),
+ clear_rec_directory, NULL, NULL, Icon_Folder);
+
MENUITEM_SETTING(cliplight, &global_settings.cliplight, NULL);
#ifdef HAVE_AGC
@@ -835,7 +832,7 @@
#endif
&filesplitoptionsmenu,
&rec_prerecord_time,
- &recdirectory,
+ &clear_rec_directory_item,
#ifdef HAVE_BACKLIGHT
&cliplight,
#endif
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 13510)
+++ apps/settings_list.c (working copy)
@@ -771,11 +771,12 @@
HAVE_SPDIF_REC_(",spdif")
HAVE_FMRADIO_REC_(",fmradio")[1]
,UNUSED},
- INT_SETTING(F_RECSETTING, rec_prerecord_time, LANG_RECORD_PRERECORD_TIME,
- 0, "prerecording time",
- UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL),
- {F_T_INT|F_RECSETTING,&global_settings.rec_directory,LANG_RECORD_DIRECTORY,
- INT(0),"rec directory",REC_BASE_DIR ",current",UNUSED},
+ INT_SETTING(F_RECSETTING, rec_prerecord_time, LANG_RECORD_PRERECORD_TIME,
+ 0, "prerecording time",
+ UNIT_SEC, 0, 30, 1, rectime_formatter, rectime_getlang, NULL),
+
+ FILENAME_SETTING(F_RECSETTING, rec_directory, "rec path",
+ REC_BASE_DIR, NULL, NULL, MAX_REC_DIR_PATH),
#ifdef HAVE_BACKLIGHT
CHOICE_SETTING(F_RECSETTING, cliplight, LANG_CLIP_LIGHT, 0 ,
"cliplight", "off,main,both,remote", NULL,
Index: apps/plugin.h
===================================================================
--- apps/plugin.h (revision 13509)
+++ apps/plugin.h (working copy)
@@ -114,12 +114,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 57
+#define PLUGIN_API_VERSION 58
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
-#define PLUGIN_MIN_API_VERSION 56
+#define PLUGIN_MIN_API_VERSION 58
/* plugin return codes */
enum plugin_status {