]> git.sesse.net Git - vlc/blobdiff - modules/access/vcdx/intf.c
info.c: Add LID info in stream and media info.
[vlc] / modules / access / vcdx / intf.c
index 69045cb7fffefd6bfa050a559db9250666ace8bb..bb0ed12dd1d8d90ae3a99abb78c115357b4b6ca8 100644 (file)
  *****************************************************************************/
 #include <vlc/vlc.h>
 #include <vlc/intf.h>
+#include <vlc/input.h>
 
-#include "stream_control.h"
-#include "input_ext-intf.h"
-#include "input_ext-dec.h"
 #include "vlc_keys.h"
 
 #include "vcd.h"
@@ -50,7 +48,7 @@ static void RunIntf        ( intf_thread_t *p_intf );
 /*****************************************************************************
  * OpenIntf: initialize dummy interface
  *****************************************************************************/
-int E_(OpenIntf) ( vlc_object_t *p_this )
+int VCDOpenIntf ( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
@@ -60,23 +58,23 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
     {
-        return( 1 );
+        return( VLC_EGENERIC );
     };
 
     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_infinite_still = 0;
     p_intf->p_sys->b_still = 0;
 
-    return( 0 );
+    return( VLC_SUCCESS );
 }
 
 /*****************************************************************************
  * CloseIntf: destroy dummy interface
  *****************************************************************************/
-void E_(CloseIntf) ( vlc_object_t *p_this )
+void VCDCloseIntf ( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
     var_DelCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf );
@@ -89,13 +87,15 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
 /*****************************************************************************
  * RunIntf: main loop
  *****************************************************************************/
-static void RunIntf( intf_thread_t *p_intf )
+static void 
+RunIntf( intf_thread_t *p_intf )
 {
     vlc_object_t      * p_vout = NULL;
     mtime_t             mtime = 0;
     mtime_t             mlast = 0;
-    thread_vcd_data_t * p_vcd;
+    vcdplayer_t       * p_vcd;
     input_thread_t    * p_input;
+    access_t          * p_access;
 
     /* What you add to the last input number entry. It accumulates all of
        the 10_ADD keypresses */
@@ -108,8 +108,14 @@ static void RunIntf( intf_thread_t *p_intf )
     }
 
     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;
+
+    while ( !p_intf->p_sys->p_vcd )
+    {
+        msleep( INTF_IDLE_SLEEP );
+    }
+    
+    p_vcd    = p_intf->p_sys->p_vcd;
+    p_access = p_vcd->p_access;
 
     dbg_print( INPUT_DBG_CALL, "intf initialized" );
 
@@ -121,7 +127,7 @@ static void RunIntf( intf_thread_t *p_intf )
         /*
          * 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_infinite_still )
         {
             if( p_intf->p_sys->m_still_time > 0 )
             {
@@ -137,7 +143,7 @@ static void RunIntf( intf_thread_t *p_intf )
             }
             else
             {
-                /* Still time has elasped; set to continue playing. */
+                /* Still time has elapsed; set to continue playing. */
                 dbg_print(INPUT_DBG_STILL, "wait time done - setting play");
                 var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );
                 p_intf->p_sys->m_still_time = 0;
@@ -177,7 +183,7 @@ static void RunIntf( intf_thread_t *p_intf )
               dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_LEFT - prev (%d)",
                          number_addend );
               do {
-                vcdplayer_play_prev( p_input );
+                vcdplayer_play_prev( p_access );
               }        while (number_addend-- > 0);
               break;
 
@@ -185,20 +191,20 @@ static void RunIntf( intf_thread_t *p_intf )
               dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_RIGHT - next (%d)",
                          number_addend );
               do {
-                vcdplayer_play_next( p_input );
+                vcdplayer_play_next( p_access );
               } while (number_addend-- > 0);
               break;
 
             case ACTIONID_NAV_UP:
               dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_UP - return" );
               do {
-                vcdplayer_play_return( p_input );
+                vcdplayer_play_return( p_access );
               } while (number_addend-- > 0);
               break;
 
             case ACTIONID_NAV_DOWN:
               dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_DOWN - default"  );
-              vcdplayer_play_default( p_input );
+              vcdplayer_play_default( p_access );
               break;
 
             case ACTIONID_NAV_ACTIVATE:
@@ -210,16 +216,16 @@ static void RunIntf( intf_thread_t *p_intf )
 
                 if ( vcdplayer_pbc_is_on( p_vcd ) && number_addend != 0 ) {
                   lid_t next_num=vcdinfo_selection_get_lid(p_vcd->vcd,
-                                                           p_vcd->cur_lid,
+                                                           p_vcd->i_lid,
                                                            number_addend);
                   if (VCDINFO_INVALID_LID != next_num) {
                     itemid.num  = next_num;
                     itemid.type = VCDINFO_ITEM_TYPE_LID;
-                    VCDPlay( p_input, itemid );
+                    vcdplayer_play( p_access, itemid );
                   }
                 } else {
                   itemid.num = number_addend;
-                  VCDPlay( p_input, itemid );
+                  vcdplayer_play( p_access, itemid );
                 }
                 break;
               }
@@ -234,7 +240,7 @@ static void RunIntf( intf_thread_t *p_intf )
                 dbg_print(INPUT_DBG_STILL, "Playing still after activate");
                 var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );
                 p_intf->p_sys->b_still = 0;
-                p_intf->p_sys->b_inf_still = 0;
+                p_intf->p_sys->b_infinite_still = 0;
                 p_intf->p_sys->m_still_time = 0;
               }
 
@@ -321,8 +327,9 @@ static int InitThread( intf_thread_t * p_intf )
         vlc_mutex_lock( &p_intf->change_lock );
 
         p_intf->p_sys->p_input = p_input;
+        p_intf->p_sys->p_vcd   = NULL;
 
-        p_intf->p_sys->b_move = VLC_FALSE;
+        p_intf->p_sys->b_move  = VLC_FALSE;
         p_intf->p_sys->b_click = VLC_FALSE;
         p_intf->p_sys->b_key_pressed = VLC_FALSE;
 
@@ -356,19 +363,18 @@ static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
  * vcdIntfStillTime: function provided to demux plugin to request
  * still images
  *****************************************************************************/
-int vcdIntfStillTime( intf_thread_t *p_intf, int i_sec )
+int vcdIntfStillTime( intf_thread_t *p_intf, uint8_t i_sec )
 {
     vlc_mutex_lock( &p_intf->change_lock );
 
-    if( i_sec == -1 )
+    p_intf->p_sys->b_still = 1;
+    if( 255 == i_sec )
     {
-        p_intf->p_sys->b_still     = 1;
-        p_intf->p_sys->b_inf_still = 1;
+        p_intf->p_sys->b_infinite_still = VLC_TRUE;
     }
-    else if( i_sec > 0 )
+    else 
     {
-        p_intf->p_sys->b_still = 1;
-        p_intf->p_sys->m_still_time = 1000000 * i_sec;
+        p_intf->p_sys->m_still_time = MILLISECONDS_PER_SEC * i_sec;
     }
     vlc_mutex_unlock( &p_intf->change_lock );