[MPlayer-users] patch: -ovc rawyuv

Tuukka Toivonen tuukkat at ees2.oulu.fi
Thu Jan 2 11:31:57 CET 2003


Here's patch against Mencoder 0.90rc2 that adds new encoder output
format "-ovc rawyuv" or technically fourcc I420. Together with my
"aviyuv" tools, the output can be feed to some encoder (e.g.
Telenor's H.263 test model encoder) that take the input as concatenated
yuv-frames.
-------------- next part --------------
diff -PruN MPlayer-0.90rc2.orig/cfg-mencoder.h MPlayer-0.90rc2/cfg-mencoder.h
--- MPlayer-0.90rc2.orig/cfg-mencoder.h	Sun Dec 22 00:16:48 2002
+++ MPlayer-0.90rc2/cfg-mencoder.h	Wed Jan  1 13:23:22 2003
@@ -60,6 +60,7 @@
 	{"lavc", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBAVCODEC, NULL},
 //	{"null", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_NULL, NULL},
 	{"rawrgb", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAWRGB, NULL},
+	{"rawyuv", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAWYUV, NULL},
 	{"vfw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_VFW, NULL},
 	{"libdv", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBDV, NULL},
 	{"xvid", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_XVID, NULL},
@@ -68,6 +69,7 @@
 	"   copy     - frame copy, without re-encoding. doesn't work with filters!\n"
 	"   frameno  - special audio-only file for 3-pass encoding, see DOCS!\n"
 	"   rawrgb   - uncompressed RGB 24bpp video\n"
+	"   rawyuv   - uncompressed YUV 12bpp video\n"
 #ifdef HAVE_DIVX4ENCORE
 	"   divx4    - using divx4linux/divx5linux or xvid (depends on configuration)\n"
 #endif
diff -PruN MPlayer-0.90rc2.orig/libmpcodecs/Makefile MPlayer-0.90rc2/libmpcodecs/Makefile
--- MPlayer-0.90rc2.orig/libmpcodecs/Makefile	Mon Dec 16 03:49:39 2002
+++ MPlayer-0.90rc2/libmpcodecs/Makefile	Wed Jan  1 13:24:54 2003
@@ -15,7 +15,7 @@
 VIDEO_SRCS=dec_video.c vd.c $(VIDEO_SRCS_NAT) $(VIDEO_SRCS_LIB) $(VIDEO_SRCS_OPT)
 
 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 vf_rectangle.c vf_lavcdeint.c vf_eq.c vf_eq2.c vf_halfpack.c vf_dint.c vf_1bpp.c vf_bmovl.c vf_2xsai.c vf_unsharp.c vf_swapuv.c vf_il.c vf_boxblur.c vf_sab.c vf_smartblur.c vf_perspective.c
-ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c ve_xvid.c ve_qtvideo.c
+ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_rawyuv.c ve_libdv.c ve_xvid.c ve_qtvideo.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
 
diff -PruN MPlayer-0.90rc2.orig/libmpcodecs/ve.c MPlayer-0.90rc2/libmpcodecs/ve.c
--- MPlayer-0.90rc2.orig/libmpcodecs/ve.c	Mon Dec 16 03:49:39 2002
+++ MPlayer-0.90rc2/libmpcodecs/ve.c	Wed Jan  1 13:21:39 2003
@@ -13,6 +13,7 @@
 extern vf_info_t ve_info_lavc;
 extern vf_info_t ve_info_vfw;
 extern vf_info_t ve_info_rawrgb;
+extern vf_info_t ve_info_rawyuv;
 extern vf_info_t ve_info_libdv;
 extern vf_info_t ve_info_xvid;
 extern vf_info_t ve_info_qtvideo;
@@ -32,6 +33,7 @@
     &ve_info_libdv,
 #endif
     &ve_info_rawrgb,
+    &ve_info_rawyuv,
 #if defined(HAVE_XVID)
     &ve_info_xvid,
 #endif
diff -PruN MPlayer-0.90rc2.orig/libmpcodecs/ve_rawyuv.c MPlayer-0.90rc2/libmpcodecs/ve_rawyuv.c
--- MPlayer-0.90rc2.orig/libmpcodecs/ve_rawyuv.c	Thu Jan  1 02:00:00 1970
+++ MPlayer-0.90rc2/libmpcodecs/ve_rawyuv.c	Wed Jan  1 14:18:53 2003
@@ -0,0 +1,83 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../config.h"
+#include "../mp_msg.h"
+
+#include "codec-cfg.h"
+#include "stream.h"
+#include "demuxer.h"
+#include "stheader.h"
+
+#include "aviwrite.h"
+
+#include "img_format.h"
+#include "mp_image.h"
+#include "vf.h"
+
+extern void mencoder_write_chunk(aviwrite_stream_t *s,int len,unsigned int flags);
+
+//===========================================================================//
+
+struct vf_priv_s {
+    aviwrite_stream_t* mux;
+};
+#define mux_v (vf->priv->mux)
+
+static int config(struct vf_instance_s *vf,
+        int width, int height, int d_width, int d_height,
+	unsigned int flags, unsigned int outfmt)
+{
+    mux_v->bih->biWidth = width;
+    mux_v->bih->biHeight = height;
+    mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
+    return 1;
+}
+
+static int control(struct vf_instance_s *vf, int request, void *data) {
+    return CONTROL_UNKNOWN;
+}
+
+static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
+    if (fmt==IMGFMT_I420) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
+    return 0;
+}
+
+static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) {
+    mux_v->buffer = mpi->planes[0];
+    mencoder_write_chunk(mux_v, mpi->width*mpi->height*3/2, 0x10);
+    return 1;
+}
+
+//===========================================================================//
+
+static int vf_open(vf_instance_t *vf, char* args){
+    vf->config = config;
+    vf->control = control;
+    vf->query_format = query_format;
+    vf->put_image = put_image;
+    vf->priv = malloc(sizeof(struct vf_priv_s));
+    memset(vf->priv, 0, sizeof(struct vf_priv_s));
+    vf->priv->mux = (aviwrite_stream_t*)args;
+    
+    mux_v->bih = malloc(sizeof(BITMAPINFOHEADER));
+    mux_v->bih->biSize = sizeof(BITMAPINFOHEADER);
+    mux_v->bih->biWidth = 0;
+    mux_v->bih->biHeight = 0;
+    mux_v->bih->biCompression = mmioFOURCC('I', '4', '2', '0');
+    mux_v->bih->biPlanes = 3;//FIXME?was 1
+    mux_v->bih->biBitCount = 12;//FIXME?was 24
+
+    return 1;
+}
+
+vf_info_t ve_info_rawyuv = {
+    "rawyuv encoder",
+    "rawyuv",
+    "tuukkat at ee.oulu.fi",
+    "Based on rawrgb",
+    vf_open
+};
+
+//===========================================================================//
diff -PruN MPlayer-0.90rc2.orig/mencoder.c MPlayer-0.90rc2/mencoder.c
--- MPlayer-0.90rc2.orig/mencoder.c	Sun Dec 22 00:16:48 2002
+++ MPlayer-0.90rc2/mencoder.c	Wed Jan  1 13:20:32 2003
@@ -4,6 +4,7 @@
 #define VCODEC_DIVX4 2
 #define VCODEC_LIBAVCODEC 4
 #define VCODEC_RAWRGB 6
+#define VCODEC_RAWYUV 11
 #define VCODEC_VFW 7
 #define VCODEC_LIBDV 8
 #define VCODEC_XVID 9
@@ -660,6 +661,8 @@
         sh_video->vfilter=vf_open_encoder(NULL,"lavc",(char *)mux_v); break;
     case VCODEC_RAWRGB:
         sh_video->vfilter=vf_open_encoder(NULL,"rawrgb",(char *)mux_v); break;
+    case VCODEC_RAWYUV:
+        sh_video->vfilter=vf_open_encoder(NULL,"rawyuv",(char *)mux_v); break;
     case VCODEC_VFW:
         sh_video->vfilter=vf_open_encoder(NULL,"vfw",(char *)mux_v); break;
     case VCODEC_LIBDV:


More information about the MPlayer-users mailing list