mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:33:46 +01:00
nosound avi seeking fixed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1422 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
921d736240
commit
de654f5bfe
14
demux_avi.c
14
demux_avi.c
@ -126,12 +126,14 @@ int ret=0;
|
||||
do{
|
||||
int flags=0;
|
||||
AVIINDEXENTRY *idx=NULL;
|
||||
#if 0
|
||||
demux->filepos=stream_tell(demux->stream);
|
||||
if(demux->filepos>=demux->movi_end){
|
||||
demux->stream->eof=1;
|
||||
return 0;
|
||||
}
|
||||
if(stream_eof(demux->stream)) return 0;
|
||||
#endif
|
||||
if(demux->idx_size>0 && demux->idx_pos<demux->idx_size){
|
||||
unsigned int pos;
|
||||
|
||||
@ -155,7 +157,7 @@ do{
|
||||
|
||||
pos=idx->dwChunkOffset+demux->idx_offset;
|
||||
if(pos<demux->movi_start || pos>=demux->movi_end){
|
||||
printf("ChunkOffset out of range! current=0x%X idx=0x%X \n",demux->filepos,pos);
|
||||
printf("ChunkOffset out of range! idx=0x%X \n",pos);
|
||||
continue;
|
||||
}
|
||||
#if 0
|
||||
@ -164,7 +166,10 @@ do{
|
||||
}
|
||||
#endif
|
||||
stream_seek(demux->stream,pos);
|
||||
demux->filepos=stream_tell(demux->stream);
|
||||
id=stream_read_dword_le(demux->stream);
|
||||
if(stream_eof(demux->stream)) return 0; // EOF!
|
||||
|
||||
if(id!=idx->ckid){
|
||||
printf("ChunkID mismatch! raw=%.4s idx=%.4s \n",(char *)&id,(char *)&idx->ckid);
|
||||
continue;
|
||||
@ -178,8 +183,15 @@ do{
|
||||
}
|
||||
if(idx->dwFlags&AVIIF_KEYFRAME) flags=1;
|
||||
} else {
|
||||
demux->filepos=stream_tell(demux->stream);
|
||||
if(demux->filepos>=demux->movi_end){
|
||||
demux->stream->eof=1;
|
||||
return 0;
|
||||
}
|
||||
id=stream_read_dword_le(demux->stream);
|
||||
len=stream_read_dword_le(demux->stream);
|
||||
if(stream_eof(demux->stream)) return 0; // EOF!
|
||||
|
||||
if(id==mmioFOURCC('L','I','S','T')){
|
||||
id=stream_read_dword_le(demux->stream); // list type
|
||||
continue;
|
||||
|
@ -180,7 +180,10 @@ int ds_fill_buffer(demux_stream_t *ds){
|
||||
printf("(maybe you play a non-interleaved stream/file or video codec failed)\n");
|
||||
break;
|
||||
}
|
||||
if(!demux_fill_buffer(demux,ds)) break; // EOF
|
||||
if(!demux_fill_buffer(demux,ds)){
|
||||
if(verbose) printf("ds_fill_buffer()->demux_fill_buffer() failed\n");
|
||||
break; // EOF
|
||||
}
|
||||
}
|
||||
ds->buffer_pos=ds->buffer_size=0;
|
||||
ds->buffer=NULL;
|
||||
|
14
mplayer.c
14
mplayer.c
@ -1166,16 +1166,16 @@ if(1)
|
||||
videobuffer[videobuf_len+3]=0xFF;
|
||||
videobuf_len+=4;
|
||||
#endif
|
||||
if(!i) eof=1; // EOF
|
||||
if(!i) eof=2; // EOF
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//if(i==0x100) in_frame=1; // picture startcode
|
||||
if(i>=0x101 && i<0x1B0) in_frame=1; // picture startcode
|
||||
else if(!i){ eof=1; break;} // EOF
|
||||
else if(!i){ eof=3; break;} // EOF
|
||||
}
|
||||
if(grab_frames==2 && (i==0x1B3 || i==0x1B8)) grab_frames=1;
|
||||
if(!read_video_packet(d_video)){ eof=1; break;} // EOF
|
||||
if(!read_video_packet(d_video)){ eof=4; break;} // EOF
|
||||
//printf("read packet 0x%X, len=%d\n",i,videobuf_len);
|
||||
if(sh_video->codec->driver!=VFM_MPEG){
|
||||
// if not libmpeg2:
|
||||
@ -1212,7 +1212,7 @@ if(1)
|
||||
// frame-based file formats: (AVI,ASF,MOV)
|
||||
unsigned char* start=NULL;
|
||||
int in_size=ds_get_packet(d_video,&start);
|
||||
if(in_size<0){ eof=1;break;}
|
||||
if(in_size<0){ eof=5;break;}
|
||||
if(in_size>max_framesize) max_framesize=in_size;
|
||||
blit_frame=decode_video(video_out,sh_video,start,in_size,drop_frame);
|
||||
}
|
||||
@ -1545,7 +1545,7 @@ if(1)
|
||||
rel_seek_secs=0;
|
||||
|
||||
//================= Update OSD ====================
|
||||
{ if(osd_level>=2){
|
||||
if(osd_level>=2){
|
||||
int pts=d_video->pts;
|
||||
if(pts==osd_last_pts-1) ++pts; else osd_last_pts=pts;
|
||||
vo_osd_text=osd_text_buffer;
|
||||
@ -1581,10 +1581,10 @@ if(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // while(!eof)
|
||||
|
||||
if(verbose) printf("EOF code: %d \n",eof);
|
||||
|
||||
exit_player("End of file");
|
||||
}
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user