From 7b6d33911304c0a8171957062652ee94fa3a0cc2 Mon Sep 17 00:00:00 2001 From: Rocky Bernstein Date: Wed, 26 Jan 2005 13:05:14 +0000 Subject: [PATCH] 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 --- configure.ac | 44 +++++++----- modules/access/cdda/access.c | 121 ++++++++++++++++++++++++++------ modules/access/cdda/cdda.c | 15 +++- modules/access/cdda/cdda.h | 18 ++++- modules/access/cdda/info.c | 4 +- modules/access/vcdx/access.c | 18 ++--- modules/access/vcdx/info.c | 2 +- modules/access/vcdx/vcdplayer.c | 71 +++++++++++-------- modules/access/vcdx/vcdplayer.h | 7 +- 9 files changed, 212 insertions(+), 88 deletions(-) diff --git a/configure.ac b/configure.ac index baf7e86f8f..aa2c25d6f3 100644 --- a/configure.ac +++ b/configure.ac @@ -1530,19 +1530,19 @@ AC_ARG_ENABLE(libcdio, AC_ARG_ENABLE(libcddb, [ --enable-libcddb CDDB support for CDDAX (default enabled)]) -dnl AC_ARG_ENABLE(vcdx, -dnl [ --enable-vcdx VCD support with Navigation (default enabled)]) +AC_ARG_ENABLE(vcdx, + [ --enable-vcdx VCD support with Navigation (default disabled)]) AC_ARG_ENABLE(cdda, [ --enable-cdda CDDA plugin support (default enabled)]) 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 PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.71, - [enable_cddax="no" + [ AC_DEFINE(HAVE_CDDAX, [], [Define for the CD-DA plugin using libcdio]) VLC_ADD_LDFLAGS([cddax],[$LIBCDIO_LIBS]) VLC_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS]) @@ -1550,6 +1550,10 @@ then [AC_MSG_WARN(libcdio library not found) 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 PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.5, [ HAVE_LIBCDDB=yes @@ -1561,18 +1565,24 @@ then HAVE_LIBCDDB=no]) fi -dnl if test "${enable_vcdx}" != "no" -dnl then -dnl PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.21, -dnl [enable_vcd="no" -dnl AC_DEFINE(HAVE_VCDX, [], -dnl [Define for the VCD plugin using libcdio/libvcdinfo]) -dnl VLC_ADD_LDFLAGS([vcdx],[$VCDINFO_LIBS]) -dnl VLC_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS]) -dnl VLC_ADD_PLUGINS([vcdx])], -dnl [AC_MSG_WARN(vcdinfo library not found) -dnl HAVE_VCDX=no]) -dnl fi +fi + +if test "${enable_vcdx}" = "yes" +then + PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.71, + [VLC_ADD_LDFLAGS([vcdx],[$LIBCDIO_LIBS]) + VLC_ADD_CFLAGS([vcdx],[$LIBCDIO_CFLAGS])], + [AC_MSG_WARN(libcdio library not found) + HAVE_VCDX=no]) + + PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.21, + [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 dnl diff --git a/modules/access/cdda/access.c b/modules/access/cdda/access.c index 8357db927b..a8da73e78e 100644 --- a/modules/access/cdda/access.c +++ b/modules/access/cdda/access.c @@ -1,7 +1,7 @@ /***************************************************************************** * 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$ * * Authors: Rocky Bernstein @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -232,21 +233,57 @@ static block_t * CDDAReadBlocks( access_t * p_access ) i_blocks * CDIO_CD_FRAMESIZE_RAW ); 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", - (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; +#if LIBCDIO_VERSION_NUM >= 72 + 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 ); + + /* 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; @@ -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); +#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 ) 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 ) access_t *p_access = (access_t*)p_this; char * psz_source = NULL; cdda_data_t *p_cdda = NULL; - CdIo *p_cdio; + CdIo_t *p_cdio; track_t i_track = 1; vlc_bool_t b_single_track = false; int i_rc = VLC_EGENERIC; @@ -382,14 +424,13 @@ CDDAOpen( vlc_object_t *p_this ) return VLC_EGENERIC; } - p_cdda = malloc( sizeof(cdda_data_t) ); + p_cdda = calloc( 1, sizeof(cdda_data_t) ); if( p_cdda == NULL ) { msg_Err( p_access, "out of memory" ); free( psz_source ); return VLC_ENOMEM; } - memset( p_cdda, 0, sizeof(cdda_data_t) ); #ifdef HAVE_LIBCDDB cddb_log_set_handler ( cddb_log_handler ); @@ -458,6 +499,32 @@ CDDAOpen( vlc_object_t *p_this ) 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. This gets sent back in the Block (read) routine. */ @@ -515,19 +582,26 @@ CDDAClose (vlc_object_t *p_this ) 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 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 + if (p_cdda->psz_mcn) free( p_cdda->psz_mcn ); if (p_cdda->psz_source) free( p_cdda->psz_source ); free( p_cdda ); + p_cdda = NULL; p_cdda_input = NULL; } @@ -624,7 +698,8 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args ) return VLC_SUCCESS; } *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; diff --git a/modules/access/cdda/cdda.c b/modules/access/cdda/cdda.c index 10bc239e99..49851d1f75 100644 --- a/modules/access/cdda/cdda.c +++ b/modules/access/cdda/cdda.c @@ -1,7 +1,7 @@ /***************************************************************************** * 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$ * * Authors: Rocky Bernstein @@ -27,6 +27,7 @@ #include "callback.h" #include "access.h" +#include /***************************************************************************** * Module descriptor @@ -131,7 +132,7 @@ vlc_module_begin(); N_("Format to use in playlist \"title\" field when using CDDB"), 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_("If set, lookup CD-DA track information using the CDDB " "protocol"), @@ -198,4 +199,14 @@ vlc_module_begin(); "a playlist entries"), 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(); diff --git a/modules/access/cdda/cdda.h b/modules/access/cdda/cdda.h index 421253f6b5..0cdc958ce7 100644 --- a/modules/access/cdda/cdda.h +++ b/modules/access/cdda/cdda.h @@ -58,12 +58,18 @@ #define dbg_print(mask, s, args...) #endif +#if LIBCDIO_VERSION_NUM >= 72 +#include +#else +#define CdIo_t CdIo +#endif + /***************************************************************************** * cdda_data_t: CD audio information *****************************************************************************/ 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_first_track; /* # of first track */ track_t i_titles; /* # of titles in playlist */ @@ -81,7 +87,15 @@ typedef struct cdda_data_s 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 */ + 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 vlc_bool_t b_cddb_enabled; /* Use CDDB at all? */ diff --git a/modules/access/cdda/info.c b/modules/access/cdda/info.c index 4f4ba124f8..be214bc35e 100644 --- a/modules/access/cdda/info.c +++ b/modules/access/cdda/info.c @@ -57,7 +57,7 @@ GetCDDBInfo( access_t *p_access, cdda_data_t *p_cdda ) { int i, i_matches; 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), "" ); @@ -754,7 +754,7 @@ CDDAFormatMRL( const access_t *p_access, track_t i_track ) const unsigned int psz_mrl_max = strlen(CDDA_MRL_PREFIX) + strlen(p_cdda->psz_source) + + 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) snprintf(psz_mrl, psz_mrl_max, "%s%s", diff --git a/modules/access/vcdx/access.c b/modules/access/vcdx/access.c index 5c1dafad5b..ca12ffbdee 100644 --- a/modules/access/vcdx/access.c +++ b/modules/access/vcdx/access.c @@ -238,8 +238,8 @@ VCDReadBlock( access_t * p_access ) if ( VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type ) { unsigned int i_entry = p_vcdplayer->play_item.num+1; - lsn_t i_lsn = vcdinfo_get_entry_lba(p_vcdplayer->vcd, i_entry); - if ( p_vcdplayer->i_lsn >= i_lsn && i_lsn != VCDINFO_NULL_LBA ) + lsn_t i_lsn = vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i_entry); + if ( p_vcdplayer->i_lsn >= i_lsn && i_lsn != VCDINFO_NULL_LSN ) { const track_t i_track = p_vcdplayer->i_track; p_vcdplayer->play_item.num = i_entry; @@ -373,11 +373,11 @@ VCDEntryPoints( access_t * p_access ) 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->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; dbg_print( INPUT_DBG_MRL, @@ -779,7 +779,7 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev ) p_vcdplayer->track[i].size = vcdinfo_get_track_sect_count(p_vcdobj, track_num); p_vcdplayer->track[i].start_LSN = - vcdinfo_get_track_lba(p_vcdobj, track_num); + vcdinfo_get_track_lsn(p_vcdobj, track_num); } } else p_vcdplayer->track = NULL; @@ -791,7 +791,7 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev ) for (i=0; ii_entries; i++) { p_vcdplayer->entry[i].size = 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 p_vcdplayer->entry = NULL; @@ -1142,7 +1142,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args ) itemid.type = VCDINFO_ITEM_TYPE_TRACK; VCDSetOrigin(p_access, - vcdinfo_get_entry_lba(p_vcdplayer->vcd, i_entry), + vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i_entry), i_track, &itemid ); } break; @@ -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.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 ) { p_vcdplayer->play_item.num = i @@ -1184,7 +1184,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args ) } 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) ); } return VLC_SUCCESS; diff --git a/modules/access/vcdx/info.c b/modules/access/vcdx/info.c index 26fe058e46..aea381d8be 100644 --- a/modules/access/vcdx/info.c +++ b/modules/access/vcdx/info.c @@ -336,7 +336,7 @@ VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcdplayer, case 'S': if ( VCDINFO_ITEM_TYPE_SEGMENT==itemid->type ) { - char seg_type_str[10]; + char seg_type_str[30]; sprintf(seg_type_str, " %s", vcdinfo_video_type2str(p_vcdplayer->vcd, itemid->num)); diff --git a/modules/access/vcdx/vcdplayer.c b/modules/access/vcdx/vcdplayer.c index f5b77f19a4..a60d610edb 100644 --- a/modules/access/vcdx/vcdplayer.c +++ b/modules/access/vcdx/vcdplayer.c @@ -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) return; else { - vcdinfo_obj_t *p_obj = p_vcdplayer->vcd; + const vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd; vcdinfo_itemid_t itemid; itemid.num = i_track; itemid.type = VCDINFO_ITEM_TYPE_TRACK; 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); 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) { vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_access->p_sys; 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); return; } else { @@ -202,9 +202,9 @@ _vcdplayer_set_entry(access_t * p_access, unsigned int num) itemid.num = num; 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); 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) dbg_print(INPUT_DBG_CALL, "called itemid.num: %d, itemid.type: %d", itemid.num, itemid.type); - p_vcdplayer->in_still = 0; + p_vcdplayer->i_still = 0; switch (itemid.type) { case VCDINFO_ITEM_TYPE_SEGMENT: @@ -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_PAL_STILL: case VCDINFO_FILES_VIDEO_PAL_STILL2: - p_vcdplayer->in_still = -5; + p_vcdplayer->i_still = STILL_READING; break; default: - p_vcdplayer->in_still = 0; + p_vcdplayer->i_still = 0; } break; @@ -293,9 +293,9 @@ vcdplayer_play_single_item( access_t * p_access, vcdinfo_itemid_t itemid) 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); - if (itemid.num >= num_entries) return false; + if (itemid.num >= i_entries) return false; _vcdplayer_set_entry(p_access, itemid.num); break; } @@ -338,13 +338,14 @@ vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track, vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_access->p_sys; const size_t i_size= vcdplayer_get_item_size(p_access, *p_itemid); - p_vcdplayer->play_item.num = p_itemid->num; - p_vcdplayer->play_item.type = p_itemid->type; - p_vcdplayer->i_lsn = i_lsn; - p_vcdplayer->end_lsn = p_vcdplayer->i_lsn + i_size; - p_vcdplayer->origin_lsn = p_vcdplayer->i_lsn; - p_vcdplayer->i_track = i_track; - p_vcdplayer->track_lsn = vcdinfo_get_track_lba(p_vcdplayer->vcd, i_track); + p_vcdplayer->play_item.num = p_itemid->num; + p_vcdplayer->play_item.type = p_itemid->type; + p_vcdplayer->i_lsn = i_lsn; + p_vcdplayer->end_lsn = p_vcdplayer->i_lsn + i_size; + p_vcdplayer->origin_lsn = p_vcdplayer->i_lsn; + p_vcdplayer->i_track = i_track; + p_vcdplayer->track_lsn = vcdinfo_get_track_lsn(p_vcdplayer->vcd, + i_track); dbg_print((INPUT_DBG_CALL|INPUT_DBG_LSN), "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) } else { /* 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; - 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) { @@ -423,7 +424,7 @@ vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid) if (p_vcdplayer->pxd.psd == NULL) return; trans_itemid_num = vcdinf_psd_get_itemid(p_vcdplayer->pxd.psd); vcdinfo_classify_itemid(trans_itemid_num, &trans_itemid); - p_vcdplayer->i_loop = 1; + p_vcdplayer->i_loop = 1; p_vcdplayer->loop_item = trans_itemid; vcdplayer_play_single_item(p_access, trans_itemid); break; @@ -477,7 +478,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) return READ_BLOCK; /* 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); dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL), "playlist wait time: %d", *wait_time); @@ -504,7 +505,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) p_vcdplayer->i_loop, max_loop); /* 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); dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL), "playlist wait_time: %d", *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 ) { p_vcdplayer->i_loop++; if (p_vcdplayer->i_loop == 0x7f) p_vcdplayer->i_loop = 0; - VCDSeek( p_access, 0 ); - /* if (p_vcdplayer->in_still) p_vcdplayer->force_redisplay();*/ + vcdplayer_play_single_item(p_access, p_vcdplayer->loop_item); + /* if (p_vcdplayer->i_still) p_vcdplayer->force_redisplay();*/ return READ_BLOCK; } @@ -547,7 +548,7 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time ) rand_selection - bsn, rand_lid); vcdplayer_play( p_access, itemid ); return READ_BLOCK; - } else if (p_vcdplayer->in_still) { + } else if (p_vcdplayer->i_still) { /* Hack: Just go back and do still again */ sleep(1); return READ_STILL_FRAME; @@ -627,7 +628,8 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf) vcdsector_t vcd_sector; 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"); p_vcdplayer->i_lsn++; return READ_ERROR; @@ -635,7 +637,7 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf) p_vcdplayer->i_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), "end reached in reading, cur: %u, end: %u\n", p_vcdplayer->i_lsn, p_vcdplayer->end_lsn); @@ -945,7 +947,8 @@ vcdplayer_play_return( access_t * p_access ) /* 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; } @@ -955,3 +958,11 @@ vcdplayer_play_return( access_t * p_access ) return VLC_SUCCESS; } + +/* + * Local variables: + * c-file-style: "gnu" + * tab-width: 8 + * indent-tabs-mode: nil + * End: + */ diff --git a/modules/access/vcdx/vcdplayer.h b/modules/access/vcdx/vcdplayer.h index 50ef1aa8ff..8fb0b313f2 100644 --- a/modules/access/vcdx/vcdplayer.h +++ b/modules/access/vcdx/vcdplayer.h @@ -58,7 +58,10 @@ 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 { lsn_t start_LSN; /* LSN where play item starts */ @@ -151,7 +154,7 @@ typedef struct vcdplayer_input_s /* Probably gets moved into another structure...*/ intf_thread_t *p_intf; int i_audio_nb; - int i_still_time; + int i_still; bool b_end_of_cell; input_thread_t *p_input; demux_t *p_demux; -- 2.39.2