summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRocky Bernstein <rockyb@users.sourceforge.net>2004-12-29 09:23:56 +0000
committerRocky Bernstein <rockyb@users.sourceforge.net>2004-12-29 09:23:56 +0000
commitbd78271773a51d1f626d18db867ead8751c96376 (patch)
tree0d53cd348c42d1afb6ae405c1226094274ef0b9b /src
parent30336aacf67d08014b6b17e4a1a50eccc9a05a92 (diff)
downloadxine-lib-bd78271773a51d1f626d18db867ead8751c96376.tar.gz
xine-lib-bd78271773a51d1f626d18db867ead8751c96376.tar.bz2
title was truncated, increase max.
Variable name changes that I think make things clearer and more consistent. Working towards a better vcdplayer-independent code and handling still wait times more correctly/accurately. CVS patchset: 7308 CVS date: 2004/12/29 09:23:56
Diffstat (limited to 'src')
-rw-r--r--src/input/vcd/vcdio.c134
-rw-r--r--src/input/vcd/vcdio.h12
-rw-r--r--src/input/vcd/vcdplayer.c565
-rw-r--r--src/input/vcd/vcdplayer.h100
-rw-r--r--src/input/vcd/xineplug_inp_vcd.c110
5 files changed, 482 insertions, 439 deletions
diff --git a/src/input/vcd/vcdio.c b/src/input/vcd/vcdio.c
index 1cbb88e06..7c5722cdb 100644
--- a/src/input/vcd/vcdio.c
+++ b/src/input/vcd/vcdio.c
@@ -1,5 +1,5 @@
/*
- $Id: vcdio.c,v 1.3 2004/09/07 19:29:49 valtri Exp $
+ $Id: vcdio.c,v 1.4 2004/12/29 09:23:56 rockyb Exp $
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -57,25 +57,25 @@
#include "vcdplayer.h"
#include "vcdio.h"
-#define LOG_ERR(this, s, args...) \
- if (this != NULL && this->log_err != NULL) \
- this->log_err("%s: "s, __func__ , ##args)
+#define LOG_ERR(p_vcdplayer, s, args...) \
+ if (p_vcdplayer != NULL && p_vcdplayer->log_err != NULL) \
+ p_vcdplayer->log_err("%s: "s, __func__ , ##args)
#define FREE_AND_NULL(ptr) if (NULL != ptr) free(ptr); ptr = NULL;
/*! Closes VCD device specified via "this", and also wipes memory of it
from it inside "this". */
int
-vcdio_close(vcdplayer_input_t *this)
+vcdio_close(vcdplayer_t *p_vcdplayer)
{
- this->opened = false;
+ p_vcdplayer->opened = false;
- FREE_AND_NULL(this->current_vcd_device);
- FREE_AND_NULL(this->track);
- FREE_AND_NULL(this->segment);
- FREE_AND_NULL(this->entry);
+ FREE_AND_NULL(p_vcdplayer->psz_source);
+ FREE_AND_NULL(p_vcdplayer->track);
+ FREE_AND_NULL(p_vcdplayer->segment);
+ FREE_AND_NULL(p_vcdplayer->entry);
- return vcdinfo_close(this->vcd);
+ return vcdinfo_close(p_vcdplayer->vcd);
}
@@ -86,37 +86,37 @@ vcdio_close(vcdplayer_input_t *this)
to open new device.
*/
bool
-vcdio_open(vcdplayer_input_t *this, char *intended_vcd_device)
+vcdio_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device)
{
- vcdinfo_obj_t *obj = this->vcd;
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
unsigned int i;
dbg_print(INPUT_DBG_CALL, "called with %s\n", intended_vcd_device);
- if ( this->opened ) {
- if ( strcmp(intended_vcd_device, this->current_vcd_device)==0 ) {
+ if ( p_vcdplayer->opened ) {
+ if ( strcmp(intended_vcd_device, p_vcdplayer->psz_source)==0 ) {
/* Already open and the same device, so do nothing */
return true;
} else {
/* Changing VCD device */
- vcdio_close(this);
+ vcdio_close(p_vcdplayer);
}
}
- if ( vcdinfo_open(&this->vcd, &intended_vcd_device, DRIVER_UNKNOWN, NULL) !=
+ if ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, DRIVER_UNKNOWN, NULL) !=
VCDINFO_OPEN_VCD) {
return false;
}
- obj = this->vcd;
+ p_vcdinfo = p_vcdplayer->vcd;
- this->current_vcd_device=strdup(intended_vcd_device);
- this->opened = true;
- this->num_LIDs = vcdinfo_get_num_LIDs(obj);
+ p_vcdplayer->psz_source = strdup(intended_vcd_device);
+ p_vcdplayer->opened = true;
+ p_vcdplayer->i_lids = vcdinfo_get_num_LIDs(p_vcdinfo);
- if (vcdinfo_read_psd (obj)) {
+ if (vcdinfo_read_psd (p_vcdinfo)) {
- vcdinfo_visit_lot (obj, false);
+ vcdinfo_visit_lot (p_vcdinfo, false);
#if FIXED
/*
@@ -125,8 +125,8 @@ vcdio_open(vcdplayer_input_t *this, char *intended_vcd_device)
selection features in the extended PSD haven't been implemented,
it's best then to not try to read this at all.
*/
- if (vcdinfo_get_psd_x_size(obj))
- vcdinfo_visit_lot (obj, true);
+ if (vcdinfo_get_psd_x_size(p_vcdinfo))
+ vcdinfo_visit_lot (p_vcdinfo, true);
#endif
}
@@ -135,39 +135,45 @@ vcdio_open(vcdplayer_input_t *this, char *intended_vcd_device)
Save summary info on tracks, segments and entries...
*/
- if ( 0 < (this->num_tracks = vcdinfo_get_num_tracks(obj)) ) {
- this->track = (vcdplayer_play_item_info *)
- calloc(this->num_tracks, sizeof(vcdplayer_play_item_info));
+ if ( 0 < (p_vcdplayer->i_tracks = vcdinfo_get_num_tracks(p_vcdinfo)) ) {
+ p_vcdplayer->track = (vcdplayer_play_item_info_t *)
+ calloc(p_vcdplayer->i_tracks, sizeof(vcdplayer_play_item_info_t));
- for (i=0; i<this->num_tracks; i++) {
- unsigned int track_num=i+1;
- this->track[i].size = vcdinfo_get_track_sect_count(obj, track_num);
- this->track[i].start_LSN = vcdinfo_get_track_lsn(obj, track_num);
+ for (i=0; i<p_vcdplayer->i_tracks; i++) {
+ track_t i_track=i+1;
+ p_vcdplayer->track[i].size
+ = vcdinfo_get_track_sect_count(p_vcdinfo, i_track);
+ p_vcdplayer->track[i].start_LSN
+ = vcdinfo_get_track_lsn(p_vcdinfo, i_track);
}
} else
- this->track = NULL;
+ p_vcdplayer->track = NULL;
- if ( 0 < (this->num_entries = vcdinfo_get_num_entries(obj)) ) {
- this->entry = (vcdplayer_play_item_info *)
- calloc(this->num_entries, sizeof(vcdplayer_play_item_info));
+ if ( 0 < (p_vcdplayer->i_entries = vcdinfo_get_num_entries(p_vcdinfo)) ) {
+ p_vcdplayer->entry = (vcdplayer_play_item_info_t *)
+ calloc(p_vcdplayer->i_entries, sizeof(vcdplayer_play_item_info_t));
- for (i=0; i<this->num_entries; i++) {
- this->entry[i].size = vcdinfo_get_entry_sect_count(obj, i);
- this->entry[i].start_LSN = vcdinfo_get_entry_lsn(obj, i);
+ for (i=0; i<p_vcdplayer->i_entries; i++) {
+ p_vcdplayer->entry[i].size
+ = vcdinfo_get_entry_sect_count(p_vcdinfo, i);
+ p_vcdplayer->entry[i].start_LSN
+ = vcdinfo_get_entry_lsn(p_vcdinfo, i);
}
} else
- this->entry = NULL;
+ p_vcdplayer->entry = NULL;
- if ( 0 < (this->num_segments = vcdinfo_get_num_segments(obj)) ) {
- this->segment = (vcdplayer_play_item_info *)
- calloc(this->num_segments, sizeof(vcdplayer_play_item_info));
+ if ( 0 < (p_vcdplayer->i_segments = vcdinfo_get_num_segments(p_vcdinfo)) ) {
+ p_vcdplayer->segment = (vcdplayer_play_item_info_t *)
+ calloc(p_vcdplayer->i_segments, sizeof(vcdplayer_play_item_info_t));
- for (i=0; i<this->num_segments; i++) {
- this->segment[i].size = vcdinfo_get_seg_sector_count(obj, i);
- this->segment[i].start_LSN = vcdinfo_get_seg_lsn(obj, i);
+ for (i=0; i<p_vcdplayer->i_segments; i++) {
+ p_vcdplayer->segment[i].size
+ = vcdinfo_get_seg_sector_count(p_vcdinfo, i);
+ p_vcdplayer->segment[i].start_LSN
+ = vcdinfo_get_seg_lsn(p_vcdinfo, i);
}
} else
- this->segment = NULL;
+ p_vcdplayer->segment = NULL;
return true;
}
@@ -178,26 +184,26 @@ vcdio_open(vcdplayer_input_t *this, char *intended_vcd_device)
if seeking failed, -1 is returned
*/
off_t
-vcdio_seek (vcdplayer_input_t *this, off_t offset, int origin)
+vcdio_seek (vcdplayer_t *p_vcdplayer, off_t offset, int origin)
{
switch (origin) {
case SEEK_SET:
{
- lsn_t old_lsn = this->cur_lsn;
- this->cur_lsn = this->origin_lsn + (offset / M2F2_SECTOR_SIZE);
+ lsn_t old_lsn = p_vcdplayer->i_lsn;
+ p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn + (offset / M2F2_SECTOR_SIZE);
dbg_print(INPUT_DBG_SEEK_SET, "seek_set to %ld => %u (start is %u)\n",
- (long int) offset, this->cur_lsn, this->origin_lsn);
+ (long int) offset, p_vcdplayer->i_lsn, p_vcdplayer->origin_lsn);
/* Seek was successful. Invalidate entry location by setting
entry number back to 1. Over time it will adjust upward
to the correct value. */
- if ( !vcdplayer_pbc_is_on(this)
- && this->play_item.type != VCDINFO_ITEM_TYPE_TRACK
- && this->cur_lsn < old_lsn) {
+ if ( !vcdplayer_pbc_is_on(p_vcdplayer)
+ && p_vcdplayer->play_item.type != VCDINFO_ITEM_TYPE_TRACK
+ && p_vcdplayer->i_lsn < old_lsn) {
dbg_print(INPUT_DBG_SEEK_SET, "seek_set entry backwards\n");
- this->next_entry = 1;
+ p_vcdplayer->next_entry = 1;
}
break;
}
@@ -206,22 +212,22 @@ vcdio_seek (vcdplayer_input_t *this, off_t offset, int origin)
{
off_t diff;
if (offset) {
- LOG_ERR(this, "%s: %d\n",
- _("SEEK_CUR not implemented for nozero offset"),
+ LOG_ERR(p_vcdplayer, "%s: %d\n",
+ _("SEEK_CUR not implemented for non-zero offset"),
(int) offset);
return (off_t) -1;
}
- if (this->slider_length == VCDPLAYER_SLIDER_LENGTH_TRACK) {
- diff = this->cur_lsn - this->track_lsn;
+ if (p_vcdplayer->slider_length == VCDPLAYER_SLIDER_LENGTH_TRACK) {
+ diff = p_vcdplayer->i_lsn - p_vcdplayer->track_lsn;
dbg_print(INPUT_DBG_SEEK_CUR,
"current pos: %u, track diff %ld\n",
- this->cur_lsn, (long int) diff);
+ p_vcdplayer->i_lsn, (long int) diff);
} else {
- diff = this->cur_lsn - this->origin_lsn;
+ diff = p_vcdplayer->i_lsn - p_vcdplayer->origin_lsn;
dbg_print(INPUT_DBG_SEEK_CUR,
"current pos: %u, entry diff %ld\n",
- this->cur_lsn, (long int) diff);
+ p_vcdplayer->i_lsn, (long int) diff);
}
if (diff < 0) {
@@ -235,10 +241,10 @@ vcdio_seek (vcdplayer_input_t *this, off_t offset, int origin)
}
case SEEK_END:
- LOG_ERR(this, "%s\n", _("SEEK_END not implemented yet."));
+ LOG_ERR(p_vcdplayer, "%s\n", _("SEEK_END not implemented yet."));
return (off_t) -1;
default:
- LOG_ERR(this, "%s %d\n", _("seek not implemented yet for"),
+ LOG_ERR(p_vcdplayer, "%s %d\n", _("seek not implemented yet for"),
origin);
return (off_t) -1;
}
diff --git a/src/input/vcd/vcdio.h b/src/input/vcd/vcdio.h
index 98a236d42..e05bb2ed1 100644
--- a/src/input/vcd/vcdio.h
+++ b/src/input/vcd/vcdio.h
@@ -1,7 +1,7 @@
/*
- $Id: vcdio.h,v 1.1 2003/10/13 11:47:11 f1rmb Exp $
+ $Id: vcdio.h,v 1.2 2004/12/29 09:23:56 rockyb Exp $
- Copyright (C) 2002 Rocky Bernstein <rocky@panix.com>
+ Copyright (C) 2002, 2004 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
read nlen bytes, return number of bytes read.
*/
off_t
-vcdio_read (vcdplayer_input_t *this, char *buf, const off_t nlen);
+vcdio_read (vcdplayer_t *p_vcdplayer, char *psz_buf, const off_t nlen);
/*! Opens VCD device and initializes things.
@@ -37,13 +37,13 @@ vcdio_read (vcdplayer_input_t *this, char *buf, const off_t nlen);
to open new device.
*/
bool
-vcdio_open(vcdplayer_input_t *this, char *intended_vcd_device);
+vcdio_open(vcdplayer_t *p_vcdplayer, char *psz_device);
/*! Closes VCD device specified via "this", and also wipes memory of it
from it inside "this". */
/* FIXME Move player stuff to player. */
int
-vcdio_close(vcdplayer_input_t *this);
+vcdio_close(vcdplayer_t *p_vcdplayer);
/*!
From xine plugin spec:
@@ -53,7 +53,7 @@ vcdio_close(vcdplayer_input_t *this);
if seeking failed, -1 is returned
*/
off_t
-vcdio_seek (vcdplayer_input_t *this, off_t offset, int origin);
+vcdio_seek (vcdplayer_t *p_vcdplayer, off_t offset, int origin);
#endif /* _VCDIO_H_ */
diff --git a/src/input/vcd/vcdplayer.c b/src/input/vcd/vcdplayer.c
index 18c411afe..802c4e508 100644
--- a/src/input/vcd/vcdplayer.c
+++ b/src/input/vcd/vcdplayer.c
@@ -1,5 +1,5 @@
/*
- $Id: vcdplayer.c,v 1.6 2004/07/25 17:42:22 mroi Exp $
+ $Id: vcdplayer.c,v 1.7 2004/12/29 09:23:56 rockyb Exp $
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -46,37 +46,37 @@
#include "vcdplayer.h"
#include "vcdio.h"
-#define LOG_ERR(this, s, args...) \
- if (this != NULL && this->log_err != NULL) \
- this->log_err("%s: "s, __func__ , ##args)
+#define LOG_ERR(p_vcdplayer, s, args...) \
+ if (p_vcdplayer != NULL && p_vcdplayer->log_err != NULL) \
+ p_vcdplayer->log_err("%s: "s, __func__ , ##args)
unsigned long int vcdplayer_debug = 0;
-static void _vcdplayer_set_origin(vcdplayer_input_t *this);
+static void _vcdplayer_set_origin(vcdplayer_t *p_vcdplayer);
/*!
Return true if playback control (PBC) is on
*/
bool
-vcdplayer_pbc_is_on(const vcdplayer_input_t *this)
+vcdplayer_pbc_is_on(const vcdplayer_t *p_vcdplayer)
{
- return VCDINFO_INVALID_ENTRY != this->cur_lid;
+ return VCDINFO_INVALID_ENTRY != p_vcdplayer->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(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
+_vcdplayer_get_item_size(vcdplayer_t *p_vcdplayer, vcdinfo_itemid_t itemid)
{
switch (itemid.type) {
case VCDINFO_ITEM_TYPE_ENTRY:
- return this->entry[itemid.num].size;
+ return p_vcdplayer->entry[itemid.num].size;
break;
case VCDINFO_ITEM_TYPE_SEGMENT:
- return this->segment[itemid.num].size;
+ return p_vcdplayer->segment[itemid.num].size;
break;
case VCDINFO_ITEM_TYPE_TRACK:
- return this->track[itemid.num-1].size;
+ return p_vcdplayer->track[itemid.num-1].size;
break;
case VCDINFO_ITEM_TYPE_LID:
/* Play list number (LID) */
@@ -85,7 +85,7 @@ _vcdplayer_get_item_size(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
case VCDINFO_ITEM_TYPE_NOTFOUND:
case VCDINFO_ITEM_TYPE_SPAREID2:
default:
- LOG_ERR(this, "%s %d\n", _("bad item type"), itemid.type);
+ LOG_ERR(p_vcdplayer, "%s %d\n", _("bad item type"), itemid.type);
return 0;
}
}
@@ -139,7 +139,7 @@ _vcdplayer_get_item_size(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
%% : a %
*/
char *
-vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
+vcdplayer_format_str(vcdplayer_t *p_vcdplayer, const char format_str[])
{
#define TEMP_STR_SIZE 256
#define TEMP_STR_LEN (TEMP_STR_SIZE-1)
@@ -148,7 +148,7 @@ vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
char * tp = temp_str;
bool saw_control_prefix = false;
size_t format_len = strlen(format_str);
- vcdinfo_obj_t *obj = this->vcd;
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
memset(temp_str, 0, TEMP_STR_SIZE);
@@ -168,25 +168,25 @@ vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
saw_control_prefix = !saw_control_prefix;
break;
case 'A':
- add_format_str_info(vcdinfo_strip_trail(vcdinfo_get_album_id(obj),
+ add_format_str_info(vcdinfo_strip_trail(vcdinfo_get_album_id(p_vcdinfo),
MAX_ALBUM_LEN));
break;
case 'c':
- add_format_num_info(vcdinfo_get_volume_num(obj), "%d");
+ add_format_num_info(vcdinfo_get_volume_num(p_vcdinfo), "%d");
break;
case 'C':
- add_format_num_info(vcdinfo_get_volume_count(obj), "%d");
+ add_format_num_info(vcdinfo_get_volume_count(p_vcdinfo), "%d");
break;
case 'F':
- add_format_str_info(vcdinfo_get_format_version_str(obj));
+ add_format_str_info(vcdinfo_get_format_version_str(p_vcdinfo));
break;
case 'I':
{
- switch (this->play_item.type) {
+ switch (p_vcdplayer->play_item.type) {
case VCDINFO_ITEM_TYPE_TRACK:
strncat(tp, "Track", TEMP_STR_LEN-(tp-temp_str));
tp += strlen("Track");
@@ -216,9 +216,9 @@ vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
break;
case 'L':
- if (vcdplayer_pbc_is_on(this)) {
+ if (vcdplayer_pbc_is_on(p_vcdplayer)) {
char num_str[20];
- snprintf(num_str, sizeof(num_str), " List ID %d", this->cur_lid);
+ snprintf(num_str, sizeof(num_str), " List ID %d", p_vcdplayer->i_lid);
strncat(tp, num_str, TEMP_STR_LEN-(tp-temp_str));
tp += strlen(num_str);
}
@@ -226,23 +226,23 @@ vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
break;
case 'N':
- add_format_num_info(this->play_item.num, "%d");
+ add_format_num_info(p_vcdplayer->play_item.num, "%d");
break;
case 'p':
- add_format_str_info(vcdinfo_get_preparer_id(obj));
+ add_format_str_info(vcdinfo_get_preparer_id(p_vcdinfo));
break;
case 'P':
- add_format_str_info(vcdinfo_get_publisher_id(obj));
+ add_format_str_info(vcdinfo_get_publisher_id(p_vcdinfo));
break;
case 'S':
- if ( VCDINFO_ITEM_TYPE_SEGMENT==this->play_item.type ) {
- char seg_type_str[10];
+ if ( VCDINFO_ITEM_TYPE_SEGMENT==p_vcdplayer->play_item.type ) {
+ char seg_type_str[30];
snprintf(seg_type_str, sizeof(seg_type_str), " %s",
- vcdinfo_video_type2str(obj, this->play_item.num));
+ vcdinfo_video_type2str(p_vcdinfo, p_vcdplayer->play_item.num));
strncat(tp, seg_type_str, TEMP_STR_LEN-(tp-temp_str));
tp += strlen(seg_type_str);
}
@@ -250,15 +250,15 @@ vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
break;
case 'T':
- add_format_num_info(this->cur_track, "%d");
+ add_format_num_info(p_vcdplayer->i_track, "%d");
break;
case 'V':
- add_format_str_info(vcdinfo_get_volumeset_id(obj));
+ add_format_str_info(vcdinfo_get_volumeset_id(p_vcdinfo));
break;
case 'v':
- add_format_str_info(vcdinfo_get_volume_id(obj));
+ add_format_str_info(vcdinfo_get_volume_id(p_vcdinfo));
break;
default:
@@ -271,13 +271,13 @@ vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[])
}
static void
-_vcdplayer_update_entry(vcdinfo_obj_t *obj, uint16_t ofs, uint16_t *entry,
- const char *label)
+_vcdplayer_update_entry(vcdinfo_obj_t *p_vcdinfo, uint16_t ofs,
+ uint16_t *entry, const char *label)
{
if ( ofs == VCDINFO_INVALID_OFFSET ) {
*entry = VCDINFO_INVALID_ENTRY;
} else {
- vcdinfo_offset_t *off = vcdinfo_get_offset_t(obj, ofs);
+ vcdinfo_offset_t *off = vcdinfo_get_offset_t(p_vcdinfo, ofs);
if (off != NULL) {
*entry = off->lid;
dbg_print(INPUT_DBG_PBC, "%s: %d\n", label, off->lid);
@@ -287,107 +287,120 @@ _vcdplayer_update_entry(vcdinfo_obj_t *obj, uint16_t ofs, uint16_t *entry,
}
/*!
- Update next/prev/return/default navigation buttons (via this->cur_lid).
- Update size of play-item (via this->play_item).
+ Update next/prev/return/default navigation buttons
+ (via p_vcdplayer->i_lid). Update size of play-item
+ (via p_vcdplayer->play_item).
*/
void
-vcdplayer_update_nav(vcdplayer_input_t *this)
+vcdplayer_update_nav(vcdplayer_t *p_vcdplayer)
{
- int play_item = this->play_item.num;
- vcdinfo_obj_t *obj = this->vcd;
+ int play_item = p_vcdplayer->play_item.num;
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
int min_entry = 1;
int max_entry = 0;
- if (vcdplayer_pbc_is_on(this)) {
+ if (vcdplayer_pbc_is_on(p_vcdplayer)) {
- vcdinfo_lid_get_pxd(obj, &(this->pxd), this->cur_lid);
+ vcdinfo_lid_get_pxd(p_vcdinfo, &(p_vcdplayer->pxd), p_vcdplayer->i_lid);
- switch (this->pxd.descriptor_type) {
+ switch (p_vcdplayer->pxd.descriptor_type) {
case PSD_TYPE_SELECTION_LIST:
case PSD_TYPE_EXT_SELECTION_LIST:
- if (this->pxd.psd == NULL) return;
- _vcdplayer_update_entry(obj, vcdinf_psd_get_prev_offset(this->pxd.psd),
- &(this->prev_entry), "prev");
+ if (p_vcdplayer->pxd.psd == NULL) return;
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinf_psd_get_prev_offset(p_vcdplayer->pxd.psd),
+ &(p_vcdplayer->prev_entry), "prev");
- _vcdplayer_update_entry(obj, vcdinf_psd_get_next_offset(this->pxd.psd),
- &(this->next_entry), "next");
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinf_psd_get_next_offset(p_vcdplayer->pxd.psd),
+ &(p_vcdplayer->next_entry), "next");
- _vcdplayer_update_entry(obj, vcdinf_psd_get_return_offset(this->pxd.psd),
- &(this->return_entry), "return");
-
- _vcdplayer_update_entry(obj,
- vcdinfo_get_default_offset(obj, this->cur_lid),
- &(this->default_entry), "default");
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinf_psd_get_return_offset(p_vcdplayer->pxd.psd),
+ &(p_vcdplayer->return_entry), "return");
+
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinfo_get_default_offset(p_vcdinfo,
+ p_vcdplayer->i_lid),
+ &(p_vcdplayer->default_entry), "default");
break;
case PSD_TYPE_PLAY_LIST:
- if (this->pxd.pld == NULL) return;
- _vcdplayer_update_entry(obj, vcdinf_pld_get_prev_offset(this->pxd.pld),
- &(this->prev_entry), "prev");
+ if (p_vcdplayer->pxd.pld == NULL) return;
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinf_pld_get_prev_offset(p_vcdplayer->pxd.pld),
+ &(p_vcdplayer->prev_entry), "prev");
- _vcdplayer_update_entry(obj, vcdinf_pld_get_next_offset(this->pxd.pld),
- &(this->next_entry), "next");
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinf_pld_get_next_offset(p_vcdplayer->pxd.pld),
+ &(p_vcdplayer->next_entry), "next");
- _vcdplayer_update_entry(obj, vcdinf_pld_get_return_offset(this->pxd.pld),
- &(this->return_entry), "return");
- this->default_entry = VCDINFO_INVALID_ENTRY;
+ _vcdplayer_update_entry(p_vcdinfo,
+ vcdinf_pld_get_return_offset(p_vcdplayer->pxd.pld),
+ &(p_vcdplayer->return_entry), "return");
+ p_vcdplayer->default_entry = VCDINFO_INVALID_ENTRY;
break;
case PSD_TYPE_END_LIST:
- this->origin_lsn = this->cur_lsn = this->end_lsn = VCDINFO_NULL_LSN;
+ p_vcdplayer->origin_lsn = p_vcdplayer->i_lsn = p_vcdplayer->end_lsn
+ = VCDINFO_NULL_LSN;
/* Fall through */
case PSD_TYPE_COMMAND_LIST:
- this->next_entry = this->prev_entry = this->return_entry =
- this->default_entry = VCDINFO_INVALID_ENTRY;
+ p_vcdplayer->next_entry = p_vcdplayer->prev_entry
+ = p_vcdplayer->return_entry = VCDINFO_INVALID_ENTRY;
+ p_vcdplayer->default_entry = VCDINFO_INVALID_ENTRY;
break;
}
-
- this->update_title();
+
+ if (p_vcdplayer->update_title)
+ p_vcdplayer->update_title();
return;
}
/* PBC is not on. Set up for simplified next, prev, and return. */
- switch (this->play_item.type) {
+ switch (p_vcdplayer->play_item.type) {
case VCDINFO_ITEM_TYPE_ENTRY:
case VCDINFO_ITEM_TYPE_SEGMENT:
case VCDINFO_ITEM_TYPE_TRACK:
- switch (this->play_item.type) {
+ switch (p_vcdplayer->play_item.type) {
case VCDINFO_ITEM_TYPE_ENTRY:
- max_entry = this->num_entries;
+ max_entry = p_vcdplayer->i_entries;
min_entry = 0; /* Can remove when Entries start at 1. */
- this->cur_track = vcdinfo_get_track(obj, play_item);
- this->track_lsn = vcdinfo_get_track_lsn(obj, this->cur_track);
+ p_vcdplayer->i_track = vcdinfo_get_track(p_vcdinfo, play_item);
+ p_vcdplayer->track_lsn = vcdinfo_get_track_lsn(p_vcdinfo,
+ p_vcdplayer->i_track);
break;
case VCDINFO_ITEM_TYPE_SEGMENT:
- max_entry = this->num_segments;
- this->cur_track = VCDINFO_INVALID_TRACK;
+ max_entry = p_vcdplayer->i_segments;
+ p_vcdplayer->i_track = VCDINFO_INVALID_TRACK;
break;
case VCDINFO_ITEM_TYPE_TRACK:
- max_entry = this->num_tracks;
- this->cur_track = this->play_item.num;
- this->track_lsn = vcdinfo_get_track_lsn(obj, this->cur_track);
+ max_entry = p_vcdplayer->i_tracks;
+ p_vcdplayer->i_track = p_vcdplayer->play_item.num;
+ p_vcdplayer->track_lsn = vcdinfo_get_track_lsn(p_vcdinfo,
+ p_vcdplayer->i_track);
break;
default: ; /* Handle exceptional cases below */
}
- _vcdplayer_set_origin(this);
+ _vcdplayer_set_origin(p_vcdplayer);
/* Set next, prev, return and default to simple and hopefully
useful values.
*/
if (play_item+1 >= max_entry)
- this->next_entry = VCDINFO_INVALID_ENTRY;
+ p_vcdplayer->next_entry = VCDINFO_INVALID_ENTRY;
else
- this->next_entry = play_item+1;
+ p_vcdplayer->next_entry = play_item+1;
if (play_item-1 >= min_entry)
- this->prev_entry = play_item-1;
+ p_vcdplayer->prev_entry = play_item-1;
else
- this->prev_entry = VCDINFO_INVALID_ENTRY;
+ p_vcdplayer->prev_entry = VCDINFO_INVALID_ENTRY;
- this->default_entry = play_item;
- this->return_entry = min_entry;
+ p_vcdplayer->default_entry = play_item;
+ p_vcdplayer->return_entry = min_entry;
break;
case VCDINFO_ITEM_TYPE_LID:
@@ -397,32 +410,32 @@ vcdplayer_update_nav(vcdplayer_input_t *this)
}
default: ;
}
- this->update_title();
+ p_vcdplayer->update_title();
}
/*!
Set reading to play an entire track.
*/
static void
-_vcdplayer_set_track(vcdplayer_input_t *this, unsigned int track_num)
+_vcdplayer_set_track(vcdplayer_t *p_vcdplayer, unsigned int i_track)
{
- if (track_num < 1 || track_num > this->num_tracks)
+ if (i_track < 1 || i_track > p_vcdplayer->i_tracks)
return;
else {
- vcdinfo_obj_t *obj = this->vcd;
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
vcdinfo_itemid_t itemid;
- itemid.num = track_num;
- itemid.type = VCDINFO_ITEM_TYPE_TRACK;
- this->in_still = 0;
- this->cur_lsn = vcdinfo_get_track_lsn(obj, track_num);
- this->play_item = itemid;
- this->cur_track = track_num;
- this->track_lsn = this->cur_lsn;
+ itemid.num = i_track;
+ itemid.type = VCDINFO_ITEM_TYPE_TRACK;
+ p_vcdplayer->i_still = 0;
+ p_vcdplayer->i_lsn = vcdinfo_get_track_lsn(p_vcdinfo, i_track);
+ p_vcdplayer->play_item = itemid;
+ p_vcdplayer->i_track = i_track;
+ p_vcdplayer->track_lsn = p_vcdplayer->i_lsn;
- _vcdplayer_set_origin(this);
+ _vcdplayer_set_origin(p_vcdplayer);
- dbg_print(INPUT_DBG_LSN, "LSN: %u\n", this->cur_lsn);
+ dbg_print(INPUT_DBG_LSN, "LSN: %u\n", p_vcdplayer->i_lsn);
}
}
@@ -430,31 +443,32 @@ _vcdplayer_set_track(vcdplayer_input_t *this, unsigned int track_num)
Set reading to play an entry
*/
static void
-_vcdplayer_set_entry(vcdplayer_input_t *this, unsigned int num)
+_vcdplayer_set_entry(vcdplayer_t *p_vcdplayer, unsigned int num)
{
- vcdinfo_obj_t *obj = this->vcd;
- unsigned int num_entries = vcdinfo_get_num_entries(obj);
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
+ const unsigned int i_entries = vcdinfo_get_num_entries(p_vcdinfo);
- if (num >= num_entries) {
- LOG_ERR(this, "%s %d\n", _("bad entry number"), num);
+ if (num >= i_entries) {
+ LOG_ERR(p_vcdplayer, "%s %d\n", _("bad entry number"), num);
return;
} else {
vcdinfo_itemid_t itemid;
- itemid.num = num;
- itemid.type = VCDINFO_ITEM_TYPE_ENTRY;
- this->in_still = 0;
- this->cur_lsn = vcdinfo_get_entry_lsn(obj, num);
- this->play_item = itemid;
- this->cur_track = vcdinfo_get_track(obj, num);
- this->track_lsn = vcdinfo_get_track_lsn(obj, this->cur_track);
- this->track_end_lsn = this->track_lsn +
- this->track[this->cur_track-1].size;
+ itemid.num = num;
+ itemid.type = VCDINFO_ITEM_TYPE_ENTRY;
+ p_vcdplayer->i_still = 0;
+ p_vcdplayer->i_lsn = vcdinfo_get_entry_lsn(p_vcdinfo, num);
+ p_vcdplayer->play_item = itemid;
+ p_vcdplayer->i_track = vcdinfo_get_track(p_vcdinfo, num);
+ p_vcdplayer->track_lsn = vcdinfo_get_track_lsn(p_vcdinfo,
+ p_vcdplayer->i_track);
+ p_vcdplayer->track_end_lsn = p_vcdplayer->track_lsn +
+ p_vcdplayer->track[p_vcdplayer->i_track-1].size;
- _vcdplayer_set_origin(this);
+ _vcdplayer_set_origin(p_vcdplayer);
dbg_print(INPUT_DBG_LSN, "LSN: %u, track_end LSN: %u\n",
- this->cur_lsn, this->track_end_lsn);
+ p_vcdplayer->i_lsn, p_vcdplayer->track_end_lsn);
}
}
@@ -462,61 +476,61 @@ _vcdplayer_set_entry(vcdplayer_input_t *this, unsigned int num)
Set reading to play an segment (e.g. still frame)
*/
static void
-_vcdplayer_set_segment(vcdplayer_input_t *this, unsigned int num)
+_vcdplayer_set_segment(vcdplayer_t *p_vcdplayer, unsigned int num)
{
- vcdinfo_obj_t *obj = this->vcd;
- segnum_t num_segs = vcdinfo_get_num_segments(obj);
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
+ segnum_t i_segs = vcdinfo_get_num_segments(p_vcdinfo);
- if (num >= num_segs) {
- LOG_ERR(this, "%s %d\n", _("bad segment number"), num);
+ if (num >= i_segs) {
+ LOG_ERR(p_vcdplayer, "%s %d\n", _("bad segment number"), num);
return;
} else {
vcdinfo_itemid_t itemid;
- this->cur_lsn = vcdinfo_get_seg_lsn(obj, num);
- this->cur_track = 0;
+ p_vcdplayer->i_lsn = vcdinfo_get_seg_lsn(p_vcdinfo, num);
+ p_vcdplayer->i_track = 0;
- if (VCDINFO_NULL_LSN==this->cur_lsn) {
- LOG_ERR(this, "%s %d\n",
+ if (VCDINFO_NULL_LSN==p_vcdplayer->i_lsn) {
+ LOG_ERR(p_vcdplayer, "%s %d\n",
_("Error in getting current segment number"), num);
return;
}
itemid.num = num;
itemid.type = VCDINFO_ITEM_TYPE_SEGMENT;
- this->play_item = itemid;
+ p_vcdplayer->play_item = itemid;
- _vcdplayer_set_origin(this);
+ _vcdplayer_set_origin(p_vcdplayer);
- dbg_print(INPUT_DBG_LSN, "LSN: %u\n", this->cur_lsn);
+ dbg_print(INPUT_DBG_LSN, "LSN: %u\n", p_vcdplayer->i_lsn);
}
}
/* Play entry. */
/* Play a single item. */
static void
-vcdplayer_play_single_item(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
+vcdplayer_play_single_item(vcdplayer_t *p_vcdplayer, vcdinfo_itemid_t itemid)
{
- vcdinfo_obj_t *obj = this->vcd;
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
dbg_print(INPUT_DBG_CALL, "called itemid.num: %d, itemid.type: %d\n",
itemid.num, itemid.type);
- this->in_still = 0;
+ p_vcdplayer->i_still = 0;
switch (itemid.type) {
case VCDINFO_ITEM_TYPE_SEGMENT:
{
vcdinfo_video_segment_type_t segtype
- = vcdinfo_get_video_type(obj, itemid.num);
- segnum_t num_segs = vcdinfo_get_num_segments(obj);
+ = vcdinfo_get_video_type(p_vcdinfo, itemid.num);
+ segnum_t i_segs = vcdinfo_get_num_segments(p_vcdinfo);
dbg_print(INPUT_DBG_PBC, "%s (%d), itemid.num: %d\n",
- vcdinfo_video_type2str(obj, itemid.num),
+ vcdinfo_video_type2str(p_vcdinfo, itemid.num),
(int) segtype, itemid.num);
- if (itemid.num >= num_segs) return;
- _vcdplayer_set_segment(this, itemid.num);
+ if (itemid.num >= i_segs) return;
+ _vcdplayer_set_segment(p_vcdplayer, itemid.num);
switch (segtype)
{
@@ -524,10 +538,10 @@ vcdplayer_play_single_item(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
case VCDINFO_FILES_VIDEO_NTSC_STILL2:
case VCDINFO_FILES_VIDEO_PAL_STILL:
case VCDINFO_FILES_VIDEO_PAL_STILL2:
- this->in_still = -5;
+ p_vcdplayer->i_still = STILL_READING;
break;
default:
- this->in_still = 0;
+ p_vcdplayer->i_still = 0;
}
break;
@@ -535,41 +549,41 @@ vcdplayer_play_single_item(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
case VCDINFO_ITEM_TYPE_TRACK:
dbg_print(INPUT_DBG_PBC, "track %d\n", itemid.num);
- if (itemid.num < 1 || itemid.num > this->num_tracks) return;
- _vcdplayer_set_track(this, itemid.num);
+ if (itemid.num < 1 || itemid.num > p_vcdplayer->i_tracks) return;
+ _vcdplayer_set_track(p_vcdplayer, itemid.num);
break;
case VCDINFO_ITEM_TYPE_ENTRY:
{
- unsigned int num_entries = vcdinfo_get_num_entries(obj);
+ unsigned int i_entries = vcdinfo_get_num_entries(p_vcdinfo);
dbg_print(INPUT_DBG_PBC, "entry %d\n", itemid.num);
- if (itemid.num >= num_entries) return;
- _vcdplayer_set_entry(this, itemid.num);
+ if (itemid.num >= i_entries) return;
+ _vcdplayer_set_entry(p_vcdplayer, itemid.num);
break;
}
case VCDINFO_ITEM_TYPE_LID:
- LOG_ERR(this, "%s\n", _("Should have converted this above"));
+ LOG_ERR(p_vcdplayer, "%s\n", _("Should have converted this above"));
break;
case VCDINFO_ITEM_TYPE_NOTFOUND:
dbg_print(INPUT_DBG_PBC, "play nothing\n");
- this->cur_lsn = this->end_lsn;
+ p_vcdplayer->i_lsn = p_vcdplayer->end_lsn;
return;
default:
- LOG_ERR(this, "item type %d not implemented.\n", itemid.type);
+ LOG_ERR(p_vcdplayer, "item type %d not implemented.\n", itemid.type);
return;
}
- this->play_item = itemid;
+ p_vcdplayer->play_item = itemid;
- vcdplayer_update_nav(this);
+ vcdplayer_update_nav(p_vcdplayer);
/* Some players like xine, have a fifo queue of audio and video buffers
that need to be flushed when playing a new selection. */
- /* if (this->flush_buffers)
- this->flush_buffers(); */
+ /* if (p_vcdplayer->flush_buffers)
+ p_vcdplayer->flush_buffers(); */
}
@@ -580,77 +594,77 @@ vcdplayer_play_single_item(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
"next" field of a LID which moves us to a different LID.
*/
static bool
-_vcdplayer_inc_play_item(vcdplayer_input_t *this)
+_vcdplayer_inc_play_item(vcdplayer_t *p_vcdplayer)
{
int noi;
- dbg_print(INPUT_DBG_CALL, "called pli: %d\n", this->pdi);
+ dbg_print(INPUT_DBG_CALL, "called pli: %d\n", p_vcdplayer->pdi);
- if ( NULL == this || NULL == this->pxd.pld ) return false;
+ if ( NULL == p_vcdplayer || NULL == p_vcdplayer->pxd.pld ) return false;
- noi = vcdinf_pld_get_noi(this->pxd.pld);
+ noi = vcdinf_pld_get_noi(p_vcdplayer->pxd.pld);
if ( noi <= 0 ) return false;
/* Handle delays like autowait or wait here? */
- this->pdi++;
+ p_vcdplayer->pdi++;
- if ( this->pdi < 0 || this->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(this->pxd.pld,
- this->pdi);
+ 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;
vcdinfo_classify_itemid(trans_itemid_num, &trans_itemid);
dbg_print(INPUT_DBG_PBC, " play-item[%d]: %s\n",
- this->pdi, vcdinfo_pin2str (trans_itemid_num));
- vcdplayer_play_single_item(this, trans_itemid);
+ p_vcdplayer->pdi, vcdinfo_pin2str (trans_itemid_num));
+ vcdplayer_play_single_item(p_vcdplayer, trans_itemid);
return true;
}
}
void
-vcdplayer_play(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
+vcdplayer_play(vcdplayer_t *p_vcdplayer, vcdinfo_itemid_t itemid)
{
dbg_print(INPUT_DBG_CALL, "called itemid.num: %d itemid.type: %d\n",
itemid.num, itemid.type);
- if (!vcdplayer_pbc_is_on(this)) {
- vcdplayer_play_single_item(this, itemid);
+ if (!vcdplayer_pbc_is_on(p_vcdplayer)) {
+ vcdplayer_play_single_item(p_vcdplayer, itemid);
} else {
/* PBC on - Itemid.num is LID. */
- vcdinfo_obj_t *obj = this->vcd;
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
- if (obj == NULL) return;
+ if (p_vcdinfo == NULL) return;
- this->cur_lid = itemid.num;
- vcdinfo_lid_get_pxd(obj, &(this->pxd), itemid.num);
+ p_vcdplayer->i_lid = itemid.num;
+ vcdinfo_lid_get_pxd(p_vcdinfo, &(p_vcdplayer->pxd), itemid.num);
- switch (this->pxd.descriptor_type) {
+ switch (p_vcdplayer->pxd.descriptor_type) {
case PSD_TYPE_SELECTION_LIST:
case PSD_TYPE_EXT_SELECTION_LIST: {
vcdinfo_itemid_t trans_itemid;
uint16_t trans_itemid_num;
- if (this->pxd.psd == NULL) return;
- trans_itemid_num = vcdinf_psd_get_itemid(this->pxd.psd);
+ 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);
- this->loop_count = 1;
- this->loop_item = trans_itemid;
- vcdplayer_play_single_item(this, trans_itemid);
+ p_vcdplayer->i_loop = 1;
+ p_vcdplayer->loop_item = trans_itemid;
+ vcdplayer_play_single_item(p_vcdplayer, trans_itemid);
break;
}
case PSD_TYPE_PLAY_LIST: {
- if (this->pxd.pld == NULL) return;
- this->pdi = -1;
- _vcdplayer_inc_play_item(this);
+ if (p_vcdplayer->pxd.pld == NULL) return;
+ p_vcdplayer->pdi = -1;
+ _vcdplayer_inc_play_item(p_vcdplayer);
break;
}
@@ -665,18 +679,19 @@ vcdplayer_play(vcdplayer_input_t *this, vcdinfo_itemid_t itemid)
/*
Set's start origin and size for subsequent seeks.
- input: this->cur_lsn, this->play_item
- changed: this->origin_lsn, this->end_lsn
+ input: p_vcdplayer->i_lsn, p_vcdplayer->play_item
+ changed: p_vcdplayer->origin_lsn, p_vcdplayer->end_lsn
*/
static void
-_vcdplayer_set_origin(vcdplayer_input_t *this)
+_vcdplayer_set_origin(vcdplayer_t *p_vcdplayer)
{
- size_t size = _vcdplayer_get_item_size(this, this->play_item);
+ size_t size = _vcdplayer_get_item_size(p_vcdplayer, p_vcdplayer->play_item);
- this->end_lsn = this->cur_lsn + size;
- this->origin_lsn = this->cur_lsn;
+ p_vcdplayer->end_lsn = p_vcdplayer->i_lsn + size;
+ p_vcdplayer->origin_lsn = p_vcdplayer->i_lsn;
- dbg_print((INPUT_DBG_CALL|INPUT_DBG_LSN), "end LSN: %u\n", this->end_lsn);
+ dbg_print((INPUT_DBG_CALL|INPUT_DBG_LSN), "end LSN: %u\n",
+ p_vcdplayer->end_lsn);
}
#define RETURN_NULL_BLOCK \
@@ -690,60 +705,60 @@ _vcdplayer_set_origin(vcdplayer_input_t *this)
return READ_STILL_FRAME
#define SLEEP_1_SEC_AND_HANDLE_EVENTS \
- if (this->handle_events()) goto skip_next_play; \
- this->sleep(250000); \
- if (this->handle_events()) goto skip_next_play; \
- this->sleep(250000); \
- if (this->handle_events()) goto skip_next_play; \
- this->sleep(250000); \
- if (this->handle_events()) goto skip_next_play; \
- this->sleep(250000);
-/* if (this->in_still) this->force_redisplay(); */
+ if (p_vcdplayer->handle_events()) goto skip_next_play; \
+ p_vcdplayer->sleep(250000); \
+ if (p_vcdplayer->handle_events()) goto skip_next_play; \
+ p_vcdplayer->sleep(250000); \
+ if (p_vcdplayer->handle_events()) goto skip_next_play; \
+ p_vcdplayer->sleep(250000); \
+ if (p_vcdplayer->handle_events()) goto skip_next_play; \
+ p_vcdplayer->sleep(250000);
+/* if (p_vcdplayer->i_still) p_vcdplayer->force_redisplay(); */
/* Handles PBC navigation when reaching the end of a play item. */
static vcdplayer_read_status_t
-vcdplayer_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
+vcdplayer_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
{
/* We are in playback control. */
vcdinfo_itemid_t itemid;
- if (0 != this->in_still && this->in_still != -5) {
+ if (0 != p_vcdplayer->i_still && p_vcdplayer->i_still != STILL_READING) {
SLEEP_1_SEC_AND_HANDLE_EVENTS;
- if (this->in_still > 0) this->in_still--;
+ if (p_vcdplayer->i_still > 0) p_vcdplayer->i_still--;
return READ_STILL_FRAME;
}
/* The end of an entry is really the end of the associated
sequence (or track). */
- if ( (VCDINFO_ITEM_TYPE_ENTRY == this->play_item.type) &&
- (this->cur_lsn < this->track_end_lsn) ) {
+ if ( (VCDINFO_ITEM_TYPE_ENTRY == p_vcdplayer->play_item.type) &&
+ (p_vcdplayer->i_lsn < p_vcdplayer->track_end_lsn) ) {
/* Set up to just continue to the next entry */
- this->play_item.num++;
+ p_vcdplayer->play_item.num++;
dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC),
- "continuing into next entry: %u\n", this->play_item.num);
- vcdplayer_play_single_item(this, this->play_item);
- this->update_title();
+ "continuing into next entry: %u\n", p_vcdplayer->play_item.num);
+ vcdplayer_play_single_item(p_vcdplayer, p_vcdplayer->play_item);
+ p_vcdplayer->update_title();
goto skip_next_play;
}
- switch (this->pxd.descriptor_type) {
+ switch (p_vcdplayer->pxd.descriptor_type) {
case PSD_TYPE_END_LIST:
return READ_END;
break;
case PSD_TYPE_PLAY_LIST: {
- int wait_time = vcdinf_get_wait_time(this->pxd.pld);
+ int wait_time = vcdinf_get_wait_time(p_vcdplayer->pxd.pld);
dbg_print(INPUT_DBG_PBC, "playlist wait_time: %d\n", wait_time);
- if (_vcdplayer_inc_play_item(this))
+ if (_vcdplayer_inc_play_item(p_vcdplayer))
goto skip_next_play;
/* Handle any wait time given. */
- if (-5 == this->in_still) {
+ if (STILL_READING == p_vcdplayer->i_still) {
if (wait_time != 0) {
- this->in_still = wait_time - 1;
+ p_vcdplayer->i_still = wait_time - 1;
SLEEP_1_SEC_AND_HANDLE_EVENTS ;
return READ_STILL_FRAME;
}
@@ -753,28 +768,28 @@ vcdplayer_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
case PSD_TYPE_SELECTION_LIST: /* Selection List (+Ext. for SVCD) */
case PSD_TYPE_EXT_SELECTION_LIST: /* Extended Selection List (VCD2.0) */
{
- int wait_time = vcdinf_get_timeout_time(this->pxd.psd);
- uint16_t timeout_offs = vcdinf_get_timeout_offset(this->pxd.psd);
- uint16_t max_loop = vcdinf_get_loop_count(this->pxd.psd);
+ int wait_time = vcdinf_get_timeout_time(p_vcdplayer->pxd.psd);
+ uint16_t timeout_offs = vcdinf_get_timeout_offset(p_vcdplayer->pxd.psd);
+ uint16_t max_loop = vcdinf_get_loop_count(p_vcdplayer->pxd.psd);
vcdinfo_offset_t *offset_timeout_LID =
- vcdinfo_get_offset_t(this->vcd, timeout_offs);
+ vcdinfo_get_offset_t(p_vcdplayer->vcd, timeout_offs);
dbg_print(INPUT_DBG_PBC, "wait_time: %d, looped: %d, max_loop %d\n",
- wait_time, this->loop_count, max_loop);
+ wait_time, p_vcdplayer->i_loop, max_loop);
/* Handle any wait time given */
- if (-5 == this->in_still) {
- this->in_still = wait_time - 1;
+ if (STILL_READING == p_vcdplayer->i_still) {
+ p_vcdplayer->i_still = wait_time - 1;
SLEEP_1_SEC_AND_HANDLE_EVENTS ;
return READ_STILL_FRAME;
}
/* Handle any looping given. */
- if ( max_loop == 0 || this->loop_count < max_loop ) {
- this->loop_count++;
- if (this->loop_count == 0x7f) this->loop_count = 0;
- vcdplayer_play_single_item(this, this->loop_item);
- if (this->in_still) this->force_redisplay();
+ 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;
+ vcdplayer_play_single_item(p_vcdplayer, p_vcdplayer->loop_item);
+ if (p_vcdplayer->i_still) p_vcdplayer->force_redisplay();
goto skip_next_play;
}
@@ -786,31 +801,32 @@ vcdplayer_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
itemid.num = offset_timeout_LID->lid;
itemid.type = VCDINFO_ITEM_TYPE_LID;
dbg_print(INPUT_DBG_PBC, "timeout to: %d\n", itemid.num);
- vcdplayer_play(this, itemid);
+ vcdplayer_play(p_vcdplayer, itemid);
goto skip_next_play;
} else {
- int num_selections = vcdinf_get_num_selections(this->pxd.psd);
+ int num_selections = vcdinf_get_num_selections(p_vcdplayer->pxd.psd);
if (num_selections > 0) {
/* Pick a random selection. */
- unsigned int bsn=vcdinf_get_bsn(this->pxd.psd);
+ unsigned int bsn=vcdinf_get_bsn(p_vcdplayer->pxd.psd);
int rand_selection=bsn +
(int) ((num_selections+0.0)*rand()/(RAND_MAX+1.0));
#if defined(LIBVCD_VERSION)
/* version 0.7.21 or greater */
- lid_t rand_lid=vcdinfo_selection_get_lid(this->vcd, this->cur_lid,
+ lid_t rand_lid=vcdinfo_selection_get_lid(p_vcdplayer->vcd,
+ p_vcdplayer->i_lid,
rand_selection);
#else
- lid_t rand_lid=vcdplayer_selection2lid (this, rand_selection);
+ lid_t rand_lid=vcdplayer_selection2lid (p_vcdplayer, rand_selection);
#endif /* LIBVCD_VERSION */
itemid.num = rand_lid;
itemid.type = VCDINFO_ITEM_TYPE_LID;
dbg_print(INPUT_DBG_PBC, "random selection %d, lid: %d\n",
rand_selection - bsn, rand_lid);
- vcdplayer_play(this, itemid);
+ vcdplayer_play(p_vcdplayer, itemid);
goto skip_next_play;
- } else if (this->in_still) {
+ } else if (p_vcdplayer->i_still) {
/* Hack: Just go back and do still again */
SLEEP_1_SEC_AND_HANDLE_EVENTS ;
RETURN_NULL_STILL ;
@@ -820,22 +836,22 @@ vcdplayer_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
break;
}
case VCDINFO_ITEM_TYPE_NOTFOUND:
- LOG_ERR(this, "NOTFOUND in PBC -- not supposed to happen\n");
+ LOG_ERR(p_vcdplayer, "NOTFOUND in PBC -- not supposed to happen\n");
break;
case VCDINFO_ITEM_TYPE_SPAREID2:
- LOG_ERR(this, "SPAREID2 in PBC -- not supposed to happen\n");
+ LOG_ERR(p_vcdplayer, "SPAREID2 in PBC -- not supposed to happen\n");
break;
case VCDINFO_ITEM_TYPE_LID:
- LOG_ERR(this, "LID in PBC -- not supposed to happen\n");
+ LOG_ERR(p_vcdplayer, "LID in PBC -- not supposed to happen\n");
break;
default:
;
}
/* FIXME: Should handle autowait ... */
- itemid.num = this->next_entry;
+ itemid.num = p_vcdplayer->next_entry;
itemid.type = VCDINFO_ITEM_TYPE_LID;
- vcdplayer_play(this, itemid);
+ vcdplayer_play(p_vcdplayer, itemid);
skip_next_play: ;
return READ_BLOCK;
}
@@ -845,52 +861,53 @@ vcdplayer_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
is to do something that's probably right or helpful.
*/
static vcdplayer_read_status_t
-vcdplayer_non_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
+vcdplayer_non_pbc_nav (vcdplayer_t *p_vcdplayer, uint8_t *buf)
{
/* Not in playback control. Do we advance automatically or stop? */
- switch (this->play_item.type) {
+ switch (p_vcdplayer->play_item.type) {
case VCDINFO_ITEM_TYPE_TRACK:
case VCDINFO_ITEM_TYPE_ENTRY:
- if (this->autoadvance && this->next_entry != VCDINFO_INVALID_ENTRY) {
- this->play_item.num=this->next_entry;
- vcdplayer_update_nav(this);
+ if (p_vcdplayer->autoadvance
+ && p_vcdplayer->next_entry != VCDINFO_INVALID_ENTRY) {
+ p_vcdplayer->play_item.num=p_vcdplayer->next_entry;
+ vcdplayer_update_nav(p_vcdplayer);
} else
return READ_END;
break;
case VCDINFO_ITEM_TYPE_SPAREID2:
/* printf("SPAREID2\n"); */
- if (this->in_still) {
+ if (p_vcdplayer->i_still) {
RETURN_NULL_STILL ;
/* Hack: Just go back and do still again */
- /*this->force_redisplay();
- this->cur_lsn = this->origin_lsn;*/
+ /*p_vcdplayer->force_redisplay();
+ p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn;*/
}
return READ_END;
case VCDINFO_ITEM_TYPE_NOTFOUND:
- LOG_ERR(this, "NOTFOUND outside PBC -- not supposed to happen\n");
- if (this->in_still) {
+ LOG_ERR(p_vcdplayer, "NOTFOUND outside PBC -- not supposed to happen\n");
+ if (p_vcdplayer->i_still) {
RETURN_NULL_STILL ;
/* Hack: Just go back and do still again */
- /*this->force_redisplay();
- this->cur_lsn = this->origin_lsn;*/
+ /*p_vcdplayer->force_redisplay();
+ p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn;*/
} else
return READ_END;
break;
case VCDINFO_ITEM_TYPE_LID:
- LOG_ERR(this, "LID outside PBC -- not supposed to happen\n");
- if (this->in_still) {
+ LOG_ERR(p_vcdplayer, "LID outside PBC -- not supposed to happen\n");
+ if (p_vcdplayer->i_still) {
RETURN_NULL_STILL ;
/* Hack: Just go back and do still again */
- /* this->force_redisplay();
- this->cur_lsn = this->origin_lsn; */
+ /* p_vcdplayer->force_redisplay();
+ p_vcdplayer->i_lsn = p_vcdplayer->origin_lsn; */
} else
return READ_END;
break;
case VCDINFO_ITEM_TYPE_SEGMENT:
- if (this->in_still) {
+ if (p_vcdplayer->i_still) {
/* Hack: Just go back and do still again */
RETURN_NULL_STILL ;
}
@@ -908,22 +925,24 @@ vcdplayer_non_pbc_nav (vcdplayer_input_t *this, uint8_t *buf)
interpret the next item in the playback-control list.
*/
vcdplayer_read_status_t
-vcdplayer_read (vcdplayer_input_t *this, uint8_t *buf, const off_t nlen)
+vcdplayer_read (vcdplayer_t *p_vcdplayer, uint8_t *buf,
+ const off_t nlen)
{
- this->handle_events ();
+ p_vcdplayer->handle_events ();
- if ( this->cur_lsn >= this->end_lsn ) {
+ if ( p_vcdplayer->i_lsn >= p_vcdplayer->end_lsn ) {
vcdplayer_read_status_t read_status;
- /* We've run off of the end of this entry. Do we continue or stop? */
+ /* We've run off of the end of p_vcdplayer entry. Do we continue or stop? */
dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC),
- "end reached, cur: %u, end: %u\n", this->cur_lsn, this->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(this)
- ? vcdplayer_pbc_nav(this, buf)
- : vcdplayer_non_pbc_nav(this, buf);
+ read_status = vcdplayer_pbc_is_on(p_vcdplayer)
+ ? vcdplayer_pbc_nav(p_vcdplayer, buf)
+ : vcdplayer_non_pbc_nav(p_vcdplayer, buf);
if (READ_BLOCK != read_status) return read_status;
}
@@ -938,27 +957,28 @@ vcdplayer_read (vcdplayer_input_t *this, uint8_t *buf, const off_t nlen)
*/
{
- CdIo *img = vcdinfo_get_cd_image(this->vcd);
+ CdIo *img = vcdinfo_get_cd_image(p_vcdplayer->vcd);
typedef struct {
- uint8_t subheader [8];
+ uint8_t subheader [CDIO_CD_SUBHEADER_SIZE];
uint8_t data [M2F2_SECTOR_SIZE];
uint8_t spare [4];
} vcdsector_t;
vcdsector_t vcd_sector;
do {
- dbg_print(INPUT_DBG_LSN, "LSN: %u\n", this->cur_lsn);
- if (cdio_read_mode2_sector(img, &vcd_sector, this->cur_lsn, true)!=0) {
+ dbg_print(INPUT_DBG_LSN, "LSN: %u\n", p_vcdplayer->i_lsn);
+ if (cdio_read_mode2_sector(img, &vcd_sector,
+ p_vcdplayer->i_lsn, true)!=0) {
dbg_print(INPUT_DBG_LSN, "read error\n");
return READ_ERROR;
}
- this->cur_lsn++;
+ p_vcdplayer->i_lsn++;
- if ( this->cur_lsn >= this->end_lsn ) {
+ if ( p_vcdplayer->i_lsn >= p_vcdplayer->end_lsn ) {
/* 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",
- this->cur_lsn, this->end_lsn);
+ p_vcdplayer->i_lsn, p_vcdplayer->end_lsn);
break;
}
@@ -968,7 +988,7 @@ vcdplayer_read (vcdplayer_input_t *this, uint8_t *buf, const off_t nlen)
*/
} while((vcd_sector.subheader[2]&~0x01)==0x60);
- if ( this->cur_lsn >= this->end_lsn )
+ if ( p_vcdplayer->i_lsn >= p_vcdplayer->end_lsn )
/* We've run off of the end of this entry. Do we continue or stop? */
goto handle_item_continuation;
@@ -979,7 +999,7 @@ vcdplayer_read (vcdplayer_input_t *this, uint8_t *buf, const off_t nlen)
/* Do if needed */
void
-vcdplayer_send_button_update(vcdplayer_input_t *this, const int mode)
+vcdplayer_send_button_update(vcdplayer_t *p_vcdplayer, const int mode)
{
/* dbg_print(INPUT_DBG_CALL, "Called\n"); */
return;
@@ -989,22 +1009,23 @@ vcdplayer_send_button_update(vcdplayer_input_t *this, const int mode)
/* Older version of vcdimager. You really should consider using 0.7.21
or later as that has bug and memory leak fixes. */
lid_t
-vcdplayer_selection2lid (vcdplayer_input_t *this, int entry_num)
+vcdplayer_selection2lid (vcdplayer_t *p_vcdplayer, int entry_num)
{
- /* FIXME: Some of this probably gets moved to vcdinfo. */
+ /* FIXME: Some of p_vcdplayer probably gets moved to vcdinfo. */
/* Convert selection number to lid and then entry number...*/
unsigned int offset;
- unsigned int bsn=vcdinf_get_bsn(this->pxd.psd);
- vcdinfo_obj_t *obj = this->vcd;
+ unsigned int bsn=vcdinf_get_bsn(p_vcdplayer->pxd.psd);
+ vcdinfo_obj_t *p_vcdinfo = p_vcdplayer->vcd;
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_PBC),
- "Called lid %u, entry_num %d bsn %d\n", this->cur_lid,
+ "Called lid %u, entry_num %d bsn %d\n", p_vcdplayer->i_lid,
entry_num, bsn);
if ( (entry_num - bsn + 1) > 0) {
- offset = vcdinfo_lid_get_offset(obj, this->cur_lid, entry_num-bsn+1);
+ offset = vcdinfo_lid_get_offset(p_vcdinfo, p_vcdplayer->i_lid,
+ entry_num-bsn+1);
} else {
- LOG_ERR(this, "Selection number %u too small. bsn %u\n",
+ LOG_ERR(p_vcdplayer, "Selection number %u too small. bsn %u\n",
entry_num, bsn);
return VCDINFO_INVALID_LID;
}
@@ -1015,21 +1036,21 @@ vcdplayer_selection2lid (vcdplayer_input_t *this, int entry_num)
switch (offset) {
case PSD_OFS_DISABLED:
- LOG_ERR(this, "Selection %u disabled\n", entry_num);
+ LOG_ERR(p_vcdplayer, "Selection %u disabled\n", entry_num);
return VCDINFO_INVALID_LID;
case PSD_OFS_MULTI_DEF:
- LOG_ERR(this, "Selection %u multi_def\n", entry_num);
+ LOG_ERR(p_vcdplayer, "Selection %u multi_def\n", entry_num);
return VCDINFO_INVALID_LID;
case PSD_OFS_MULTI_DEF_NO_NUM:
- LOG_ERR(this, "Selection %u multi_def_no_num\n", entry_num);
+ LOG_ERR(p_vcdplayer, "Selection %u multi_def_no_num\n", entry_num);
return VCDINFO_INVALID_LID;
default: ;
}
- ofs = vcdinfo_get_offset_t(obj, offset);
+ ofs = vcdinfo_get_offset_t(p_vcdinfo, offset);
if (NULL == ofs) {
- LOG_ERR(this, "error in vcdinfo_get_offset\n");
+ LOG_ERR(p_vcdplayer, "error in vcdinfo_get_offset\n");
return -1;
}
dbg_print(INPUT_DBG_PBC,
@@ -1038,7 +1059,7 @@ vcdplayer_selection2lid (vcdplayer_input_t *this, int entry_num)
return ofs->lid;
} else {
- LOG_ERR(this, "invalid or unset entry %u\n", entry_num);
+ LOG_ERR(p_vcdplayer, "invalid or unset entry %u\n", entry_num);
return VCDINFO_INVALID_LID;
}
}
diff --git a/src/input/vcd/vcdplayer.h b/src/input/vcd/vcdplayer.h
index 09bd84936..5b2d1ce4b 100644
--- a/src/input/vcd/vcdplayer.h
+++ b/src/input/vcd/vcdplayer.h
@@ -1,7 +1,7 @@
/*
- $Id: vcdplayer.h,v 1.1 2003/10/13 11:47:11 f1rmb Exp $
+ $Id: vcdplayer.h,v 1.2 2004/12/29 09:23:56 rockyb Exp $
- Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
+ Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@
#define INPUT_DBG_META 1 /* Meta information */
#define INPUT_DBG_EVENT 2 /* input (keyboard/mouse) events */
-#define INPUT_DBG_MRL 4
+#define INPUT_DBG_MRL 4 /* MRL parsing */
#define INPUT_DBG_EXT 8 /* Calls from external routines */
#define INPUT_DBG_CALL 16 /* routine calls */
#define INPUT_DBG_LSN 32 /* LSN changes */
@@ -93,18 +93,25 @@ typedef enum {
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;
+} vcdplayer_play_item_info_t;
typedef int (*generic_fn)();
-typedef struct vcdplayer_input_struct {
+/* 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 vcdplayer_input_s {
void *user_data; /* environment. Passed to called routines. */
int32_t buttonN;
vcdinfo_obj_t *vcd; /* Pointer to libvcd structures. */
- int in_still; /* 0 if not in still,
- -2 if in infinite loop
- -5 if a still but haven't read wait time yet
- >0 number of seconds yet to wait */
+
+ /*------------------------------------------------------------------
+ User-settable options
+ --------------------------------------------------------------*/
+ unsigned int i_debug; /* Debugging mask */
+ unsigned int i_blocks_per_read; /* number of blocks per read */
/*------------------------------------------------------------------
Callback functions - players and higher-level routines can use
@@ -122,7 +129,7 @@ typedef struct vcdplayer_input_struct {
/* Function to flush sleep for a number of milliseconds. */
void (*sleep) (unsigned int usecs);
- /* Function to flush sleep for a number of milliseconds. */
+ /* Function to force a redisplay. */
void (*force_redisplay) (void);
/* Function to handle player events. Returns true if play item changed. */
@@ -134,20 +141,25 @@ typedef struct vcdplayer_input_struct {
/*-------------------------------------------------------------
Playback control fields
--------------------------------------------------------------*/
- int cur_lid; /* LID that play item is in. Implies PBC is.
+ int i_still; /* 0 if not in still,
+ STILL_INDEFINITE_WAIT if indefinite time,
+ STILL_READING if don't have full picture,
+ else number of seconds yet to wait */
+
+ int i_lid; /* LID that play item is in. Implies PBC is.
on. VCDPLAYER_BAD_ENTRY if not none or
not in PBC */
- PsdListDescriptor pxd; /* If PBC is on, the relevant PSD/PLD */
- int pdi; /* current pld index of pxd. -1 if
+ PsdListDescriptor_t pxd; /* If PBC is on, the relevant 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 */
- int loop_count; /* # of times play-item has been played.
+ int i_loop; /* # of times play-item has been played.
Meaningful only in a selection list.
*/
- track_t cur_track; /* current track number. */
+ track_t i_track; /* current track number */
/*-----------------------------------
Navigation and location fields
@@ -159,29 +171,35 @@ typedef struct vcdplayer_input_struct {
uint16_t return_entry; /* Entry index to use if return is pressed */
uint16_t default_entry; /* Default selection entry. */
- lsn_t cur_lsn; /* LSN of where we are right now */
- lsn_t end_lsn; /* LSN of end of current entry/segment/track. */
- lsn_t origin_lsn; /* LSN of start of slider position. */
+ lsn_t i_lsn; /* LSN of where we are right now */
+ lsn_t end_lsn; /* LSN of end of current entry/segment/track.
+ entry/segment/track. This block can be read
+ (and is not one after the "end"). */
+
+ lsn_t origin_lsn; /* LSN of start of seek/slider position. */
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). */
/*--------------------------------------------------------------
- Medium information
+ (S)VCD Medium information
---------------------------------------------------------------*/
-
- char *current_vcd_device; /* VCD device currently open */
+ char *psz_source; /* VCD device currently open */
bool opened; /* true if initialized */
- track_t num_tracks; /* Number of tracks in medium */
- segnum_t num_segments; /* Number of segments in medium */
- unsigned int num_entries; /* Number of entries in medium */
- lid_t num_LIDs; /* Number of LIDs in medium */
+ track_t i_tracks; /* # of playable MPEG tracks. This is
+ generally one less than the number
+ of CD tracks as the first CD track
+ is an ISO-9660 track and is not
+ playable. */
+ segnum_t i_segments; /* Number of segments in medium */
+ unsigned int i_entries; /* Number of entries in medium */
+ lid_t i_lids; /* Number of LIDs in medium */
/* Tracks, segment, and entry information. The number of entries for
- each is given by the corresponding num_* field above. */
- vcdplayer_play_item_info *track;
- vcdplayer_play_item_info *segment;
- vcdplayer_play_item_info *entry;
+ each is given by the corresponding i_* field above. */
+ vcdplayer_play_item_info_t *track;
+ vcdplayer_play_item_info_t *segment;
+ vcdplayer_play_item_info_t *entry;
/*--------------------------------------------------------------
Configuration variables
@@ -203,7 +221,7 @@ typedef struct vcdplayer_input_struct {
/* Whether GUI slider is track size or entry size. */
vcdplayer_slider_length_t slider_length;
-} vcdplayer_input_t;
+} vcdplayer_t;
/* vcdplayer_read return status */
typedef enum {
@@ -221,8 +239,7 @@ typedef enum {
/*!
Return true if playback control (PBC) is on
*/
-bool
-vcdplayer_pbc_is_on(const vcdplayer_input_t *this);
+bool vcdplayer_pbc_is_on(const vcdplayer_t *p_vcdplayer);
/*!
Take a format string and expand escape sequences, that is sequences that
@@ -244,30 +261,30 @@ vcdplayer_pbc_is_on(const vcdplayer_input_t *this);
%% : a %
*/
char *
-vcdplayer_format_str(vcdplayer_input_t *this, const char format_str[]);
+vcdplayer_format_str(vcdplayer_t *p_vcdplayer, const char format_str[]);
/*!
Update next/prev/return/default navigation buttons.
*/
void
-vcdplayer_update_nav(vcdplayer_input_t *this);
+vcdplayer_update_nav(vcdplayer_t *p_vcdplayer);
/*! Update the player title text. */
void
-vcdplayer_update_title_display(vcdplayer_input_t *this);
+vcdplayer_update_title_display(vcdplayer_t *p_vcdplayer);
/*! Play title part. If part is -1, use the first title. */
void
-vcdplayer_play(vcdplayer_input_t *this, vcdinfo_itemid_t itemid);
+vcdplayer_play(vcdplayer_t *p_vcdplayer, vcdinfo_itemid_t itemid);
bool
-vcdplayer_open(vcdplayer_input_t *this, char *intended_vcd_device);
+vcdplayer_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device);
/*!
Read nlen bytes into buf and return the status back.
*/
vcdplayer_read_status_t
-vcdplayer_read (vcdplayer_input_t *this, uint8_t *buf, const off_t nlen);
+vcdplayer_read (vcdplayer_t *p_vcdplayer, uint8_t *p_buf, const off_t nlen);
/*!
seek position, return new position
@@ -275,17 +292,14 @@ vcdplayer_read (vcdplayer_input_t *this, uint8_t *buf, const off_t nlen);
if seeking failed, -1 is returned
*/
off_t
-vcdplayer_seek (vcdplayer_input_t *this, off_t offset, int origin);
+vcdplayer_seek (vcdplayer_t *p_vcdplayer, off_t offset, int origin);
/*!
Get the number of tracks or titles of the VCD. The result is stored
in "titles".
*/
void
-vcdplayer_send_button_update(vcdplayer_input_t *this, int mode);
-
-lid_t
-vcdplayer_selection2lid (vcdplayer_input_t *this, int entry_num);
+vcdplayer_send_button_update(vcdplayer_t *p_vcdplayer, int mode);
#endif /* _VCDPLAYER_H_ */
/*
diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c
index d8c95aae1..864b48ee9 100644
--- a/src/input/vcd/xineplug_inp_vcd.c
+++ b/src/input/vcd/xineplug_inp_vcd.c
@@ -1,5 +1,5 @@
/*
- $Id: xineplug_inp_vcd.c,v 1.26 2004/12/12 22:01:07 mroi Exp $
+ $Id: xineplug_inp_vcd.c,v 1.27 2004/12/29 09:23:56 rockyb Exp $
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -121,9 +121,9 @@ typedef struct {
into "mrls" array
---------------------------------------------------------------*/
int mrl_track_offset; /* perhaps -1 for tracks staring with 1*/
- int mrl_entry_offset; /* num_tracks for entries starting with 0 */
- int mrl_play_offset; /* num_tracks for entries starting with 0 */
- int mrl_segment_offset; /* num_tracks + num_entries if segs start 1*/
+ int mrl_entry_offset; /* i_tracks for entries starting with 0 */
+ int mrl_play_offset; /* i_tracks for entries starting with 0 */
+ int mrl_segment_offset; /* i_tracks + i_entries if segs start 1*/
} vcd_input_class_t;
@@ -145,7 +145,7 @@ struct vcd_input_plugin_tag {
sort of discontinuity in playing */
char *mrl;
- vcdplayer_input_t player ;
+ vcdplayer_t player ;
};
vcd_input_plugin_t my_vcd;
@@ -197,16 +197,16 @@ meta_info_assign(int field, xine_stream_t *stream, const char * info)
static void
vcd_set_meta_info (vcd_input_plugin_t *xine_vcd)
{
- vcdinfo_obj_t *obj= xine_vcd->player.vcd;
+ vcdinfo_obj_t *p_vcdinfo= xine_vcd->player.vcd;
meta_info_assign(XINE_META_INFO_ALBUM, xine_vcd->stream,
- vcdinfo_get_album_id(obj));
+ vcdinfo_get_album_id(p_vcdinfo));
meta_info_assign(XINE_META_INFO_ARTIST, xine_vcd->stream,
- vcdinfo_get_preparer_id(obj));
+ vcdinfo_get_preparer_id(p_vcdinfo));
meta_info_assign(XINE_META_INFO_COMMENT, xine_vcd->stream,
vcdplayer_format_str(&xine_vcd->player,
xine_vcd->v_config.comment_format));
meta_info_assign(XINE_META_INFO_GENRE, xine_vcd->stream,
- vcdinfo_get_format_version_str(obj));
+ vcdinfo_get_format_version_str(p_vcdinfo));
}
static void
@@ -274,7 +274,7 @@ vcd_get_mrl_type_offset(vcd_input_plugin_t *inp,
return inp->class->mrl_track_offset;
case VCDINFO_ITEM_TYPE_LID:
/* Play list number (LID) */
- *size = (inp->player.num_LIDs > 0) ? 1 : 0;
+ *size = (inp->player.i_lids > 0) ? 1 : 0;
return inp->class->mrl_play_offset;
case VCDINFO_ITEM_TYPE_NOTFOUND:
case VCDINFO_ITEM_TYPE_SPAREID2:
@@ -291,10 +291,10 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device)
{
char mrl[MRL_PREFIX_LEN+MAX_DEVICE_LEN+(sizeof("@E")-1)+12];
- vcdplayer_input_t *player;
+ vcdplayer_t *player;
unsigned int n, i=0;
- unsigned int num_entries;
- vcdinfo_obj_t *obj;
+ unsigned int i_entries;
+ vcdinfo_obj_t *p_vcdinfo;
if (NULL == class) {
LOG_MSG("%s", _("was passed a null class parameter"));
@@ -321,8 +321,8 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device)
return false;
}
- obj = player->vcd;
- num_entries = player->num_entries;
+ p_vcdinfo = player->vcd;
+ i_entries = player->i_entries;
class->mrl_track_offset = -1;
xine_free_mrls(&(class->num_mrls), class->mrls);
@@ -331,12 +331,12 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device)
didn't have to possibly remove rejected LIDs from list done in the
loop below.
*/
- class->num_mrls = player->num_tracks + player->num_entries
- + player->num_segments + player->num_LIDs;
+ class->num_mrls = player->i_tracks + player->i_entries
+ + player->i_segments + player->i_lids;
if (!player->show_rejected && vcdinfo_get_lot(player->vcd)) {
/* Remove rejected LIDs from count. */
- for (n=0; n<player->num_LIDs; n++) {
+ for (n=0; n<player->i_lids; n++) {
if ( vcdinf_get_lot_offset(vcdinfo_get_lot(player->vcd), n)
== PSD_OFS_DISABLED )
class->num_mrls--;
@@ -351,18 +351,18 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device)
}
/* Record MRL's for tracks */
- for (n=1; n<=player->num_tracks; n++) {
+ for (n=1; n<=player->i_tracks; n++) {
memset(&mrl, 0, sizeof (mrl));
sprintf(mrl, "%s%s@T%2u", MRL_PREFIX, vcd_device, n);
vcd_add_mrl_slot(class, mrl, player->track[n-1].size, &i);
}
- class->mrl_entry_offset = player->num_tracks;
- class->mrl_play_offset = class->mrl_entry_offset + num_entries - 1;
+ class->mrl_entry_offset = player->i_tracks;
+ class->mrl_play_offset = class->mrl_entry_offset + i_entries - 1;
/* Record MRL's for entries */
- if (num_entries > 0) {
- for (n=0; n<num_entries; n++) {
+ if (i_entries > 0) {
+ for (n=0; n<i_entries; n++) {
memset(&mrl, 0, sizeof (mrl));
sprintf(mrl, "%s%s@E%4u", MRL_PREFIX, vcd_device, n);
vcd_add_mrl_slot(class, mrl, player->entry[n].size, &i);
@@ -372,7 +372,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device)
/* Record MRL's for LID entries or selection entries*/
class->mrl_segment_offset = class->mrl_play_offset;
if (vcdinfo_get_lot(player->vcd)) {
- for (n=0; n<player->num_LIDs; n++) {
+ for (n=0; n<player->i_lids; n++) {
uint16_t ofs = vcdinf_get_lot_offset(vcdinfo_get_lot(player->vcd), n);
if (ofs != PSD_OFS_DISABLED || player->show_rejected) {
memset(&mrl, 0, sizeof (mrl));
@@ -386,10 +386,10 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device)
/* Record MRL's for segments */
{
- segnum_t num_segments = player->num_segments;
- for (n=0; n<num_segments; n++) {
+ segnum_t i_segments = player->i_segments;
+ for (n=0; n<i_segments; n++) {
vcdinfo_video_segment_type_t segtype
- = vcdinfo_get_video_type(obj, n);
+ = vcdinfo_get_video_type(p_vcdinfo, n);
char c='S';
switch (segtype) {
{
@@ -569,7 +569,7 @@ vcd_plugin_get_capabilities (input_plugin_t *this_gen)
uint32_t ret =
INPUT_CAP_AUDIOLANG | INPUT_CAP_BLOCK |
INPUT_CAP_CHAPTERS | INPUT_CAP_PREVIEW |
- (my_vcd.player.in_still ? 0: INPUT_CAP_SEEKABLE) |
+ (my_vcd.player.i_still ? 0: INPUT_CAP_SEEKABLE) |
INPUT_CAP_SPULANG;
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "returning %d\n", ret);
@@ -624,7 +624,7 @@ static buf_element_t *
vcd_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
const off_t nlen)
{
- vcdplayer_input_t *this = &my_vcd.player;
+ vcdplayer_t *this = &my_vcd.player;
buf_element_t *buf;
uint8_t data[M2F2_SECTOR_SIZE];
@@ -699,7 +699,7 @@ static off_t
vcd_plugin_get_length (input_plugin_t *this_gen) {
vcd_input_plugin_t *ip= (vcd_input_plugin_t *) this_gen;
- vcdplayer_input_t *this = &(ip->player);
+ vcdplayer_t *this = &(ip->player);
int n = this->play_item.num;
@@ -795,7 +795,7 @@ vcd_class_get_dir (input_class_t *this_gen, const char *filename,
vcdinfo_itemid_t itemid;
vcd_input_class_t *class = (vcd_input_class_t *) this_gen;
- vcdplayer_input_t *player = &my_vcd.player;
+ vcdplayer_t *player= &my_vcd.player;
bool used_default;
@@ -804,7 +804,7 @@ vcd_class_get_dir (input_class_t *this_gen, const char *filename,
"called with NULL\n");
if ( class->mrls != NULL && NULL != class->mrls[0] ) goto have_mrls;
- if ( !vcd_build_mrl_list(class, player->current_vcd_device) ) {
+ if ( !vcd_build_mrl_list(class, player->psz_source) ) {
goto no_mrls;
}
} else {
@@ -870,14 +870,14 @@ vcd_class_eject_media (input_class_t *this_gen)
static char *
vcd_plugin_get_mrl (input_plugin_t *this_gen)
{
- vcd_input_plugin_t *t = (vcd_input_plugin_t *) this_gen;
- vcdplayer_input_t *this = &my_vcd.player;
+ vcd_input_plugin_t *t = (vcd_input_plugin_t *) this_gen;
+ vcdplayer_t *this = &my_vcd.player;
unsigned int n;
int size; /* need something to feed get_mrl_type_offset */
int offset;
if (vcdplayer_pbc_is_on(this)) {
- n = this->cur_lid;
+ n = this->i_lid;
offset = vcd_get_mrl_type_offset(t, VCDINFO_ITEM_TYPE_LID, &size);
} else {
n = this->play_item.num;
@@ -934,7 +934,7 @@ vcd_class_get_identifier (input_class_t *this_gen) {
static bool
vcd_handle_events (void)
{
- vcdplayer_input_t *this = &my_vcd.player;
+ vcdplayer_t *this = &my_vcd.player;
xine_event_t *event;
int digit_entered=0;
@@ -1025,8 +1025,8 @@ vcd_handle_events (void)
case XINE_EVENT_INPUT_MENU2:
#if defined(LIBVCD_VERSION)
if (vcdplayer_pbc_is_on(this)) {
- lid_t lid=vcdinfo_get_multi_default_lid(this->vcd, this->cur_lid,
- this->cur_lsn);
+ lid_t lid=vcdinfo_get_multi_default_lid(this->vcd, this->i_lid,
+ this->i_lsn);
if (VCDINFO_INVALID_LID != lid) {
itemid.num = lid;
dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT),
@@ -1034,7 +1034,7 @@ vcd_handle_events (void)
} else {
dbg_print((INPUT_DBG_PBC|INPUT_DBG_EVENT),
"no DEFAULT for LID %d\n",
- this->cur_lid);
+ this->i_lid);
}
/* Don't loop around -- doesn't make sense to loop a return*/
@@ -1094,7 +1094,7 @@ vcd_handle_events (void)
if (vcdplayer_pbc_is_on(this)) {
#if defined(LIBVCD_VERSION)
/* version 0.7.21 or greater */
- lid_t next_num=vcdinfo_selection_get_lid(this->vcd, this->cur_lid,
+ lid_t next_num=vcdinfo_selection_get_lid(this->vcd, this->i_lid,
itemid.num);
#else
lid_t next_num=vcdplayer_selection2lid(this, itemid.num);
@@ -1167,12 +1167,12 @@ vcd_get_optional_data (input_plugin_t *this_gen,
if (-1 == channel) {
sprintf(data, " %s", "auto");
} else {
- const vcdinfo_obj_t *obj= my_vcd.player.vcd;
+ const vcdinfo_obj_t *p_vcdinfo= my_vcd.player.vcd;
unsigned int audio_type;
unsigned int num_channels;
- unsigned int track_num = my_vcd.player.cur_track;
- audio_type = vcdinfo_get_track_audio_type(obj, track_num);
- num_channels = vcdinfo_audio_type_num_channels(obj, audio_type);
+ unsigned int track_num = my_vcd.player.i_track;
+ audio_type = vcdinfo_get_track_audio_type(p_vcdinfo, track_num);
+ num_channels = vcdinfo_audio_type_num_channels(p_vcdinfo, audio_type);
if (channel >= num_channels) {
sprintf(data, "%d ERR", channel);
@@ -1224,7 +1224,7 @@ vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_files)
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n");
- if ( !vcd_build_mrl_list(class, my_vcd.player.current_vcd_device) ) {
+ if ( !vcd_build_mrl_list(class, my_vcd.player.psz_source) ) {
*num_files = 0;
return NULL;
} else {
@@ -1279,8 +1279,8 @@ vcd_plugin_dispose(input_plugin_t *this_gen)
my_vcd.stream = NULL;
#if 0
- vcd_input_plugin_t *t= (vcd_input_plugin_t *) this_gen;
- vcdplayer_input_t *this = t->v;
+ vcd_input_plugin_t *t= (vcd_input_plugin_t *) this_gen;
+ vcdplayer_t *this = t->v;
if (NULL==this) return;
#endif
@@ -1375,7 +1375,8 @@ vcd_class_dispose (input_class_t *this_gen) {
vcd_input_class_t *class = (vcd_input_class_t *) this_gen;
gl_default_vcd_log_handler = vcd_log_set_handler (uninit_log_handler);
- gl_default_cdio_log_handler = cdio_log_set_handler (uninit_log_handler);
+ gl_default_cdio_log_handler =
+ cdio_log_set_handler ((cdio_log_handler_t) uninit_log_handler);
dbg_print((INPUT_DBG_CALL|INPUT_DBG_EXT), "called\n");
@@ -1399,7 +1400,7 @@ vcd_update_title(void)
vcdplayer_format_str(&my_vcd.player,
my_vcd.v_config.comment_format));
stream_info_assign(XINE_STREAM_INFO_VIDEO_HAS_STILL, my_vcd.stream,
- my_vcd.player.in_still);
+ my_vcd.player.i_still);
/* Set_str title/chapter display */
dbg_print((INPUT_DBG_MRL|INPUT_DBG_CALL),
@@ -1491,9 +1492,9 @@ vcd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream,
my_vcd.player.user_data = (void *) class;
/* Do we set PBC (via LID) on? */
- my_vcd.player.cur_lid =
+ my_vcd.player.i_lid =
( VCDINFO_ITEM_TYPE_LID == itemid.type
- && my_vcd.player.num_LIDs > itemid.num )
+ && my_vcd.player.i_lids > itemid.num )
? itemid.num
: VCDINFO_INVALID_ENTRY;
@@ -1622,7 +1623,7 @@ vcd_init (xine_t *xine, void *data)
Playback control-specific fields
--------------------------------------------------------------*/
- my_vcd.player.cur_lid = VCDINFO_INVALID_ENTRY;
+ my_vcd.player.i_lid = VCDINFO_INVALID_ENTRY;
my_vcd.player.end_lsn = VCDINFO_NULL_LSN;
my_vcd.player.pdi = -1;
@@ -1754,7 +1755,8 @@ _("Format used in the GUI Title. Similar to the Unix date "
}
gl_default_vcd_log_handler = vcd_log_set_handler (uninit_log_handler);
- gl_default_cdio_log_handler = cdio_log_set_handler (uninit_log_handler);
+ gl_default_cdio_log_handler =
+ cdio_log_set_handler ((cdio_log_handler_t) uninit_log_handler);
my_vcd.input_plugin.open = vcd_plugin_open;
my_vcd.input_plugin.get_capabilities = vcd_plugin_get_capabilities;
@@ -1773,7 +1775,7 @@ _("Format used in the GUI Title. Similar to the Unix date "
my_vcd.class = class;
my_vcd.player.buttonN = 0;
- my_vcd.player.current_vcd_device = NULL;
+ my_vcd.player.psz_source = NULL;
my_vcd.player.opened = false;
my_vcd.player.play_item.num = VCDINFO_INVALID_ENTRY;