Small simplifications

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24470 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-09-14 16:21:12 +00:00
parent 55dac8bb6f
commit 1498c9b7d0
1 changed files with 4 additions and 7 deletions

View File

@ -140,7 +140,6 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
char *sizestr; char *sizestr;
int size; int size;
int count; int count;
int blocks;
int done; int done;
off_t offset; off_t offset;
off_t totalsize; off_t totalsize;
@ -185,9 +184,8 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
sizestr[11] = 0; sizestr[11] = 0;
size = strtol(sizestr, NULL, 8); size = strtol(sizestr, NULL, 8);
blocks = size / 512; // size rounded up to blocks + header size
if ( size % 512 > 0 ) blocks++; skip = 512 + ((size + 511) & ~511);
skip = ( blocks + 1 ) * 512;
if ( offset + skip > totalsize ) if ( offset + skip > totalsize )
{ {
@ -204,8 +202,7 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
tivo->tmfparts[ parts ].fileNo = parts; tivo->tmfparts[ parts ].fileNo = parts;
tivo->tmfparts[ parts ].fileSize = size; tivo->tmfparts[ parts ].fileSize = size;
tivo->tmfparts[ parts ].startOffset = offset + 512; tivo->tmfparts[ parts ].startOffset = offset + 512;
tivo->tmfparts[ parts ].chunks = tivo->tmfparts[ parts ].chunks = size / CHUNKSIZE;
tivo->tmfparts[ parts ].fileSize / CHUNKSIZE;
mp_msg mp_msg
( (
MSGT_DEMUX, MSGL_DBG3, MSGT_DEMUX, MSGL_DBG3,
@ -251,7 +248,7 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
for( index = 0 ; index < tivo->tmf_totalparts ; index++ ) for( index = 0 ; index < tivo->tmf_totalparts ; index++ )
{ {
tivo->tmf_totalsize += tivo->tmfparts[ index ].fileSize; tivo->tmf_totalsize += tivo->tmfparts[ index ].fileSize;
tivo->tmf_totalchunks += tivo->tmfparts[ index ].fileSize / CHUNKSIZE; tivo->tmf_totalchunks += tivo->tmfparts[ index ].chunks;
} }
mp_msg( MSGT_DEMUX, MSGL_DBG3, mp_msg( MSGT_DEMUX, MSGL_DBG3,
"tmf_filetoparts():total size %"PRId64"\n", (int64_t)tivo->tmf_totalsize ); "tmf_filetoparts():total size %"PRId64"\n", (int64_t)tivo->tmf_totalsize );