/*****************************************************************************
* Preamble
*****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h>
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_input.h>
+#include <vlc_access.h>
-#include "codecs.h"
+#include <vlc_codecs.h> /* For WAVEHEADER */
#include "vcd/cdrom.h"
#include <vlc_playlist.h>
vcddev_t *vcddev;
char *psz_name;
int i_mrl_tracknum = -1;
-
- input_thread_t *p_input;
- playlist_item_t *p_item = NULL;
- playlist_t *p_playlist = NULL;
int i_ret;
if( !p_access->psz_path || !*p_access->psz_path )
STANDARD_BLOCK_ACCESS_INIT
p_sys->vcddev = vcddev;
- /* We only do separate items if the whole disc is requested -
- * Dirty hack we access some private data ! */
- p_input = (input_thread_t *)( p_access->p_parent );
-
/* Do we play a single track ? */
p_sys->i_track = var_CreateGetInteger( p_access, "cdda-track" );
if( p_sys->i_track < 0 && i_mrl_tracknum <= 0 )
{
- p_playlist = pl_Yield( p_access );
- if( p_playlist->status.p_item->p_input ==
- ((input_thread_t *)p_access->p_parent)->input.p_item )
- p_item = p_playlist->status.p_item;
- else
- {
- input_item_t *p_current = ( (input_thread_t*)p_access->p_parent)->
- input.p_item;
- p_item = playlist_LockItemGetByInput( p_playlist, p_current );
+ /* We only do separate items if the whole disc is requested */
+ playlist_t *p_playlist = pl_Yield( p_access );
- if( !p_item )
+ i_ret = -1;
+ if( p_playlist )
+ {
+ input_thread_t *p_input = (input_thread_t*)vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
+ if( p_input )
{
- msg_Dbg( p_playlist, "unable to find item in playlist");
- return -1;
+ input_item_t *p_current = input_GetItem( p_input );
+ playlist_item_t *p_item;
+
+ if( p_playlist->status.p_item->p_input == p_current )
+ p_item = p_playlist->status.p_item;
+ else
+ p_item = playlist_ItemGetByInput( p_playlist, p_current, VLC_FALSE );
+
+ if( p_item )
+ i_ret = GetTracks( p_access, p_playlist, p_item );
+ else
+ msg_Dbg( p_playlist, "unable to find item in playlist");
+ vlc_object_release( p_input );
}
+ vlc_object_release( p_playlist );
}
-
- i_ret = GetTracks( p_access, p_playlist, p_item );
-
- if( p_playlist ) vlc_object_release( p_playlist );
- if( i_ret < 0 ) goto error;
+ if( i_ret < 0 )
+ goto error;
}
else
{
error:
ioctl_Close( VLC_OBJECT(p_access), p_sys->vcddev );
free( p_sys );
- if( p_playlist ) vlc_object_release( p_playlist );
return VLC_EGENERIC;
}
case ACCESS_GET_META:
case ACCESS_SET_SEEKPOINT:
case ACCESS_SET_PRIVATE_ID_STATE:
+ case ACCESS_GET_CONTENT_TYPE:
return VLC_EGENERIC;
default:
return VLC_EGENERIC;
}
- p_item_in_category = playlist_LockItemToNode( p_playlist, p_parent );
- psz_name = strdup( "Audio CD" );
- vlc_mutex_lock( &p_playlist->object_lock );
- playlist_ItemSetName( p_parent, psz_name );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, VLC_FALSE );
+ playlist_ItemSetName( p_parent, "Audio CD" );
var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id );
- free( psz_name );
#ifdef HAVE_LIBCDDB
GetCDDBInfo( p_access, i_titles, p_sys->p_sectors );
{
if( cddb_disc_get_title( p_sys->p_disc ) )
{
- asprintf( &psz_name, "%s", cddb_disc_get_title( p_sys->p_disc ) );
- vlc_mutex_lock( &p_playlist->object_lock );
+ const char *psz_name = cddb_disc_get_title( p_sys->p_disc );
playlist_ItemSetName( p_parent, psz_name );
- vlc_mutex_unlock( &p_playlist->object_lock );
var_SetInteger( p_playlist, "item-change",
p_parent->p_input->i_id );
- free( psz_name );
}
}
#endif
/* If we have CDDB info, change the name */
if( p_sys->p_disc )
{
- char *psz_result;
+ const char *psz_result;
cddb_track_t *t = cddb_disc_get_track( p_sys->p_disc, i );
if( t!= NULL )
{
{
input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
_(VLC_META_TITLE),
- cddb_track_get_title( t ) );
+ "%s", cddb_track_get_title( t ) );
if( p_input_item->psz_name )
free( p_input_item->psz_name );
- asprintf( &p_input_item->psz_name, "%s",
- cddb_track_get_title( t ) );
+ p_input_item->psz_name = strdup( cddb_track_get_title( t ) );
}
psz_result = cddb_track_get_artist( t );
if( psz_result )
{
input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
- _(VLC_META_ARTIST), psz_result );
+ _(VLC_META_ARTIST), "%s", psz_result );
}
}
}
#endif
- playlist_AddWhereverNeeded( p_playlist, p_input_item, p_parent,
- p_item_in_category, VLC_FALSE, PLAYLIST_APPEND );
+ playlist_BothAddInput( p_playlist, p_input_item, p_item_in_category,
+ PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
+ VLC_FALSE );
free( psz_uri ); free( psz_opt ); free( psz_name );
free( psz_first ); free( psz_last );
}