]> git.sesse.net Git - vlc/commitdiff
Handle keyboard input: numeric entry, next, prev, return and default.
authorRocky Bernstein <rocky@videolan.org>
Sun, 9 Nov 2003 00:52:32 +0000 (00:52 +0000)
committerRocky Bernstein <rocky@videolan.org>
Sun, 9 Nov 2003 00:52:32 +0000 (00:52 +0000)
modules/access/vcdx/demux.c
modules/access/vcdx/intf.c
modules/access/vcdx/vcd.c
modules/access/vcdx/vcdplayer.c
modules/access/vcdx/vcdplayer.h

index 1c23f871230d191b99ea3458898c87f6750eb455..386598800a0edff102b58941c29d9ff7ea5aed15 100644 (file)
@@ -2,7 +2,7 @@
  * demux.c: demux functions for dvdplay.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: demux.c,v 1.1 2003/10/04 18:55:13 gbazin Exp $
+ * $Id: demux.c,v 1.2 2003/11/09 00:52:32 rocky Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -90,7 +90,7 @@ int E_(InitVCD) ( vlc_object_t *p_this )
     p_demux = p_input->p_demux_data = malloc( sizeof(demux_sys_t ) );
     if( p_demux == NULL )
     {
-        return VLC_ENOMEM;
+        return VLC_ENOMOD;
     }
 
     p_input->p_private = (void*)&p_demux->mpeg;
@@ -104,6 +104,7 @@ int E_(InitVCD) ( vlc_object_t *p_this )
     p_input->p_demux_data->p_vcd = p_vcd;
 
     p_input->pf_demux = Demux;
+    p_input->pf_demux_control = demux_vaControlDefault;
     p_input->pf_rewind = NULL;
 
     p_vcd->p_intf = NULL;
index cf309e2b35d162f6dde2f62c6d023c64ba1c224d..9d2b59b9d1e7c0706ce71a8d357564133a1c4411 100644 (file)
@@ -2,10 +2,10 @@
  * intf.c: Video CD interface to handle user interaction and still time
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.1 2003/10/04 18:55:13 gbazin Exp $
+ * $Id: intf.c,v 1.2 2003/11/09 00:52:32 rocky Exp $
  *
- * Authors: Stéphane Borel <stef@via.ecp.fr>
- *          Current modification and breakage for VCD by rocky.
+ * Authors: Rocky Bernstein <rocky@panix.com>
+ *   from DVD code by Stéphane Borel <stef@via.ecp.fr>
  *
  * 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
 #include "stream_control.h"
 #include "input_ext-intf.h"
 #include "input_ext-dec.h"
+#include "vlc_keys.h"
 
 #include "vcd.h"
+#include "vcdplayer.h"
 
 /*****************************************************************************
  * intf_sys_t: description and status of interface
  *****************************************************************************/
 struct intf_sys_t
 {
-    input_thread_t *    p_input;
-    vcd_data_t *        p_vcd;
+    input_thread_t    * p_input;
+    thread_vcd_data_t * p_vcd;
 
     vlc_bool_t          b_still;
     vlc_bool_t          b_inf_still;
@@ -77,7 +79,8 @@ int E_(VCDOpenIntf) ( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
-    printf("+++++Called VCDOpenIntf\n");
+    msg_Dbg( p_intf, "VCDOpenIntf" );
+
     /* Allocate instance and initialize some members */
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
@@ -87,6 +90,7 @@ int E_(VCDOpenIntf) ( vlc_object_t *p_this )
 
     p_intf->pf_run = RunIntf;
 
+    var_AddCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
     p_intf->p_sys->m_still_time = 0;
     p_intf->p_sys->b_inf_still = 0;
     p_intf->p_sys->b_still = 0;
@@ -111,48 +115,167 @@ void E_(VCDCloseIntf) ( vlc_object_t *p_this )
  *****************************************************************************/
 static void RunIntf( intf_thread_t *p_intf )
 {
-    vlc_object_t *      p_vout = NULL;
-    printf("+++++Called RunIntf\n");
-
+    vlc_object_t      * p_vout = NULL;
+    thread_vcd_data_t * p_vcd;
+    input_thread_t    * p_input;
+    
+    /* What you add to the last input number entry. It accumulates all of
+       the 10_ADD keypresses */
+    int number_addend = 0; 
+    
     if( InitThread( p_intf ) < 0 )
     {
         msg_Err( p_intf, "can't initialize intf" );
         return;
     }
-    msg_Dbg( p_intf, "intf initialized" );
+
+    p_input = p_intf->p_sys->p_input;
+    p_vcd   = p_intf->p_sys->p_vcd = 
+      (thread_vcd_data_t *) p_input->p_access_data;
+
+    dbg_print( INPUT_DBG_CALL, "intf initialized" );
 
     /* Main loop */
     while( !p_intf->b_die )
     {
       vlc_mutex_lock( &p_intf->change_lock );
 
-        /*
-         * keyboard event
-         */
-        if( p_vout && p_intf->p_sys->b_key_pressed )
+      /*
+       * keyboard event
+       */
+      if( p_vout && p_intf->p_sys->b_key_pressed )
         {
-            p_intf->p_sys->b_key_pressed = VLC_FALSE;
-            
-            printf("++++key pressed...\n");
+         vlc_value_t val;
+         int i, i_action = -1;
+         struct hotkey *p_hotkeys = p_intf->p_vlc->p_hotkeys;
+
+         p_intf->p_sys->b_key_pressed = VLC_FALSE;
+          
+         /* Find action triggered by hotkey (if any) */
+         var_Get( p_intf->p_vlc, "key-pressed", &val );
+
+         dbg_print( INPUT_DBG_EVENT, "Key pressed %d", val.i_int );
+
+         for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+            {
+             if( p_hotkeys[i].i_key == val.i_int )
+                {
+                 i_action = p_hotkeys[i].i_action;
+                }
+            }
+         
+         if( i_action != -1) {
+           switch (i_action) {
+             
+           case ACTIONID_NAV_LEFT: 
+             dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_LEFT - prev (%d)", 
+                        number_addend );
+             do {
+               vcdplayer_play_prev( p_input );
+             } while (number_addend-- > 0);
+             break;
+
+           case ACTIONID_NAV_RIGHT:
+             dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_RIGHT - next (%d)",
+                        number_addend );
+             do {
+               vcdplayer_play_next( p_input );
+             } while (number_addend-- > 0);
+             break;
+
+           case ACTIONID_NAV_UP:
+             dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_UP - return" );
+             vcdplayer_play_return( p_input );
+             break;
+
+           case ACTIONID_NAV_DOWN:
+             dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_DOWN - default"  );
+             vcdplayer_play_default( p_input );
+             break;
+
+           case ACTIONID_NAV_ACTIVATE: 
+             {
+               vcdinfo_itemid_t itemid;
+               itemid.type=p_vcd->play_item.type;
+
+               dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_ACTIVATE" );
+
+               if ( vcdplayer_pbc_is_on( p_vcd ) && number_addend != 0 ) {
+                 lid_t next_num=vcdplayer_selection2lid(p_input, 
+                                                        number_addend);
+                 if (VCDINFO_INVALID_LID != next_num) {
+                   itemid.num  = next_num;
+                   itemid.type = VCDINFO_ITEM_TYPE_LID;
+                   VCDPlay( p_input, itemid );
+                 }
+               } else {
+                 itemid.num = number_addend;
+                 VCDPlay( p_input, itemid );
+               }
+               break;
+             }
+           }
+           number_addend = 0;
+         } else {
+           unsigned int digit_entered=0;
+
+           switch (val.i_int) {
+           case '9':
+             digit_entered++;
+           case '8':
+             digit_entered++;
+           case '7':
+             digit_entered++;
+           case '6':
+             digit_entered++;
+           case '5':
+             digit_entered++;
+           case '4':
+             digit_entered++;
+           case '3':
+             digit_entered++;
+           case '2':
+             digit_entered++;
+           case '1':
+             digit_entered++;
+           case '0':
+             {
+               number_addend *= 10;
+               number_addend += digit_entered;
+               dbg_print( INPUT_DBG_EVENT, 
+                          "Added %d. Number is now: %d\n", 
+                          digit_entered, number_addend);
+               break;
+             }
+           }
+         }
         }
-                
-        vlc_mutex_unlock( &p_intf->change_lock );
 
-        if( p_vout == NULL )
+      
+      vlc_mutex_unlock( &p_intf->change_lock );
+      
+      if( p_vout == NULL )
         {
-            p_vout = vlc_object_find( p_intf->p_sys->p_input,
-                                      VLC_OBJECT_VOUT, FIND_CHILD );
-            if( p_vout )
+         p_vout = vlc_object_find( p_intf->p_sys->p_input,
+                                   VLC_OBJECT_VOUT, FIND_CHILD );
+         if( p_vout )
             {
-                var_AddCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
-                var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
-                var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf );
+             var_AddCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
+             var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
+             var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf );
             }
         }
+      
+      
+      /* Wait a bit */
+      msleep( INTF_IDLE_SLEEP );
+    }
 
-
-        /* Wait a bit */
-        msleep( INTF_IDLE_SLEEP );
+    if( p_vout )
+    {
+        var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf );
+        var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );
+        vlc_object_release( p_vout );
     }
 
     vlc_object_release( p_intf->p_sys->p_input );
@@ -167,7 +290,6 @@ static int InitThread( intf_thread_t * p_intf )
     if( !p_intf->b_die )
     {
         input_thread_t * p_input;
-        vcd_data_t * p_vcd;
 
         p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
 
@@ -177,13 +299,9 @@ static int InitThread( intf_thread_t * p_intf )
             return VLC_EGENERIC;
         }
 
-        p_vcd = (vcd_data_t*)p_input->p_access_data;
-        p_vcd->p_intf = p_intf;
-
         vlc_mutex_lock( &p_intf->change_lock );
 
         p_intf->p_sys->p_input = p_input;
-        p_intf->p_sys->p_vcd = p_vcd;
 
         p_intf->p_sys->b_move = VLC_FALSE;
         p_intf->p_sys->b_click = VLC_FALSE;
index cf080c552c4f5edfdfca1325d5c29baca17081c7..3e21e9140c10f43bad23c86c7dd2a21d1713985d 100644 (file)
@@ -4,7 +4,7 @@
  *         to go here.
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vcd.c,v 1.2 2003/11/07 10:33:41 rocky Exp $
+ * $Id: vcd.c,v 1.3 2003/11/09 00:52:32 rocky Exp $
  *
  * Authors: Johan Bilien <jobi@via.ecp.fr>
  *          Rocky Bernstein <rocky@panix.com> 
@@ -30,6 +30,7 @@
 
 #include <vlc/vlc.h>
 #include <vlc/input.h>
+#include <vlc_interface.h>
 
 #include "../../demux/mpeg/system.h"
 #include "vcd.h"
@@ -345,6 +346,10 @@ VCDOpen( vlc_object_t *p_this )
 #endif
     }
 
+    p_vcd->p_intf = intf_Create( p_input, "vcdx" );
+    p_vcd->p_intf->b_block = VLC_FALSE;
+    intf_RunThread( p_vcd->p_intf );
+
     return VLC_SUCCESS;
 }
 
@@ -362,8 +367,22 @@ VCDClose( vlc_object_t *p_this )
 
     free( p_vcd->p_entries );
     free( p_vcd->p_segments );
+
+
+    /* The following if block get moved elsewhere... */
+    if( p_vcd->p_intf != NULL )
+    {
+        intf_StopThread( p_vcd->p_intf );
+        vlc_object_detach( p_vcd->p_intf );
+        vlc_object_release( p_vcd->p_intf );
+        intf_Destroy( p_vcd->p_intf );
+       p_vcd->p_intf = NULL;
+    }
+
     free( p_vcd );
     p_vcd_input = NULL;
+
+
 }
 
 /*****************************************************************************
index f47ddb00fa40a55fa3115b0915fe5c50017fa6b6..ce3c9d735c7f97e0f0b034b95edca4ee05de816c 100644 (file)
@@ -3,7 +3,7 @@
  *               using libcdio, libvcd and libvcdinfo
  *****************************************************************************
  * Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
- * $Id: vcdplayer.c,v 1.1 2003/10/04 18:55:13 gbazin Exp $
+ * $Id: vcdplayer.c,v 1.2 2003/11/09 00:52:32 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
@@ -327,7 +327,7 @@ vcdplayer_pbc_nav ( input_thread_t * p_input )
   return READ_ERROR;
 }
 
-/*
+/*!
   Get the next play-item in the list given in the LIDs. Note play-item
   here refers to list of play-items for a single LID It shouldn't be
   confused with a user's list of favorite things to play or the 
@@ -367,3 +367,268 @@ vcdplayer_inc_play_item( input_thread_t *p_input )
     return VLC_SUCCESS == VCDPlay( p_input, trans_itemid );
   }
 }
+
+/*!
+  Play item assocated with the "default" selection.
+
+  Return false if there was some problem.
+*/
+bool
+vcdplayer_play_default( input_thread_t * p_input )
+{
+  thread_vcd_data_t *p_vcd= (thread_vcd_data_t *)p_input->p_access_data;
+
+  vcdinfo_obj_t     *obj  = p_vcd->vcd;
+  vcdinfo_itemid_t   itemid;
+
+  dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC), 
+            "current: %d" , p_vcd->play_item.num);
+
+  itemid.type = p_vcd->play_item.type;
+
+  if  (vcdplayer_pbc_is_on(p_vcd)) {
+
+    vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->cur_lid);
+    
+    switch (p_vcd->pxd.descriptor_type) {
+    case PSD_TYPE_SELECTION_LIST:
+    case PSD_TYPE_EXT_SELECTION_LIST:
+      if (p_vcd->pxd.psd == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinfo_get_default_offset(p_vcd->vcd, 
+                                                        p_vcd->cur_lid), 
+                             &itemid.num, "default");
+      break;
+
+    case PSD_TYPE_PLAY_LIST: 
+    case PSD_TYPE_END_LIST:
+    case PSD_TYPE_COMMAND_LIST:
+      LOG_WARN( "There is no PBC 'default' selection here" );
+      return false;
+    }
+  } else {
+
+    /* PBC is not on. "default" selection beginning of current 
+       selection . */
+  
+    p_vcd->play_item.num = p_vcd->play_item.num;
+    
+  }
+
+  /** ??? p_vcd->update_title(); ***/
+  return VLC_SUCCESS == VCDPlay( p_input, itemid );
+
+}
+
+/*!
+  Play item assocated with the "next" selection.
+
+  Return false if there was some problem.
+*/
+bool
+vcdplayer_play_next( input_thread_t * p_input )
+{
+  thread_vcd_data_t *p_vcd= (thread_vcd_data_t *)p_input->p_access_data;
+
+  vcdinfo_obj_t     *obj  = p_vcd->vcd;
+  vcdinfo_itemid_t   itemid;
+
+  dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC), 
+            "current: %d" , p_vcd->play_item.num);
+
+  itemid.type = p_vcd->play_item.type;
+
+  if  (vcdplayer_pbc_is_on(p_vcd)) {
+
+    vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->cur_lid);
+    
+    switch (p_vcd->pxd.descriptor_type) {
+    case PSD_TYPE_SELECTION_LIST:
+    case PSD_TYPE_EXT_SELECTION_LIST:
+      if (p_vcd->pxd.psd == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinf_psd_get_next_offset(p_vcd->pxd.psd), 
+                             &itemid.num, "next");
+      break;
+
+    case PSD_TYPE_PLAY_LIST: 
+      if (p_vcd->pxd.pld == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinf_pld_get_next_offset(p_vcd->pxd.pld), 
+                             &itemid.num, "next");
+      break;
+      
+    case PSD_TYPE_END_LIST:
+    case PSD_TYPE_COMMAND_LIST:
+      LOG_WARN( "There is no PBC 'next' selection here" );
+      return false;
+    }
+  } else {
+
+    /* PBC is not on. "Next" selection is play_item.num+1 if possible. */
+  
+    int max_entry = 0;
+
+    switch (p_vcd->play_item.type) {
+    case VCDINFO_ITEM_TYPE_ENTRY: 
+    case VCDINFO_ITEM_TYPE_SEGMENT: 
+    case VCDINFO_ITEM_TYPE_TRACK: 
+      
+      switch (p_vcd->play_item.type) {
+      case VCDINFO_ITEM_TYPE_ENTRY: 
+       max_entry = p_vcd->num_entries;
+       break;
+      case VCDINFO_ITEM_TYPE_SEGMENT: 
+       max_entry = p_vcd->num_segments;
+       break;
+      case VCDINFO_ITEM_TYPE_TRACK: 
+       max_entry = p_vcd->num_tracks;
+       break;
+      default: ; /* Handle exceptional cases below */
+      }
+      
+      if (p_vcd->play_item.num+1 < max_entry) {
+       itemid.num = p_vcd->play_item.num+1;
+      } else {
+       LOG_WARN( "At the end - non-PBC 'next' not possible here" );
+       return false;
+      }
+      
+      break;
+      
+    case VCDINFO_ITEM_TYPE_LID: 
+      {
+       /* Should have handled above. */
+       LOG_WARN( "Internal inconsistency - should not have gotten here." );
+       return false;
+      }
+    default: 
+      return false;
+    }
+  }
+
+  /** ??? p_vcd->update_title(); ***/
+  return VLC_SUCCESS == VCDPlay( p_input, itemid );
+
+}
+
+/*!
+  Play item assocated with the "prev" selection.
+
+  Return false if there was some problem.
+*/
+bool
+vcdplayer_play_prev( input_thread_t * p_input )
+{
+  thread_vcd_data_t *p_vcd= (thread_vcd_data_t *)p_input->p_access_data;
+
+  vcdinfo_obj_t     *obj  = p_vcd->vcd;
+  vcdinfo_itemid_t   itemid;
+
+  dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC), 
+            "current: %d" , p_vcd->play_item.num);
+
+  itemid.type = p_vcd->play_item.type;
+
+  if  (vcdplayer_pbc_is_on(p_vcd)) {
+
+    vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->cur_lid);
+    
+    switch (p_vcd->pxd.descriptor_type) {
+    case PSD_TYPE_SELECTION_LIST:
+    case PSD_TYPE_EXT_SELECTION_LIST:
+      if (p_vcd->pxd.psd == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinf_psd_get_prev_offset(p_vcd->pxd.psd), 
+                             &itemid.num, "prev");
+      break;
+
+    case PSD_TYPE_PLAY_LIST: 
+      if (p_vcd->pxd.pld == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinf_pld_get_prev_offset(p_vcd->pxd.pld), 
+                             &itemid.num, "prev");
+      break;
+      
+    case PSD_TYPE_END_LIST:
+    case PSD_TYPE_COMMAND_LIST:
+      LOG_WARN( "There is no PBC 'prev' selection here" );
+      return false;
+    }
+  } else {
+
+    /* PBC is not on. "Prev" selection is play_item.num-1 if possible. */
+  
+    int min_entry = (VCDINFO_ITEM_TYPE_ENTRY == p_vcd->play_item.type) 
+      ? 0 : 1;
+    
+    if (p_vcd->play_item.num > min_entry) {
+      itemid.num = p_vcd->play_item.num-1;
+    } else {
+      LOG_WARN( "At the beginning - non-PBC 'prev' not possible here" );
+      return false;
+    }
+      
+  }
+
+  /** ??? p_vcd->update_title(); ***/
+  return VLC_SUCCESS == VCDPlay( p_input, itemid );
+
+}
+
+/*!
+  Play item assocated with the "return" selection.
+
+  Return false if there was some problem.
+*/
+bool
+vcdplayer_play_return( input_thread_t * p_input )
+{
+  thread_vcd_data_t *p_vcd= (thread_vcd_data_t *)p_input->p_access_data;
+
+  vcdinfo_obj_t     *obj  = p_vcd->vcd;
+  vcdinfo_itemid_t   itemid;
+
+  dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC), 
+            "current: %d" , p_vcd->play_item.num);
+
+  itemid.type = p_vcd->play_item.type;
+
+  if  (vcdplayer_pbc_is_on(p_vcd)) {
+
+    vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->cur_lid);
+    
+    switch (p_vcd->pxd.descriptor_type) {
+    case PSD_TYPE_SELECTION_LIST:
+    case PSD_TYPE_EXT_SELECTION_LIST:
+      if (p_vcd->pxd.psd == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinf_psd_get_return_offset(p_vcd->pxd.psd), 
+                             &itemid.num, "return");
+      break;
+
+    case PSD_TYPE_PLAY_LIST: 
+      if (p_vcd->pxd.pld == NULL) return false;
+      vcdplayer_update_entry( p_input, 
+                             vcdinf_pld_get_return_offset(p_vcd->pxd.pld), 
+                             &itemid.num, "return");
+      break;
+      
+    case PSD_TYPE_END_LIST:
+    case PSD_TYPE_COMMAND_LIST:
+      LOG_WARN( "There is no PBC 'return' selection here" );
+      return false;
+    }
+  } else {
+
+    /* PBC is not on. "Return" selection is min_entry if possible. */
+  
+    p_vcd->play_item.num = (VCDINFO_ITEM_TYPE_ENTRY == p_vcd->play_item.type) 
+      ? 0 : 1;
+    
+  }
+
+  /** ??? p_vcd->update_title(); ***/
+  return VLC_SUCCESS == VCDPlay( p_input, itemid );
+
+}
index aae929cb1eb2c7d7a99cbd31b426d3d38f7b8356..2e762612673ca1c18b1173281846fb84453441ae 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
  * Copyright (C) 2003 Rocky Bernstein (for VideoLAN)
- * $Id: vcdplayer.h,v 1.1 2003/10/04 18:55:13 gbazin Exp $
+ * $Id: vcdplayer.h,v 1.2 2003/11/09 00:52:32 rocky Exp $
  *
  * Authors: Rocky Bernstein <rocky@panix.com> 
  *
 
 #include <libvcd/info.h>
 
-#define INPUT_DBG_MRL         1 
-#define INPUT_DBG_EXT         2 /* Calls from external routines */
-#define INPUT_DBG_CALL        4 /* all calls */
-#define INPUT_DBG_LSN         8 /* LSN changes */
-#define INPUT_DBG_PBC        16 /* Playback control */
-#define INPUT_DBG_CDIO       32 /* Debugging from CDIO */
-#define INPUT_DBG_SEEK       64 /* Seeks to set location */
-#define INPUT_DBG_STILL     128 /* Still-frame */
-#define INPUT_DBG_VCDINFO   256 /* Debugging from VCDINFO */
+#define INPUT_DBG_META        1 /* Meta information */
+#define INPUT_DBG_EVENT       2 /* input (keyboard/mouse) events */
+#define INPUT_DBG_MRL         4 /* MRL parsing */
+#define INPUT_DBG_EXT         8 /* Calls from external routines */
+#define INPUT_DBG_CALL       16 /* all calls */
+#define INPUT_DBG_LSN        32 /* LSN changes */
+#define INPUT_DBG_PBC        64 /* Playback control */
+#define INPUT_DBG_CDIO      128 /* Debugging from CDIO */
+#define INPUT_DBG_SEEK      256 /* Seeks to set location */
+#define INPUT_DBG_SEEK_CUR  512 /* Seeks to find current location */
+#define INPUT_DBG_STILL    1024 /* Still-frame */
+#define INPUT_DBG_VCDINFO  2048 /* Debugging from VCDINFO */
 
 #define INPUT_DEBUG 1
 #if INPUT_DEBUG
@@ -45,7 +48,8 @@
 #define dbg_print(mask, s, args...) 
 #endif
 
-#define LOG_ERR(args...) msg_Err( p_input, args )
+#define LOG_ERR(args...)  msg_Err( p_input, args )
+#define LOG_WARN(args...) msg_Warn( p_input, args )
 
 /* vcdplayer_read return status */
 typedef enum {
@@ -97,11 +101,56 @@ typedef struct thread_vcd_data_s
   bool         b_valid_ep;              /* Valid entry points flag */
   vlc_bool_t   b_end_of_track;          /* If the end of track was reached */
   int          i_debug;                 /* Debugging mask */
+
+  /* Probably gets moved into another structure...*/
+  intf_thread_t *         p_intf;
+  int                     i_audio_nb;
+  int                     i_still_time;
+  vlc_bool_t              b_end_of_cell;
   
 } thread_vcd_data_t;
 
-bool  vcdplayer_inc_play_item( input_thread_t *p_input );
-bool  vcdplayer_pbc_is_on(const thread_vcd_data_t *p_this);
+/*!
+  Get the next play-item in the list given in the LIDs. Note play-item
+  here refers to list of play-items for a single LID It shouldn't be
+  confused with a user's list of favorite things to play or the 
+  "next" field of a LID which moves us to a different LID.
+ */
+bool vcdplayer_inc_play_item( input_thread_t *p_input );
+
+/*!
+  Return true if playback control (PBC) is on
+*/
+bool vcdplayer_pbc_is_on(const thread_vcd_data_t *p_this);
+
+/*!
+  Play item assocated with the "default" selection.
+
+  Return false if there was some problem.
+*/
+bool vcdplayer_play_default( input_thread_t * p_input );
+
+/*!
+  Play item assocated with the "next" selection.
+
+  Return false if there was some problem.
+*/
+bool vcdplayer_play_next( input_thread_t * p_input );
+
+/*!
+  Play item assocated with the "prev" selection.
+
+  Return false if there was some problem.
+*/
+bool vcdplayer_play_prev( input_thread_t * p_input );
+
+/*!
+  Play item assocated with the "return" selection.
+
+  Return false if there was some problem.
+*/
+bool
+vcdplayer_play_return( input_thread_t * p_input );
 
 vcdplayer_read_status_t vcdplayer_pbc_nav ( input_thread_t * p_input );
 vcdplayer_read_status_t vcdplayer_non_pbc_nav ( input_thread_t * p_input );