From 7215a67e643d4266d7f9702a66fb93f84cb5ff67 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Sat, 24 Jan 2009 04:09:29 +0000 Subject: [PATCH] albumart search in pluginlib when building without HAVE_ALBUMART (for later use by pictureflow) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19835 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 1 + apps/plugin.h | 3 ++- apps/plugins/lib/SOURCES | 3 +++ apps/plugins/lib/pluginlib_albumart.c | 27 +++++++++++++++++++++++++++ apps/plugins/lib/wrappers.h | 13 +++++++++++++ apps/recorder/albumart.c | 2 ++ 6 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 apps/plugins/lib/pluginlib_albumart.c diff --git a/apps/plugin.c b/apps/plugin.c index 1e86b4d07e..98bbd2956f 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -630,6 +630,7 @@ static const struct plugin_api rockbox_api = { #ifdef CPU_ARM __div0, #endif + strip_extension }; int plugin_load(const char* plugin, const void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 472daeafe4..a83a9788e9 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -126,7 +126,7 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 138 +#define PLUGIN_API_VERSION 139 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -785,6 +785,7 @@ struct plugin_api { #ifdef CPU_ARM void (*__div0)(void); #endif + char* (*strip_extension)(char* buffer, int buffer_size, const char *filename); }; /* plugin header */ diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index c90613623c..e99a449e98 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -51,4 +51,7 @@ helper.c #ifdef HAVE_TOUCHSCREEN touchscreen.c #endif +#ifndef HAVE_ALBUMART +pluginlib_albumart.c +#endif md5.c diff --git a/apps/plugins/lib/pluginlib_albumart.c b/apps/plugins/lib/pluginlib_albumart.c new file mode 100644 index 0000000000..25c6716097 --- /dev/null +++ b/apps/plugins/lib/pluginlib_albumart.c @@ -0,0 +1,27 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2009 by Andrew Mahone +* +* This is a wrapper for the core albumart.c +* +* 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. +* +****************************************************************************/ + +#include +#include "wrappers.h" + +#include "../../recorder/albumart.c" diff --git a/apps/plugins/lib/wrappers.h b/apps/plugins/lib/wrappers.h index 385cd5d613..bb904ff946 100644 --- a/apps/plugins/lib/wrappers.h +++ b/apps/plugins/lib/wrappers.h @@ -27,6 +27,9 @@ #ifndef _LIB_WRAPPERS_H_ #define _LIB_WRAPPERS_H_ +#define DEBUG_H +#define __SPRINTF_H__ + #define open rb->open #define close rb->close #define read rb->read @@ -36,6 +39,16 @@ #define cpu_boost rb->cpu_boost #endif #define yield rb->yield +#define file_exists rb->file_exists +#define snprintf rb->snprintf +#define strcat rb->strcat +#define strchr rb->strchr +#define strcmp rb->strcmp +#define strcpy rb->strcpy +#define strip_extension rb->strip_extension +#define strlen rb->strlen +#define strncpy rb->strncpy +#define strrchr rb->strrchr #endif diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index babf63ef1c..e0977f738a 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c @@ -204,6 +204,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, return true; } +#ifdef HAVE_ALBUMART /* Look for albumart bitmap in the same dir as the track and in its parent dir. * Stores the found filename in the buf parameter. * Returns true if a bitmap was found, false otherwise */ @@ -306,3 +307,4 @@ void get_albumart_size(struct bitmap *bmp) bmp->width = data->albumart_max_width; bmp->height = data->albumart_max_height; } +#endif /* HAVE_ALBUMART */