diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 2 | ||||
-rw-r--r-- | apps/codecs/Makefile | 1 | ||||
-rw-r--r-- | apps/codecs/SOURCES | 1 | ||||
-rw-r--r-- | apps/filetypes.c | 1 | ||||
-rw-r--r-- | apps/main.c | 4 | ||||
-rw-r--r-- | apps/metadata.c | 8 | ||||
-rw-r--r-- | apps/metadata/metadata_parsers.h | 1 | ||||
-rw-r--r-- | apps/playback.c | 2 | ||||
-rw-r--r-- | apps/player/bmp.c | 199 | ||||
-rw-r--r-- | apps/player/bmp.h | 35 | ||||
-rw-r--r-- | apps/plugins/CATEGORIES | 1 | ||||
-rw-r--r-- | apps/plugins/SOURCES | 11 |
12 files changed, 262 insertions, 4 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 0d23f42765..f3cb39fc1f 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -75,6 +75,7 @@ gui/backdrop.c | |||
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #ifdef HAVE_LCD_CHARCELLS | 77 | #ifdef HAVE_LCD_CHARCELLS |
78 | player/bmp.c | ||
78 | player/icons.c | 79 | player/icons.c |
79 | player/keyboard.c | 80 | player/keyboard.c |
80 | #endif | 81 | #endif |
@@ -129,6 +130,7 @@ metadata/mp4.c | |||
129 | metadata/mpc.c | 130 | metadata/mpc.c |
130 | metadata/ogg.c | 131 | metadata/ogg.c |
131 | metadata/sid.c | 132 | metadata/sid.c |
133 | metadata/mod.c | ||
132 | metadata/spc.c | 134 | metadata/spc.c |
133 | metadata/vorbis.c | 135 | metadata/vorbis.c |
134 | metadata/wave.c | 136 | metadata/wave.c |
diff --git a/apps/codecs/Makefile b/apps/codecs/Makefile index 5a65341d02..7c066d284d 100644 --- a/apps/codecs/Makefile +++ b/apps/codecs/Makefile | |||
@@ -47,6 +47,7 @@ all: $(LINKCODEC) $(ROCKS) | |||
47 | ifndef SIMVER | 47 | ifndef SIMVER |
48 | $(BUILDDIR)/%.a : % $(CODECDEPS) | 48 | $(BUILDDIR)/%.a : % $(CODECDEPS) |
49 | 49 | ||
50 | $(OBJDIR)/mod.elf : $(OBJDIR)/mod.o $(OBJDIR)/codec_crt0.o | ||
50 | $(OBJDIR)/wav.elf : $(OBJDIR)/wav.o $(OBJDIR)/codec_crt0.o | 51 | $(OBJDIR)/wav.elf : $(OBJDIR)/wav.o $(OBJDIR)/codec_crt0.o |
51 | $(OBJDIR)/sid.elf : $(OBJDIR)/sid.o $(OBJDIR)/codec_crt0.o | 52 | $(OBJDIR)/sid.elf : $(OBJDIR)/sid.o $(OBJDIR)/codec_crt0.o |
52 | $(OBJDIR)/adx.elf : $(OBJDIR)/adx.o $(OBJDIR)/codec_crt0.o | 53 | $(OBJDIR)/adx.elf : $(OBJDIR)/adx.o $(OBJDIR)/codec_crt0.o |
diff --git a/apps/codecs/SOURCES b/apps/codecs/SOURCES index a93cb6c0cc..3c0118c1ce 100644 --- a/apps/codecs/SOURCES +++ b/apps/codecs/SOURCES | |||
@@ -13,6 +13,7 @@ wma.c | |||
13 | aac.c | 13 | aac.c |
14 | #endif | 14 | #endif |
15 | ape.c | 15 | ape.c |
16 | mod.c | ||
16 | shorten.c | 17 | shorten.c |
17 | aiff.c | 18 | aiff.c |
18 | speex.c | 19 | speex.c |
diff --git a/apps/filetypes.c b/apps/filetypes.c index 8427bc7450..7cf95553a3 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -69,6 +69,7 @@ const struct filetype inbuilt_filetypes[] = { | |||
69 | { "m4a", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | 69 | { "m4a", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, |
70 | { "m4b", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | 70 | { "m4b", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, |
71 | { "mp4", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | 71 | { "mp4", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, |
72 | { "mod", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
72 | { "shn", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | 73 | { "shn", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, |
73 | { "aif", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | 74 | { "aif", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, |
74 | { "aiff",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | 75 | { "aiff",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, |
diff --git a/apps/main.c b/apps/main.c index 15dd1bcef9..b60b089b74 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -144,10 +144,10 @@ static int init_dircache(bool preinit) | |||
144 | 144 | ||
145 | if (preinit) | 145 | if (preinit) |
146 | dircache_init(); | 146 | dircache_init(); |
147 | 147 | ||
148 | if (!global_settings.dircache) | 148 | if (!global_settings.dircache) |
149 | return 0; | 149 | return 0; |
150 | 150 | ||
151 | # ifdef HAVE_EEPROM_SETTINGS | 151 | # ifdef HAVE_EEPROM_SETTINGS |
152 | if (firmware_settings.initialized && firmware_settings.disk_clean | 152 | if (firmware_settings.initialized && firmware_settings.disk_clean |
153 | && preinit) | 153 | && preinit) |
diff --git a/apps/metadata.c b/apps/metadata.c index 3abbd74c35..303fafc070 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -183,6 +183,14 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) | |||
183 | 183 | ||
184 | break; | 184 | break; |
185 | 185 | ||
186 | case AFMT_MOD: | ||
187 | if (!get_mod_metadata(fd, id3)) | ||
188 | { | ||
189 | return false; | ||
190 | } | ||
191 | |||
192 | break; | ||
193 | |||
186 | case AFMT_SHN: | 194 | case AFMT_SHN: |
187 | id3->vbr = true; | 195 | id3->vbr = true; |
188 | id3->filesize = filesize(fd); | 196 | id3->filesize = filesize(fd); |
diff --git a/apps/metadata/metadata_parsers.h b/apps/metadata/metadata_parsers.h index c3265f8a43..b34d09fe4c 100644 --- a/apps/metadata/metadata_parsers.h +++ b/apps/metadata/metadata_parsers.h | |||
@@ -25,6 +25,7 @@ bool get_mp4_metadata(int fd, struct mp3entry* id3); | |||
25 | bool get_monkeys_metadata(int fd, struct mp3entry* id3); | 25 | bool get_monkeys_metadata(int fd, struct mp3entry* id3); |
26 | bool get_musepack_metadata(int fd, struct mp3entry *id3); | 26 | bool get_musepack_metadata(int fd, struct mp3entry *id3); |
27 | bool get_sid_metadata(int fd, struct mp3entry* id3); | 27 | bool get_sid_metadata(int fd, struct mp3entry* id3); |
28 | bool get_mod_metadata(int fd, struct mp3entry* id3); | ||
28 | bool get_spc_metadata(int fd, struct mp3entry* id3); | 29 | bool get_spc_metadata(int fd, struct mp3entry* id3); |
29 | bool get_ogg_metadata(int fd, struct mp3entry* id3); | 30 | bool get_ogg_metadata(int fd, struct mp3entry* id3); |
30 | bool get_wave_metadata(int fd, struct mp3entry* id3); | 31 | bool get_wave_metadata(int fd, struct mp3entry* id3); |
diff --git a/apps/playback.c b/apps/playback.c index cb9ed3e162..dbaf55fbdd 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1511,7 +1511,7 @@ int audio_track_count(void) | |||
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | long audio_filebufused(void) | 1513 | long audio_filebufused(void) |
1514 | { | 1514 | { |
1515 | return (long) buf_used(); | 1515 | return (long) buf_used(); |
1516 | } | 1516 | } |
1517 | 1517 | ||
diff --git a/apps/player/bmp.c b/apps/player/bmp.c new file mode 100644 index 0000000000..290880c0f7 --- /dev/null +++ b/apps/player/bmp.c | |||
@@ -0,0 +1,199 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* | ||
21 | 2008-02-24 Jens Arnold: minimalistic version for charcell displays | ||
22 | */ | ||
23 | |||
24 | #include <stdio.h> | ||
25 | #include <stdlib.h> | ||
26 | #include <string.h> | ||
27 | #include "inttypes.h" | ||
28 | #include "debug.h" | ||
29 | #include "lcd.h" | ||
30 | #include "file.h" | ||
31 | #include "config.h" | ||
32 | #include "system.h" | ||
33 | #include "bmp.h" | ||
34 | #include "lcd.h" | ||
35 | |||
36 | #ifdef __GNUC__ | ||
37 | #define STRUCT_PACKED __attribute__((packed)) | ||
38 | #else | ||
39 | #define STRUCT_PACKED | ||
40 | #pragma pack (push, 2) | ||
41 | #endif | ||
42 | |||
43 | /* BMP header structure */ | ||
44 | struct bmp_header { | ||
45 | uint16_t type; /* signature - 'BM' */ | ||
46 | uint32_t size; /* file size in bytes */ | ||
47 | uint16_t reserved1; /* 0 */ | ||
48 | uint16_t reserved2; /* 0 */ | ||
49 | uint32_t off_bits; /* offset to bitmap */ | ||
50 | uint32_t struct_size; /* size of this struct (40) */ | ||
51 | int32_t width; /* bmap width in pixels */ | ||
52 | int32_t height; /* bmap height in pixels */ | ||
53 | uint16_t planes; /* num planes - always 1 */ | ||
54 | uint16_t bit_count; /* bits per pixel */ | ||
55 | uint32_t compression; /* compression flag */ | ||
56 | uint32_t size_image; /* image size in bytes */ | ||
57 | int32_t x_pels_per_meter; /* horz resolution */ | ||
58 | int32_t y_pels_per_meter; /* vert resolution */ | ||
59 | uint32_t clr_used; /* 0 -> color table size */ | ||
60 | uint32_t clr_important; /* important color count */ | ||
61 | } STRUCT_PACKED; | ||
62 | |||
63 | union rgb_union { | ||
64 | struct { /* Little endian */ | ||
65 | unsigned char blue; | ||
66 | unsigned char green; | ||
67 | unsigned char red; | ||
68 | unsigned char reserved; | ||
69 | }; | ||
70 | uint32_t raw; | ||
71 | }; | ||
72 | |||
73 | |||
74 | /* little endian functions */ | ||
75 | static inline unsigned readshort(uint16_t *value) | ||
76 | { | ||
77 | unsigned char* bytes = (unsigned char*) value; | ||
78 | return (unsigned)bytes[0] | ((unsigned)bytes[1] << 8); | ||
79 | } | ||
80 | |||
81 | static inline uint32_t readlong(uint32_t *value) | ||
82 | { | ||
83 | unsigned char* bytes = (unsigned char*) value; | ||
84 | return (uint32_t)bytes[0] | ((uint32_t)bytes[1] << 8) | | ||
85 | ((uint32_t)bytes[2] << 16) | ((uint32_t)bytes[3] << 24); | ||
86 | } | ||
87 | |||
88 | static inline unsigned brightness(union rgb_union color) | ||
89 | { | ||
90 | return (3 * (unsigned)color.red + 6 * (unsigned)color.green | ||
91 | + (unsigned)color.blue) / 10; | ||
92 | } | ||
93 | |||
94 | /****************************************************************************** | ||
95 | * read_bmp_file() | ||
96 | * | ||
97 | * Reads a BMP file and puts the data in rockbox format in *data. | ||
98 | * | ||
99 | *****************************************************************************/ | ||
100 | int read_bmp_file(const char* filename, | ||
101 | unsigned char *bitmap, | ||
102 | int maxsize) | ||
103 | { | ||
104 | struct bmp_header bmph; | ||
105 | int fd, ret; | ||
106 | int width, height, depth; | ||
107 | int row, rowstart, rowstop, rowstep; | ||
108 | unsigned char invert; | ||
109 | unsigned char bmpbuf[4]; /* Buffer for one line */ | ||
110 | uint32_t palette[2]; | ||
111 | |||
112 | fd = open(filename, O_RDONLY); | ||
113 | |||
114 | /* Exit if file opening failed */ | ||
115 | if (fd < 0) | ||
116 | { | ||
117 | DEBUGF("read_bmp_file: can't open '%s', rc: %d\n", filename, fd); | ||
118 | return fd * 10 - 1; | ||
119 | } | ||
120 | |||
121 | /* read fileheader */ | ||
122 | ret = read(fd, &bmph, sizeof(struct bmp_header)); | ||
123 | if (ret < 0) | ||
124 | return ret * 10 - 2; | ||
125 | |||
126 | if (ret != sizeof(struct bmp_header)) { | ||
127 | DEBUGF("read_bmp_file: can't read BMP header."); | ||
128 | return -3; | ||
129 | } | ||
130 | |||
131 | width = readlong(&bmph.width); | ||
132 | if (width > 8) | ||
133 | { | ||
134 | DEBUGF("read_bmp_file: Bitmap too wide (%d pixels, max is 8)\n", width); | ||
135 | return -4; | ||
136 | } | ||
137 | |||
138 | depth = readshort(&bmph.bit_count); | ||
139 | if (depth != 1) | ||
140 | { | ||
141 | DEBUGF("read_bmp_fd: Wrong depth (%d, must be 1)\n", depth); | ||
142 | return -5; | ||
143 | } | ||
144 | |||
145 | height = readlong(&bmph.height); | ||
146 | if (height < 0) | ||
147 | { /* Top-down BMP file */ | ||
148 | height = -height; | ||
149 | rowstart = 0; | ||
150 | rowstop = height; | ||
151 | rowstep = 1; | ||
152 | } | ||
153 | else | ||
154 | { /* normal BMP */ | ||
155 | rowstart = height - 1; | ||
156 | rowstop = -1; | ||
157 | rowstep = -1; | ||
158 | } | ||
159 | |||
160 | /* Check if this fits the buffer */ | ||
161 | if (height > maxsize) | ||
162 | { | ||
163 | DEBUGF("read_bmp_fd: Bitmap too high for buffer: %d bytes.\n", height); | ||
164 | return -6; | ||
165 | } | ||
166 | |||
167 | if (read(fd, palette, 2 * sizeof(uint32_t)) | ||
168 | != 2 * (int)sizeof(uint32_t)) | ||
169 | { | ||
170 | DEBUGF("read_bmp_fd: Can't read color palette\n"); | ||
171 | return -7; | ||
172 | } | ||
173 | invert = (brightness((union rgb_union)palette[1]) | ||
174 | > brightness((union rgb_union)palette[0])) | ||
175 | ? 0xff : 0x00; | ||
176 | |||
177 | /* Search to the beginning of the image data */ | ||
178 | lseek(fd, (off_t)readlong(&bmph.off_bits), SEEK_SET); | ||
179 | memset(bitmap, 0, height); | ||
180 | |||
181 | /* loop to read rows and put them to buffer */ | ||
182 | for (row = rowstart; row != rowstop; row += rowstep) | ||
183 | { | ||
184 | /* read one row */ | ||
185 | ret = read(fd, bmpbuf, 4); | ||
186 | if (ret != 4) | ||
187 | { | ||
188 | DEBUGF("read_bmp_fd: error reading image, read returned: %d " | ||
189 | "expected: 4\n", ret); | ||
190 | return -9; | ||
191 | } | ||
192 | bitmap[row] = bmpbuf[0] ^ invert; | ||
193 | } | ||
194 | |||
195 | DEBUGF("totalsize: %d\n", totalsize); | ||
196 | |||
197 | close(fd); | ||
198 | return height; /* return the used buffer size. */ | ||
199 | } | ||
diff --git a/apps/player/bmp.h b/apps/player/bmp.h new file mode 100644 index 0000000000..ddfa349d9d --- /dev/null +++ b/apps/player/bmp.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Daniel Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _BMP_H_ | ||
20 | #define _BMP_H_ | ||
21 | |||
22 | /********************************************************************* | ||
23 | * read_bmp_file(), minimalistic version for charcell displays | ||
24 | * | ||
25 | * Reads a 1 bit BMP file and puts the data in a horizontal packed | ||
26 | * 1 bit-per-pixel char array. Width must be <= 8 pixels. | ||
27 | * Returns < 0 for error, or number of bytes used from the bitmap | ||
28 | * buffer, which equals bitmap height. | ||
29 | * | ||
30 | **********************************************/ | ||
31 | int read_bmp_file(const char* filename, | ||
32 | unsigned char *bitmap, | ||
33 | int maxsize); | ||
34 | |||
35 | #endif | ||
diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES index 4b267c162b..c2ad75e0c7 100644 --- a/apps/plugins/CATEGORIES +++ b/apps/plugins/CATEGORIES | |||
@@ -80,6 +80,7 @@ stopwatch,apps | |||
80 | test_codec,viewers | 80 | test_codec,viewers |
81 | test_disk,apps | 81 | test_disk,apps |
82 | test_fps,apps | 82 | test_fps,apps |
83 | test_grey,apps | ||
83 | test_sampr,apps | 84 | test_sampr,apps |
84 | test_scanrate,apps | 85 | test_scanrate,apps |
85 | test_viewports,apps | 86 | test_viewports,apps |
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 4f782dc455..7b7edbf5c2 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -21,6 +21,7 @@ stats.c | |||
21 | stopwatch.c | 21 | stopwatch.c |
22 | vbrfix.c | 22 | vbrfix.c |
23 | viewer.c | 23 | viewer.c |
24 | test_disk.c | ||
24 | 25 | ||
25 | #ifdef OLYMPUS_MROBE_500 | 26 | #ifdef OLYMPUS_MROBE_500 |
26 | /* remove these once the plugins before it are compileable */ | 27 | /* remove these once the plugins before it are compileable */ |
@@ -48,7 +49,10 @@ flipit.c | |||
48 | #ifdef HAVE_LCD_BITMAP /* Not for the Player */ | 49 | #ifdef HAVE_LCD_BITMAP /* Not for the Player */ |
49 | brickmania.c | 50 | brickmania.c |
50 | maze.c | 51 | maze.c |
51 | mazezam.c | 52 | mazezam.c |
53 | greyscale.c | ||
54 | test_fps.c | ||
55 | test_scanrate.c | ||
52 | text_editor.c | 56 | text_editor.c |
53 | wavview.c | 57 | wavview.c |
54 | robotfindskitten.c | 58 | robotfindskitten.c |
@@ -59,6 +63,10 @@ jpeg.c | |||
59 | mandelbrot.c | 63 | mandelbrot.c |
60 | plasma.c | 64 | plasma.c |
61 | 65 | ||
66 | #if LCD_DEPTH < 4 | ||
67 | test_grey.c | ||
68 | #endif | ||
69 | |||
62 | blackjack.c | 70 | blackjack.c |
63 | bounce.c | 71 | bounce.c |
64 | bubbles.c | 72 | bubbles.c |
@@ -118,6 +126,7 @@ nim.c | |||
118 | 126 | ||
119 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ | 127 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ |
120 | mp3_encoder.c | 128 | mp3_encoder.c |
129 | test_codec.c | ||
121 | wav2wv.c | 130 | wav2wv.c |
122 | #else /* hardware codec platforms */ | 131 | #else /* hardware codec platforms */ |
123 | #ifndef HAVE_MMC /* not for Ondio, has no remote control pin */ | 132 | #ifndef HAVE_MMC /* not for Ondio, has no remote control pin */ |