mirror of
https://github.com/mpv-player/mpv
synced 2024-09-12 23:45:53 +02:00
mov_check_file 64bit support by Chris Bednar. also fixed co64 chunk and added warnings for 64bit files reading without largefiles support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4000 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
ae478fadb8
commit
082d9e80ba
@ -51,7 +51,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int id;
|
int id;
|
||||||
int type;
|
int type;
|
||||||
int pos;
|
off_t pos;
|
||||||
//
|
//
|
||||||
int timescale;
|
int timescale;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
@ -198,21 +198,34 @@ int mov_check_file(demuxer_t* demuxer){
|
|||||||
demuxer->priv=priv;
|
demuxer->priv=priv;
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
|
int skipped=8;
|
||||||
off_t len=stream_read_dword(demuxer->stream);
|
off_t len=stream_read_dword(demuxer->stream);
|
||||||
unsigned int id=stream_read_dword(demuxer->stream);
|
unsigned int id=stream_read_dword(demuxer->stream);
|
||||||
if(stream_eof(demuxer->stream)) break; // EOF
|
if(stream_eof(demuxer->stream)) break; // EOF
|
||||||
if(len<8) break; // invalid chunk
|
if (len == 1) /* real size is 64bits - cjb */
|
||||||
|
{
|
||||||
|
#ifndef _LARGEFILE_SOURCE
|
||||||
|
if (stream_read_dword(demuxer->stream) != 0)
|
||||||
|
mp_msg(MSGT_DEMUX, MSGL_WARN, "64bit file, but you've MPlayer compiled without LARGEFILE support!\n");
|
||||||
|
len = stream_read_dword(demuxer->stream);
|
||||||
|
#else
|
||||||
|
len = stream_read_qword(demuxer->stream);
|
||||||
|
#endif
|
||||||
|
skipped += 8;
|
||||||
|
}
|
||||||
|
else if(len<8) break; // invalid chunk
|
||||||
|
|
||||||
switch(id){
|
switch(id){
|
||||||
case MOV_FOURCC('m','o','o','v'):
|
case MOV_FOURCC('m','o','o','v'):
|
||||||
mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie header found!\n");
|
mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie header found!\n");
|
||||||
priv->moov_start=stream_tell(demuxer->stream);
|
priv->moov_start=stream_tell(demuxer->stream);
|
||||||
priv->moov_end=priv->moov_start+len-8;
|
priv->moov_end=priv->moov_start+len-skipped;
|
||||||
flags|=1;
|
flags|=1;
|
||||||
break;
|
break;
|
||||||
case MOV_FOURCC('m','d','a','t'):
|
case MOV_FOURCC('m','d','a','t'):
|
||||||
mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie DATA found!\n");
|
mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie DATA found!\n");
|
||||||
priv->mdat_start=stream_tell(demuxer->stream);
|
priv->mdat_start=stream_tell(demuxer->stream);
|
||||||
priv->mdat_end=priv->mdat_start+len-8;
|
priv->mdat_end=priv->mdat_start+len-skipped;
|
||||||
flags|=2;
|
flags|=2;
|
||||||
break;
|
break;
|
||||||
case MOV_FOURCC('f','r','e','e'):
|
case MOV_FOURCC('f','r','e','e'):
|
||||||
@ -226,7 +239,7 @@ int mov_check_file(demuxer_t* demuxer){
|
|||||||
id = bswap_32(id);
|
id = bswap_32(id);
|
||||||
mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
|
mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
|
||||||
}
|
}
|
||||||
if(!stream_skip(demuxer->stream,len-8)) break;
|
if(!stream_skip(demuxer->stream,len-skipped)) break;
|
||||||
++no;
|
++no;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,17 +442,12 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
|
|||||||
// read elements:
|
// read elements:
|
||||||
for(i=0;i<len;i++)
|
for(i=0;i<len;i++)
|
||||||
{
|
{
|
||||||
int len1=stream_read_dword(demuxer->stream);
|
#ifndef _LARGEFILE_SOURCE
|
||||||
int len2=stream_read_dword(demuxer->stream);
|
if (stream_read_dword(demuxer->stream) != 0)
|
||||||
|
|
||||||
mp_msg(MSGT_DEMUX, MSGL_DBG3, "Chunk #%d: len1=%d, len2=%d\n", i, len1, len2);
|
|
||||||
|
|
||||||
#ifndef _LARGEFILE_SOURCE /* is this right ?! -- alex */
|
|
||||||
if (len1)
|
|
||||||
mp_msg(MSGT_DEMUX, MSGL_WARN, "Chunk %d has got 64bit address, but you've MPlayer compiled without LARGEFILE support!\n", i);
|
mp_msg(MSGT_DEMUX, MSGL_WARN, "Chunk %d has got 64bit address, but you've MPlayer compiled without LARGEFILE support!\n", i);
|
||||||
trak->chunks[i].pos = len2;
|
trak->chunks[i].pos = stream_read_dword(demuxer->stream);
|
||||||
#else
|
#else
|
||||||
trak->chunks[i].pos = len1+len2; /* also off_t pos -> on 64bit platform off_t MUST be 64bit */
|
trak->chunks[i].pos = stream_read_qword(demuxer->stream);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user