Update of /cvsroot/mplayer/main In directory usw-pr-cvs1:/tmp/cvs-serv1762 Modified Files: mplayer.c Log Message: sub control optimized Index: mplayer.c =================================================================== RCS file: /cvsroot/mplayer/main/mplayer.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -r1.72 -r1.73 *** mplayer.c 2001/04/16 03:31:34 1.72 --- mplayer.c 2001/04/17 00:08:56 1.73 *************** *** 95,104 **** static subtitle* subtitles=NULL; ! void find_sub(unsigned long key){ int i,j; ! if(current_sub<0 || current_sub>=sub_num) current_sub=0; ! vo_sub=&subtitles[current_sub]; ! if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! // use logarithmic search: i=0;j=sub_num-1; --- 95,129 ---- static subtitle* subtitles=NULL; + static int nosub_range_start=-1; + static int nosub_range_end=-1; ! void find_sub(int key){ int i,j; ! if(vo_sub){ ! if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! ! } else { ! if(key>nosub_range_start && key<nosub_range_end) return; // OK! ! } ! // sub changed! ! ! // printf("\r---- sub changed ----\n"); ! ! // check next sub. ! if(current_sub>=0 && current_sub+1<sub_num){ ! if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ ! // no sub ! nosub_range_start=subtitles[current_sub].end; ! nosub_range_end=subtitles[current_sub+1].start; ! vo_sub=NULL; ! return; ! } ! // next sub? ! ++current_sub; ! vo_sub=&subtitles[current_sub]; ! if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! ! } ! ! // printf("\r---- sub log search... ----\n"); ! // use logarithmic search: i=0;j=sub_num-1; *************** *** 106,118 **** while(j>=i){ current_sub=(i+j+1)/2; ! if(key<subtitles[current_sub].start) ! j=current_sub-1; ! else ! if(key>subtitles[current_sub].end) ! i=current_sub+1; ! else break; // found! } ! vo_sub=&subtitles[current_sub]; ! if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! vo_sub=NULL; // no sub here } --- 131,183 ---- while(j>=i){ current_sub=(i+j+1)/2; ! vo_sub=&subtitles[current_sub]; ! if(key<vo_sub->start) j=current_sub-1; ! else if(key>vo_sub->end) i=current_sub+1; ! else return; // found! } ! // if(key>=vo_sub->start && key<=vo_sub->end) return; // OK! ! ! // check where are we... ! if(key<vo_sub->start){ ! if(current_sub<=0){ ! // before the first sub ! nosub_range_start=key-1; // tricky ! nosub_range_end=vo_sub->start; ! // printf("FIRST... key=%d end=%d \n",key,vo_sub->start); ! vo_sub=NULL; ! return; ! } ! --current_sub; ! if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ ! // no sub ! nosub_range_start=subtitles[current_sub].end; ! nosub_range_end=subtitles[current_sub+1].start; ! // printf("No sub... 1 \n"); ! vo_sub=NULL; ! return; ! } ! printf("HEH???? "); ! } else { ! if(key<=vo_sub->end) printf("JAJJ! "); else ! if(current_sub+1>=sub_num){ ! // at the end? ! nosub_range_start=vo_sub->end; ! nosub_range_end=0x7FFFFFFF; // MAXINT ! // printf("END!?\n"); ! vo_sub=NULL; ! return; ! } else ! if(key>subtitles[current_sub].end && key<subtitles[current_sub+1].start){ ! // no sub ! nosub_range_start=subtitles[current_sub].end; ! nosub_range_end=subtitles[current_sub+1].start; ! // printf("No sub... 2 \n"); ! vo_sub=NULL; ! return; ! } ! } ! ! printf("SUB ERROR: %d ? %d --- %d [%d] \n",key,vo_sub->start,vo_sub->end,current_sub); ! vo_sub=NULL; // no sub here } *************** *** 1920,1924 **** --- 1985,1991 ---- if(subtitles){ if(sub_fps==0) sub_fps=sh_video->fps; + current_module="find_sub"; find_sub(sub_uses_time?(100*(v_pts+sub_delay)):((v_pts+sub_delay)*sub_fps)); // FIXME! frame counter... + current_module=NULL; } } _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
participants (1)
-
GEREOFFY