changeset 4989:11d8bf468334

cyuv, nuv, qtrle, qtsmc, roq added
author arpi
date Fri, 08 Mar 2002 07:14:34 +0000
parents db591864d642
children 6e39ed017ab1
files libmpcodecs/Makefile libmpcodecs/vd.c libmpcodecs/vd_cyuv.c libmpcodecs/vd_nuv.c libmpcodecs/vd_qtrle.c libmpcodecs/vd_qtsmc.c libmpcodecs/vd_roqvideo.c
diffstat 7 files changed, 316 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/Makefile	Thu Mar 07 21:12:27 2002 +0000
+++ b/libmpcodecs/Makefile	Fri Mar 08 07:14:34 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 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)
 
--- a/libmpcodecs/vd.c	Thu Mar 07 21:12:27 2002 +0000
+++ b/libmpcodecs/vd.c	Fri Mar 08 07:14:34 2002 +0000
@@ -35,6 +35,11 @@
 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 @@
         &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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpcodecs/vd_cyuv.c	Fri Mar 08 07:14:34 2002 +0000
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpcodecs/vd_nuv.c	Fri Mar 08 07:14:34 2002 +0000
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#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 <takis@lumumba.luc.ac.be>",
+	"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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpcodecs/vd_qtrle.c	Fri Mar 08 07:14:34 2002 +0000
@@ -0,0 +1,71 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpcodecs/vd_qtsmc.c	Fri Mar 08 07:14:34 2002 +0000
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libmpcodecs/vd_roqvideo.c	Fri Mar 08 07:14:34 2002 +0000
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#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;
+}