/*****************************************************************************
* cdda.c : CD digital audio input module for vlc
*****************************************************************************
- * Copyright (C) 2000, 2003-2006, 2008-2009 the VideoLAN team
+ * Copyright (C) 2000, 2003-2006, 2008-2009 VLC authors and VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
*
- * 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
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser 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.
*****************************************************************************/
/**
* Todo:
- * - Improve CDDB support (non-blocking, cache, ...)
+ * - Improve CDDB support (non-blocking, ...)
* - Fix tracknumber in MRL
*/
change_volatile ()
#ifdef HAVE_LIBCDDB
- add_string( "cddb-server", "freedb.freedb.org", N_( "CDDB Server" ),
+ add_string( "cddb-server", "freedb.videolan.org", N_( "CDDB Server" ),
N_( "Address of the CDDB server to use." ), true )
- add_integer( "cddb-port", 8880, N_( "CDDB port" ),
+ add_integer( "cddb-port", 80, N_( "CDDB port" ),
N_( "CDDB Server port to use." ), true )
+ change_integer_range( 1, 65535 )
#endif
add_shortcut( "cdda", "cddasimple" )
}
else psz_name = ToLocaleDup( p_access->psz_filepath );
-#if defined( WIN32 ) || defined( __OS2__ )
+#if defined( _WIN32 ) || defined( __OS2__ )
if( psz_name[0] && psz_name[1] == ':' &&
psz_name[2] == '\\' && psz_name[3] == '\0' ) psz_name[2] = '\0';
#endif
STANDARD_BLOCK_ACCESS_INIT
p_sys->vcddev = vcddev;
- /* Do we play a single track ? */
- p_sys->i_track = var_InheritInteger( p_access, "cdda-track" ) - 1;
+ /* Do we play a single track ? */
+ p_sys->i_track = var_InheritInteger( p_access, "cdda-track" ) - 1;
- if( p_sys->i_track < 0 )
- {
+ if( p_sys->i_track < 0 )
+ {
/* We only do separate items if the whole disc is requested */
input_thread_t *p_input = access_GetParentInput( p_access );
if( !p_sys->b_header )
{
/* Return only the header */
- p_block = block_New( p_access, sizeof( WAVEHEADER ) );
+ p_block = block_Alloc( sizeof( WAVEHEADER ) );
memcpy( p_block->p_buffer, &p_sys->waveheader, sizeof(WAVEHEADER) );
p_sys->b_header = true;
return p_block;
i_blocks = p_sys->i_last_sector - p_sys->i_sector;
/* Do the actual reading */
- if( !( p_block = block_New( p_access, i_blocks * CDDA_DATA_SIZE ) ) )
+ if( !( p_block = block_Alloc( i_blocks * CDDA_DATA_SIZE ) ) )
{
msg_Err( p_access, "cannot get a new block of size: %i",
i_blocks * CDDA_DATA_SIZE );
}
/* */
+
+ cddb_http_enable( p_cddb );
+
char *psz_tmp = var_InheritString( p_access, "cddb-server" );
if( psz_tmp )
{
cddb_set_email_address( p_cddb, "vlc@videolan.org" );
- /// \todo
- cddb_cache_disable( p_cddb );
+ cddb_set_http_path_query( p_cddb, "/~cddb/cddb.cgi" );
+ cddb_set_http_path_submit( p_cddb, "/~cddb/submit.cgi" );
-// cddb_cache_set_dir( p_cddb,
-// var_InheritString( p_access,
-// MODULE_STRING "-cddb-cachedir") );
- cddb_set_timeout( p_cddb, 10 );
+ char *psz_cachedir;
+ char *psz_temp = config_GetUserDir( VLC_CACHE_DIR );
- /// \todo
- cddb_http_disable( p_cddb );
+ if( asprintf( &psz_cachedir, "%s" DIR_SEP "cddb", psz_temp ) > 0 ) {
+ cddb_cache_enable( p_cddb );
+ cddb_cache_set_dir( p_cddb, psz_cachedir );
+ free( psz_cachedir );
+ }
+ free( psz_temp );
+
+ cddb_set_timeout( p_cddb, 10 );
/* */
cddb_disc_t *p_disc = cddb_disc_new();