Commit ded081bc authored by JP Dinger's avatar JP Dinger

vcdx: 100% cosmetics; indentation reformatting.

parent f5078293
......@@ -103,8 +103,7 @@ cdio_log_handler (cdio_log_level_t level, const char message[])
break;
default:
msg_Warn( p_vcd_access, "%s\n%s %d", message,
"The above message had unknown log level",
level);
"The above message had unknown log level", level);
}
return;
}
......@@ -129,8 +128,7 @@ vcd_log_handler (vcd_log_level_t level, const char message[])
break;
default:
msg_Warn( p_vcd_access, "%s\n%s %d", message,
"The above message had unknown vcdimager log level",
level);
"The above message had unknown vcdimager log level", level);
}
return;
}
......@@ -177,7 +175,7 @@ VCDReadBlock( access_t * p_access )
right this shouldn't have to happen.
*/
#if 0
if ( p_access->info.i_pos != p_access->info.i_size ) {
if( p_access->info.i_pos != p_access->info.i_size ) {
msg_Warn( p_access,
"At end but pos (%llu) is not size (%llu). Adjusting.",
p_access->info.i_pos, p_access->info.i_size );
......@@ -189,19 +187,17 @@ VCDReadBlock( access_t * p_access )
return NULL;
case READ_ERROR:
/* Some sort of error. Should we increment lsn? to skip block?
*/
/* Some sort of error. Should we increment lsn? to skip block? */
block_Release( p_block );
return NULL;
case READ_STILL_FRAME:
{
/* FIXME The below should be done in an event thread.
Until then...
*/
#if 1
msleep( MILLISECONDS_PER_SEC * *p_buf );
VCDSetOrigin(p_access, p_vcdplayer->origin_lsn, p_vcdplayer->i_track,
&(p_vcdplayer->play_item));
VCDSetOrigin(p_access, p_vcdplayer->origin_lsn,
p_vcdplayer->i_track, &(p_vcdplayer->play_item));
// p_vcd->in_still = false;
dbg_print(INPUT_DBG_STILL, "still wait time done");
#else
......@@ -210,12 +206,11 @@ VCDReadBlock( access_t * p_access )
block_Release( p_block );
return NULL;
}
default:
case READ_BLOCK:
/* Read buffer */
;
break;
}
p_buf += M2F2_SECTOR_SIZE;
......@@ -249,7 +244,6 @@ int
VCDSeek( access_t * p_access, int64_t i_pos )
{
if (!p_access || !p_access->p_sys) return VLC_EGENERIC;
{
vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_vcd_access->p_sys;
const input_title_t *t = p_vcdplayer->p_title[p_access->info.i_title];
......@@ -261,12 +255,14 @@ VCDSeek( access_t * p_access, int64_t i_pos )
p_vcdplayer->i_lsn = (i_pos / (int64_t) M2F2_SECTOR_SIZE) +
p_vcdplayer->origin_lsn;
switch (p_vcdplayer->play_item.type) {
switch (p_vcdplayer->play_item.type)
{
case VCDINFO_ITEM_TYPE_TRACK:
case VCDINFO_ITEM_TYPE_ENTRY:
break ;
break;
default:
p_vcdplayer->b_valid_ep = false;
break;
}
/* Find entry */
......@@ -286,8 +282,8 @@ VCDSeek( access_t * p_access, int64_t i_pos )
vcdinfo_itemid_t itemid;
itemid.num = i_entry;
itemid.type = VCDINFO_ITEM_TYPE_ENTRY;
VCDSetOrigin(p_access, p_vcdplayer->i_lsn, p_vcdplayer->i_track,
&itemid);
VCDSetOrigin(p_access, p_vcdplayer->i_lsn,
p_vcdplayer->i_track, &itemid);
}
}
......@@ -312,11 +308,9 @@ VCDSeek( access_t * p_access, int64_t i_pos )
p_access->info.i_update |= INPUT_UPDATE_SEEKPOINT;
p_access->info.i_seekpoint = i_seekpoint;
}
}
p_access->info.b_eof = false;
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -329,10 +323,8 @@ VCDEntryPoints( access_t * p_access )
{
if (!p_access || !p_access->p_sys) return false;
{
vcdplayer_t *p_vcdplayer = (vcdplayer_t *) p_access->p_sys;
const unsigned int i_entries =
vcdinfo_get_num_entries(p_vcdplayer->vcd);
const unsigned int i_entries = vcdinfo_get_num_entries(p_vcdplayer->vcd);
const track_t i_last_track
= cdio_get_num_tracks(vcdinfo_get_cd_image(p_vcdplayer->vcd))
+ cdio_get_first_track_num(vcdinfo_get_cd_image(p_vcdplayer->vcd));
......@@ -356,21 +348,22 @@ VCDEntryPoints( access_t * p_access )
for( i = 0 ; i < i_entries ; i++ )
{
const track_t i_track = vcdinfo_get_track(p_vcdplayer->vcd, i);
if( i_track <= i_last_track ) {
if( i_track <= i_last_track )
{
seekpoint_t *s = vlc_seekpoint_New();
char psz_entry[100];
snprintf(psz_entry, sizeof(psz_entry), "%s %02d", _("Entry"), i );
p_vcdplayer->p_entries[i] = vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i);
p_vcdplayer->p_entries[i] =
vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i);
s->psz_name = strdup(psz_entry);
s->i_byte_offset =
(p_vcdplayer->p_entries[i] - vcdinfo_get_track_lsn(p_vcdplayer->vcd, i_track))
s->i_byte_offset = (p_vcdplayer->p_entries[i]
- vcdinfo_get_track_lsn(p_vcdplayer->vcd,i_track))
* M2F2_SECTOR_SIZE;
dbg_print( INPUT_DBG_MRL,
"%s, lsn %d, byte_offset %ld",
dbg_print( INPUT_DBG_MRL, "%s, lsn %d, byte_offset %ld",
s->psz_name, p_vcdplayer->p_entries[i],
(unsigned long int) s->i_byte_offset);
TAB_APPEND( p_vcdplayer->p_title[i_track-1]->i_seekpoint,
......@@ -381,7 +374,6 @@ VCDEntryPoints( access_t * p_access )
}
p_vcdplayer->b_valid_ep = true;
return true;
}
}
/*****************************************************************************
......@@ -410,8 +402,7 @@ VCDSegments( access_t * p_access )
/* We have one additional segment allocated so we can get the size
by subtracting seg[i+1] - seg[i].
*/
p_vcdplayer->p_segments =
malloc( sizeof( lsn_t ) * (p_vcdplayer->i_segments+1) );
p_vcdplayer->p_segments=malloc(sizeof(lsn_t)*(p_vcdplayer->i_segments+1));
if( p_vcdplayer->p_segments == NULL )
{
LOG_ERR ("not enough memory for segment treatment" );
......@@ -597,7 +588,6 @@ VCDParse( access_t * p_access, /*out*/ vcdinfo_itemid_t * p_itemid,
*psz_parser = '\0';
++psz_parser;
if( *psz_parser )
{
switch(*psz_parser) {
case 'E':
p_itemid->type = VCDINFO_ITEM_TYPE_ENTRY;
......@@ -619,8 +609,8 @@ VCDParse( access_t * p_access, /*out*/ vcdinfo_itemid_t * p_itemid,
++psz_parser;
*play_single_item = true;
break;
default: ;
}
default:
break;
}
num = strtol( psz_parser, &psz_next, 10 );
......@@ -634,20 +624,22 @@ VCDParse( access_t * p_access, /*out*/ vcdinfo_itemid_t * p_itemid,
}
if( !*psz_source ) {
if( !*psz_source )
{
/* No source specified, so figure it out. */
if( !p_access->psz_access ) return NULL;
psz_source = config_GetPsz( p_access, "vcd" );
if( !psz_source || 0==strlen(psz_source) ) {
if( !psz_source || 0==strlen(psz_source) )
{
free( psz_source );
/* Scan for a CD-ROM drive with a VCD in it. */
char **cd_drives = cdio_get_devices_with_cap( NULL,
( CDIO_FS_ANAL_SVCD | CDIO_FS_ANAL_CVD
|CDIO_FS_ANAL_VIDEOCD | CDIO_FS_UNKNOWN ),
true );
char **cd_drives = cdio_get_devices_with_cap(NULL,
(CDIO_FS_ANAL_SVCD|CDIO_FS_ANAL_CVD
|CDIO_FS_ANAL_VIDEOCD|CDIO_FS_UNKNOWN),
true);
if( NULL == cd_drives ) return NULL;
if( cd_drives[0] == NULL )
{
......@@ -676,12 +668,12 @@ VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
vcdplayer_t *p_vcdplayer= (vcdplayer_t *)p_access->p_sys;
dbg_print( (INPUT_DBG_CALL|INPUT_DBG_LSN),
"i_lsn: %lu, track: %d", (long unsigned int) i_lsn,
i_track );
"i_lsn: %lu, track: %d", (long unsigned int) i_lsn, i_track );
vcdplayer_set_origin(p_access, i_lsn, i_track, p_itemid);
switch (p_vcdplayer->play_item.type) {
switch (p_vcdplayer->play_item.type)
{
case VCDINFO_ITEM_TYPE_ENTRY:
VCDUpdateVar( p_access, p_itemid->num, VLC_VAR_SETVALUE,
"chapter", _("Entry"), "Setting entry/segment");
......@@ -690,10 +682,10 @@ VCDSetOrigin( access_t *p_access, lsn_t i_lsn, track_t i_track,
{
p_access->info.i_size = p_vcdplayer->p_title[i_track-1]->i_size;
p_access->info.i_pos = (int64_t) M2F2_SECTOR_SIZE *
(vcdinfo_get_track_lsn(p_vcdplayer->vcd, i_track) - i_lsn);
(vcdinfo_get_track_lsn(p_vcdplayer->vcd, i_track)-i_lsn);
} else {
p_access->info.i_size = M2F2_SECTOR_SIZE * (int64_t)
vcdinfo_get_entry_sect_count(p_vcdplayer->vcd, p_itemid->num);
vcdinfo_get_entry_sect_count(p_vcdplayer->vcd,p_itemid->num);
p_access->info.i_pos = 0;
}
dbg_print( (INPUT_DBG_LSN|INPUT_DBG_PBC), "size: %llu, pos: %llu",
......@@ -753,8 +745,9 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev )
if( !psz_dev ) return NULL;
actual_dev= ToLocaleDup(psz_dev);
if ( vcdinfo_open(&p_vcdobj, &actual_dev, DRIVER_UNKNOWN, NULL) !=
VCDINFO_OPEN_VCD) {
if( vcdinfo_open(&p_vcdobj, &actual_dev, DRIVER_UNKNOWN, NULL) !=
VCDINFO_OPEN_VCD)
{
free(actual_dev);
return NULL;
}
......@@ -764,11 +757,13 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev )
Save summary info on tracks, segments and entries...
*/
if ( 0 < (p_vcdplayer->i_tracks = vcdinfo_get_num_tracks(p_vcdobj)) ) {
if ( 0 < (p_vcdplayer->i_tracks = vcdinfo_get_num_tracks(p_vcdobj)) )
{
p_vcdplayer->track = (vcdplayer_play_item_info_t *)
calloc(p_vcdplayer->i_tracks, sizeof(vcdplayer_play_item_info_t));
for (i=0; i<p_vcdplayer->i_tracks; i++) {
for (i=0; i<p_vcdplayer->i_tracks; i++)
{
unsigned int track_num=i+1;
p_vcdplayer->track[i].size =
vcdinfo_get_track_sect_count(p_vcdobj, track_num);
......@@ -778,26 +773,32 @@ vcd_Open( vlc_object_t *p_this, const char *psz_dev )
} else
p_vcdplayer->track = NULL;
if ( 0 < (p_vcdplayer->i_entries = vcdinfo_get_num_entries(p_vcdobj)) ) {
if( 0 < (p_vcdplayer->i_entries = vcdinfo_get_num_entries(p_vcdobj)) )
{
p_vcdplayer->entry = (vcdplayer_play_item_info_t *)
calloc(p_vcdplayer->i_entries, sizeof(vcdplayer_play_item_info_t));
for (i=0; i<p_vcdplayer->i_entries; i++) {
for (i=0; i<p_vcdplayer->i_entries; i++)
{
p_vcdplayer->entry[i].size =
vcdinfo_get_entry_sect_count(p_vcdobj, i);
p_vcdplayer->entry[i].start_LSN = vcdinfo_get_entry_lsn(p_vcdobj, i);
p_vcdplayer->entry[i].start_LSN =
vcdinfo_get_entry_lsn(p_vcdobj, i);
}
} else
p_vcdplayer->entry = NULL;
if ( 0 < (p_vcdplayer->i_segments = vcdinfo_get_num_segments(p_vcdobj)) ) {
if ( 0 < (p_vcdplayer->i_segments = vcdinfo_get_num_segments(p_vcdobj)) )
{
p_vcdplayer->segment = (vcdplayer_play_item_info_t *)
calloc(p_vcdplayer->i_segments, sizeof(vcdplayer_play_item_info_t));
for (i=0; i<p_vcdplayer->i_segments; i++) {
for (i=0; i<p_vcdplayer->i_segments; i++)
{
p_vcdplayer->segment[i].size =
vcdinfo_get_seg_sector_count(p_vcdobj, i);
p_vcdplayer->segment[i].start_LSN = vcdinfo_get_seg_lsn(p_vcdobj, i);
p_vcdplayer->segment[i].start_LSN =
vcdinfo_get_seg_lsn(p_vcdobj, i);
}
} else
p_vcdplayer->segment = NULL;
......@@ -815,11 +816,13 @@ VCDUpdateVar( access_t *p_access, int i_num, int i_action,
{
vlc_value_t val;
val.i_int = i_num;
if (p_access) {
if( p_access )
{
const vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_vcd_access->p_sys;
dbg_print( INPUT_DBG_PBC, "%s %d", p_debug_label, i_num );
}
if (p_label) {
if( p_label )
{
vlc_value_t text;
text.psz_string = p_label;
var_Change( p_access, p_varname, VLC_VAR_SETTEXT, &text, NULL );
......@@ -912,7 +915,8 @@ VCDOpen ( vlc_object_t *p_this )
/* Get track information. */
p_vcdplayer->i_tracks = vcdinfo_get_num_tracks(p_vcdplayer->vcd);
if( p_vcdplayer->i_tracks < 1 || CDIO_INVALID_TRACK == p_vcdplayer->i_tracks ) {
if( p_vcdplayer->i_tracks<1 || CDIO_INVALID_TRACK==p_vcdplayer->i_tracks )
{
vcdinfo_close( p_vcdplayer->vcd );
LOG_ERR ("no movie tracks found" );
goto err_exit;
......@@ -950,9 +954,8 @@ VCDOpen ( vlc_object_t *p_this )
p_access->psz_demux = strdup( "ps" );
#ifdef FIXED
if (play_single_item)
VCDFixupPlayList( p_access, p_vcd, psz_source, &itemid,
play_single_item );
if( play_single_item )
VCDFixupPlayList(p_access,p_vcd,psz_source,&itemid,play_single_item);
#endif
#ifdef FIXED
......@@ -1025,7 +1028,6 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
during the Open/Initialize call.
*/
case ACCESS_GET_META:
{
dbg_print( INPUT_DBG_EVENT, "get meta info" );
#if 0
if( p_vcdplayer->p_meta )
......@@ -1040,39 +1042,28 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
msg_Warn( p_access, "tried to copy NULL meta info" );
return VLC_SUCCESS;
}
return VLC_EGENERIC;
case ACCESS_CAN_SEEK:
case ACCESS_CAN_FASTSEEK:
case ACCESS_CAN_PAUSE:
case ACCESS_CAN_CONTROL_PACE:
{
bool *pb_bool = (bool*)va_arg( args, bool* );
dbg_print( INPUT_DBG_EVENT,
"seek/fastseek/pause/can_control_pace" );
*pb_bool = true;
*((bool*)va_arg( args, bool* )) = true;
return VLC_SUCCESS;
break;
}
/* */
case ACCESS_GET_PTS_DELAY:
{
int64_t *pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = var_GetInteger( p_access, MODULE_STRING "-caching" )
* MILLISECONDS_PER_SEC;
*(int64_t*)va_arg(args,int64_t *) = MILLISECONDS_PER_SEC *
var_GetInteger( p_access, MODULE_STRING "-caching" );
dbg_print( INPUT_DBG_EVENT, "GET PTS DELAY" );
return VLC_SUCCESS;
break;
}
/* */
case ACCESS_SET_PAUSE_STATE:
dbg_print( INPUT_DBG_EVENT, "SET PAUSE STATE" );
return VLC_SUCCESS;
break;
case ACCESS_GET_TITLE_INFO:
{
......@@ -1103,17 +1094,14 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
return VLC_SUCCESS;
}
*pi_int = p_vcdplayer->i_titles;
*ppp_title = malloc( sizeof( input_title_t **)
* p_vcdplayer->i_titles );
*ppp_title = malloc(sizeof(input_title_t **)*p_vcdplayer->i_titles);
if (!*ppp_title) return VLC_ENOMEM;
for( i = 0; i < p_vcdplayer->i_titles; i++ )
{
if ( p_vcdplayer->p_title[i] )
if( p_vcdplayer->p_title[i] )
(*ppp_title)[i] =
vlc_input_title_Duplicate( p_vcdplayer->p_title[i] );
}
vlc_input_title_Duplicate(p_vcdplayer->p_title[i]);
}
break;
......@@ -1126,7 +1114,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
vcdinfo_itemid_t itemid;
track_t i_track = i+1;
unsigned int i_entry =
vcdinfo_track_get_entry( p_vcdplayer->vcd, i_track);
vcdinfo_track_get_entry(p_vcdplayer->vcd,i_track);
if( i < p_vcdplayer->i_tracks )
{
......@@ -1137,20 +1125,19 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
}
else
{
/* FIXME! i_tracks+2 are Segments, but we need to
be able to figure out which segment of that.
i_tracks+1 is either Segments (if no LIDs) or
LIDs otherwise. Again need a way to get the LID
number. */
msg_Warn( p_access,
"Trying to set track (%u) beyond end of last track (%u).",
i+1, p_vcdplayer->i_tracks );
/* FIXME! i_tracks+2 are Segments, but we need to be able
to figure out which segment of that. i_tracks+1 is
either Segments (if no LIDs) or LIDs otherwise. Again
need a way to get the LID number. */
msg_Warn(p_access,"Trying to set track (%u) beyond end "
"of last track (%u).",i+1,p_vcdplayer->i_tracks);
return VLC_EGENERIC;
}
VCDSetOrigin(p_access,
vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i_entry),
i_track, &itemid );
vcdinfo_get_entry_lsn(p_vcdplayer->vcd,i_entry),
i_track, &itemid);
}
break;
......@@ -1165,10 +1152,9 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
track_t i_track = p_access->info.i_title+1;
lsn_t lsn;
/* FIXME! For now we are assuming titles are only
tracks and that track == title+1 and we the play
item is entries (not tracks or lids).
We need to generalize all of this.
/* FIXME! For now we are assuming titles are only tracks and
that track == title+1 and we the play item is entries (not
tracks or lids). We need to generalize all of this.
*/
if (i < p_vcdplayer->i_entries)
......@@ -1178,8 +1164,7 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
lsn = vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i);
} else if ( i < p_vcdplayer->i_entries + p_vcdplayer->i_lids )
{
p_vcdplayer->play_item.num = i
= i - p_vcdplayer->i_entries;
p_vcdplayer->play_item.num = i = i - p_vcdplayer->i_entries;
p_vcdplayer->play_item.type = VCDINFO_ITEM_TYPE_LID;
lsn = 0;
} else
......@@ -1190,9 +1175,8 @@ static int VCDControl( access_t *p_access, int i_query, va_list args )
lsn = vcdinfo_get_seg_lsn(p_vcdplayer->vcd, i);
}
VCDSetOrigin( p_access,
vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i),
i_track, &(p_vcdplayer->play_item) );
VCDSetOrigin(p_access,vcdinfo_get_entry_lsn(p_vcdplayer->vcd,i),
i_track,&(p_vcdplayer->play_item));
}
return VLC_SUCCESS;
}
......
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