Rockbox mail archive
Subject: ANNOUNCE: New Talkbox Patch
From: ds2list (ds2list_at_yahoo.com)
Date: 2003-05-15
Here is a new patch against Rockbox 2.0 stable. New features
in this patch are:
1) There is now a Configuration menu option for switching
thumbnailing on and off: It is in:
F1->General Settings->File View->Play Thumbnails
Which can be set to yes or no.
2) There are 2 modes of thumbnail playing available, which can
be configured in:
F1->General Settings->File View->Thumbnail Mode
The options are:
"enter": Play thumbnail when you enter a directory
"hover": Play a thumbnail when the cursor is hovering
over a directory
Known Problems:
- When in the hover mode, the cursor disappears for a given
selection after playing the thumbnail.
- Not sure if added global settings are saved properly yet,
so the feature has to be enabled each time you boot.
My web space is down right now, so I'll to post the images
for the Recorder, FM Recorder and Player when it comes up at:
http://pages.sbcglobal.net/gsudindranath/index.html
In the meantime, here is the patch:
diff -ur rockbox-2.0/apps/main.c rockbox-2.0-talkbox/apps/main.c
--- rockbox-2.0/apps/main.c 2003-02-14 01:44:33.000000000 -0800
+++ rockbox-2.0-talkbox/apps/main.c 2003-05-07 20:06:49.000000000 -0700
@@ -56,6 +56,7 @@
void app_main(void)
{
init();
+ global_settings.repeat_mode = 0;
browse_root();
}
diff -ur rockbox-2.0/apps/recorder/recording.c rockbox-2.0-talkbox/apps/recorder/recording.c
--- rockbox-2.0/apps/recorder/recording.c 2003-04-10 17:44:21.000000000 -0700
+++ rockbox-2.0-talkbox/apps/recorder/recording.c 2003-05-07 20:12:15.000000000 -0700
@@ -40,6 +40,7 @@
#include "timefuncs.h"
#include "debug.h"
#include "misc.h"
+#include "tree.h"
bool f2_rec_screen(void);
bool f3_rec_screen(void);
@@ -54,6 +55,9 @@
extern unsigned long record_start_frame; /* Frame number where
recording started */
+bool use_alt_filename;
+char alt_filename[MAX_PATH];
+
#define SOURCE_MIC 0
#define SOURCE_LINE 1
#define SOURCE_SPDIF 2
@@ -202,7 +206,15 @@
if(!mpeg_status())
{
have_recorded = true;
- mpeg_record(create_filename());
+
+ if (!use_alt_filename)
+ {
+ mpeg_record(create_filename());
+ }
+ else
+ {
+ mpeg_record(alt_filename);
+ }
status_set_playmode(STATUS_RECORD);
update_countdown = 1; /* Update immediately */
last_seconds = 0;
@@ -630,3 +642,35 @@
return false;
}
+
+
+bool record_thumbnail(void)
+{
+ bool result = true;
+
+ if (result)
+ {
+ use_alt_filename = true;
+ snprintf(alt_filename, sizeof(alt_filename), "%s/%s", get_currdir(), ".dirname.mp3");
+
+ int fd = open(alt_filename, O_RDONLY);
+
+ if (fd > -1)
+ {
+ close(fd);
+ remove(alt_filename);
+ }
+
+ recording_screen();
+ use_alt_filename = false;
+
+ return true;
+ }
+ else
+ {
+ DEBUGF("No directory selected\n");
+ return false;
+ }
+
+}
+
diff -ur rockbox-2.0/apps/recorder/recording.h rockbox-2.0-talkbox/apps/recorder/recording.h
--- rockbox-2.0/apps/recorder/recording.h 2002-11-10 08:42:31.000000000 -0800
+++ rockbox-2.0-talkbox/apps/recorder/recording.h 2003-05-03 16:18:12.000000000 -0700
@@ -20,5 +20,6 @@
#define RECORDING_H
bool recording_screen(void);
+bool record_thumbnail(void);
#endif
diff -ur rockbox-2.0/apps/screens.c rockbox-2.0-talkbox/apps/screens.c
--- rockbox-2.0/apps/screens.c 2003-04-02 16:18:14.000000000 -0800
+++ rockbox-2.0-talkbox/apps/screens.c 2003-05-12 01:36:47.000000000 -0700
@@ -31,6 +31,14 @@
#include "status.h"
#include "playlist.h"
#include "sprintf.h"
+#include "debug.h"
+
+#ifdef HAVE_RECORDER_KEYPAD
+#include "recording.h"
+#include "tree.h"
+#endif
+
+bool confirm_record_thumbnail(void);
#ifdef HAVE_LCD_BITMAP
#define BMPHEIGHT_usb_logo 32
@@ -270,7 +278,20 @@
lcd_clear_display();
+
+#ifdef HAVE_MAS3587F
+
+ if (strcmp(get_currdir(), "/") != 0) {
+
+ lcd_putsxy(8, 0, "Record Thumbnail");
+ lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow],
+ LCD_WIDTH/2 - 3, LCD_HEIGHT/2 - h*2, 7, 8, true);
+ }
+#endif
+
/* Shuffle mode */
+ DEBUGF("LCD_WIDTH is %d and w is %d\n", LCD_WIDTH, w);
+
lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE));
lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
lcd_putsxy(0, LCD_HEIGHT/2,
@@ -343,6 +364,23 @@
used = true;
break;
+#ifdef HAVE_MAS3587F
+ case BUTTON_UP:
+ case BUTTON_F2 | BUTTON_UP:
+
+
+ if (strcmp(get_currdir(), "/") != 0)
+ {
+
+ if (confirm_record_thumbnail())
+ {
+ record_thumbnail();
+ }
+ }
+ used = true;
+ break;
+#endif
+
case BUTTON_DOWN:
case BUTTON_F2 | BUTTON_DOWN:
global_settings.dirfilter++;
@@ -466,6 +504,48 @@
return false;
}
+
+bool confirm_record_thumbnail(void)
+{
+
+ bool yesno;
+ bool done;
+
+ if (strcmp(get_currdir(), "/") == 0)
+ return false;
+
+ lcd_clear_display();
+
+
+ lcd_putsxy(0, LCD_HEIGHT/2 - 30, "Record Thumbnail");
+ lcd_putsxy(0, LCD_HEIGHT/2 - 20, "in directory?:");
+ lcd_putsxy(0, LCD_HEIGHT/2 - 5, get_currdir());
+ lcd_putsxy(4, LCD_HEIGHT/2 + 10, "PLAY - Confirm");
+ lcd_putsxy(5, LCD_HEIGHT/2 + 20, " F2 - Cancel");
+ lcd_update();
+
+
+ done=false;
+ yesno=false;
+
+ while(!done) {
+ switch (button_get(true)) {
+ case BUTTON_PLAY:
+ yesno=true;
+ done = true;
+ break;
+
+ case BUTTON_F2:
+ yesno=false;
+ done = true;
+ break;
+ }
+ }
+
+ return yesno;
+
+}
+
#endif
#ifdef HAVE_LCD_BITMAP
@@ -633,3 +713,7 @@
sleep(ticks);
}
}
+
+
+
+
diff -ur rockbox-2.0/apps/settings.c rockbox-2.0-talkbox/apps/settings.c
--- rockbox-2.0/apps/settings.c 2003-04-11 00:47:30.000000000 -0700
+++ rockbox-2.0-talkbox/apps/settings.c 2003-05-12 01:48:29.000000000 -0700
@@ -1041,6 +1041,15 @@
#endif
else if (!strcasecmp(name, "volume fade"))
set_cfg_bool(&global_settings.fade_on_stop, value);
+
+ else if (!strcasecmp(name, "play thumbnails"))
+ set_cfg_bool(&global_settings.play_thumbnails, value);
+ else if (!strcasecmp(name, "thumbnail mode")) {
+ static char* options[] = {"enter","hover"};
+ set_cfg_option(&global_settings.thumbnail_mode, value, options, 2);
+ }
+
+
}
close(fd);
@@ -1426,6 +1435,21 @@
global_settings.rec_right_gain);
write(fd, buf, strlen(buf));
#endif
+ {
+ static char* options[] = {"off","on"};
+ snprintf(buf, sizeof(buf),
+ "play thumbnails: %s\r\n",
+ options[global_settings.play_thumbnails]);
+ write(fd, buf, strlen(buf));
+ }
+
+ {
+ static char* options[] = {"enter","hover"};
+ snprintf(buf, sizeof(buf),
+ "thumbnail mode: %s\r\n",
+ options[global_settings.thumbnail_mode]);
+ write(fd, buf, strlen(buf));
+ }
close(fd);
lcd_clear_display();
diff -ur rockbox-2.0/apps/settings.h rockbox-2.0-talkbox/apps/settings.h
--- rockbox-2.0/apps/settings.h 2003-03-12 07:30:57.000000000 -0800
+++ rockbox-2.0-talkbox/apps/settings.h 2003-05-12 01:48:47.000000000 -0700
@@ -150,6 +150,11 @@
int scroll_step; /* pixels to advance per update */
bool fade_on_stop; /* fade on pause/unpause/stop */
+ bool play_thumbnails; /* Enable/disable playing of directory
+ name thumbnails */
+ int thumbnail_mode; /* When to play directory thumbnails:
+ 0=when entering a directory
+ 1=when cursor is over a directory */
};
/* prototypes */
diff -ur rockbox-2.0/apps/settings_menu.c rockbox-2.0-talkbox/apps/settings_menu.c
--- rockbox-2.0/apps/settings_menu.c 2003-03-12 07:30:58.000000000 -0800
+++ rockbox-2.0-talkbox/apps/settings_menu.c 2003-05-12 01:49:27.000000000 -0700
@@ -588,6 +588,20 @@
return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
}
+
+static bool play_thumbnails(void)
+{
+ return set_bool( "Play Thumbnails", &global_settings.play_thumbnails );
+}
+
+static bool thumbnail_mode(void)
+{
+ char* names[] = { "enter", "hover"};
+
+ return set_option("Thumbnail Mode", &global_settings.thumbnail_mode,
+ names, 2, NULL );
+}
+
static bool playback_settings_menu(void)
{
int m;
@@ -683,6 +697,8 @@
{ str(LANG_CASE_MENU), sort_case },
{ str(LANG_FILTER), dir_filter },
{ str(LANG_FOLLOW), browse_current },
+ { "Play Thumbnails", play_thumbnails },
+ { "Thumbnail Mode", thumbnail_mode },
};
m = menu_init( items, sizeof items / sizeof(struct menu_items) );
diff -ur rockbox-2.0/apps/tree.c rockbox-2.0-talkbox/apps/tree.c
--- rockbox-2.0/apps/tree.c 2003-04-14 00:53:58.000000000 -0700
+++ rockbox-2.0-talkbox/apps/tree.c 2003-05-15 01:56:27.000000000 -0700
@@ -75,6 +75,8 @@
static char lastdir[MAX_PATH];
static char lastfile[MAX_PATH];
static char currdir[MAX_PATH];
+
+
static bool reload_dir = false;
void browse_root(void)
@@ -168,6 +170,43 @@
return start_index;
}
+static int play_dirname(int start_index)
+{
+
+ int dirname_mp3_file;
+ int repeat_mode;
+ char dirname_mp3_filename[1000];
+ int seed = current_tick;
+
+ playlist_clear();
+
+ snprintf(dirname_mp3_filename, sizeof(dirname_mp3_filename),"%s/%s/%s", currdir, dircache[start_index].name, ".dirname.mp3");
+
+ DEBUGF("Checking for %s\n", dirname_mp3_filename);
+
+ dirname_mp3_file = open(dirname_mp3_filename, O_RDONLY);
+
+ if (dirname_mp3_file < 0)
+ {
+ DEBUGF("Failed to find: %s\n", dirname_mp3_filename);
+ return -1;
+ }
+
+ close(dirname_mp3_file);
+
+ DEBUGF("Found: %s\n", dirname_mp3_filename);
+ playlist_add(dirname_mp3_filename);
+
+ repeat_mode = global_settings.repeat_mode;
+ global_settings.repeat_mode = 0;
+ play_list(dircache[start_index].name, NULL,
+ 0, false,
+ 0, seed, 0, 0, -1);
+ global_settings.repeat_mode = repeat_mode;
+ return 1;
+}
+
+
static int compare(const void* p1, const void* p2)
{
struct entry* e1 = (struct entry*)p1;
@@ -209,7 +248,6 @@
}
}
-
static int showdir(char *path, int start)
{
int icon_type = 0;
@@ -486,6 +524,7 @@
return filesindir;
}
+
bool ask_resume(void)
{
#ifdef HAVE_LCD_CHARCELLS
@@ -727,7 +766,6 @@
return used;
}
-
bool dirbrowse(char *root)
{
int numentries=0;
@@ -745,6 +783,8 @@
bool update_all = false; /* set this to true when the whole file list
has been refreshed on screen */
+ int last_thumbnail_played=-1;
+
#ifdef HAVE_LCD_BITMAP
int fw, fh;
lcd_getstringsize("A", &fw, &fh);
@@ -773,6 +813,20 @@
bool restore = false;
+ if (file->attr & ATTR_DIRECTORY) {
+
+ /* play directory thumbnail */
+ if (global_settings.play_thumbnails &&
+ (global_settings.thumbnail_mode == 1) &&
+ (last_thumbnail_played != dircursor+dirstart) &&
+ (!(mpeg_status() & MPEG_STATUS_PLAY))) {
+
+ DEBUGF("Playing directory thumbnail: %s", currdir);
+ play_dirname(dircursor+dirstart);
+ last_thumbnail_played = dircursor+dirstart;
+ }
+ }
+
button = button_get_w_tmo(HZ/5);
switch ( button ) {
case TREE_EXIT:
@@ -832,6 +886,15 @@
snprintf(buf,sizeof(buf),"/%s",file->name);
if (file->attr & ATTR_DIRECTORY) {
+
+ if (global_settings.play_thumbnails &&
+ (global_settings.thumbnail_mode == 0) &&
+ (!(mpeg_status() & MPEG_STATUS_PLAY))) {
+ /* play_dirname */
+ DEBUGF("Playing directory thumbnail: %s", currdir);
+ play_dirname(dircursor+dirstart);
+ }
+
memcpy(currdir,buf,sizeof(currdir));
if ( dirlevel < MAX_DIR_LEVELS ) {
dirpos[dirlevel] = dirstart;
@@ -1185,6 +1248,7 @@
return true;
}
+
static int plsize = 0;
static bool add_dir(char* dirname, int fd)
{
@@ -1285,3 +1349,8 @@
return true;
}
+
+char * get_currdir(void)
+{
+ return currdir;
+}
diff -ur rockbox-2.0/apps/tree.h rockbox-2.0-talkbox/apps/tree.h
--- rockbox-2.0/apps/tree.h 2003-03-12 12:21:28.000000000 -0800
+++ rockbox-2.0-talkbox/apps/tree.h 2003-05-03 17:45:02.000000000 -0700
@@ -36,5 +36,6 @@
void set_current_file(char *path);
bool dirbrowse(char *root);
bool create_playlist(void);
+char * get_currdir(void);
#endif
Page was last modified "Jan 10 2012" The Rockbox Crew
|