[MPlayer-dev-eng] Re: Prefetching/buffering files

Anil Nambiar nambiara at sharpsec.com
Fri Sep 2 23:18:05 CEST 2005


Diego Biurrun <diego <at> biurrun.de> writes:

> 
> On Fri, Sep 02, 2005 at 02:15:35PM -0400, Nambiar, Anil wrote:
> >             In demuxer.c I changed the code in function "ds_fill_buffer". It
> > checks for packets and then performs read if no packet is available. I
> > changed it to always read and then perform a check. This was there is some
> > prefetching or buffering of data, before it is actually needed. It
> > drastically reduced the frame drops. I have tested the change with a lot of
> > files and have not observed any sync loss. 
> 
> OK, let's see your patch then.
> 
> Diego
> 

Sorry for the previous post, I had reversed the files. Here is the patch

--- ../test/arm/MPlayer-1.0pre7/libmpdemux/demuxer.c	2005-04-03 
10:08:26.000000000 -0400
+++ mplayer/libmpdemux/demuxer.c	2005-09-02 13:59:51.000000000 -0400
@@ -21,6 +21,7 @@
 #include "../libaf/af_format.h"
 #include "../libvo/fastmemcpy.h"
 
+
 // Should be set to 1 by demux module if ids it passes to new_sh_audio and
 // new_sh_video don't match aids and vids it accepts from the command line
 int demux_aid_vid_mismatch = 0;
@@ -77,9 +78,9 @@ demuxer_t* new_demuxer(stream_t *stream,
 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
     if(id > MAX_A_STREAMS-1 || id < 0)
     {
-	mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested audio stream id overflow (%d > 
%d)\n",
-	    id, MAX_A_STREAMS);
-	return NULL;
+    mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested audio stream id overflow (%d > %d)
\n",
+        id, MAX_A_STREAMS);
+    return NULL;
     }
     if(demuxer->a_streams[id]){
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_AudioStreamRedefined,id);
@@ -108,9 +109,9 @@ void free_sh_audio(sh_audio_t* sh){
 sh_video_t* new_sh_video(demuxer_t *demuxer,int id){
     if(id > MAX_V_STREAMS-1 || id < 0)
     {
-	mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested video stream id overflow (%d > 
%d)\n",
-	    id, MAX_V_STREAMS);
-	return NULL;
+    mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested video stream id overflow (%d > %d)
\n",
+        id, MAX_V_STREAMS);
+    return NULL;
     }
     if(demuxer->v_streams[id]){
         mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_VideoStreamRedefined,id);
@@ -201,7 +202,7 @@ void free_demuxer(demuxer_t *demuxer){
       demux_close_ty(demuxer); break;
 #if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2))
     case DEMUXER_TYPE_TV:
-	demux_close_tv(demuxer); break;
+    demux_close_tv(demuxer); break;
 #endif
 #ifdef HAVE_LIBDV095
     case DEMUXER_TYPE_RAWDV:
@@ -225,7 +226,7 @@ void free_demuxer(demuxer_t *demuxer){
       demux_close_smjpeg(demuxer); break;
     case DEMUXER_TYPE_DEMUXERS:
       demux_close_demuxers(demuxer); break;
-    case DEMUXER_TYPE_AVI: 
+    case DEMUXER_TYPE_AVI:
     case DEMUXER_TYPE_AVI_NI:
     case DEMUXER_TYPE_AVI_NINI:
       demux_close_avi(demuxer); break;
@@ -258,9 +259,9 @@ void free_demuxer(demuxer_t *demuxer){
     }
     // free streams:
     for(i = 0; i < MAX_A_STREAMS; i++)
-	if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]);
+    if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]);
     for(i = 0; i < MAX_V_STREAMS; i++)
-	if(demuxer->v_streams[i]) free_sh_video(demuxer->v_streams[i]);
+    if(demuxer->v_streams[i]) free_sh_video(demuxer->v_streams[i]);
     //if(sh_audio) free_sh_audio(sh_audio);
     //if(sh_video) free_sh_video(sh_video);
     // free demuxers:
@@ -269,7 +270,7 @@ void free_demuxer(demuxer_t *demuxer){
     free_demuxer_stream(demuxer->sub);
     if(demuxer->info) {
       for(i=0;demuxer->info[i] != NULL; i++)
-	free(demuxer->info[i]);
+    free(demuxer->info[i]);
       free(demuxer->info);
     }
     free(demuxer);
@@ -298,9 +299,11 @@ void ds_add_packet(demux_stream_t *ds,de
 }
 
 void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float 
pts,off_t pos,int flags){
+    int len1;
     demux_packet_t* dp=new_demux_packet(len);
-    len = stream_read(stream,dp->buffer,len);
-    resize_demux_packet(dp, len);
+    len1 = stream_read(stream,dp->buffer,len);
+    if(len != len1)
+        resize_demux_packet(dp, len1);
     dp->pts=pts; //(float)pts/90000.0f;
     dp->pos=pos;
     dp->flags=flags;
@@ -401,8 +404,8 @@ int demux_fill_buffer(demuxer_t *demux,d
     case DEMUXER_TYPE_GIF: return demux_gif_fill_buffer(demux);
 #endif
     case DEMUXER_TYPE_LMLM4: return demux_lmlm4_fill_buffer(demux);
-    case DEMUXER_TYPE_MPEG_TS: 
-	return demux_ts_fill_buffer(demux);
+    case DEMUXER_TYPE_MPEG_TS:
+    return demux_ts_fill_buffer(demux);
     case DEMUXER_TYPE_REALAUDIO: return demux_ra_fill_buffer(demux);
     case DEMUXER_TYPE_VQF: return demux_vqf_fill_buffer(demux);
 #ifdef USE_LIBAVFORMAT
@@ -428,6 +431,24 @@ int ds_fill_buffer(demux_stream_t *ds){
                          mp_dbg(MSGT_DEMUXER,MSGL_DBG3,"ds_fill_buffer(unknown 
0x%X) called\n",(unsigned int)ds);
   }
   while(1){
+    if(demux->audio->packs>=MAX_PACKS || demux->audio->bytes>=MAX_PACK_BYTES){
+      mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyAudioInBuffer,demux->audio-
>packs,demux->audio->bytes);
+      mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
+      break;
+    }
+    if(demux->video->packs>=MAX_PACKS || demux->video->bytes>=MAX_PACK_BYTES){
+      mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyVideoInBuffer,demux->video-
>packs,demux->video->bytes);
+      mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
+      break;
+    }
+    if(!demux_fill_buffer(demux,ds)){
+        if(ds->packs <= 0)
+        {
+
+           mp_dbg(MSGT_DEMUXER,MSGL_DBG2,"ds_fill_buffer()->demux_fill_buffer
() failed\n");
+           break; // EOF
+        }
+    }
     if(ds->packs){
       demux_packet_t *p=ds->first;
       // copy useful data:
@@ -451,20 +472,6 @@ int ds_fill_buffer(demux_stream_t *ds){
       --ds->packs;
       return 1; //ds->buffer_size;
     }
-    if(demux->audio->packs>=MAX_PACKS || demux->audio->bytes>=MAX_PACK_BYTES){
-      mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyAudioInBuffer,demux->audio-
>packs,demux->audio->bytes);
-      mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
-      break;
-    }
-    if(demux->video->packs>=MAX_PACKS || demux->video->bytes>=MAX_PACK_BYTES){
-      mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_TooManyVideoInBuffer,demux->video-
>packs,demux->video->bytes);
-      mp_msg(MSGT_DEMUXER,MSGL_HINT,MSGTR_MaybeNI);
-      break;
-    }
-    if(!demux_fill_buffer(demux,ds)){
-       mp_dbg(MSGT_DEMUXER,MSGL_DBG2,"ds_fill_buffer()->demux_fill_buffer() 
failed\n");
-       break; // EOF
-    }
   }
   ds->buffer_pos=ds->buffer_size=0;
   ds->buffer=NULL;
@@ -730,14 +737,14 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
     if((id==mmioFOURCC('R','I','F','F')) || (id==mmioFOURCC('O','N','2',' '))){
       stream_read_dword_le(demuxer->stream); //filesize
       id=stream_read_dword_le(demuxer->stream); // "AVI "
-      if(id==formtypeAVI){ 
+      if(id==formtypeAVI){
         mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"AVI");
         file_format=DEMUXER_TYPE_AVI;
-      }	
-      if(id==mmioFOURCC('O','N','2','f')){ 
+      }
+      if(id==mmioFOURCC('O','N','2','f')){
         mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"ON2 AVI");
         file_format=DEMUXER_TYPE_AVI;
-      }	
+      }
     }
     if (file_format==DEMUXER_TYPE_UNKNOWN) {
       free_demuxer(demuxer);
@@ -893,7 +900,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
     stream_seek(demuxer->stream, 4);
     id=stream_read_word_le(demuxer->stream);
     // check for the FLI file magic number
-    if((id==0xAF11) || (id==0xAF12)){ 
+    if((id==0xAF11) || (id==0xAF12)){
       mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"FLI");
       file_format=DEMUXER_TYPE_FLI;
     } else {
@@ -908,7 +915,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
   {
     int signature=stream_read_fourcc(demuxer->stream);
     // check for the FLI file magic number
-    if(signature==mmioFOURCC('F', 'I', 'L', 'M')){ 
+    if(signature==mmioFOURCC('F', 'I', 'L', 'M')){
       mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"FILM");
       file_format=DEMUXER_TYPE_FILM;
     } else {
@@ -969,25 +976,25 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
 #endif
 //=============== Try to open as PVA file: =================
 if(file_format == DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_PVA){
-	demuxer=new_demuxer
(stream,DEMUXER_TYPE_PVA,audio_id,video_id,dvdsub_id);
-	if(pva_check_file(demuxer)) {
-		mp_msg
(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"PVA");
-		file_format=DEMUXER_TYPE_PVA;
-	} else {
-		free_demuxer(demuxer);
-		demuxer=NULL;
-	}
+    demuxer=new_demuxer(stream,DEMUXER_TYPE_PVA,audio_id,video_id,dvdsub_id);
+    if(pva_check_file(demuxer)) {
+        mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"PVA");
+        file_format=DEMUXER_TYPE_PVA;
+    } else {
+        free_demuxer(demuxer);
+        demuxer=NULL;
+    }
 }
 //=============== Try to open as MPEG-TS file: =================
 if(file_format == DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_MPEG_TS){
-	demuxer=new_demuxer
(stream,DEMUXER_TYPE_MPEG_TS,audio_id,video_id,dvdsub_id);
-	if(ts_check_file(demuxer)) {
-		mp_msg
(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"TS");
-		file_format=DEMUXER_TYPE_MPEG_TS;
-	} else {
-		free_demuxer(demuxer);
-		demuxer=NULL;
-	}
+    demuxer=new_demuxer
(stream,DEMUXER_TYPE_MPEG_TS,audio_id,video_id,dvdsub_id);
+    if(ts_check_file(demuxer)) {
+        mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"TS");
+        file_format=DEMUXER_TYPE_MPEG_TS;
+    } else {
+        free_demuxer(demuxer);
+        demuxer=NULL;
+    }
 }
 //=============== Try to open as LMLM4 file: =================
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_LMLM4){
@@ -1008,7 +1015,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
  file_format=DEMUXER_TYPE_UNKNOWN;
  while(pes>=0){
   demuxer=new_demuxer(stream,DEMUXER_TYPE_MPEG_PS,audio_id,video_id,dvdsub_id);
-  
+
   // try to pre-detect PES:
   tmppos=stream_tell(demuxer->stream);
   tmp=stream_read_dword(demuxer->stream);
@@ -1017,7 +1024,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
       if(tmp>1 && tmp<=2048) pes=0; // demuxer->synced=3; // PES...
   }
   stream_seek(demuxer->stream,tmppos);
-  
+
   if(!pes) demuxer->synced=3; // hack!
 
   num_elementary_packets100=0;
@@ -1042,17 +1049,17 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
     file_format=DEMUXER_TYPE_MPEG_PS;
   } else {
     mp_msg(MSGT_DEMUX,MSGL_V,"MPEG packet stats: p100: %d  p101: %d p1B6: %d 
p12x: %d sli: %d a: %d b: %d c: %d idr: %d sps: %d pps: %d PES: %d  MP3: %d \n",
-	num_elementary_packets100,num_elementary_packets101,
-	num_elementary_packets1B6,num_elementary_packets12x,
-	num_h264_slice, num_h264_dpa,
-	num_h264_dpb, num_h264_dpc=0,
-	num_h264_idr,  num_h264_sps=0,
-	num_h264_pps,
-	num_elementary_packetsPES,num_mp3audio_packets);
+    num_elementary_packets100,num_elementary_packets101,
+    num_elementary_packets1B6,num_elementary_packets12x,
+    num_h264_slice, num_h264_dpa,
+    num_h264_dpb, num_h264_dpc=0,
+    num_h264_idr,  num_h264_sps=0,
+    num_h264_pps,
+    num_elementary_packetsPES,num_mp3audio_packets);
 //MPEG packet stats: p100: 458  p101: 458  PES: 0  MP3: 1103  (.m2v)
     if(num_mp3audio_packets>50 && 
num_mp3audio_packets>2*num_elementary_packets100
-	&& abs(num_elementary_packets100-num_elementary_packets101)>2)
-	break; // it's .MP3
+    && abs(num_elementary_packets100-num_elementary_packets101)>2)
+    break; // it's .MP3
     // some hack to get meaningfull error messages to our unhappy users:
     if(num_elementary_packets100>=2 && num_elementary_packets101>=2 &&
        abs(num_elementary_packets101+8-num_elementary_packets100)<16){
@@ -1060,7 +1067,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
         --pes;continue; // tricky...
       }
       file_format=DEMUXER_TYPE_MPEG_ES; //  <-- hack is here :)
-    } else 
+    } else
 #if 1
     // fuzzy mpeg4-es detection. do NOT enable without heavy testing of mpeg 
formats detection!
     if(num_elementary_packets1B6>3 && num_elementary_packets12x>=1 &&
@@ -1071,7 +1078,7 @@ if(file_format==DEMUXER_TYPE_UNKNOWN || 
 #endif
 #if 1
     // fuzzy h264-es detection. do NOT enable without heavy testing of mpeg 
formats detection!
-    if((num_h264_slice>3 || (num_h264_dpa>3 && num_h264_dpb>3 && 
num_h264_dpc>3)) && 
+    if((num_h264_slice>3 || (num_h264_dpa>3 && num_h264_dpb>3 && 
num_h264_dpc>3)) &&
        /* FIXME num_h264_sps>=1 && */ num_h264_pps>=1 && num_h264_idr>=1 &&
        num_elementary_packets1B6==0 && num_elementary_packetsPES==0 &&
        demuxer->synced<2){
@@ -1102,11 +1109,11 @@ if(file_format==DEMUXER_TYPE_MPEG_ES || 
     demuxer = NULL;
   } else {
     switch(file_format){
-    case DEMUXER_TYPE_MPEG_ES: 
+    case DEMUXER_TYPE_MPEG_ES:
         mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat, "MPEG-
ES"); break;
-    case DEMUXER_TYPE_MPEG4_ES: 
+    case DEMUXER_TYPE_MPEG4_ES:
         mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat, "MPEG4-
ES"); break;
-    case DEMUXER_TYPE_H264_ES: 
+    case DEMUXER_TYPE_H264_ES:
         mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat, "H264-
ES"); break;
     }
   }
@@ -1256,14 +1263,14 @@ switch(file_format){
        s = new_ds_stream(demuxer->audio);
        od = new_demuxer(s,DEMUXER_TYPE_OGG,-1,-2,-2);
        if(!demux_ogg_open(od)) {
-	 mp_msg( MSGT_DEMUXER,MSGL_ERR,MSGTR_ErrorOpeningOGGDemuxer);
-	 free_stream(s);
-	 demuxer->audio->id = -2;
+     mp_msg( MSGT_DEMUXER,MSGL_ERR,MSGTR_ErrorOpeningOGGDemuxer);
+     free_stream(s);
+     demuxer->audio->id = -2;
        } else
-	 demuxer = new_demuxers_demuxer(demuxer,od,demuxer);
+     demuxer = new_demuxers_demuxer(demuxer,od,demuxer);
      }
 #endif
-   }       
+   }
    return demuxer;
 //  break;
  }
@@ -1348,7 +1355,7 @@ switch(file_format){
    break;
  }
 
- case DEMUXER_TYPE_MPEG_TY: 
+ case DEMUXER_TYPE_MPEG_TY:
  case DEMUXER_TYPE_MPEG_PS: {
   sh_video=d_video->sh;sh_video->ds=d_video;
 //  if(demuxer->stream->type!=STREAMTYPE_VCD) demuxer->movi_start=0; // for VCD
@@ -1438,10 +1445,10 @@ demuxer_t* demux_open(stream_t *vs,int f
     }
     if(audio_stream_cache) {
       if(!stream_enable_cache
(as,audio_stream_cache*1024,audio_stream_cache*1024*(stream_cache_min_percent / 
100.0),
-			      audio_stream_cache*1024*
(stream_cache_prefill_percent / 100.0))) {
-	free_stream(as);
-	mp_msg(MSGT_DEMUXER,MSGL_ERR,"Can't enable audio stream cache\n");
-	return NULL;
+                  audio_stream_cache*1024*(stream_cache_prefill_percent / 
100.0))) {
+    free_stream(as);
+    mp_msg(MSGT_DEMUXER,MSGL_ERR,"Can't enable audio stream cache\n");
+    return NULL;
       }
     }
   }
@@ -1525,20 +1532,20 @@ int demux_seek(demuxer_t *demuxer,float 
 
 if(!demuxer->seekable){
     if(demuxer->file_format==DEMUXER_TYPE_AVI)
-	mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_CantSeekRawAVI);
+    mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_CantSeekRawAVI);
 #ifdef USE_TV
     else if (demuxer->file_format==DEMUXER_TYPE_TV)
-	mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_TVInputNotSeekable);
+    mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_TVInputNotSeekable);
 #endif
     else
-	mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_CantSeekFile);
+    mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_CantSeekFile);
     return 0;
 }
 
     // clear demux buffers:
     if(sh_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;}
     ds_free_packs(d_video);
-    
+
     demuxer->stream->eof=0; // clear eof flag
     demuxer->video->eof=0;
     demuxer->audio->eof=0;
@@ -1564,7 +1571,7 @@ switch(demuxer->file_format){
 
   case DEMUXER_TYPE_MPEG_TY:
       demux_seek_ty(demuxer,rel_seek_secs,flags);  break;
-  
+
   case DEMUXER_TYPE_H264_ES:
   case DEMUXER_TYPE_MPEG4_ES:
   case DEMUXER_TYPE_MPEG_ES:
@@ -1585,7 +1592,7 @@ switch(demuxer->file_format){
 
   case DEMUXER_TYPE_PVA:
       demux_seek_pva(demuxer,rel_seek_secs,flags); break;
-      
+
   case DEMUXER_TYPE_FLI:
       demux_seek_fli(demuxer,rel_seek_secs,flags);  break;
   case DEMUXER_TYPE_FILM:
@@ -1636,15 +1643,15 @@ int demux_info_add(demuxer_t *demuxer, c
     int n = 0;
 
 
-    for(n = 0; info && info[2*n] != NULL; n++) 
+    for(n = 0; info && info[2*n] != NULL; n++)
+      {
+    if(!strcasecmp(opt,info[2*n]))
       {
-	if(!strcasecmp(opt,info[2*n]))
-	  {
-	    mp_msg(MSGT_DEMUX, MSGL_WARN,MSGTR_DemuxerInfoAlreadyPresent,opt);
-	    return 0;
-	  }
+        mp_msg(MSGT_DEMUX, MSGL_WARN,MSGTR_DemuxerInfoAlreadyPresent,opt);
+        return 0;
       }
-    
+      }
+
     info = demuxer->info = (char**)realloc(info,(2*(n+2))*sizeof(char*));
     info[2*n] = strdup(opt);
     info[2*n+1] = strdup(param);
@@ -1700,70 +1707,70 @@ extern int demux_rawdv_control(demuxer_t
 
 int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
     switch(demuxer->type) {
-	case DEMUXER_TYPE_MPEG_TY:
-	    return demux_ty_control(demuxer,cmd,arg);
-	case DEMUXER_TYPE_MPEG4_ES:
-	case DEMUXER_TYPE_MPEG_ES:
-	case DEMUXER_TYPE_MPEG_PS:
-	case DEMUXER_TYPE_MPEG_TS:
-	    return demux_mpg_control(demuxer,cmd,arg);
-	case DEMUXER_TYPE_ASF:
-	    return demux_asf_control(demuxer,cmd,arg);
-	case DEMUXER_TYPE_AVI:
-	case DEMUXER_TYPE_AVI_NI:
-	case DEMUXER_TYPE_AVI_NINI:
-	    return demux_avi_control(demuxer,cmd,arg);
-	case DEMUXER_TYPE_AUDIO:
-	    return demux_audio_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_MPEG_TY:
+        return demux_ty_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_MPEG4_ES:
+    case DEMUXER_TYPE_MPEG_ES:
+    case DEMUXER_TYPE_MPEG_PS:
+    case DEMUXER_TYPE_MPEG_TS:
+        return demux_mpg_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_ASF:
+        return demux_asf_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_AVI:
+    case DEMUXER_TYPE_AVI_NI:
+    case DEMUXER_TYPE_AVI_NINI:
+        return demux_avi_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_AUDIO:
+        return demux_audio_control(demuxer,cmd,arg);
 #ifdef HAVE_OGGVORBIS
-	case DEMUXER_TYPE_OGG:
-	    return demux_ogg_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_OGG:
+        return demux_ogg_control(demuxer,cmd,arg);
 #endif
 #ifdef HAVE_XMMS
-	case DEMUXER_TYPE_XMMS:
-	    return demux_xmms_control(demuxer,cmd,arg);
+    case DEMUXER_TYPE_XMMS:
+        return demux_xmms_control(demuxer,cmd,arg);
 #endif
 #ifdef HAVE_MATROSKA
         case DEMUXER_TYPE_MATROSKA:
-	    return demux_mkv_control(demuxer,cmd,arg);
+        return demux_mkv_control(demuxer,cmd,arg);
 #endif
-	case DEMUXER_TYPE_REAL:
-	    return demux_real_control(demuxer, cmd, arg);
+    case DEMUXER_TYPE_REAL:
+        return demux_real_control(demuxer, cmd, arg);
 #ifdef USE_LIBAVFORMAT
         case DEMUXER_TYPE_LAVF:
-	    return demux_lavf_control(demuxer, cmd, arg);
+        return demux_lavf_control(demuxer, cmd, arg);
 #endif
         case DEMUXER_TYPE_MOV:
-   	    return demux_mov_control(demuxer, cmd, arg);
+        return demux_mov_control(demuxer, cmd, arg);
 #ifdef USE_WIN32DLL
         case DEMUXER_TYPE_AVS:
-   	    return demux_avs_control(demuxer, cmd, arg);
-#endif 
+        return demux_avs_control(demuxer, cmd, arg);
+#endif
 #ifdef HAVE_LIBDV095
         case DEMUXER_TYPE_RAWDV:
             return demux_rawdv_control(demuxer,cmd, arg);
 #endif
-	default:
-	    return DEMUXER_CTRL_NOTIMPL;
+    default:
+        return DEMUXER_CTRL_NOTIMPL;
     }
 }
 
 
 
-unsigned long demuxer_get_time_length(demuxer_t *demuxer){     
-    unsigned long get_time_ans;     
+unsigned long demuxer_get_time_length(demuxer_t *demuxer){
+    unsigned long get_time_ans;
     sh_video_t *sh_video = demuxer->video->sh;
     // <= 0 means DEMUXER_CTRL_NOTIMPL or DEMUXER_CTRL_DONTKNOW
     if (demux_control(demuxer, DEMUXER_CTRL_GET_TIME_LENGTH,(void *)
&get_time_ans)<=0)  {
       if (sh_video && sh_video->i_bps)
         get_time_ans = (demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps;
       else
-        get_time_ans=0;     
+        get_time_ans=0;
     }
     return get_time_ans;
 }
 
-int demuxer_get_percent_pos(demuxer_t *demuxer){     
+int demuxer_get_percent_pos(demuxer_t *demuxer){
     int ans = 0;
     int res = demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans);
     int len = (demuxer->movi_end - demuxer->movi_start) / 100;
@@ -1778,7 +1785,7 @@ int demuxer_get_percent_pos(demuxer_t *d
     return ans;
 }
 
-int demuxer_switch_audio(demuxer_t *demuxer){     
+int demuxer_switch_audio(demuxer_t *demuxer){
     int ans = 0;
     int res = demux_control(demuxer, DEMUXER_CTRL_SWITCH_AUDIO, &ans);
     return ans;






More information about the MPlayer-dev-eng mailing list