No maintainer, buggy code and no major feature in.
Sorry guys
* WinCE interface
* opie, qte and qte_main
* opengllayer
+ * cddax. Use cdda instead
Changes between 1.0.2 and 1.0.3:
bsdi*)
SYS=bsdi
CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
- VLC_ADD_LIBS([dvd dvdcss vcd cdda vcdx cddax],[-ldvd])
+ VLC_ADD_LIBS([dvd dvdcss vcd cdda vcdx],[-ldvd])
;;
*bsd*)
SYS="${host_os}"
echo " Assuming --enable-theora"
enable_shout="yes"
echo " Assuming --enable-shout"
- enable_cddax="yes"
- echo " Assuming --enable-cddax"
enable_vcdx="yes"
echo " Assuming --enable-vcdx"
enable_caca="yes"
VLC_ADD_LIBS([libvlccore],[-lws2_32 -lnetapi32 -lwinmm])
VLC_ADD_LDFLAGS([vlc],[-mwindows])
VLC_ADD_LIBS([activex mozilla],[-lgdi32])
- VLC_ADD_LIBS([cdda vcdx cddax sdl_image aout_sdl vout_sdl],[-lwinmm])
+ VLC_ADD_LIBS([cdda vcdx sdl_image aout_sdl vout_sdl],[-lwinmm])
VLC_ADD_LIBS([access_http access_mms access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout access_output_rtmp sap slp oldhttp stream_out_standard stream_out_rtp stream_out_raop vod_rtsp access_realrtsp rtp oldtelnet oldrc netsync gnutls growl_udp flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a],[-lws2_32])
VLC_ADD_LIBS([access_file], [-lshlwapi])
dnl
SOCKET_LIBS=""
AC_CHECK_FUNCS(connect,,[
AC_CHECK_LIB(socket,connect,[
- VLC_ADD_LIBS([libvlccore cdda cddax],-lsocket)
+ VLC_ADD_LIBS([libvlccore cdda],-lsocket)
SOCKET_LIBS="-lsocket"
])
])
fi
dnl
-dnl VCDX and CDDAX modules
+dnl VCDX modules
dnl
-AC_ARG_ENABLE(cddax,
- AS_HELP_STRING([--enable-cddax],[audio CD plugin with CD Text and CD paranoia
- via libcdio (default disabled)]))
-
-AC_ARG_ENABLE(libcddb,
- [ --enable-libcddb CDDB support for libcdio audio CD (default enabled)])
-
-if test "${enable_cddax}" = "yes"
-then
- if test "$have_libcdio" = "yes"
- then
- AC_DEFINE(HAVE_CDDAX, 1, [Define for the audio CD plugin using libcdio])
- VLC_ADD_LIBS([cddax],[$LIBCDIO_LIBS])
- VLC_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS])
- VLC_ADD_PLUGIN([cddax])
- PKG_CHECK_MODULES(LIBCDIO_PARANOIA, libcdio_paranoia >= 0.72, [
- VLC_ADD_LIBS([cddax],[$LIBCDIO_CDDA_LIBS $LIBCDIO_CDDA_LIBS $LIBCDIO_PARANOIA_LIBS])],
- AC_MSG_WARN([CD Paranoia support disabled because no libcdio >= 0.72 found]))
- else
- AC_MSG_WARN([cddax plugin disabled because ok libcdio library not found or disabled])
- HAVE_CDDAX=no
- fi
-
- if test "$enable_libcddb" != "no"; then
- PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
- HAVE_LIBCDDB=yes
- AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
- VLC_ADD_LIBS([cddax],[$LIBCDDB_LIBS])
- VLC_ADD_CFLAGS([cddax],[$LIBCDDB_CFLAGS])
- ],
- [AC_MSG_WARN(new enough libcddb not found. CDDB access disabled)
- HAVE_LIBCDDB=no])
- fi
-
-fi
-
AC_ARG_ENABLE(vcdx,
[ --enable-vcdx VCD with navigation via libvcdinfo (default disabled)])
then
VLC_ADD_PLUGIN([vcd])
VLC_ADD_PLUGIN([cdda])
- VLC_ADD_LDFLAGS([vcd vcdx cdda cddax],[-Wl,-framework,IOKit,-framework,CoreFoundation])
- VLC_ADD_LIBS([vcdx cddax cdda],[-liconv])
+ VLC_ADD_LDFLAGS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
+ VLC_ADD_LIBS([vcdx cdda],[-liconv])
fi
if test "$enable_libcddb" != "no"; then
modules/access/dshow/Makefile
modules/access/dvb/Makefile
modules/access/mms/Makefile
- modules/access/cdda/Makefile
modules/access/rtp/Makefile
modules/access/rtsp/Makefile
modules/access/vcd/Makefile
* canvas: Automatically resize and padd a video
* cc: CC 608/708 subtitles decoder
* cdda: input module to read audio CDs
- * cddax: input module to read audio CDs via libcdio
* cdg: CD-G decoder
* chain: Video filtering using a chain of video filter modules
* chorus_flanger: variable delay audio filter
# obviously does not. Here is a fix for that.
LIBTOOL=@LIBTOOL@ --tag=CC
-BASE_SUBDIRS = dvb mms cdda rtp rtsp vcd vcdx screen bd zip
+BASE_SUBDIRS = dvb mms rtp rtsp vcd vcdx screen bd zip
EXTRA_SUBDIRS = bda dshow
SUBDIRS = $(BASE_SUBDIRS)
DIST_SUBDIRS = $(BASE_SUBDIRS) $(EXTRA_SUBDIRS)
+++ /dev/null
-SOURCES_cddax = \
- access.c \
- access.h \
- callback.c \
- callback.h \
- cdda.c \
- cdda.h \
- info.c \
- info.h \
- $(NULL)
+++ /dev/null
-/*****************************************************************************
- * access.c : CD digital audio input module for vlc using libcdio
- *****************************************************************************
- * Copyright (C) 2000, 2003, 2004, 2005 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.com>
- * 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
- * (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.
- *
- * 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.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "callback.h" /* FIXME - reorganize callback.h, cdda.h better */
-#include "cdda.h" /* private structures. Also #includes vlc things */
-#include "info.h" /* headers for meta info retrieval */
-#include "access.h"
-#include <vlc_keys.h>
-#include <vlc_dialog.h>
-
-#include <cdio/cdio.h>
-#include <cdio/logging.h>
-#include <cdio/cd_types.h>
-
-
-/* #ifdef variables below are defined via config.h via #include vlc above. */
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-/* FIXME: This variable is a hack. Would be nice to eliminate. */
-access_t *p_cdda_input = NULL;
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static ssize_t CDDARead( access_t *, uint8_t *, size_t );
-static block_t *CDDAReadBlocks( access_t * p_access );
-static int CDDASeek( access_t * p_access, int64_t i_pos );
-static int CDDAControl( access_t *p_access, int i_query,
- va_list args );
-
-static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda ) ;
-
-
-/****************************************************************************
- * Private functions
- ****************************************************************************/
-
-/* process messages that originate from libcdio.
- called by CDDAOpen
-*/
-static void
-cdio_log_handler( cdio_log_level_t level, const char message[] )
-{
- cdda_data_t *p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
- if( p_cdda == NULL )
- return;
-
- switch( level )
- {
- case CDIO_LOG_DEBUG:
- case CDIO_LOG_INFO:
- if (p_cdda->i_debug & INPUT_DBG_CDIO)
- msg_Dbg( p_cdda_input, "%s", message);
- break;
- case CDIO_LOG_WARN:
- msg_Warn( p_cdda_input, "%s", message);
- break;
- case CDIO_LOG_ERROR:
- case CDIO_LOG_ASSERT:
- msg_Err( p_cdda_input, "%s", message);
- break;
- default:
- msg_Warn( p_cdda_input, "%s\n%s %d", message,
- "the above message had unknown cdio log level",
- level);
- break;
- }
-}
-
-#ifdef HAVE_LIBCDDB
-/*! This routine is called by libcddb routines on error.
- called by CDDAOpen
-*/
-static void
-cddb_log_handler( cddb_log_level_t level, const char message[] )
-{
- cdda_data_t *p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
- switch( level )
- {
- case CDDB_LOG_DEBUG:
- case CDDB_LOG_INFO:
- if( !(p_cdda->i_debug & INPUT_DBG_CDDB) )
- return;
- /* Fall through if to warn case */
- default:
- cdio_log_handler( level, message );
- break;
- }
-}
-#endif /*HAVE_LIBCDDB*/
-
-
-/*! This routine is when vlc is not fully set up (before full initialization)
- or is not around (before finalization).
-*/
-static void
-uninit_log_handler( cdio_log_level_t level, const char message[] )
-{
- cdda_data_t *p_cdda = NULL;
-
- if( p_cdda_input )
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
- switch( level )
- {
- case CDIO_LOG_DEBUG:
- case CDIO_LOG_INFO:
- if( !p_cdda || !(p_cdda->i_debug & (INPUT_DBG_CDIO|INPUT_DBG_CDDB)) )
- return;
- /* Fall through if to warn case */
- case CDIO_LOG_WARN:
- fprintf( stderr, "WARN: %s\n", message );
- break;
- case CDIO_LOG_ERROR:
- fprintf( stderr, "ERROR: %s\n", message );
- break;
- case CDIO_LOG_ASSERT:
- fprintf( stderr, "ASSERT ERROR: %s\n", message );
- break;
- default:
- fprintf( stderr, "UNKNOWN ERROR: %s\n%s %d\n", message,
- "The above message had unknown cdio log level",
- level );
- break;
- }
- /* gl_default_cdio_log_handler (level, message); */
-}
-
-/* Only used in audio control mode. Gets the current LSN from the
- CD-ROM drive. */
-static int64_t get_audio_position ( access_t *p_access )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- lsn_t i_offset;
-
-#if LIBCDIO_VERSION_NUM >= 73
- if( p_cdda->b_audio_ctl )
- {
- cdio_subchannel_t sub;
- CdIo_t *p_cdio = p_cdda->p_cdio;
-
- if( DRIVER_OP_SUCCESS == cdio_audio_read_subchannel(p_cdio, &sub) )
- {
- if( (sub.audio_status != CDIO_MMC_READ_SUB_ST_PAUSED) &&
- (sub.audio_status != CDIO_MMC_READ_SUB_ST_PLAY) )
- return CDIO_INVALID_LSN;
-
- if( ! p_cdda->b_nav_mode )
- {
- i_offset = cdio_msf_to_lba( (&sub.abs_addr) );
- }
- else
- {
- i_offset = cdio_msf_to_lba( (&sub.rel_addr) );
- }
- }
- else
- {
- i_offset = p_cdda->i_lsn;
- }
- }
- else
- {
- i_offset = p_cdda->i_lsn;
- }
-#else
- i_offset = p_cdda->i_lsn;
-#endif
- return i_offset;
-}
-
-/*****************************************************************************
- * CDDAReadBlocks: reads a group of blocks from the CD-DA and returns
- * an allocated pointer to the data. NULL is returned if no data
- * read. It is also possible if we haven't read a RIFF header in which
- * case one that we creaded during Open/Initialization is returned.
- *****************************************************************************/
-static block_t * CDDAReadBlocks( access_t * p_access )
-{
- block_t *p_block;
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- int i_blocks = p_cdda->i_blocks_per_read;
-
- dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN),
- "called i_lsn: %d i_pos: %lld, size: %lld",
- p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size );
-
- /* Check end of file */
- if( p_access->info.b_eof )
- return NULL;
-
- if( !p_cdda->b_header )
- {
- /* Return only the dummy RIFF header we created in Open/Init */
- p_block = block_New( p_access, sizeof( WAVEHEADER ) );
- memcpy( p_block->p_buffer, &p_cdda->waveheader, sizeof(WAVEHEADER) );
- p_cdda->b_header = true;
- return p_block;
- }
-
- /* Check end of track */
- while( p_cdda->i_lsn > cdio_get_track_last_lsn(p_cdda->p_cdio,
- p_cdda->i_track) )
- {
- bool go_on;
-
- if( p_cdda->b_nav_mode )
- go_on = p_cdda->i_lsn > p_cdda->last_disc_frame;
- else
- go_on = p_cdda->i_track >= p_cdda->i_first_track+p_cdda->i_titles-1 ;
-
- if( go_on )
- {
- dbg_print( (INPUT_DBG_LSN), "EOF");
- p_access->info.b_eof = true;
- return NULL;
- }
-
- p_access->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_META;
- p_access->info.i_title++;
- p_cdda->i_track++;
-
- if( p_cdda-> b_nav_mode )
- {
- char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
- input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title );
- free(psz_title);
- }
- else
- {
- p_access->info.i_size =
- p_cdda->p_title[p_access->info.i_title]->i_size;
- p_access->info.i_pos = 0;
- p_access->info.i_update |= INPUT_UPDATE_SIZE;
- }
- }
-
- /* Possibly adjust i_blocks so we don't read past the end of a track. */
- if( p_cdda->i_lsn + i_blocks >=
- cdio_get_track_lsn(p_cdda->p_cdio, p_cdda->i_track+1) )
- {
- i_blocks = cdio_get_track_lsn( p_cdda->p_cdio, p_cdda->i_track+1 )
- - p_cdda->i_lsn;
- }
-
- /* Do the actual reading */
- p_block = block_New( p_access, i_blocks * CDIO_CD_FRAMESIZE_RAW );
- if( !p_block)
- {
- msg_Err( p_access, "cannot get a new block of size: %i",
- i_blocks * CDIO_CD_FRAMESIZE_RAW );
- dialog_Fatal( p_access, _("CD reading failed"),
- _("VLC could not get a new block of size: %i."),
- i_blocks * CDIO_CD_FRAMESIZE_RAW );
- return NULL;
- }
-
- {
-#if LIBCDIO_VERSION_NUM >= 72
- driver_return_code_t rc = DRIVER_OP_SUCCESS;
-
- if( p_cdda->e_paranoia && p_cdda->paranoia )
- {
- int i;
- for( i = 0; i < i_blocks; i++ )
- {
- int16_t *p_readbuf = cdio_paranoia_read( p_cdda->paranoia, NULL );
- char *psz_err = cdio_cddap_errors( p_cdda->paranoia_cd );
- char *psz_mes = cdio_cddap_messages( p_cdda->paranoia_cd );
-
- if( psz_mes || psz_err )
- msg_Err( p_access, "%s%s", psz_mes ? psz_mes: "",
- psz_err ? psz_err: "" );
-
- free( psz_err );
- free( psz_mes );
- if( !p_readbuf )
- {
- msg_Err( p_access, "paranoia read error on frame %i",
- p_cdda->i_lsn+i );
- }
- else
- memcpy( p_block->p_buffer + i * CDIO_CD_FRAMESIZE_RAW,
- p_readbuf, CDIO_CD_FRAMESIZE_RAW );
- }
- }
- else
- rc = cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer,
- p_cdda->i_lsn, i_blocks );
-#else
-#define DRIVER_OP_SUCCESS 0
- int rc = cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer,
- p_cdda->i_lsn, i_blocks);
-#endif
- if( rc != DRIVER_OP_SUCCESS )
- {
- msg_Err( p_access, "could not read %d sectors starting from %lu",
- i_blocks, (long unsigned int) p_cdda->i_lsn );
- block_Release( p_block );
-
- /* If we had problems above, assume the problem is with
- the first sector of the read and set to skip it. In
- the future libcdio may have cdparanoia support.
- */
- p_cdda->i_lsn++;
- p_access->info.i_pos += CDIO_CD_FRAMESIZE_RAW;
- return NULL;
- }
- }
-
- p_cdda->i_lsn += i_blocks;
- p_access->info.i_pos += i_blocks * CDIO_CD_FRAMESIZE_RAW;
-
- return p_block;
-}
-
-/*****************************************************************************
- * CDDARead: Handler for audio control reads the CD-DA.
- *****************************************************************************/
-static ssize_t
-CDDARead( access_t * p_access, uint8_t *p_buffer, size_t i_len )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
-
- dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_LSN),
- "called lsn: %d pos: %lld, size: %lld",
- p_cdda->i_lsn, p_access->info.i_pos, p_access->info.i_size);
-
- /* Check end of file */
- if( p_access->info.b_eof )
- return 0;
-
- {
- lsn_t i_lsn = get_audio_position(p_access);
- if( CDIO_INVALID_LSN == i_lsn )
- {
- dbg_print( (INPUT_DBG_LSN), "invalid lsn" );
- memset( p_buffer, 0, i_len );
- return i_len;
- }
-
- p_cdda->i_lsn = i_lsn;
- p_access->info.i_pos = p_cdda->i_lsn * CDIO_CD_FRAMESIZE_RAW;
- }
-
- dbg_print( (INPUT_DBG_LSN), "updated lsn: %d", p_cdda->i_lsn );
-
- /* Check end of track */
- while( p_cdda->i_lsn > cdio_get_track_last_lsn( p_cdda->p_cdio,
- p_cdda->i_track) )
- {
- if( p_cdda->i_track >= p_cdda->i_first_track + p_cdda->i_titles - 1 )
- {
- dbg_print( (INPUT_DBG_LSN), "EOF");
- p_access->info.b_eof = true;
- return 0;
- }
- p_access->info.i_update |= INPUT_UPDATE_TITLE;
- p_access->info.i_title++;
- p_cdda->i_track++;
-
- if( p_cdda-> b_nav_mode )
- {
- char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
- input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title );
- free( psz_title );
- }
- else
- {
- p_access->info.i_size =
- p_cdda->p_title[p_access->info.i_title]->i_size;
- p_access->info.i_pos = 0;
- p_access->info.i_update |= INPUT_UPDATE_SIZE;
- }
- }
- memset( p_buffer, 0, i_len );
- return i_len;
-}
-
-/*! Pause CD playing via audio control */
-static bool cdda_audio_pause( CdIo_t *p_cdio )
-{
- bool b_ok = true;
-#if LIBCDIO_VERSION_NUM >= 73
- cdio_subchannel_t sub;
-
- if( DRIVER_OP_SUCCESS == cdio_audio_read_subchannel( p_cdio, &sub ) )
- {
- if( sub.audio_status == CDIO_MMC_READ_SUB_ST_PLAY )
- {
- b_ok = DRIVER_OP_SUCCESS == cdio_audio_pause(p_cdio);
- }
- }
- else
- b_ok = false;
-#endif
- return b_ok;
-}
-
-#if LIBCDIO_VERSION_NUM >= 73
-/*! play CD using audio controls */
-static driver_return_code_t
-cdda_audio_play( CdIo_t *p_cdio, lsn_t start_lsn, lsn_t end_lsn )
-{
- msf_t start_msf;
- msf_t last_msf;
- cdio_lsn_to_msf( start_lsn, &start_msf );
- cdio_lsn_to_msf( end_lsn, &last_msf );
- cdda_audio_pause( p_cdio );
- return cdio_audio_play_msf( p_cdio, &start_msf, &last_msf );
-}
-#endif
-
-/****************************************************************************
- * CDDASeek - change position for subsequent reads. For example, this
- * can happen if the user moves a position slider bar in a GUI.
- ****************************************************************************/
-static int CDDASeek( access_t * p_access, int64_t i_pos )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
-
- dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_SEEK),
- "lsn %lu, offset: %lld",
- (long unsigned int) p_cdda->i_lsn, i_pos );
-
- p_cdda->i_lsn = (i_pos / CDIO_CD_FRAMESIZE_RAW);
-
-#if LIBCDIO_VERSION_NUM >= 72
- if( p_cdda->e_paranoia && p_cdda->paranoia )
- cdio_paranoia_seek( p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET );
-#endif
-
-#if LIBCDIO_VERSION_NUM >= 73
- if( p_cdda->b_audio_ctl )
- {
- track_t i_track = cdio_get_track( p_cdda->p_cdio, p_cdda->i_lsn );
- lsn_t i_last_lsn;
-
- if( p_cdda->b_nav_mode )
- i_last_lsn = p_cdda->last_disc_frame;
- else
- i_last_lsn = cdio_get_track_last_lsn( p_cdda->p_cdio, i_track );
-
- cdda_audio_play( p_cdda->p_cdio, p_cdda->i_lsn, i_last_lsn );
- }
-#endif
-
- if( ! p_cdda->b_nav_mode )
- p_cdda->i_lsn += cdio_get_track_lsn( p_cdda->p_cdio, p_cdda->i_track );
-
- /* Seeked backwards and we are doing disc mode. */
- if( p_cdda->b_nav_mode && p_access->info.i_pos > i_pos )
- {
- track_t i_track;
- char *psz_title;
-
- for( i_track = p_cdda->i_track; i_track > 1 &&
- p_cdda->i_lsn < cdio_get_track_lsn( p_cdda->p_cdio, i_track );
- i_track--, p_access->info.i_title-- )
- ;
-
- p_cdda->i_track = i_track;
- p_access->info.i_update |= INPUT_UPDATE_TITLE | INPUT_UPDATE_META ;
- psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
- input_Control( p_cdda->p_input, INPUT_SET_NAME,
- psz_title );
- free( psz_title );
- }
-
- p_access->info.i_pos = i_pos;
- p_access->info.b_eof = false;
- return VLC_SUCCESS;
-}
-
-/*
- Set up internal state so that we play a given track.
- If we are using audio-ctl mode we also activate CD-ROM
- to play.
- */
-static bool cdda_play_track( access_t *p_access, track_t i_track )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
-
- dbg_print( (INPUT_DBG_CALL), "called track: %d\n", i_track );
-
- if( i_track > p_cdda->i_tracks )
- {
- msg_Err( p_access, "CD has %d tracks, and you requested track %d",
- p_cdda->i_tracks, i_track );
- return false;
- }
- p_cdda->i_track = i_track;
-
- /* set up the frame boundaries for this particular track */
- p_cdda->first_frame = p_cdda->i_lsn =
- cdio_get_track_lsn( p_cdda->p_cdio, i_track );
-
- p_cdda->last_frame = cdio_get_track_lsn( p_cdda->p_cdio, i_track+1 ) - 1;
-
-#if LIBCDIO_VERSION_NUM >= 73
- if( p_cdda->b_audio_ctl )
- {
- lsn_t i_last_lsn;
- if( p_cdda->b_nav_mode )
- i_last_lsn = p_cdda->last_disc_frame;
- else
- i_last_lsn = cdio_get_track_last_lsn( p_cdda->p_cdio, i_track );
- cdda_audio_play( p_cdda->p_cdio, p_cdda->i_lsn, i_last_lsn );
- }
-#endif
- return true;
-}
-
-/****************************************************************************
- * Public functions
- ****************************************************************************/
-
-/*****************************************************************************
- * Open: open cdda device or image file and initialize structures
- * for subsequent operations.
- *****************************************************************************/
-int CDDAOpen( vlc_object_t *p_this )
-{
- access_t *p_access = (access_t*)p_this;
- char * psz_source = NULL;
- cdda_data_t *p_cdda = NULL;
- CdIo_t *p_cdio;
- track_t i_track = 1;
- bool b_single_track = false;
- int i_rc = VLC_EGENERIC;
-
- p_access->p_sys = NULL;
-
- /* Set where to log errors messages from libcdio. */
- p_cdda_input = p_access;
-
- /* parse the options passed in command line : */
- if( p_access->psz_path && *p_access->psz_path )
- {
- char *psz_parser = psz_source = strdup( p_access->psz_path );
-
- while( *psz_parser && *psz_parser != '@' )
- {
- psz_parser++;
- }
-
- if( *psz_parser == '@' )
- {
- /* Found options */
- *psz_parser = '\0';
- ++psz_parser;
-
- if ('T' == *psz_parser || 't' == *psz_parser )
- ++psz_parser;
-
- i_track = (int)strtol( psz_parser, NULL, 10 );
- i_track = i_track ? i_track : 1;
- b_single_track = true;
- }
- }
-
- if( !psz_source || !*psz_source )
- {
- free( psz_source );
- /* No device/track given. Continue only when this plugin was
- selected */
- if( !p_this->b_force )
- return VLC_EGENERIC;
-
- psz_source = var_CreateGetString( p_this, "cd-audio" );
- if( !psz_source || !*psz_source )
- {
- free( psz_source );
- /* Scan for a CD-ROM drive with a CD-DA in it. */
- char **ppsz_drives =
- cdio_get_devices_with_cap( NULL, CDIO_FS_AUDIO, false );
-
- if( (NULL == ppsz_drives) || (NULL == ppsz_drives[0]) )
- {
- msg_Err( p_access,
- "libcdio couldn't find something with a CD-DA in it" );
- if( ppsz_drives )
- cdio_free_device_list( ppsz_drives );
- return VLC_EGENERIC;
- }
- psz_source = strdup( ppsz_drives[0] );
- cdio_free_device_list( ppsz_drives );
- }
- }
- cdio_log_set_handler( cdio_log_handler );
-
- /* Open CDDA */
- if( !(p_cdio = cdio_open( psz_source, DRIVER_UNKNOWN )) )
- {
- msg_Warn( p_access, "could not open %s", psz_source );
- free( psz_source );
- return VLC_EGENERIC;
- }
-
- p_cdda = calloc( 1, sizeof(cdda_data_t) );
- if( p_cdda == NULL )
- {
- free( psz_source );
- return VLC_ENOMEM;
- }
-
-#ifdef HAVE_LIBCDDB
- cddb_log_set_handler ( cddb_log_handler );
- p_cdda->cddb.disc = NULL;
- p_cdda->b_cddb_enabled =
- var_CreateGetInteger( p_access, "album-art" ) != ALBUM_ART_WHEN_ASKED
- && var_InheritInteger( p_access, MODULE_STRING "-cddb-enabled" );
-#endif
- p_cdda->b_cdtext =
- var_InheritInteger( p_access, MODULE_STRING "-cdtext-enabled" );
- p_cdda->b_cdtext_prefer =
- var_InheritInteger( p_access, MODULE_STRING "-cdtext-prefer" );
-#if LIBCDIO_VERSION_NUM >= 73
- p_cdda->b_audio_ctl =
- var_InheritInteger( p_access, MODULE_STRING "-analog-output" );
-#endif
-
- p_cdda->psz_source = strdup( psz_source );
- p_cdda->b_header = false;
- p_cdda->p_cdio = p_cdio;
- p_cdda->i_tracks = 0;
- p_cdda->i_titles = 0;
- p_cdda->i_debug = var_InheritInteger( p_this, MODULE_STRING "-debug" );
- p_cdda->b_nav_mode =
- var_InheritInteger(p_this, MODULE_STRING "-navigation-mode" );
- p_cdda->i_blocks_per_read =
- var_InheritInteger( p_this, MODULE_STRING "-blocks-per-read" );
- p_cdda->last_disc_frame =
- cdio_get_track_lsn( p_cdio, CDIO_CDROM_LEADOUT_TRACK );
- p_cdda->p_input = access_GetParentInput( p_access );
-
- if( 0 == p_cdda->i_blocks_per_read )
- p_cdda->i_blocks_per_read = DEFAULT_BLOCKS_PER_READ;
-
- if( (p_cdda->i_blocks_per_read < MIN_BLOCKS_PER_READ)
- || (p_cdda->i_blocks_per_read > MAX_BLOCKS_PER_READ) )
- {
- msg_Warn( p_cdda_input,
- "number of blocks (%d) has to be between %d and %d. "
- "Using %d.",
- p_cdda->i_blocks_per_read,
- MIN_BLOCKS_PER_READ, MAX_BLOCKS_PER_READ,
- DEFAULT_BLOCKS_PER_READ );
- p_cdda->i_blocks_per_read = DEFAULT_BLOCKS_PER_READ;
- }
-
- dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "%s", psz_source );
-
- /* Set up p_access */
- if( p_cdda->b_audio_ctl )
- {
- p_access->pf_read = CDDARead;
- p_access->pf_block = NULL;
- }
- else
- {
- p_access->pf_read = NULL;
- p_access->pf_block = CDDAReadBlocks;
- }
-
- p_access->pf_control = CDDAControl;
- p_access->pf_seek = CDDASeek;
-
- {
- lsn_t i_last_lsn;
-
- if( p_cdda->b_nav_mode )
- i_last_lsn = p_cdda->last_disc_frame;
- else
- i_last_lsn = cdio_get_track_last_lsn( p_cdio, i_track );
-
- if( CDIO_INVALID_LSN != i_last_lsn )
- p_access->info.i_size = i_last_lsn * (uint64_t) CDIO_CD_FRAMESIZE_RAW;
- else
- p_access->info.i_size = 0;
- }
-
- p_access->info.i_update = 0;
- p_access->info.b_eof = false;
- p_access->info.i_title = 0;
- p_access->info.i_seekpoint = 0;
-
- p_access->p_sys = (access_sys_t *) p_cdda;
-
- /* We read the Table Of Content information */
- i_rc = CDDAInit( p_access, p_cdda );
- if( VLC_SUCCESS != i_rc )
- goto error;
-
- cdda_play_track( p_access, i_track );
- CDDAFixupPlaylist( p_access, p_cdda, b_single_track );
-
-#if LIBCDIO_VERSION_NUM >= 72
- {
- char *psz_paranoia = var_InheritString( p_access,
- MODULE_STRING "-paranoia" );
-
- p_cdda->e_paranoia = PARANOIA_MODE_DISABLE;
- if( psz_paranoia )
- {
- if( !strncmp( psz_paranoia, "full", strlen("full") ) )
- p_cdda->e_paranoia = PARANOIA_MODE_FULL;
- else if( !strncmp(psz_paranoia, "overlap", strlen("overlap")) )
- p_cdda->e_paranoia = PARANOIA_MODE_OVERLAP;
-
- /* Use CD Paranoia? */
- if( p_cdda->e_paranoia )
- {
- p_cdda->paranoia_cd =
- cdio_cddap_identify_cdio( p_cdio, 1, NULL );
- /* We'll set for verbose paranoia messages. */
- cdio_cddap_verbose_set( p_cdda->paranoia_cd,
- CDDA_MESSAGE_PRINTIT,
- CDDA_MESSAGE_PRINTIT );
- if ( 0 != cdio_cddap_open(p_cdda->paranoia_cd) )
- {
- msg_Warn( p_cdda_input, "unable to get paranoia support - "
- "continuing without it." );
- p_cdda->e_paranoia = PARANOIA_MODE_DISABLE;
- }
- else
- {
- p_cdda->paranoia = cdio_paranoia_init(p_cdda->paranoia_cd);
- cdio_paranoia_seek( p_cdda->paranoia, p_cdda->i_lsn,
- SEEK_SET);
-
- /* Set reading mode for full or overlap paranoia,
- * but allow skipping sectors. */
- cdio_paranoia_modeset( p_cdda->paranoia,
- PARANOIA_MODE_FULL == p_cdda->e_paranoia ?
- PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP :
- PARANOIA_MODE_OVERLAP^PARANOIA_MODE_NEVERSKIP );
- }
- }
- }
- free( psz_paranoia );
- }
-#endif
-
- /* Build a WAV header to put in front of the output data.
- This gets sent back in the Block (read) routine.
- */
- memset( &p_cdda->waveheader, 0, sizeof(WAVEHEADER) );
-
- SetWLE( &p_cdda->waveheader.Format, 1 ); /*WAVE_FORMAT_PCM*/
- SetWLE( &p_cdda->waveheader.BitsPerSample, 16);
-
- p_cdda->waveheader.MainChunkID = VLC_FOURCC('R', 'I', 'F', 'F');
- p_cdda->waveheader.Length = 0; /* we just don't know */
- p_cdda->waveheader.ChunkTypeID = VLC_FOURCC('W', 'A', 'V', 'E');
- p_cdda->waveheader.SubChunkID = VLC_FOURCC('f', 'm', 't', ' ');
-
- SetDWLE( &p_cdda->waveheader.SubChunkLength, 16);
- SetWLE( &p_cdda->waveheader.Modus, 2);
- SetDWLE( &p_cdda->waveheader.SampleFreq, CDDA_FREQUENCY_SAMPLE);
- SetWLE( &p_cdda->waveheader.BytesPerSample,
- 2 /*Modus*/ * 16 /*BitsPerSample*/ / 8 );
- SetDWLE( &p_cdda->waveheader.BytesPerSec,
- 2*16/8 /*BytesPerSample*/ * CDDA_FREQUENCY_SAMPLE );
-
- p_cdda->waveheader.DataChunkID = VLC_FOURCC('d', 'a', 't', 'a');
- p_cdda->waveheader.DataLength = 0; /* we just don't know */
-
- /* PTS delay */
- var_Create( p_access, MODULE_STRING "-caching",
- VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
- vlc_object_release( p_cdda->p_input );
- free( psz_source );
- return VLC_SUCCESS;
-
- error:
- cdio_destroy( p_cdda->p_cdio );
- free( psz_source );
- if( p_cdda )
- {
- if ( p_cdda->p_input )
- vlc_object_release( p_cdda->p_input );
- free(p_cdda);
- }
- return i_rc;
-}
-
-/*****************************************************************************
- * CDDAClose: closes cdda and frees any resources associded with it.
- *****************************************************************************/
-void CDDAClose (vlc_object_t *p_this )
-{
- access_t *p_access = (access_t *) p_this;
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- track_t i;
-
-#if LIBCDIO_VERSION_NUM >= 73
- if( p_cdda->b_audio_ctl )
- cdio_audio_stop(p_cdda->p_cdio);
-#endif
-
- dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT), "" );
-
- /* Remove playlist titles */
- for( i = 0; i < p_cdda->i_titles; i++ )
- {
- vlc_input_title_Delete( p_cdda->p_title[i] );
- }
-
-#ifdef HAVE_LIBCDDB
- cddb_log_set_handler( (cddb_log_handler_t) uninit_log_handler );
- if( p_cdda->b_cddb_enabled )
- cddb_disc_destroy( p_cdda->cddb.disc );
-#endif
-
- cdio_destroy( p_cdda->p_cdio );
- cdio_log_set_handler( uninit_log_handler );
-
-#if LIBCDIO_VERSION_NUM >= 72
- if( p_cdda->paranoia )
- cdio_paranoia_free(p_cdda->paranoia);
- if( p_cdda->paranoia_cd )
- cdio_cddap_close_no_free_cdio( p_cdda->paranoia_cd );
-#endif
-
- free( p_cdda->psz_mcn );
- free( p_cdda->psz_source );
-
-#if LIBCDDB_VERSION_NUM >= 1
- libcddb_shutdown();
-#endif
- free( p_cdda );
- p_cdda = NULL;
- p_cdda_input = NULL;
-}
-
-/*****************************************************************************
- * Control: The front-end or vlc engine calls here to ether get
- * information such as meta information or plugin capabilities or to
- * issue miscellaneous "set" requests.
- *****************************************************************************/
-static int CDDAControl( access_t *p_access, int i_query, va_list args )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- int *pi_int;
- int i;
-
- dbg_print( (INPUT_DBG_CALL|INPUT_DBG_EXT|INPUT_DBG_EVENT),
- "query %d", i_query );
-
- switch( i_query )
- {
- /* Pass back a copy of meta information that was gathered when we
- during the Open/Initialize call.
- */
- case ACCESS_GET_META:
- {
-#if 0
- vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
- if( p_cdda->p_meta )
- {
- *pp_meta = vlc_meta_Duplicate( p_cdda->p_meta );
- dbg_print( INPUT_DBG_META, "%s", "Meta copied" );
- return VLC_SUCCESS;
- }
- else
-#endif
- {
- msg_Warn( p_access, "tried to copy NULL meta info" );
- return VLC_EGENERIC;
- }
- }
-
- case ACCESS_CAN_CONTROL_PACE:
- {
- bool *pb_bool = (bool*)va_arg( args, bool* );
- *pb_bool = p_cdda->b_audio_ctl ? false : true;
- dbg_print( INPUT_DBG_META, "can control pace? %d", *pb_bool);
- return VLC_SUCCESS;
- }
-
- case ACCESS_CAN_FASTSEEK:
- dbg_print( INPUT_DBG_META, "can fast seek?");
- goto common;
- case ACCESS_CAN_SEEK:
- dbg_print( INPUT_DBG_META, "can seek?");
- goto common;
- case ACCESS_CAN_PAUSE:
- dbg_print( INPUT_DBG_META, "can pause?");
- common:
- {
- bool *pb_bool = (bool*)va_arg( args, bool* );
- *pb_bool = true;
- return VLC_SUCCESS;
- }
-
- case ACCESS_GET_PTS_DELAY:
- {
- int64_t *pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = var_GetInteger( p_access, MODULE_STRING "-caching" )
- * MILLISECONDS_PER_SEC;
- break;
- }
-
- case ACCESS_GET_TITLE_INFO:
- {
- input_title_t ***ppp_title =
- (input_title_t***)va_arg( args, input_title_t*** );
-
- pi_int = (int*)va_arg( args, int* );
- *((int*)va_arg( args, int* )) = 1; /* Title offset */
-
- dbg_print ( INPUT_DBG_EVENT,
- "GET TITLE: i_tracks %d, i_tracks %d",
- p_cdda->i_tracks, p_cdda->i_tracks );
-
- CDDAMetaInfo( p_access, CDIO_INVALID_TRACK );
-
- if( p_cdda->b_nav_mode)
- {
- char *psz_title = CDDAFormatTitle( p_access, p_cdda->i_track );
- input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_title );
- free(psz_title);
- }
-
- /* Duplicate title info */
- if( p_cdda->i_titles == 0 )
- {
- *pi_int = 0; ppp_title = NULL;
- return VLC_SUCCESS;
- }
- *pi_int = p_cdda->i_titles;
- *ppp_title = calloc(1, sizeof( input_title_t **)
- * p_cdda->i_titles );
-
- if (!*ppp_title)
- return VLC_ENOMEM;
-
- for( i = 0; i < p_cdda->i_titles; i++ )
- {
- if ( p_cdda->p_title[i] )
- {
- (*ppp_title)[i] =
- vlc_input_title_Duplicate( p_cdda->p_title[i] );
- }
- }
- break;
- }
-
- case ACCESS_SET_TITLE:
- {
- i = (int)va_arg( args, int );
-
- dbg_print( INPUT_DBG_EVENT, "set title %d", i );
- if( i != p_access->info.i_title )
- {
- const track_t i_track = p_cdda->i_first_track + i;
- /* Update info */
- p_access->info.i_title = i;
- if( p_cdda->b_nav_mode)
- {
- lsn_t i_last_lsn;
- char *psz_title = CDDAFormatTitle( p_access, i_track );
- input_Control( p_cdda->p_input, INPUT_SET_NAME,
- psz_title );
- free( psz_title );
- p_cdda->i_track = i_track;
- i_last_lsn = cdio_get_track_lsn( p_cdda->p_cdio,
- CDIO_CDROM_LEADOUT_TRACK );
- if( CDIO_INVALID_LSN != i_last_lsn )
- p_access->info.i_size = (int64_t) CDIO_CD_FRAMESIZE_RAW
- * i_last_lsn ;
- p_access->info.i_pos = (int64_t)
- cdio_get_track_lsn( p_cdda->p_cdio, i_track )
- * CDIO_CD_FRAMESIZE_RAW;
- }
- else
- {
- p_access->info.i_size = p_cdda->p_title[i]->i_size;
- p_access->info.i_pos = 0;
- }
- p_access->info.i_update = INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
-
- /* Next sector to read */
- p_cdda->i_lsn = cdio_get_track_lsn( p_cdda->p_cdio, i_track );
- }
- break;
- }
-
- case ACCESS_SET_PAUSE_STATE:
- dbg_print( INPUT_DBG_META, "Pause");
- if( p_cdda->b_audio_ctl )
- cdda_audio_pause( p_cdda->p_cdio );
- break;
-
- case ACCESS_SET_SEEKPOINT:
- dbg_print( INPUT_DBG_META, "set seekpoint");
- return VLC_EGENERIC;
-
- case ACCESS_SET_PRIVATE_ID_STATE:
- dbg_print( INPUT_DBG_META, "set private id state");
- return VLC_EGENERIC;
-
- default:
- msg_Warn( p_access, "unimplemented query in control" );
- return VLC_EGENERIC;
-
- }
- return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- CDDAInit:
-
- Initialize information pertaining to the CD: the number of tracks,
- first track number, LSNs for each track and the leadout. The leadout
- information is stored after the last track. The LSN array is
- 0-origin, same as p_access->info. Add first_track to get what track
- number this is on the CD. Note: libcdio uses the real track number.
-
- On input we assume p_cdda->p_cdio and p_cdda->i_track have been set.
-
- We return the VLC-type status, e.g. VLC_SUCCESS, VLC_ENOMEM, etc.
- *****************************************************************************/
-static int CDDAInit( access_t *p_access, cdda_data_t *p_cdda )
-{
- discmode_t discmode = CDIO_DISC_MODE_NO_INFO;
-
- p_cdda->i_tracks = cdio_get_num_tracks( p_cdda->p_cdio );
- p_cdda->i_first_track = cdio_get_first_track_num( p_cdda->p_cdio );
-
- discmode = cdio_get_discmode( p_cdda->p_cdio );
- switch( discmode )
- {
- case CDIO_DISC_MODE_CD_DA:
- case CDIO_DISC_MODE_CD_MIXED:
- /* These are possible for CD-DA */
- break;
- default:
- /* These are not possible for CD-DA */
- msg_Err( p_access,
- "Disc seems not to be CD-DA. libcdio reports it is %s",
- discmode2str[discmode]
- );
- return VLC_EGENERIC;
- }
-
- /* Set reading start LSN. */
- p_cdda->i_lsn = cdio_get_track_lsn(p_cdda->p_cdio, p_cdda->i_track);
-
- return VLC_SUCCESS;
-}
-
-/*
- * Local variables:
- * mode: C
- * style: gnu
- * End:
- */
+++ /dev/null
-/*****************************************************************************
- * access.h : access headers for CD digital audio input module
- *****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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.
- *****************************************************************************/
-
-/*****************************************************************************
- * Open: open cdda device or image file and initialize structures
- * for subsequent operations.
- *****************************************************************************/
-int CDDAOpen ( vlc_object_t * );
-
-/*****************************************************************************
- * CDDAClose: closes cdda and frees any resources associded with it.
- *****************************************************************************/
-void CDDAClose ( vlc_object_t * );
+++ /dev/null
-/*****************************************************************************
- * callback.c : Callbacks for CD digital audio input module
- *****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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 "callback.h"
-#include "cdda.h"
-
-int
-CDDADebugCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- VLC_UNUSED(p_this);
- VLC_UNUSED(psz_name);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
- cdda_data_t *p_cdda;
-
- if (NULL == p_cdda_input) return VLC_EGENERIC;
-
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
- if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
- {
- msg_Dbg( p_cdda_input, "old debug (x%0x) %d, new debug (x%0x) %d",
- p_cdda->i_debug, p_cdda->i_debug, val.i_int, val.i_int);
- }
- p_cdda->i_debug = val.i_int;
- return VLC_SUCCESS;
-}
-
-/* FIXME: could probably shorten some of the below boilerplate code...
-*/
-int
-CDDBEnabledCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- VLC_UNUSED(p_this);
- VLC_UNUSED(psz_name);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
-
- cdda_data_t *p_cdda;
-
- if (NULL == p_cdda_input) return VLC_EGENERIC;
-
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
-#ifdef HAVE_LIBCDDB
- if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
- {
- msg_Dbg( p_cdda_input, "old CDDB Enabled (x%0x) %d, new (x%0x) %d",
- p_cdda->b_cddb_enabled, p_cdda->b_cddb_enabled,
- val.b_bool, val.b_bool);
- }
- p_cdda->b_cddb_enabled = val.b_bool;
-#endif
- return VLC_SUCCESS;
-}
-
-int
-CDTextEnabledCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- VLC_UNUSED(p_this);
- VLC_UNUSED(psz_name);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
-
- cdda_data_t *p_cdda;
-
- if (NULL == p_cdda_input) return VLC_EGENERIC;
-
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
- if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
- {
- msg_Dbg( p_cdda_input, "old CDText Enabled %d, new %d",
- p_cdda->b_cdtext, val.b_bool);
- }
- p_cdda->b_cdtext = val.b_bool;
- return VLC_SUCCESS;
-}
-
-int
-CDDANavModeCB( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- VLC_UNUSED(p_this);
- VLC_UNUSED(psz_name);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
-
- cdda_data_t *p_cdda;
-
- if (NULL == p_cdda_input) return VLC_EGENERIC;
-
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
- if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
- {
- msg_Dbg( p_cdda_input,
- "old Navigation Mode Enabled %d, new %d",
- p_cdda->b_nav_mode, val.b_bool);
- }
- p_cdda->b_nav_mode = val.b_bool;
- return VLC_SUCCESS;
-}
-
-int
-CDTextPreferCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- VLC_UNUSED(p_this);
- VLC_UNUSED(psz_name);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
-
- cdda_data_t *p_cdda;
-
- if (NULL == p_cdda_input) return VLC_EGENERIC;
-
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
-#ifdef HAVE_LIBCDDB
- if ( p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
- {
- msg_Dbg( p_cdda_input, "old CDText Prefer (x%0x) %d, new (x%0x) %d",
- p_cdda->b_cdtext_prefer, p_cdda->b_cdtext_prefer,
- val.b_bool, val.b_bool);
- }
- p_cdda->b_cdtext_prefer = val.b_bool;
-#endif
- return VLC_SUCCESS;
-}
-
-int
-CDDABlocksPerReadCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val, void *p_data )
-{
- VLC_UNUSED(p_this);
- VLC_UNUSED(psz_name);
- VLC_UNUSED(oldval);
- VLC_UNUSED(p_data);
-
- cdda_data_t *p_cdda;
-
- if (NULL == p_cdda_input) return VLC_EGENERIC;
-
- p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
-
- if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT))
- {
- msg_Dbg( p_cdda_input, "old blocks per read: %d, new %d",
- p_cdda->i_blocks_per_read, val.i_int);
- }
-
- if (0 == val.i_int) val.i_int = DEFAULT_BLOCKS_PER_READ;
- if ( val.i_int >= MIN_BLOCKS_PER_READ && val.i_int <= MAX_BLOCKS_PER_READ )
- p_cdda->i_blocks_per_read = val.i_int;
- else
- {
- msg_Warn( p_cdda_input,
- "number of blocks (%d) has to be between %d and %d. No change.",
- val.i_int, MIN_BLOCKS_PER_READ, MAX_BLOCKS_PER_READ );
- }
- return VLC_SUCCESS;
-}
+++ /dev/null
-/*****************************************************************************
- * callback.h : Callbacks for CD digital audio input module
- *****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-
-/*
- Minimum, maximum and default number of blocks we allow on read.
-*/
-#define MIN_BLOCKS_PER_READ 1
-#define MAX_BLOCKS_PER_READ 25
-#define DEFAULT_BLOCKS_PER_READ 20
-
-int CDDADebugCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val,
- void *p_data );
-
-int CDDBEnabledCB( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val,
- void *p_data );
-
-
-int CDTextEnabledCB( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val,
- void *p_data );
-
-int CDTextPreferCB( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val,
- void *p_data );
-
-int CDDANavModeCB( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val,
- void *p_data );
-
-
-int CDDABlocksPerReadCB ( vlc_object_t *p_this, const char *psz_name,
- vlc_value_t oldval, vlc_value_t val,
- void *p_data );
-
+++ /dev/null
-/*****************************************************************************
- * cdda.c : CD digital audio input module for vlc using libcdio
- *****************************************************************************
- * Copyright (C) 2000, 2003, 2004, 2005 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "callback.h"
-#include "access.h"
-#include <cdio/version.h>
-#include <vlc_plugin.h>
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-
-/*****************************************************************************
- * Option help text
- *****************************************************************************/
-
-#if LIBCDIO_VERSION_NUM >= 72
-static const char *const psz_paranoia_list[] = { "none", "overlap", "full" };
-static const char *const psz_paranoia_list_text[] = { N_("none"), N_("overlap"),
- N_("full") };
-#endif
-
-#define DEBUG_LONGTEXT N_( \
- "This integer when viewed in binary is a debugging mask\n" \
- "meta info 1\n" \
- "events 2\n" \
- "MRL 4\n" \
- "external call 8\n" \
- "all calls (0x10) 16\n" \
- "LSN (0x20) 32\n" \
- "seek (0x40) 64\n" \
- "libcdio (0x80) 128\n" \
- "libcddb (0x100) 256\n" )
-
-#define CACHING_LONGTEXT N_( \
- "Caching value for CDDA streams. This " \
- "value should be set in millisecond units." )
-
-#define BLOCKS_PER_READ_LONGTEXT N_( \
- "How many CD blocks to get on a single CD read. " \
- "Generally on newer/faster CDs, this increases throughput at the " \
- "expense of a little more memory usage and initial delay. SCSI-MMC " \
- "limitations generally don't allow for more than 25 blocks per access.")
-
-#define CDDB_TITLE_FMT_LONGTEXT N_( \
-"Format used in the GUI Playlist Title. Similar to the Unix date \n" \
-"Format specifiers that start with a percent sign. Specifiers are: \n" \
-" %a : The artist (for the album)\n" \
-" %A : The album information\n" \
-" %C : Category\n" \
-" %e : The extended data (for a track)\n" \
-" %I : CDDB disk ID\n" \
-" %G : Genre\n" \
-" %M : The current MRL\n" \
-" %m : The CD-DA Media Catalog Number (MCN)\n" \
-" %n : The number of tracks on the CD\n" \
-" %p : The artist/performer/composer in the track\n" \
-" %T : The track number\n" \
-" %s : Number of seconds in this track\n" \
-" %S : Number of seconds in the CD\n" \
-" %t : The track title or MRL if no title\n" \
-" %Y : The year 19xx or 20xx\n" \
-" %% : a % \n")
-
-#define TITLE_FMT_LONGTEXT N_( \
-"Format used in the GUI Playlist Title. Similar to the Unix date \n" \
-"Format specifiers that start with a percent sign. Specifiers are: \n" \
-" %M : The current MRL\n" \
-" %m : The CD-DA Media Catalog Number (MCN)\n" \
-" %n : The number of tracks on the CD\n" \
-" %T : The track number\n" \
-" %s : Number of seconds in this track\n" \
-" %S : Number of seconds in the CD\n" \
-" %t : The track title or MRL if no title\n" \
-" %% : a % \n")
-
-#define PARANOIA_TEXT N_("Enable CD paranoia?")
-#define PARANOIA_LONGTEXT N_( \
- "Select whether to use CD Paranoia for jitter/error correction.\n" \
- "none: no paranoia - fastest.\n" \
- "overlap: do only overlap detection - not generally recommended.\n" \
- "full: complete jitter and error correction detection - slowest.\n" )
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-
-vlc_module_begin ()
- add_usage_hint( N_("cddax://[device-or-file][@[T]track]") )
- set_description( N_("Compact Disc Digital Audio (CD-DA) input") )
- set_capability( "access", 10 /* compare with priority of cdda */ )
- set_shortname( N_("Audio Compact Disc"))
- set_callbacks( CDDAOpen, CDDAClose )
- add_shortcut( "cddax" )
- add_shortcut( "cd" )
- set_category( CAT_INPUT )
- set_subcategory( SUBCAT_INPUT_ACCESS )
-
- /* Configuration options */
- add_integer ( MODULE_STRING "-debug", 0, CDDADebugCB,
- N_("Additional debug"),
- DEBUG_LONGTEXT, true )
-
- add_integer( MODULE_STRING "-caching",
- DEFAULT_PTS_DELAY / MILLISECONDS_PER_SEC, NULL,
- N_("Caching value in microseconds"),
- CACHING_LONGTEXT, true )
-
- add_integer( MODULE_STRING "-blocks-per-read",
- DEFAULT_BLOCKS_PER_READ, CDDABlocksPerReadCB,
- N_("Number of blocks per CD read"),
- BLOCKS_PER_READ_LONGTEXT, true )
-
- add_string( MODULE_STRING "-title-format",
- "Track %T. %t", NULL,
- N_("Format to use in playlist \"title\" field when no CDDB"),
- TITLE_FMT_LONGTEXT, true )
-
-#if LIBCDIO_VERSION_NUM >= 73
- add_bool( MODULE_STRING "-analog-output", false, NULL,
- N_("Use CD audio controls and output?"),
- N_("If set, audio controls and audio jack output are used"),
- false )
-#endif
-
- add_bool( MODULE_STRING "-cdtext-enabled", true, CDTextEnabledCB,
- N_("Do CD-Text lookups?"),
- N_("If set, get CD-Text information"),
- false )
-
- add_bool( MODULE_STRING "-navigation-mode", true,
-#ifdef FIXED
- CDDANavModeCB,
-#else
- NULL,
-#endif
- N_("Use Navigation-style playback?"),
- N_("Tracks are navigated via Navagation rather than "
- "a playlist entries"),
- false )
-
-#if LIBCDIO_VERSION_NUM >= 72
- add_string( MODULE_STRING "-paranoia", NULL, NULL,
- PARANOIA_TEXT,
- PARANOIA_LONGTEXT,
- false )
- change_string_list( psz_paranoia_list, psz_paranoia_list_text, 0 );
-#endif /* LIBCDIO_VERSION_NUM >= 72 */
-
-#ifdef HAVE_LIBCDDB
- set_section( N_("CDDB" ), 0 )
- add_string( MODULE_STRING "-cddb-title-format",
- "Track %T. %t - %p %A", NULL,
- N_("Format to use in playlist \"title\" field when using CDDB"),
- CDDB_TITLE_FMT_LONGTEXT, true )
-
- add_bool( MODULE_STRING "-cddb-enabled", true, CDDBEnabledCB,
- N_("CDDB lookups"),
- N_("If set, lookup CD-DA track information using the CDDB "
- "protocol"),
- false )
-
- add_string( MODULE_STRING "-cddb-server", "freedb.freedb.org", NULL,
- N_("CDDB server"),
- N_( "Contact this CDDB server look up CD-DA information"),
- true )
-
- add_integer( MODULE_STRING "-cddb-port", 8880, NULL,
- N_("CDDB server port"),
- N_("CDDB server uses this port number to communicate on"),
- true )
-
- add_string( MODULE_STRING "-cddb-email", "me@home", NULL,
- N_("email address reported to CDDB server"),
- N_("email address reported to CDDB server"),
- true )
-
- add_bool( MODULE_STRING "-cddb-enable-cache", true, NULL,
- N_("Cache CDDB lookups?"),
- N_("If set cache CDDB information about this CD"),
- false )
-
- add_bool( MODULE_STRING "-cddb-httpd", false, NULL,
- N_("Contact CDDB via the HTTP protocol?"),
- N_("If set, the CDDB server gets information via the CDDB HTTP "
- "protocol"),
- true )
-
- add_integer( MODULE_STRING "-cddb-timeout", 10, NULL,
- N_("CDDB server timeout"),
- N_("Time (in seconds) to wait for a response from the "
- "CDDB server"),
- false )
-
- add_string( MODULE_STRING "-cddb-cachedir", "~/.cddbslave", NULL,
- N_("Directory to cache CDDB requests"),
- N_("Directory to cache CDDB requests"),
- true )
-
- add_bool( MODULE_STRING "-cdtext-prefer", true, CDTextPreferCB,
- N_("Prefer CD-Text info to CDDB info?"),
- N_("If set, CD-Text information will be preferred "
- "to CDDB information when both are available"),
- false )
-#endif /*HAVE_LIBCDDB*/
-
-vlc_module_end ()
+++ /dev/null
-/*****************************************************************************
- * cdda.h : CD-DA input module header for vlc using libcdio.
- *****************************************************************************
- * Copyright (C) 2003 the VideoLAN team
- * $Id$
- *
- * Author: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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_input.h>
-#include <vlc_access.h>
-#include <cdio/cdio.h>
-#include <cdio/cdtext.h>
-#if LIBCDIO_VERSION_NUM >= 73
-#include <cdio/audio.h>
-#include <cdio/mmc.h>
-#endif
-
-#include <vlc_meta.h>
-#include <vlc_codecs.h>
-
-#ifdef HAVE_LIBCDDB
-#include <cddb/cddb.h>
-#endif
-
-
-#define CDDA_MRL_PREFIX "cddax://"
-
-/* Frequency of sample in bits per second. */
-#define CDDA_FREQUENCY_SAMPLE 44100
-
-/*****************************************************************************
- * Debugging
- *****************************************************************************/
-#define INPUT_DBG_META 1 /* Meta information */
-#define INPUT_DBG_EVENT 2 /* Trace keyboard events */
-#define INPUT_DBG_MRL 4 /* MRL debugging */
-#define INPUT_DBG_EXT 8 /* Calls from external routines */
-#define INPUT_DBG_CALL 16 /* all calls */
-#define INPUT_DBG_LSN 32 /* LSN changes */
-#define INPUT_DBG_SEEK 64 /* Seeks to set location */
-#define INPUT_DBG_CDIO 128 /* Debugging from CDIO */
-#define INPUT_DBG_CDDB 256 /* CDDB debugging */
-
-#define INPUT_DEBUG 1
-#if INPUT_DEBUG
-#define dbg_print(mask, s, args...) \
- if (p_cdda->i_debug & mask) \
- msg_Dbg(p_access, "%s: "s, __func__ , ##args)
-#else
-#define dbg_print(mask, s, args...)
-#endif
-
-#if LIBCDIO_VERSION_NUM >= 72
-#include <cdio/cdda.h>
-#include <cdio/paranoia.h>
-#else
-#define CdIo_t CdIo
-#endif
-
-/*****************************************************************************
- * cdda_data_t: CD audio information
- *****************************************************************************/
-typedef struct cdda_data_s
-{
- CdIo_t *p_cdio; /* libcdio CD device */
- track_t i_tracks; /* # of tracks */
- track_t i_first_track; /* # of first track */
- track_t i_titles; /* # of titles in playlist */
-
- /* Current position */
- track_t i_track; /* Current track */
- lsn_t i_lsn; /* Current Logical Sector Number */
-
- lsn_t first_frame; /* LSN of first frame of this track */
- lsn_t last_frame; /* LSN of last frame of this track */
- lsn_t last_disc_frame; /* LSN of last frame on CD */
- int i_blocks_per_read; /* # blocks to get in a read */
- int i_debug; /* Debugging mask */
-
- /* Information about CD */
- vlc_meta_t *p_meta;
- char * psz_mcn; /* Media Catalog Number */
- char * psz_source; /* CD drive or CD image filename */
- input_title_t *p_title[CDIO_CD_MAX_TRACKS]; /* This *is* 0 origin, not
- track number origin */
-
-#if LIBCDIO_VERSION_NUM >= 72
- /* Paranoia support */
- paranoia_mode_t e_paranoia; /* Use cd paranoia for reads? */
- cdrom_drive_t *paranoia_cd; /* Place to store drive
- handle given by paranoia. */
- cdrom_paranoia_t *paranoia;
-
-#endif
-
-#ifdef HAVE_LIBCDDB
- bool b_cddb_enabled; /* Use CDDB at all? */
- struct {
- bool have_info; /* True if we have any info */
- cddb_disc_t *disc; /* libcdio uses this to get disc
- info */
- int disc_length; /* Length in frames of cd. Used
- in CDDB lookups */
- } cddb;
-#endif
-
- bool b_audio_ctl; /* Use CD-Text audio controls and
- audio output? */
-
- bool b_cdtext; /* Use CD-Text at all? If not,
- cdtext_preferred is meaningless. */
- bool b_cdtext_prefer; /* Prefer CD-Text info over
- CDDB? If no CDDB, the issue
- is moot. */
-
- const cdtext_t *p_cdtext[CDIO_CD_MAX_TRACKS]; /* CD-Text info. Origin is NOT
- 0 origin but origin of track
- number (usually 1).
- */
-
- WAVEHEADER waveheader; /* Wave header for the output data */
- bool b_header;
- bool b_nav_mode; /* If false we view the entire CD as
- as a unit rather than each track
- as a unit. If b_nav_mode then the
- slider area represents the Disc rather
- than a track
- */
-
- input_thread_t *p_input;
-
-} cdda_data_t;
-
-/* FIXME: This variable is a hack. Would be nice to eliminate. */
-extern access_t *p_cdda_input;
+++ /dev/null
-/*****************************************************************************
- * info.c : CD digital audio input information routines
- *****************************************************************************
- * Copyright (C) 2004, 2005 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "callback.h" /* FIXME - reorganize callback.h, cdda.h better */
-#include "cdda.h" /* private structures. Also #includes vlc things */
-
-#include <cdio/cdio.h>
-#include <cdio/cdtext.h>
-#include <cdio/logging.h>
-#include <cdio/cd_types.h>
-#include "info.h"
-
-#include <errno.h>
-#include <assert.h>
-
-static char *CDDAFormatStr( const access_t *p_access, cdda_data_t *p_cdda,
- const char format_str[], const char *psz_mrl,
- track_t i_track);
-
-static char *CDDAFormatMRL( const access_t *p_access, track_t i_track );
-
-#ifdef HAVE_LIBCDDB
-
-#define free_and_dup(var, val) \
- free( var ); \
- if (val) var = strdup( val );
-
-
-/* Saves CDDB information about CD-DA via libcddb. */
-static void
-GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda )
-{
- int i, i_matches;
- cddb_conn_t *conn = cddb_new();
- const CdIo_t *p_cdio = p_cdda->p_cdio;
-
- dbg_print( (INPUT_DBG_CALL), "" );
-
-#ifdef FIXME_NOW
- cddb_log_set_handler (uninit_log_handler);
-#endif
-
- if (!conn)
- {
- msg_Warn( p_access, "Unable to initialize libcddb" );
- goto cddb_destroy;
- }
-
- char* psz_email = var_InheritString( p_access, MODULE_STRING "-cddb-email");
- if( psz_email )
- {
- cddb_set_email_address( conn, psz_email );
- free( psz_email );
- }
-
- char* psz_srv_name = var_InheritString( p_access, MODULE_STRING "-cddb-server");
- if( psz_srv_name )
- {
- cddb_set_server_name( conn, psz_srv_name );
- free( psz_srv_name );
- }
- cddb_set_server_port(conn,
- var_InheritInteger( p_access,
- MODULE_STRING "-cddb-port") );
-
- /* Set the location of the local CDDB cache directory.
- The default location of this directory is */
-
- if (!var_InheritInteger( p_access, MODULE_STRING "-cddb-enable-cache" ))
- cddb_cache_disable(conn);
-
- char* psz_cache = var_InheritString( p_access, MODULE_STRING "-cddb-cachedir");
- if( psz_cache )
- {
- cddb_cache_set_dir(conn, psz_cache );
- free( psz_cache );
- }
-
- cddb_set_timeout(conn,
- var_InheritInteger( p_access, MODULE_STRING "-cddb-timeout") );
-
-
- if (var_InheritInteger( p_access, MODULE_STRING "-cddb-httpd" ) )
- cddb_http_enable(conn);
- else
- cddb_http_disable(conn);
-
- p_cdda->cddb.disc = cddb_disc_new();
-
- if (!p_cdda->cddb.disc)
- {
- msg_Err( p_access, "Unable to create CDDB disc structure." );
- goto cddb_end;
- }
-
- for(i = 0; i < p_cdda->i_tracks; i++)
- {
- track_t i_track = p_cdda->i_first_track + i;
- cddb_track_t *t = cddb_track_new();
- cddb_track_set_frame_offset(t,
- cdio_get_track_lba(p_cdio, i_track));
- cddb_disc_add_track(p_cdda->cddb.disc, t);
- }
-
- cddb_disc_set_length(p_cdda->cddb.disc,
- cdio_get_track_lba(p_cdio, CDIO_CDROM_LEADOUT_TRACK)
- / CDIO_CD_FRAMES_PER_SEC);
-
- if (!cddb_disc_calc_discid(p_cdda->cddb.disc))
- {
- msg_Err( p_access, "CDDB disc ID calculation failed" );
- goto cddb_destroy;
- }
-
- i_matches = cddb_query(conn, p_cdda->cddb.disc);
-
- if (i_matches > 0)
- {
- if (i_matches > 1)
- msg_Warn( p_access, "Found %d matches in CDDB. Using first one.",
- i_matches);
- cddb_read(conn, p_cdda->cddb.disc);
-
- if (p_cdda->i_debug & INPUT_DBG_CDDB)
- cddb_disc_print(p_cdda->cddb.disc);
-
- }
- else
- {
- msg_Warn( p_access, "CDDB error: %s", cddb_error_str(errno));
- }
-
-cddb_destroy:
- cddb_destroy(conn);
-
-cddb_end: ;
-}
-#endif /*HAVE_LIBCDDB*/
-
-static inline void add_meta_val(access_t *p_access, vlc_meta_type_t meta, const char * val)
-{
- cdda_data_t *p_cdda = (cdda_data_t *)p_access->p_sys;
- if (p_cdda->p_meta && val)
- dbg_print( INPUT_DBG_META, "field %s: %s\n", input_MetaTypeToLocalizedString(meta), val);
-}
-
-#define add_cddb_meta(FIELD, VLC_META) \
- add_meta_val(p_access, VLC_META, cddb_disc_get_##FIELD(p_cdda->cddb.disc));
-
-#define add_cddb_meta_fmt(FIELD, FORMAT_SPEC, VLC_META) \
- { \
- char psz_buf[100]; \
- snprintf( psz_buf, sizeof(psz_buf)-1, FORMAT_SPEC, \
- cddb_disc_get_##FIELD(p_cdda->cddb.disc)); \
- psz_buf[sizeof(psz_buf)-1] = '\0'; \
- add_meta_val(p_access, VLC_META, psz_buf); \
- }
-
-/* Adds a string-valued entry to the stream and media information if
- the string is not null or the null string.
- */
-#define add_info_str(CATEGORY, TITLE, FIELD) \
- if (FIELD && strlen(FIELD)) { \
- input_Control( p_cdda->p_input, INPUT_ADD_INFO, CATEGORY, \
- _(TITLE), "%s", FIELD ); \
- }
-
-/* Adds a numeric-valued entry to the stream and media information
- if the number is not zero. */
-#define add_info_val(CATEGORY, TITLE, FMT, FIELD) \
- if (FIELD) { \
- input_Control( p_cdda->p_input, INPUT_ADD_INFO, CATEGORY, \
- _(TITLE), FMT, FIELD ); \
- }
-
-/* Adds a CDDB string-valued entry to the stream and media information
- under category "Disc" if the string is not null or the null string.
- */
-#define add_cddb_disc_info_str(TITLE, FIELD) \
- add_info_str("Disc", TITLE, cddb_disc_get_##FIELD(p_cdda->cddb.disc))
-
-/* Adds a CDDB numeric-valued entry to the stream and media information
- under category "Disc" if the string is not null or the null string.
- */
-#define add_cddb_disc_info_val(TITLE, FMT, FIELD) \
- add_info_val("Disc", TITLE, FMT, cddb_disc_get_##FIELD(p_cdda->cddb.disc))
-
-/* Adds a CD-Text string-valued entry to the stream and media information
- under category "Disc" if the string is not null or the null string.
- */
-#define add_cdtext_info_str(CATEGORY, TITLE, INDEX, FIELD) \
- add_info_str(CATEGORY, TITLE, p_cdda->p_cdtext[INDEX]->field[FIELD])
-
-/* Adds a CD-Text string-valued entry to the stream and media information
- under category "Disc" if the string is not null or the null string.
- */
-#define add_cdtext_disc_info_str(TITLE, FIELD) \
- add_cdtext_info_str("Disc", TITLE, 0, FIELD)
-
-
-/*
- Saves Meta Information about the CD-DA.
-
- Meta information used in "stream and media info" or in playlist
- info. The intialization of CD-Text or CDDB is done here though.
- Therefore, this should be called before CDDAMetaInfo is called.
-
- */
-static void
-CDDAMetaInfoInit( access_t *p_access )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
-
- if ( ! p_cdda ) return;
-
- dbg_print( (INPUT_DBG_CALL), "p_cdda->i_tracks %d",
- p_cdda->i_tracks );
-
- p_cdda->psz_mcn = cdio_get_mcn(p_cdda->p_cdio);
-#if 0
- p_cdda->p_meta = vlc_meta_New();
-#endif
-
-#ifdef HAVE_LIBCDDB
- if ( p_cdda->b_cddb_enabled )
- {
- GetCDDBInfo(p_access, p_cdda);
- }
-
-#endif /*HAVE_LIBCDDB*/
-
-#define TITLE_MAX 30
- {
- track_t i_track;
-
- for( i_track = 0 ; i_track < p_cdda->i_tracks ; i_track++ )
- {
- p_cdda->p_cdtext[i_track] =
- cdio_get_cdtext(p_cdda->p_cdio, i_track);
- }
- }
-}
-
-/*
- In the Control routine, we handle Meta Information requests and
- basically copy what was saved in CDDAMetaInfoInit.
-
- If i_track is CDIO_INVALID_TRACK we are probably asking about the entire
- CD.
- */
-void
-CDDAMetaInfo( access_t *p_access, track_t i_track )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- char *psz_meta_title = CDDAFormatMRL( p_access, i_track );
- char *psz_meta_artist = NULL;
-
- if ( ! p_cdda ) return;
-
- dbg_print( (INPUT_DBG_CALL), "i_track %d", i_track );
-
-#ifdef HAVE_LIBCDDB
-
- /* Set up for Meta and name for CDDB access. */
- if ( p_cdda->b_cddb_enabled && p_cdda->cddb.disc )
- {
- if( CDIO_INVALID_TRACK == i_track )
- {
-
- psz_meta_title = (char *)cddb_disc_get_title(p_cdda->cddb.disc);
- psz_meta_artist = (char *)cddb_disc_get_artist(p_cdda->cddb.disc);
- if ( cddb_disc_get_genre(p_cdda->cddb.disc) &&
- strlen(cddb_disc_get_genre(p_cdda->cddb.disc)) )
- add_cddb_meta(genre, vlc_meta_Genre);
- if ( 0 != cddb_disc_get_year(p_cdda->cddb.disc))
- add_cddb_meta_fmt(year, "%d", vlc_meta_Date );
- }
- else
- {
- cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc, i_track-1);
- if (t != NULL )
- {
- if( cddb_track_get_title(t) != NULL && ! p_cdda->b_nav_mode )
- {
- add_meta_val( p_access, vlc_meta_Title, cddb_track_get_title(t) );
- }
- if( cddb_track_get_artist(t) != NULL )
- {
- add_meta_val( p_access, vlc_meta_Artist, cddb_track_get_artist(t) );
- }
- }
- }
- }
-#endif /*HAVE_LIBCDDB*/
-
-#define TITLE_MAX 30
- {
- track_t i = p_cdda->i_tracks;
- const int i_first_track = p_cdda->i_first_track;
- char psz_buffer[MSTRTIME_MAX_SIZE];
- unsigned int i_track_frames =
- cdio_get_track_lba(p_cdda->p_cdio, CDIO_CDROM_LEADOUT_TRACK);
-
- mtime_t i_duration = i_track_frames / CDIO_CD_FRAMES_PER_SEC;
-
- dbg_print( INPUT_DBG_META, "Duration %ld, tracks %d",
- (long int) i_duration, p_cdda->i_tracks );
- input_Control( p_cdda->p_input, INPUT_ADD_INFO,
- _("Disc"), _("Duration"), "%s",
- secstotimestr( psz_buffer, i_duration ) );
-
- if (p_cdda->psz_mcn)
- {
- input_Control( p_cdda->p_input, INPUT_ADD_INFO,
- _("Disc"), _("Media Catalog Number (MCN)"), "%s",
- p_cdda->psz_mcn );
- input_Control( p_cdda->p_input, INPUT_ADD_INFO,
- _("Disc"), _("Tracks"), "%d", p_cdda->i_tracks );
- }
-
-#ifdef HAVE_LIBCDDB
- if (p_cdda->b_cddb_enabled && p_cdda->cddb.disc)
- {
- add_cddb_disc_info_str("Artist (CDDB)", artist);
- if ( CDDB_CAT_INVALID != cddb_disc_get_category(p_cdda->cddb.disc) )
- add_info_str("Disc", "Category (CDDB)",
- CDDB_CATEGORY[cddb_disc_get_category(p_cdda->cddb.disc)]);
- add_cddb_disc_info_val("Disc ID (CDDB)", "%x", discid);
- add_cddb_disc_info_str("Extended Data (CDDB)", ext_data);
- add_cddb_disc_info_str("Genre (CDDB)", genre);
- add_cddb_disc_info_str("Title (CDDB)", title);
- if ( 0 != cddb_disc_get_year(p_cdda->cddb.disc) )
- add_cddb_disc_info_val("Year (CDDB)", "%d", year);
-
- }
-#endif /*HAVE_LIBCDDB*/
-
- if (p_cdda->p_cdtext[0])
- {
- char *psz_field;
-
- add_cdtext_disc_info_str("Arranger (CD-Text)", CDTEXT_ARRANGER);
- add_cdtext_disc_info_str("Composer (CD-Text)", CDTEXT_COMPOSER);
- add_cdtext_disc_info_str("Disc ID (CD-Text)", CDTEXT_DISCID);
- add_cdtext_disc_info_str("Genre (CD-Text)", CDTEXT_GENRE);
- add_cdtext_disc_info_str("Message (CD-Text)", CDTEXT_MESSAGE);
- add_cdtext_disc_info_str("Performer (CD-Text)", CDTEXT_PERFORMER);
- add_cdtext_disc_info_str("Songwriter (CD-Text)", CDTEXT_SONGWRITER);
- add_cdtext_disc_info_str("Title (CD-Text)", CDTEXT_TITLE);
-
- psz_field = p_cdda->p_cdtext[0]->field[CDTEXT_TITLE];
- if (psz_field && strlen(psz_field))
- psz_meta_title = psz_field;
-
- psz_field = p_cdda->p_cdtext[0]->field[CDTEXT_PERFORMER];
- if (psz_field && strlen(psz_field))
- psz_meta_artist = psz_field;
- }
-
- for( i = 0 ; i < p_cdda->i_tracks ; i++ )
- {
- char psz_track[TITLE_MAX];
- const track_t i_track = i_first_track + i;
- unsigned int i_track_frames =
- cdio_get_track_lsn(p_cdda->p_cdio, i_track+1) -
- cdio_get_track_lsn(p_cdda->p_cdio, i_track);
-
- mtime_t i_duration = i_track_frames / CDIO_CD_FRAMES_PER_SEC;
- char *psz_mrl = CDDAFormatMRL( p_access, i_track );
-
- snprintf(psz_track, TITLE_MAX, "%s %02d", _("Track"), i_track);
-
- input_Control( p_cdda->p_input, INPUT_ADD_INFO, psz_track,
- _("Duration"), "%s",
- secstotimestr( psz_buffer, i_duration ) );
-
- input_Control( p_cdda->p_input, INPUT_ADD_INFO, psz_track,
- _("MRL"), "%s", psz_mrl );
- free(psz_mrl);
-
- if (p_cdda->p_cdtext[i_track])
- {
- add_cdtext_info_str( psz_track, "Arranger (CD-Text)",
- i_track, CDTEXT_ARRANGER);
- add_cdtext_info_str( psz_track, "Composer (CD-Text)",
- i_track, CDTEXT_COMPOSER);
- add_cdtext_info_str( psz_track, "Disc ID (CD-Text)",
- i_track, CDTEXT_DISCID);
- add_cdtext_info_str( psz_track, "Genre (CD-Text)",
- i_track, CDTEXT_GENRE);
- add_cdtext_info_str( psz_track, "Message (CD-Text)",
- i_track, CDTEXT_MESSAGE);
- add_cdtext_info_str( psz_track, "Performer (CD-Text)",
- i_track, CDTEXT_PERFORMER);
- add_cdtext_info_str( psz_track, "Songwriter (CD-Text)",
- i_track, CDTEXT_SONGWRITER);
- add_cdtext_info_str( psz_track, "Title (CD-Text)",
- i_track, CDTEXT_TITLE);
- }
-
-#ifdef HAVE_LIBCDDB
- if (p_cdda->b_cddb_enabled)
- {
- cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc, i);
- if (t != NULL)
- {
- add_info_str(psz_track, "Artist (CDDB)",
- cddb_track_get_artist(t));
- add_info_str(psz_track, "Title (CDDB)",
- cddb_track_get_title(t));
- add_info_str(psz_track, "Extended Data (CDDB)",
- cddb_track_get_ext_data(t));
- }
- }
-#endif /*HAVE_LIBCDDB*/
- }
-
- /* Above we should have set psz_meta_title and psz_meta_artist
- to CDDB or CD-Text values or the default value depending on
- availablity and user preferences.
-
- So now add the title and artist to VLC's meta, and the name
- as shown in the status bar and playlist entry.
-
- For playlist mode, the meta title is what's seen at the
- bottom and in the playlist. For nav-mode playing, it is
- done by input_control. I don't understand why they do
- different things. In either case, we may have customized to
- put in the track name.
- */
- if ( CDIO_INVALID_TRACK != i_track )
- {
- char *psz_name = CDDAFormatTitle( p_access, i_track ) ;
- if ( !p_cdda->b_nav_mode ) {
- add_meta_val( p_access, vlc_meta_Title, psz_name );
- } else
- {
- input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_name );
- free(psz_name);
- }
- if (psz_meta_artist)
- add_meta_val( p_access, vlc_meta_Artist, psz_meta_artist );
- }
- }
-}
-
-#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 = 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 = false; \
- }
-
-static inline bool
-want_cddb_info(
-cdda_data_t *p_cdda, char *psz_cdtext)
-{
- /* We either don't have CD-Text info, or we do but we prefer to get CDDB
- which means CDDB has been enabled and we were able to retrieve the info.*/
-#ifdef HAVE_LIBCDDB
- return !psz_cdtext ||
- (!p_cdda->b_cdtext_prefer && p_cdda->b_cddb_enabled && p_cdda->cddb.disc);
-#else
- return false;
-#endif
-}
-
-
-/*!
- Take a format string and expand escape sequences, that is sequences that
- begin with %, with information from the current CD.
- The expanded string is returned. Here is a list of escape sequences:
-
- %a : The album artist **
- %A : The album information **
- %C : Category **
- %e : The extended track data
- %I : CDDB disk ID **
- %G : Genre **
- %M : The current MRL
- %m : The CD-DA Media Catalog Number (MCN)
- %n : The number of tracks on the CD
- %p : The artist/performer/composer in the track **
- %T : The track number **
- %s : Number of seconds in this track, or seconds in CD if invalid track
- %S : Number of seconds on the CD
- %t : The track name or MRL if no name
- %Y : The year 19xx or 20xx **
- %% : a %
-*/
-char *
-CDDAFormatStr( const access_t *p_access, cdda_data_t *p_cdda,
- const char format_str[], const char *psz_mrl, track_t i_track)
-{
- VLC_UNUSED(p_access);
-#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;
- bool saw_control_prefix = false;
- size_t format_len = strlen(format_str);
-
- memset(temp_str, 0, TEMP_STR_SIZE);
-
- for (i=0; i<format_len; i++)
- {
- char *psz = NULL;
-
- if (!saw_control_prefix && format_str[i] != '%')
- {
- *tp++ = format_str[i];
- saw_control_prefix = false;
- continue;
- }
-
- switch(format_str[i])
- {
- case '%':
- if (saw_control_prefix)
- {
- *tp++ = '%';
- }
- saw_control_prefix = !saw_control_prefix;
- break;
-#ifdef HAVE_LIBCDDB
- case 'a':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_PERFORMER])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_PERFORMER];
- if (want_cddb_info(p_cdda, psz))
- psz = (char *)cddb_disc_get_artist(p_cdda->cddb.disc);
- goto format_str;
- case 'A':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_TITLE])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_TITLE];
- if (want_cddb_info(p_cdda, psz))
- psz = (char *)cddb_disc_get_title(p_cdda->cddb.disc);
- goto format_str;
- case 'C':
- if (!p_cdda->b_cddb_enabled) goto not_special;
- if (p_cdda->cddb.disc)
- add_format_str_info(CDDB_CATEGORY[cddb_disc_get_category(p_cdda->cddb.disc)]);
- break;
- case 'G':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_GENRE])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_GENRE];
- if (want_cddb_info(p_cdda, psz))
- psz = (char *)cddb_disc_get_genre(p_cdda->cddb.disc);
- goto format_str;
- case 'I':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_DISCID])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_DISCID];
- if (want_cddb_info(p_cdda, psz)) {
- add_format_num_info(cddb_disc_get_discid(p_cdda->cddb.disc), "%x");
- } else if (psz)
- add_format_str_info(psz);
- break;
- case 'Y':
- if (!p_cdda->b_cddb_enabled) goto not_special;
- if (p_cdda->cddb.disc)
- add_format_num_info(cddb_disc_get_year(p_cdda->cddb.disc),
- "%5d");
- break;
- case 't':
- if ( CDIO_INVALID_TRACK == i_track ) break;
- if (p_cdda && p_cdda->b_cddb_enabled && p_cdda->cddb.disc)
- {
- cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
- i_track-1);
- if (t != NULL && cddb_track_get_title(t) != NULL) {
- add_format_str_info(cddb_track_get_title(t));
- } else {
- add_format_str_info(psz_mrl);
- }
- }
- else
- {
- if (p_cdda->p_cdtext[i_track]
- && p_cdda->p_cdtext[i_track]->field[CDTEXT_TITLE])
- {
- add_format_str_info(p_cdda->p_cdtext[i_track]->field[CDTEXT_TITLE]);
- }
- else
- add_format_str_info(psz_mrl);
- }
- break;
- case 'p':
- if ( CDIO_INVALID_TRACK == i_track ) break;
- if (p_cdda->p_cdtext[i_track]
- && p_cdda->p_cdtext[i_track]->field[CDTEXT_PERFORMER])
- psz = p_cdda->p_cdtext[i_track]->field[CDTEXT_PERFORMER];
- if (want_cddb_info(p_cdda, psz))
- {
- cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
- i_track-1);
- if (t != NULL && cddb_track_get_artist(t) != NULL)
- psz = (char *)cddb_track_get_artist(t);
- }
- goto format_str;
- case 'e':
- if ( CDIO_INVALID_TRACK == i_track ) break;
- if (p_cdda->p_cdtext[i_track]
- && p_cdda->p_cdtext[i_track]->field[CDTEXT_MESSAGE])
- psz = p_cdda->p_cdtext[i_track]->field[CDTEXT_MESSAGE];
- if (want_cddb_info(p_cdda, psz))
- {
- cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
- i_track-1);
- if (t != NULL && cddb_track_get_ext_data(t) != NULL)
- psz = (char *)cddb_track_get_ext_data(t);
- }
- goto format_str;
- break;
-#else
- case 'a':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_PERFORMER])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_PERFORMER];
- goto format_str;
- case 'A':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_TITLE])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_TITLE];
- goto format_str;
- case 'G':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_GENRE])
- psz = p_cdda->p_cdtext[0]->field[CDTEXT_GENRE];
- goto format_str;
- case 'I':
- if (p_cdda->p_cdtext[0]
- && p_cdda->p_cdtext[0]->field[CDTEXT_DISCID])
- add_format_str_info(p_cdda->p_cdtext[0]->field[CDTEXT_DISCID]);
- break;
- case 'p':
- if ( CDIO_INVALID_TRACK == i_track ) break;
- if (p_cdda->p_cdtext[i_track]
- && p_cdda->p_cdtext[i_track]->field[CDTEXT_PERFORMER])
- psz = p_cdda->p_cdtext[i_track]->field[CDTEXT_PERFORMER];
- goto format_str;
- case 't':
- if ( CDIO_INVALID_TRACK == i_track ) break;
- if (p_cdda->p_cdtext[i_track]
- && p_cdda->p_cdtext[i_track]->field[CDTEXT_TITLE])
- psz = p_cdda->p_cdtext[i_track]->field[CDTEXT_TITLE];
- else
- psz = psz_mrl;
- goto format_str;
- case 'e':
- if ( CDIO_INVALID_TRACK == i_track ) break;
- if (p_cdda->p_cdtext[i_track]
- && p_cdda->p_cdtext[i_track]->field[CDTEXT_MESSAGE])
- psz = p_cdda->p_cdtext[i_track]->field[CDTEXT_MESSAGE];
- goto format_str;
- break;
-#endif /*HAVE_LIBCDDB*/
-
- case 's':
- if ( CDIO_INVALID_TRACK != i_track )
- {
- char psz_buffer[MSTRTIME_MAX_SIZE];
- unsigned int i_track_frames =
- cdio_get_track_sec_count(p_cdda->p_cdio, i_track);
- mtime_t i_duration =
- i_track_frames / CDIO_CD_FRAMES_PER_SEC;
- add_format_str_info( secstotimestr( psz_buffer,
- i_duration ) );
- break;
- }
-
- /* Fall through to disc duration if CDIO_INVALID_TRACK */
- case 'S':
- {
- char psz_buffer[MSTRTIME_MAX_SIZE];
- unsigned int i_track_frames =
- cdio_get_track_lba(p_cdda->p_cdio,
- CDIO_CDROM_LEADOUT_TRACK);
- mtime_t i_duration =
- i_track_frames / CDIO_CD_FRAMES_PER_SEC;
- add_format_str_info( secstotimestr( psz_buffer,
- i_duration ) );
- break;
- }
-
- case 'M':
- add_format_str_info(psz_mrl);
- break;
-
- case 'm':
- add_format_str_info(p_cdda->psz_mcn);
- break;
-
- case 'n':
- add_format_num_info(p_cdda->i_tracks, "%d");
- break;
-
- case 'T':
- add_format_num_info(i_track, "%02d");
- break;
- format_str:
- if (psz)
- add_format_str_info(psz);
- break;
-#ifdef HAVE_LIBCDDB
- not_special:
-#endif
- default:
- *tp++ = '%';
- *tp++ = format_str[i];
- saw_control_prefix = false;
- }
- }
- return strdup(temp_str);
-}
-
-/* Return a MRL for the given track. The caller must free the
- allocated string. */
-static char *
-CDDAFormatMRL( const access_t *p_access, track_t i_track )
-{
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- const unsigned int psz_mrl_max = strlen(CDDA_MRL_PREFIX)
- + strlen(p_cdda->psz_source) +
- + strlen("@T") + strlen("100") + 1;
- char *psz_mrl = calloc( 1, psz_mrl_max );
-
- if (CDIO_INVALID_TRACK == i_track)
- snprintf(psz_mrl, psz_mrl_max, "%s%s",
- CDDA_MRL_PREFIX, p_cdda->psz_source);
- else
- snprintf(psz_mrl, psz_mrl_max, "%s%s@T%u",
- CDDA_MRL_PREFIX, p_cdda->psz_source, i_track);
- return psz_mrl;
-}
-
-
-/* Return a title string as specified by the titel format string for the
- given track. The caller must free the allocated string. */
-char *
-CDDAFormatTitle( const access_t *p_access, track_t i_track )
-{
-
- const char *config_varname = MODULE_STRING "-title-format";
- cdda_data_t *p_cdda = (cdda_data_t *) p_access->p_sys;
- char *psz_mrl = CDDAFormatMRL( p_access, i_track );
-
- if( psz_mrl )
- {
- char *psz_name;
-#ifdef HAVE_LIBCDDB
- if (p_cdda->b_cddb_enabled)
- {
- config_varname = MODULE_STRING "-cddb-title-format";
- }
-#endif /*HAVE_LIBCDDB*/
- char* psz_config_varname = var_InheritString( p_access, config_varname );
- if( psz_config_varname )
- {
- psz_name = CDDAFormatStr( p_access, p_cdda, psz_config_varname,
- psz_mrl, i_track );
- free( psz_config_varname );
- }
- free( psz_mrl );
- return psz_name;
- }
- return NULL;
-}
-
-/*
- Fixes up playlist.
-*/
-int
-CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
- bool b_single_track )
-{
- int i;
- const track_t i_first_track = p_cdda->i_first_track;
- track_t i_track;
-
-#ifdef HAVE_LIBCDDB
- p_cdda->b_cddb_enabled =
- var_InheritInteger( p_access, MODULE_STRING "-cddb-enabled" );
- if( b_single_track && !p_cdda->b_cddb_enabled )
- return VLC_SUCCESS;
-#else
- if( b_single_track )
- return VLC_SUCCESS;
-#endif
-
- if( b_single_track || p_cdda->b_nav_mode ) {
- i_track = p_cdda->i_track;
- }
- else
- {
- i_track = CDIO_INVALID_TRACK;
- }
- CDDAMetaInfoInit( p_access );
- CDDAMetaInfo( p_access, p_cdda->i_track );
-
- if( b_single_track && !p_cdda->b_nav_mode )
- {
- /*May fill out more information when the playlist user interface becomes
- more mature.
- */
- track_t i_track = p_cdda->i_track;
- unsigned int i_track_frames =
- cdio_get_track_sec_count(p_cdda->p_cdio, i_track);
-
- input_title_t *t = p_cdda->p_title[0] = //i_track-i_first_track] =
- vlc_input_title_New();
-
- if( asprintf( &t->psz_name, _("Track %i"), i_track ) == -1 )
- t->psz_name = NULL;
- t->i_size = i_track_frames * (int64_t) CDIO_CD_FRAMESIZE_RAW;
- t->i_length = INT64_C(1000000) * t->i_size / CDDA_FREQUENCY_SAMPLE / 4;
-
- p_cdda->i_titles = 1;
- p_access->info.i_update = INPUT_UPDATE_TITLE;
- }
- else
- {
- input_thread_t *p_input = access_GetParentInput( p_access );
- if( !p_input )
- return VLC_EGENERIC;
-
- input_item_t *p_current = input_GetItem( p_input );
- assert( p_current );
-
- for( i = 0 ; i < p_cdda->i_tracks ; i++ )
- {
- const track_t i_track = i_first_track + i;
- unsigned int i_track_frames =
- cdio_get_track_sec_count(p_cdda->p_cdio, i_track);
- input_title_t *t;
-
- t = p_cdda->p_title[i] = vlc_input_title_New();
-
- if( asprintf( &t->psz_name, _("Track %i"), i_track ) == -1 )
- t->psz_name = NULL;
- t->i_size = i_track_frames * (int64_t) CDIO_CD_FRAMESIZE_RAW;
-
- t->i_length = INT64_C(1000000) * t->i_size
- / CDDA_FREQUENCY_SAMPLE / 4;
-
- if( !p_cdda->b_nav_mode )
- {
- input_item_t *p_child;
- char *psz_mrl = CDDAFormatMRL( p_access, i_track );
- char *psz_title = CDDAFormatTitle( p_access, i_track );
- unsigned int i_track_frames =
- cdio_get_track_lsn(p_cdda->p_cdio, i_track+1) -
- cdio_get_track_lsn(p_cdda->p_cdio, i_track);
- mtime_t i_mduration = i_track_frames * (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) ;
-
- p_child = input_item_NewWithType( VLC_OBJECT( p_access ),
- psz_mrl, psz_title, 0, NULL, 0, i_mduration,
- ITEM_TYPE_DISC );
- if( p_child )
- {
- input_item_CopyOptions( p_current, p_child );
-
- input_item_AddSubItem( p_current, p_child );
-
- vlc_gc_decref( p_child );
- }
- free( psz_mrl );
- free( psz_title );
- }
- }
-
- p_cdda->i_titles = p_cdda->i_tracks;
- p_access->info.i_update |= INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
- if( p_current )
- {
- input_item_SetDuration( p_current,
- (mtime_t) p_access->info.i_size * (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) );
- input_item_SetURI( p_current, CDDAFormatMRL( p_access, p_cdda->i_track ) );
- }
-
- vlc_object_release( p_input );
- }
-
- return VLC_SUCCESS;
-}
-
-
-/*
- * Local variables:
- * mode: C
- * style: gnu
- * End:
- */
+++ /dev/null
-/*****************************************************************************
- * info.h : CD digital audio input information routine headers
- *****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
- * $Id$
- *
- * Authors: Rocky Bernstein <rocky@panix.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
- * (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.
- *
- * 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.
- *****************************************************************************/
-
-/*
- Fills out playlist information.
- */
-int CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
- bool b_single_track );
-
-/*
- Sets CDDA Meta Information. In the Control routine,
- we handle Meta Information requests and basically copy what we've
- saved here.
- */
-void CDDAMetaInfo( access_t *p_access, track_t i_track );
-
-char *CDDAFormatTitle( const access_t *p_access, track_t i_track );
-
modules/access/bda/bdagraph.cpp
modules/access/bda/bdagraph.h
modules/access/cdda.c
-modules/access/cdda/access.c
-modules/access/cdda/access.h
-modules/access/cdda/callback.c
-modules/access/cdda/callback.h
-modules/access/cdda/cdda.c
-modules/access/cdda/cdda.h
-modules/access/cdda/info.c
-modules/access/cdda/info.h
modules/access/dc1394.c
modules/access/directory.c
modules/access/dshow/common.h