summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/input/vcd/vcdplayer.c96
-rw-r--r--src/input/vcd/xineplug_inp_vcd.c51
2 files changed, 56 insertions, 91 deletions
diff --git a/src/input/vcd/vcdplayer.c b/src/input/vcd/vcdplayer.c
index 86a751a00..2d2659600 100644
--- a/src/input/vcd/vcdplayer.c
+++ b/src/input/vcd/vcdplayer.c
@@ -1,7 +1,7 @@
/*
- $Id: vcdplayer.c,v 1.12 2005/01/02 02:51:39 rockyb Exp $
+ $Id: vcdplayer.c,v 1.13 2005/01/02 13:51:01 rockyb Exp $
- Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
+ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -694,40 +694,19 @@ _vcdplayer_set_origin(vcdplayer_t *p_vcdplayer)
p_vcdplayer->end_lsn);
}
-#define RETURN_NULL_BLOCK \
- memset (buf, 0, M2F2_SECTOR_SIZE); \
- buf[0] = 0; buf[1] = 0; buf[2] = 0x01; \
- return READ_BLOCK
-
-#define RETURN_NULL_STILL \
- memset (buf, 0, M2F2_SECTOR_SIZE); \
- buf[0] = 0; buf[1] = 0; buf[2] = 0x01; \
+#define RETURN_NULL_STILL \
+ p_vcdplayer->i_still = 127; \
+ memset (p_buf, 0, M2F2_SECTOR_SIZE); \
+ p_buf[0] = 0; p_buf[1] = 0; p_buf[2] = 0x01; \
return READ_STILL_FRAME
-#define SLEEP_1_SEC_AND_HANDLE_EVENTS \
- if (p_vcdplayer->handle_events()) goto skip_next_play; \
- p_vcdplayer->sleep(250000); \
- if (p_vcdplayer->handle_events()) goto skip_next_play; \
- p_vcdplayer->sleep(250000); \
- if (p_vcdplayer->handle_events()) goto skip_next_play; \
- p_vcdplayer->sleep(250000); \
- if (p_vcdplayer->handle_events()) goto skip_next_play; \
- p_vcdplayer->sleep(250000);
-/* if (p_vcdplayer->i_still) p_vcdplayer->force_redisplay(); */
-
/* Handles PBC navigation when reaching the end of a play item. */
static vcdplayer_read_status_t
-vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
+vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *p_buf)
{
/* We are in playback control. */
vcdinfo_itemid_t itemid;
- if (0 != p_vcdplayer->i_still && p_vcdplayer->i_still != STILL_READING) {
- SLEEP_1_SEC_AND_HANDLE_EVENTS;
- if (p_vcdplayer->i_still > 0) p_vcdplayer->i_still--;
- return READ_STILL_FRAME;
- }
-
/* The end of an entry is really the end of the associated
sequence (or track). */
@@ -754,13 +733,10 @@ vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
if (_vcdplayer_inc_play_item(p_vcdplayer))
goto skip_next_play;
- /* Handle any wait time given. */
- if (STILL_READING == p_vcdplayer->i_still) {
- if (wait_time != 0) {
- p_vcdplayer->i_still = wait_time - 1;
- SLEEP_1_SEC_AND_HANDLE_EVENTS ;
- return READ_STILL_FRAME;
- }
+ /* Set caller to handle wait time given. */
+ if (STILL_READING == p_vcdplayer->i_still && wait_time > 0) {
+ p_vcdplayer->i_still = wait_time;
+ return READ_STILL_FRAME;
}
break;
}
@@ -776,10 +752,9 @@ vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
dbg_print(INPUT_DBG_PBC, "wait_time: %d, looped: %d, max_loop %d\n",
wait_time, p_vcdplayer->i_loop, max_loop);
- /* Handle any wait time given */
- if (STILL_READING == p_vcdplayer->i_still) {
- p_vcdplayer->i_still = wait_time - 1;
- SLEEP_1_SEC_AND_HANDLE_EVENTS ;
+ /* Set caller to handle wait time given. */
+ if (STILL_READING == p_vcdplayer->i_still && wait_time > 0) {
+ p_vcdplayer->i_still = wait_time;
return READ_STILL_FRAME;
}
@@ -822,7 +797,6 @@ vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
goto skip_next_play;
} else if (p_vcdplayer->i_still) {
/* Hack: Just go back and do still again */
- SLEEP_1_SEC_AND_HANDLE_EVENTS ;
RETURN_NULL_STILL ;
}
}
@@ -855,7 +829,7 @@ vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
is to do something that's probably right or helpful.
*/
static vcdplayer_read_status_t
-vcdplayer_non_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
+vcdplayer_non_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *p_buf)
{
/* Not in playback control. Do we advance automatically or stop? */
switch (p_vcdplayer->play_item.type) {
@@ -869,43 +843,21 @@ vcdplayer_non_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
return READ_END;
break;
case VCDINFO_ITEM_TYPE_SPAREID2:
- /* printf("SPAREID2\n"); */
- if (p_vcdplayer->i_still) {
- RETURN_NULL_STILL ;
- /* Hack: Just go back and do still again */
- /*p_vcdplayer->force_redisplay();
- p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn;*/
- }
- return READ_END;
+ RETURN_NULL_STILL ;
case VCDINFO_ITEM_TYPE_NOTFOUND:
LOG_ERR(p_vcdplayer, "NOTFOUND outside PBC -- not supposed to happen\n");
- if (p_vcdplayer->i_still) {
- RETURN_NULL_STILL ;
- /* Hack: Just go back and do still again */
- /*p_vcdplayer->force_redisplay();
- p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn;*/
- } else
- return READ_END;
+ return READ_END;
break;
case VCDINFO_ITEM_TYPE_LID:
LOG_ERR(p_vcdplayer, "LID outside PBC -- not supposed to happen\n");
- if (p_vcdplayer->i_still) {
- RETURN_NULL_STILL ;
- /* Hack: Just go back and do still again */
- /* p_vcdplayer->force_redisplay();
- p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn; */
- } else
- return READ_END;
+ return READ_END;
break;
case VCDINFO_ITEM_TYPE_SEGMENT:
- if (p_vcdplayer->i_still) {
- /* Hack: Just go back and do still again */
- RETURN_NULL_STILL ;
- }
- return READ_END;
+ /* Hack: Just go back and do still again */
+ RETURN_NULL_STILL ;
}
return READ_BLOCK;
}
@@ -919,7 +871,7 @@ vcdplayer_non_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
interpret the next item in the playback-control list.
*/
vcdplayer_read_status_t
-vcdplayer_read (vcdplayer_t *p_vcdplayer, uint8_t *buf,
+vcdplayer_read (vcdplayer_t *p_vcdplayer, uint8_t *p_buf,
const off_t nlen)
{
@@ -935,8 +887,8 @@ vcdplayer_read (vcdplayer_t *p_vcdplayer, uint8_t *buf,
handle_item_continuation:
read_status = vcdplayer_pbc_is_on(p_vcdplayer)
- ? vcdplayer_pbc_nav(p_vcdplayer, buf)
- : vcdplayer_non_pbc_nav(p_vcdplayer, buf);
+ ? vcdplayer_pbc_nav(p_vcdplayer, p_buf)
+ : vcdplayer_non_pbc_nav(p_vcdplayer, p_buf);
if (READ_BLOCK != read_status) return read_status;
}
@@ -986,7 +938,7 @@ vcdplayer_read (vcdplayer_t *p_vcdplayer, uint8_t *buf,
/* We've run off of the end of this entry. Do we continue or stop? */
goto handle_item_continuation;
- memcpy (buf, vcd_sector.data, M2F2_SECTOR_SIZE);
+ memcpy (p_buf, vcd_sector.data, M2F2_SECTOR_SIZE);
return READ_BLOCK;
}
}
diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c
index c882cb919..e32c4dc20 100644
--- a/src/input/vcd/xineplug_inp_vcd.c
+++ b/src/input/vcd/xineplug_inp_vcd.c
@@ -1,7 +1,7 @@
/*
- $Id: xineplug_inp_vcd.c,v 1.30 2005/01/02 02:51:39 rockyb Exp $
+ $Id: xineplug_inp_vcd.c,v 1.31 2005/01/02 13:51:01 rockyb Exp $
- Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
+ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -619,6 +619,16 @@ vcd_plugin_read (input_plugin_t *this_gen, char *buf, const off_t nlen)
return (off_t) 1;
}
+#define SLEEP_1_SEC_AND_HANDLE_EVENTS \
+ if (p_vcdplayer->handle_events()) goto read_block; \
+ p_vcdplayer->sleep(250000); \
+ if (p_vcdplayer->handle_events()) goto read_block; \
+ p_vcdplayer->sleep(250000); \
+ if (p_vcdplayer->handle_events()) goto read_block; \
+ p_vcdplayer->sleep(250000); \
+ if (p_vcdplayer->handle_events()) goto read_block; \
+ p_vcdplayer->sleep(250000);
+
/*!
From xine plugin spec:
@@ -631,7 +641,7 @@ static buf_element_t *
vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
const off_t nlen)
{
- vcdplayer_t *vcdplayer = &my_vcd.player;
+ vcdplayer_t *p_vcdplayer = &my_vcd.player;
buf_element_t *buf;
uint8_t data[M2F2_SECTOR_SIZE];
@@ -645,15 +655,21 @@ vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
/* Should we change this to <= instead of !=? */
if (nlen != M2F2_SECTOR_SIZE) return NULL;
- switch (vcdplayer_read(vcdplayer, data, nlen)) {
+ if (p_vcdplayer->i_still > 0) goto read_still;
+
+ read_block:
+ switch (vcdplayer_read(p_vcdplayer, data, nlen)) {
case READ_END:
/* End reached. Return NULL to indicated this. */
return NULL;
case READ_ERROR:
/* Some sort of error. */
return NULL;
+ read_still:
case READ_STILL_FRAME:
{
+ p_vcdplayer->i_still--;
+ SLEEP_1_SEC_AND_HANDLE_EVENTS ;
dbg_print(INPUT_DBG_STILL, "Handled still event\n");
buf = fifo->buffer_pool_alloc (fifo);
buf->type = BUF_CONTROL_NOP;
@@ -669,22 +685,19 @@ vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
buf->content = buf->mem;
- if (vcdplayer->i_still != my_vcd.i_old_still) {
- if (vcdplayer->i_still) {
- my_vcd.i_old_deinterlace = xine_get_param(my_vcd.stream,
- XINE_PARAM_VO_DEINTERLACE);
- xine_set_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE, 0);
- dbg_print(INPUT_DBG_STILL, "going into still, saving deinterlace %d\n",
- my_vcd.i_old_deinterlace);
- } else {
- dbg_print(INPUT_DBG_STILL,
- "going out of still, restoring deinterlace\n");
- xine_set_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE,
- my_vcd.i_old_deinterlace);
- }
-
+ if (STILL_READING == p_vcdplayer->i_still && 0 == my_vcd.i_old_still) {
+ my_vcd.i_old_deinterlace = xine_get_param(my_vcd.stream,
+ XINE_PARAM_VO_DEINTERLACE);
+ xine_set_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE, 0);
+ dbg_print(INPUT_DBG_STILL, "going into still, saving deinterlace %d\n",
+ my_vcd.i_old_deinterlace);
+ } else if (0 == p_vcdplayer->i_still && 0 != my_vcd.i_old_still) {
+ dbg_print(INPUT_DBG_STILL,
+ "going out of still, restoring deinterlace\n");
+ xine_set_param(my_vcd.stream, XINE_PARAM_VO_DEINTERLACE,
+ my_vcd.i_old_deinterlace);
}
- my_vcd.i_old_still = vcdplayer->i_still;
+ my_vcd.i_old_still = p_vcdplayer->i_still;
/* Ideally this should probably be nlen. */
memcpy (buf->mem, data, M2F2_SECTOR_SIZE);