summaryrefslogtreecommitdiff
path: root/utils/wpseditor/libwps/src
diff options
context:
space:
mode:
Diffstat (limited to 'utils/wpseditor/libwps/src')
-rw-r--r--utils/wpseditor/libwps/src/api.c36
-rw-r--r--utils/wpseditor/libwps/src/proxy.c9
-rw-r--r--utils/wpseditor/libwps/src/proxy.h6
3 files changed, 26 insertions, 25 deletions
diff --git a/utils/wpseditor/libwps/src/api.c b/utils/wpseditor/libwps/src/api.c
index 485efa8e00..89538423b4 100644
--- a/utils/wpseditor/libwps/src/api.c
+++ b/utils/wpseditor/libwps/src/api.c
@@ -32,8 +32,7 @@ bool load_remote_wps_backdrop(char* filename) {
32} 32}
33 33
34int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) { 34int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) {
35 if (!xapi->read_bmp_file) 35 if (!xapi->read_bmp_file) {
36 {
37 DEBUGF1("can't read bmp file! NULL api!\n"); 36 DEBUGF1("can't read bmp file! NULL api!\n");
38 return -1; 37 return -1;
39 } 38 }
@@ -84,7 +83,7 @@ int getstringsize(const unsigned char *str, int *w, int *h) {
84 return 1; 83 return 1;
85} 84}
86 85
87void set_wpsstate(struct wpsstate state){ 86void set_wpsstate(struct wpsstate state) {
88 sysfont.height = state.fontheight; 87 sysfont.height = state.fontheight;
89 sysfont.maxwidth = state.fontwidth; 88 sysfont.maxwidth = state.fontwidth;
90 global_settings.volume = state.volume; 89 global_settings.volume = state.volume;
@@ -92,7 +91,10 @@ void set_wpsstate(struct wpsstate state){
92 _audio_status = state.audio_status; 91 _audio_status = state.audio_status;
93} 92}
94 93
95void set_trackstate(struct trackstate state){ 94void set_trackstate(struct trackstate state) {
95 if (!(gui_wps[0].state) ||
96 !(gui_wps[0].state->id3))
97 return;
96 gui_wps[0].state->id3->title = state.title; 98 gui_wps[0].state->id3->title = state.title;
97 gui_wps[0].state->id3->artist = state.artist; 99 gui_wps[0].state->id3->artist = state.artist;
98 gui_wps[0].state->id3->album = state.album; 100 gui_wps[0].state->id3->album = state.album;
@@ -100,8 +102,7 @@ void set_trackstate(struct trackstate state){
100 gui_wps[0].state->id3->length = state.length; 102 gui_wps[0].state->id3->length = state.length;
101} 103}
102 104
103void set_next_trackstate(struct trackstate state) 105void set_next_trackstate(struct trackstate state) {
104{
105 gui_wps[0].state->nid3->title = state.title; 106 gui_wps[0].state->nid3->title = state.title;
106 gui_wps[0].state->nid3->artist = state.artist; 107 gui_wps[0].state->nid3->artist = state.artist;
107 gui_wps[0].state->nid3->album = state.album; 108 gui_wps[0].state->nid3->album = state.album;
@@ -110,21 +111,21 @@ void set_next_trackstate(struct trackstate state)
110} 111}
111 112
112enum api_playmode playmodes[PLAYMODES_NUM] = { 113enum api_playmode playmodes[PLAYMODES_NUM] = {
113 API_STATUS_PLAY, 114 API_STATUS_PLAY,
114 API_STATUS_STOP, 115 API_STATUS_STOP,
115 API_STATUS_PAUSE, 116 API_STATUS_PAUSE,
116 API_STATUS_FASTFORWARD, 117 API_STATUS_FASTFORWARD,
117 API_STATUS_FASTBACKWARD 118 API_STATUS_FASTBACKWARD
118}; 119 };
119 120
120const char *playmodeNames[] = { 121const char *playmodeNames[] = {
121 "Play", "Stop", "Pause", "FastForward", "FastBackward" 122 "Play", "Stop", "Pause", "FastForward", "FastBackward"
122}; 123 };
123 124
124 125
125void set_audio_status(int status){ 126void set_audio_status(int status) {
126 DEBUGF1("%s",playmodeNames[status]); 127 DEBUGF1("%s",playmodeNames[status]);
127 switch(status){ 128 switch (status) {
128 case API_STATUS_PLAY: 129 case API_STATUS_PLAY:
129 _audio_status = AUDIO_STATUS_PLAY; 130 _audio_status = AUDIO_STATUS_PLAY;
130 status_set_ffmode(STATUS_PLAY); 131 status_set_ffmode(STATUS_PLAY);
@@ -203,8 +204,6 @@ int set_api(struct proxy_api* api) {
203#else 204#else
204 screens[0].is_color=false; 205 screens[0].is_color=false;
205#endif 206#endif
206 if (api->getwidth)
207 screens[0].getwidth = api->getwidth;
208 if (api->stop_scroll) 207 if (api->stop_scroll)
209 screens[0].stop_scroll=api->stop_scroll; 208 screens[0].stop_scroll=api->stop_scroll;
210 screens[0].scroll_stop = lcd_scroll_stop; 209 screens[0].scroll_stop = lcd_scroll_stop;
@@ -266,3 +265,4 @@ int set_api(struct proxy_api* api) {
266 265
267 266
268 267
268
diff --git a/utils/wpseditor/libwps/src/proxy.c b/utils/wpseditor/libwps/src/proxy.c
index 3a3b8ce4d9..8f9218e3ff 100644
--- a/utils/wpseditor/libwps/src/proxy.c
+++ b/utils/wpseditor/libwps/src/proxy.c
@@ -69,7 +69,7 @@ void* plugin_get_buffer(size_t *buffer_size)
69int checkwps(const char *filename, int verbose){ 69int checkwps(const char *filename, int verbose){
70 int res; 70 int res;
71 int fd; 71 int fd;
72 72
73 struct wps_data wps; 73 struct wps_data wps;
74 wps_verbose_level = verbose; 74 wps_verbose_level = verbose;
75 75
@@ -104,9 +104,8 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){
104 if (!res) 104 if (!res)
105 { 105 {
106 DEBUGF1("ERR: WPS parsing failure\n"); 106 DEBUGF1("ERR: WPS parsing failure\n");
107 return 3; 107 } else
108 } 108 DEBUGF1("WPS parsed OK\n");
109 DEBUGF1("WPS parsed OK\n");
110 DEBUGF1("\n-------------------------------------------------\n"); 109 DEBUGF1("\n-------------------------------------------------\n");
111 wps_state.paused = true; 110 wps_state.paused = true;
112 gwps.data = &wpsdata; 111 gwps.data = &wpsdata;
@@ -115,7 +114,7 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){
115 gwps.state->id3 = &id3; 114 gwps.state->id3 = &id3;
116 gwps.state->nid3 = &nid3; 115 gwps.state->nid3 = &nid3;
117 gui_wps[0] = gwps; 116 gui_wps[0] = gwps;
118 return res; 117 return (res?res:3);
119} 118}
120 119
121int wps_display(){ 120int wps_display(){
diff --git a/utils/wpseditor/libwps/src/proxy.h b/utils/wpseditor/libwps/src/proxy.h
index 3836ecc6d0..df0abd3c3e 100644
--- a/utils/wpseditor/libwps/src/proxy.h
+++ b/utils/wpseditor/libwps/src/proxy.h
@@ -1,6 +1,8 @@
1#ifndef PROXY_H 1#ifndef PROXY_H
2#define PROXY_h 2#define PROXY_h
3 3
4#include <stdio.h>
5
4#include "screen_access.h" 6#include "screen_access.h"
5#include "api.h" 7#include "api.h"
6#include "defs.h" 8#include "defs.h"
@@ -9,13 +11,13 @@
9#define DEBUGF1 dbgf 11#define DEBUGF1 dbgf
10#define DEBUGF2(...) 12#define DEBUGF2(...)
11#define DEBUGF3(...) 13#define DEBUGF3(...)
14#define DEBUGF4(...)
12 15
13EXPORT int checkwps(const char *filename, int verbose); 16EXPORT int checkwps(const char *filename, int verbose);
14EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile); 17EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile);
15EXPORT int wps_display(); 18EXPORT int wps_display();
16EXPORT int wps_refresh(); 19EXPORT int wps_refresh();
17 20EXPORT const char* get_model_name();
18const char* get_model_name();
19 21
20extern struct screen screens[NB_SCREENS]; 22extern struct screen screens[NB_SCREENS];
21extern bool debug_wps; 23extern bool debug_wps;