[MPlayer-dev-eng] [PATCH] vf_noformat
Joey Parrish
joey at nicewarrior.org
Mon Feb 2 15:07:24 CET 2004
On Fri, Jan 30, 2004 at 10:29:02PM -0600, Joey Parrish wrote:
> On Fri, Jan 30, 2004 at 07:41:58PM -0300, Diego Biurrun wrote:
> > Joey Parrish writes:
> > > Comments?
> > > Reject/Commit now/Commit after release?
> >
> > Include documentation.
> >
> > Did you really expect me to say anything different? ;-)
>
> Oh! What a fool I've been!
>
> New patch attached, including documentation.
Will commit on Friday if nobody objects. Original mail and updated
patch included for easy review if anyone is interested.
Original mail:
---------------
Attached is a patch for a new video filter. It's very simple, and very
similar to vf_format, except in reverse. Instead of forcing only one
video format to be accepted, it accepts all but one format. This is
useful as a workaround for crappy video drivers. My video card does not
support yv12, but the drivers report that it does, then they do the
conversion themselves.
Without this patch, I would either have to force unaccelerated display
(which sucks) or use vf_format to force bgr16 or so. But if my display
depth changes, I would have to change the vf_format parameter each time
to match my primary colorspace.
It makes more sense to eliminate the cspace that doesn't work right
(yv12) and let MPlayer decide the next best space to use based on the
other info from my video drivers. And vf=noformat=yv12 can stay in my
config file all the time. :)
---------------
Thanks,
--Joey
--
"I know Kung Fu." --Darth Vader
-------------- next part --------------
diff -Nur main.cvs/DOCS/man/en/mplayer.1 main.noformat/DOCS/man/en/mplayer.1
--- main.cvs/DOCS/man/en/mplayer.1 2004-01-30 12:47:31.779651200 -0600
+++ main.noformat/DOCS/man/en/mplayer.1 2004-01-30 22:21:46.460811200 -0600
@@ -2639,6 +2639,19 @@
.RE
.PD 1
.TP
+.B noformat[=fourcc]
+Restricts the colorspace for the next filter without doing any conversion.
+Unlike the format filter, this will allow any colorspace
+.B except
+the one you specify.
+For a list of available formats see noformat=fmt=help.
+.PD 0
+.RSs
+.IPs fourcc
+format name like rgb15, bgr24, yv12, etc (default: yv12)
+.RE
+.PD 1
+.TP
.B pp[=filter1[:option1[:option2...]]/[-]filter2...] (see \-pphelp too)
This option enables usage of MPlayer's internal postprocessing filter,
and also gives an interface where you can pass options to the named filter.
diff -Nur main.cvs/libmpcodecs/Makefile main.noformat/libmpcodecs/Makefile
--- main.cvs/libmpcodecs/Makefile 2004-01-30 12:47:37.397729600 -0600
+++ main.noformat/libmpcodecs/Makefile 2004-01-30 22:14:12.397900800 -0600
@@ -14,7 +14,7 @@
VIDEO_SRCS_OPT=vd_realvid.c vd_ffmpeg.c vd_dshow.c vd_dmo.c vd_vfw.c vd_vfwex.c vd_odivx.c vd_divx4.c vd_zrmjpeg.c vd_xanim.c vd_xvid.c vd_xvid4.c vd_libdv.c vd_qtvideo.c vd_theora.c
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_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 vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c vf_softpulldown.c vf_tinterlace.c vf_pullup.c pullup.c vf_framestep.c vf_tile.c vf_delogo.c vf_fil.c vf_hue.c vf_spp.c vf_yuvcsp.c vf_filmdint.c vf_kerndeint.c vf_rgbtest.c
+VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_scale.c vf_format.c vf_noformat.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 vf_down3dright.c vf_field.c vf_denoise3d.c vf_hqdn3d.c vf_detc.c vf_telecine.c vf_tfields.c vf_ivtc.c vf_ilpack.c vf_dsize.c vf_decimate.c vf_softpulldown.c vf_tinterlace.c vf_pullup.c pullup.c vf_framestep.c vf_tile.c vf_delogo.c vf_fil.c vf_hue.c vf_spp.c vf_yuvcsp.c vf_filmdint.c vf_kerndeint.c vf_rgbtest.c
ifeq ($(HAVE_FFPOSTPROCESS),yes)
VFILTER_SRCS += vf_pp.c
endif
diff -Nur main.cvs/libmpcodecs/vf.c main.noformat/libmpcodecs/vf.c
--- main.cvs/libmpcodecs/vf.c 2004-01-30 12:47:37.527916800 -0600
+++ main.noformat/libmpcodecs/vf.c 2004-01-30 22:12:54.846387200 -0600
@@ -34,6 +34,7 @@
extern vf_info_t vf_info_fame;
#endif
extern vf_info_t vf_info_format;
+extern vf_info_t vf_info_noformat;
extern vf_info_t vf_info_yuy2;
extern vf_info_t vf_info_flip;
extern vf_info_t vf_info_rgb2bgr;
@@ -104,6 +105,7 @@
&vf_info_fame,
#endif
&vf_info_format,
+ &vf_info_noformat,
&vf_info_yuy2,
&vf_info_flip,
&vf_info_rgb2bgr,
diff -Nur main.cvs/libmpcodecs/vf_noformat.c main.noformat/libmpcodecs/vf_noformat.c
--- main.cvs/libmpcodecs/vf_noformat.c 1969-12-31 18:00:00.000000000 -0600
+++ main.noformat/libmpcodecs/vf_noformat.c 2004-01-30 22:14:26.357974400 -0600
@@ -0,0 +1,93 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include "../config.h"
+#include "../mp_msg.h"
+
+#include "img_format.h"
+#include "mp_image.h"
+#include "vf.h"
+
+#include "m_option.h"
+#include "m_struct.h"
+
+static struct vf_priv_s {
+ unsigned int fmt;
+} vf_priv_dflt = {
+ IMGFMT_YV12
+};
+
+//===========================================================================//
+
+static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+ if(fmt!=vf->priv->fmt)
+ return vf_next_query_format(vf,fmt);
+ return 0;
+}
+
+static int open(vf_instance_t *vf, char* args){
+ vf->query_format=query_format;
+ vf->default_caps=0;
+ if(!vf->priv) {
+ vf->priv=malloc(sizeof(struct vf_priv_s));
+ vf->priv->fmt=IMGFMT_YV12;
+ }
+ if(args){
+ if(!strcasecmp(args,"444p")) vf->priv->fmt=IMGFMT_444P; else
+ if(!strcasecmp(args,"422p")) vf->priv->fmt=IMGFMT_422P; else
+ if(!strcasecmp(args,"411p")) vf->priv->fmt=IMGFMT_411P; else
+ if(!strcasecmp(args,"yuy2")) vf->priv->fmt=IMGFMT_YUY2; else
+ if(!strcasecmp(args,"yv12")) vf->priv->fmt=IMGFMT_YV12; else
+ if(!strcasecmp(args,"i420")) vf->priv->fmt=IMGFMT_I420; else
+ if(!strcasecmp(args,"yvu9")) vf->priv->fmt=IMGFMT_YVU9; else
+ if(!strcasecmp(args,"if09")) vf->priv->fmt=IMGFMT_IF09; else
+ if(!strcasecmp(args,"iyuv")) vf->priv->fmt=IMGFMT_IYUV; else
+ if(!strcasecmp(args,"uyvy")) vf->priv->fmt=IMGFMT_UYVY; else
+ if(!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else
+ if(!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else
+ if(!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else
+ if(!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
+ if(!strcasecmp(args,"bgr8")) vf->priv->fmt=IMGFMT_BGR8; else
+ if(!strcasecmp(args,"bgr4")) vf->priv->fmt=IMGFMT_BGR4; else
+ if(!strcasecmp(args,"bg4b")) vf->priv->fmt=IMGFMT_BG4B; else
+ if(!strcasecmp(args,"bgr1")) vf->priv->fmt=IMGFMT_BGR1; else
+ if(!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else
+ if(!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else
+ if(!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else
+ if(!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else
+ if(!strcasecmp(args,"rgb8")) vf->priv->fmt=IMGFMT_RGB8; else
+ if(!strcasecmp(args,"rgb4")) vf->priv->fmt=IMGFMT_RGB4; else
+ if(!strcasecmp(args,"rg4b")) vf->priv->fmt=IMGFMT_RG4B; else
+ if(!strcasecmp(args,"rgb1")) vf->priv->fmt=IMGFMT_RGB1; else
+ { printf("Unknown format name: '%s'\n",args);return 0;}
+ }
+
+
+ return 1;
+}
+
+#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
+static m_option_t vf_opts_fields[] = {
+ {"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
+ { NULL, NULL, 0, 0, 0, 0, NULL }
+};
+
+static m_struct_t vf_opts = {
+ "noformat",
+ sizeof(struct vf_priv_s),
+ &vf_priv_dflt,
+ vf_opts_fields
+};
+
+vf_info_t vf_info_noformat = {
+ "disallow one output format",
+ "noformat",
+ "Joey",
+ "",
+ open,
+ &vf_opts
+};
+
+//===========================================================================//
More information about the MPlayer-dev-eng
mailing list