Commit 21d4c7c7 authored by Rocky Bernstein's avatar Rocky Bernstein

A little cleanup on wait timing. No bug fixes yet, though.

parent 39a7f7e6
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* to go here. * to go here.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000,2003 VideoLAN * Copyright (C) 2000,2003 VideoLAN
* $Id: access.c,v 1.8 2003/12/05 04:24:47 rocky Exp $ * $Id: access.c,v 1.9 2003/12/05 05:01:17 rocky Exp $
* *
* Authors: Rocky Bernstein <rocky@panix.com> * Authors: Rocky Bernstein <rocky@panix.com>
* Johan Bilien <jobi@via.ecp.fr> * Johan Bilien <jobi@via.ecp.fr>
...@@ -410,7 +410,7 @@ VCDPlay( input_thread_t *p_input, vcdinfo_itemid_t itemid ) ...@@ -410,7 +410,7 @@ VCDPlay( input_thread_t *p_input, vcdinfo_itemid_t itemid )
thread_vcd_data_t * p_vcd= (thread_vcd_data_t *)p_input->p_access_data; thread_vcd_data_t * p_vcd= (thread_vcd_data_t *)p_input->p_access_data;
input_area_t * p_area; input_area_t * p_area;
p_vcd->in_still = 0; p_vcd->in_still = false;
dbg_print(INPUT_DBG_CALL, "itemid.num: %d, itemid.type: %d\n", dbg_print(INPUT_DBG_CALL, "itemid.num: %d, itemid.type: %d\n",
itemid.num, itemid.type); itemid.num, itemid.type);
...@@ -454,11 +454,11 @@ VCDPlay( input_thread_t *p_input, vcdinfo_itemid_t itemid ) ...@@ -454,11 +454,11 @@ VCDPlay( input_thread_t *p_input, vcdinfo_itemid_t itemid )
case VCDINFO_FILES_VIDEO_PAL_STILL: case VCDINFO_FILES_VIDEO_PAL_STILL:
case VCDINFO_FILES_VIDEO_PAL_STILL2: case VCDINFO_FILES_VIDEO_PAL_STILL2:
p_input->stream.b_seekable = 0; p_input->stream.b_seekable = 0;
p_vcd->in_still = -5; p_vcd->in_still = true;
break; break;
default: default:
p_input->stream.b_seekable = 1; p_input->stream.b_seekable = 1;
p_vcd->in_still = 0; p_vcd->in_still = false;
} }
} }
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.c: Video CD interface to handle user interaction and still time * intf.c: Video CD interface to handle user interaction and still time
***************************************************************************** *****************************************************************************
* Copyright (C) 2002,2003 VideoLAN * Copyright (C) 2002,2003 VideoLAN
* $Id: intf.c,v 1.10 2003/12/05 04:24:47 rocky Exp $ * $Id: intf.c,v 1.11 2003/12/05 05:01:17 rocky Exp $
* *
* Authors: Rocky Bernstein <rocky@panix.com> * Authors: Rocky Bernstein <rocky@panix.com>
* from DVD code by Stphane Borel <stef@via.ecp.fr> * from DVD code by Stphane Borel <stef@via.ecp.fr>
...@@ -119,13 +119,13 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -119,13 +119,13 @@ static void RunIntf( intf_thread_t *p_intf )
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
/* /*
* still images * Have we timed-out in showing a still frame?
*/ */
if( p_intf->p_sys->b_still && !p_intf->p_sys->b_inf_still ) if( p_intf->p_sys->b_still && !p_intf->p_sys->b_inf_still )
{ {
if( p_intf->p_sys->m_still_time > 0 ) if( p_intf->p_sys->m_still_time > 0 )
{ {
/* update remaining still time */ /* Update remaining still time */
dbg_print(INPUT_DBG_STILL, "updating still time"); dbg_print(INPUT_DBG_STILL, "updating still time");
mtime = mdate(); mtime = mdate();
if( mlast ) if( mlast )
...@@ -137,7 +137,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -137,7 +137,7 @@ static void RunIntf( intf_thread_t *p_intf )
} }
else else
{ {
/* still time elasped */ /* Still time has elasped; set to continue playing. */
dbg_print(INPUT_DBG_STILL, "wait time done - setting play"); dbg_print(INPUT_DBG_STILL, "wait time done - setting play");
input_SetStatus( p_intf->p_sys->p_input, input_SetStatus( p_intf->p_sys->p_input,
INPUT_STATUS_PLAY ); INPUT_STATUS_PLAY );
...@@ -148,7 +148,7 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -148,7 +148,7 @@ static void RunIntf( intf_thread_t *p_intf )
} }
/* /*
* keyboard event * Do we have a keyboard event?
*/ */
if( p_vout && p_intf->p_sys->b_key_pressed ) if( p_vout && p_intf->p_sys->b_key_pressed )
{ {
...@@ -227,8 +227,9 @@ static void RunIntf( intf_thread_t *p_intf ) ...@@ -227,8 +227,9 @@ static void RunIntf( intf_thread_t *p_intf )
} }
number_addend = 0; number_addend = 0;
/* we can safely interact with the VCD player /* Any keypress gets rid of still frame waiting.
* with the stream lock */ FIXME - should handle just the ones that cause an action.
*/
if( p_intf->p_sys->b_still ) if( p_intf->p_sys->b_still )
{ {
dbg_print(INPUT_DBG_STILL, "Playing still after activate"); dbg_print(INPUT_DBG_STILL, "Playing still after activate");
...@@ -360,7 +361,7 @@ int vcdIntfStillTime( intf_thread_t *p_intf, int i_sec ) ...@@ -360,7 +361,7 @@ int vcdIntfStillTime( intf_thread_t *p_intf, int i_sec )
{ {
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
if( i_sec == 0xff ) if( i_sec == -1 )
{ {
p_intf->p_sys->b_still = 1; p_intf->p_sys->b_still = 1;
p_intf->p_sys->b_inf_still = 1; p_intf->p_sys->b_inf_still = 1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.h: send info to intf. * intf.h: send info to intf.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: intf.h,v 1.2 2003/12/05 04:24:47 rocky Exp $ * $Id: intf.h,v 1.3 2003/12/05 05:01:17 rocky Exp $
* *
* Author: Stéphane Borel <stef@via.ecp.fr> * Author: Stéphane Borel <stef@via.ecp.fr>
* *
...@@ -29,10 +29,11 @@ struct intf_sys_t ...@@ -29,10 +29,11 @@ struct intf_sys_t
input_thread_t * p_input; input_thread_t * p_input;
thread_vcd_data_t * p_vcd; thread_vcd_data_t * p_vcd;
vlc_bool_t b_still; vlc_bool_t b_still; /* True if we are in a still frame */
vlc_bool_t b_inf_still; vlc_bool_t b_inf_still; /* True if still wait time is infinite */
mtime_t m_still_time; mtime_t m_still_time; /* Time in microseconds remaining
to wait in still frame.
*/
#if FINISHED #if FINISHED
vcdplay_ctrl_t control; vcdplay_ctrl_t control;
#else #else
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* using libcdio, libvcd and libvcdinfo * using libcdio, libvcd and libvcdinfo
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> * Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
* $Id: vcdplayer.c,v 1.6 2003/12/05 04:24:47 rocky Exp $ * $Id: vcdplayer.c,v 1.7 2003/12/05 05:01:17 rocky Exp $
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -136,9 +136,6 @@ vcdplayer_non_pbc_nav ( input_thread_t * p_input ) ...@@ -136,9 +136,6 @@ vcdplayer_non_pbc_nav ( input_thread_t * p_input )
return READ_BLOCK; return READ_BLOCK;
} }
/* FIXME: Will do whatever the right thing is later. */
#define SLEEP_1_SEC_AND_HANDLE_EVENTS sleep(1)
/* Handles PBC navigation when reaching the end of a play item. */ /* Handles PBC navigation when reaching the end of a play item. */
vcdplayer_read_status_t vcdplayer_read_status_t
vcdplayer_pbc_nav ( input_thread_t * p_input ) vcdplayer_pbc_nav ( input_thread_t * p_input )
...@@ -148,12 +145,6 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) ...@@ -148,12 +145,6 @@ vcdplayer_pbc_nav ( input_thread_t * p_input )
/* We are in playback control. */ /* We are in playback control. */
vcdinfo_itemid_t itemid; vcdinfo_itemid_t itemid;
if (0 != p_vcd->in_still && p_vcd->in_still != -5) {
SLEEP_1_SEC_AND_HANDLE_EVENTS;
if (p_vcd->in_still > 0) p_vcd->in_still--;
return READ_STILL_FRAME;
}
/* The end of an entry is really the end of the associated /* The end of an entry is really the end of the associated
sequence (or track). */ sequence (or track). */
...@@ -181,18 +172,11 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) ...@@ -181,18 +172,11 @@ vcdplayer_pbc_nav ( input_thread_t * p_input )
return READ_BLOCK; return READ_BLOCK;
/* Handle any wait time given. */ /* Handle any wait time given. */
if (-5 == p_vcd->in_still) { if (p_vcd->in_still) {
if (wait_time != 0) { vcdIntfStillTime( p_vcd->p_intf, wait_time );
/* FIXME */
p_vcd->in_still = wait_time - 1;
p_vcd->p_intf->p_sys->m_still_time = (wait_time - 1) * 1000000;
return READ_STILL_FRAME; return READ_STILL_FRAME;
} else {
p_vcd->p_intf->p_sys->m_still_time = 0;
p_vcd->p_intf->p_sys->b_inf_still = 1;
} }
}
vcdplayer_update_entry( p_input, vcdplayer_update_entry( p_input,
vcdinf_pld_get_next_offset(p_vcd->pxd.pld), vcdinf_pld_get_next_offset(p_vcd->pxd.pld),
&itemid.num, "next" ); &itemid.num, "next" );
...@@ -213,16 +197,8 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) ...@@ -213,16 +197,8 @@ vcdplayer_pbc_nav ( input_thread_t * p_input )
wait_time, p_vcd->loop_count, max_loop); wait_time, p_vcd->loop_count, max_loop);
/* Handle any wait time given */ /* Handle any wait time given */
if (-5 == p_vcd->in_still) { if (p_vcd->in_still) {
if (wait_time != 0) { vcdIntfStillTime( p_vcd->p_intf, wait_time );
/* FIXME */
p_vcd->in_still = wait_time - 1;
p_vcd->p_intf->p_sys->m_still_time = (wait_time - 1) * 1000000;
return READ_STILL_FRAME;
} else {
p_vcd->p_intf->p_sys->m_still_time = 0;
p_vcd->p_intf->p_sys->b_inf_still = 1;
}
return READ_STILL_FRAME; return READ_STILL_FRAME;
} }
...@@ -263,7 +239,7 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) ...@@ -263,7 +239,7 @@ vcdplayer_pbc_nav ( input_thread_t * p_input )
return READ_BLOCK; return READ_BLOCK;
} else if (p_vcd->in_still) { } else if (p_vcd->in_still) {
/* Hack: Just go back and do still again */ /* Hack: Just go back and do still again */
SLEEP_1_SEC_AND_HANDLE_EVENTS ; sleep(1);
return READ_STILL_FRAME; return READ_STILL_FRAME;
} }
} }
......
/***************************************************************************** /*****************************************************************************
* Copyright (C) 2003 Rocky Bernstein (for VideoLAN) * Copyright (C) 2003 Rocky Bernstein (for VideoLAN)
* $Id: vcdplayer.h,v 1.3 2003/12/04 05:14:39 rocky Exp $ * $Id: vcdplayer.h,v 1.4 2003/12/05 05:01:17 rocky Exp $
* *
* Authors: Rocky Bernstein <rocky@panix.com> * Authors: Rocky Bernstein <rocky@panix.com>
* *
...@@ -65,12 +65,7 @@ typedef enum { ...@@ -65,12 +65,7 @@ typedef enum {
typedef struct thread_vcd_data_s typedef struct thread_vcd_data_s
{ {
vcdinfo_obj_t *vcd; /* CD device descriptor */ vcdinfo_obj_t *vcd; /* CD device descriptor */
int in_still; /* 0 if not in still, bool in_still; /* true if in still */
-2 if in infinite loop
-5 if a still but haven't
read wait time yet
>0 number of seconds yet to
wait */
unsigned int num_tracks; /* Nb of tracks (titles) */ unsigned int num_tracks; /* Nb of tracks (titles) */
unsigned int num_segments; /* Nb of segments */ unsigned int num_segments; /* Nb of segments */
unsigned int num_entries; /* Nb of entries */ unsigned int num_entries; /* Nb of entries */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment