[MPlayer-dev-eng] patch: mencoder -ovc rawyuv

Tuukka Toivonen tuukkat at ee.oulu.fi
Mon Nov 17 09:01:09 CET 2003


This patch adds "-ovc rawyuv" into mencoder (against cvs-20031114) which is
similar to "-ovc rawrgb" put outputs video in I420 (YUV 4:2:0) format.

Status: I think it could be included into MPlayer right away, I don't
see any significant problems with the patch.

URL: http://www.ee.oulu.fi/~tuukkat/mplayer/MPlayer-20031114.rawyuv.patch

diff -PruN MPlayer-20031114.orig/cfg-mencoder.h MPlayer-20031114/cfg-mencoder.h
--- MPlayer-20031114.orig/cfg-mencoder.h	Wed Nov 12 02:43:03 2003
+++ MPlayer-20031114/cfg-mencoder.h	Sat Nov 15 18:25:19 2003
@@ -66,6 +66,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},
@@ -75,6 +76,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 4:2:0 YUV (I420) 12bpp video\n"
 	"   nuv      - nuppel video\n"
 #ifdef HAVE_DIVX4ENCORE
 #ifdef ENCORE_XVID
diff -PruN MPlayer-20031114.orig/libmpcodecs/Makefile MPlayer-20031114/libmpcodecs/Makefile
--- MPlayer-20031114.orig/libmpcodecs/Makefile	Wed Nov 12 02:43:42 2003
+++ MPlayer-20031114/libmpcodecs/Makefile	Sat Nov 15 18:26:35 2003
@@ -19,7 +19,7 @@
 VFILTER_SRCS += vf_pp.c
 endif

-ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c ve_xvid.c ve_xvid4.c ve_qtvideo.c ve_nuv.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_xvid4.c ve_qtvideo.c ve_nuv.c

 NATIVE_SRCS=native/RTjpegN.c native/cinepak.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/decode144.c native/decode288.c

diff -PruN MPlayer-20031114.orig/libmpcodecs/ve.c MPlayer-20031114/libmpcodecs/ve.c
--- MPlayer-20031114.orig/libmpcodecs/ve.c	Wed Nov 12 02:43:42 2003
+++ MPlayer-20031114/libmpcodecs/ve.c	Sat Nov 15 18:27:54 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;
@@ -33,6 +34,7 @@
     &ve_info_libdv,
 #endif
     &ve_info_rawrgb,
+    &ve_info_rawyuv,
 #if defined(HAVE_XVID3) || defined(HAVE_XVID4)
     &ve_info_xvid,
 #endif
diff -PruN MPlayer-20031114.orig/libmpcodecs/ve_rawyuv.c MPlayer-20031114/libmpcodecs/ve_rawyuv.c
--- MPlayer-20031114.orig/libmpcodecs/ve_rawyuv.c	Thu Jan  1 02:00:00 1970
+++ MPlayer-20031114/libmpcodecs/ve_rawyuv.c	Sat Oct 11 06:55:50 2003
@@ -0,0 +1,81 @@
+#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 "muxer.h"
+
+#include "img_format.h"
+#include "mp_image.h"
+#include "vf.h"
+
+//===========================================================================//
+
+struct vf_priv_s {
+    muxer_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];
+    muxer_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 = (muxer_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-20031114.orig/mencoder.c MPlayer-20031114/mencoder.c
--- MPlayer-20031114.orig/mencoder.c	Sat Nov  8 01:32:38 2003
+++ MPlayer-20031114/mencoder.c	Sat Nov 15 18:30:54 2003
@@ -4,11 +4,12 @@
 #define VCODEC_DIVX4 2
 #define VCODEC_LIBAVCODEC 4
 #define VCODEC_RAWRGB 6
-#define VCODEC_VFW 7
-#define VCODEC_LIBDV 8
-#define VCODEC_XVID 9
-#define VCODEC_QTVIDEO 10
-#define VCODEC_NUV 11
+#define VCODEC_RAWYUV 7
+#define VCODEC_VFW 8
+#define VCODEC_LIBDV 9
+#define VCODEC_XVID 10
+#define VCODEC_QTVIDEO 11
+#define VCODEC_NUV 12

 #define ACODEC_COPY 0
 #define ACODEC_PCM 1
@@ -671,6 +672,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-dev-eng mailing list