1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dave Chapman 2006-08-17 18:35:11 +00:00
parent f5e78674ff
commit 567cb6e615
3 changed files with 23 additions and 168 deletions

View file

@ -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)