Commit 6f0aba82 authored by JP Dinger's avatar JP Dinger

Clean up vcdx a bit. Or a lot. It compiles, but I can't test. Since apparently...

Clean up vcdx a bit. Or a lot. It compiles, but I can't test. Since apparently nobody uses this anyway it shouldn't be a big problem.
parent 4f050947
SOURCES_vcdx = \
access.h \
access.c \
intf.c \
intf.h \
vcd.c \
vcd.h \
vcdplayer.h \
......
......@@ -48,10 +48,7 @@
#include <libvcd/logging.h>
#include "vcd.h"
#include "info.h"
#include "intf.h"
extern void VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
const vcdinfo_itemid_t *p_itemid );
#include "access.h"
/*****************************************************************************
* Local prototypes
......@@ -1039,12 +1036,12 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
*/
case ACCESS_GET_META:
{
vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg( args, vlc_meta_t** );
dbg_print( INPUT_DBG_EVENT, "get meta info" );
#if 0
if( p_vcdplayer->p_meta )
{
vlc_meta_t **pp_meta = (vlc_meta_t**)va_arg(args,vlc_meta_t**);
*pp_meta = vlc_meta_Duplicate( p_vcdplayer->p_meta );
dbg_print( INPUT_DBG_META, "%s", "Meta copied" );
}
......
/*****************************************************************************
* intf.h: send info to intf.
* access.h : VCD access.c routine headers
*****************************************************************************
* Copyright (C) 2001 the VideoLAN team
* $Id$
*
* Author: Stéphane Borel <stef@via.ecp.fr>
* Copyright (C) 2004 the VideoLAN team
*
* 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
......@@ -16,37 +13,19 @@
* 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.
* 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.
*****************************************************************************/
#ifndef VCD_ACCESS_H
#define VCD_ACCESS_H
#include <vlc_common.h>
#include <vlc_input.h>
#include "vcdplayer.h"
void VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
const vcdinfo_itemid_t *p_itemid );
/*****************************************************************************
* intf_sys_t: description and status of interface
*****************************************************************************/
struct intf_sys_t
{
input_thread_t *p_input;
vcdplayer_t *p_vcdplayer;
int VCDOpen ( vlc_object_t * );
void VCDClose ( vlc_object_t * );
bool b_still; /* True if we are in a still frame */
bool b_infinite_still; /* True if still wait time is infinite */
mtime_t m_still_time; /* Time in microseconds remaining
to wait in still frame.
*/
#ifdef FINISHED
vcdplay_ctrl_t control;
#else
int control;
#endif
bool b_click, b_move, b_key_pressed;
vlc_mutex_t lock;
};
int vcdIntfStillTime( struct intf_thread_t * p_intf, uint8_t wait_time);
int vcdIntfResetStillTime( intf_thread_t *p_intf );
#endif /* VCD_ACCESS_H */
/*****************************************************************************
* demux.c: demux functions for dvdplay.
*****************************************************************************
* Copyright (C) 1998-2001 the VideoLAN team
* $Id$
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
* 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 <stddef.h>
#include <vlc_common.h>
#include <vlc_input.h>
#include <vlc_access.h>
#include <vlc_interface.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#include "vcd.h"
#include "vcdplayer.h"
#include "intf.h"
/* how many packets vcdx_Demux will read in each loop */
/* #define vcdplay_READ_ONCE 64 */
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Demux ( input_thread_t * );
/*****************************************************************************
* Private structure
*****************************************************************************/
struct demux_sys_t
{
vcd_data_t * p_vcd;
module_t * p_module;
mpeg_demux_t mpeg;
};
/*****************************************************************************
* VCDInit: initializes structures
*****************************************************************************/
int VCDInit ( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
vcd_data_t * p_vcd = (vcd_data_t *)p_input->p_sys;
demux_sys_t * p_demux;
printf("++++ VCDInit CALLED\n");
if( p_input->stream.i_method != INPUT_METHOD_VCD )
{
return VLC_EGENERIC;
}
p_demux = p_input->p_demux_data = malloc( sizeof(demux_sys_t ) );
if( p_demux == NULL )
{
return VLC_ENOMOD;
}
p_input->p_private = (void*)&p_demux->mpeg;
p_demux->p_module = module_need( p_input, "mpeg-system", NULL, false );
if( p_demux->p_module == NULL )
{
free( p_input->p_demux_data );
return VLC_ENOMOD;
}
p_input->p_demux_data->p_vcd = p_vcd;
p_input->pf_demux = Demux;
p_input->pf_demux_control = demux_vaControlDefault;
p_input->pf_rewind = NULL;
p_vcd->p_intf = NULL;
p_vcd->i_still_time = 0;
return VLC_SUCCESS;
}
/*****************************************************************************
* VCDEnd: frees unused data
*****************************************************************************/
void VCDEnd ( vlc_object_t *p_this )
{
input_thread_t *p_input = (input_thread_t *)p_this;
vcd_data_t * p_vcd = p_input->p_demux_data->p_vcd;
#if FIXED
intf_thread_t * p_intf = NULL;
p_intf = vlc_object_find( p_input, VLC_OBJECT_INTF, FIND_CHILD );
if( p_intf != NULL )
{
intf_StopThread( p_intf );
vlc_object_detach( p_intf );
vlc_object_release( p_intf );
vlc_object_release( p_intf );
}
p_vcd->p_intf = NULL;
#endif
module_unneed( p_input, p_input->p_demux_data->p_module );
free( p_input->p_demux_data );
}
/*****************************************************************************
* Demux
*****************************************************************************/
static int Demux( input_thread_t * p_input )
{
vcd_data_t * p_vcd;
data_packet_t * p_data;
ssize_t i_result;
ptrdiff_t i_remains;
int i_data_nb = 0;
p_vcd = p_input->p_demux_data->p_vcd;
/* Read headers to compute payload length */
do
{
i_result = p_input->p_demux_data->mpeg.pf_read_ps( p_input, &p_data );
if( i_result <= 0 )
{
return i_result;
}
i_remains = p_input->p_last_data - p_input->p_current_data;
p_input->p_demux_data->mpeg.pf_demux_ps( p_input, p_data );
++i_data_nb;
}
while( i_remains );
// if( p_vcd->b_still && p_vcd->b_end_of_cell && p_vcd->p_intf != NULL )
if( p_vcd->i_still_time && p_vcd->b_end_of_cell && p_vcd->p_intf != NULL )
{
pgrm_descriptor_t * p_pgrm;
/* when we receive still_time flag, we have to pause immediately */
var_SetInteger( p_input, "state", PAUSE_S );
vcdIntfStillTime( p_vcd->p_intf, p_vcd->i_still_time );
p_vcd->i_still_time = 0;
vlc_mutex_lock( &p_input->stream.stream_lock );
p_pgrm = p_input->stream.p_selected_program;
p_pgrm->i_synchro_state = SYNCHRO_REINIT;
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_ClockManageControl( p_input, p_pgrm, 0 );
}
return i_data_nb;
}
/*****************************************************************************
* intf.c: Video CD interface to handle user interaction and still time
*****************************************************************************
* Copyright (C) 2002,2003 the VideoLAN team
* $Id$
*
* Author: Rocky Bernstein <rocky@panix.com>
* from DVD code by Stéphane Borel <stef@via.ecp.fr>
*
* 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 <vlc_common.h>
#include <vlc_interface.h>
#include <vlc_access.h>
#include "vlc_keys.h"
#include "vcd.h"
#include "vcdplayer.h"
#include "intf.h"
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int InitThread ( intf_thread_t *p_intf );
static int KeyEvent ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/* Exported functions */
static void RunIntf ( intf_thread_t *p_intf );
/*****************************************************************************
* OpenIntf: initialize dummy interface
*****************************************************************************/
int VCDOpenIntf ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
msg_Dbg( p_intf, "VCDOpenIntf" );
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( VLC_EGENERIC );
};
vlc_mutex_init( &p_intf->p_sys->lock );
p_intf->pf_run = RunIntf;
var_AddCallback( p_intf->p_libvlc, "key-pressed", KeyEvent, p_intf );
p_intf->p_sys->m_still_time = 0;
p_intf->p_sys->b_infinite_still = 0;
p_intf->p_sys->b_still = 0;
return( VLC_SUCCESS );
}
/*****************************************************************************
* CloseIntf: destroy dummy interface
*****************************************************************************/
void VCDCloseIntf ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
var_DelCallback( p_intf->p_libvlc, "key-pressed", KeyEvent, p_intf );
/* Destroy structure */
vlc_mutex_destroy( &p_intf->p_sys->lock );
free( p_intf->p_sys );
}
/*****************************************************************************
* RunIntf: main loop
*****************************************************************************/
static void
RunIntf( intf_thread_t *p_intf )
{
vlc_object_t * p_vout = NULL;
mtime_t mtime = 0;
mtime_t mlast = 0;
vcdplayer_t * p_vcdplayer;
input_thread_t * p_input;
access_t * p_access;
/* What you add to the last input number entry. It accumulates all of
the 10_ADD keypresses */
int number_addend = 0;
int canc = vlc_savecancel();
if( InitThread( p_intf ) < 0 )
{
msg_Err( p_intf, "can't initialize intf" );
return;
}
p_input = p_intf->p_sys->p_input;
while ( !p_intf->p_sys->p_vcdplayer )
{
msleep( INTF_IDLE_SLEEP );
}
p_vcdplayer = p_intf->p_sys->p_vcdplayer;
p_access = p_vcdplayer->p_access;
canc = vlc_savecancel();
dbg_print( INPUT_DBG_CALL, "intf initialized" );
/* Main loop */
while( vlc_object_alive (p_intf) )
{
vlc_mutex_lock( &p_intf->p_sys->lock );
/*
* Have we timed-out in showing a still frame?
*/
if( p_intf->p_sys->b_still && !p_intf->p_sys->b_infinite_still )
{
if( p_intf->p_sys->m_still_time > 0 )
{
/* Update remaining still time */
dbg_print(INPUT_DBG_STILL, "updating still time");
mtime = mdate();
if( mlast )
{
p_intf->p_sys->m_still_time -= mtime - mlast;
}
mlast = mtime;
}
else
{
/* Still time has elapsed; set to continue playing. */
dbg_print(INPUT_DBG_STILL, "wait time done - setting play");
var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );
p_intf->p_sys->m_still_time = 0;
p_intf->p_sys->b_still = 0;
mlast = 0;
}
}
/*
* Do we have a keyboard event?
*/
if( p_vout && p_intf->p_sys->b_key_pressed )
{
vlc_value_t val;
int i, i_action = -1;
struct hotkey *p_hotkeys = p_intf->p_libvlc->p_hotkeys;
p_intf->p_sys->b_key_pressed = false;
/* Find action triggered by hotkey (if any) */
var_Get( p_intf->p_libvlc, "key-pressed", &val );
dbg_print( INPUT_DBG_EVENT, "Key pressed %d", val.i_int );
for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
{
if( p_hotkeys[i].i_key == val.i_int )
{
i_action = p_hotkeys[i].i_action;
}
}
if( i_action != -1) {
switch (i_action) {
case ACTIONID_NAV_LEFT:
dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_LEFT - prev (%d)",
number_addend );
do {
vcdplayer_play_prev( p_access );
} while (number_addend-- > 0);
break;
case ACTIONID_NAV_RIGHT:
dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_RIGHT - next (%d)",
number_addend );
do {
vcdplayer_play_next( p_access );
} while (number_addend-- > 0);
break;
case ACTIONID_NAV_UP:
dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_UP - return" );
do {
vcdplayer_play_return( p_access );
} while (number_addend-- > 0);
break;
case ACTIONID_NAV_DOWN:
dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_DOWN - default" );
vcdplayer_play_default( p_access );
break;
case ACTIONID_NAV_ACTIVATE:
{
vcdinfo_itemid_t itemid;
itemid.type=p_vcdplayer->play_item.type;
dbg_print( INPUT_DBG_EVENT, "ACTIONID_NAV_ACTIVATE" );
if ( vcdplayer_pbc_is_on( p_vcdplayer )
&& number_addend != 0 ) {
lid_t next_num=vcdinfo_selection_get_lid(p_vcdplayer->vcd,
p_vcdplayer->i_lid,
number_addend);
if (VCDINFO_INVALID_LID != next_num) {
itemid.num = next_num;
itemid.type = VCDINFO_ITEM_TYPE_LID;
vcdplayer_play( p_access, itemid );
}
} else {
itemid.num = number_addend;
vcdplayer_play( p_access, itemid );
}
break;
}
}
number_addend = 0;
/* Any keypress gets rid of still frame waiting.
FIXME - should handle just the ones that cause an action.
*/
if( p_intf->p_sys->b_still )
{
dbg_print(INPUT_DBG_STILL, "Playing still after activate");
var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );
p_intf->p_sys->b_still = 0;
p_intf->p_sys->b_infinite_still = 0;
p_intf->p_sys->m_still_time = 0;
}
} else {
unsigned int digit_entered=0;
switch (val.i_int) {
case '9':
digit_entered++;
case '8':
digit_entered++;
case '7':
digit_entered++;
case '6':
digit_entered++;
case '5':
digit_entered++;
case '4':
digit_entered++;
case '3':
digit_entered++;
case '2':
digit_entered++;
case '1':
digit_entered++;
case '0':
{
number_addend *= 10;
number_addend += digit_entered;
dbg_print( INPUT_DBG_EVENT,
"Added %d. Number is now: %d\n",
digit_entered, number_addend);
break;
}
}
}
}
vlc_mutex_unlock( &p_intf->p_sys->lock );
if( p_vout == NULL )
{
p_vout = vlc_object_find( p_intf->p_sys->p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
if( p_vout )
{
var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf );
}
}
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
}
if( p_vout )
{
var_DelCallback( p_vout, "key-pressed", KeyEvent, p_intf );
vlc_object_release( p_vout );
}
vlc_object_release( p_intf->p_sys->p_input );
vlc_restorecancel( canc );
}
/*****************************************************************************
* InitThread:
*****************************************************************************/
static int InitThread( intf_thread_t * p_intf )
{
/* We might need some locking here */
input_thread_t * p_input;
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_PARENT );
/* Maybe the input just died */
if( p_input == NULL )
return VLC_EGENERIC;
vlc_mutex_lock( &p_intf->p_sys->lock );
p_intf->p_sys->p_input = p_input;
p_intf->p_sys->p_vcdplayer = NULL;
p_intf->p_sys->b_move = false;
p_intf->p_sys->b_click = false;
p_intf->p_sys->b_key_pressed = false;
vlc_mutex_unlock( &p_intf->p_sys->lock );
/* make sure we return a value */
return 0;
}
/*****************************************************************************
* KeyEvent: callback for keyboard events
*****************************************************************************/
static int KeyEvent( vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
intf_thread_t *p_intf = (intf_thread_t *)p_data;
vlc_mutex_lock( &p_intf->p_sys->lock );
p_intf->p_sys->b_key_pressed = true;
vlc_mutex_unlock( &p_intf->p_sys->lock );
return VLC_SUCCESS;
}
/*****************************************************************************
* vcdIntfStillTime: function provided to demux plugin to request
* still images
*****************************************************************************/
int vcdIntfStillTime( intf_thread_t *p_intf, uint8_t i_sec )
{
vlc_mutex_lock( &p_intf->p_sys->lock );
p_intf->p_sys->b_still = 1;
if( 255 == i_sec )
{
p_intf->p_sys->b_infinite_still = true;
}
else
{
p_intf->p_sys->m_still_time = MILLISECONDS_PER_SEC * i_sec;
}
vlc_mutex_unlock( &p_intf->p_sys->lock );
return VLC_SUCCESS;
}
/*****************************************************************************
* vcdIntfStillTime: function provided to reset still image
*****************************************************************************/
int vcdIntfResetStillTime( intf_thread_t *p_intf )
{
vlc_mutex_lock( &p_intf->p_sys->lock );
p_intf->p_sys->m_still_time = 0;
var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );
vlc_mutex_unlock( &p_intf->p_sys->lock );
return VLC_SUCCESS;
}
......@@ -16,9 +16,9 @@
* 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.
* 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.
*****************************************************************************/
/*****************************************************************************
......@@ -37,23 +37,8 @@
#include <vlc_plugin.h>
#include <vlc_charset.h>
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
int VCDOpen ( vlc_object_t * );
void VCDClose ( vlc_object_t * );
int VCDOpenIntf ( vlc_object_t * );
void VCDCloseIntf ( vlc_object_t * );
int VCDInit ( vlc_object_t * );
void VCDEnd ( vlc_object_t * );
int DebugCallback ( vlc_object_t *p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val,
void *p_data );
int BlocksPerReadCallback ( vlc_object_t *p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val,
void *p_data );
#include "vcd.h"
#include "access.h"
/*****************************************************************************
* Option help text
......
......@@ -39,16 +39,12 @@
#include "vcd.h"
#include "vcdplayer.h"
#include "intf.h"
#include "access.h"
#include <cdio/cdio.h>
#include <cdio/util.h>
#include <libvcd/info.h>
extern void VCDSetOrigin ( access_t *p_access, lsn_t i_lsn, track_t i_track,
const vcdinfo_itemid_t * p_itemid );
/*!
Return true if playback control (PBC) is on
*/
......@@ -112,7 +108,7 @@ vcdplayer_update_entry( access_t * p_access, uint16_t ofs,
return true if the caller should return.
*/
vcdplayer_read_status_t
static vcdplayer_read_status_t
vcdplayer_non_pbc_nav ( access_t *p_access, uint8_t *wait_time )
{
vcdplayer_t *p_vcdplayer= (vcdplayer_t *)p_access->p_sys;
......@@ -122,9 +118,7 @@ vcdplayer_non_pbc_nav ( access_t *p_access, uint8_t *wait_time )
case VCDINFO_ITEM_TYPE_TRACK:
case VCDINFO_ITEM_TYPE_ENTRY: {
if ( ! vcdplayer_play_next( p_access ) )
{
return READ_END;
}
return READ_END;
break;
}
case VCDINFO_ITEM_TYPE_SPAREID2:
......@@ -338,8 +332,8 @@ vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track,
if( VCDINFO_NULL_LSN == i_lsn )
{
LOG_ERR("%s %d", "Invalid LSN for track", i_track);
return;
LOG_ERR("%s %d", "Invalid LSN for track", i_track);
return;
}
p_vcdplayer->play_item.num = p_itemid->num;
......@@ -368,36 +362,35 @@ vcdplayer_set_origin(access_t *p_access, lsn_t i_lsn, track_t i_track,
static bool
vcdplayer_inc_play_item(access_t *p_access)
{
vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_access->p_sys;
int noi;
dbg_print(INPUT_DBG_CALL, "called pli: %d", p_vcdplayer->pdi);
if ( NULL == p_vcdplayer || NULL == p_vcdplayer->pxd.pld ) return false;
if ( NULL == p_vcdplayer || NULL == p_vcdplayer->pxd.pld )
return false;
noi = vcdinf_pld_get_noi(p_vcdplayer->pxd.pld);
if ( noi <= 0 ) return false;
if ( noi <= 0 )
return false;
/* Handle delays like autowait or wait here? */
p_vcdplayer->pdi++;
if ( p_vcdplayer->pdi < 0 || p_vcdplayer->pdi >= noi ) return false;
if ( p_vcdplayer->pdi < 0 || p_vcdplayer->pdi >= noi )
return false;
else {
uint16_t trans_itemid_num=vcdinf_pld_get_play_item(p_vcdplayer->pxd.pld,
p_vcdplayer->pdi);
vcdinfo_itemid_t trans_itemid;
uint16_t trans_itemid_num=vcdinf_pld_get_play_item(p_vcdplayer->pxd.pld,
p_vcdplayer->pdi);
vcdinfo_itemid_t trans_itemid;
if (VCDINFO_INVALID_ITEMID == trans_itemid_num) return false;
if (VCDINFO_INVALID_ITEMID == trans_itemid_num) return false;
vcdinfo_classify_itemid(trans_itemid_num, &trans_itemid);
dbg_print(INPUT_DBG_PBC, " play-item[%d]: %s",
p_vcdplayer->pdi, vcdinfo_pin2str (trans_itemid_num));
return vcdplayer_play_single_item(p_access, trans_itemid);
}
vcdinfo_classify_itemid(trans_itemid_num, &trans_itemid);
dbg_print(INPUT_DBG_PBC, " play-item[%d]: %s",
p_vcdplayer->pdi, vcdinfo_pin2str (trans_itemid_num));
return vcdplayer_play_single_item(p_access, trans_itemid);
}
void
......@@ -415,7 +408,8 @@ vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid)
vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
if (p_vcdinfo == NULL) return;
if (p_vcdinfo == NULL)
return;
p_vcdplayer->i_lid = itemid.num;
vcdinfo_lid_get_pxd(p_vcdinfo, &(p_vcdplayer->pxd), itemid.num);
......@@ -453,7 +447,7 @@ vcdplayer_play(access_t *p_access, vcdinfo_itemid_t itemid)
}
/* Handles PBC navigation when reaching the end of a play item. */
vcdplayer_read_status_t
static vcdplayer_read_status_t
vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
{
vcdplayer_t *p_vcdplayer= (vcdplayer_t *)p_access->p_sys;
......@@ -512,10 +506,10 @@ vcdplayer_pbc_nav ( access_t * p_access, uint8_t *wait_time )
/* Set up for caller process wait time given. */
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);
return READ_STILL_FRAME;
*wait_time = vcdinf_get_timeout_time(p_vcdplayer->pxd.psd);
dbg_print((INPUT_DBG_PBC|INPUT_DBG_STILL),
"playlist wait_time: %d", *wait_time);
return READ_STILL_FRAME;
}
/* Wait time has been processed; continue with next entry. */
......@@ -592,7 +586,7 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf)
{
/* p_access->handle_events (); */
uint8_t wait_time;
uint8_t wait_time=0;
vcdplayer_t *p_vcdplayer= (vcdplayer_t *)p_access->p_sys;
if ( p_vcdplayer->i_lsn > p_vcdplayer->end_lsn ) {
......@@ -600,7 +594,8 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf)
/* 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, cur: %u, end: %u\n", p_vcdplayer->i_lsn, p_vcdplayer->end_lsn);
"end reached, cur: %u, end: %u\n",
p_vcdplayer->i_lsn, p_vcdplayer->end_lsn);
handle_item_continuation:
read_status = vcdplayer_pbc_is_on( p_vcdplayer )
......@@ -635,9 +630,9 @@ vcdplayer_read (access_t * p_access, uint8_t *p_buf)
do {
if (cdio_read_mode2_sector(p_img, &vcd_sector,
p_vcdplayer->i_lsn, true)!=0) {
p_vcdplayer->i_lsn, true)!=0) {
dbg_print(INPUT_DBG_LSN, "read error\n");
p_vcdplayer->i_lsn++;
p_vcdplayer->i_lsn++;
return READ_ERROR;
}
p_vcdplayer->i_lsn++;
......@@ -689,7 +684,7 @@ vcdplayer_play_default( access_t * p_access )
itemid.type = p_vcdplayer->play_item.type;
if (vcdplayer_pbc_is_on(p_vcdplayer)) {
if (vcdplayer_pbc_is_on(p_vcdplayer)) {
#if defined(LIBVCD_VERSION)
lid_t lid=vcdinfo_get_multi_default_lid(p_vcdplayer->vcd, p_vcdplayer->i_lid,
......@@ -705,16 +700,17 @@ vcdplayer_play_default( access_t * p_access )
}
#else
vcdinfo_lid_get_pxd(p_vcdplayer->vcd, &(p_vcdplayer->pxd), p_vcdplayer->i_lid);
vcdinfo_lid_get_pxd(p_vcdplayer->vcd, &(p_vcdplayer->pxd),
p_vcdplayer->i_lid);
switch (p_vcdplayer->pxd.descriptor_type) {
case PSD_TYPE_SELECTION_LIST:
case PSD_TYPE_EXT_SELECTION_LIST:
if (p_vcdplayer->pxd.psd == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinfo_get_default_offset(p_vcdplayer->vcd,
p_vcdplayer->i_lid),
&itemid.num, "default");
vcdplayer_update_entry(p_access,
vcdinfo_get_default_offset(p_vcdplayer->vcd,
p_vcdplayer->i_lid),
&itemid.num, "default");
break;
case PSD_TYPE_PLAY_LIST:
......@@ -771,17 +767,17 @@ vcdplayer_play_next( access_t * p_access )
case PSD_TYPE_SELECTION_LIST:
case PSD_TYPE_EXT_SELECTION_LIST:
if (p_vcdplayer->pxd.psd == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinf_psd_get_next_offset(p_vcdplayer->pxd.psd),
&itemid.num, "next");
vcdplayer_update_entry(p_access,
vcdinf_psd_get_next_offset(p_vcdplayer->pxd.psd),
&itemid.num, "next");
itemid.type = VCDINFO_ITEM_TYPE_LID;
break;
case PSD_TYPE_PLAY_LIST:
if (p_vcdplayer->pxd.pld == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinf_pld_get_next_offset(p_vcdplayer->pxd.pld),
&itemid.num, "next");
vcdplayer_update_entry(p_access,
vcdinf_pld_get_next_offset(p_vcdplayer->pxd.pld),
&itemid.num, "next");
itemid.type = VCDINFO_ITEM_TYPE_LID;
break;
......@@ -803,32 +799,30 @@ vcdplayer_play_next( access_t * p_access )
switch (p_vcdplayer->play_item.type) {
case VCDINFO_ITEM_TYPE_ENTRY:
max_entry = p_vcdplayer->i_entries;
break;
max_entry = p_vcdplayer->i_entries;
break;
case VCDINFO_ITEM_TYPE_SEGMENT:
max_entry = p_vcdplayer->i_segments;
break;
max_entry = p_vcdplayer->i_segments;
break;
case VCDINFO_ITEM_TYPE_TRACK:
max_entry = p_vcdplayer->i_tracks;
break;
max_entry = p_vcdplayer->i_tracks;
break;
default: ; /* Handle exceptional cases below */
}
if (p_vcdplayer->play_item.num+1 < max_entry) {
itemid.num = p_vcdplayer->play_item.num+1;
itemid.num = p_vcdplayer->play_item.num+1;
} else {
LOG_WARN( "At the end - non-PBC 'next' not possible here" );
return false;
LOG_WARN( "At the end - non-PBC 'next' not possible here" );
return false;
}
break;
case VCDINFO_ITEM_TYPE_LID:
{
/* Should have handled above. */
LOG_WARN( "Internal inconsistency - should not have gotten here." );
return false;
}
/* Should have handled above. */
LOG_WARN( "Internal inconsistency - should not have gotten here." );
return false;
default:
return false;
}
......@@ -857,7 +851,7 @@ vcdplayer_play_prev( access_t * p_access )
itemid = p_vcdplayer->play_item;
if (vcdplayer_pbc_is_on(p_vcdplayer)) {
if (vcdplayer_pbc_is_on(p_vcdplayer)) {
vcdinfo_lid_get_pxd(p_vcdinfo, &(p_vcdplayer->pxd), p_vcdplayer->i_lid);
......@@ -865,17 +859,17 @@ vcdplayer_play_prev( access_t * p_access )
case PSD_TYPE_SELECTION_LIST:
case PSD_TYPE_EXT_SELECTION_LIST:
if (p_vcdplayer->pxd.psd == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinf_psd_get_prev_offset(p_vcdplayer->pxd.psd),
&itemid.num, "prev");
vcdplayer_update_entry(p_access,
vcdinf_psd_get_prev_offset(p_vcdplayer->pxd.psd),
&itemid.num, "prev");
itemid.type = VCDINFO_ITEM_TYPE_LID;
break;
case PSD_TYPE_PLAY_LIST:
if (p_vcdplayer->pxd.pld == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinf_pld_get_prev_offset(p_vcdplayer->pxd.pld),
&itemid.num, "prev");
vcdplayer_update_entry(p_access,
vcdinf_pld_get_prev_offset(p_vcdplayer->pxd.pld),
&itemid.num, "prev");
itemid.type = VCDINFO_ITEM_TYPE_LID;
break;
......@@ -889,7 +883,7 @@ vcdplayer_play_prev( access_t * p_access )
/* PBC is not on. "Prev" selection is play_item.num-1 if possible. */
int min_entry = (VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type)
? 0 : 1;
? 0 : 1;
if (p_vcdplayer->play_item.num > min_entry) {
itemid.num = p_vcdplayer->play_item.num-1;
......@@ -919,11 +913,11 @@ vcdplayer_play_return( access_t * p_access )
vcdinfo_itemid_t itemid;
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC),
"current: %d" , p_vcdplayer->play_item.num);
"current: %d" , p_vcdplayer->play_item.num);
itemid = p_vcdplayer->play_item;
if (vcdplayer_pbc_is_on(p_vcdplayer)) {
if (vcdplayer_pbc_is_on(p_vcdplayer)) {
vcdinfo_lid_get_pxd(p_vcdinfo, &(p_vcdplayer->pxd), p_vcdplayer->i_lid);
......@@ -931,17 +925,17 @@ vcdplayer_play_return( access_t * p_access )
case PSD_TYPE_SELECTION_LIST:
case PSD_TYPE_EXT_SELECTION_LIST:
if (p_vcdplayer->pxd.psd == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinf_psd_get_return_offset(p_vcdplayer->pxd.psd),
&itemid.num, "return");
vcdplayer_update_entry(p_access,
vcdinf_psd_get_return_offset(p_vcdplayer->pxd.psd),
&itemid.num, "return");
itemid.type = VCDINFO_ITEM_TYPE_LID;
break;
case PSD_TYPE_PLAY_LIST:
if (p_vcdplayer->pxd.pld == NULL) return false;
vcdplayer_update_entry( p_access,
vcdinf_pld_get_return_offset(p_vcdplayer->pxd.pld),
&itemid.num, "return");
vcdplayer_update_entry(p_access,
vcdinf_pld_get_return_offset(p_vcdplayer->pxd.pld),
&itemid.num, "return");
itemid.type = VCDINFO_ITEM_TYPE_LID;
break;
......@@ -965,11 +959,3 @@ vcdplayer_play_return( access_t * p_access )
return VLC_SUCCESS;
}
/*
* Local variables:
* c-file-style: "gnu"
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
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