[Mplayer-cvslog] CVS: main Makefile,1.21,1.22 asfheader.c,1.6,1.7 aviheader.c,1.8,1.9 aviprint.c,1.2,1.3 aviwrite.c,1.1.1.1,1.2 dec_audio.c,1.6,1.7 demux_asf.c,1.3,1.4 demux_avi.c,1.4,1.5 demux_mpg.c,1.15,1.16 demuxer.c,1.4,1.5 dll_init.c,1.11,1.12 mplayer.c,1.91,1.92 stheader.h,1.6,1.7 vcd_read.c,1.1.1.1,1.2

GEREOFFY arpi_esp at users.sourceforge.net
Mon Apr 23 05:42:19 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv6784

Modified Files:
	Makefile asfheader.c aviheader.c aviprint.c aviwrite.c 
	dec_audio.c demux_asf.c demux_avi.c demux_mpg.c demuxer.c 
	dll_init.c mplayer.c stheader.h vcd_read.c 
Log Message:
stage#1 completed: c files no more included from mplayer.c

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** Makefile	2001/04/22 16:56:20	1.21
--- Makefile	2001/04/23 03:42:17	1.22
***************
*** 21,26 ****
  BINDIR = ${prefix}/bin
  # BINDIR = /usr/local/bin
! SRCS = stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c
! OBJS = stream.o codec-cfg.o subreader.o linux/getch2.o linux/timer-lx.o linux/shmem.o xa/xa_gsm.o lirc_mp.o cfgparser.o mixer.o dvdauth.o spudec.o
  CFLAGS = $(OPTFLAGS) $(CSS_INC) -Iloader -Ilibvo # -Wall
  A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3
--- 21,26 ----
  BINDIR = ${prefix}/bin
  # BINDIR = /usr/local/bin
! SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c
! OBJS = find_sub.o aviprint.o dll_init.o dec_audio.o aviwrite.o aviheader.o asfheader.o demux_avi.o demux_asf.o demux_mpg.o demuxer.o stream.o codec-cfg.o subreader.o linux/getch2.o linux/timer-lx.o linux/shmem.o xa/xa_gsm.o lirc_mp.o cfgparser.o mixer.o dvdauth.o spudec.o
  CFLAGS = $(OPTFLAGS) $(CSS_INC) -Iloader -Ilibvo # -Wall
  A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3

Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/asfheader.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** asfheader.c	2001/04/15 14:33:49	1.6
--- asfheader.c	2001/04/23 03:42:17	1.7
***************
*** 1,4 ****
--- 1,20 ----
  // .asf fileformat docs from http://divx.euro.ru
  
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
+ #include "wine/mmreg.h"
+ #include "wine/avifmt.h"
+ #include "wine/vfw.h"
+ 
+ #include "codec-cfg.h"
+ #include "stheader.h"
+ 
  typedef struct __attribute__((packed)) {
    unsigned char guid[16];
***************
*** 38,74 ****
  } ASF_stream_header_t;
  
  
- ASF_header_t asfh;
- ASF_obj_header_t objh;
- ASF_file_header_t fileh;
- ASF_stream_header_t streamh;
  unsigned char* asf_packet=NULL;
- //int asf_video_id=-1;
  int asf_scrambling_h=1;
  int asf_scrambling_w=1;
  int asf_scrambling_b=1;
  
! int i;
  
- void asf_descrambling(unsigned char *src,int len){
-   unsigned char *dst=malloc(len);
-   unsigned char *s2=src;
-   int i=0,x,y;
-   while(len-i>=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b){
- //    printf("descrambling! (w=%d  b=%d)\n",w,asf_scrambling_b);
- 	//i+=asf_scrambling_h*asf_scrambling_w;
- 	for(x=0;x<asf_scrambling_w;x++)
- 	  for(y=0;y<asf_scrambling_h;y++){
- 	    memcpy(dst+i,s2+(y*asf_scrambling_w+x)*asf_scrambling_b,asf_scrambling_b);
- 		i+=asf_scrambling_b;
- 	  }
- 	s2+=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b;
-   }
-   //if(i<len) memcpy(dst+i,src+i,len-i);
-   memcpy(src,dst,i);
-   free(dst);
- }
  
! char* asf_chunk_type(unsigned char* guid){
    switch(*((unsigned int*)guid)){
      case 0xF8699E40: return "guid_audio_stream";
--- 54,73 ----
  } ASF_stream_header_t;
  
+ 
+ static ASF_header_t asfh;
+ static ASF_obj_header_t objh;
+ static ASF_file_header_t fileh;
+ static ASF_stream_header_t streamh;
  
  unsigned char* asf_packet=NULL;
  int asf_scrambling_h=1;
  int asf_scrambling_w=1;
  int asf_scrambling_b=1;
+ int asf_packetsize=0;
  
! //int i;
  
  
! static char* asf_chunk_type(unsigned char* guid){
    switch(*((unsigned int*)guid)){
      case 0xF8699E40: return "guid_audio_stream";
***************
*** 86,90 ****
  }
  
! int asf_check_header(){
    unsigned char asfhdrguid[16]={0x30,0x26,0xB2,0x75,0x8E,0x66,0xCF,0x11,0xA6,0xD9,0x00,0xAA,0x00,0x62,0xCE,0x6C};
    stream_read(demuxer->stream,(char*) &asfh,sizeof(asfh)); // header obj
--- 85,89 ----
  }
  
! int asf_check_header(demuxer_t *demuxer){
    unsigned char asfhdrguid[16]={0x30,0x26,0xB2,0x75,0x8E,0x66,0xCF,0x11,0xA6,0xD9,0x00,0xAA,0x00,0x62,0xCE,0x6C};
    stream_read(demuxer->stream,(char*) &asfh,sizeof(asfh)); // header obj
***************
*** 102,106 ****
  }
  
! int read_asf_header(){
    unsigned char buffer[512];
    
--- 101,105 ----
  }
  
! int read_asf_header(demuxer_t *demuxer){
    unsigned char buffer[512];
    
***************
*** 167,176 ****
        stream_read(demuxer->stream,(char*) &fileh,sizeof(fileh));
        if(verbose) printf("ASF: packets: %d  flags: %d  pack_size: %d  frame_size: %d\n",(int)fileh.packets,(int)fileh.flags,(int)fileh.packetsize,(int)fileh.frame_size);
!       asf_packet=malloc(fileh.packetsize); // !!!
        break;
      case 0x75b22636: // guid_data_chunk
!       avi_header.movi_start=stream_tell(demuxer->stream)+26;
!       avi_header.movi_end=endpos;
!       if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",avi_header.movi_start,avi_header.movi_end);
        break;
  
--- 166,176 ----
        stream_read(demuxer->stream,(char*) &fileh,sizeof(fileh));
        if(verbose) printf("ASF: packets: %d  flags: %d  pack_size: %d  frame_size: %d\n",(int)fileh.packets,(int)fileh.flags,(int)fileh.packetsize,(int)fileh.frame_size);
!       asf_packetsize=fileh.packetsize;
!       asf_packet=malloc(asf_packetsize); // !!!
        break;
      case 0x75b22636: // guid_data_chunk
!       demuxer->movi_start=stream_tell(demuxer->stream)+26;
!       demuxer->movi_end=endpos;
!       if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
        break;
  

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** aviheader.c	2001/04/22 01:29:59	1.8
--- aviheader.c	2001/04/23 03:42:17	1.9
***************
*** 1,6 ****
  
  #define MIN(a,b) (((a)<(b))?(a):(b))
  
! void read_avi_header(int index_mode){
  sh_audio_t *sh_audio=NULL;
  sh_video_t *sh_video=NULL;
--- 1,24 ----
  
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
+ #include "wine/mmreg.h"
+ #include "wine/avifmt.h"
+ #include "wine/vfw.h"
+ 
+ #include "codec-cfg.h"
+ #include "stheader.h"
+ 
  #define MIN(a,b) (((a)<(b))?(a):(b))
+ 
+ static MainAVIHeader avih;
  
! void read_avi_header(demuxer_t *demuxer,int index_mode){
  sh_audio_t *sh_audio=NULL;
  sh_video_t *sh_video=NULL;
***************
*** 10,14 ****
  
  //---- AVI header:
! avi_header.idx_size=0;
  while(1){
    int id=stream_read_dword_le(demuxer->stream);
--- 28,32 ----
  
  //---- AVI header:
! demuxer->idx_size=0;
  while(1){
    int id=stream_read_dword_le(demuxer->stream);
***************
*** 24,30 ****
      if(id==listtypeAVIMOVIE){
        // found MOVI header
!       avi_header.movi_start=stream_tell(demuxer->stream);
!       avi_header.movi_end=avi_header.movi_start+len;
!       if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",avi_header.movi_start,avi_header.movi_end);
        len=(len+1)&(~1);
        stream_skip(demuxer->stream,len);
--- 42,48 ----
      if(id==listtypeAVIMOVIE){
        // found MOVI header
!       demuxer->movi_start=stream_tell(demuxer->stream);
!       demuxer->movi_end=demuxer->movi_start+len;
!       if(verbose>=1) printf("Found movie at 0x%X - 0x%X\n",demuxer->movi_start,demuxer->movi_end);
        len=(len+1)&(~1);
        stream_skip(demuxer->stream,len);
***************
*** 37,43 ****
    switch(id){
      case ckidAVIMAINHDR:          // read 'avih'
!       stream_read(demuxer->stream,(char*) &avi_header.avih,MIN(size2,sizeof(avi_header.avih)));
!       chunksize-=MIN(size2,sizeof(avi_header.avih));
!       if(verbose) print_avih(&avi_header.avih);
        break;
      case ckidSTREAMHEADER: {      // read 'strh'
--- 55,61 ----
    switch(id){
      case ckidAVIMAINHDR:          // read 'avih'
!       stream_read(demuxer->stream,(char*) &avih,MIN(size2,sizeof(avih)));
!       chunksize-=MIN(size2,sizeof(avih));
!       if(verbose) print_avih(&avih);
        break;
      case ckidSTREAMHEADER: {      // read 'strh'
***************
*** 80,83 ****
--- 98,103 ----
  	case mmioFOURCC('M', 'P', '4', '3'):
  	case mmioFOURCC('m', 'p', '4', '3'):
+ 	case mmioFOURCC('M', 'P', '4', '2'):
+ 	case mmioFOURCC('m', 'p', '4', '2'):
          case mmioFOURCC('A', 'P', '4', '1'):
            idxfix_divx=1; // we can fix keyframes only for divx coded files!
***************
*** 96,106 ****
      }
      case ckidAVINEWINDEX: if(index_mode){
!       avi_header.idx_size=size2>>4;
        if(verbose>=1) printf("Reading INDEX block, %d chunks for %d frames\n",
!         avi_header.idx_size,avi_header.avih.dwTotalFrames);
!       avi_header.idx=malloc(avi_header.idx_size<<4);
!       stream_read(demuxer->stream,(char*)avi_header.idx,avi_header.idx_size<<4);
!       chunksize-=avi_header.idx_size<<4;
!       if(verbose>=2) print_index();
        break;
      }
--- 116,126 ----
      }
      case ckidAVINEWINDEX: if(index_mode){
!       demuxer->idx_size=size2>>4;
        if(verbose>=1) printf("Reading INDEX block, %d chunks for %d frames\n",
!         demuxer->idx_size,avih.dwTotalFrames);
!       demuxer->idx=malloc(demuxer->idx_size<<4);
!       stream_read(demuxer->stream,(char*)demuxer->idx,demuxer->idx_size<<4);
!       chunksize-=demuxer->idx_size<<4;
!       if(verbose>=2) print_index(demuxer->idx,demuxer->idx_size);
        break;
      }
***************
*** 111,121 ****
  }
  
! if(index_mode>=2 || (avi_header.idx_size==0 && index_mode==1)){
    // build index for file:
    stream_reset(demuxer->stream);
!   stream_seek(demuxer->stream,avi_header.movi_start);
    
!   avi_header.idx_pos=0;
!   avi_header.idx=NULL;
  
    while(1){
--- 131,141 ----
  }
  
! if(index_mode>=2 || (demuxer->idx_size==0 && index_mode==1)){
    // build index for file:
    stream_reset(demuxer->stream);
!   stream_seek(demuxer->stream,demuxer->movi_start);
    
!   demuxer->idx_pos=0;
!   demuxer->idx=NULL;
  
    while(1){
***************
*** 124,128 ****
      unsigned char c;
      demuxer->filepos=stream_tell(demuxer->stream);
!     if(demuxer->filepos>=avi_header.movi_end) break;
      id=stream_read_dword_le(demuxer->stream);
      len=stream_read_dword_le(demuxer->stream);
--- 144,148 ----
      unsigned char c;
      demuxer->filepos=stream_tell(demuxer->stream);
!     if(demuxer->filepos>=demuxer->movi_end) break;
      id=stream_read_dword_le(demuxer->stream);
      len=stream_read_dword_le(demuxer->stream);
***************
*** 132,141 ****
      }
      if(stream_eof(demuxer->stream)) break;
!     if(avi_header.idx_pos<=avi_header.idx_size){
!       avi_header.idx_size+=32;
!       avi_header.idx=realloc(avi_header.idx,avi_header.idx_size*sizeof(AVIINDEXENTRY));
!       if(!avi_header.idx){avi_header.idx_pos=0; break;} // error!
      }
!     idx=&avi_header.idx[avi_header.idx_pos++];
      idx->ckid=id;
      idx->dwFlags=AVIIF_KEYFRAME; // FIXME
--- 152,161 ----
      }
      if(stream_eof(demuxer->stream)) break;
!     if(demuxer->idx_pos<=demuxer->idx_size){
!       demuxer->idx_size+=32;
!       demuxer->idx=realloc(demuxer->idx,demuxer->idx_size*sizeof(AVIINDEXENTRY));
!       if(!demuxer->idx){demuxer->idx_pos=0; break;} // error!
      }
!     idx=&((AVIINDEXENTRY *)demuxer->idx)[demuxer->idx_pos++];
      idx->ckid=id;
      idx->dwFlags=AVIIF_KEYFRAME; // FIXME
***************
*** 164,169 ****
      stream_seek(demuxer->stream,8+demuxer->filepos+skip);
    }
!   avi_header.idx_size=avi_header.idx_pos;
!   printf("AVI: Generated index table for %d chunks!\n",avi_header.idx_size);
  }
  
--- 184,189 ----
      stream_seek(demuxer->stream,8+demuxer->filepos+skip);
    }
!   demuxer->idx_size=demuxer->idx_pos;
!   printf("AVI: Generated index table for %d chunks!\n",demuxer->idx_size);
  }
  

Index: aviprint.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviprint.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** aviprint.c	2001/04/11 19:25:18	1.2
--- aviprint.c	2001/04/23 03:42:17	1.3
***************
*** 1,2 ****
--- 1,19 ----
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ //extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
+ #include "wine/mmreg.h"
+ #include "wine/avifmt.h"
+ #include "wine/vfw.h"
+ 
+ //#include "codec-cfg.h"
+ //#include "stheader.h"
+ 
+ 
  void print_avih(MainAVIHeader *h){
    printf("======= AVI Header =======\n");
***************
*** 57,69 ****
  
  
! void print_index(){
    int i;
!   for(i=0;i<avi_header.idx_size;i++){
!     printf("%5d:  %.4s  %4X  %08X (%08X)  %d\n",i,
!       &avi_header.idx[i].ckid,
!       avi_header.idx[i].dwFlags,
!       avi_header.idx[i].dwChunkOffset,
!       avi_header.idx[i].dwChunkOffset+avi_header.movi_start,
!       avi_header.idx[i].dwChunkLength
      );
    }
--- 74,86 ----
  
  
! void print_index(AVIINDEXENTRY *idx,int idx_size){
    int i;
!   for(i=0;i<idx_size;i++){
!     printf("%5d:  %.4s  %4X  %08X  %d\n",i,
!       &idx[i].ckid,
!       idx[i].dwFlags,
!       idx[i].dwChunkOffset,
! //      idx[i].dwChunkOffset+demuxer->movi_start,
!       idx[i].dwChunkLength
      );
    }

Index: aviwrite.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviwrite.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** aviwrite.c	2001/02/24 20:28:25	1.1.1.1
--- aviwrite.c	2001/04/23 03:42:17	1.2
***************
*** 1,3 ****
--- 1,14 ----
  
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+ 
+ #include "wine/mmreg.h"
+ #include "wine/avifmt.h"
+ #include "wine/vfw.h"
+ 
+ extern char* encode_name;
+ extern char* encode_index_name;
+ 
  void write_avi_chunk(FILE *f,unsigned int id,int len,void* data){
  

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** dec_audio.c	2001/04/15 14:33:49	1.6
--- dec_audio.c	2001/04/23 03:42:17	1.7
***************
*** 1,3 ****
--- 1,39 ----
  
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ #include "config.h"
+ 
+ extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
+ #include "wine/mmreg.h"
+ #include "wine/avifmt.h"
+ #include "wine/vfw.h"
+ 
+ #include "codec-cfg.h"
+ #include "stheader.h"
+ 
+ #include "mp3lib/mp3.h"
+ #include "libac3/ac3.h"
+ 
+ #include "alaw.c"
+ #include "xa/xa_gsm.h"
+ 
+ static sh_audio_t* ac3_audio_sh=NULL;
+ 
+ // AC3 decoder buffer callback:
+ static void ac3_fill_buffer(uint8_t **start,uint8_t **end){
+     int len=ds_get_packet(ac3_audio_sh->ds,start);
+     //printf("<ac3:%d>\n",len);
+     if(len<0)
+           *start = *end = NULL;
+     else
+           *end = *start + len;
+ }
+ 
+ 
  int init_audio(sh_audio_t *sh_audio){
  
***************
*** 80,83 ****
--- 116,120 ----
  case 3: {
    // Dolby AC3 audio:
+   ac3_audio_sh=sh_audio; // save sh_audio for the callback:
    ac3_config.fill_buffer_callback = ac3_fill_buffer;
    ac3_config.num_output_ch = 2;
***************
*** 92,96 ****
    sh_audio->ac3_frame = ac3_decode_frame();
    if(sh_audio->ac3_frame){
!     sh_audio->samplerate=sh_audio->ac3_frame->sampling_rate;
      sh_audio->channels=2;
    } else {
--- 129,133 ----
    sh_audio->ac3_frame = ac3_decode_frame();
    if(sh_audio->ac3_frame){
!     sh_audio->samplerate=((ac3_frame_t*)sh_audio->ac3_frame)->sampling_rate;
      sh_audio->channels=2;
    } else {
***************
*** 180,184 ****
              len=0;
              while(len<OUTBURST){
!                 if(demux_read_data(d_audio,buf,65)!=65) break; // EOF
                  XA_MSGSM_Decoder(buf,(unsigned short *) buf); // decodes 65 byte -> 320 short
  //  		XA_GSM_Decoder(buf,(unsigned short *) &sh_audio->a_buffer[sh_audio->a_buffer_len]); // decodes 33 byte -> 160 short
--- 217,221 ----
              len=0;
              while(len<OUTBURST){
!                 if(demux_read_data(sh_audio->ds,buf,65)!=65) break; // EOF
                  XA_MSGSM_Decoder(buf,(unsigned short *) buf); // decodes 65 byte -> 320 short
  //  		XA_GSM_Decoder(buf,(unsigned short *) &sh_audio->a_buffer[sh_audio->a_buffer_len]); // decodes 33 byte -> 160 short
***************
*** 193,197 ****
          if(sh_audio->ac3_frame){
            len = 256 * 6 *sh_audio->channels*sh_audio->samplesize;
!           memcpy(buf,sh_audio->ac3_frame->audio_data,len);
            sh_audio->ac3_frame=NULL;
          }
--- 230,234 ----
          if(sh_audio->ac3_frame){
            len = 256 * 6 *sh_audio->channels*sh_audio->samplesize;
!           memcpy(buf,((ac3_frame_t*)sh_audio->ac3_frame)->audio_data,len);
            sh_audio->ac3_frame=NULL;
          }

Index: demux_asf.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_asf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** demux_asf.c	2001/04/15 03:40:37	1.3
--- demux_asf.c	2001/04/23 03:42:17	1.4
***************
*** 1,4 ****
--- 1,20 ----
  //  ASF file parser for DEMUXER v0.3  by A'rpi/ESP-team
  
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
+ // defined at asfheader.c:
+ extern unsigned char* asf_packet;
+ extern int asf_scrambling_h;
+ extern int asf_scrambling_w;
+ extern int asf_scrambling_b;
+ extern int asf_packetsize;
+ 
+ 
  // based on asf file-format doc by Eugene [http://divx.euro.ru]
  
***************
*** 16,19 ****
--- 32,54 ----
  } ASF_segmhdr_t;
  
+ static void asf_descrambling(unsigned char *src,int len){
+   unsigned char *dst=malloc(len);
+   unsigned char *s2=src;
+   int i=0,x,y;
+   while(len-i>=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b){
+ //    printf("descrambling! (w=%d  b=%d)\n",w,asf_scrambling_b);
+ 	//i+=asf_scrambling_h*asf_scrambling_w;
+ 	for(x=0;x<asf_scrambling_w;x++)
+ 	  for(y=0;y<asf_scrambling_h;y++){
+ 	    memcpy(dst+i,s2+(y*asf_scrambling_w+x)*asf_scrambling_b,asf_scrambling_b);
+ 		i+=asf_scrambling_b;
+ 	  }
+ 	s2+=asf_scrambling_h*asf_scrambling_w*asf_scrambling_b;
+   }
+   //if(i<len) memcpy(dst+i,src+i,len-i);
+   memcpy(src,dst,i);
+   free(dst);
+ }
+ 
  
  static int demux_asf_read_packet(demuxer_t *demux,unsigned char *data,int len,int id,int seq,unsigned long time,unsigned short dur,int offs){
***************
*** 23,31 ****
    
    if(demux->video->id==-1)
!     if(avi_header.v_streams[id])
          demux->video->id=id;
  
    if(demux->audio->id==-1)
!     if(avi_header.a_streams[id])
          demux->audio->id=id;
  
--- 58,66 ----
    
    if(demux->video->id==-1)
!     if(demux->v_streams[id])
          demux->video->id=id;
  
    if(demux->audio->id==-1)
!     if(demux->a_streams[id])
          demux->audio->id=id;
  
***************
*** 34,38 ****
        ds=demux->audio;
        if(!ds->sh){
!         ds->sh=avi_header.a_streams[id];
          if(verbose) printf("Auto-selected ASF audio ID = %d\n",ds->id);
        }
--- 69,73 ----
        ds=demux->audio;
        if(!ds->sh){
!         ds->sh=demux->a_streams[id];
          if(verbose) printf("Auto-selected ASF audio ID = %d\n",ds->id);
        }
***************
*** 42,46 ****
        ds=demux->video;
        if(!ds->sh){
!         ds->sh=avi_header.v_streams[id];
          if(verbose) printf("Auto-selected ASF video ID = %d\n",ds->id);
        }
--- 77,81 ----
        ds=demux->video;
        if(!ds->sh){
!         ds->sh=demux->v_streams[id];
          if(verbose) printf("Auto-selected ASF video ID = %d\n",ds->id);
        }
***************
*** 98,107 ****
  
    demux->filepos=stream_tell(demux->stream);
!   if(demux->filepos>=demux->endpos){
            demux->stream->eof=1;
            return 0;
    }
  
!     stream_read(demux->stream,asf_packet,(int)fileh.packetsize);
      if(demux->stream->eof) return 0; // EOF
      
--- 133,142 ----
  
    demux->filepos=stream_tell(demux->stream);
!   if(demux->filepos>=demux->movi_end){
            demux->stream->eof=1;
            return 0;
    }
  
!     stream_read(demux->stream,asf_packet,asf_packetsize);
      if(demux->stream->eof) return 0; // EOF
      
***************
*** 110,114 ****
              unsigned char segtype=asf_packet[4];
              unsigned char* p=&asf_packet[5];
!             unsigned char* p_end=p+(int)fileh.packetsize;
              unsigned long time;
              unsigned short duration;
--- 145,149 ----
              unsigned char segtype=asf_packet[4];
              unsigned char* p=&asf_packet[5];
!             unsigned char* p_end=p+asf_packetsize;
              unsigned long time;
              unsigned short duration;
***************
*** 132,140 ****
                plen=p[0]|(p[1]<<8); p+=2;
                if(verbose>1)printf("Explicit packet size specified: %d  \n",plen);
!               if(plen>fileh.packetsize) printf("Warning! plen>packetsize! (%d>%d)  \n",plen,(int)fileh.packetsize);
                if(flags&(8|16)){
                  padding=p[0];p++;
                  if(flags&16){ padding|=p[0]<<8; p++;}
!                 if(verbose)printf("Warning! explicit=%d  padding=%d  \n",plen,fileh.packetsize-padding);
                }
              } else {
--- 167,175 ----
                plen=p[0]|(p[1]<<8); p+=2;
                if(verbose>1)printf("Explicit packet size specified: %d  \n",plen);
!               if(plen>asf_packetsize) printf("Warning! plen>packetsize! (%d>%d)  \n",plen,asf_packetsize);
                if(flags&(8|16)){
                  padding=p[0];p++;
                  if(flags&16){ padding|=p[0]<<8; p++;}
!                 if(verbose)printf("Warning! explicit=%d  padding=%d  \n",plen,asf_packetsize-padding);
                }
              } else {
***************
*** 146,150 ****
                  padding=p[0]|(p[1]<<8);p+=2;
                }
!               plen=fileh.packetsize-padding;
              }
  
--- 181,185 ----
                  padding=p[0]|(p[1]<<8);p+=2;
                }
!               plen=asf_packetsize-padding;
              }
  

Index: demux_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_avi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** demux_avi.c	2001/04/15 03:40:37	1.4
--- demux_avi.c	2001/04/23 03:42:17	1.5
***************
*** 1,20 ****
  //  AVI file parser for DEMUXER v2.6  by A'rpi/ESP-team
  
! //static float avi_pts_frametime=1.0f/25.0f;
! static float avi_audio_pts=0;
! static float avi_video_pts=0;
  
! static int skip_video_frames=0;
  
! static inline int avi_stream_id(unsigned int id){
!   unsigned char *p=(unsigned char *)&id;
!   unsigned char a,b;
!   a=p[0]-'0'; b=p[1]-'0';
!   if(a>9 || b>9) return 100; // invalid ID
!   return a*10+b;
! }
  
  // Select ds from ID
! static inline demux_stream_t* demux_avi_select_stream(demuxer_t *demux,unsigned int id){
    int stream_id=avi_stream_id(id);
  
--- 1,27 ----
  //  AVI file parser for DEMUXER v2.6  by A'rpi/ESP-team
  
! #include <stdio.h>
! #include <stdlib.h>
  
! extern int verbose; // defined in mplayer.c
  
! #include "stream.h"
! #include "demuxer.h"
! 
! #include "wine/mmreg.h"
! #include "wine/avifmt.h"
! #include "wine/vfw.h"
! 
! #include "codec-cfg.h"
! #include "stheader.h"
! 
! //static float avi_pts_frametime=1.0f/25.0f;
! float avi_audio_pts=0;
! float avi_video_pts=0;
! //float avi_video_ftime=0.04;
! int skip_video_frames=0;
  
  // Select ds from ID
! demux_stream_t* demux_avi_select_stream(demuxer_t *demux,unsigned int id){
    int stream_id=avi_stream_id(id);
  
***************
*** 23,36 ****
  
    if(demux->video->id==-1)
!     if(avi_header.v_streams[stream_id])
          demux->video->id=stream_id;
  
    if(demux->audio->id==-1)
!     if(avi_header.a_streams[stream_id])
          demux->audio->id=stream_id;
  
    if(stream_id==demux->audio->id){
        if(!demux->audio->sh){
!         demux->audio->sh=avi_header.a_streams[stream_id];
          if(verbose) printf("Auto-selected AVI audio ID = %d\n",demux->audio->id);
        }
--- 30,43 ----
  
    if(demux->video->id==-1)
!     if(demux->v_streams[stream_id])
          demux->video->id=stream_id;
  
    if(demux->audio->id==-1)
!     if(demux->a_streams[stream_id])
          demux->audio->id=stream_id;
  
    if(stream_id==demux->audio->id){
        if(!demux->audio->sh){
!         demux->audio->sh=demux->a_streams[stream_id];
          if(verbose) printf("Auto-selected AVI audio ID = %d\n",demux->audio->id);
        }
***************
*** 39,43 ****
    if(stream_id==demux->video->id){
        if(!demux->video->sh){
!         demux->video->sh=avi_header.v_streams[stream_id];
          if(verbose) printf("Auto-selected AVI video ID = %d\n",demux->video->id);
        }
--- 46,50 ----
    if(stream_id==demux->video->id){
        if(!demux->video->sh){
!         demux->video->sh=demux->v_streams[stream_id];
          if(verbose) printf("Auto-selected AVI video ID = %d\n",demux->video->id);
        }
***************
*** 75,79 ****
--- 82,88 ----
       //avi_video_pts+=(float)avi_header.video.dwScale/(float)avi_header.video.dwRate;
       //avi_video_pts+=((sh_video_t*)ds->sh)->frametime;
+ // FIXME!!!
       avi_video_pts+=(float)((sh_video_t*)(demux->video->sh))->video.dwScale/(float)((sh_video_t*)(demux->video->sh))->video.dwRate;
+ //     avi_video_pts+=avi_video_ftime;
       avi_audio_pts=avi_video_pts;
    }
***************
*** 109,125 ****
    AVIINDEXENTRY *idx=NULL;
    demux->filepos=stream_tell(demux->stream);
!   if(demux->filepos>=demux->endpos){
            demux->stream->eof=1;
            return 0;
    }
    if(stream_eof(demux->stream)) return 0;
!   if(avi_header.idx_size>0 && avi_header.idx_pos<avi_header.idx_size){
      unsigned int pos;
      
!     //if(avi_header.idx_pos<0) printf("Fatal! idx_pos=%d\n",avi_header.idx_pos);
      
!     idx=&avi_header.idx[avi_header.idx_pos++];
      
!     //printf("[%d]",avi_header.idx_pos);fflush(stdout);
      
      //stream_seek(demux->stream,idx.dwChunkOffset);
--- 118,134 ----
    AVIINDEXENTRY *idx=NULL;
    demux->filepos=stream_tell(demux->stream);
!   if(demux->filepos>=demux->movi_end){
            demux->stream->eof=1;
            return 0;
    }
    if(stream_eof(demux->stream)) return 0;
!   if(demux->idx_size>0 && demux->idx_pos<demux->idx_size){
      unsigned int pos;
      
!     //if(demux->idx_pos<0) printf("Fatal! idx_pos=%d\n",demux->idx_pos);
      
!     idx=&((AVIINDEXENTRY *)demux->idx)[demux->idx_pos++];
      
!     //printf("[%d]",demux->idx_pos);fflush(stdout);
      
      //stream_seek(demux->stream,idx.dwChunkOffset);
***************
*** 135,140 ****
      }
  
!     pos=idx->dwChunkOffset+avi_header.idx_offset;
!     if(pos<avi_header.movi_start || pos>=avi_header.movi_end){
        printf("ChunkOffset out of range!  current=0x%X  idx=0x%X  \n",demux->filepos,pos);
        continue;
--- 144,149 ----
      }
  
!     pos=idx->dwChunkOffset+demux->idx_offset;
!     if(pos<demux->movi_start || pos>=demux->movi_end){
        printf("ChunkOffset out of range!  current=0x%X  idx=0x%X  \n",demux->filepos,pos);
        continue;
***************
*** 166,170 ****
      }
    }
!   ret=demux_avi_read_packet(demux,id,len,avi_header.idx_pos-1);
        if(!ret && skip_video_frames<=0)
          if(--max_packs==0){
--- 175,179 ----
      }
    }
!   ret=demux_avi_read_packet(demux,id,len,demux->idx_pos-1);
        if(!ret && skip_video_frames<=0)
          if(--max_packs==0){
***************
*** 192,202 ****
    demux->filepos=stream_tell(demux->stream);
    
!   if(ds==demux->video) idx_pos=avi_header.idx_pos_a++; else
!   if(ds==demux->audio) idx_pos=avi_header.idx_pos_v++; else
!                        idx_pos=avi_header.idx_pos++;
    
!   if(avi_header.idx_size>0 && idx_pos<avi_header.idx_size){
      unsigned int pos;
!     idx=&avi_header.idx[idx_pos];
      
      if(idx->dwFlags&AVIIF_LIST){
--- 201,212 ----
    demux->filepos=stream_tell(demux->stream);
    
!   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++;
    
!   if(demux->idx_size>0 && idx_pos<demux->idx_size){
      unsigned int pos;
!     idx=&((AVIINDEXENTRY *)demux->idx)[idx_pos];
! //    idx=&demux->idx[idx_pos];
      
      if(idx->dwFlags&AVIIF_LIST){
***************
*** 209,214 ****
      }
  
!     pos=idx->dwChunkOffset+avi_header.idx_offset;
!     if(pos<avi_header.movi_start || pos>=avi_header.movi_end){
        printf("ChunkOffset out of range!  current=0x%X  idx=0x%X  \n",demux->filepos,pos);
        continue;
--- 219,224 ----
      }
  
!     pos=idx->dwChunkOffset+demux->idx_offset;
!     if(pos<demux->movi_start || pos>=demux->movi_end){
        printf("ChunkOffset out of range!  current=0x%X  idx=0x%X  \n",demux->filepos,pos);
        continue;
***************
*** 258,263 ****
  int *fpos=NULL;
  
!   if(ds==demux->video) fpos=&avi_header.idx_pos_a; else
!   if(ds==demux->audio) fpos=&avi_header.idx_pos_v; else
    return 0;
  
--- 268,273 ----
  int *fpos=NULL;
  
!   if(ds==demux->video) fpos=&demux->idx_pos_a; else
!   if(ds==demux->audio) fpos=&demux->idx_pos_v; else
    return 0;
  
***************
*** 267,271 ****
  
    demux->filepos=stream_tell(demux->stream);
!   if(demux->filepos>=demux->endpos){
            demux->stream->eof=1;
            return 0;
--- 277,281 ----
  
    demux->filepos=stream_tell(demux->stream);
!   if(demux->filepos>=demux->movi_end){
            demux->stream->eof=1;
            return 0;
***************
*** 282,286 ****
    if(ds==demux_avi_select_stream(demux,id)){
      // read it!
!     ret=demux_avi_read_packet(demux,id,len,avi_header.idx_pos-1);
    } else {
      // skip it!
--- 292,296 ----
    if(ds==demux_avi_select_stream(demux,id)){
      // read it!
!     ret=demux_avi_read_packet(demux,id,len,demux->idx_pos-1);
    } else {
      // skip it!

Index: demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mpg.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** demux_mpg.c	2001/04/20 23:00:11	1.15
--- demux_mpg.c	2001/04/23 03:42:17	1.16
***************
*** 1,4 ****
--- 1,12 ----
  //  MPG/VOB file parser for DEMUXER v2.5  by A'rpi/ESP-team
  
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
  //#define MAX_PS_PACKETSIZE 2048
  #define MAX_PS_PACKETSIZE (224*1024)
***************
*** 129,135 ****
          aid&=0x1F;
  
!         if(!avi_header.s_streams[aid]){
              printf("==> Found subtitle: %d\n",aid);
!             avi_header.s_streams[aid]=1;
              // new_sh_audio(aid);
          }
--- 137,143 ----
          aid&=0x1F;
  
!         if(!demux->s_streams[aid]){
              printf("==> Found subtitle: %d\n",aid);
!             demux->s_streams[aid]=1;
              // new_sh_audio(aid);
          }
***************
*** 145,149 ****
          // aid=0x80..0xBF
  
!         if(!avi_header.a_streams[aid]) new_sh_audio(aid);
          if(demux->audio->id==-1) demux->audio->id=aid;
  
--- 153,157 ----
          // aid=0x80..0xBF
  
!         if(!demux->a_streams[aid]) new_sh_audio(aid);
          if(demux->audio->id==-1) demux->audio->id=aid;
  
***************
*** 151,155 ****
  //        int type;
          ds=demux->audio;
!         if(!ds->sh) ds->sh=avi_header.a_streams[aid];
          // READ Packet: Skip additional audio header data:
          c=stream_read_char(demux->stream);//type=c;
--- 159,163 ----
  //        int type;
          ds=demux->audio;
!         if(!ds->sh) ds->sh=demux->a_streams[aid];
          // READ Packet: Skip additional audio header data:
          c=stream_read_char(demux->stream);//type=c;
***************
*** 198,206 ****
      // mpeg audio
      int aid=id-0x1C0;
!     if(!avi_header.a_streams[aid]) new_sh_audio(aid);
      if(demux->audio->id==-1) demux->audio->id=aid;
      if(demux->audio->id==aid){
        ds=demux->audio;
!       if(!ds->sh) ds->sh=avi_header.a_streams[aid];
        if(ds->type==-1) ds->type=1;
      }
--- 206,214 ----
      // mpeg audio
      int aid=id-0x1C0;
!     if(!demux->a_streams[aid]) new_sh_audio(aid);
      if(demux->audio->id==-1) demux->audio->id=aid;
      if(demux->audio->id==aid){
        ds=demux->audio;
!       if(!ds->sh) ds->sh=demux->a_streams[aid];
        if(ds->type==-1) ds->type=1;
      }
***************
*** 209,217 ****
      // mpeg video
      int aid=id-0x1E0;
!     if(!avi_header.v_streams[aid]) new_sh_video(aid);
      if(demux->video->id==-1) demux->video->id=aid;
      if(demux->video->id==aid){
        ds=demux->video;
!       if(!ds->sh) ds->sh=avi_header.v_streams[aid];
      }
    }
--- 217,225 ----
      // mpeg video
      int aid=id-0x1E0;
!     if(!demux->v_streams[aid]) new_sh_video(aid);
      if(demux->video->id==-1) demux->video->id=aid;
      if(demux->video->id==aid){
        ds=demux->video;
!       if(!ds->sh) ds->sh=demux->v_streams[aid];
      }
    }
***************
*** 235,240 ****
  }
  
! static int num_elementary_packets100=0;
! static int num_elementary_packets101=0;
  
  int demux_mpg_es_fill_buffer(demuxer_t *demux){
--- 243,248 ----
  }
  
! int num_elementary_packets100=0;
! int num_elementary_packets101=0;
  
  int demux_mpg_es_fill_buffer(demuxer_t *demux){

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** demuxer.c	2001/04/20 23:00:11	1.4
--- demuxer.c	2001/04/23 03:42:17	1.5
***************
*** 1,52 ****
  //=================== DEMUXER v2.5 =========================
  
! #define MAX_PACKS 2048
! #define MAX_PACK_BYTES 0x400000
  
! typedef struct demux_packet_st {
!   int len;
!   float pts;
!   int pos;  // pozicio indexben (AVI) ill. fileban (MPG)
!   unsigned char* buffer;
!   struct demux_packet_st* next;
! } demux_packet_t;
! 
! inline demux_packet_t* new_demux_packet(int len){
!   demux_packet_t* dp=malloc(sizeof(demux_packet_t));
!   dp->len=len;
!   dp->buffer=malloc(len);
!   dp->next=NULL;
!   dp->pts=0;
!   dp->pos=0;
!   return dp;
! }
! 
! inline void free_demux_packet(demux_packet_t* dp){
!   free(dp->buffer);
!   free(dp);
! }
  
! typedef struct {
!   int buffer_pos;          // current buffer position
!   int buffer_size;         // current buffer size
!   unsigned char* buffer;   // current buffer
!   float pts;               // current buffer's pts
!   int eof;                 // end of demuxed stream? (true if all buffer empty)
!   int pos;                 // position in the input stream (file)
!   int dpos;                // position in the demuxed stream
! //---------------
!   int packs;              // number of packets in buffer
!   int bytes;              // total bytes of packets in buffer
!   demux_packet_t *first;  // read to current buffer from here
!   demux_packet_t *last;   // append new packets from input stream to here
!   int id;                 // stream ID  (for multiple audio/video streams)
!   int type;               // stream type (currently used only for audio)
!   struct demuxer_st *demuxer; // parent demuxer structure (stream handler)
! // ---- asf -----
!   demux_packet_t *asf_packet;  // read asf fragments here
!   int asf_seq;
! // ---- stream header ----
!   void* sh;
! } demux_stream_t;
  
  demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id){
--- 1,11 ----
  //=================== DEMUXER v2.5 =========================
  
! #include <stdio.h>
! #include <stdlib.h>
  
! extern int verbose; // defined in mplayer.c
  
! #include "stream.h"
! #include "demuxer.h"
  
  demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id){
***************
*** 73,103 ****
  }
  
- #define DEMUXER_TYPE_UNKNOWN 0
- #define DEMUXER_TYPE_MPEG_ES 1
- #define DEMUXER_TYPE_MPEG_PS 2
- #define DEMUXER_TYPE_AVI 3
- #define DEMUXER_TYPE_AVI_NI 4
- #define DEMUXER_TYPE_AVI_NINI 5
- #define DEMUXER_TYPE_ASF 6
- 
- #define DEMUXER_TIME_NONE 0
- #define DEMUXER_TIME_PTS 1
- #define DEMUXER_TIME_FILE 2
- #define DEMUXER_TIME_BPS 3
- 
- typedef struct demuxer_st {
-   stream_t *stream;
-   int synced;  // stream synced (used by mpeg)
-   int filepos; // input stream current pos.
-   int endpos;  // input stream end pos. (return EOF fi filepos>endpos)
-   int type;    // mpeg system stream, mpeg elementary s., avi raw, avi indexed
- //  int time_src;// time source (pts/file/bps)
-   demux_stream_t *audio;
-   demux_stream_t *video;
-   demux_stream_t *sub;
- } demuxer_t;
- 
  demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){
    demuxer_t *d=malloc(sizeof(demuxer_t));
    d->stream=stream;
    d->synced=0;
--- 32,38 ----
  }
  
  demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id){
    demuxer_t *d=malloc(sizeof(demuxer_t));
+   memset(d,0,sizeof(demuxer_t));
    d->stream=stream;
    d->synced=0;
***************
*** 110,114 ****
  }
  
! static void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp){
  //    demux_packet_t* dp=new_demux_packet(len);
  //    stream_read(stream,dp->buffer,len);
--- 45,49 ----
  }
  
! void ds_add_packet(demux_stream_t *ds,demux_packet_t* dp){
  //    demux_packet_t* dp=new_demux_packet(len);
  //    stream_read(stream,dp->buffer,len);
***************
*** 132,136 ****
  }
  
! static void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,int pos){
      demux_packet_t* dp=new_demux_packet(len);
      stream_read(stream,dp->buffer,len);
--- 67,71 ----
  }
  
! void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,int pos){
      demux_packet_t* dp=new_demux_packet(len);
      stream_read(stream,dp->buffer,len);
***************
*** 141,145 ****
  }
  
- 
  // return value:
  //     0 = EOF or no stream found or invalid type
--- 76,79 ----
***************
*** 168,172 ****
  //     0 = EOF
  //     1 = succesfull
! inline static int ds_fill_buffer(demux_stream_t *ds){
    demuxer_t *demux=ds->demuxer;
    if(ds->buffer) free(ds->buffer);
--- 102,106 ----
  //     0 = EOF
  //     1 = succesfull
! int ds_fill_buffer(demux_stream_t *ds){
    demuxer_t *demux=ds->demuxer;
    if(ds->buffer) free(ds->buffer);
***************
*** 174,178 ****
      if(ds==demux->audio) printf("ds_fill_buffer(d_audio) called\n");else
      if(ds==demux->video) printf("ds_fill_buffer(d_video) called\n");else
!                          printf("ds_fill_buffer(unknown 0x%X) called\n",ds);
    }
    while(1){
--- 108,112 ----
      if(ds==demux->audio) printf("ds_fill_buffer(d_audio) called\n");else
      if(ds==demux->video) printf("ds_fill_buffer(d_video) called\n");else
!                          printf("ds_fill_buffer(unknown 0x%X) called\n",(unsigned int)ds);
    }
    while(1){
***************
*** 213,221 ****
  }
  
! inline int ds_tell(demux_stream_t *ds){
!   return (ds->dpos-ds->buffer_size)+ds->buffer_pos;
! }
! 
! int demux_read_data(demux_stream_t *ds,char* mem,int len){
  int x;
  int bytes=0;
--- 147,151 ----
  }
  
! int demux_read_data(demux_stream_t *ds,unsigned char* mem,int len){
  int x;
  int bytes=0;
***************
*** 233,254 ****
  }
  
- 
- #if 1
- #define demux_getc(ds) (\
-      (ds->buffer_pos<ds->buffer_size) ? ds->buffer[ds->buffer_pos++] \
-      :((!ds_fill_buffer(ds))? (-1) : ds->buffer[ds->buffer_pos++] ) )
- #else
- inline static int demux_getc(demux_stream_t *ds){
-   if(ds->buffer_pos>=ds->buffer_size){
-     if(!ds_fill_buffer(ds)){
- //      printf("DEMUX_GETC: EOF reached!\n");
-       return -1; // EOF
-     }
-   }
- //  printf("[%02X]",ds->buffer[ds->buffer_pos]);
-   return ds->buffer[ds->buffer_pos++];
- }
- #endif
- 
  void ds_free_packs(demux_stream_t *ds){
    demux_packet_t *dp=ds->first;
--- 163,166 ----
***************
*** 274,278 ****
  }
  
! int ds_get_packet(demux_stream_t *ds,char **start){
      while(1){
          int len;
--- 186,190 ----
  }
  
! int ds_get_packet(demux_stream_t *ds,unsigned char **start){
      while(1){
          int len;
***************
*** 291,295 ****
  }
  
! int ds_get_packet_sub(demux_stream_t *ds,char **start){
      while(1){
          int len;
--- 203,207 ----
  }
  
! int ds_get_packet_sub(demux_stream_t *ds,unsigned char **start){
      while(1){
          int len;

Index: dll_init.c
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** dll_init.c	2001/04/17 19:23:47	1.11
--- dll_init.c	2001/04/23 03:42:17	1.12
***************
*** 1,2 ****
--- 1,26 ----
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ #include "config.h"
+ 
+ extern int verbose; // defined in mplayer.c
+ 
+ #include "stream.h"
+ #include "demuxer.h"
+ 
+ #include "loader.h"
+ //#include "wine/mmreg.h"
+ //#include "wine/vfw.h"
+ #include "wine/avifmt.h"
+ 
+ #include "codec-cfg.h"
+ #include "stheader.h"
+ 
+ #include "libvo/img_format.h"
+ #include "linux/shmem.h"
+ 
+ extern char* win32_codec_name;  // must be set before calling DrvOpen() !!!
+ 
  // ACM audio and VfW video codecs initialization
  // based on the avifile library [http://divx.euro.ru]
***************
*** 101,105 ****
  
  
! int init_video_codec(){
    HRESULT ret;
    int yuv=0;
--- 125,129 ----
  
  
! int init_video_codec(sh_video_t *sh_video){
    HRESULT ret;
    int yuv=0;

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -r1.91 -r1.92
*** mplayer.c	2001/04/22 16:56:20	1.91
--- mplayer.c	2001/04/23 03:42:17	1.92
***************
*** 4,13 ****
  //#define SIMULATE_ALSA
  
- #ifdef USE_XMMP_AUDIO
- #define OUTBURST 4096
- #else
- //#define OUTBURST 1024
- #define OUTBURST 512
- #endif
  
  #include <stdio.h>
--- 4,7 ----
***************
*** 91,94 ****
--- 85,93 ----
  #define ABS(x) (((x)>=0)?(x):(-(x)))
  
+ static subtitle* subtitles=NULL;
+ void find_sub(subtitle* subtitles,int key);
+ 
+ 
+ #if 0
  //**************************************************************************//
  //             .SUB 
***************
*** 186,189 ****
--- 185,189 ----
  }
  
+ #endif
  
  //**************************************************************************//
***************
*** 235,247 ****
  
  #include "stream.h"
! #include "demuxer.c"
  
  #include "stheader.h"
  
  typedef struct {
    // file:
!   MainAVIHeader avih;
!   unsigned int movi_start;
!   unsigned int movi_end;
    // index:
    AVIINDEXENTRY* idx;
--- 235,249 ----
  
  #include "stream.h"
! #include "demuxer.h"
  
  #include "stheader.h"
  
+ #if 0
+ 
  typedef struct {
    // file:
! //  MainAVIHeader avih;
! //  unsigned int movi_start;
! //  unsigned int movi_end;
    // index:
    AVIINDEXENTRY* idx;
***************
*** 251,258 ****
    int idx_pos_v;
    int idx_offset;  // ennyit kell hozzaadni az index offset ertekekhez
-   // streams:
-   sh_audio_t* a_streams[256];
-   sh_video_t* v_streams[256];
-   char s_streams[32]; // dvd subtitles
    // video:
    unsigned int bitrate;
--- 253,256 ----
***************
*** 261,293 ****
  avi_header_t avi_header;
  
! #include "aviprint.c"
  
  sh_audio_t* new_sh_audio(int id){
!     if(avi_header.a_streams[id]){
          printf("Warning! Audio stream header %d redefined!\n",id);
      } else {
          printf("==> Found audio stream: %d\n",id);
!         avi_header.a_streams[id]=malloc(sizeof(sh_audio_t));
!         memset(avi_header.a_streams[id],0,sizeof(sh_audio_t));
      }
!     return avi_header.a_streams[id];
  }
  
  sh_video_t* new_sh_video(int id){
!     if(avi_header.v_streams[id]){
          printf("Warning! video stream header %d redefined!\n",id);
      } else {
          printf("==> Found video stream: %d\n",id);
!         avi_header.v_streams[id]=malloc(sizeof(sh_video_t));
!         memset(avi_header.v_streams[id],0,sizeof(sh_video_t));
      }
!     return avi_header.v_streams[id];
  }
  
  
! #include "demux_avi.c"
! #include "demux_mpg.c"
  
- demuxer_t *demuxer=NULL;
  demux_stream_t *d_audio=NULL;
  demux_stream_t *d_video=NULL;
--- 259,296 ----
  avi_header_t avi_header;
  
! #endif
! 
! int avi_bitrate=0;
  
+ demuxer_t *demuxer=NULL;
+ 
+ //#include "aviprint.c"
+ 
  sh_audio_t* new_sh_audio(int id){
!     if(demuxer->a_streams[id]){
          printf("Warning! Audio stream header %d redefined!\n",id);
      } else {
          printf("==> Found audio stream: %d\n",id);
!         demuxer->a_streams[id]=malloc(sizeof(sh_audio_t));
!         memset(demuxer->a_streams[id],0,sizeof(sh_audio_t));
      }
!     return demuxer->a_streams[id];
  }
  
  sh_video_t* new_sh_video(int id){
!     if(demuxer->v_streams[id]){
          printf("Warning! video stream header %d redefined!\n",id);
      } else {
          printf("==> Found video stream: %d\n",id);
!         demuxer->v_streams[id]=malloc(sizeof(sh_video_t));
!         memset(demuxer->v_streams[id],0,sizeof(sh_video_t));
      }
!     return demuxer->v_streams[id];
  }
  
  
! //#include "demux_avi.c"
! //#include "demux_mpg.c"
  
  demux_stream_t *d_audio=NULL;
  demux_stream_t *d_video=NULL;
***************
*** 301,307 ****
--- 304,326 ----
  int encode_bitrate=0;
  
+ extern int asf_packetsize;
+ 
+ extern float avi_audio_pts;
+ extern float avi_video_pts;
+ extern float avi_video_ftime;
+ extern int skip_video_frames;
+ 
+ void read_avi_header(demuxer_t *demuxer,int index_mode);
+ demux_stream_t* demux_avi_select_stream(demuxer_t *demux,unsigned int id);
+ 
+ int asf_check_header(demuxer_t *demuxer);
+ int read_asf_header(demuxer_t *demuxer);
+ 
  // MPEG video stream parser:
  #include "parse_es.c"
  
+ extern int num_elementary_packets100;
+ extern int num_elementary_packets101;
+ 
  extern picture_t *picture;
  
***************
*** 322,339 ****
  }
  
- // AC3 decoder buffer callback:
- static void ac3_fill_buffer(uint8_t **start,uint8_t **end){
-     int len=ds_get_packet(sh_audio->ds,(char**)start);
-     //printf("<ac3:%d>\n",len);
-     if(len<0)
-           *start = *end = NULL;
-     else
-           *end = *start + len;
- }
- 
- #include "alaw.c"
- #include "xa/xa_gsm.h"
  
! #include "dec_audio.c"
  
  //**************************************************************************//
--- 341,346 ----
  }
  
  
! //#include "dec_audio.c"
  
  //**************************************************************************//
***************
*** 387,399 ****
  
  // AVI file header reader/parser/writer:
! #include "aviheader.c"
! #include "aviwrite.c"
  
  // ASF headers:
! #include "asfheader.c"
! #include "demux_asf.c"
  
  // DLL codecs init routines
! #include "dll_init.c"
  
  // Common FIFO functions, and keyboard/event FIFO code
--- 394,406 ----
  
  // AVI file header reader/parser/writer:
! //#include "aviheader.c"
! //#include "aviwrite.c"
  
  // ASF headers:
! //#include "asfheader.c"
! //#include "demux_asf.c"
  
  // DLL codecs init routines
! //#include "dll_init.c"
  
  // Common FIFO functions, and keyboard/event FIFO code
***************
*** 444,448 ****
  
  int divx_quality=0;
- extern int vo_dbpp;
  
  int main(int argc,char* argv[], char *envp[]){
--- 451,454 ----
***************
*** 611,615 ****
    vcd_read_toc(f);
    ret=vcd_seek_to_track(f,vcd_track);
!   if(ret==-1){ printf("Error selecting VCD track!\n");return 1;}
    seek_to_byte+=ret;
    if(verbose) printf("VCD start byte position: 0x%X\n",seek_to_byte);
--- 617,621 ----
    vcd_read_toc(f);
    ret=vcd_seek_to_track(f,vcd_track);
!   if(ret<0){ printf("Error selecting VCD track!\n");return 1;}
    seek_to_byte+=ret;
    if(verbose) printf("VCD start byte position: 0x%X\n",seek_to_byte);
***************
*** 639,643 ****
  
  stream=new_stream(f,stream_type);
- 
  //============ Open & Sync stream and detect file format ===============
  
--- 645,648 ----
***************
*** 648,651 ****
--- 653,657 ----
  demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id,dvdsub_id);
  stream_seek(demuxer->stream,seek_to_byte);
+ //printf("stream3=0x%X vs. 0x%X\n",demuxer->stream,stream);
  { //---- RIFF header:
    int id=stream_read_dword_le(demuxer->stream); // "RIFF"
***************
*** 664,668 ****
    demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id,dvdsub_id);
    stream_seek(demuxer->stream,seek_to_byte);
!   if(asf_check_header()){
        printf("Detected ASF file format!\n");
        file_format=DEMUXER_TYPE_ASF;
--- 670,674 ----
    demuxer=new_demuxer(stream,DEMUXER_TYPE_ASF,audio_id,video_id,dvdsub_id);
    stream_seek(demuxer->stream,seek_to_byte);
!   if(asf_check_header(demuxer)){
        printf("Detected ASF file format!\n");
        file_format=DEMUXER_TYPE_ASF;
***************
*** 723,751 ****
   case DEMUXER_TYPE_AVI: {
    //---- AVI header:
!   read_avi_header(index_mode);
    stream_reset(demuxer->stream);
!   stream_seek(demuxer->stream,avi_header.movi_start);
!   avi_header.idx_pos=0;
!   avi_header.idx_pos_a=0;
!   avi_header.idx_pos_v=0;
!   if(avi_header.idx_size>0){
      // decide index format:
!     if(avi_header.idx[0].dwChunkOffset<avi_header.movi_start)
!       avi_header.idx_offset=avi_header.movi_start-4;
      else
!       avi_header.idx_offset=0;
!     if(verbose) printf("AVI index offset: %d\n",avi_header.idx_offset);
    }
!   demuxer->endpos=avi_header.movi_end;
    
!   if(avi_header.idx_size>0){
        // check that file is non-interleaved:
        int i;
        int a_pos=-1;
        int v_pos=-1;
!       for(i=0;i<avi_header.idx_size;i++){
!         AVIINDEXENTRY* idx=&avi_header.idx[i];
          demux_stream_t* ds=demux_avi_select_stream(demuxer,idx->ckid);
!         int pos=idx->dwChunkOffset+avi_header.idx_offset;
          if(a_pos==-1 && ds==demuxer->audio){
            a_pos=pos;
--- 729,757 ----
   case DEMUXER_TYPE_AVI: {
    //---- AVI header:
!   read_avi_header(demuxer,index_mode);
    stream_reset(demuxer->stream);
!   stream_seek(demuxer->stream,demuxer->movi_start);
!   demuxer->idx_pos=0;
!   demuxer->idx_pos_a=0;
!   demuxer->idx_pos_v=0;
!   if(demuxer->idx_size>0){
      // decide index format:
!     if(((AVIINDEXENTRY *)demuxer->idx)[0].dwChunkOffset<demuxer->movi_start)
!       demuxer->idx_offset=demuxer->movi_start-4;
      else
!       demuxer->idx_offset=0;
!     if(verbose) printf("AVI index offset: %d\n",demuxer->idx_offset);
    }
! //  demuxer->endpos=avi_header.movi_end;
    
!   if(demuxer->idx_size>0){
        // check that file is non-interleaved:
        int i;
        int a_pos=-1;
        int v_pos=-1;
!       for(i=0;i<demuxer->idx_size;i++){
!         AVIINDEXENTRY* idx=&((AVIINDEXENTRY *)demuxer->idx)[i];
          demux_stream_t* ds=demux_avi_select_stream(demuxer,idx->ckid);
!         int pos=idx->dwChunkOffset+demuxer->idx_offset;
          if(a_pos==-1 && ds==demuxer->audio){
            a_pos=pos;
***************
*** 776,781 ****
            printf("Using NON-INTERLEAVED Broken AVI file-format!\n");
            demuxer->type=DEMUXER_TYPE_AVI_NINI; // HACK!!!!
! 	  avi_header.idx_pos_a=
! 	  avi_header.idx_pos_v=avi_header.movi_start;
  	  pts_from_bps=1; // force BPS sync!
        }
--- 782,787 ----
            printf("Using NON-INTERLEAVED Broken AVI file-format!\n");
            demuxer->type=DEMUXER_TYPE_AVI_NINI; // HACK!!!!
! 	  demuxer->idx_pos_a=
! 	  demuxer->idx_pos_v=demuxer->movi_start;
  	  pts_from_bps=1; // force BPS sync!
        }
***************
*** 801,808 ****
    sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
    // calculating video bitrate:
!   avi_header.bitrate=avi_header.movi_end-avi_header.movi_start-avi_header.idx_size*8;
!   if(sh_audio) avi_header.bitrate-=sh_audio->audio.dwLength;
!   if(verbose) printf("AVI video length=%d\n",avi_header.bitrate);
!   avi_header.bitrate=((float)avi_header.bitrate/(float)sh_video->video.dwLength)*sh_video->fps;
    printf("VIDEO:  [%.4s]  %dx%d  %dbpp  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
      &sh_video->bih->biCompression,
--- 807,814 ----
    sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
    // calculating video bitrate:
!   avi_bitrate=demuxer->movi_end-demuxer->movi_start-demuxer->idx_size*8;
!   if(sh_audio) avi_bitrate-=sh_audio->audio.dwLength;
!   if(verbose) printf("AVI video length=%d\n",avi_bitrate);
!   avi_bitrate=((float)avi_bitrate/(float)sh_video->video.dwLength)*sh_video->fps;
    printf("VIDEO:  [%.4s]  %dx%d  %dbpp  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
      &sh_video->bih->biCompression,
***************
*** 811,825 ****
      sh_video->bih->biBitCount,
      sh_video->fps,
!     avi_header.bitrate*0.008f,
!     avi_header.bitrate/1024.0f );
    break;
   }
   case DEMUXER_TYPE_ASF: {
    //---- ASF header:
!   read_asf_header();
    stream_reset(demuxer->stream);
!   stream_seek(demuxer->stream,avi_header.movi_start);
!   avi_header.idx_pos=0;
!   demuxer->endpos=avi_header.movi_end;
    if(!ds_fill_buffer(d_video)){
      printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
--- 817,831 ----
      sh_video->bih->biBitCount,
      sh_video->fps,
!     avi_bitrate*0.008f,
!     avi_bitrate/1024.0f );
    break;
   }
   case DEMUXER_TYPE_ASF: {
    //---- ASF header:
!   read_asf_header(demuxer);
    stream_reset(demuxer->stream);
!   stream_seek(demuxer->stream,demuxer->movi_start);
!   demuxer->idx_pos=0;
! //  demuxer->endpos=avi_header.movi_end;
    if(!ds_fill_buffer(d_video)){
      printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
***************
*** 949,953 ****
    if(!f){ printf("Can't open dump file!!!\n");exit(1); }
    while(!ds->eof){
!     char* start;
      int in_size=ds_get_packet(ds,&start);
      if(in_size>0) fwrite(start,in_size,1,f);
--- 955,959 ----
    if(!f){ printf("Can't open dump file!!!\n");exit(1); }
    while(!ds->eof){
!     unsigned char* start;
      int in_size=ds_get_packet(ds,&start);
      if(in_size>0) fwrite(start,in_size,1,f);
***************
*** 1012,1016 ****
  switch(sh_video->codec->driver){
   case 2: {
!    if(!init_video_codec(out_fmt)) exit(1);
     if(verbose) printf("INFO: Win32 video codec init OK!\n");
     break;
--- 1018,1022 ----
  switch(sh_video->codec->driver){
   case 2: {
!    if(!init_video_codec(sh_video)) exit(1);
     if(verbose) printf("INFO: Win32 video codec init OK!\n");
     break;
***************
*** 1440,1444 ****
      unsigned int t2;
      DEC_FRAME dec_frame;
!     char* start=NULL;
      int in_size=ds_get_packet(d_video,&start);
      if(in_size<0){ eof=1;break;}
--- 1446,1450 ----
      unsigned int t2;
      DEC_FRAME dec_frame;
!     unsigned char* start=NULL;
      int in_size=ds_get_packet(d_video,&start);
      if(in_size<0){ eof=1;break;}
***************
*** 1462,1466 ****
  #ifdef USE_DIRECTSHOW
    case 4: {        // W32/DirectShow
!     char* start=NULL;
      unsigned int t=GetTimer();
      unsigned int t2;
--- 1468,1472 ----
  #ifdef USE_DIRECTSHOW
    case 4: {        // W32/DirectShow
!     unsigned char* start=NULL;
      unsigned int t=GetTimer();
      unsigned int t2;
***************
*** 1490,1494 ****
    case 2: {
      HRESULT ret;
!     char* start=NULL;
      unsigned int t=GetTimer();
      unsigned int t2;
--- 1496,1500 ----
    case 2: {
      HRESULT ret;
!     unsigned char* start=NULL;
      unsigned int t=GetTimer();
      unsigned int t2;
***************
*** 1763,1768 ****
    }
    if(rel_seek_secs)
!   if(file_format==DEMUXER_TYPE_AVI && avi_header.idx_size<=0){
!     printf("Can't seek in raw .AVI streams! (index required)  \n");
    } else {
      int skip_audio_bytes=0;
--- 1769,1774 ----
    }
    if(rel_seek_secs)
!   if(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");
    } else {
      int skip_audio_bytes=0;
***************
*** 1796,1804 ****
        if(rel_seek_frames>0){
          // seek forward
!         while(video_chunk_pos<avi_header.idx_size){
!           int id=avi_header.idx[video_chunk_pos].ckid;
  //          if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
            if(avi_stream_id(id)==d_video->id){  // video frame
!             if((--rel_seek_frames)<0 && avi_header.idx[video_chunk_pos].dwFlags&AVIIF_KEYFRAME) break;
              v_pts+=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
              ++skip_audio_bytes;
--- 1802,1810 ----
        if(rel_seek_frames>0){
          // seek forward
!         while(video_chunk_pos<demuxer->idx_size){
!           int id=((AVIINDEXENTRY *)demuxer->idx)[video_chunk_pos].ckid;
  //          if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
            if(avi_stream_id(id)==d_video->id){  // video frame
!             if((--rel_seek_frames)<0 && ((AVIINDEXENTRY *)demuxer->idx)[video_chunk_pos].dwFlags&AVIIF_KEYFRAME) break;
              v_pts+=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
              ++skip_audio_bytes;
***************
*** 1809,1816 ****
          // seek backward
          while(video_chunk_pos>=0){
!           int id=avi_header.idx[video_chunk_pos].ckid;
  //          if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
            if(avi_stream_id(id)==d_video->id){  // video frame
!             if((++rel_seek_frames)>0 && avi_header.idx[video_chunk_pos].dwFlags&AVIIF_KEYFRAME) break;
              v_pts-=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
              --skip_audio_bytes;
--- 1815,1822 ----
          // seek backward
          while(video_chunk_pos>=0){
!           int id=((AVIINDEXENTRY *)demuxer->idx)[video_chunk_pos].ckid;
  //          if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
            if(avi_stream_id(id)==d_video->id){  // video frame
!             if((++rel_seek_frames)>0 && ((AVIINDEXENTRY *)demuxer->idx)[video_chunk_pos].dwFlags&AVIIF_KEYFRAME) break;
              v_pts-=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
              --skip_audio_bytes;
***************
*** 1819,1824 ****
          }
        }
!       avi_header.idx_pos_a=avi_header.idx_pos_v=
!       avi_header.idx_pos=video_chunk_pos;
  //      printf("%d frames skipped\n",skip_audio_bytes);
  
--- 1825,1830 ----
          }
        }
!       demuxer->idx_pos_a=demuxer->idx_pos_v=
!       demuxer->idx_pos=video_chunk_pos;
  //      printf("%d frames skipped\n",skip_audio_bytes);
  
***************
*** 1827,1831 ****
        avi_video_pts=0;
        for(i=0;i<video_chunk_pos;i++){
!           int id=avi_header.idx[i].ckid;
  //          if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
            if(avi_stream_id(id)==d_video->id){  // video frame
--- 1833,1837 ----
        avi_video_pts=0;
        for(i=0;i<video_chunk_pos;i++){
!           int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
  //          if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
            if(avi_stream_id(id)==d_video->id){  // video frame
***************
*** 1855,1869 ****
          curr_audio_pos/=sh_audio->wf->nBlockAlign;
          curr_audio_pos*=sh_audio->wf->nBlockAlign;
!         avi_header.audio_seekable=1;
  #endif
  
          // find audio chunk pos:
            for(i=0;i<video_chunk_pos;i++){
!             int id=avi_header.idx[i].ckid;
              //if(TWOCCFromFOURCC(id)==cktypeWAVEbytes){
              if(avi_stream_id(id)==d_audio->id){
                int aid=StreamFromFOURCC(id);
                if(d_audio->id==aid || d_audio->id==-1){
!                 len=avi_header.idx[i].dwChunkLength;
                  last=i;
                  if(apos<=curr_audio_pos && curr_audio_pos<(apos+len)){
--- 1861,1875 ----
          curr_audio_pos/=sh_audio->wf->nBlockAlign;
          curr_audio_pos*=sh_audio->wf->nBlockAlign;
!         demuxer->audio_seekable=1;
  #endif
  
          // find audio chunk pos:
            for(i=0;i<video_chunk_pos;i++){
!             int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
              //if(TWOCCFromFOURCC(id)==cktypeWAVEbytes){
              if(avi_stream_id(id)==d_audio->id){
                int aid=StreamFromFOURCC(id);
                if(d_audio->id==aid || d_audio->id==-1){
!                 len=((AVIINDEXENTRY *)demuxer->idx)[i].dwChunkLength;
                  last=i;
                  if(apos<=curr_audio_pos && curr_audio_pos<(apos+len)){
***************
*** 1884,1889 ****
            d_audio->pos=audio_chunk_pos;
            d_audio->dpos=apos;
!           avi_header.idx_pos_a=avi_header.idx_pos_v=
!           avi_header.idx_pos=audio_chunk_pos;
  
            if(!(sh_audio->codec->flags&CODECS_FLAG_SEEKABLE)){
--- 1890,1895 ----
            d_audio->pos=audio_chunk_pos;
            d_audio->dpos=apos;
!           demuxer->idx_pos_a=demuxer->idx_pos_v=
!           demuxer->idx_pos=audio_chunk_pos;
  
            if(!(sh_audio->codec->flags&CODECS_FLAG_SEEKABLE)){
***************
*** 1907,1913 ****
            // calc skip_video_frames & adjust video pts counter:
  //          i=last;
!           i=avi_header.idx_pos;
            while(i<video_chunk_pos){
!             int id=avi_header.idx[i].ckid;
  //            if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
              if(avi_stream_id(id)==d_video->id){  // video frame
--- 1913,1919 ----
            // calc skip_video_frames & adjust video pts counter:
  //          i=last;
!           i=demuxer->idx_pos;
            while(i<video_chunk_pos){
!             int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
  //            if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
              if(avi_stream_id(id)==d_video->id){  // video frame
***************
*** 1922,1926 ****
  
        if(verbose) printf("SEEK: idx=%d  (a:%d v:%d)  v.skip=%d  a.skip=%d/%4.3f  \n",
!         avi_header.idx_pos,audio_chunk_pos,video_chunk_pos,
          skip_video_frames,skip_audio_bytes,skip_audio_secs);
  
--- 1928,1932 ----
  
        if(verbose) printf("SEEK: idx=%d  (a:%d v:%d)  v.skip=%d  a.skip=%d/%4.3f  \n",
!         demuxer->idx_pos,audio_chunk_pos,video_chunk_pos,
          skip_video_frames,skip_audio_bytes,skip_audio_secs);
  
***************
*** 1929,1935 ****
          osd_visible=sh_video->fps; // 1 sec
          vo_osd_progbar_type=0;
!         vo_osd_progbar_value=(demuxer->filepos)/((avi_header.movi_end-avi_header.movi_start)>>8);
          //printf("avi filepos = %d  \n",vo_osd_progbar_value);
!   //      printf("avi filepos = %d  (len=%d)  \n",demuxer->filepos,(avi_header.movi_end-avi_header.movi_start));
        }
  
--- 1935,1941 ----
          osd_visible=sh_video->fps; // 1 sec
          vo_osd_progbar_type=0;
!         vo_osd_progbar_value=(demuxer->filepos)/((demuxer->movi_end-demuxer->movi_start)>>8);
          //printf("avi filepos = %d  \n",vo_osd_progbar_value);
!   //      printf("avi filepos = %d  (len=%d)  \n",demuxer->filepos,(demuxer->movi_end-demuxer->movi_start));
        }
  
***************
*** 1941,1945 ****
      float p_rate=10; // packets / sec
      int rel_seek_packs=rel_seek_secs*p_rate;
!     int rel_seek_bytes=rel_seek_packs*fileh.packetsize;
      int newpos;
      //printf("ASF: packs: %d  duration: %d  \n",(int)fileh.packets,*((int*)&fileh.duration));
--- 1947,1951 ----
      float p_rate=10; // packets / sec
      int rel_seek_packs=rel_seek_secs*p_rate;
!     int rel_seek_bytes=rel_seek_packs*asf_packetsize;
      int newpos;
      //printf("ASF: packs: %d  duration: %d  \n",(int)fileh.packets,*((int*)&fileh.duration));
***************
*** 2058,2062 ****
        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;
    }
--- 2064,2068 ----
        if(sub_fps==0) sub_fps=sh_video->fps;
        current_module="find_sub";
!       find_sub(subtitles,sub_uses_time?(100*(v_pts+sub_delay)):((v_pts+sub_delay)*sub_fps)); // FIXME! frame counter...
        current_module=NULL;
    }

Index: stheader.h
===================================================================
RCS file: /cvsroot/mplayer/main/stheader.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** stheader.h	2001/04/15 14:33:49	1.6
--- stheader.h	2001/04/23 03:42:17	1.7
***************
*** 34,38 ****
    int audio_out_minsize;
    // other codecs:
!   ac3_frame_t *ac3_frame;
    int pcm_bswap;
  } sh_audio_t;
--- 34,39 ----
    int audio_out_minsize;
    // other codecs:
! //  ac3_frame_t *ac3_frame;
!   void* ac3_frame;
    int pcm_bswap;
  } sh_audio_t;
***************
*** 58,60 ****
--- 59,63 ----
  } sh_video_t;
  
+ sh_audio_t* new_sh_audio(int id);
+ sh_video_t* new_sh_video(int id);
  

Index: vcd_read.c
===================================================================
RCS file: /cvsroot/mplayer/main/vcd_read.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** vcd_read.c	2001/02/24 20:28:43	1.1.1.1
--- vcd_read.c	2001/04/23 03:42:17	1.2
***************
*** 2,6 ****
  static struct cdrom_tocentry vcd_entry;
  
! void vcd_set_msf(unsigned int sect){
    vcd_entry.cdte_addr.msf.frame=sect%75;
    sect=sect/75;
--- 2,6 ----
  static struct cdrom_tocentry vcd_entry;
  
! static inline void vcd_set_msf(unsigned int sect){
    vcd_entry.cdte_addr.msf.frame=sect%75;
    sect=sect/75;
***************
*** 10,14 ****
  }
  
! unsigned int vcd_get_msf(){
    return vcd_entry.cdte_addr.msf.frame +
          (vcd_entry.cdte_addr.msf.second+
--- 10,14 ----
  }
  
! static inline unsigned int vcd_get_msf(){
    return vcd_entry.cdte_addr.msf.frame +
          (vcd_entry.cdte_addr.msf.second+
***************
*** 21,27 ****
    if (ioctl(fd, CDROMREADTOCENTRY, &vcd_entry)) {
      perror("ioctl dif1");
!     return 0;
    }
!   return 1;
  }
  
--- 21,27 ----
    if (ioctl(fd, CDROMREADTOCENTRY, &vcd_entry)) {
      perror("ioctl dif1");
!     return -1;
    }
!   return VCD_SECTOR_DATA*vcd_get_msf();
  }
  
***************
*** 53,62 ****
  }
  
- #define VCD_SECTOR_SIZE 2352
- #define VCD_SECTOR_OFFS 24
- #define VCD_SECTOR_DATA 2324
  static char vcd_buf[VCD_SECTOR_SIZE];
  
! int vcd_read(int fd,char *mem){
        memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf));
        if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF?
--- 53,59 ----
  }
  
  static char vcd_buf[VCD_SECTOR_SIZE];
  
! static int vcd_read(int fd,char *mem){
        memcpy(vcd_buf,&vcd_entry.cdte_addr.msf,sizeof(struct cdrom_msf));
        if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; // EOF?
***************
*** 92,96 ****
  }
  
! void vcd_cache_seek(int sect){
    vcd_cache_current=sect;
  }
--- 89,93 ----
  }
  
! static inline void vcd_cache_seek(int sect){
    vcd_cache_current=sect;
  }


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



More information about the MPlayer-cvslog mailing list