# HG changeset patch # User arpi # Date 1002059085 0 # Node ID df41903fd7d7922fbc946c2f18b1768cc5f8c65a # Parent 2ee71a0754f7de30a58996431ddfb73497a65c4b VfW stuff moved to dll_init, warnings fixed, using dll_init.h diff -r 2ee71a0754f7 -r df41903fd7d7 dec_audio.c --- a/dec_audio.c Tue Oct 02 21:24:02 2001 +0000 +++ b/dec_audio.c Tue Oct 02 21:44:45 2001 +0000 @@ -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(yds->buffer_pos+=y-x; // put back data (HACK!) if(len2>0){ diff -r 2ee71a0754f7 -r df41903fd7d7 dec_video.c --- a/dec_video.c Tue Oct 02 21:24:02 2001 +0000 +++ b/dec_video.c Tue Oct 02 21:44:45 2001 +0000 @@ -29,6 +29,8 @@ #include "codec-cfg.h" #include "stheader.h" +#include "dll_init.h" + //#include //#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;ydisp_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; diff -r 2ee71a0754f7 -r df41903fd7d7 dll_init.c --- a/dll_init.c Tue Oct 02 21:24:02 2001 +0000 +++ b/dll_init.c Tue Oct 02 21:44:45 2001 +0000 @@ -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; +} + diff -r 2ee71a0754f7 -r df41903fd7d7 dll_init.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dll_init.h Tue Oct 02 21:44:45 2001 +0000 @@ -0,0 +1,10 @@ + +// 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);