2002-04-09 14:01:53 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2005-11-18 14:39:25 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "mp_msg.h"
|
2006-03-31 00:15:47 +00:00
|
|
|
#include "help_mp.h"
|
2002-04-09 14:01:53 +00:00
|
|
|
|
2002-04-13 19:14:34 +00:00
|
|
|
#include "img_format.h"
|
|
|
|
#include "mp_image.h"
|
2002-04-09 14:01:53 +00:00
|
|
|
#include "vf.h"
|
|
|
|
|
2003-03-15 20:51:35 +00:00
|
|
|
#include "m_option.h"
|
|
|
|
#include "m_struct.h"
|
|
|
|
|
|
|
|
static struct vf_priv_s {
|
2002-04-09 14:01:53 +00:00
|
|
|
unsigned int fmt;
|
2007-01-28 16:48:01 +00:00
|
|
|
} const vf_priv_dflt = {
|
2003-03-15 20:51:35 +00:00
|
|
|
IMGFMT_YUY2
|
2002-04-09 14:01:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
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;
|
2002-05-06 22:48:59 +00:00
|
|
|
vf->default_caps=0;
|
2003-03-15 20:51:35 +00:00
|
|
|
if(!vf->priv) {
|
|
|
|
vf->priv=malloc(sizeof(struct vf_priv_s));
|
|
|
|
vf->priv->fmt=IMGFMT_YUY2;
|
|
|
|
}
|
2002-04-09 14:01:53 +00:00
|
|
|
if(args){
|
2002-08-02 19:36:31 +00:00
|
|
|
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
|
2002-04-09 14:01:53 +00:00
|
|
|
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
|
2002-06-23 15:15:31 +00:00
|
|
|
if(!strcasecmp(args,"yvu9")) vf->priv->fmt=IMGFMT_YVU9; else
|
|
|
|
if(!strcasecmp(args,"if09")) vf->priv->fmt=IMGFMT_IF09; else
|
2002-04-09 14:01:53 +00:00
|
|
|
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
|
2002-04-11 20:56:17 +00:00
|
|
|
if(!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
|
2002-06-23 15:15:31 +00:00
|
|
|
if(!strcasecmp(args,"bgr8")) vf->priv->fmt=IMGFMT_BGR8; else
|
2002-07-29 16:24:40 +00:00
|
|
|
if(!strcasecmp(args,"bgr4")) vf->priv->fmt=IMGFMT_BGR4; else
|
2003-01-30 09:15:09 +00:00
|
|
|
if(!strcasecmp(args,"bg4b")) vf->priv->fmt=IMGFMT_BG4B; else
|
2002-07-29 16:24:40 +00:00
|
|
|
if(!strcasecmp(args,"bgr1")) vf->priv->fmt=IMGFMT_BGR1; else
|
2002-07-11 19:16:30 +00:00
|
|
|
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
|
2002-07-29 16:24:40 +00:00
|
|
|
if(!strcasecmp(args,"rgb4")) vf->priv->fmt=IMGFMT_RGB4; else
|
2003-01-30 09:15:09 +00:00
|
|
|
if(!strcasecmp(args,"rg4b")) vf->priv->fmt=IMGFMT_RG4B; else
|
2002-07-29 16:24:40 +00:00
|
|
|
if(!strcasecmp(args,"rgb1")) vf->priv->fmt=IMGFMT_RGB1; else
|
2004-08-11 10:31:38 +00:00
|
|
|
if(!strcasecmp(args,"rgba")) vf->priv->fmt=IMGFMT_RGBA; else
|
|
|
|
if(!strcasecmp(args,"argb")) vf->priv->fmt=IMGFMT_ARGB; else
|
|
|
|
if(!strcasecmp(args,"bgra")) vf->priv->fmt=IMGFMT_BGRA; else
|
|
|
|
if(!strcasecmp(args,"abgr")) vf->priv->fmt=IMGFMT_ABGR; else
|
2006-03-31 00:15:47 +00:00
|
|
|
{ mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args);return 0;}
|
2003-03-15 20:51:35 +00:00
|
|
|
}
|
|
|
|
|
2002-04-09 14:01:53 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-03-15 20:51:35 +00:00
|
|
|
#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 = {
|
|
|
|
"format",
|
|
|
|
sizeof(struct vf_priv_s),
|
|
|
|
&vf_priv_dflt,
|
|
|
|
vf_opts_fields
|
|
|
|
};
|
|
|
|
|
2007-12-02 14:57:15 +00:00
|
|
|
const vf_info_t vf_info_format = {
|
2002-04-09 14:01:53 +00:00
|
|
|
"force output format",
|
|
|
|
"format",
|
|
|
|
"A'rpi",
|
2002-04-11 20:56:17 +00:00
|
|
|
"FIXME! get_image()/put_image()",
|
2003-03-15 18:01:02 +00:00
|
|
|
open,
|
2003-03-15 20:51:35 +00:00
|
|
|
&vf_opts
|
2002-04-09 14:01:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//===========================================================================//
|