Commit 7b6d3391 authored by Rocky Bernstein's avatar Rocky Bernstein

configure.ac: reinstate libcdio CD-DA and VCD plugins (on demand)

cdda/*: add basic cd-paranoia mode via libcdio.
vcdx/*: changes dictated by new regime
 
parent 5db972ab
...@@ -1530,19 +1530,19 @@ AC_ARG_ENABLE(libcdio, ...@@ -1530,19 +1530,19 @@ AC_ARG_ENABLE(libcdio,
AC_ARG_ENABLE(libcddb, AC_ARG_ENABLE(libcddb,
[ --enable-libcddb CDDB support for CDDAX (default enabled)]) [ --enable-libcddb CDDB support for CDDAX (default enabled)])
dnl AC_ARG_ENABLE(vcdx, AC_ARG_ENABLE(vcdx,
dnl [ --enable-vcdx VCD support with Navigation (default enabled)]) [ --enable-vcdx VCD support with Navigation (default disabled)])
AC_ARG_ENABLE(cdda, AC_ARG_ENABLE(cdda,
[ --enable-cdda CDDA plugin support (default enabled)]) [ --enable-cdda CDDA plugin support (default enabled)])
AC_ARG_ENABLE(cddax, AC_ARG_ENABLE(cddax,
[ --enable-cddax CDDAX plugin support (default enabled)]) [ --enable-cddax CDDA plugin with CD Text and possibly CDDB and paranoia support (default disabled)])
if test "${enable_cddax}" != "no" if test "${enable_cddax}" = "yes"
then then
PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.71, PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.71,
[enable_cddax="no" [
AC_DEFINE(HAVE_CDDAX, [], [Define for the CD-DA plugin using libcdio]) AC_DEFINE(HAVE_CDDAX, [], [Define for the CD-DA plugin using libcdio])
VLC_ADD_LDFLAGS([cddax],[$LIBCDIO_LIBS]) VLC_ADD_LDFLAGS([cddax],[$LIBCDIO_LIBS])
VLC_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS]) VLC_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS])
...@@ -1550,6 +1550,10 @@ then ...@@ -1550,6 +1550,10 @@ then
[AC_MSG_WARN(libcdio library not found) [AC_MSG_WARN(libcdio library not found)
HAVE_CDDAX=no]) HAVE_CDDAX=no])
PKG_CHECK_MODULES(LIBCDIO_PARANOIA, libcdio_paranoia >= 0.72, [
VLC_ADD_LDFLAGS([cddax],[$LIBCDIO_CDDA_LIBS $LIBCDIO_PARANOIA_LIBS])],
HAVE_CDDAX=no)
if test "$enable_libcddb" != "no"; then if test "$enable_libcddb" != "no"; then
PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [ PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [
HAVE_LIBCDDB=yes HAVE_LIBCDDB=yes
...@@ -1561,18 +1565,24 @@ then ...@@ -1561,18 +1565,24 @@ then
HAVE_LIBCDDB=no]) HAVE_LIBCDDB=no])
fi fi
dnl if test "${enable_vcdx}" != "no" fi
dnl then
dnl PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.21, if test "${enable_vcdx}" = "yes"
dnl [enable_vcd="no" then
dnl AC_DEFINE(HAVE_VCDX, [], PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.71,
dnl [Define for the VCD plugin using libcdio/libvcdinfo]) [VLC_ADD_LDFLAGS([vcdx],[$LIBCDIO_LIBS])
dnl VLC_ADD_LDFLAGS([vcdx],[$VCDINFO_LIBS]) VLC_ADD_CFLAGS([vcdx],[$LIBCDIO_CFLAGS])],
dnl VLC_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS]) [AC_MSG_WARN(libcdio library not found)
dnl VLC_ADD_PLUGINS([vcdx])], HAVE_VCDX=no])
dnl [AC_MSG_WARN(vcdinfo library not found)
dnl HAVE_VCDX=no]) PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.21,
dnl fi [AC_DEFINE(HAVE_VCDX, [],
[Define for the VCD plugin using libcdio/libvcdinfo])
VLC_ADD_LDFLAGS([vcdx],[$VCDINFO_LIBS])
VLC_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS])
VLC_ADD_PLUGINS([vcdx])],
[AC_MSG_WARN(vcdinfo library not found)
HAVE_VCDX=no])
fi fi
dnl dnl
......
/***************************************************************************** /*****************************************************************************
* access.c : CD digital audio input module for vlc using libcdio * access.c : CD digital audio input module for vlc using libcdio
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2003, 2004 VideoLAN * Copyright (C) 2000, 2003, 2004, 2005 VideoLAN
* $Id$ * $Id$
* *
* Authors: Rocky Bernstein <rocky@panix.com> * Authors: Rocky Bernstein <rocky@panix.com>
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>
#include <cdio/cdda.h>
#include <stdio.h> #include <stdio.h>
...@@ -233,11 +234,46 @@ static block_t * CDDAReadBlocks( access_t * p_access ) ...@@ -233,11 +234,46 @@ static block_t * CDDAReadBlocks( access_t * p_access )
return NULL; return NULL;
} }
if( cdio_read_audio_sectors( p_cdda->p_cdio, p_block->p_buffer,
p_cdda->i_lsn, i_blocks) != 0 )
{ {
msg_Err( p_access, "could not read sector %lu", #if LIBCDIO_VERSION_NUM >= 72
(long unsigned int) p_cdda->i_lsn ); driver_return_code_t rc = DRIVER_OP_SUCCESS;
if ( p_cdda->b_paranoia_enabled )
{
int i;
for( i = 0; i < i_blocks; i++ )
{
int16_t *p_readbuf=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\n", psz_mes ? psz_mes: "",
psz_err ? psz_err: "" );
if (psz_err) free(psz_err);
if (psz_mes) free(psz_mes);
if( !p_readbuf ) {
msg_Err( p_access, "paranoia read error on frame %i\n",
p_cdda->i_lsn+i );
} else
memcpy(p_block + 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;
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 ); block_Release( p_block );
/* If we had problems above, assume the problem is with /* If we had problems above, assume the problem is with
...@@ -248,6 +284,7 @@ static block_t * CDDAReadBlocks( access_t * p_access ) ...@@ -248,6 +284,7 @@ static block_t * CDDAReadBlocks( access_t * p_access )
p_access->info.i_pos += CDIO_CD_FRAMESIZE_RAW; p_access->info.i_pos += CDIO_CD_FRAMESIZE_RAW;
return NULL; return NULL;
} }
}
p_cdda->i_lsn += i_blocks; p_cdda->i_lsn += i_blocks;
p_access->info.i_pos += p_block->i_buffer; p_access->info.i_pos += p_block->i_buffer;
...@@ -265,6 +302,11 @@ static int CDDASeek( access_t * p_access, int64_t i_pos ) ...@@ -265,6 +302,11 @@ static int CDDASeek( access_t * p_access, int64_t i_pos )
p_cdda->i_lsn = (i_pos / CDIO_CD_FRAMESIZE_RAW); p_cdda->i_lsn = (i_pos / CDIO_CD_FRAMESIZE_RAW);
#if LIBCDIO_VERSION_NUM >= 72
if ( p_cdda->b_paranoia_enabled )
cdio_paranoia_seek(p_cdda->paranoia, p_cdda->i_lsn, SEEK_SET);
#endif
if ( ! p_cdda->b_nav_mode ) if ( ! p_cdda->b_nav_mode )
p_cdda->i_lsn += cdio_get_track_lsn(p_cdda->p_cdio, p_cdda->i_track); p_cdda->i_lsn += cdio_get_track_lsn(p_cdda->p_cdio, p_cdda->i_track);
...@@ -309,7 +351,7 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -309,7 +351,7 @@ CDDAOpen( vlc_object_t *p_this )
access_t *p_access = (access_t*)p_this; access_t *p_access = (access_t*)p_this;
char * psz_source = NULL; char * psz_source = NULL;
cdda_data_t *p_cdda = NULL; cdda_data_t *p_cdda = NULL;
CdIo *p_cdio; CdIo_t *p_cdio;
track_t i_track = 1; track_t i_track = 1;
vlc_bool_t b_single_track = false; vlc_bool_t b_single_track = false;
int i_rc = VLC_EGENERIC; int i_rc = VLC_EGENERIC;
...@@ -382,14 +424,13 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -382,14 +424,13 @@ CDDAOpen( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_cdda = malloc( sizeof(cdda_data_t) ); p_cdda = calloc( 1, sizeof(cdda_data_t) );
if( p_cdda == NULL ) if( p_cdda == NULL )
{ {
msg_Err( p_access, "out of memory" ); msg_Err( p_access, "out of memory" );
free( psz_source ); free( psz_source );
return VLC_ENOMEM; return VLC_ENOMEM;
} }
memset( p_cdda, 0, sizeof(cdda_data_t) );
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
cddb_log_set_handler ( cddb_log_handler ); cddb_log_set_handler ( cddb_log_handler );
...@@ -458,6 +499,32 @@ CDDAOpen( vlc_object_t *p_this ) ...@@ -458,6 +499,32 @@ CDDAOpen( vlc_object_t *p_this )
CDDAFixupPlaylist( p_access, p_cdda, b_single_track ); CDDAFixupPlaylist( p_access, p_cdda, b_single_track );
#if LIBCDIO_VERSION_NUM >= 72
p_cdda->b_paranoia_enabled =
config_GetInt( p_access, MODULE_STRING "-paranoia-enabled" );
/* Use CD Paranoia? */
if ( p_cdda->b_paranoia_enabled ) {
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->b_paranoia_enabled = VLC_FALSE;
} 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 paranoia, but allow skipping sectors. */
cdio_paranoia_modeset(p_cdda->paranoia,
PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP);
}
}
#endif
/* Build a WAV header to put in front of the output data. /* Build a WAV header to put in front of the output data.
This gets sent back in the Block (read) routine. This gets sent back in the Block (read) routine.
*/ */
...@@ -515,19 +582,26 @@ CDDAClose (vlc_object_t *p_this ) ...@@ -515,19 +582,26 @@ CDDAClose (vlc_object_t *p_this )
vlc_input_title_Delete( p_cdda->p_title[i] ); vlc_input_title_Delete( p_cdda->p_title[i] );
} }
cdio_destroy( p_cdda->p_cdio );
cdio_log_set_handler (uninit_log_handler);
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
cddb_log_set_handler ((cddb_log_handler_t) uninit_log_handler); cddb_log_set_handler ((cddb_log_handler_t) uninit_log_handler);
if (p_cdda->b_cddb_enabled) if (p_cdda->b_cddb_enabled)
cddb_disc_destroy(p_cdda->cddb.disc); cddb_disc_destroy(p_cdda->cddb.disc);
#endif #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
if (p_cdda->psz_mcn) free( p_cdda->psz_mcn ); if (p_cdda->psz_mcn) free( p_cdda->psz_mcn );
if (p_cdda->psz_source) free( p_cdda->psz_source ); if (p_cdda->psz_source) free( p_cdda->psz_source );
free( p_cdda ); free( p_cdda );
p_cdda = NULL;
p_cdda_input = NULL; p_cdda_input = NULL;
} }
...@@ -624,7 +698,8 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) ...@@ -624,7 +698,8 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
*pi_int = p_cdda->i_titles; *pi_int = p_cdda->i_titles;
*ppp_title = malloc(sizeof( input_title_t **) * p_cdda->i_titles ); *ppp_title = calloc(1,
sizeof( input_title_t **) * p_cdda->i_titles );
if (!*ppp_title) return VLC_ENOMEM; if (!*ppp_title) return VLC_ENOMEM;
......
/***************************************************************************** /*****************************************************************************
* cdda.c : CD digital audio input module for vlc using libcdio * cdda.c : CD digital audio input module for vlc using libcdio
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2003, 2004 VideoLAN * Copyright (C) 2000, 2003, 2004, 2005 VideoLAN
* $Id$ * $Id$
* *
* Authors: Rocky Bernstein <rocky@panix.com> * Authors: Rocky Bernstein <rocky@panix.com>
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "callback.h" #include "callback.h"
#include "access.h" #include "access.h"
#include <cdio/version.h>
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -131,7 +132,7 @@ vlc_module_begin(); ...@@ -131,7 +132,7 @@ vlc_module_begin();
N_("Format to use in playlist \"title\" field when using CDDB"), N_("Format to use in playlist \"title\" field when using CDDB"),
CDDB_TITLE_FMT_LONGTEXT, VLC_TRUE ); CDDB_TITLE_FMT_LONGTEXT, VLC_TRUE );
add_bool( MODULE_STRING "-cddb-enabled", 1, CDDBEnabledCB, add_bool( MODULE_STRING "-cddb-enabled", VLC_TRUE, CDDBEnabledCB,
N_("Do CDDB lookups?"), N_("Do CDDB lookups?"),
N_("If set, lookup CD-DA track information using the CDDB " N_("If set, lookup CD-DA track information using the CDDB "
"protocol"), "protocol"),
...@@ -198,4 +199,14 @@ vlc_module_begin(); ...@@ -198,4 +199,14 @@ vlc_module_begin();
"a playlist entries"), "a playlist entries"),
VLC_FALSE ); VLC_FALSE );
#if LIBCDIO_VERSION_NUM >= 72
add_bool( MODULE_STRING "-paranoia-enabled",
// VLC_FALSE, NULL,
VLC_TRUE, NULL,
N_("Enable CD paranoia?"),
N_("If set, CD-DA reading will go through paranoia "
"jitter/error correction"),
VLC_FALSE );
#endif
vlc_module_end(); vlc_module_end();
...@@ -58,12 +58,18 @@ ...@@ -58,12 +58,18 @@
#define dbg_print(mask, s, args...) #define dbg_print(mask, s, args...)
#endif #endif
#if LIBCDIO_VERSION_NUM >= 72
#include <cdio/cdda.h>
#else
#define CdIo_t CdIo
#endif
/***************************************************************************** /*****************************************************************************
* cdda_data_t: CD audio information * cdda_data_t: CD audio information
*****************************************************************************/ *****************************************************************************/
typedef struct cdda_data_s typedef struct cdda_data_s
{ {
CdIo *p_cdio; /* libcdio CD device */ CdIo_t *p_cdio; /* libcdio CD device */
track_t i_tracks; /* # of tracks */ track_t i_tracks; /* # of tracks */
track_t i_first_track; /* # of first track */ track_t i_first_track; /* # of first track */
track_t i_titles; /* # of titles in playlist */ track_t i_titles; /* # of titles in playlist */
...@@ -82,6 +88,14 @@ typedef struct cdda_data_s ...@@ -82,6 +88,14 @@ typedef struct cdda_data_s
input_title_t *p_title[CDIO_CD_MAX_TRACKS]; /* This *is* 0 origin, not input_title_t *p_title[CDIO_CD_MAX_TRACKS]; /* This *is* 0 origin, not
track number origin */ track number origin */
#if LIBCDIO_VERSION_NUM >= 72
/* Paranoia support */
vlc_bool_t b_paranoia_enabled; /* 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 #ifdef HAVE_LIBCDDB
vlc_bool_t b_cddb_enabled; /* Use CDDB at all? */ vlc_bool_t b_cddb_enabled; /* Use CDDB at all? */
......
...@@ -57,7 +57,7 @@ GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda ) ...@@ -57,7 +57,7 @@ GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda )
{ {
int i, i_matches; int i, i_matches;
cddb_conn_t *conn = cddb_new(); cddb_conn_t *conn = cddb_new();
const CdIo *p_cdio = p_cdda->p_cdio; const CdIo_t *p_cdio = p_cdda->p_cdio;
dbg_print( (INPUT_DBG_CALL), "" ); dbg_print( (INPUT_DBG_CALL), "" );
...@@ -754,7 +754,7 @@ CDDAFormatMRL( const access_t *p_access, track_t i_track ) ...@@ -754,7 +754,7 @@ CDDAFormatMRL( const access_t *p_access, track_t i_track )
const unsigned int psz_mrl_max = strlen(CDDA_MRL_PREFIX) const unsigned int psz_mrl_max = strlen(CDDA_MRL_PREFIX)
+ strlen(p_cdda->psz_source) + + strlen(p_cdda->psz_source) +
+ strlen("@T") + strlen("100") + 1; + strlen("@T") + strlen("100") + 1;
char *psz_mrl = malloc( psz_mrl_max ); char *psz_mrl = calloc( 1, psz_mrl_max );
if (CDIO_INVALID_TRACK == i_track) if (CDIO_INVALID_TRACK == i_track)
snprintf(psz_mrl, psz_mrl_max, "%s%s", snprintf(psz_mrl, psz_mrl_max, "%s%s",
......
...@@ -238,8 +238,8 @@ VCDReadBlock( access_t * p_access ) ...@@ -238,8 +238,8 @@ VCDReadBlock( access_t * p_access )
if ( VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type ) if ( VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type )
{ {
unsigned int i_entry = p_vcdplayer->play_item.num+1; unsigned int i_entry = p_vcdplayer->play_item.num+1;
lsn_t i_lsn = vcdinfo_get_entry_lba(p_vcdplayer->vcd, i_entry); lsn_t i_lsn = vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i_entry);
if ( p_vcdplayer->i_lsn >= i_lsn && i_lsn != VCDINFO_NULL_LBA ) if ( p_vcdplayer->i_lsn >= i_lsn && i_lsn != VCDINFO_NULL_LSN )
{ {
const track_t i_track = p_vcdplayer->i_track; const track_t i_track = p_vcdplayer->i_track;
p_vcdplayer->play_item.num = i_entry; p_vcdplayer->play_item.num = i_entry;
...@@ -373,11 +373,11 @@ VCDEntryPoints( access_t * p_access ) ...@@ -373,11 +373,11 @@ VCDEntryPoints( access_t * p_access )
snprintf(psz_entry, sizeof(psz_entry), "%s%02d", _("Entry "), i ); snprintf(psz_entry, sizeof(psz_entry), "%s%02d", _("Entry "), i );
p_vcdplayer->p_entries[i] = vcdinfo_get_entry_lba(p_vcdplayer->vcd, i); p_vcdplayer->p_entries[i] = vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i);
s->psz_name = strdup(psz_entry); s->psz_name = strdup(psz_entry);
s->i_byte_offset = s->i_byte_offset =
(p_vcdplayer->p_entries[i] - vcdinfo_get_track_lba(p_vcdplayer->vcd, i_track)) (p_vcdplayer->p_entries[i] - vcdinfo_get_track_lsn(p_vcdplayer->vcd, i_track))
* M2F2_SECTOR_SIZE; * M2F2_SECTOR_SIZE;
dbg_print( INPUT_DBG_MRL, dbg_print( INPUT_DBG_MRL,
...@@ -779,7 +779,7 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev ) ...@@ -779,7 +779,7 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev )
p_vcdplayer->track[i].size = p_vcdplayer->track[i].size =
vcdinfo_get_track_sect_count(p_vcdobj, track_num); vcdinfo_get_track_sect_count(p_vcdobj, track_num);
p_vcdplayer->track[i].start_LSN = p_vcdplayer->track[i].start_LSN =
vcdinfo_get_track_lba(p_vcdobj, track_num); vcdinfo_get_track_lsn(p_vcdobj, track_num);
} }
} else } else
p_vcdplayer->track = NULL; p_vcdplayer->track = NULL;
...@@ -791,7 +791,7 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev ) ...@@ -791,7 +791,7 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev )
for (i=0; i<p_vcdplayer->i_entries; i++) { for (i=0; i<p_vcdplayer->i_entries; i++) {
p_vcdplayer->entry[i].size = p_vcdplayer->entry[i].size =
vcdinfo_get_entry_sect_count(p_vcdobj, i); vcdinfo_get_entry_sect_count(p_vcdobj, i);
p_vcdplayer->entry[i].start_LSN = vcdinfo_get_entry_lba(p_vcdobj, i); p_vcdplayer->entry[i].start_LSN = vcdinfo_get_entry_lsn(p_vcdobj, i);
} }
} else } else
p_vcdplayer->entry = NULL; p_vcdplayer->entry = NULL;
...@@ -1142,7 +1142,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args ) ...@@ -1142,7 +1142,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
itemid.type = VCDINFO_ITEM_TYPE_TRACK; itemid.type = VCDINFO_ITEM_TYPE_TRACK;
VCDSetOrigin(p_access, VCDSetOrigin(p_access,
vcdinfo_get_entry_lba(p_vcdplayer->vcd, i_entry), vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i_entry),
i_track, &itemid ); i_track, &itemid );
} }
break; break;
...@@ -1168,7 +1168,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args ) ...@@ -1168,7 +1168,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
{ {
p_vcdplayer->play_item.num = i; p_vcdplayer->play_item.num = i;
p_vcdplayer->play_item.type = VCDINFO_ITEM_TYPE_ENTRY; p_vcdplayer->play_item.type = VCDINFO_ITEM_TYPE_ENTRY;
lsn = vcdinfo_get_entry_lba(p_vcdplayer->vcd, i); lsn = vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i);
} else if ( i < p_vcdplayer->i_entries + p_vcdplayer->i_lids ) } else if ( i < p_vcdplayer->i_entries + p_vcdplayer->i_lids )
{ {
p_vcdplayer->play_item.num = i p_vcdplayer->play_item.num = i
...@@ -1184,7 +1184,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args ) ...@@ -1184,7 +1184,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
} }
VCDSetOrigin( p_access, VCDSetOrigin( p_access,
vcdinfo_get_entry_lba(p_vcdplayer->vcd, i), vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i),
i_track, &(p_vcdplayer->play_item) ); i_track, &(p_vcdplayer->play_item) );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -336,7 +336,7 @@ VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcdplayer, ...@@ -336,7 +336,7 @@ VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcdplayer,
case 'S': case 'S':
if ( VCDINFO_ITEM_TYPE_SEGMENT==itemid->type ) { if ( VCDINFO_ITEM_TYPE_SEGMENT==itemid->type ) {
char seg_type_str[10]; char seg_type_str[30];
sprintf(seg_type_str, " %s", sprintf(seg_type_str, " %s",
vcdinfo_video_type2str(p_vcdplayer->vcd, itemid->num)); vcdinfo_video_type2str(p_vcdplayer->vcd, itemid->num));
......
...@@ -170,14 +170,14 @@ _vcdplayer_set_track(access_t * p_access, track_t i_track) ...@@ -170,14 +170,14 @@ _vcdplayer_set_track(access_t * p_access, track_t i_track)
if (i_track < 1 || i_track > p_vcdplayer->i_tracks) if (i_track < 1 || i_track > p_vcdplayer->i_tracks)
return; return;
else { else {
vcdinfo_obj_t *p_obj = p_vcdplayer->vcd; const vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
vcdinfo_itemid_t itemid; vcdinfo_itemid_t itemid;
itemid.num = i_track; itemid.num = i_track;
itemid.type = VCDINFO_ITEM_TYPE_TRACK; itemid.type = VCDINFO_ITEM_TYPE_TRACK;
p_vcdplayer->in_still = 0; p_vcdplayer->in_still = 0;
VCDSetOrigin(p_access, vcdinfo_get_track_lsn(p_obj, i_track), VCDSetOrigin(p_access, vcdinfo_get_track_lsn(p_vcdinfo, i_track),
i_track, &itemid); i_track, &itemid);
dbg_print(INPUT_DBG_LSN, "LSN: %u", p_vcdplayer->i_lsn); dbg_print(INPUT_DBG_LSN, "LSN: %u", p_vcdplayer->i_lsn);
...@@ -192,9 +192,9 @@ _vcdplayer_set_entry(access_t * p_access, unsigned int num) ...@@ -192,9 +192,9 @@ _vcdplayer_set_entry(access_t * p_access, unsigned int num)
{ {
vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_access->p_sys; vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_access->p_sys;
vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd; vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
unsigned int num_entries = vcdinfo_get_num_entries(p_vcdinfo); const unsigned int i_entries = vcdinfo_get_num_entries(p_vcdinfo);
if (num >= num_entries) { if (num >= i_entries) {
LOG_ERR("%s %d", _("bad entry number"), num); LOG_ERR("%s %d", _("bad entry number"), num);
return; return;
} else { } else {
...@@ -202,9 +202,9 @@ _vcdplayer_set_entry(access_t * p_access, unsigned int num) ...@@ -202,9 +202,9 @@ _vcdplayer_set_entry(access_t * p_access, unsigned int num)
itemid.num = num; itemid.num = num;
itemid.type = VCDINFO_ITEM_TYPE_ENTRY; itemid.type = VCDINFO_ITEM_TYPE_ENTRY;
p_vcdplayer->in_still = 0; p_vcdplayer->i_still = 0;
VCDSetOrigin(p_access, vcdinfo_get_entry_lba(p_vcdinfo, num), VCDSetOrigin(p_access, vcdinfo_get_entry_lsn(p_vcdinfo, num),
vcdinfo_get_track(p_vcdinfo, num), &itemid); vcdinfo_get_track(p_vcdinfo, num), &itemid);
dbg_print(INPUT_DBG_LSN, "LSN: %u, track_end LSN: %u", dbg_print(INPUT_DBG_LSN, "LSN: %u, track_end LSN: %u",
...@@ -254,7 +254,7 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid) ...@@ -254,7 +254,7 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid)
dbg_print(INPUT_DBG_CALL, "called itemid.num: %d, itemid.type: %d", dbg_print(INPUT_DBG_CALL, "called itemid.num: %d, itemid.type: %d",
itemid.num, itemid.type); itemid.num, itemid.type);
p_vcdplayer->in_still = 0; p_vcdplayer->i_still = 0;
switch (itemid.type) { switch (itemid.type) {
case VCDINFO_ITEM_TYPE_SEGMENT: case VCDINFO_ITEM_TYPE_SEGMENT:
...@@ -276,10 +276,10 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid) ...@@ -276,10 +276,10 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid)
case VCDINFO_FILES_VIDEO_NTSC_STILL2: case VCDINFO_FILES_VIDEO_NTSC_STILL2:
case VCDINFO_FILES_VIDEO_PAL_STILL: case VCDINFO_FILES_VIDEO_PAL_STILL:
case VCDINFO_FILES_VIDEO_PAL_STILL2: case VCDINFO_FILES_VIDEO_PAL_STILL2:
p_vcdplayer->in_still = -5; p_vcdplayer->i_still = STILL_READING;
break; break;
default: default:
p_vcdplayer->in_still = 0; p_vcdplayer->i_still = 0;
} }
break; break;
...@@ -293,9 +293,9 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid) ...@@ -293,9 +293,9 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid)
case VCDINFO_ITEM_TYPE_ENTRY: case VCDINFO_ITEM_TYPE_ENTRY:
{ {
unsigned int num_entries = vcdinfo_get_num_entries(p_vcdinfo); unsigned int i_entries = vcdinfo_get_num_entries(p_vcdinfo);
dbg_print(INPUT_DBG_PBC, "entry %d", itemid.num); dbg_print(INPUT_DBG_PBC, "entry %d", itemid.num);
if (itemid.num >= num_entries) return false; if (itemid.num >= i_entries) return false;
_vcdplayer_set_entry(p_access, itemid.num); _vcdplayer_set_entry(p_access, itemid.num);
break; break;
} }
...@@ -344,7 +344,8 @@ vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track, ...@@ -344,7 +344,8 @@ vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track,
p_vcdplayer->end_lsn = p_vcdplayer->i_lsn + i_size; p_vcdplayer->end_lsn = p_vcdplayer->i_lsn + i_size;
p_vcdplayer->origin_lsn = p_vcdplayer->i_lsn; p_vcdplayer->origin_lsn = p_vcdplayer->i_lsn;
p_vcdplayer->i_track = i_track; p_vcdplayer->i_track = i_track;
p_vcdplayer->track_lsn = vcdinfo_get_track_lba(p_vcdplayer->vcd, i_track); p_vcdplayer->track_lsn = vcdinfo_get_track_lsn(p_vcdplayer->vcd,
i_track);
dbg_print((INPUT_DBG_CALL|INPUT_DBG_LSN), dbg_print((INPUT_DBG_CALL|INPUT_DBG_LSN),
"lsn %u, end LSN: %u item.num %d, item.type %d", "lsn %u, end LSN: %u item.num %d, item.type %d",
...@@ -406,12 +407,12 @@ vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid) ...@@ -406,12 +407,12 @@ vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid)
} else { } else {
/* PBC on - Itemid.num is LID. */ /* PBC on - Itemid.num is LID. */
vcdinfo_obj_t *obj = p_vcdplayer->vcd; vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
if (obj == NULL) return; if (p_vcdinfo == NULL) return;
p_vcdplayer->i_lid = itemid.num; p_vcdplayer->i_lid = itemid.num;
vcdinfo_lid_get_pxd(obj, &(p_vcdplayer->pxd), itemid.num); vcdinfo_lid_get_pxd(p_vcdinfo, &(p_vcdplayer->pxd), itemid.num);
switch (p_vcdplayer->pxd.descriptor_type) { switch (p_vcdplayer->pxd.descriptor_type) {
...@@ -477,7 +478,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) ...@@ -477,7 +478,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
return READ_BLOCK; return READ_BLOCK;
/* Set up for caller process wait time given. */ /* Set up for caller process wait time given. */
if (p_vcdplayer->in_still) { if (p_vcdplayer->i_still) {
*wait_time = vcdinf_get_wait_time(p_vcdplayer->pxd.pld); *wait_time = vcdinf_get_wait_time(p_vcdplayer->pxd.pld);
dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL), dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL),
"playlist wait time: %d", *wait_time); "playlist wait time: %d", *wait_time);
...@@ -504,7 +505,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) ...@@ -504,7 +505,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
p_vcdplayer->i_loop, max_loop); p_vcdplayer->i_loop, max_loop);
/* Set up for caller process wait time given. */ /* Set up for caller process wait time given. */
if (p_vcdplayer->in_still) { if (p_vcdplayer->i_still) {
*wait_time = vcdinf_get_timeout_time(p_vcdplayer->pxd.psd); *wait_time = vcdinf_get_timeout_time(p_vcdplayer->pxd.psd);
dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL), dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL),
"playlist wait_time: %d", *wait_time); "playlist wait_time: %d", *wait_time);
...@@ -516,8 +517,8 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) ...@@ -516,8 +517,8 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
if ( max_loop == 0 || p_vcdplayer->i_loop < max_loop ) { if ( max_loop == 0 || p_vcdplayer->i_loop < max_loop ) {
p_vcdplayer->i_loop++; p_vcdplayer->i_loop++;
if (p_vcdplayer->i_loop == 0x7f) p_vcdplayer->i_loop = 0; if (p_vcdplayer->i_loop == 0x7f) p_vcdplayer->i_loop = 0;
VCDSeek( p_access, 0 ); vcdplayer_play_single_item(p_access, p_vcdplayer->loop_item);
/* if (p_vcdplayer->in_still) p_vcdplayer->force_redisplay();*/ /* if (p_vcdplayer->i_still) p_vcdplayer->force_redisplay();*/
return READ_BLOCK; return READ_BLOCK;
} }
...@@ -547,7 +548,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) ...@@ -547,7 +548,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
rand_selection - bsn, rand_lid); rand_selection - bsn, rand_lid);
vcdplayer_play( p_access, itemid ); vcdplayer_play( p_access, itemid );
return READ_BLOCK; return READ_BLOCK;
} else if (p_vcdplayer->in_still) { } else if (p_vcdplayer->i_still) {
/* Hack: Just go back and do still again */ /* Hack: Just go back and do still again */
sleep(1); sleep(1);
return READ_STILL_FRAME; return READ_STILL_FRAME;
...@@ -627,7 +628,8 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf) ...@@ -627,7 +628,8 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf)
vcdsector_t vcd_sector; vcdsector_t vcd_sector;
do { do {
if (cdio_read_mode2_sector(p_img, &vcd_sector, p_vcdplayer->i_lsn, true)!=0) { if (cdio_read_mode2_sector(p_img, &vcd_sector,
p_vcdplayer->i_lsn, true)!=0) {
dbg_print(INPUT_DBG_LSN, "read error\n"); dbg_print(INPUT_DBG_LSN, "read error\n");
p_vcdplayer->i_lsn++; p_vcdplayer->i_lsn++;
return READ_ERROR; return READ_ERROR;
...@@ -635,7 +637,7 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf) ...@@ -635,7 +637,7 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf)
p_vcdplayer->i_lsn++; p_vcdplayer->i_lsn++;
if ( p_vcdplayer->i_lsn >= p_vcdplayer->end_lsn ) { if ( p_vcdplayer->i_lsn >= p_vcdplayer->end_lsn ) {
/* We've run off of the end of p_vcdplayer entry. Do we continue or stop? */ /* We've run off of the end of this entry. Do we continue or stop? */
dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC), dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC),
"end reached in reading, cur: %u, end: %u\n", "end reached in reading, cur: %u, end: %u\n",
p_vcdplayer->i_lsn, p_vcdplayer->end_lsn); p_vcdplayer->i_lsn, p_vcdplayer->end_lsn);
...@@ -945,7 +947,8 @@ vcdplayer_play_return( access_t * p_access ) ...@@ -945,7 +947,8 @@ vcdplayer_play_return( access_t * p_access )
/* PBC is not on. "Return" selection is min_entry if possible. */ /* PBC is not on. "Return" selection is min_entry if possible. */
p_vcdplayer->play_item.num = (VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type) p_vcdplayer->play_item.num =
(VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type)
? 0 : 1; ? 0 : 1;
} }
...@@ -955,3 +958,11 @@ vcdplayer_play_return( access_t * p_access ) ...@@ -955,3 +958,11 @@ vcdplayer_play_return( access_t * p_access )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
...@@ -58,7 +58,10 @@ ...@@ -58,7 +58,10 @@
General definitions and structures. General definitions and structures.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
#define VCDPLAYER_IN_STILL 65535 /* Value for indefinite wait period on a still frame */
#define STILL_INDEFINITE_WAIT 255
/* Value when we have yet to finish reading blocks of a frame. */
#define STILL_READING -5
typedef struct { typedef struct {
lsn_t start_LSN; /* LSN where play item starts */ lsn_t start_LSN; /* LSN where play item starts */
...@@ -151,7 +154,7 @@ typedef struct vcdplayer_input_s ...@@ -151,7 +154,7 @@ typedef struct vcdplayer_input_s
/* Probably gets moved into another structure...*/ /* Probably gets moved into another structure...*/
intf_thread_t *p_intf; intf_thread_t *p_intf;
int i_audio_nb; int i_audio_nb;
int i_still_time; int i_still;
bool b_end_of_cell; bool b_end_of_cell;
input_thread_t *p_input; input_thread_t *p_input;
demux_t *p_demux; demux_t *p_demux;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment