]> git.sesse.net Git - vlc/commitdiff
A little cleanup on wait timing. No bug fixes yet, though.
authorRocky Bernstein <rocky@videolan.org>
Fri, 5 Dec 2003 05:01:17 +0000 (05:01 +0000)
committerRocky Bernstein <rocky@videolan.org>
Fri, 5 Dec 2003 05:01:17 +0000 (05:01 +0000)
modules/access/vcdx/access.c
modules/access/vcdx/intf.c
modules/access/vcdx/intf.h
modules/access/vcdx/vcdplayer.c
modules/access/vcdx/vcdplayer.h

index 320e597a37d33f34b8daf1afe43a7358aa09da3b..ada2d56289c6b6f470c7ffef5fc3d2058b3f90e1 100644 (file)
@@ -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 <rocky@panix.com> 
  *          Johan Bilien <jobi@via.ecp.fr>
@@ -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;
index cd70c4aa7a663622c1b759c7ae83c69ff3ac3843..6b2ce0709217889e9635f5e3d3c6d63f1a385c28 100644 (file)
@@ -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 <rocky@panix.com>
  *   from DVD code by Stéphane Borel <stef@via.ecp.fr>
@@ -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 )
index 1adf05c698e9c73769d5a55af718cdad9c6f5e8a..7ba5499ee76bd769b596c3d00f3179ed2ac2154a 100644 (file)
@@ -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 <stef@via.ecp.fr>
  *
  *****************************************************************************/
 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 );
index 91c4a11a16d4e348ea4867d89170108e50ae1843..3e355081dfe04c3fd7d432201257b89e752ddfea 100644 (file)
@@ -3,7 +3,7 @@
  *               using libcdio, libvcd and libvcdinfo
  *****************************************************************************
  * 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
  * 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;
         }
       }
index 662cf91a11d77fea46b765bf794a59a7ff8cab3f..78c9c9fe023edb1b1f1769ce641ec5797008885d 100644 (file)
@@ -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 <rocky@panix.com> 
  *
@@ -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 */