summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-03-26 01:32:31 +0000
committerDave Chapman <dave@dchapman.com>2007-03-26 01:32:31 +0000
commita56757137c9b8e11e5380270a1ebbbd29ad0b0d0 (patch)
treee2113fd56fd537d95e96a972925a8c05fc40dfe6 /apps
parent8f04faef91e759aa97d85f403ba236278a25d9f6 (diff)
downloadrockbox-a56757137c9b8e11e5380270a1ebbbd29ad0b0d0.zip
rockbox-a56757137c9b8e11e5380270a1ebbbd29ad0b0d0.tar.gz
rockbox-a56757137c9b8e11e5380270a1ebbbd29ad0b0d0.tar.bz2
rockbox-a56757137c9b8e11e5380270a1ebbbd29ad0b0d0.tar.xz
mpegplayer for grayscale targets. Note that performance is slow...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12913 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/SUBDIRS5
-rw-r--r--apps/plugins/mpegplayer/Makefile2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c39
-rw-r--r--apps/plugins/mpegplayer/video_out_rockbox.c6
4 files changed, 46 insertions, 6 deletions
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS
index 4a2a819..70cffe7 100644
--- a/apps/plugins/SUBDIRS
+++ b/apps/plugins/SUBDIRS
@@ -31,10 +31,9 @@ pacbox
doom
#endif
-/* For all the colour targets */
-#if defined(HAVE_LCD_COLOR)
+/* For all the swcodec targets */
+#if CONFIG_CODEC == SWCODEC
mpegplayer
#endif
-
#endif /* IRIVER_IFP7XX_SERIES */
diff --git a/apps/plugins/mpegplayer/Makefile b/apps/plugins/mpegplayer/Makefile
index 7b52d2d..28691f4 100644
--- a/apps/plugins/mpegplayer/Makefile
+++ b/apps/plugins/mpegplayer/Makefile
@@ -8,7 +8,7 @@
#
INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
- -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
+ -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(APPSDIR)/plugins/lib -I$(OUTDIR) -I$(BUILDDIR)
CFLAGS = $(INCLUDES) $(GCCOPTS) -O2 $(TARGET) $(EXTRA_DEFINES) \
-DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 80159e3..a5b71c0 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -103,6 +103,7 @@ FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz
#include "mpeg2dec_config.h"
#include "plugin.h"
+#include "gray.h"
#include "mpeg2.h"
#include "mpeg_settings.h"
@@ -270,8 +271,16 @@ static void button_loop(void)
/* Wait for video thread to stop */
while (videostatus == PLEASE_PAUSE) { rb->sleep(HZ/25); }
}
+
+#ifndef HAVE_LCD_COLOR
+ gray_show(false);
+#endif
result = mpeg_menu();
+#ifndef HAVE_LCD_COLOR
+ gray_show(true);
+#endif
+
/* The menu can change the font, so restore */
rb->lcd_setfont(FONT_SYSFIXED);
@@ -911,6 +920,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
size_t file_remaining;
size_t n;
size_t disk_buf_len;
+#ifndef HAVE_LCD_COLOR
+ long graysize;
+ int grayscales;
+#endif
/* We define this here so it is on the main stack (in IRAM) */
mad_fixed_t mad_frame_overlap[2][32][18]; /* 4608 bytes */
@@ -940,13 +953,27 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
buffer_size = audiosize - (PCMBUFFER_SIZE+AUDIOBUFFER_SIZE+LIBMPEG2BUFFER_SIZE);
DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
- buffer_size &= ~(0x7ff); /* Round buffer down to nearest 2KB */
- DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
buffer = mpeg2_malloc(buffer_size,-1);
if (buffer == NULL)
return PLUGIN_ERROR;
+#ifndef HAVE_LCD_COLOR
+ /* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */
+ grayscales = gray_init(rb, buffer, buffer_size, false, LCD_WIDTH, LCD_HEIGHT,
+ 32, 2<<8, &graysize) + 1;
+ buffer += graysize;
+ buffer_size -= graysize;
+ if (grayscales < 33 || buffer_size <= 0)
+ {
+ rb->splash(HZ, "gray buf error");
+ return PLUGIN_ERROR;
+ }
+#endif
+
+ buffer_size &= ~(0x7ff); /* Round buffer down to nearest 2KB */
+ DEBUGF("audiosize=%d, buffer_size=%ld\n",audiosize,buffer_size);
+
mpa_buffer_size = AUDIOBUFFER_SIZE;
mpa_buffer = mpeg2_malloc(mpa_buffer_size,-2);
@@ -1026,6 +1053,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
audiostatus = STREAM_BUFFERING;
videostatus = STREAM_PLAYING;
+#ifndef HAVE_LCD_COLOR
+ gray_show(true);
+#endif
+
/* We put the video thread on the second processor for multi-core targets. */
if ((videothread_id = rb->create_thread(video_thread,
(uint8_t*)video_stack,VIDEO_STACKSIZE,"mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK)
@@ -1074,6 +1105,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->sleep(HZ/10);
}
+#ifndef HAVE_LCD_COLOR
+ gray_release();
+#endif
+
rb->remove_thread(audiothread_id);
rb->yield(); /* Is this needed? */
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c
index f6e33e9..b37b754 100644
--- a/apps/plugins/mpegplayer/video_out_rockbox.c
+++ b/apps/plugins/mpegplayer/video_out_rockbox.c
@@ -24,6 +24,7 @@
#include "mpeg2dec_config.h"
#include "plugin.h"
+#include "gray.h"
extern struct plugin_api* rb;
@@ -188,6 +189,7 @@ static void yuv_bitmap_part(unsigned char * const src[3],
void vo_draw_frame (uint8_t * const * buf)
{
+#ifdef HAVE_LCD_COLOR
#ifdef SIMULATOR
yuv_bitmap_part(buf,0,0,image_width,
output_x,output_y,output_width,output_height);
@@ -197,6 +199,10 @@ void vo_draw_frame (uint8_t * const * buf)
0,0,image_width,
output_x,output_y,output_width,output_height);
#endif
+#else
+ gray_ub_gray_bitmap_part(buf[0],0,0,image_width,
+ output_x,output_y,output_width,output_height);
+#endif
}
#if LCD_WIDTH >= LCD_HEIGHT