[Mplayer-cvslog] CVS: main dll_init.h,NONE,1.1 dll_init.c,1.28,1.29 dec_audio.c,1.40,1.41 dec_video.c,1.43,1.44

Arpi of Ize arpi at mplayer.dev.hu
Tue Oct 2 23:44:51 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv13055

Modified Files:
	dll_init.c dec_audio.c dec_video.c 
Added Files:
	dll_init.h 
Log Message:
VfW stuff moved to dll_init, warnings fixed, using dll_init.h

--- NEW FILE ---

// Win32 VfW/ACM interface:

extern char* win32_codec_name;  // must be set before calling DrvOpen() !!!

int init_acm_audio_codec(sh_audio_t *sh_audio);
int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen);

int init_vfw_video_codec(sh_video_t *sh_video,int ex);
int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex);

Index: dll_init.c
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- dll_init.c	26 Sep 2001 21:35:14 -0000	1.28
+++ dll_init.c	2 Oct 2001 21:44:45 -0000	1.29
@@ -18,11 +18,11 @@
 #include "codec-cfg.h"
 #include "stheader.h"
 
+#include "dll_init.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]
 
@@ -143,7 +143,7 @@
 
 
 
-int init_video_codec(sh_video_t *sh_video,int ex){
+int init_vfw_video_codec(sh_video_t *sh_video,int ex){
   HRESULT ret;
   int yuv=0;
   unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx];
@@ -282,7 +282,7 @@
     return 0;
   }
 
-  sh_video->our_out_buffer = memalign(64,sh_video->o_bih.biSizeImage);
+  sh_video->our_out_buffer = (char*)memalign(64,sh_video->o_bih.biSizeImage);
   if(!sh_video->our_out_buffer){
     mp_msg(MSGT_WIN32,MSGL_ERR,MSGTR_NoMemForDecodedImage, sh_video->o_bih.biSizeImage);
     return 0;
@@ -296,3 +296,27 @@
   mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n");
   return 1;
 }
+
+int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex){
+    HRESULT ret;
+
+    sh_video->bih->biSizeImage = in_size;
+
+    if(ex)
+      ret = ICDecompressEx(sh_video->hic, 
+	  ( (sh_video->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) |
+	  ( (drop_frame==2 && !(sh_video->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , 
+                         sh_video->bih,   start,
+                        &sh_video->o_bih,
+                        drop_frame ? 0 : sh_video->our_out_buffer);
+    else
+      ret = ICDecompress(sh_video->hic, 
+	  ( (sh_video->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) |
+	  ( (drop_frame==2 && !(sh_video->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , 
+                         sh_video->bih,   start,
+                        &sh_video->o_bih,
+                        drop_frame ? 0 : sh_video->our_out_buffer);
+
+    return (int)ret;
+}
+

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- dec_audio.c	26 Sep 2001 21:35:13 -0000	1.40
+++ dec_audio.c	2 Oct 2001 21:44:45 -0000	1.41
@@ -25,6 +25,8 @@
 #include "codec-cfg.h"
 #include "stheader.h"
 
+#include "dll_init.h"
+
 #include "mp3lib/mp3.h"
 #include "libac3/ac3.h"
 
@@ -51,8 +53,6 @@
     extern int avcodec_inited;
 #endif
 
-extern int init_acm_audio_codec(sh_audio_t *sh_audio);
-extern int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen);
 int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen);
 
 
@@ -512,7 +512,7 @@
 	    int len2=0;
 	    int x=ds_get_packet(sh_audio->ds,&start);
 	    if(x<=0) break; // error
-	    y=avcodec_decode_audio(&lavc_context,buf,&len2,start,x);
+	    y=avcodec_decode_audio(&lavc_context,(INT16*)buf,&len2,start,x);
 	    if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; }
 	    if(y<x) sh_audio->ds->buffer_pos+=y-x;  // put back data (HACK!)
 	    if(len2>0){

Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- dec_video.c	2 Oct 2001 08:31:46 -0000	1.43
+++ dec_video.c	2 Oct 2001 21:44:45 -0000	1.44
@@ -29,6 +29,8 @@
 #include "codec-cfg.h"
 #include "stheader.h"
 
+#include "dll_init.h"
+
 //#include <inttypes.h>
 //#include "libvo/img_format.h"
 
@@ -43,7 +45,6 @@
 
 extern picture_t *picture;	// exported from libmpeg2/decode.c
 
-extern int init_video_codec(sh_video_t *sh_video,int ex);
 
 #ifdef USE_DIRECTSHOW
 #include "loader/DirectShow/DS_VideoDec.h"
@@ -145,7 +146,7 @@
     return 0;
 }
 
-int uninit_video(sh_video_t *sh_video){
+void uninit_video(sh_video_t *sh_video){
     if(!sh_video->inited) return;
     mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d  \n",sh_video->codec->driver);
     switch(sh_video->codec->driver){
@@ -179,14 +180,14 @@
 switch(sh_video->codec->driver){
 #ifdef USE_WIN32DLL
  case VFM_VFW: {
-   if(!init_video_codec(sh_video,0)) {
+   if(!init_vfw_video_codec(sh_video,0)) {
       return 0;
    }  
    mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
    break;
  }
  case VFM_VFWEX: {
-   if(!init_video_codec(sh_video,1)) {
+   if(!init_vfw_video_codec(sh_video,1)) {
       return 0;
    }  
    mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n");
@@ -222,7 +223,7 @@
      DS_VideoDecoder_SetDestFmt(out_fmt&255,0);           // RGB/BGR
    }
 
-   sh_video->our_out_buffer = memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!!
+   sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!!
 
    DS_VideoDecoder_Start();
 
@@ -288,7 +289,7 @@
 	decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
 	dec_set.postproc_level = divx_quality;
 	decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
-	sh_video->our_out_buffer = memalign(64,((bits*dec_param.x_dim+7)/8)*dec_param.y_dim);
+	sh_video->our_out_buffer = (char*)memalign(64,((bits*dec_param.x_dim+7)/8)*dec_param.y_dim);
 //	sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5);
    }
    mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n");
@@ -342,7 +343,7 @@
  }
  case VFM_RLE: {
    int bpp=((out_fmt&255)+7)/8; // RGB only
-   sh_video->our_out_buffer = memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!!
+   sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!!
    if(bpp==2){  // 15 or 16 bpp ==> palette conversion!
      unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40);
      //int cols=(sh_video->bih->biSize-40)/4;
@@ -486,7 +487,7 @@
 	    int y;
 	    // temporary hack - FIXME
 	    if(!sh_video->our_out_buffer)
-		sh_video->our_out_buffer = memalign(64,sh_video->disp_w*sh_video->disp_h*2);
+		sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*2);
 	    for(y=0;y<sh_video->disp_h;y++){
 	      unsigned char *s0=lavc_picture.data[0]+lavc_picture.linesize[0]*y;
 	      unsigned char *s1=lavc_picture.data[1]+lavc_picture.linesize[1]*y;
@@ -512,33 +513,12 @@
   case VFM_VFWEX:
   case VFM_VFW:
   {
-    HRESULT ret;
-    
+    int ret;
     if(!in_size) break;
-    
-      sh_video->bih->biSizeImage = in_size;
-
-//      sh_video->bih->biWidth = 1280;
-//      sh_video->o_bih.biWidth = 1280;
-	    //      ret = ICDecompress(avi_header.hic, ICDECOMPRESS_NOTKEYFRAME|(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL), 
-
-if(sh_video->codec->driver==VFM_VFWEX)
-      ret = ICDecompressEx(sh_video->hic, 
-	  ( (sh_video->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) |
-	  ( (drop_frame==2 && !(sh_video->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , 
-                         sh_video->bih,   start,
-                        &sh_video->o_bih,
-                        drop_frame ? 0 : sh_video->our_out_buffer);
-else
-      ret = ICDecompress(sh_video->hic, 
-	  ( (sh_video->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) |
-	  ( (drop_frame==2 && !(sh_video->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , 
-                         sh_video->bih,   start,
-                        &sh_video->o_bih,
-                        drop_frame ? 0 : sh_video->our_out_buffer);
-
-      if(ret){ mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",(int)ret);break; }
-
+    if((ret=vfw_decode_video(sh_video,start,in_size,drop_frame,(sh_video->codec->driver==VFM_VFWEX) ))){
+      mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret);
+      break;
+    }
     if(!drop_frame) blit_frame=3;
     break;
   }
@@ -552,7 +532,7 @@
 	packet.size=in_size-4;
 	packet.timestamp=sh_video->timer*90000.0;
 	packet.id=0x1E0; //+sh_video->ds->id;
-	planes[0]=&packet;
+	planes[0]=(uint8_t*)(&packet);
 	blit_frame=2;
     } else {
 	// software decoding:
@@ -647,7 +627,7 @@
 //   sh_video=d_video->sh;sh_video->ds=d_video;
    mpeg2_init();
    // ========= Read & process sequence header & extension ============
-   if(!videobuffer) videobuffer=memalign(8,VIDEOBUFFER_SIZE);
+   if(!videobuffer) videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE);
    if(!videobuffer){ 
      mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
      return 0;




More information about the MPlayer-cvslog mailing list