summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_ty.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-09-14 16:21:12 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-09-14 16:21:12 +0000
commit1498c9b7d0f83d0deb3f0a79f09d907d2a400fc7 (patch)
tree4d418cfeb65135c68ed0acf7ca8a28ac719969ad /libmpdemux/demux_ty.c
parent55dac8bb6f394016a9736199668ac5c56eb6f558 (diff)
downloadmpv-1498c9b7d0f83d0deb3f0a79f09d907d2a400fc7.tar.bz2
mpv-1498c9b7d0f83d0deb3f0a79f09d907d2a400fc7.tar.xz
Small simplifications
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24470 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_ty.c')
-rw-r--r--libmpdemux/demux_ty.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libmpdemux/demux_ty.c b/libmpdemux/demux_ty.c
index d820059ddd..14a9b4f742 100644
--- a/libmpdemux/demux_ty.c
+++ b/libmpdemux/demux_ty.c
@@ -140,7 +140,6 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
char *sizestr;
int size;
int count;
- int blocks;
int done;
off_t offset;
off_t totalsize;
@@ -185,9 +184,8 @@ static int ty_tmf_filetoparts( demuxer_t *demux, TiVoInfo *tivo )
sizestr[11] = 0;
size = strtol(sizestr, NULL, 8);
- blocks = size / 512;
- if ( size % 512 > 0 ) blocks++;
- skip = ( blocks + 1 ) * 512;
+ // size rounded up to blocks + header size
+ skip = 512 + ((size + 511) & ~511);
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 ].fileSize = size;
tivo->tmfparts[ parts ].startOffset = offset + 512;
- tivo->tmfparts[ parts ].chunks =
- tivo->tmfparts[ parts ].fileSize / CHUNKSIZE;
+ tivo->tmfparts[ parts ].chunks = size / CHUNKSIZE;
mp_msg
(
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++ )
{
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,
"tmf_filetoparts():total size %"PRId64"\n", (int64_t)tivo->tmf_totalsize );