* Preamble
*****************************************************************************/
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_access.h>
+#include <vlc_meta.h>
+#include <vlc_charset.h>
#include <vlc_codecs.h> /* For WAVEHEADER */
#include "vcd/cdrom.h"
+#warning playlist code must not be used here.
#include <vlc_playlist.h>
#ifdef HAVE_LIBCDDB
"value should be set in milliseconds." )
vlc_module_begin();
- set_shortname( _("Audio CD"));
- set_description( _("Audio CD input") );
- set_capability( "access2", 10 );
+ set_shortname( N_("Audio CD"));
+ set_description( N_("Audio CD input") );
+ set_capability( "access", 10 );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACCESS );
set_callbacks( Open, Close );
add_usage_hint( N_("[cdda:][device][@[track]]") );
add_integer( "cdda-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
- CACHING_LONGTEXT, VLC_TRUE );
+ CACHING_LONGTEXT, true );
- add_integer( "cdda-track", -1 , NULL, NULL, NULL, VLC_TRUE );
+ add_integer( "cdda-track", -1 , NULL, NULL, NULL, true );
change_internal();
- add_integer( "cdda-first-sector", -1, NULL, NULL, NULL, VLC_TRUE );
+ add_integer( "cdda-first-sector", -1, NULL, NULL, NULL, true );
change_internal();
- add_integer( "cdda-last-sector", -1, NULL, NULL, NULL, VLC_TRUE );
+ add_integer( "cdda-last-sector", -1, NULL, NULL, NULL, true );
change_internal();
add_string( "cddb-server", "freedb.freedb.org", NULL,
N_( "CDDB Server" ), N_( "Address of the CDDB server to use." ),
- VLC_TRUE );
+ true );
add_integer( "cddb-port", 8880, NULL,
N_( "CDDB port" ), N_( "CDDB Server port to use." ),
- VLC_TRUE );
+ true );
add_shortcut( "cdda" );
add_shortcut( "cddasimple" );
vlc_module_end();
/* Wave header for the output data */
WAVEHEADER waveheader;
- vlc_bool_t b_header;
+ bool b_header;
int i_track;
int i_first_sector;
psz_name = var_CreateGetString( p_this, "cd-audio" );
if( !psz_name || !*psz_name )
{
- if( psz_name ) free( psz_name );
+ free( psz_name );
return VLC_EGENERIC;
}
}
- else psz_name = strdup( p_access->psz_path );
+ else psz_name = ToLocaleDup( p_access->psz_path );
#ifdef WIN32
if( psz_name[0] && psz_name[1] == ':' &&
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 );
+ p_item = playlist_ItemGetByInput( p_playlist, p_current, pl_Unlocked );
if( p_item )
i_ret = GetTracks( p_access, p_playlist, p_item );
int i_blocks = CDDA_BLOCKS_ONCE;
block_t *p_block;
- if( p_sys->i_track < 0 ) p_access->info.b_eof = VLC_TRUE;
+ if( p_sys->i_track < 0 ) p_access->info.b_eof = true;
/* Check end of file */
if( p_access->info.b_eof ) return NULL;
/* Return only the header */
p_block = block_New( p_access, sizeof( WAVEHEADER ) );
memcpy( p_block->p_buffer, &p_sys->waveheader, sizeof(WAVEHEADER) );
- p_sys->b_header = VLC_TRUE;
+ p_sys->b_header = true;
return p_block;
}
if( p_sys->i_sector >= p_sys->i_last_sector )
{
- p_access->info.b_eof = VLC_TRUE;
+ p_access->info.b_eof = true;
return NULL;
}
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
- vlc_bool_t *pb_bool;
+ bool *pb_bool;
int *pi_int;
int64_t *pi_64;
case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = VLC_TRUE;
+ pb_bool = (bool*)va_arg( args, bool* );
+ *pb_bool = true;
break;
case ACCESS_GET_MTU:
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_ItemToNode( p_playlist, p_parent, VLC_FALSE );
- vlc_mutex_lock( &p_playlist->object_lock );
+ p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, pl_Unlocked );
playlist_ItemSetName( p_parent, "Audio CD" );
- vlc_mutex_unlock( &p_playlist->object_lock );
var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id );
#ifdef HAVE_LIBCDDB
if( cddb_disc_get_title( p_sys->p_disc ) )
{
const char *psz_name = cddb_disc_get_title( p_sys->p_disc );
- vlc_mutex_lock( &p_playlist->object_lock );
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 );
}
/* If we have CDDB info, change the name */
if( p_sys->p_disc )
{
- const char *psz_result;
cddb_track_t *t = cddb_disc_get_track( p_sys->p_disc, i );
if( t!= NULL )
{
if( cddb_track_get_title( t ) != NULL )
{
- input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
- _(VLC_META_TITLE),
- "%s", cddb_track_get_title( t ) );
- if( p_input_item->psz_name )
- free( p_input_item->psz_name );
+ free( p_input_item->psz_name );
p_input_item->psz_name = strdup( cddb_track_get_title( t ) );
+ input_item_SetTitle( p_input_item, cddb_track_get_title( t ) );
}
- psz_result = cddb_track_get_artist( t );
- if( psz_result )
+ if( cddb_track_get_artist( t ) != NULL )
{
- input_ItemAddInfo( p_input_item, _(VLC_META_INFO_CAT),
- _(VLC_META_ARTIST), "%s", psz_result );
+ input_item_SetArtist( p_input_item, cddb_track_get_artist( t ) );
}
}
}
#endif
- playlist_BothAddInput( p_playlist, p_input_item, p_item_in_category,
+ int i_ret = playlist_BothAddInput( p_playlist, p_input_item,
+ p_item_in_category,
PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
- VLC_FALSE );
+ pl_Unlocked );
+ vlc_gc_decref( p_input_item );
free( psz_uri ); free( psz_opt ); free( psz_name );
free( psz_first ); free( psz_last );
+ if( i_ret != VLC_SUCCESS )
+ return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
cddb_disc_add_track( p_access->p_sys->p_disc, t );
i_size = ( p_sectors[i+1] - p_sectors[i] ) *
(int64_t)CDDA_DATA_SIZE;
- i_length += I64C(1000000) * i_size / 44100 / 4 ;
+ i_length += INT64_C(1000000) * i_size / 44100 / 4 ;
}
cddb_disc_set_length( p_access->p_sys->p_disc, (int)(i_length/1000000) );