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
52wavview.c 52wavview.c
53robotfindskitten.c 53robotfindskitten.c
54 54
55#if defined(HAVE_TAGCACHE) && (CONFIG_CODEC == SWCODEC)
56pictureflow.c
57#endif
58
55#ifdef HAVE_LCD_COLOR 59#ifdef HAVE_LCD_COLOR
56ppmviewer.c 60ppmviewer.c
57#endif 61#endif
@@ -129,9 +133,6 @@ splitedit.c
129 133
130#if LCD_DEPTH > 1 /* non-mono bitmap targets */ 134#if LCD_DEPTH > 1 /* non-mono bitmap targets */
131matrix.c 135matrix.c
132#if defined(HAVE_ALBUMART) && defined(HAVE_TAGCACHE)
133pictureflow.c
134#endif
135#endif 136#endif
136 137
137/* Platform-specific plugins */ 138/* 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
669#endif 669#endif
670 670
671/* pictureflow */ 671/* pictureflow */
672#if defined(HAVE_ALBUMART) && defined(HAVE_TAGCACHE) 672#if defined(HAVE_LCD_BITMAP) && defined(HAVE_TAGCACHE)
673#if (LCD_WIDTH < 200) 673#if (LCD_WIDTH < 200)
674pictureflow_logo.100x18x16.bmp 674pictureflow_logo.100x18x16.bmp
675#else 675#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 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2009 by Andrew Mahone
11*
12* This defines wrappers for some features which are used differently depending
13* on how the target was built, primarily because of core features being accesed
14* via pluginlib on targets where they are missing from core.
15*
16* This program is free software; you can redistribute it and/or
17* modify it under the terms of the GNU General Public License
18* as published by the Free Software Foundation; either version 2
19* of the License, or (at your option) any later version.
20*
21* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22* KIND, either express or implied.
23*
24****************************************************************************/
25
26#ifndef _LIB_FEATURE_WRAPPERS_H_
27#define _LIB_FEATURE_WRAPPERS_H_
28
29/* search_albumart_files is only available in core with HAVE_ALBUMART defined,
30 * but can easily be implement in pluginlib as long as the database is
31 * available.
32 */
33#ifdef HAVE_ALBUMART
34#define search_albumart_files rb->search_albumart_files
35#endif
36
37/* This should only be used when loading scaled bitmaps, or using custom output
38 * plugins. The pluginlib loader does not support loading bitmaps unscaled in
39 * native format, so rb->read_bmp_file should always be used directly to load
40 * such images.
41 */
42#if LCD_DEPTH > 1
43#define scaled_read_bmp_file rb->read_bmp_file
44#else
45#define scaled_read_bmp_file read_bmp_file
46#endif
47
48#endif
49
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 @@
24****************************************************************************/ 24****************************************************************************/
25 25
26#include "plugin.h" 26#include "plugin.h"
27#include <albumart.h>
27#include "lib/pluginlib_actions.h" 28#include "lib/pluginlib_actions.h"
28#include "lib/helper.h" 29#include "lib/helper.h"
29#include "lib/configfile.h" 30#include "lib/configfile.h"
30#include "lib/picture.h" 31#include "lib/picture.h"
31#include "pluginbitmaps/pictureflow_logo.h" 32#include "pluginbitmaps/pictureflow_logo.h"
32#include "lib/grey.h" 33#include "lib/grey.h"
34#include "lib/feature_wrappers.h"
33 35
34PLUGIN_HEADER 36PLUGIN_HEADER
35 37
@@ -41,15 +43,19 @@ const struct button_mapping *plugin_contexts[]
41#define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) 43#define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
42 44
43#if LCD_DEPTH < 8 45#if LCD_DEPTH < 8
46#if LCD_DEPTH > 1
47#define N_BRIGHT(y) LCD_BRIGHTNESS(y)
48#else
49#define N_BRIGHT(y) ((y > 127) ? 0 : 1)
50#endif
44#define USEGSLIB 51#define USEGSLIB
45GREY_INFO_STRUCT 52GREY_INFO_STRUCT
46#define LCD_BUF _grey_info.buffer 53#define LCD_BUF _grey_info.buffer
47#define MYLCD(fn) grey_ ## fn 54#define MYLCD(fn) grey_ ## fn
48#define G_PIX(r,g,b) \ 55#define G_PIX(r,g,b) \
49 (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256 56 (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256
50#define N_PIX(r,g,b) LCD_BRIGHTNESS(G_PIX(r,g,b)) 57#define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b))
51#define G_BRIGHT(y) (y) 58#define G_BRIGHT(y) (y)
52#define N_BRIGHT(y) LCD_BRIGHTNESS(y)
53#define BUFFER_WIDTH _grey_info.width 59#define BUFFER_WIDTH _grey_info.width
54#define BUFFER_HEIGHT _grey_info.height 60#define BUFFER_HEIGHT _grey_info.height
55typedef unsigned char pix_t; 61typedef unsigned char pix_t;
@@ -602,7 +608,7 @@ bool get_albumart_for_index_from_db(const int slide_index, char *buf,
602 fd = rb->open(tcs.result, O_RDONLY); 608 fd = rb->open(tcs.result, O_RDONLY);
603 rb->get_metadata(&id3, fd, tcs.result); 609 rb->get_metadata(&id3, fd, tcs.result);
604 rb->close(fd); 610 rb->close(fd);
605 if ( rb->search_albumart_files(&id3, "", buf, buflen) ) 611 if ( search_albumart_files(&id3, "", buf, buflen) )
606 result = true; 612 result = true;
607 else 613 else
608 result = false; 614 result = false;
@@ -622,8 +628,10 @@ void draw_splashscreen(void)
622{ 628{
623 struct screen* display = rb->screens[0]; 629 struct screen* display = rb->screens[0];
624 630
631#if LCD_DEPTH > 1
625 rb->lcd_set_background(N_BRIGHT(0)); 632 rb->lcd_set_background(N_BRIGHT(0));
626 rb->lcd_set_foreground(N_BRIGHT(255)); 633 rb->lcd_set_foreground(N_BRIGHT(255));
634#endif
627 rb->lcd_clear_display(); 635 rb->lcd_clear_display();
628 636
629 const struct picture* logo = &(logos[display->screen_type]); 637 const struct picture* logo = &(logos[display->screen_type]);
@@ -650,12 +658,18 @@ void draw_progressbar(int step)
650 rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork"); 658 rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork");
651 y += (txt_h + 5); 659 y += (txt_h + 5);
652 660
661#if LCD_DEPTH > 1
653 rb->lcd_set_foreground(N_BRIGHT(100)); 662 rb->lcd_set_foreground(N_BRIGHT(100));
663#endif
654 rb->lcd_drawrect(x, y, w+2, bar_height); 664 rb->lcd_drawrect(x, y, w+2, bar_height);
665#if LCD_DEPTH > 1
655 rb->lcd_set_foreground(N_PIX(165, 231, 82)); 666 rb->lcd_set_foreground(N_PIX(165, 231, 82));
667#endif
656 668
657 rb->lcd_fillrect(x+1, y+1, step * w / album_count, bar_height-2); 669 rb->lcd_fillrect(x+1, y+1, step * w / album_count, bar_height-2);
670#if LCD_DEPTH > 1
658 rb->lcd_set_foreground(N_BRIGHT(255)); 671 rb->lcd_set_foreground(N_BRIGHT(255));
672#endif
659 rb->lcd_update(); 673 rb->lcd_update();
660 rb->yield(); 674 rb->yield();
661} 675}
@@ -691,7 +705,7 @@ bool create_albumart_cache(void)
691 input_bmp.data = plugin_buf; 705 input_bmp.data = plugin_buf;
692 input_bmp.width = DISPLAY_WIDTH; 706 input_bmp.width = DISPLAY_WIDTH;
693 input_bmp.height = DISPLAY_HEIGHT; 707 input_bmp.height = DISPLAY_HEIGHT;
694 ret = rb->read_bmp_file(albumart_file, &input_bmp, 708 ret = scaled_read_bmp_file(albumart_file, &input_bmp,
695 plugin_buf_size, format, &format_transposed); 709 plugin_buf_size, format, &format_transposed);
696 if (ret <= 0) { 710 if (ret <= 0) {
697 rb->splash(HZ, "Could not read bmp"); 711 rb->splash(HZ, "Could not read bmp");
@@ -948,7 +962,9 @@ int read_pfraw(char* filename)
948 962
949 bm->width = bmph.width; 963 bm->width = bmph.width;
950 bm->height = bmph.height; 964 bm->height = bmph.height;
965#if LCD_DEPTH > 1
951 bm->format = FORMAT_NATIVE; 966 bm->format = FORMAT_NATIVE;
967#endif
952 bm->data = ((unsigned char *)bm + sizeof(struct bitmap)); 968 bm->data = ((unsigned char *)bm + sizeof(struct bitmap));
953 969
954 int y; 970 int y;
@@ -1527,9 +1543,11 @@ int create_empty_slide(bool force)
1527 int ret; 1543 int ret;
1528 input_bmp.width = DISPLAY_WIDTH; 1544 input_bmp.width = DISPLAY_WIDTH;
1529 input_bmp.height = DISPLAY_HEIGHT; 1545 input_bmp.height = DISPLAY_HEIGHT;
1546#if LCD_DEPTH > 1
1530 input_bmp.format = FORMAT_NATIVE; 1547 input_bmp.format = FORMAT_NATIVE;
1548#endif
1531 input_bmp.data = (char*)plugin_buf; 1549 input_bmp.data = (char*)plugin_buf;
1532 ret = rb->read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp, 1550 ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp,
1533 plugin_buf_size, 1551 plugin_buf_size,
1534 FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, 1552 FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT,
1535 &format_transposed); 1553 &format_transposed);
@@ -1641,7 +1659,9 @@ int main_menu(void)
1641 int selection = 0; 1659 int selection = 0;
1642 int result; 1660 int result;
1643 1661
1662#if LCD_DEPTH > 1
1644 rb->lcd_set_foreground(N_BRIGHT(255)); 1663 rb->lcd_set_foreground(N_BRIGHT(255));
1664#endif
1645 1665
1646 MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, 1666 MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL,
1647 "Settings", "Return", "Quit"); 1667 "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 @@
22#ifndef _ALBUMART_H_ 22#ifndef _ALBUMART_H_
23#define _ALBUMART_H_ 23#define _ALBUMART_H_
24 24
25#ifdef HAVE_ALBUMART 25#if defined(HAVE_ALBUMART) || defined(PLUGIN)
26 26
27#include <stdbool.h> 27#include <stdbool.h>
28#include "metadata.h" 28#include "metadata.h"