From f60b5944a43cd2963af506a0a65eb7fbf329dd95 Mon Sep 17 00:00:00 2001 From: arpi Date: Sat, 22 Jun 2002 23:09:40 +0000 Subject: [PATCH] SVQ1 added git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6507 b3059339-0415-0410-9bf9-f77b7e298cf2 --- codec-cfg.c | 1 + codec-cfg.h | 1 + libmpcodecs/Makefile | 4 +-- libmpcodecs/vd.c | 2 ++ libmpcodecs/vd_svq1.c | 67 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 libmpcodecs/vd_svq1.c diff --git a/codec-cfg.c b/codec-cfg.c index eb5aadb866..67da0ad016 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -261,6 +261,7 @@ static short get_driver(char *s,int audioflag) "zlib", "mpegpes", "realvid", + "svq1", NULL }; char **drv=audioflag?audiodrv:videodrv; diff --git a/codec-cfg.h b/codec-cfg.h index e7117fab0a..42e80cef10 100644 --- a/codec-cfg.h +++ b/codec-cfg.h @@ -74,6 +74,7 @@ #define VFM_ZLIB 24 #define VFM_MPEGPES 25 #define VFM_REAL 26 +#define VFM_SVQ1 27 #ifndef GUID_TYPE #define GUID_TYPE diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile index d51ffac08b..320f898677 100644 --- a/libmpcodecs/Makefile +++ b/libmpcodecs/Makefile @@ -5,10 +5,10 @@ LIBNAME = libmpcodecs.a LIBNAME2 = libmpencoders.a AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c ad_real.c -VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_real.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_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c +VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_real.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_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c vd_svq1.c VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c vf_noise.c vf_yvu9.c ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c -NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/cyuv.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c +NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/cyuv.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c native/svq1.c ifeq ($(FAME),yes) VFILTER_SRCS += vf_fame.c diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 2fd76b8a73..c0323ed402 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -51,6 +51,7 @@ extern vd_functions_t mpcodecs_vd_huffyuv; extern vd_functions_t mpcodecs_vd_zlib; extern vd_functions_t mpcodecs_vd_mpegpes; extern vd_functions_t mpcodecs_vd_real; +extern vd_functions_t mpcodecs_vd_svq1; vd_functions_t* mpcodecs_vd_drivers[] = { &mpcodecs_vd_null, @@ -99,6 +100,7 @@ vd_functions_t* mpcodecs_vd_drivers[] = { #ifdef USE_REALCODECS &mpcodecs_vd_real, #endif + &mpcodecs_vd_svq1, NULL }; diff --git a/libmpcodecs/vd_svq1.c b/libmpcodecs/vd_svq1.c new file mode 100644 index 0000000000..c9bb774658 --- /dev/null +++ b/libmpcodecs/vd_svq1.c @@ -0,0 +1,67 @@ +#include +#include + +#include "config.h" +#include "mp_msg.h" + +#include "vd_internal.h" + +static vd_info_t info = { + "SVQ1 (Sorenson v1) Video decoder", + "svq1", + VFM_SVQ1, + "A'rpi", + "XINE team", + "native codec" +}; + +LIBVD_EXTERN(svq1) + +#include "native/svq1.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){ + if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YVU9)) return 0; + + sh->context=malloc(sizeof(svq1_t)); + memset(sh->context,0,sizeof(svq1_t)); + + return 1; +} + +// uninit driver +static void uninit(sh_video_t *sh){ + svq1_free(sh->context); + sh->context=NULL; +} + +// decode a frame +static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ + mp_image_t* mpi; + svq1_t* svq1=sh->context; + int ret; + + if(len<=0) return NULL; // skipped frame + + ret=svq1_decode_frame(svq1,data); + + mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, + sh->disp_w, sh->disp_h); + if(!mpi) return NULL; + + mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"SVQ1: ret=%d wh=%dx%d p=%p \n",ret,svq1->width,svq1->height,svq1->current); + + mpi->planes[0]=svq1->base[0]; + mpi->planes[1]=svq1->base[1]; + mpi->planes[2]=svq1->base[2]; + mpi->stride[0]=svq1->luma_width; + mpi->stride[1]=mpi->stride[2]=svq1->chroma_width; + + return mpi; +} +