summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/SOURCES7
-rw-r--r--apps/plugins/bitmaps/native/SOURCES2
-rw-r--r--apps/plugins/lib/feature_wrappers.h49
-rw-r--r--apps/plugins/pictureflow.c30
-rw-r--r--apps/recorder/albumart.h2
5 files changed, 80 insertions, 10 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 7d48be60c1..d982ecb4c3 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -52,6 +52,10 @@ text_editor.c
wavview.c
robotfindskitten.c
+#if defined(HAVE_TAGCACHE) && (CONFIG_CODEC == SWCODEC)
+pictureflow.c
+#endif
+
#ifdef HAVE_LCD_COLOR
ppmviewer.c
#endif
@@ -129,9 +133,6 @@ splitedit.c
#if LCD_DEPTH > 1 /* non-mono bitmap targets */
matrix.c
-#if defined(HAVE_ALBUMART) && defined(HAVE_TAGCACHE)
-pictureflow.c
-#endif
#endif
/* Platform-specific plugins */
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES
index 924b55617d..357480afc6 100644
--- a/apps/plugins/bitmaps/native/SOURCES
+++ b/apps/plugins/bitmaps/native/SOURCES
@@ -669,7 +669,7 @@ matrix_normal.bmp
#endif
/* pictureflow */
-#if defined(HAVE_ALBUMART) && defined(HAVE_TAGCACHE)
+#if defined(HAVE_LCD_BITMAP) && defined(HAVE_TAGCACHE)
#if (LCD_WIDTH < 200)
pictureflow_logo.100x18x16.bmp
#else
diff --git a/apps/plugins/lib/feature_wrappers.h b/apps/plugins/lib/feature_wrappers.h
new file mode 100644
index 0000000000..52750acb61
--- /dev/null
+++ b/apps/plugins/lib/feature_wrappers.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Copyright (C) 2009 by Andrew Mahone
+*
+* This defines wrappers for some features which are used differently depending
+* on how the target was built, primarily because of core features being accesed
+* via pluginlib on targets where they are missing from core.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#ifndef _LIB_FEATURE_WRAPPERS_H_
+#define _LIB_FEATURE_WRAPPERS_H_
+
+/* search_albumart_files is only available in core with HAVE_ALBUMART defined,
+ * but can easily be implement in pluginlib as long as the database is
+ * available.
+ */
+#ifdef HAVE_ALBUMART
+#define search_albumart_files rb->search_albumart_files
+#endif
+
+/* This should only be used when loading scaled bitmaps, or using custom output
+ * plugins. The pluginlib loader does not support loading bitmaps unscaled in
+ * native format, so rb->read_bmp_file should always be used directly to load
+ * such images.
+ */
+#if LCD_DEPTH > 1
+#define scaled_read_bmp_file rb->read_bmp_file
+#else
+#define scaled_read_bmp_file read_bmp_file
+#endif
+
+#endif
+
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index 642afa1feb..ca1f0715b3 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -24,12 +24,14 @@
****************************************************************************/
#include "plugin.h"
+#include <albumart.h>
#include "lib/pluginlib_actions.h"
#include "lib/helper.h"
#include "lib/configfile.h"
#include "lib/picture.h"
#include "pluginbitmaps/pictureflow_logo.h"
#include "lib/grey.h"
+#include "lib/feature_wrappers.h"
PLUGIN_HEADER
@@ -41,15 +43,19 @@ const struct button_mapping *plugin_contexts[]
#define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
#if LCD_DEPTH < 8
+#if LCD_DEPTH > 1
+#define N_BRIGHT(y) LCD_BRIGHTNESS(y)
+#else
+#define N_BRIGHT(y) ((y > 127) ? 0 : 1)
+#endif
#define USEGSLIB
GREY_INFO_STRUCT
#define LCD_BUF _grey_info.buffer
#define MYLCD(fn) grey_ ## fn
#define G_PIX(r,g,b) \
(77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256
-#define N_PIX(r,g,b) LCD_BRIGHTNESS(G_PIX(r,g,b))
+#define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b))
#define G_BRIGHT(y) (y)
-#define N_BRIGHT(y) LCD_BRIGHTNESS(y)
#define BUFFER_WIDTH _grey_info.width
#define BUFFER_HEIGHT _grey_info.height
typedef unsigned char pix_t;
@@ -602,7 +608,7 @@ bool get_albumart_for_index_from_db(const int slide_index, char *buf,
fd = rb->open(tcs.result, O_RDONLY);
rb->get_metadata(&id3, fd, tcs.result);
rb->close(fd);
- if ( rb->search_albumart_files(&id3, "", buf, buflen) )
+ if ( search_albumart_files(&id3, "", buf, buflen) )
result = true;
else
result = false;
@@ -622,8 +628,10 @@ void draw_splashscreen(void)
{
struct screen* display = rb->screens[0];
+#if LCD_DEPTH > 1
rb->lcd_set_background(N_BRIGHT(0));
rb->lcd_set_foreground(N_BRIGHT(255));
+#endif
rb->lcd_clear_display();
const struct picture* logo = &(logos[display->screen_type]);
@@ -650,12 +658,18 @@ void draw_progressbar(int step)
rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork");
y += (txt_h + 5);
+#if LCD_DEPTH > 1
rb->lcd_set_foreground(N_BRIGHT(100));
+#endif
rb->lcd_drawrect(x, y, w+2, bar_height);
+#if LCD_DEPTH > 1
rb->lcd_set_foreground(N_PIX(165, 231, 82));
+#endif
rb->lcd_fillrect(x+1, y+1, step * w / album_count, bar_height-2);
+#if LCD_DEPTH > 1
rb->lcd_set_foreground(N_BRIGHT(255));
+#endif
rb->lcd_update();
rb->yield();
}
@@ -691,7 +705,7 @@ bool create_albumart_cache(void)
input_bmp.data = plugin_buf;
input_bmp.width = DISPLAY_WIDTH;
input_bmp.height = DISPLAY_HEIGHT;
- ret = rb->read_bmp_file(albumart_file, &input_bmp,
+ ret = scaled_read_bmp_file(albumart_file, &input_bmp,
plugin_buf_size, format, &format_transposed);
if (ret <= 0) {
rb->splash(HZ, "Could not read bmp");
@@ -948,7 +962,9 @@ int read_pfraw(char* filename)
bm->width = bmph.width;
bm->height = bmph.height;
+#if LCD_DEPTH > 1
bm->format = FORMAT_NATIVE;
+#endif
bm->data = ((unsigned char *)bm + sizeof(struct bitmap));
int y;
@@ -1527,9 +1543,11 @@ int create_empty_slide(bool force)
int ret;
input_bmp.width = DISPLAY_WIDTH;
input_bmp.height = DISPLAY_HEIGHT;
+#if LCD_DEPTH > 1
input_bmp.format = FORMAT_NATIVE;
+#endif
input_bmp.data = (char*)plugin_buf;
- ret = rb->read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp,
+ ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp,
plugin_buf_size,
FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT,
&format_transposed);
@@ -1641,7 +1659,9 @@ int main_menu(void)
int selection = 0;
int result;
+#if LCD_DEPTH > 1
rb->lcd_set_foreground(N_BRIGHT(255));
+#endif
MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL,
"Settings", "Return", "Quit");
diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h
index ecfdb9c9ed..edf464fb7a 100644
--- a/apps/recorder/albumart.h
+++ b/apps/recorder/albumart.h
@@ -22,7 +22,7 @@
#ifndef _ALBUMART_H_
#define _ALBUMART_H_
-#ifdef HAVE_ALBUMART
+#if defined(HAVE_ALBUMART) || defined(PLUGIN)
#include <stdbool.h>
#include "metadata.h"