[MPlayer-dev-eng] [PATCH] small semplification in stream_seek()

Ivan Kalvachev ikalvachev at gmail.com
Tue Feb 27 23:58:42 CET 2007


2007/2/28, Nico Sabbi <nicola_sabbi at fastwebnet.it>:
> Ivan Kalvachev wrote:
> > 2007/2/27, Nico Sabbi <nicola_sabbi at fastwebnet.it>:
> >
> >> As discussed in another thread the seeking can be simplified ignoring the
> >> definition of _LARGEFILE_SOURCE_
> >> Paternity of this patch belongs to Zuxy.
> >
> >
> > Are you talking about "[MPlayer-dev-eng] [PATCH] Small cleanup in
> > demux_mpg.c" thread?
>
> yes
>
> >
> >> If no one objects I'll commit tomorrow
> >
> >
> > Not really objection...
> > I just wonder do you know why s->stream_size is ignored  when
> > s->type==STREAMTYPE_STREAM.
>
> dunno
>
> >
> > I ask this because in the patch this behavior is removed.
>
> why removed? STREAMTYPE_STREAM used STREAM_BUFFER_SIZE like
> all other streams (except block-based ones) :
>
[skip]
Index: stream.c
===================================================================
--- stream.c    (revisione 22224)
+++ stream.c    (copia locale)
@@ -299,26 +299,10 @@
     return 1;
   }
@
@here we remove the switch/case
@
-  switch(s->type){
-  case STREAMTYPE_STREAM:
-#ifdef _LARGEFILE_SOURCE
-    newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
-#else
-    newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
-#endif
-  default:
@
@the above block is not added again, it is removed completely
@
-    // Round on sector size
-    if(s->sector_size)
-      newpos=(pos/s->sector_size)*s->sector_size;
-    else { // Otherwise on the buffer size
-#ifdef _LARGEFILE_SOURCE
-      newpos=pos&(~((long long)STREAM_BUFFER_SIZE-1));break;
-#else
-      newpos=pos&(~(STREAM_BUFFER_SIZE-1));break;
-#endif
-    }
-    break;
-  }
@these are the only added lines, the switch/case is completely
removed, and nothing checks
@for STREAMTYPE_STREAM
+  if(s->sector_size)
+      newpos = (pos/s->sector_size)*s->sector_size;
+  else
+      newpos = pos&(~((off_t)STREAM_BUFFER_SIZE-1));

 if( mp_msg_test(MSGT_STREAM,MSGL_DBG3) ){
   mp_msg(MSGT_STREAM,MSGL_DBG3, "s->pos=%"PRIX64"  newpos=%"PRIX64"
new_bufpos=%"PRIX64"  buflen=%X  \n",

=========================
You see the patch removes the switch/case, including the check for
STREAMTYPE_STREAM.

I ask if it is intensionally or it just slipped away.



More information about the MPlayer-dev-eng mailing list