summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-08-17 18:35:11 +0000
committerDave Chapman <dave@dchapman.com>2006-08-17 18:35:11 +0000
commit567cb6e615dca698d8ce7a46b8f94ccd8500f428 (patch)
tree4daf09bb890fab259f858483ca564d56b0c66b76 /apps/plugins
parentf5e78674ffb08fbea9fa56fda0d88c97a7a03041 (diff)
downloadrockbox-567cb6e615dca698d8ce7a46b8f94ccd8500f428.zip
rockbox-567cb6e615dca698d8ce7a46b8f94ccd8500f428.tar.gz
rockbox-567cb6e615dca698d8ce7a46b8f94ccd8500f428.tar.bz2
rockbox-567cb6e615dca698d8ce7a46b8f94ccd8500f428.tar.xz
Clean up the video output code - remove the final traces of libvo (used by mpeg2dec) and remove unused code-paths from the main decoding loop.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c84
-rw-r--r--apps/plugins/mpegplayer/video_out.h38
-rw-r--r--apps/plugins/mpegplayer/video_out_rockbox.c69
3 files changed, 23 insertions, 168 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 577d9c6..be028c0 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -1,4 +1,4 @@
-/*
+ /*
* mpegplayer.c - based on mpeg2dec.c
*
* Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
@@ -45,11 +45,8 @@ struct plugin_api* rb;
#define BUFFER_SIZE (MEM-6)*1024*1024
static mpeg2dec_t * mpeg2dec;
-static vo_open_t * output_open = NULL;
-static vo_instance_t * output;
static int total_offset = 0;
-extern vo_open_t vo_rockbox_open;
/* button definitions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define MPEG_STOP BUTTON_OFF
@@ -106,7 +103,6 @@ static bool decode_mpeg2 (uint8_t * current, uint8_t * end)
{
const mpeg2_info_t * info;
mpeg2_state_t state;
- vo_setup_result_t setup_result;
mpeg2_buffer (mpeg2dec, current, end);
total_offset += end - current;
@@ -121,70 +117,20 @@ static bool decode_mpeg2 (uint8_t * current, uint8_t * end)
case STATE_BUFFER:
return false;
case STATE_SEQUENCE:
- /* might set nb fbuf, convert format, stride */
- /* might set fbufs */
- if (output->setup (output, info->sequence->width,
- info->sequence->height,
- info->sequence->chroma_width,
- info->sequence->chroma_height, &setup_result)) {
- //fprintf (stderr, "display setup failed\n");
- return false;
- }
- if (setup_result.convert &&
- mpeg2_convert (mpeg2dec, setup_result.convert, NULL)) {
- //fprintf (stderr, "color conversion setup failed\n");
- return false;
- }
- if (output->set_fbuf) {
- uint8_t * buf[3];
- void * id;
-
- mpeg2_custom_fbuf (mpeg2dec, 1);
- output->set_fbuf (output, buf, &id);
- mpeg2_set_buf (mpeg2dec, buf, id);
- output->set_fbuf (output, buf, &id);
- mpeg2_set_buf (mpeg2dec, buf, id);
- } else if (output->setup_fbuf) {
- uint8_t * buf[3];
- void * id;
-
- output->setup_fbuf (output, buf, &id);
- mpeg2_set_buf (mpeg2dec, buf, id);
- output->setup_fbuf (output, buf, &id);
- mpeg2_set_buf (mpeg2dec, buf, id);
- output->setup_fbuf (output, buf, &id);
- mpeg2_set_buf (mpeg2dec, buf, id);
- }
- mpeg2_skip (mpeg2dec, (output->draw == NULL));
+ vo_setup(info->sequence->width,
+ info->sequence->height,
+ info->sequence->chroma_width,
+ info->sequence->chroma_height);
+ mpeg2_skip (mpeg2dec, false);
break;
case STATE_PICTURE:
- /* might skip */
- /* might set fbuf */
- if (output->set_fbuf) {
- uint8_t * buf[3];
- void * id;
-
- output->set_fbuf (output, buf, &id);
- mpeg2_set_buf (mpeg2dec, buf, id);
- }
- if (output->start_fbuf)
- output->start_fbuf (output, info->current_fbuf->buf,
- info->current_fbuf->id);
break;
case STATE_SLICE:
case STATE_END:
case STATE_INVALID_END:
/* draw current picture */
- /* might free frame buffer */
- if (info->display_fbuf) {
- if (output->draw)
- output->draw (output, info->display_fbuf->buf,
- info->display_fbuf->id);
- //print_fps (0);
- }
- if (output->discard && info->discard_fbuf)
- output->discard (output, info->discard_fbuf->buf,
- info->discard_fbuf->id);
+ if (info->display_fbuf)
+ vo_draw_frame(info->display_fbuf->buf);
break;
default:
break;
@@ -256,20 +202,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
return PLUGIN_ERROR;
}
- output_open = vo_rockbox_open;
-
- if (output_open == NULL) {
- //fprintf (stderr, "output_open is NULL\n");
- return PLUGIN_ERROR;
- }
-
- output = output_open ();
-
- if (output == NULL) {
- //fprintf (stderr, "Can not open output\n");
- return PLUGIN_ERROR;
- }
-
mpeg2dec = mpeg2_init ();
if (mpeg2dec == NULL)
diff --git a/apps/plugins/mpegplayer/video_out.h b/apps/plugins/mpegplayer/video_out.h
index 342c551..e29d0d7 100644
--- a/apps/plugins/mpegplayer/video_out.h
+++ b/apps/plugins/mpegplayer/video_out.h
@@ -21,38 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-struct mpeg2_sequence_s;
-struct mpeg2_convert_init_s;
-typedef struct {
- int (* convert) (int stage, void * id,
- const struct mpeg2_sequence_s * sequence,
- int stride, uint32_t accel, void * arg,
- struct mpeg2_convert_init_s * result);
-} vo_setup_result_t;
-
-typedef struct vo_instance_s vo_instance_t;
-struct vo_instance_s {
- int (* setup) (vo_instance_t * instance, unsigned int width,
- unsigned int height, unsigned int chroma_width,
- unsigned int chroma_height, vo_setup_result_t * result);
- void (* setup_fbuf) (vo_instance_t * instance, uint8_t ** buf, void ** id);
- void (* set_fbuf) (vo_instance_t * instance, uint8_t ** buf, void ** id);
- void (* start_fbuf) (vo_instance_t * instance,
- uint8_t * const * buf, void * id);
- void (* draw) (vo_instance_t * instance, uint8_t * const * buf, void * id);
- void (* discard) (vo_instance_t * instance,
- uint8_t * const * buf, void * id);
- void (* close) (vo_instance_t * instance);
-};
-
-typedef vo_instance_t * vo_open_t (void);
-
-typedef struct {
- char * name;
- vo_open_t * open;
-} vo_driver_t;
-
-void vo_accel (uint32_t accel);
-
-/* return NULL terminated array of all drivers */
-vo_driver_t const * vo_drivers (void);
+void vo_draw_frame (uint8_t * const * buf);
+void vo_setup (unsigned int width, unsigned int height,
+ unsigned int chroma_width, unsigned int chroma_height);
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c
index 7bce6aa..258416f 100644
--- a/apps/plugins/mpegplayer/video_out_rockbox.c
+++ b/apps/plugins/mpegplayer/video_out_rockbox.c
@@ -45,8 +45,7 @@ static int output_y;
static int output_width;
static int output_height;
-#if (LCD_DEPTH == 16) && \
- ((LCD_PIXELFORMAT == RGB565) || (LCD_PIXELFORMAT == RGB565SWAPPED))
+#ifdef SIMULATOR
#define RYFAC (31*257)
#define GYFAC (63*257)
@@ -59,9 +58,9 @@ static int output_height;
#define ROUNDOFFS (127*257)
/* Draw a partial YUV colour bitmap - taken from the Rockbox JPEG viewer */
-void yuv_bitmap_part(unsigned char * const src[3],
- int src_x, int src_y, int stride,
- int x, int y, int width, int height)
+static void yuv_bitmap_part(unsigned char * const src[3],
+ int src_x, int src_y, int stride,
+ int x, int y, int width, int height)
{
fb_data *dst, *dst_end;
@@ -190,25 +189,20 @@ void yuv_bitmap_part(unsigned char * const src[3],
}
#endif
-static void rockbox_draw_frame (vo_instance_t * instance,
- uint8_t * const * buf, void * id)
+void vo_draw_frame (uint8_t * const * buf)
{
char str[80];
static int frame=0;
int ticks,fps;
- (void)id;
- (void)instance;
-
-#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR)
- rb->lcd_yuv_blit(buf,
- 0,0,image_width,
- output_x,output_y,output_width,output_height);
-#elif (LCD_DEPTH == 16) && \
- ((LCD_PIXELFORMAT == RGB565) || (LCD_PIXELFORMAT == RGB565SWAPPED))
+#ifdef SIMULATOR
yuv_bitmap_part(buf,0,0,image_width,
output_x,output_y,output_width,output_height);
rb->lcd_update_rect(output_x,output_y,output_width,output_height);
+#else
+ rb->lcd_yuv_blit(buf,
+ 0,0,image_width,
+ output_x,output_y,output_width,output_height);
#endif
if (starttick==0) {
@@ -230,41 +224,9 @@ static void rockbox_draw_frame (vo_instance_t * instance,
frame++;
}
-vo_instance_t static_instance;
-
-static vo_instance_t * internal_open (int setup (vo_instance_t *, unsigned int,
- unsigned int, unsigned int,
- unsigned int,
- vo_setup_result_t *),
- void draw (vo_instance_t *,
- uint8_t * const *, void *))
-{
- vo_instance_t * instance;
-
- instance = (vo_instance_t *) &static_instance;
- if (instance == NULL)
- return NULL;
-
- instance->setup = setup;
- instance->setup_fbuf = NULL;
- instance->set_fbuf = NULL;
- instance->start_fbuf = NULL;
- instance->draw = draw;
- instance->discard = NULL;
- //instance->close = (void (*) (vo_instance_t *)) free;
-
- return instance;
-}
-
-static int rockbox_setup (vo_instance_t * instance, unsigned int width,
- unsigned int height, unsigned int chroma_width,
- unsigned int chroma_height,
- vo_setup_result_t * result)
+void vo_setup(unsigned int width, unsigned int height,
+ unsigned int chroma_width, unsigned int chroma_height)
{
- (void)instance;
-
- result->convert = NULL;
-
image_width=width;
image_height=height;
image_chroma_x=image_width/chroma_width;
@@ -285,11 +247,4 @@ static int rockbox_setup (vo_instance_t * instance, unsigned int width,
output_height = image_height;
output_y = (LCD_HEIGHT-image_height)/2;
}
-
- return 0;
-}
-
-vo_instance_t * vo_rockbox_open (void)
-{
- return internal_open (rockbox_setup, rockbox_draw_frame);
}