summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-23 20:03:30 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:11 +0100
commit8751a0e261c0c7150874f78b23c7f1d3539883b5 (patch)
treebe72a06e1d1470cf968835e432c19f6d3a0e49b2
parent0c5311f17cb9078f0ddde7c41cad61d00aea4a94 (diff)
downloadmpv-8751a0e261c0c7150874f78b23c7f1d3539883b5.tar.bz2
mpv-8751a0e261c0c7150874f78b23c7f1d3539883b5.tar.xz
video: decouple internal pixel formats from FourCCs
mplayer's video chain traditionally used FourCCs for pixel formats. For example, it used IMGFMT_YV12 for 4:2:0 YUV, which was defined to the string 'YV12' interpreted as unsigned int. Additionally, it used to encode information into the numeric values of some formats. The RGB formats had their bit depth and endian encoded into the least significant byte. Extended planar formats (420P10 etc.) had chroma shift, endian, and component bit depth encoded. (This has been removed in recent commits.) Replace the FourCC mess with a simple enum. Remove all the redundant formats like YV12/I420/IYUV. Replace some image format names by something more intuitive, most importantly IMGFMT_YV12 -> IMGFMT_420P. Add img_fourcc.h, which contains the old IDs for code that actually uses FourCCs. Change the way demuxers, that output raw video, identify the video format: they set either MP_FOURCC_RAWVIDEO or MP_FOURCC_IMGFMT to request the rawvideo decoder, and sh_video->imgfmt specifies the pixel format. Like the previous hack, this is supposed to avoid the need for a complete codecs.cfg entry per format, or other lookup tables. (Note that the RGB raw video FourCCs mostly rely on ffmpeg's mappings for NUT raw video, but this is still considered better than adding a raw video decoder - even if trivial, it would be full of annoying lookup tables.) The TV code has not been tested. Some corrective changes regarding endian and other image format flags creep in.
-rw-r--r--DOCS/man/en/options.rst7
-rw-r--r--core/cfg-mplayer.h2
-rw-r--r--core/m_option.c35
-rw-r--r--core/m_option.h3
-rw-r--r--core/mp_common.h3
-rw-r--r--demux/demux_mng.c5
-rw-r--r--demux/demux_rawvideo.c81
-rw-r--r--demux/stheader.h1
-rw-r--r--etc/codecs.conf9
-rw-r--r--stream/tv.c45
-rw-r--r--stream/tvi_bsdbt848.c6
-rw-r--r--stream/tvi_def.h12
-rw-r--r--stream/tvi_dummy.c7
-rw-r--r--stream/tvi_v4l2.c98
-rw-r--r--video/decode/lavc.h1
-rw-r--r--video/decode/vd_lavc.c19
-rw-r--r--video/filter/vf_crop.c8
-rw-r--r--video/filter/vf_delogo.c10
-rw-r--r--video/filter/vf_divtc.c7
-rw-r--r--video/filter/vf_down3dright.c8
-rw-r--r--video/filter/vf_eq.c9
-rw-r--r--video/filter/vf_expand.c2
-rw-r--r--video/filter/vf_format.c2
-rw-r--r--video/filter/vf_gradfun.c13
-rw-r--r--video/filter/vf_hqdn3d.c13
-rw-r--r--video/filter/vf_ilpack.c8
-rw-r--r--video/filter/vf_mirror.c3
-rw-r--r--video/filter/vf_noformat.c2
-rw-r--r--video/filter/vf_noise.c10
-rw-r--r--video/filter/vf_pp.c10
-rw-r--r--video/filter/vf_pullup.c4
-rw-r--r--video/filter/vf_rotate.c10
-rw-r--r--video/filter/vf_scale.c39
-rw-r--r--video/filter/vf_sub.c12
-rw-r--r--video/filter/vf_swapuv.c11
-rw-r--r--video/filter/vf_unsharp.c10
-rw-r--r--video/filter/vf_yadif.c5
-rw-r--r--video/fmt-conversion.c58
-rw-r--r--video/image_writer.c8
-rw-r--r--video/img_format.c217
-rw-r--r--video/img_format.h422
-rw-r--r--video/img_fourcc.h57
-rw-r--r--video/out/gl_common.c10
-rw-r--r--video/out/vo.h2
-rw-r--r--video/out/vo_corevideo.m4
-rw-r--r--video/out/vo_direct3d.c12
-rw-r--r--video/out/vo_opengl.c2
-rw-r--r--video/out/vo_opengl_old.c4
-rw-r--r--video/out/vo_sdl.c12
-rw-r--r--video/out/vo_vdpau.c12
-rw-r--r--video/out/vo_x11.c4
-rw-r--r--video/out/vo_xv.c36
52 files changed, 695 insertions, 695 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 936f3b3293..c629d35046 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1605,10 +1605,11 @@
:sqcif|qcif|cif|4cif|pal|ntsc: set standard image size
:w=<value>: image width in pixels
:h=<value>: image height in pixels
- :i420|yv12|yuy2|y8: set colorspace
:format=<value>: colorspace (fourcc) in hex or string
- constant. Use ``--rawvideo=format=help``
- for a list of possible strings.
+ constant.
+ :mp-format=<value>: colorspace by internal video format
+ Use ``--rawvideo=mp-format=help``
+ for a list of possible formats.
:size=<value>: frame size in Bytes
*EXAMPLE*:
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index 9627a25140..0aef77ae70 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -107,7 +107,7 @@ const m_option_t tvopts_conf[]={
{"width", &stream_tv_defaults.width, CONF_TYPE_INT, 0, 0, 4096, NULL},
{"height", &stream_tv_defaults.height, CONF_TYPE_INT, 0, 0, 4096, NULL},
{"input", &stream_tv_defaults.input, CONF_TYPE_INT, 0, 0, 20, NULL},
- {"outfmt", &stream_tv_defaults.outfmt, CONF_TYPE_IMGFMT, 0, 0, 0, NULL},
+ {"outfmt", &stream_tv_defaults.outfmt, CONF_TYPE_FOURCC, 0, 0, 0, NULL},
{"fps", &stream_tv_defaults.fps, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
{"channels", &stream_tv_defaults.channels, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
{"brightness", &stream_tv_defaults.brightness, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
diff --git a/core/m_option.c b/core/m_option.c
index 7ea25c25b0..82f6265124 100644
--- a/core/m_option.c
+++ b/core/m_option.c
@@ -1203,6 +1203,41 @@ const m_option_type_t m_option_type_imgfmt = {
.copy = copy_opt,
};
+static int parse_fourcc(const m_option_t *opt, struct bstr name,
+ struct bstr param, void *dst)
+{
+ if (param.len == 0)
+ return M_OPT_MISSING_PARAM;
+
+ unsigned int value;
+
+ if (param.len == 4) {
+ uint8_t *s = param.start;
+ value = s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24);
+ } else {
+ bstr rest;
+ value = bstrtoll(param, &rest, 16);
+ if (rest.len != 0) {
+ mp_msg(MSGT_CFGPARSER, MSGL_ERR,
+ "Option %.*s: invalid FourCC: '%.*s'\n",
+ BSTR_P(name), BSTR_P(param));
+ return M_OPT_INVALID;
+ }
+ }
+
+ if (dst)
+ *((unsigned int *)dst) = value;
+
+ return 1;
+}
+
+const m_option_type_t m_option_type_fourcc = {
+ .name = "FourCC",
+ .size = sizeof(unsigned int),
+ .parse = parse_fourcc,
+ .copy = copy_opt,
+};
+
#include "audio/format.h"
static int parse_afmt(const m_option_t *opt, struct bstr name,
diff --git a/core/m_option.h b/core/m_option.h
index 20bcfba1c2..f6c346521a 100644
--- a/core/m_option.h
+++ b/core/m_option.h
@@ -53,6 +53,7 @@ extern const m_option_type_t m_option_type_print_func_param;
extern const m_option_type_t m_option_type_subconfig;
extern const m_option_type_t m_option_type_subconfig_struct;
extern const m_option_type_t m_option_type_imgfmt;
+extern const m_option_type_t m_option_type_fourcc;
extern const m_option_type_t m_option_type_afmt;
extern const m_option_type_t m_option_type_color;
@@ -177,6 +178,7 @@ struct m_sub_options {
#define CONF_TYPE_SUBCONFIG (&m_option_type_subconfig)
#define CONF_TYPE_STRING_LIST (&m_option_type_string_list)
#define CONF_TYPE_IMGFMT (&m_option_type_imgfmt)
+#define CONF_TYPE_FOURCC (&m_option_type_fourcc)
#define CONF_TYPE_AFMT (&m_option_type_afmt)
#define CONF_TYPE_SPAN (&m_option_type_span)
#define CONF_TYPE_OBJ_SETTINGS_LIST (&m_option_type_obj_settings_list)
@@ -198,6 +200,7 @@ union m_option_value {
char *string;
char **string_list;
int imgfmt;
+ unsigned int fourcc;
int afmt;
m_span_t span;
m_obj_settings_t *obj_settings_list;
diff --git a/core/mp_common.h b/core/mp_common.h
index 184cea2a32..0ee14ab484 100644
--- a/core/mp_common.h
+++ b/core/mp_common.h
@@ -28,6 +28,9 @@
// both int64_t and double should be able to represent this exactly
#define MP_NOPTS_VALUE (-1LL<<63)
+#define MP_CONCAT_(a, b) a ## b
+#define MP_CONCAT(a, b) MP_CONCAT_(a, b)
+
#define ROUND(x) ((int)((x) < 0 ? (x) - 0.5 : (x) + 0.5))
extern const char *mplayer_version;
diff --git a/demux/demux_mng.c b/demux/demux_mng.c
index 1d21d9d218..74f633d64e 100644
--- a/demux/demux_mng.c
+++ b/demux/demux_mng.c
@@ -31,7 +31,7 @@
#include "stream/stream.h"
#include "demux.h"
#include "stheader.h"
-#include "video/img_format.h"
+#include "video/img_fourcc.h"
#define MNG_SUPPORT_READ
#define MNG_SUPPORT_DISPLAY
@@ -437,7 +437,8 @@ static demuxer_t * demux_mng_open(demuxer_t * demuxer)
sh_video->ds = demuxer->video;
// set format of pixels in video packets
- sh_video->format = IMGFMT_RGB32;
+ sh_video->format = MP_FOURCC_RAWVIDEO;
+ sh_video->imgfmt = MP_FOURCC_RGB32;
// set framerate to some value (MNG does not have a fixed framerate)
sh_video->fps = 5.0f;
diff --git a/demux/demux_rawvideo.c b/demux/demux_rawvideo.c
index 68dc270e44..47d32f933e 100644
--- a/demux/demux_rawvideo.c
+++ b/demux/demux_rawvideo.c
@@ -30,8 +30,10 @@
#include "stheader.h"
#include "video/img_format.h"
+#include "video/img_fourcc.h"
-static int format = IMGFMT_I420;
+static int format = MP_FOURCC_I420;
+static int mp_format;
static int size_id = 0;
static int width = 0;
static int height = 0;
@@ -51,15 +53,8 @@ const m_option_t demux_rawvideo_opts[] = {
{ "16cif", &size_id, CONF_TYPE_FLAG,0,0,7, NULL },
{ "sif", &size_id, CONF_TYPE_FLAG,0,0,8, NULL },
// format:
- { "format", &format, CONF_TYPE_IMGFMT, 0, 0 , 0, NULL },
- // below options are obsolete
- { "i420", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_I420, NULL },
- { "yv12", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YV12, NULL },
- { "nv12", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_NV12, NULL },
- { "hm12", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_HM12, NULL },
- { "yuy2", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_YUY2, NULL },
- { "uyvy", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_UYVY, NULL },
- { "y8", &format, CONF_TYPE_FLAG, 0, 0 , IMGFMT_Y8, NULL },
+ { "format", &format, CONF_TYPE_FOURCC, 0, 0 , 0, NULL },
+ { "mp-format", &mp_format, CONF_TYPE_IMGFMT, 0, 0 , 0, NULL },
// misc:
{ "fps", &fps, CONF_TYPE_FLOAT,CONF_RANGE,0.001,1000, NULL },
{ "size", &imgsize, CONF_TYPE_INT, CONF_RANGE, 1 , 8192*8192*4, NULL },
@@ -86,30 +81,58 @@ static demuxer_t* demux_rawvideo_open(demuxer_t* demuxer) {
return 0;
}
- if(!imgsize)
- switch(format){
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_NV12:
- case IMGFMT_HM12:
- case IMGFMT_YV12: imgsize=width*height+2*(width>>1)*(height>>1);break;
- case IMGFMT_YUY2:
- case IMGFMT_UYVY: imgsize=width*height*2;break;
- case IMGFMT_Y800:
- case IMGFMT_Y8: imgsize=width*height;break;
- default:
- if (IMGFMT_IS_RGB(format))
- imgsize = width * height * ((IMGFMT_RGB_DEPTH(format) + 7) >> 3);
- else if (IMGFMT_IS_BGR(format))
- imgsize = width * height * ((IMGFMT_BGR_DEPTH(format) + 7) >> 3);
- else {
+ int tag, fmt;
+ if (mp_format) {
+ tag = MP_FOURCC_IMGFMT;
+ fmt = mp_format;
+ if (!imgsize) {
+ struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(mp_format);
+ for (int p = 0; p < desc.num_planes; p++) {
+ imgsize += ((width >> desc.xs[p]) * (height >> desc.ys[p]) *
+ desc.bpp[p] + 7) / 8;
+ }
+ }
+ } else {
+ tag = MP_FOURCC_RAWVIDEO;
+ fmt = format;
+ }
+
+ if (!imgsize) {
+ int bpp = 0;
+ switch(format){
+ case MP_FOURCC_I420: case MP_FOURCC_IYUV:
+ case MP_FOURCC_NV12: case MP_FOURCC_NV21:
+ case MP_FOURCC_HM12:
+ case MP_FOURCC_YV12:
+ bpp = 12;
+ break;
+ case MP_FOURCC_RGB12: case MP_FOURCC_BGR12:
+ case MP_FOURCC_RGB15: case MP_FOURCC_BGR15:
+ case MP_FOURCC_RGB16: case MP_FOURCC_BGR16:
+ case MP_FOURCC_YUY2: case MP_FOURCC_UYVY:
+ bpp = 16;
+ break;
+ case MP_FOURCC_RGB8: case MP_FOURCC_BGR8:
+ case MP_FOURCC_Y800: case MP_FOURCC_Y8:
+ bpp = 8;
+ break;
+ case MP_FOURCC_RGB24: case MP_FOURCC_BGR24:
+ bpp = 24;
+ break;
+ case MP_FOURCC_RGB32: case MP_FOURCC_BGR32:
+ bpp = 32;
+ break;
+ }
+ if (!bpp) {
mp_msg(MSGT_DEMUX,MSGL_ERR,"rawvideo: img size not specified and unknown format!\n");
return 0;
- }
+ }
+ imgsize = width * height * bpp / 8;
}
sh_video = new_sh_video(demuxer,0);
- sh_video->format=format;
+ sh_video->format=tag;
+ sh_video->imgfmt=fmt;
sh_video->fps=fps;
sh_video->frametime=1.0/fps;
sh_video->disp_w=width;
diff --git a/demux/stheader.h b/demux/stheader.h
index 4745e452d5..97d079f4e6 100644
--- a/demux/stheader.h
+++ b/demux/stheader.h
@@ -154,6 +154,7 @@ typedef struct sh_video {
int disp_w, disp_h; // display size (filled by demuxer)
int colorspace; // mp_csp
int color_range; // mp_csp_levels
+ int imgfmt; // raw video image format
// output driver/filters: (set by libmpcodecs core)
unsigned int outfmt;
struct vf_instance *vfilter; // video filter chain
diff --git a/etc/codecs.conf b/etc/codecs.conf
index 46f87e1cd6..ba00957a94 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -1430,6 +1430,15 @@ videocodec ffrawy800
driver ffmpeg
dll rawvideo
+; used by some demuxers (demux_rawvideo.c, demux_mng.c, stream/tv.c)
+videocodec ffrawvideo
+ info "RAW video"
+ status working
+ fourcc MPrv
+ fourcc MPvf ; internal mpv FourCC for demux_rawvideo
+ driver ffmpeg
+ dll rawvideo
+
;=============================================================================
; AUDIO CODECS
;=============================================================================
diff --git a/stream/tv.c b/stream/tv.c
index e5e64dd636..a9bc535cee 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -42,7 +42,7 @@
#include "demux/stheader.h"
#include "audio/format.h"
-#include "video/img_format.h"
+#include "video/img_fourcc.h"
#include "libavutil/avstring.h"
#include "osdep/timer.h"
@@ -409,14 +409,14 @@ static int open_tv(tvi_handle_t *tvh)
int i;
const tvi_functions_t *funcs = tvh->functions;
static const int tv_fmt_list[] = {
- IMGFMT_YV12,
- IMGFMT_I420,
- IMGFMT_UYVY,
- IMGFMT_YUY2,
- IMGFMT_RGB32,
- IMGFMT_RGB24,
- IMGFMT_RGB16,
- IMGFMT_RGB15
+ MP_FOURCC_YV12,
+ MP_FOURCC_I420,
+ MP_FOURCC_UYVY,
+ MP_FOURCC_YUY2,
+ MP_FOURCC_RGB32,
+ MP_FOURCC_RGB24,
+ MP_FOURCC_RGB16,
+ MP_FOURCC_RGB15
};
if (funcs->control(tvh->priv, TVI_CONTROL_IS_VIDEO, 0) != TVI_CONTROL_TRUE)
@@ -437,16 +437,16 @@ static int open_tv(tvi_handle_t *tvh)
{
switch(tvh->tv_param->outfmt)
{
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_UYVY:
- case IMGFMT_YUY2:
- case IMGFMT_RGB32:
- case IMGFMT_RGB24:
- case IMGFMT_BGR32:
- case IMGFMT_BGR24:
- case IMGFMT_BGR16:
- case IMGFMT_BGR15:
+ case MP_FOURCC_YV12:
+ case MP_FOURCC_I420:
+ case MP_FOURCC_UYVY:
+ case MP_FOURCC_YUY2:
+ case MP_FOURCC_RGB32:
+ case MP_FOURCC_RGB24:
+ case MP_FOURCC_BGR32:
+ case MP_FOURCC_BGR24:
+ case MP_FOURCC_BGR16:
+ case MP_FOURCC_BGR15:
break;
default:
mp_tmsg(MSGT_TV, MSGL_ERR,
@@ -715,9 +715,10 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
sh_video = new_sh_video(demuxer, 0);
/* get IMAGE FORMAT */
- funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format);
-// if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format))
-// sh_video->format = 0x0;
+ int fourcc;
+ funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &fourcc);
+ sh_video->format = MP_FOURCC_RAWVIDEO;
+ sh_video->imgfmt = fourcc;
/* set FPS and FRAMETIME */
diff --git a/stream/tvi_bsdbt848.c b/stream/tvi_bsdbt848.c
index 19d68dd899..4f101ee74f 100644
--- a/stream/tvi_bsdbt848.c
+++ b/stream/tvi_bsdbt848.c
@@ -79,7 +79,7 @@
#endif
#include "audio/format.h"
-#include "video/img_format.h"
+#include "video/img_fourcc.h"
#include "tv.h"
#include "core/mp_msg.h"
@@ -450,14 +450,14 @@ static int control(priv_t *priv, int cmd, void *arg)
}
case TVI_CONTROL_VID_GET_FORMAT:
- *(int *)arg = IMGFMT_UYVY;
+ *(int *)arg = MP_FOURCC_UYVY;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_FORMAT:
{
int req_fmt = *(int *)arg;
- if(req_fmt != IMGFMT_UYVY) return TVI_CONTROL_FALSE;
+ if(req_fmt != MP_FOURCC_UYVY) return TVI_CONTROL_FALSE;
return TVI_CONTROL_TRUE;
}
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 367f2adb35..959237aa04 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -21,7 +21,7 @@
#include <stdlib.h> /* malloc */
#include <string.h> /* memset */
-#include "video/img_format.h"
+#include "video/img_fourcc.h"
#include "tv.h"
static int init(priv_t *priv);
@@ -54,17 +54,17 @@ static inline void fill_blank_frame(char* buffer,int len,int fmt){
// RGB(0,0,255) <-> YVU(41,110,240)
switch(fmt){
- case IMGFMT_YV12:
+ case MP_FOURCC_YV12:
memset(buffer, 41,4*len/6); //Y
memset(buffer+4*len/6, 110,len/6);//V
memset(buffer+5*len/6, 240,len/6);//U
break;
- case IMGFMT_I420:
+ case MP_FOURCC_I420:
memset(buffer, 41,4*len/6); //Y
memset(buffer+4*len/6, 240,len/6);//U
memset(buffer+5*len/6, 110,len/6);//V
break;
- case IMGFMT_UYVY:
+ case MP_FOURCC_UYVY:
for(i=0;i<len;i+=4){
buffer[i]=0xFF;
buffer[i+1]=0;
@@ -72,7 +72,7 @@ static inline void fill_blank_frame(char* buffer,int len,int fmt){
buffer[i+3]=0;
}
break;
- case IMGFMT_YUY2:
+ case MP_FOURCC_YUY2:
for(i=0;i<len;i+=4){
buffer[i]=0;
buffer[i+1]=0xFF;
@@ -80,7 +80,7 @@ static inline void fill_blank_frame(char* buffer,int len,int fmt){
buffer[i+3]=0;
}
break;
- case IMGFMT_MJPEG:
+ case MP_FOURCC_MJPEG:
/*
This is compressed format. I don't know yet how to fill such frame with blue color.
Keeping frame unchanged.
diff --git a/stream/tvi_dummy.c b/stream/tvi_dummy.c
index 48a745450e..c0bf8bba32 100644
--- a/stream/tvi_dummy.c
+++ b/stream/tvi_dummy.c
@@ -21,7 +21,7 @@
#include "config.h"
#include <stdio.h>
-#include "video/img_format.h"
+#include "video/img_fourcc.h"
#include "tv.h"
static tvi_handle_t *tvi_init_dummy(tv_param_t* tv_param);
@@ -74,14 +74,13 @@ static int control(priv_t *priv, int cmd, void *arg)
case TVI_CONTROL_IS_VIDEO:
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_FORMAT:
-// *(int *)arg = IMGFMT_YV12;
- *(int *)arg = IMGFMT_YV12;
+ *(int *)arg = MP_FOURCC_YV12;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_FORMAT:
{
// int req_fmt = *(int *)arg;
int req_fmt = *(int *)arg;
- if (req_fmt != IMGFMT_YV12)
+ if (req_fmt != MP_FOURCC_YV12)
return TVI_CONTROL_FALSE;
return TVI_CONTROL_TRUE;
}
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 14313d0966..abe455d8bf 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -56,7 +56,7 @@ known issues:
#include <linux/videodev2.h>
#endif
#include "core/mp_msg.h"
-#include "video/img_format.h"
+#include "video/img_fourcc.h"
#include "audio/format.h"
#include "tv.h"
#include "audio_in.h"
@@ -180,27 +180,27 @@ static void *video_grabber(void *data);
Only few of the fourccs are the same in v4l2 and mplayer:
- IMGFMT_YVU9 == V4L2_PIX_FMT_YVU410
- IMGFMT_YV12 == V4L2_PIX_FMT_YVU420
- IMGFMT_NV12 == V4L2_PIX_FMT_NV12
- IMGFMT_422P == V4L2_PIX_FMT_YUV422P
- IMGFMT_411P == V4L2_PIX_FMT_YUV411P
- IMGFMT_UYVY == V4L2_PIX_FMT_UYVY
- IMGFMT_Y41P == V4L2_PIX_FMT_Y41P
+ MP_FOURCC_YVU9 == V4L2_PIX_FMT_YVU410
+ MP_FOURCC_YV12 == V4L2_PIX_FMT_YVU420
+ MP_FOURCC_NV12 == V4L2_PIX_FMT_NV12
+ MP_FOURCC_422P == V4L2_PIX_FMT_YUV422P
+ MP_FOURCC_411P == V4L2_PIX_FMT_YUV411P
+ MP_FOURCC_UYVY == V4L2_PIX_FMT_UYVY
+ MP_FOURCC_Y41P == V4L2_PIX_FMT_Y41P
This may be an useful translation table for some others:
- IMGFMT_RGB8 == V4L2_PIX_FMT_RGB332
- IMGFMT_BGR15 == V4L2_PIX_FMT_RGB555
- IMGFMT_BGR16 == V4L2_PIX_FMT_RGB565
- IMGFMT_RGB24 == V4L2_PIX_FMT_RGB24
- IMGFMT_RGB32 == V4L2_PIX_FMT_RGB32
- IMGFMT_BGR24 == V4L2_PIX_FMT_BGR24
- IMGFMT_BGR32 == V4L2_PIX_FMT_BGR32
- IMGFMT_Y800 == V4L2_PIX_FMT_GREY
- IMGFMT_IF09 == V4L2_PIX_FMT_YUV410
- IMGFMT_I420 == V4L2_PIX_FMT_YUV420
- IMGFMT_YUY2 == V4L2_PIX_FMT_YUYV
+ MP_FOURCC_RGB8 == V4L2_PIX_FMT_RGB332
+ MP_FOURCC_BGR15 == V4L2_PIX_FMT_RGB555
+ MP_FOURCC_BGR16 == V4L2_PIX_FMT_RGB565
+ MP_FOURCC_RGB24 == V4L2_PIX_FMT_RGB24
+ MP_FOURCC_RGB32 == V4L2_PIX_FMT_RGB32
+ MP_FOURCC_BGR24 == V4L2_PIX_FMT_BGR24
+ MP_FOURCC_BGR32 == V4L2_PIX_FMT_BGR32
+ MP_FOURCC_Y800 == V4L2_PIX_FMT_GREY
+ MP_FOURCC_YUV9 == V4L2_PIX_FMT_YUV410
+ MP_FOURCC_I420 == V4L2_PIX_FMT_YUV420
+ MP_FOURCC_YUY2 == V4L2_PIX_FMT_YUYV
\**********************************************************************/
@@ -210,20 +210,20 @@ static void *video_grabber(void *data);
static int fcc_mp2vl(int fcc)
{
switch (fcc) {
- case IMGFMT_RGB8: return V4L2_PIX_FMT_RGB332;
- case IMGFMT_BGR15: return V4L2_PIX_FMT_RGB555;
- case IMGFMT_BGR16: return V4L2_PIX_FMT_RGB565;
- case IMGFMT_RGB24: return V4L2_PIX_FMT_RGB24;
- case IMGFMT_RGB32: return V4L2_PIX_FMT_RGB32;
- case IMGFMT_BGR24: return V4L2_PIX_FMT_BGR24;
- case IMGFMT_BGR32: return V4L2_PIX_FMT_BGR32;
- case IMGFMT_Y800: return V4L2_PIX_FMT_GREY;
- case IMGFMT_IF09: return V4L2_PIX_FMT_YUV410;
- case IMGFMT_I420: return V4L2_PIX_FMT_YUV420;
- case IMGFMT_YUY2: return V4L2_PIX_FMT_YUYV;
- case IMGFMT_YV12: return V4L2_PIX_FMT_YVU420;
- case IMGFMT_UYVY: return V4L2_PIX_FMT_UYVY;
- case IMGFMT_MJPEG: return V4L2_PIX_FMT_MJPEG;
+ case MP_FOURCC_RGB8: return V4L2_PIX_FMT_RGB332;
+ case MP_FOURCC_BGR15: return V4L2_PIX_FMT_RGB555;
+ case MP_FOURCC_BGR16: return V4L2_PIX_FMT_RGB565;
+ case MP_FOURCC_RGB24: return V4L2_PIX_FMT_RGB24;
+ case MP_FOURCC_RGB32: return V4L2_PIX_FMT_RGB32;
+ case MP_FOURCC_BGR24: return V4L2_PIX_FMT_BGR24;
+ case MP_FOURCC_BGR32: return V4L2_PIX_FMT_BGR32;
+ case MP_FOURCC_Y800: return V4L2_PIX_FMT_GREY;
+ case MP_FOURCC_YUV9: return V4L2_PIX_FMT_YUV410;
+ case MP_FOURCC_I420: return V4L2_PIX_FMT_YUV420;
+ case MP_FOURCC_YUY2: return V4L2_PIX_FMT_YUYV;
+ case MP_FOURCC_YV12: return V4L2_PIX_FMT_YVU420;
+ case MP_FOURCC_UYVY: return V4L2_PIX_FMT_UYVY;
+ case MP_FOURCC_MJPEG: return V4L2_PIX_FMT_MJPEG;
}
return fcc;
}
@@ -234,20 +234,20 @@ static int fcc_mp2vl(int fcc)
static int fcc_vl2mp(int fcc)
{
switch (fcc) {
- case V4L2_PIX_FMT_RGB332: return IM