From 625396332a1d8d6c49f3a06526d897c5b45bc788 Mon Sep 17 00:00:00 2001 From: arpi Date: Fri, 8 Mar 2002 07:14:34 +0000 Subject: cyuv, nuv, qtrle, qtsmc, roq added git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4990 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/Makefile | 2 +- libmpcodecs/vd.c | 10 +++++++ libmpcodecs/vd_cyuv.c | 57 +++++++++++++++++++++++++++++++++++++ libmpcodecs/vd_nuv.c | 56 +++++++++++++++++++++++++++++++++++++ libmpcodecs/vd_qtrle.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++ libmpcodecs/vd_qtsmc.c | 69 +++++++++++++++++++++++++++++++++++++++++++++ libmpcodecs/vd_roqvideo.c | 52 ++++++++++++++++++++++++++++++++++ 7 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 libmpcodecs/vd_cyuv.c create mode 100644 libmpcodecs/vd_nuv.c create mode 100644 libmpcodecs/vd_qtrle.c create mode 100644 libmpcodecs/vd_qtsmc.c create mode 100644 libmpcodecs/vd_roqvideo.c diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile index b4870c1ca8..bc84c0475e 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 vd_msvidc.c vd_fli.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 vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c OBJS=$(SRCS:.c=.o) diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index e4a1a2abdf..7d901e178d 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -35,6 +35,11 @@ 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; +extern vd_functions_t mpcodecs_vd_qtrle; +extern vd_functions_t mpcodecs_vd_qtsmc; +extern vd_functions_t mpcodecs_vd_roqvideo; +extern vd_functions_t mpcodecs_vd_cyuv; +extern vd_functions_t mpcodecs_vd_nuv; vd_functions_t* mpcodecs_vd_drivers[] = { &mpcodecs_vd_null, @@ -60,6 +65,11 @@ vd_functions_t* mpcodecs_vd_drivers[] = { &mpcodecs_vd_rle, &mpcodecs_vd_msvidc, &mpcodecs_vd_fli, + &mpcodecs_vd_qtrle, + &mpcodecs_vd_qtsmc, + &mpcodecs_vd_roqvideo, + &mpcodecs_vd_cyuv, + &mpcodecs_vd_nuv, #ifdef USE_XANIM &mpcodecs_vd_xanim, #endif diff --git a/libmpcodecs/vd_cyuv.c b/libmpcodecs/vd_cyuv.c new file mode 100644 index 0000000000..aba0d91baa --- /dev/null +++ b/libmpcodecs/vd_cyuv.c @@ -0,0 +1,57 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "Creative YUV decoder", + "cyuv", + VFM_CYUV, + "A'rpi", + "Dr. Tim Ferguson", + "native codec" +}; + +LIBVD_EXTERN(cyuv) + +// 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_UYVY); + 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 decode_cyuv( + unsigned char *buf, + int size, + unsigned char *frame, + int width, + int height, + int bit_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_TEMP, 0, + sh->disp_w, sh->disp_h); + if(!mpi) return NULL; + + decode_cyuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h, 0); + + return mpi; +} diff --git a/libmpcodecs/vd_nuv.c b/libmpcodecs/vd_nuv.c new file mode 100644 index 0000000000..b6cebe2449 --- /dev/null +++ b/libmpcodecs/vd_nuv.c @@ -0,0 +1,56 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "NuppelVideo decoder", + "nuv", + VFM_NUV, + "A'rpi", + "Alex & Panagiotis Issaris ", + "native codecs" +}; + +LIBVD_EXTERN(nuv) + +// 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_I420); + 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 decode_nuv( + unsigned char *encoded, + int encoded_size, + unsigned char *decoded, + int width, + int height); + +// 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_TEMP, 0, + sh->disp_w, sh->disp_h); + if(!mpi) return NULL; + + decode_nuv(data, len, mpi->planes[0], sh->disp_w, sh->disp_h); + + return mpi; +} diff --git a/libmpcodecs/vd_qtrle.c b/libmpcodecs/vd_qtrle.c new file mode 100644 index 0000000000..83b309f101 --- /dev/null +++ b/libmpcodecs/vd_qtrle.c @@ -0,0 +1,71 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "Quicktime Animation (RLE) decoder", + "qtrle", + VFM_QTRLE, + "A'rpi", + "Mike Melanson", + "native codec" +}; + +LIBVD_EXTERN(qtrle) + +// 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){ + if (sh->bih->biBitCount != 24){ + mp_msg(MSGT_DECVIDEO,MSGL_ERR, + " *** FYI: This Quicktime file is using %d-bit RLE Animation\n" \ + " encoding, which is not yet supported by MPlayer. But if you upload\n" \ + " this Quicktime file to the MPlayer FTP, the team could look at it.\n", + sh->bih->biBitCount); + return 0; + } + + 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 qt_decode_rle( + unsigned char *encoded, + int encoded_size, + unsigned char *decoded, + int width, + int height, + int encoded_bpp, + 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; + + qt_decode_rle( + data,len, mpi->planes[0], + sh->disp_w, sh->disp_h, + sh->bih->biBitCount, + mpi->bpp/8); + + return mpi; +} diff --git a/libmpcodecs/vd_qtsmc.c b/libmpcodecs/vd_qtsmc.c new file mode 100644 index 0000000000..1dc6ebf666 --- /dev/null +++ b/libmpcodecs/vd_qtsmc.c @@ -0,0 +1,69 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "Apple Graphics (SMC) decoder", + "qtsmc", + VFM_QTSMC, + "A'rpi", + "Mike Melanson", + "native codec" +}; + +LIBVD_EXTERN(qtsmc) + +// to set/get/query special features/parameters +static int control(sh_video_t *sh,int cmd,void* arg,...){ + return CONTROL_UNKNOWN; +} + +int qt_init_decode_smc(void); + +// init driver +static int init(sh_video_t *sh){ + if (qt_init_decode_smc() != 0){ + mp_msg(MSGT_DECVIDEO, MSGL_ERR, "SMC decoder could not allocate enough memory"); + return 0; + } + + 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 qt_decode_smc( + unsigned char *encoded, + int encoded_size, + unsigned 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; + + qt_decode_smc( + data,len, mpi->planes[0], + sh->disp_w, sh->disp_h, + (unsigned char *)sh->bih+40, + mpi->bpp/8); + + return mpi; +} diff --git a/libmpcodecs/vd_roqvideo.c b/libmpcodecs/vd_roqvideo.c new file mode 100644 index 0000000000..5aaf20c46f --- /dev/null +++ b/libmpcodecs/vd_roqvideo.c @@ -0,0 +1,52 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "Id RoQ File Video decoder", + "roqvideo", + VFM_ROQVIDEO, + "A'rpi", + "Mike Melanson", + "native codec" +}; + +LIBVD_EXTERN(roqvideo) + +#include "roqav.h" + +// 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){ + sh->context = roq_decode_video_init(); + mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); + 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_IP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE, + sh->disp_w, sh->disp_h); + if(!mpi) return NULL; + + roq_decode_video(sh->context, data, len, mpi); + + return mpi; +} -- cgit v1.2.3