[Mplayer-users] a question about fast forward

Arpi arpi at thot.banki.hu
Tue Jul 31 20:59:11 CEST 2001


Hi,

> My name is Przemek, I'm from Poland.
> I'm sorry for my poor English, I haven't used it for ages.
> I have Red Hat Linux 7.0, kernel 2.2.19, gcc 2.95.3, ( and Duron 750 processor).
> I got mplayer sources from CVS on 24th July.
> I tried to play one avi/DivX movie.
> I had problems with sound and I set ni = yes.
> The mplayer worked well but when I tried move forward 10 minutes
> it stopped for a minute.
> On other files moving forward was ok, but for this one was very slow.
> I tried to find the problem.
> I found that all this time program spent in loop in
> the demux_avi_fill_buffer_ni() function.
> Here is some lines from index of this avi file:
>     0:  01wb    10  00000004  7225
>     1:  00dc    10  00001C46  1162
>     2:  01wb    10  000020D8  8068
>     3:  00dc     0  00004064  117
>     4:  00dc     0  000040E2  117
>     5:  00dc     0  00004160  117
> the video stream is divided in very small packages, and every single package
> was skipped in one call of the demux_avi_read_packet(). 
yes, it's a limitation of my avi seeking code. it was desigend for
interleaved streams. it works with -ni streams too, but it skips the
whole stream at seeking :(
i planned to fix it when i wrote it, but i already forget :(

i have to make different seeking code for ni streams.

> I added one condition to the demux_avi_fill_buffer_ni() :
> (...)
> >   if((skip_video_frames>0) && \
> >      ds && (ds==demux->video) && \
> >      (demux_avi_select_stream(demux,((AVIINDEXENTRY *)demux->idx)[idx_pos].ckid)    --skip_video_frames;
> >     ret=0;
> >   } else {
>   if(demux->idx_size>0 && idx_pos<demux->idx_size){
> (...)
>   } else return 0;
>   ret=demux_avi_read_packet(demux,id,len,idx_pos,flags);
> > }
>       if(!ret && skip_video_frames<=0)
> (...)
> and moving forward works faster. When it skips package it doesn't call
> the demux_avi_read_packet() function.
> 
> In the begginning of the demux_avi_fill_buffer_ni() I saw code:
> 
>   if(ds==demux->video) idx_pos=demux->idx_pos_a++; else
>   if(ds==demux->audio) idx_pos=demux->idx_pos_v++; else
>                        idx_pos=demux->idx_pos++;
> 
> It looks like a bug, if there is the video stream it gets index of
> package of audio stream and index of package of video stream for audio stream.
right. silly bug :( thanks, i'll fix.
btw it works, as this is the only place where idx_pos_a and idx_pos_v are
used different way (currently).

> I have a question of the main function in mplayer.c, 
it's demuxer.c

> why in the code block beggining of 'switch(file_format)' and 'case DEMUXER_TYPE_AVI:'
> is 'demuxer->idx_pos_v' set two times, second time to position of package
> of audio stream ?

do you mean this: ?
  demuxer->idx_pos=0;
  demuxer->idx_pos_a=0;
  demuxer->idx_pos_v=0;

it's normal. i set every steram pointers to the beginning of the file.
for interleaved files (99% of avi files) _a and _v variables aren't used.
for non-interleaved (-ni) files they are set by the demuxer.
for ni, i could calculate position from index table, it's right.
but i'm lazy, and you can nitoce that many "HACK!!!" commenst in teh -ni
code. it wasn't well-written, unfortunately. just hacked together to work.
as it's used for only a few movies, i don't care. i'll rewrite that stuff
later.

but thanks for the note, i already forget that it's unfinished code. :(


A'rpi / Astral & ESP-team

--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu

_______________________________________________
Mplayer-users mailing list
Mplayer-users at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-users



More information about the MPlayer-users mailing list