# HG changeset patch # User arpi # Date 1015535219 0 # Node ID f412b0110524be5b27ad09a310a5337a3090b5d2 # Parent eb57973314aec47b0d2aadd6813f34a66b313540 fli and msvideo1 added diff -r eb57973314ae -r f412b0110524 libmpcodecs/Makefile --- a/libmpcodecs/Makefile Thu Mar 07 20:43:17 2002 +0000 +++ b/libmpcodecs/Makefile Thu Mar 07 21:06:59 2002 +0000 @@ -3,7 +3,7 @@ LIBNAME = libmpcodecs.a -SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_rle.c +SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_rle.c vd_msvidc.c vd_fli.c OBJS=$(SRCS:.c=.o) diff -r eb57973314ae -r f412b0110524 libmpcodecs/vd.c --- a/libmpcodecs/vd.c Thu Mar 07 20:43:17 2002 +0000 +++ b/libmpcodecs/vd.c Thu Mar 07 21:06:59 2002 +0000 @@ -33,6 +33,8 @@ extern vd_functions_t mpcodecs_vd_raw; extern vd_functions_t mpcodecs_vd_xanim; extern vd_functions_t mpcodecs_vd_rle; +extern vd_functions_t mpcodecs_vd_msvidc; +extern vd_functions_t mpcodecs_vd_fli; vd_functions_t* mpcodecs_vd_drivers[] = { &mpcodecs_vd_null, @@ -56,6 +58,8 @@ #endif &mpcodecs_vd_raw, &mpcodecs_vd_rle, + &mpcodecs_vd_msvidc, + &mpcodecs_vd_fli, #ifdef USE_XANIM &mpcodecs_vd_xanim, #endif diff -r eb57973314ae -r f412b0110524 libmpcodecs/vd_fli.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libmpcodecs/vd_fli.c Thu Mar 07 21:06:59 2002 +0000 @@ -0,0 +1,65 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "Autodesk FLI/FLC Animation decoder", + "fli", + VFM_FLI, + "A'rpi", + "Mike Melanson", + "native codec" +}; + +LIBVD_EXTERN(fli) + +// to set/get/query special features/parameters +static int control(sh_video_t *sh,int cmd,void* arg,...){ + return CONTROL_UNKNOWN; +} + +void *init_fli_decoder(int width, int height); + +void decode_fli_frame( + unsigned char *encoded, + int encoded_size, + unsigned char *decoded, + int width, + int height, + int bytes_per_pixel, + void *context); + +// init driver +static int init(sh_video_t *sh){ + mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24); + sh->context = init_fli_decoder(sh->disp_w, sh->disp_h); + return 1; +} + +// uninit driver +static void uninit(sh_video_t *sh){ +} + +//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); + +// decode a frame +static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ + mp_image_t* mpi; + if(len<=0) return NULL; // skipped frame + + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, + sh->disp_w, sh->disp_h); + if(!mpi) return NULL; + + decode_fli_frame( + data, len, mpi->planes[0], + sh->disp_w, sh->disp_h, + mpi->bpp/8, + sh->context); + + return mpi; +} diff -r eb57973314ae -r f412b0110524 libmpcodecs/vd_msvidc.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libmpcodecs/vd_msvidc.c Thu Mar 07 21:06:59 2002 +0000 @@ -0,0 +1,76 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "Microsoft Video 1 / CRAM decoder", + "msvidc", + VFM_MSVIDC, + "A'rpi", + "Mike Melanson", + "native codec" +}; + +LIBVD_EXTERN(msvidc) + +// to set/get/query special features/parameters +static int control(sh_video_t *sh,int cmd,void* arg,...){ + return CONTROL_UNKNOWN; +} + +// init driver +static int init(sh_video_t *sh){ + mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24); + return 1; +} + +// uninit driver +static void uninit(sh_video_t *sh){ +} + +//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); + +void AVI_Decode_Video1_16( + char *encoded, + int encoded_size, + char *decoded, + int width, + int height, + int bytes_per_pixel); + +void AVI_Decode_Video1_8( + char *encoded, + int encoded_size, + char *decoded, + int width, + int height, + unsigned char *palette_map, + int bytes_per_pixel); + +// decode a frame +static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ + mp_image_t* mpi; + if(len<=0) return NULL; // skipped frame + + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_STATIC, MP_IMGFLAG_PRESERVE, + sh->disp_w, sh->disp_h); + if(!mpi) return NULL; + + if (sh->bih->biBitCount == 16) + AVI_Decode_Video1_16( + data, len, mpi->planes[0], + sh->disp_w, sh->disp_h, + mpi->bpp/8); + else + AVI_Decode_Video1_8( + data, len, mpi->planes[0], + sh->disp_w, sh->disp_h, + (unsigned char *)sh->bih+40, + mpi->bpp/8); + + return mpi; +}