]> git.sesse.net Git - vlc/blobdiff - modules/access/vcdx/info.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / access / vcdx / info.c
index e18281a40bb3fa141bed14d15e038d8d0d84535b..090605dedebae4c13c92fe296cc932dcab56ab50 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * info.c : CD digital audio input information routines
  *****************************************************************************
- * Copyright (C) 2004 VideoLAN
- * $Id: info.c 8845 2004-09-29 09:00:41Z rocky $
+ * Copyright (C) 2004 the VideoLAN team
+ * $Id$
  *
  * Authors: Rocky Bernstein <rocky@panix.com>
  *
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <vlc/vlc.h>
-#include <vlc/input.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
+#include <vlc_common.h>
+#include <vlc_input.h>
+#include <vlc_access.h>
 #include "vcd.h"
-#include <vlc_playlist.h> 
-#include "vlc_keys.h"
 #include "info.h"
 
 #include <cdio/cdio.h>
 #include <libvcd/info.h>
 #include <libvcd/logging.h>
 
-static inline void
-MetaInfoAddStr(access_t *p_access, char *p_cat,
-               char *title, const char *str)
-{
-  vcdplayer_t *p_vcd = (vcdplayer_t *) p_access->p_sys;
-  if ( str ) {
-    dbg_print( INPUT_DBG_META, "field: %s: %s", title, str);
-    input_Control( p_vcd->p_input, INPUT_ADD_INFO, p_cat, title, "%s", str);
-  }
-}
-
-
-static inline void
-MetaInfoAddNum(access_t *p_access, char *psz_cat, char *title, int num)
+static char *
+VCDFormatStr(vcdplayer_t *p_vcdplayer,
+             const char *format_str, const char *mrl,
+             const vcdinfo_itemid_t *itemid);
+void
+VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
 {
-  vcdplayer_t *p_vcd = (vcdplayer_t *) p_access->p_sys;
-  dbg_print( INPUT_DBG_META, "field %s: %d", title, num);
-  input_Control( p_vcd->p_input, INPUT_ADD_INFO, psz_cat, title, "%d", num );
-}
-
-#define addstr(title, str) \
-  MetaInfoAddStr( p_access, psz_cat, title, str );
+  vcdplayer_t    *p_vcdplayer  = (vcdplayer_t *) p_access->p_sys;
+  input_thread_t *p_input = p_vcdplayer->p_input;
+  vcdinfo_obj_t  *p_vcdev = p_vcdplayer->vcd;
 
-#define addnum(title, num) \
-  MetaInfoAddNum( p_access, psz_cat, title, num );
+  size_t i_entries = vcdinfo_get_num_entries(p_vcdev);
+  size_t last_entry = 0;
+  char *psz_cat = _("Disc");
 
-void 
-VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
-{
-  vcdplayer_t *p_vcd = (vcdplayer_t *) p_access->p_sys;
-  unsigned int i_entries = vcdinfo_get_num_entries(p_vcd->vcd);
-  unsigned int last_entry = 0;
-  char *psz_cat;
   track_t i_track;
 
-  psz_cat = _("General");
-
-  addstr( _("VCD Format"),  vcdinfo_get_format_version_str(p_vcd->vcd) );
-  addstr( _("Album"),       vcdinfo_get_album_id(p_vcd->vcd));
-  addstr( _("Application"), vcdinfo_get_application_id(p_vcd->vcd) );
-  addstr( _("Preparer"),    vcdinfo_get_preparer_id(p_vcd->vcd) );
-  addnum( _("Vol #"),       vcdinfo_get_volume_num(p_vcd->vcd) );
-  addnum( _("Vol max #"),   vcdinfo_get_volume_count(p_vcd->vcd) );
-  addstr( _("Volume Set"),  vcdinfo_get_volumeset_id(p_vcd->vcd) );
-  addstr( _("Volume"),      vcdinfo_get_volume_id(p_vcd->vcd) );
-  addstr( _("Publisher"),   vcdinfo_get_publisher_id(p_vcd->vcd) );
-  addstr( _("System Id"),   vcdinfo_get_system_id(p_vcd->vcd) );
-  addnum( "LIDs",           vcdinfo_get_num_LIDs(p_vcd->vcd) );
-  addnum( _("Entries"),     vcdinfo_get_num_entries(p_vcd->vcd) );
-  addnum( _("Segments"),    vcdinfo_get_num_segments(p_vcd->vcd) );
-  addnum( _("Tracks"),      vcdinfo_get_num_tracks(p_vcd->vcd) );
+# define addstr(t,v) input_Control(p_input,INPUT_ADD_INFO,psz_cat,t,"%s",v)
+# define addnum(t,v) input_Control(p_input,INPUT_ADD_INFO,psz_cat,t,"%d",v)
+# define addhex(t,v) input_Control(p_input,INPUT_ADD_INFO,psz_cat,t,"%x",v)
+
+  addstr(_("VCD Format"),  vcdinfo_get_format_version_str(p_vcdev));
+  addstr(_("Album"),       vcdinfo_get_album_id          (p_vcdev));
+  addstr(_("Application"), vcdinfo_get_application_id    (p_vcdev));
+  addstr(_("Preparer"),    vcdinfo_get_preparer_id       (p_vcdev));
+  addnum(_("Vol #"),       vcdinfo_get_volume_num        (p_vcdev));
+  addnum(_("Vol max #"),   vcdinfo_get_volume_count      (p_vcdev));
+  addstr(_("Volume Set"),  vcdinfo_get_volumeset_id      (p_vcdev));
+  addstr(_("Volume"),      vcdinfo_get_volume_id         (p_vcdev));
+  addstr(_("Publisher"),   vcdinfo_get_publisher_id      (p_vcdev));
+  addstr(_("System Id"),   vcdinfo_get_system_id         (p_vcdev));
+  addnum("LIDs",           vcdinfo_get_num_LIDs          (p_vcdev));
+  addnum(_("Entries"),     vcdinfo_get_num_entries       (p_vcdev));
+  addnum(_("Segments"),    vcdinfo_get_num_segments      (p_vcdev));
+  addnum(_("Tracks"),      vcdinfo_get_num_tracks        (p_vcdev));
 
   /* Spit out track information. Could also include MSF info.
      Also build title table.
    */
 
-#define TITLE_MAX 30
-  for( i_track = 1 ; i_track < p_vcd->i_tracks ; i_track++ ) {
-    unsigned int audio_type = vcdinfo_get_track_audio_type(p_vcd->vcd, 
-                                                          i_track);
-    uint32_t i_secsize = vcdinfo_get_track_sect_count(p_vcd->vcd, i_track);
+  for( i_track = 1 ; i_track < p_vcdplayer->i_tracks ; i_track++ ) {
+    unsigned int audio_type = vcdinfo_get_track_audio_type(p_vcdev, i_track);
+    uint32_t i_secsize = vcdinfo_get_track_sect_count(p_vcdev, i_track);
 
-    if (p_vcd->b_svd) {
-      addnum(_("Audio Channels"),  
-            vcdinfo_audio_type_num_channels(p_vcd->vcd, audio_type) );
+    if (p_vcdplayer->b_svd) {
+      addnum(_("Audio Channels"),
+             vcdinfo_audio_type_num_channels(p_vcdev, audio_type) );
     }
 
-    addnum(_("First Entry Point"), last_entry );
-    for ( ; last_entry < i_entries 
-           && vcdinfo_get_track(p_vcd->vcd, last_entry) == i_track;
-         last_entry++ ) ;
+    addnum(_("First Entry Point"), 0 );
+
+    for ( last_entry = 0 ; last_entry < i_entries
+        && vcdinfo_get_track(p_vcdev, last_entry) == i_track; last_entry++ ) ;
+
     addnum(_("Last Entry Point"), last_entry-1 );
     addnum(_("Track size (in sectors)"), i_secsize );
   }
+  {
+    lid_t i_lid;
+    for( i_lid = 1 ; i_lid <= p_vcdplayer->i_lids ; i_lid++ ) {
+      PsdListDescriptor_t pxd;
+      if (vcdinfo_lid_get_pxd(p_vcdev, &pxd, i_lid)) {
+    switch (pxd.descriptor_type) {
+    case PSD_TYPE_END_LIST:
+      addstr(_("type"), _("end"));
+      break;
+    case PSD_TYPE_PLAY_LIST:
+      addstr(_("type"), _("play list"));
+      addnum("items",     vcdinf_pld_get_noi(pxd.pld));
+      addhex("next",      vcdinf_pld_get_next_offset(pxd.pld));
+      addhex("previous",  vcdinf_pld_get_prev_offset(pxd.pld));
+      addhex("return",    vcdinf_pld_get_return_offset(pxd.pld));
+      addnum("wait time", vcdinf_get_wait_time(pxd.pld));
+      break;
+    case PSD_TYPE_SELECTION_LIST:
+    case PSD_TYPE_EXT_SELECTION_LIST:
+      addstr(_("type"), PSD_TYPE_SELECTION_LIST == pxd.descriptor_type
+             ? _("extended selection list") : _("selection list") );
+      addhex("default",          vcdinf_psd_get_default_offset(pxd.psd));
+      addhex("loop count",       vcdinf_get_loop_count(pxd.psd));
+      addhex("next",             vcdinf_psd_get_next_offset(pxd.psd));
+      addhex("previous",         vcdinf_psd_get_prev_offset(pxd.psd));
+      addhex("return",           vcdinf_psd_get_return_offset(pxd.psd));
+      addhex("rejected",         vcdinf_psd_get_lid_rejected(pxd.psd));
+      addhex("time-out offset",  vcdinf_get_timeout_offset(pxd.psd));
+      addnum("time-out time",    vcdinf_get_timeout_time(pxd.psd));
+      break;
+    default:
+      addstr(_("type"), _("unknown type"));
+      break;
+    }
+      }
+    }
+  }
+# undef  addstr
+# undef  addnum
+# undef  addhex
 
   if ( CDIO_INVALID_TRACK != i_track )
-  { 
-    char *psz_name = 
-      VCDFormatStr( p_access, p_vcd,
-                   config_GetPsz( p_access, MODULE_STRING "-title-format" ),
-                   psz_mrl, &(p_vcd->play_item) );
-    
-    input_Control( p_vcd->p_input, INPUT_SET_NAME, psz_name );
+  {
+    char *psz_tfmt = var_InheritString( p_access, MODULE_STRING "-title-format" );
+    char *psz_name = VCDFormatStr( p_vcdplayer, psz_tfmt, psz_mrl,
+                                                  &(p_vcdplayer->play_item) );
+    free( psz_tfmt );
+    input_Control( p_input, INPUT_SET_NAME, psz_name );
+    free( psz_name );
   }
 
 }
 
-#define add_format_str_info(val)                              \
-  {                                                           \
-    const char *str = val;                                    \
-    unsigned int len;                                         \
-    if (val != NULL) {                                        \
-      len=strlen(str);                                        \
-      if (len != 0) {                                         \
-        strncat(tp, str, TEMP_STR_LEN-(tp-temp_str));         \
-        tp += len;                                            \
-      }                                                        \
-      saw_control_prefix = VLC_FALSE;                         \
-    }                                                         \
-  }
-
-#define add_format_num_info( val, fmt )                               \
-  {                                                           \
-    char num_str[10];                                         \
-    unsigned int len;                                         \
-    sprintf(num_str, fmt, val);                                \
-    len = strlen(num_str);                                    \
-    if( len != 0 )                                             \
-    {                                                         \
-      strncat(tp, num_str, TEMP_STR_LEN-(tp-temp_str));        \
-      tp += len;                                              \
-    }                                                         \
-    saw_control_prefix = VLC_FALSE;                                \
-  }
-
 /*!
    Take a format string and expand escape sequences, that is sequences that
    begin with %, with information from the current VCD.
@@ -173,30 +172,28 @@ VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
        A number between 1 and the volume count.
    %% : a %
 */
-char *
-VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcd,
-             const char format_str[], const char *mrl,
+static char *
+VCDFormatStr(vcdplayer_t *p_vcdplayer,
+             const char *format_str, const char *mrl,
              const vcdinfo_itemid_t *itemid)
 {
 #define TEMP_STR_SIZE 256
-#define TEMP_STR_LEN (TEMP_STR_SIZE-1)
-  static char    temp_str[TEMP_STR_SIZE];
-  size_t         i;
-  char *         tp = temp_str;
-  vlc_bool_t     saw_control_prefix = VLC_FALSE;
-  size_t         format_len = strlen(format_str);
+  char        temp_str[TEMP_STR_SIZE];
+  char       *tp = temp_str;
+  const char *te = tp+TEMP_STR_SIZE-1;
+  bool        saw_control_prefix = false;
 
   memset(temp_str, 0, TEMP_STR_SIZE);
 
-  for (i=0; i<format_len; i++) {
+  for (; *format_str && tp<te; ++format_str) {
 
-    if (!saw_control_prefix && format_str[i] != '%') {
-      *tp++ = format_str[i];
-      saw_control_prefix = VLC_FALSE;
+    if (!saw_control_prefix && *format_str != '%') {
+      *tp++ = *format_str;
+      saw_control_prefix = false;
       continue;
     }
 
-    switch(format_str[i]) {
+    switch(*format_str) {
     case '%':
       if (saw_control_prefix) {
         *tp++ = '%';
@@ -204,237 +201,126 @@ VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcd,
       saw_control_prefix = !saw_control_prefix;
       break;
     case 'A':
-      add_format_str_info(vcdinfo_strip_trail(vcdinfo_get_album_id(p_vcd->vcd),
-                                              MAX_ALBUM_LEN));
+      tp += snprintf(tp,te-tp,"%s",
+                   vcdinfo_strip_trail(vcdinfo_get_album_id(p_vcdplayer->vcd),
+                                                              MAX_ALBUM_LEN));
       break;
 
     case 'c':
-      add_format_num_info(vcdinfo_get_volume_num(p_vcd->vcd), "%d");
+      tp += snprintf(tp,te-tp,"%d",vcdinfo_get_volume_num(p_vcdplayer->vcd));
       break;
 
     case 'C':
-      add_format_num_info(vcdinfo_get_volume_count(p_vcd->vcd), "%d");
+      tp += snprintf(tp,te-tp,"%d",vcdinfo_get_volume_count(p_vcdplayer->vcd));
       break;
 
     case 'F':
-      add_format_str_info(vcdinfo_get_format_version_str(p_vcd->vcd));
+      tp += snprintf(tp,te-tp,"%s",
+                            vcdinfo_get_format_version_str(p_vcdplayer->vcd));
       break;
 
     case 'I':
       {
         switch (itemid->type) {
         case VCDINFO_ITEM_TYPE_TRACK:
-          strncat(tp, _("Track"), TEMP_STR_LEN-(tp-temp_str));
-          tp += strlen(_("Track"));
+          tp += snprintf(tp,te-tp,"%s",_("Track"));
         break;
         case VCDINFO_ITEM_TYPE_ENTRY:
-          strncat(tp, _("Entry"), TEMP_STR_LEN-(tp-temp_str));
-          tp += strlen(_("Entry"));
+          tp += snprintf(tp,te-tp,"%s",_("Entry"));
           break;
         case VCDINFO_ITEM_TYPE_SEGMENT:
-          strncat(tp, _("Segment"), TEMP_STR_LEN-(tp-temp_str));
-          tp += strlen(_("Segment"));
+          tp += snprintf(tp,te-tp,"%s",_("Segment"));
           break;
         case VCDINFO_ITEM_TYPE_LID:
-          strncat(tp, _("List ID"), TEMP_STR_LEN-(tp-temp_str));
-          tp += strlen(_("List ID"));
+          tp += snprintf(tp,te-tp,"%s",_("List ID"));
           break;
         case VCDINFO_ITEM_TYPE_SPAREID2:
-          strncat(tp, _("Navigation"), TEMP_STR_LEN-(tp-temp_str));
-          tp += strlen(_("Navigation"));
+          tp += snprintf(tp,te-tp,"%s",_("Navigation"));
           break;
         default:
           /* What to do? */
           ;
         }
-        saw_control_prefix = VLC_FALSE;
+        saw_control_prefix = false;
       }
       break;
 
     case 'L':
-      if (vcdplayer_pbc_is_on(p_vcd)) {
-        char num_str[40];
-        sprintf(num_str, "%s %d", _("List ID"), p_vcd->i_lid);
-        strncat(tp, num_str, TEMP_STR_LEN-(tp-temp_str));
-        tp += strlen(num_str);
-      }
-      saw_control_prefix = VLC_FALSE;
+      if (vcdplayer_pbc_is_on(p_vcdplayer))
+        tp += snprintf(tp,te-tp,"%s %d",_("List ID"),p_vcdplayer->i_lid);
+      saw_control_prefix = false;
       break;
 
     case 'M':
-      add_format_str_info(mrl);
+      tp += snprintf(tp,te-tp,"%s",mrl);
       break;
 
     case 'N':
-      add_format_num_info(itemid->num, "%d");
+      tp += snprintf(tp,te-tp,"%d",itemid->num);
       break;
 
     case 'p':
-      add_format_str_info(vcdinfo_get_preparer_id(p_vcd->vcd));
+      tp += snprintf(tp,te-tp,"%s",vcdinfo_get_preparer_id(p_vcdplayer->vcd));
       break;
 
     case 'P':
-      add_format_str_info(vcdinfo_get_publisher_id(p_vcd->vcd));
+      tp += snprintf(tp,te-tp,"%s",vcdinfo_get_publisher_id(p_vcdplayer->vcd));
       break;
 
     case 'S':
       if ( VCDINFO_ITEM_TYPE_SEGMENT==itemid->type ) {
-        char seg_type_str[10];
-
-        sprintf(seg_type_str, " %s",
-                vcdinfo_video_type2str(p_vcd->vcd, itemid->num));
-        strncat(tp, seg_type_str, TEMP_STR_LEN-(tp-temp_str));
-        tp += strlen(seg_type_str);
+        tp += snprintf(tp,te-tp," %s",
+                vcdinfo_video_type2str(p_vcdplayer->vcd, itemid->num));
       }
-      saw_control_prefix = VLC_FALSE;
+      saw_control_prefix = false;
       break;
 
     case 'T':
-      add_format_num_info(p_vcd->i_track, "%d");
+      tp += snprintf(tp,te-tp,"%d",p_vcdplayer->i_track);
       break;
 
     case 'V':
-      add_format_str_info(vcdinfo_get_volumeset_id(p_vcd->vcd));
+      tp += snprintf(tp,te-tp,"%s",vcdinfo_get_volumeset_id(p_vcdplayer->vcd));
       break;
 
     case 'v':
-      add_format_str_info(vcdinfo_get_volume_id(p_vcd->vcd));
+      tp += snprintf(tp,te-tp,"%s",vcdinfo_get_volume_id(p_vcdplayer->vcd));
       break;
 
     default:
       *tp++ = '%';
-      *tp++ = format_str[i];
-      saw_control_prefix = VLC_FALSE;
+      if(tp<te)
+        *tp++ = *format_str;
+      saw_control_prefix = false;
     }
   }
   return strdup(temp_str);
 }
 
-static void
-VCDCreatePlayListItem(const access_t *p_access,
-                      vcdplayer_t *p_vcd,
-                      playlist_t *p_playlist,
-                      const vcdinfo_itemid_t *itemid,
-                      char *psz_mrl, int psz_mrl_max,
-                      const char *psz_source, int playlist_operation,
-                      int i_pos)
-{
-  char *p_author;
-  char *p_title;
-  char c_type;
-
-  switch(itemid->type) {
-  case VCDINFO_ITEM_TYPE_TRACK:
-    c_type='T';
-    break;
-  case VCDINFO_ITEM_TYPE_SEGMENT:
-    c_type='S';
-    break;
-  case VCDINFO_ITEM_TYPE_LID:
-    c_type='P';
-    break;
-  case VCDINFO_ITEM_TYPE_ENTRY:
-    c_type='E';
-    break;
-  default:
-    c_type='?';
-    break;
-  }
-
-  snprintf(psz_mrl, psz_mrl_max, "%s%s@%c%3u", VCD_MRL_PREFIX, psz_source,
-           c_type, itemid->num);
-
-  p_title =
-    VCDFormatStr( p_access, p_vcd,
-                 config_GetPsz( p_access, MODULE_STRING "-title-format" ),
-                 psz_mrl, itemid );
-  
-  playlist_Add( p_playlist, psz_mrl, p_title, playlist_operation, i_pos );
-
-  p_author =
-    VCDFormatStr( p_access, p_vcd,
-                 config_GetPsz( p_access, MODULE_STRING "-author-format" ),
-                 psz_mrl, itemid );
-
-  if( i_pos == PLAYLIST_END ) i_pos = p_playlist->i_size - 1;
-  playlist_AddInfo(p_playlist, i_pos, _("General"), _("Author"), "%s",
-                  p_author);
-}
-
-int
-VCDFixupPlayList( access_t *p_access, vcdplayer_t *p_vcd,
-                  const char *psz_source, vcdinfo_itemid_t *itemid,
-                  vlc_bool_t b_single_item )
-{
-  unsigned int i;
-  playlist_t * p_playlist;
-  char       * psz_mrl;
-  unsigned int psz_mrl_max = strlen(VCD_MRL_PREFIX) + strlen(psz_source) +
-    strlen("@T") + strlen("100") + 1;
-
-  psz_mrl = malloc( psz_mrl_max );
-
-  if( psz_mrl == NULL )
-    {
-      msg_Warn( p_access, "out of memory" );
-      return -1;
-    }
-
-  p_playlist = (playlist_t *) vlc_object_find( p_access, VLC_OBJECT_PLAYLIST,
-                                               FIND_ANYWHERE );
-  if( !p_playlist )
-    {
-      msg_Warn( p_access, "can't find playlist" );
-      free(psz_mrl);
-      return -1;
-    }
-
-  {
-    vcdinfo_itemid_t list_itemid;
-    list_itemid.type=VCDINFO_ITEM_TYPE_ENTRY;
-
-    playlist_LockDelete( p_playlist, p_playlist->i_index);
-
-    for( i = 0 ; i < p_vcd->i_entries ; i++ )
-      {
-        list_itemid.num=i;
-        VCDCreatePlayListItem(p_access, p_vcd, p_playlist, &list_itemid,
-                              psz_mrl, psz_mrl_max, psz_source,
-                              PLAYLIST_APPEND, PLAYLIST_END);
-      }
-
-#if LOOKED_OVER
-    playlist_Command( p_playlist, PLAYLIST_GOTO, 0 );
-#endif
-
-  }
-
-  vlc_object_release( p_playlist );
-  free(psz_mrl);
-  return 0;
-}
-
 void
 VCDUpdateTitle( access_t *p_access )
-{ 
-
-    vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
+{
+    vcdplayer_t *p_vcdplayer= (vcdplayer_t *)p_access->p_sys;
 
-    unsigned int psz_mrl_max = strlen(VCD_MRL_PREFIX) 
-      + strlen(p_vcd->psz_source) + sizeof("@E999")+3;
+    size_t psz_mrl_max = strlen(VCD_MRL_PREFIX)
+                       + strlen(p_vcdplayer->psz_source) + sizeof("@E999")+3;
     char *psz_mrl = malloc( psz_mrl_max );
 
-    if( psz_mrl ) 
+    if( psz_mrl )
     {
         char *psz_name;
-       snprintf(psz_mrl, psz_mrl_max, "%s%s", 
-                VCD_MRL_PREFIX, p_vcd->psz_source);
-       psz_name = VCDFormatStr( p_access, p_vcd,
-                                config_GetPsz( p_access, MODULE_STRING 
-                                               "-title-format" ),
-                               psz_mrl, &(p_vcd->play_item) );
-       input_Control( p_vcd->p_input, INPUT_SET_NAME, psz_name );
-       free(psz_mrl);
+        char *psz_tfmt = var_InheritString( p_access, MODULE_STRING "-title-format" );
+        snprintf( psz_mrl, psz_mrl_max, "%s%s",
+                  VCD_MRL_PREFIX, p_vcdplayer->psz_source );
+        if( psz_tfmt )
+        {
+            psz_name = VCDFormatStr( p_vcdplayer, psz_tfmt, psz_mrl,
+                                     &(p_vcdplayer->play_item) );
+            free(psz_tfmt);
+            input_Control( p_vcdplayer->p_input, INPUT_SET_NAME, psz_name );
+            free(psz_name);
+        }
+        free(psz_mrl);
     }
 }