Commit c7cac1b2 authored by Rocky Bernstein's avatar Rocky Bernstein

Work on getting slider seeking working better.

parent 149e4ec2
This diff is collapsed.
......@@ -40,7 +40,7 @@ static inline void
MetaInfoAddStr(access_t *p_access, char *p_cat,
char *title, const char *str)
{
access_vcd_data_t *p_vcd = (access_vcd_data_t *) p_access->p_sys;
vcdplayer_t *p_vcd = (vcdplayer_t *) p_access->p_sys;
if ( str ) {
dbg_print( INPUT_DBG_META, "field: %s: %s", title, str);
input_Control( p_vcd->p_input, INPUT_ADD_INFO, p_cat, title, "%s", str);
......@@ -51,7 +51,7 @@ MetaInfoAddStr(access_t *p_access, char *p_cat,
static inline void
MetaInfoAddNum(access_t *p_access, char *psz_cat, char *title, int num)
{
access_vcd_data_t *p_vcd = (access_vcd_data_t *) p_access->p_sys;
vcdplayer_t *p_vcd = (vcdplayer_t *) p_access->p_sys;
dbg_print( INPUT_DBG_META, "field %s: %d", title, num);
input_Control( p_vcd->p_input, INPUT_ADD_INFO, psz_cat, title, "%d", num );
}
......@@ -65,7 +65,7 @@ MetaInfoAddNum(access_t *p_access, char *psz_cat, char *title, int num)
void
VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
{
access_vcd_data_t *p_vcd = (access_vcd_data_t *) p_access->p_sys;
vcdplayer_t *p_vcd = (vcdplayer_t *) p_access->p_sys;
unsigned int i_entries = vcdinfo_get_num_entries(p_vcd->vcd);
unsigned int last_entry = 0;
char *psz_cat;
......@@ -174,7 +174,7 @@ VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl )
%% : a %
*/
char *
VCDFormatStr(const access_t *p_access, access_vcd_data_t *p_vcd,
VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcd,
const char format_str[], const char *mrl,
const vcdinfo_itemid_t *itemid)
{
......@@ -312,7 +312,7 @@ VCDFormatStr(const access_t *p_access, access_vcd_data_t *p_vcd,
static void
VCDCreatePlayListItem(const access_t *p_access,
access_vcd_data_t *p_vcd,
vcdplayer_t *p_vcd,
playlist_t *p_playlist,
const vcdinfo_itemid_t *itemid,
char *psz_mrl, int psz_mrl_max,
......@@ -362,7 +362,7 @@ VCDCreatePlayListItem(const access_t *p_access,
}
int
VCDFixupPlayList( access_t *p_access, access_vcd_data_t *p_vcd,
VCDFixupPlayList( access_t *p_access, vcdplayer_t *p_vcd,
const char *psz_source, vcdinfo_itemid_t *itemid,
vlc_bool_t b_single_item )
{
......@@ -414,3 +414,27 @@ VCDFixupPlayList( access_t *p_access, access_vcd_data_t *p_vcd,
return 0;
}
void
VCDUpdateTitle( access_t *p_access )
{
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
unsigned int psz_mrl_max = strlen(VCD_MRL_PREFIX)
+ strlen(p_vcd->psz_source) + sizeof("@E999")+3;
char *psz_mrl = malloc( psz_mrl_max );
if( psz_mrl )
{
char *psz_name;
snprintf(psz_mrl, psz_mrl_max, "%s%s",
VCD_MRL_PREFIX, p_vcd->psz_source);
psz_name = VCDFormatStr( p_access, p_vcd,
config_GetPsz( p_access, MODULE_STRING
"-title-format" ),
psz_mrl, &(p_vcd->play_item) );
input_Control( p_vcd->p_input, INPUT_SET_NAME, psz_name );
free(psz_mrl);
}
}
......@@ -29,7 +29,7 @@
/*
Fills out playlist information.
*/
int VCDFixupPlayList( access_t *p_access, access_vcd_data_t *p_vcd,
int VCDFixupPlayList( access_t *p_access, vcdplayer_t *p_vcd,
const char *psz_source, vcdinfo_itemid_t *itemid,
vlc_bool_t b_single_track );
......@@ -39,8 +39,10 @@ int VCDFixupPlayList( access_t *p_access, access_vcd_data_t *p_vcd,
void VCDMetaInfo( access_t *p_access, /*const*/ char *psz_mrl );
char * VCDFormatStr(const access_t *p_access, access_vcd_data_t *p_vcd,
char * VCDFormatStr(const access_t *p_access, vcdplayer_t *p_vcd,
const char format_str[], const char *mrl,
const vcdinfo_itemid_t *itemid);
void VCDUpdateTitle( access_t *p_access );
#endif /* VCD_INFO_H */
......@@ -26,12 +26,12 @@
*****************************************************************************/
struct intf_sys_t
{
input_thread_t * p_input;
access_vcd_data_t * p_vcd;
input_thread_t *p_input;
vcdplayer_t *p_vcd;
vlc_bool_t b_still; /* True if we are in a still frame */
vlc_bool_t b_inf_still; /* True if still wait time is infinite */
mtime_t m_still_time; /* Time in microseconds remaining
vlc_bool_t b_still; /* True if we are in a still frame */
vlc_bool_t b_inf_still; /* True if still wait time is infinite */
mtime_t m_still_time; /* Time in microseconds remaining
to wait in still frame.
*/
#if FINISHED
......
......@@ -51,16 +51,45 @@
Return VLC_TRUE if playback control (PBC) is on
*/
vlc_bool_t
vcdplayer_pbc_is_on( const access_vcd_data_t *p_vcd )
vcdplayer_pbc_is_on( const vcdplayer_t *p_vcd )
{
return VCDINFO_INVALID_ENTRY != p_vcd->i_lid;
}
/* Given an itemid, return the size for the object (via information
previously stored when opening the vcd). */
static size_t
vcdplayer_get_item_size(access_t * p_access, vcdinfo_itemid_t itemid)
{
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
switch (itemid.type) {
case VCDINFO_ITEM_TYPE_ENTRY:
return p_vcd->entry[itemid.num].size;
break;
case VCDINFO_ITEM_TYPE_SEGMENT:
return p_vcd->segment[itemid.num].size;
break;
case VCDINFO_ITEM_TYPE_TRACK:
return p_vcd->track[itemid.num-1].size;
break;
case VCDINFO_ITEM_TYPE_LID:
/* Play list number (LID) */
return 0;
break;
case VCDINFO_ITEM_TYPE_NOTFOUND:
case VCDINFO_ITEM_TYPE_SPAREID2:
default:
LOG_ERR("%s %d\n", _("bad item type"), itemid.type);
return 0;
}
}
static void
vcdplayer_update_entry( access_t * p_access, uint16_t ofs,
uint16_t *entry, const char *label)
{
access_vcd_data_t * p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
if ( ofs == VCDINFO_INVALID_OFFSET ) {
*entry = VCDINFO_INVALID_ENTRY;
......@@ -84,7 +113,7 @@ vcdplayer_update_entry( access_t * p_access, uint16_t ofs,
vcdplayer_read_status_t
vcdplayer_non_pbc_nav ( access_t * p_access )
{
access_vcd_data_t * p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
/* Not in playback control. Do we advance automatically or stop? */
switch (p_vcd->play_item.type) {
......@@ -125,11 +154,125 @@ vcdplayer_non_pbc_nav ( access_t * p_access )
return READ_BLOCK;
}
#if FINISHED
/*!
Set reading to play an entire track.
*/
static void
_vcdplayer_set_track(access_t * p_access, track_t i_track)
{
vcdplayer_t *p_vcd = (vcdplayer_t *)p_access->p_sys;
if (i_track < 1 || i_track > p_vcd->i_tracks)
return;
else {
vcdinfo_obj_t *p_obj = p_vcd->vcd;
vcdinfo_itemid_t itemid;
itemid.num = i_track;
itemid.type = VCDINFO_ITEM_TYPE_TRACK;
p_vcd->in_still = 0;
p_vcd->i_lsn = vcdinfo_get_track_lsn(p_obj, i_track);
p_vcd->play_item = itemid;
p_vcd->i_track = i_track;
p_vcd->track_lsn = p_vcd->i_lsn;
vcdplayer_set_origin(p_access);
dbg_print(INPUT_DBG_LSN, "LSN: %u\n", p_vcd->i_lsn);
}
}
/*!
Set reading to play an entry
*/
static void
_vcdplayer_set_entry(access_t * p_access, unsigned int num)
{
vcdplayer_t *p_vcd = (vcdplayer_t *)p_access->p_sys;
vcdinfo_obj_t *p_obj = p_vcd->vcd;
unsigned int num_entries = vcdinfo_get_num_entries(p_obj);
if (num >= num_entries) {
LOG_ERR("%s %d\n", _("bad entry number"), num);
return;
} else {
vcdinfo_itemid_t itemid;
itemid.num = num;
itemid.type = VCDINFO_ITEM_TYPE_ENTRY;
p_vcd->in_still = 0;
p_vcd->i_lsn = vcdinfo_get_entry_lsn(p_obj, num);
p_vcd->play_item = itemid;
p_vcd->i_track = vcdinfo_get_track(p_obj, num);
p_vcd->track_lsn = vcdinfo_get_track_lsn(p_obj, p_vcd->i_track);
p_vcd->track_end_lsn = p_vcd->track_lsn +
p_vcd->track[p_vcd->i_track-1].size;
vcdplayer_set_origin(p_access);
dbg_print(INPUT_DBG_LSN, "LSN: %u, track_end LSN: %u\n",
p_vcd->i_lsn, p_vcd->track_end_lsn);
}
}
/*!
Set reading to play an segment (e.g. still frame)
*/
static void
_vcdplayer_set_segment(access_t * p_access, unsigned int num)
{
vcdplayer_t *p_vcd = (vcdplayer_t *)p_access->p_sys;
vcdinfo_obj_t *p_obj = p_vcd->vcd;
segnum_t num_segs = vcdinfo_get_num_segments(p_obj);
if (num >= num_segs) {
LOG_ERR("%s %d\n", _("bad segment number"), num);
return;
} else {
vcdinfo_itemid_t itemid;
p_vcd->i_lsn = vcdinfo_get_seg_lsn(p_obj, num);
p_vcd->i_track = 0;
if (VCDINFO_NULL_LSN==p_vcd->i_lsn) {
LOG_ERR("%s %d\n",
_("Error in getting current segment number"), num);
return;
}
itemid.num = num;
itemid.type = VCDINFO_ITEM_TYPE_SEGMENT;
p_vcd->play_item = itemid;
vcdplayer_set_origin(p_access);
dbg_print(INPUT_DBG_LSN, "LSN: %u\n", p_vcd->i_lsn);
}
}
#endif /* FINISHED */
/*
Set's start origin and size for subsequent seeks.
input: p_vcd->i_lsn, p_vcd->play_item
changed: p_vcd->origin_lsn, p_vcd->end_lsn
*/
void
vcdplayer_set_origin(access_t *p_access)
{
vcdplayer_t *p_vcd = (vcdplayer_t *)p_access->p_sys;
size_t i_size= vcdplayer_get_item_size(p_access, p_vcd->play_item);
p_vcd->end_lsn = p_vcd->i_lsn + i_size;
p_vcd->origin_lsn = p_vcd->i_lsn;
dbg_print((INPUT_DBG_CALL|INPUT_DBG_LSN), "end LSN: %u\n", p_vcd->end_lsn);
}
/* Handles PBC navigation when reaching the end of a play item. */
vcdplayer_read_status_t
vcdplayer_pbc_nav ( access_t * p_access )
{
access_vcd_data_t * p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
/* We are in playback control. */
vcdinfo_itemid_t itemid;
......@@ -265,7 +408,7 @@ vcdplayer_pbc_nav ( access_t * p_access )
vlc_bool_t
vcdplayer_inc_play_item( access_t *p_access )
{
access_vcd_data_t * p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
int noi;
......@@ -305,7 +448,7 @@ vcdplayer_inc_play_item( access_t *p_access )
vlc_bool_t
vcdplayer_play_default( access_t * p_access )
{
access_vcd_data_t *p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
vcdinfo_itemid_t itemid;
......@@ -379,9 +522,9 @@ vcdplayer_play_default( access_t * p_access )
vlc_bool_t
vcdplayer_play_next( access_t * p_access )
{
access_vcd_data_t *p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
vcdinfo_obj_t *obj;
vcdinfo_obj_t *p_obj;
vcdinfo_itemid_t itemid;
if (!p_vcd) return VLC_FALSE;
......@@ -389,13 +532,13 @@ vcdplayer_play_next( access_t * p_access )
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC),
"current: %d" , p_vcd->play_item.num);
obj = p_vcd->vcd;
p_obj = p_vcd->vcd;
itemid.type = p_vcd->play_item.type;
if (vcdplayer_pbc_is_on(p_vcd)) {
vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->i_lid);
vcdinfo_lid_get_pxd(p_obj, &(p_vcd->pxd), p_vcd->i_lid);
switch (p_vcd->pxd.descriptor_type) {
case PSD_TYPE_SELECTION_LIST:
......@@ -477,10 +620,9 @@ vcdplayer_play_next( access_t * p_access )
vlc_bool_t
vcdplayer_play_prev( access_t * p_access )
{
access_vcd_data_t *p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdinfo_obj_t *obj = p_vcd->vcd;
vcdinfo_itemid_t itemid;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
vcdinfo_obj_t *p_obj = p_vcd->vcd;
vcdinfo_itemid_t itemid;
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC),
"current: %d" , p_vcd->play_item.num);
......@@ -489,7 +631,7 @@ vcdplayer_play_prev( access_t * p_access )
if (vcdplayer_pbc_is_on(p_vcd)) {
vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->i_lid);
vcdinfo_lid_get_pxd(p_obj, &(p_vcd->pxd), p_vcd->i_lid);
switch (p_vcd->pxd.descriptor_type) {
case PSD_TYPE_SELECTION_LIST:
......@@ -543,10 +685,9 @@ vcdplayer_play_prev( access_t * p_access )
vlc_bool_t
vcdplayer_play_return( access_t * p_access )
{
access_vcd_data_t *p_vcd= (access_vcd_data_t *)p_access->p_sys;
vcdinfo_obj_t *obj = p_vcd->vcd;
vcdinfo_itemid_t itemid;
vcdplayer_t *p_vcd= (vcdplayer_t *)p_access->p_sys;
vcdinfo_obj_t *p_obj = p_vcd->vcd;
vcdinfo_itemid_t itemid;
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC),
"current: %d" , p_vcd->play_item.num);
......@@ -555,7 +696,7 @@ vcdplayer_play_return( access_t * p_access )
if (vcdplayer_pbc_is_on(p_vcd)) {
vcdinfo_lid_get_pxd(obj, &(p_vcd->pxd), p_vcd->i_lid);
vcdinfo_lid_get_pxd(p_obj, &(p_vcd->pxd), p_vcd->i_lid);
switch (p_vcd->pxd.descriptor_type) {
case PSD_TYPE_SELECTION_LIST:
......
......@@ -52,6 +52,17 @@
#define LOG_ERR(args...) msg_Err( p_access, args )
#define LOG_WARN(args...) msg_Warn( p_access, args )
/*------------------------------------------------------------------
General definitions and structures.
---------------------------------------------------------------------*/
#define VCDPLAYER_IN_STILL 65535
typedef struct {
lsn_t start_LSN; /* LSN where play item starts */
size_t size; /* size in sector units of play item. */
} vcdplayer_play_item_info_t;
/* vcdplayer_read return status */
typedef enum {
READ_BLOCK,
......@@ -61,7 +72,7 @@ typedef enum {
} vcdplayer_read_status_t;
/*****************************************************************************
* access_vcd_data_t: VCD information
* vcdplayer_t: VCD information
*****************************************************************************/
typedef struct thread_vcd_data_s
{
......@@ -70,8 +81,6 @@ typedef struct thread_vcd_data_s
/* Current State: position */
int i_debug; /* Debugging mask */
vlc_bool_t in_still; /* true if in still */
vcdinfo_itemid_t play_item; /* play-item, VCDPLAYER_BAD_ENTRY
if none */
int i_lid; /* LID that play item is in. Implies
PBC is on. VCDPLAYER_BAD_ENTRY if
not none or not in PBC */
......@@ -79,6 +88,8 @@ typedef struct thread_vcd_data_s
PSD/PLD */
int pdi; /* current pld index of pxd. -1 if
no index*/
vcdinfo_itemid_t play_item; /* play-item, VCDPLAYER_BAD_ENTRY
if none */
vcdinfo_itemid_t loop_item; /* Where do we loop back to?
Meaningful only in a selection
list */
......@@ -90,7 +101,10 @@ typedef struct thread_vcd_data_s
lsn_t end_lsn; /* LSN of end of current
entry/segment/track. */
lsn_t origin_lsn; /* LSN of start of seek/slider */
lsn_t track_lsn; /* LSN of start track origin of track
we are in. */
lsn_t track_end_lsn; /* LSN of end of current track (if
entry). */
lsn_t * p_entries; /* Entry points */
lsn_t * p_segments; /* Segments */
vlc_bool_t b_valid_ep; /* Valid entry points flag */
......@@ -109,6 +123,13 @@ typedef struct thread_vcd_data_s
unsigned int i_segments; /* # of segments */
unsigned int i_entries; /* # of entries */
unsigned int i_lids; /* # of List IDs */
/* Tracks, segment, and entry information. The number of entries for
each is given by the corresponding num_* field above. */
vcdplayer_play_item_info_t *track;
vcdplayer_play_item_info_t *segment;
vcdplayer_play_item_info_t *entry;
unsigned int i_titles; /* # of navigatable titles. */
input_title_t *p_title[CDIO_CD_MAX_TRACKS];
......@@ -120,7 +141,7 @@ typedef struct thread_vcd_data_s
vlc_bool_t b_end_of_cell;
input_thread_t *p_input;
} access_vcd_data_t;
} vcdplayer_t;
/*!
Get the next play-item in the list given in the LIDs. Note play-item
......@@ -133,7 +154,7 @@ vlc_bool_t vcdplayer_inc_play_item( access_t *p_access );
/*!
Return true if playback control (PBC) is on
*/
vlc_bool_t vcdplayer_pbc_is_on(const access_vcd_data_t *p_this);
vlc_bool_t vcdplayer_pbc_is_on(const vcdplayer_t *p_this);
/*!
Play item assocated with the "default" selection.
......@@ -164,6 +185,13 @@ vlc_bool_t vcdplayer_play_prev( access_t * p_access );
vlc_bool_t
vcdplayer_play_return( access_t * p_access );
/*
Set's start origin and size for subsequent seeks.
input: p_vcd->i_lsn, p_vcd->play_item
changed: p_vcd->origin_lsn, p_vcd->end_lsn
*/
void vcdplayer_set_origin(access_t * p_access);
vcdplayer_read_status_t vcdplayer_pbc_nav ( access_t * p_access );
vcdplayer_read_status_t vcdplayer_non_pbc_nav ( access_t * p_access );
......
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