From: Rocky Bernstein Date: Fri, 5 Dec 2003 05:01:17 +0000 (+0000) Subject: A little cleanup on wait timing. No bug fixes yet, though. X-Git-Tag: 0.7.0~216 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=21d4c7c7e8743d9849cfcd338496d3a613ab39fa;p=vlc A little cleanup on wait timing. No bug fixes yet, though. --- diff --git a/modules/access/vcdx/access.c b/modules/access/vcdx/access.c index 320e597a37..ada2d56289 100644 --- a/modules/access/vcdx/access.c +++ b/modules/access/vcdx/access.c @@ -4,7 +4,7 @@ * to go here. ***************************************************************************** * 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 * Johan Bilien @@ -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; 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", itemid.num, itemid.type); @@ -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_STILL2: p_input->stream.b_seekable = 0; - p_vcd->in_still = -5; + p_vcd->in_still = true; break; default: p_input->stream.b_seekable = 1; - p_vcd->in_still = 0; + p_vcd->in_still = false; } } break; diff --git a/modules/access/vcdx/intf.c b/modules/access/vcdx/intf.c index cd70c4aa7a..6b2ce07092 100644 --- a/modules/access/vcdx/intf.c +++ b/modules/access/vcdx/intf.c @@ -2,7 +2,7 @@ * intf.c: Video CD interface to handle user interaction and still time ***************************************************************************** * 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 * from DVD code by Stéphane Borel @@ -119,13 +119,13 @@ static void RunIntf( intf_thread_t *p_intf ) 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->m_still_time > 0 ) { - /* update remaining still time */ + /* Update remaining still time */ dbg_print(INPUT_DBG_STILL, "updating still time"); mtime = mdate(); if( mlast ) @@ -137,7 +137,7 @@ static void RunIntf( intf_thread_t *p_intf ) } else { - /* still time elasped */ + /* Still time has elasped; set to continue playing. */ dbg_print(INPUT_DBG_STILL, "wait time done - setting play"); input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); @@ -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 ) { @@ -227,8 +227,9 @@ static void RunIntf( intf_thread_t *p_intf ) } number_addend = 0; - /* we can safely interact with the VCD player - * with the stream lock */ + /* Any keypress gets rid of still frame waiting. + FIXME - should handle just the ones that cause an action. + */ if( p_intf->p_sys->b_still ) { dbg_print(INPUT_DBG_STILL, "Playing still after activate"); @@ -360,9 +361,9 @@ int vcdIntfStillTime( intf_thread_t *p_intf, int i_sec ) { 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; } else if( i_sec > 0 ) diff --git a/modules/access/vcdx/intf.h b/modules/access/vcdx/intf.h index 1adf05c698..7ba5499ee7 100644 --- a/modules/access/vcdx/intf.h +++ b/modules/access/vcdx/intf.h @@ -2,7 +2,7 @@ * intf.h: send info to intf. ***************************************************************************** * 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 * @@ -26,19 +26,20 @@ *****************************************************************************/ struct intf_sys_t { - input_thread_t * p_input; - thread_vcd_data_t * p_vcd; - - vlc_bool_t b_still; - vlc_bool_t b_inf_still; - mtime_t m_still_time; - + input_thread_t * p_input; + thread_vcd_data_t * p_vcd; + + vlc_bool_t b_still; /* True if we are in a still frame */ + vlc_bool_t b_inf_still; /* True if still wait time is infinite */ + mtime_t m_still_time; /* Time in microseconds remaining + to wait in still frame. + */ #if FINISHED - vcdplay_ctrl_t control; + vcdplay_ctrl_t control; #else - int control; + int control; #endif - vlc_bool_t b_click, b_move, b_key_pressed; + vlc_bool_t b_click, b_move, b_key_pressed; }; int vcdIntfStillTime( struct intf_thread_t *, int ); diff --git a/modules/access/vcdx/vcdplayer.c b/modules/access/vcdx/vcdplayer.c index 91c4a11a16..3e355081df 100644 --- a/modules/access/vcdx/vcdplayer.c +++ b/modules/access/vcdx/vcdplayer.c @@ -3,7 +3,7 @@ * using libcdio, libvcd and libvcdinfo ***************************************************************************** * Copyright (C) 2003 Rocky Bernstein - * $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 * 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 ) 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. */ vcdplayer_read_status_t 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. */ 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 sequence (or track). */ @@ -181,18 +172,11 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) return READ_BLOCK; /* Handle any wait time given. */ - if (-5 == p_vcd->in_still) { - if (wait_time != 0) { - /* 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; - } - + if (p_vcd->in_still) { + vcdIntfStillTime( p_vcd->p_intf, wait_time ); + return READ_STILL_FRAME; } + vcdplayer_update_entry( p_input, vcdinf_pld_get_next_offset(p_vcd->pxd.pld), &itemid.num, "next" ); @@ -213,18 +197,10 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) wait_time, p_vcd->loop_count, max_loop); /* Handle any wait time given */ - if (-5 == p_vcd->in_still) { - if (wait_time != 0) { - /* 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; - } + if (p_vcd->in_still) { + vcdIntfStillTime( p_vcd->p_intf, wait_time ); return READ_STILL_FRAME; - } + } /* Handle any looping given. */ if ( max_loop == 0 || p_vcd->loop_count < max_loop ) { @@ -263,7 +239,7 @@ vcdplayer_pbc_nav ( input_thread_t * p_input ) return READ_BLOCK; } else if (p_vcd->in_still) { /* Hack: Just go back and do still again */ - SLEEP_1_SEC_AND_HANDLE_EVENTS ; + sleep(1); return READ_STILL_FRAME; } } diff --git a/modules/access/vcdx/vcdplayer.h b/modules/access/vcdx/vcdplayer.h index 662cf91a11..78c9c9fe02 100644 --- a/modules/access/vcdx/vcdplayer.h +++ b/modules/access/vcdx/vcdplayer.h @@ -1,6 +1,6 @@ /***************************************************************************** * 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 * @@ -65,12 +65,7 @@ typedef enum { typedef struct thread_vcd_data_s { vcdinfo_obj_t *vcd; /* CD device descriptor */ - int in_still; /* 0 if not 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 */ + bool in_still; /* true if in still */ unsigned int num_tracks; /* Nb of tracks (titles) */ unsigned int num_segments; /* Nb of segments */ unsigned int num_entries; /* Nb of entries */