1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00

added demuxer->seekable flag to generalize seeking ability test

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1624 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-08-22 16:42:37 +00:00
parent 766e6011ba
commit a81e5493dd
3 changed files with 11 additions and 5 deletions

View File

@ -433,6 +433,7 @@ demuxer_t* demux_open_avi(demuxer_t* demuxer){
priv->idx_pos_v=demuxer->movi_start;
pts_from_bps=1; // force BPS sync!
}
demuxer->seekable=0;
}
if(!ds_fill_buffer(d_video)){
mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: missing video stream!? contact the author, it may be a bug :(\n");

View File

@ -51,6 +51,7 @@ demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){
d->stream=stream;
d->movi_start=stream->start_pos;
d->movi_end=stream->end_pos;
d->seekable=1;
d->synced=0;
d->filepos=0;
d->audio=new_demuxer_stream(d,a_id);
@ -413,7 +414,7 @@ switch(file_format){
break;
}
case DEMUXER_TYPE_AVI: {
return demux_open_avi(demuxer);
return (demuxer_t*) demux_open_avi(demuxer);
// break;
}
case DEMUXER_TYPE_ASF: {
@ -492,10 +493,13 @@ int demux_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){
sh_audio_t *sh_audio=d_audio->sh;
sh_video_t *sh_video=d_video->sh;
//if(demuxer->file_format==DEMUXER_TYPE_AVI && demuxer->idx_size<=0){
// printf("Can't seek in raw .AVI streams! (index required, try with the -idx switch!) \n");
// return 0;
//}
if(!demuxer->seekable){
if(demuxer->file_format==DEMUXER_TYPE_AVI)
mp_msg(MSGT_SEEK,MSGL_WARN,"Can't seek in raw .AVI streams! (index required, try with the -idx switch!) \n");
else
mp_msg(MSGT_SEEK,MSGL_WARN,"Can't seek in this file! \n");
return 0;
}
// clear demux buffers:
if(sh_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;}

View File

@ -62,6 +62,7 @@ typedef struct demuxer_st {
int file_format; // file format: mpeg/avi/asf
off_t movi_start;
off_t movi_end;
int seekable; // flag
//
demux_stream_t *audio; // audio buffer/demuxer
demux_stream_t *video; // video buffer/demuxer