]> git.sesse.net Git - vlc/commitdiff
intf.c, vcdplayer.c: Add code for multi-default selection lists. But
authorRocky Bernstein <rocky@videolan.org>
Sun, 23 Nov 2003 03:58:33 +0000 (03:58 +0000)
committerRocky Bernstein <rocky@videolan.org>
Sun, 23 Nov 2003 03:58:33 +0000 (03:58 +0000)
this required new libvcdinfo API - so change to configure.ac for
pending new libcdio/vcdimager releases.

Additional libvcdinfo routines also means less VCD twidling inside vlc
code, thus simplifying what is already a bit complicated and likely to
get more so.

configure.ac
modules/access/vcdx/intf.c
modules/access/vcdx/vcdplayer.c

index 81d814bf3b1d2f51f46cd52d99e75d1bb58dea4a..d536f03566f065566a6d36a186f43c757ed7205c 100644 (file)
@@ -1,5 +1,5 @@
 dnl Autoconf settings for vlc
-dnl $Id: configure.ac,v 1.117 2003/11/22 18:11:22 gbazin Exp $
+dnl $Id: configure.ac,v 1.118 2003/11/23 03:58:33 rocky Exp $
 
 AC_INIT(vlc,0.6.3-cvs)
 
@@ -1528,14 +1528,14 @@ AC_ARG_ENABLE(vcdx,
 
 if test "${enable_vcdx}" != "no"
 then
-  PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.63,
+  PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.65,
    [enable_cdda="no"
     AX_ADD_LDFLAGS([cddax],[$LIBCDIO_LIBS])
     AX_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS])
     AX_ADD_PLUGINS([cddax])], 
    [AC_MSG_WARN(libcdio library not found)])
 
-  PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.18-cdio,
+  PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.20-cdio,
    [enable_vcd="no"
     AX_ADD_LDFLAGS([vcdx],[$VCDINFO_LIBS])
     AX_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS])
index f0411b88e4436c981c11f1eb5e28149b0a0eac6b..357807abdd341a0cc2f7e2500679d2ceab334ebb 100644 (file)
@@ -2,7 +2,7 @@
  * intf.c: Video CD interface to handle user interaction and still time
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: intf.c,v 1.3 2003/11/09 18:06:11 rocky Exp $
+ * $Id: intf.c,v 1.4 2003/11/23 03:58:33 rocky Exp $
  *
  * Authors: Rocky Bernstein <rocky@panix.com>
  *   from DVD code by Stéphane Borel <stef@via.ecp.fr>
@@ -203,8 +203,9 @@ static void RunIntf( intf_thread_t *p_intf )
                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);
+                 lid_t next_num=vcdinfo_selection_get_lid(p_vcd->vcd, 
+                                                          itemid.num,
+                                                          number_addend);
                  if (VCDINFO_INVALID_LID != next_num) {
                    itemid.num  = next_num;
                    itemid.type = VCDINFO_ITEM_TYPE_LID;
index ce3c9d735c7f97e0f0b034b95edca4ee05de816c..5e9529d7b407f784e3e93633f3c3f50b9ace09ed 100644 (file)
@@ -3,7 +3,7 @@
  *               using libcdio, libvcd and libvcdinfo
  *****************************************************************************
  * Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
- * $Id: vcdplayer.c,v 1.2 2003/11/09 00:52:32 rocky Exp $
+ * $Id: vcdplayer.c,v 1.3 2003/11/23 03:58:33 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
@@ -50,61 +50,6 @@ vcdplayer_pbc_is_on(const thread_vcd_data_t *p_vcd)
   return VCDINFO_INVALID_ENTRY != p_vcd->cur_lid; 
 }
 
-lid_t
-vcdplayer_selection2lid ( input_thread_t *p_input, int entry_num ) 
-{
-  /* FIXME: Some of this probably gets moved to vcdinfo. */
-  /* Convert selection number to lid and then entry number...*/
-  thread_vcd_data_t *     p_vcd= (thread_vcd_data_t *)p_input->p_access_data;
-  unsigned int offset;
-  unsigned int bsn=vcdinf_get_bsn(p_vcd->pxd.psd);
-  vcdinfo_obj_t *obj = p_vcd->vcd;
-
-  dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC), 
-            "Called lid %u, entry_num %d bsn %d", p_vcd->cur_lid, 
-             entry_num, bsn);
-
-  if ( (entry_num - bsn + 1) > 0) {
-    offset = vcdinfo_lid_get_offset(obj, p_vcd->cur_lid, entry_num-bsn+1);
-  } else {
-    LOG_ERR( "Selection number %u too small. bsn %u", entry_num, bsn );
-    return VCDINFO_INVALID_LID;
-  }
-  
-  if (offset != VCDINFO_INVALID_OFFSET) {
-    vcdinfo_offset_t *ofs;
-    int old = entry_num;
-    
-    switch (offset) {
-    case PSD_OFS_DISABLED:
-      LOG_ERR( "Selection %u disabled", entry_num );
-      return VCDINFO_INVALID_LID;
-    case PSD_OFS_MULTI_DEF:
-      LOG_ERR( "Selection %u multi_def", entry_num );
-      return VCDINFO_INVALID_LID;
-    case PSD_OFS_MULTI_DEF_NO_NUM:
-      LOG_ERR( "Selection %u multi_def_no_num", entry_num );
-      return VCDINFO_INVALID_LID;
-    default: ;
-    }
-    
-    ofs = vcdinfo_get_offset_t(obj, offset);
-
-    if (NULL == ofs) {
-      LOG_ERR( "error in vcdinfo_get_offset" );
-      return -1;
-    }
-    dbg_print(INPUT_DBG_PBC,
-              "entry %u turned into selection lid %u", 
-              old, ofs->lid);
-    return ofs->lid;
-    
-  } else {
-    LOG_ERR( "invalid or unset entry %u", entry_num );
-    return VCDINFO_INVALID_LID;
-  }
-}
-
 static void
 vcdplayer_update_entry( input_thread_t * p_input, uint16_t ofs, 
                         uint16_t *entry, const char *label)
@@ -294,7 +239,9 @@ vcdplayer_pbc_nav ( input_thread_t * p_input )
           unsigned int bsn=vcdinf_get_bsn(p_vcd->pxd.psd);
           int rand_selection=bsn +
             (int) ((num_selections+0.0)*rand()/(RAND_MAX+1.0));
-          lid_t rand_lid=vcdplayer_selection2lid (p_input, rand_selection);
+          lid_t rand_lid=vcdinfo_selection_get_lid (p_vcd->vcd, 
+                                                   p_vcd->cur_lid, 
+                                                   rand_selection);
           itemid.num = rand_lid;
           itemid.type = VCDINFO_ITEM_TYPE_LID;
           dbg_print(INPUT_DBG_PBC, "random selection %d, lid: %d", 
@@ -378,7 +325,6 @@ 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), 
@@ -388,24 +334,18 @@ vcdplayer_play_default( input_thread_t * p_input )
 
   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;
+    lid_t lid=vcdinfo_get_multi_default_lid(p_vcd->vcd, p_vcd->cur_lid,
+                                           itemid.num);
 
-    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;
+    if (VCDINFO_INVALID_LID != lid) {
+      itemid.num  = lid;
+      itemid.type = VCDINFO_ITEM_TYPE_LID;
+      dbg_print(INPUT_DBG_PBC, "DEFAULT to %d\n", itemid.num);
+    } else {
+      dbg_print(INPUT_DBG_PBC, "no DEFAULT for LID %d\n", p_vcd->cur_lid);
     }
+    
+
   } else {
 
     /* PBC is not on. "default" selection beginning of current