-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;
-}
-