diff options
-rw-r--r-- | libmpcodecs/Makefile | 2 | ||||
-rw-r--r-- | libmpcodecs/vd.c | 4 | ||||
-rw-r--r-- | libmpcodecs/vd_fli.c | 65 | ||||
-rw-r--r-- | libmpcodecs/vd_msvidc.c | 76 |
4 files changed, 146 insertions, 1 deletions
diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile index f0cce2e411..b4870c1ca8 100644 --- a/libmpcodecs/Makefile +++ b/libmpcodecs/Makefile @@ -3,7 +3,7 @@ include ../config.mak 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 --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index a7db03dd6f..e4a1a2abdf 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -33,6 +33,8 @@ extern vd_functions_t mpcodecs_vd_divx4; 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 @@ vd_functions_t* mpcodecs_vd_drivers[] = { #endif &mpcodecs_vd_raw, &mpcodecs_vd_rle, + &mpcodecs_vd_msvidc, + &mpcodecs_vd_fli, #ifdef USE_XANIM &mpcodecs_vd_xanim, #endif diff --git a/libmpcodecs/vd_fli.c b/libmpcodecs/vd_fli.c new file mode 100644 index 0000000000..2f62e4d1ba --- /dev/null +++ b/libmpcodecs/vd_fli.c @@ -0,0 +1,65 @@ +#include <stdio.h> +#include <stdlib.h> + +#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 --git a/libmpcodecs/vd_msvidc.c b/libmpcodecs/vd_msvidc.c new file mode 100644 index 0000000000..2e92da73a6 --- /dev/null +++ b/libmpcodecs/vd_msvidc.c @@ -0,0 +1,76 @@ +#include <stdio.h> +#include <stdlib.h> + +#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; +} |