diff options
-rw-r--r-- | Copyright | 1 | ||||
-rw-r--r-- | demux/demux_mkv.c | 7 | ||||
-rw-r--r-- | demux/demux_raw.c | 28 | ||||
-rw-r--r-- | demux/demux_tv.c | 1 | ||||
-rw-r--r-- | stream/tv.c | 1 | ||||
-rw-r--r-- | stream/tv.h | 38 | ||||
-rw-r--r-- | stream/tvi_def.h | 1 | ||||
-rw-r--r-- | stream/tvi_dummy.c | 1 | ||||
-rw-r--r-- | stream/tvi_v4l2.c | 1 | ||||
-rw-r--r-- | video/img_fourcc.h | 47 | ||||
-rw-r--r-- | video/out/opengl/hwdec_vaegl.c | 10 | ||||
-rw-r--r-- | video/out/vo_xv.c | 9 |
12 files changed, 62 insertions, 83 deletions
@@ -306,7 +306,6 @@ x video/fmt-conversion.* hard video/hwdec.* LGPL x video/image_writer.* unknown x video/img_format.* hard -x video/img_fourcc.h hard video/mp_image.* almost LGPL video/mp_image_pool.* LGPL video/out/aspect.* LGPL diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 97c7d3e09b..c3988b8bf8 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -56,7 +56,6 @@ #include "ebml.h" #include "matroska.h" #include "codec_tags.h" -#include "video/img_fourcc.h" #include "common/msg.h" @@ -1392,8 +1391,8 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track) fourcc1 = AV_RL32(track->private_data + 0); fourcc2 = AV_RL32(track->private_data + 4); } - if (fourcc1 == MP_FOURCC('S', 'V', 'Q', '3') || - fourcc2 == MP_FOURCC('S', 'V', 'Q', '3')) + if (fourcc1 == MKTAG('S', 'V', 'Q', '3') || + fourcc2 == MKTAG('S', 'V', 'Q', '3')) { sh_v->codec = "svq3"; extradata = track->private_data; @@ -1417,7 +1416,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track) track->parse = true; track->parse_timebase = 1e9; } else if (!strcmp(codec, "mjpeg")) { - sh_v->codec_tag = MP_FOURCC('m', 'j', 'p', 'g'); + sh_v->codec_tag = MKTAG('m', 'j', 'p', 'g'); } if (extradata_size > 0x1000000) { diff --git a/demux/demux_raw.c b/demux/demux_raw.c index c0948c59dc..7dffa1caa7 100644 --- a/demux/demux_raw.c +++ b/demux/demux_raw.c @@ -23,6 +23,7 @@ #include <string.h> #include <libavcodec/avcodec.h> +#include <libavutil/common.h> #include "common/av_common.h" @@ -36,7 +37,6 @@ #include "video/fmt-conversion.h" #include "video/img_format.h" -#include "video/img_fourcc.h" #include "osdep/endian.h" @@ -118,7 +118,7 @@ const struct m_sub_options demux_rawvideo_conf = { }, .size = sizeof(struct demux_rawvideo_opts), .defaults = &(const struct demux_rawvideo_opts){ - .vformat = MP_FOURCC_I420, + .vformat = MKTAG('I', '4', '2', '0'), .width = 1280, .height = 720, .fps = 25, @@ -208,28 +208,16 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check) if (!imgsize) { int bpp = 0; switch (imgfmt) { - case MP_FOURCC_I420: case MP_FOURCC_IYUV: - case MP_FOURCC_NV12: case MP_FOURCC_NV21: - case MP_FOURCC_HM12: - case MP_FOURCC_YV12: + case MKTAG('Y', 'V', '1', '2'): + case MKTAG('I', '4', '2', '0'): + case MKTAG('I', 'Y', 'U', 'V'): + case MKTAG('N', 'V', '1', '2'): 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: + case MKTAG('U', 'Y', 'V', 'Y'): + case MKTAG('Y', 'U', 'Y', '2'): 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_ERR(demuxer, "rawvideo: img size not specified and unknown format!\n"); diff --git a/demux/demux_tv.c b/demux/demux_tv.c index 4a8e0c70fa..94bb71284e 100644 --- a/demux/demux_tv.c +++ b/demux/demux_tv.c @@ -11,7 +11,6 @@ #include "codec_tags.h" #include "audio/format.h" -#include "video/img_fourcc.h" #include "osdep/endian.h" #include "stream/stream.h" diff --git a/stream/tv.c b/stream/tv.c index 89783374f9..de97f8d13e 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -46,7 +46,6 @@ #include "stream.h" #include "audio/format.h" -#include "video/img_fourcc.h" #include "osdep/timer.h" #include "tv.h" diff --git a/stream/tv.h b/stream/tv.h index 434a52d4fd..64be22298b 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -24,6 +24,8 @@ #ifndef MPLAYER_TV_H #define MPLAYER_TV_H +#include "osdep/endian.h" + struct mp_log; typedef struct tv_params { @@ -238,4 +240,40 @@ int tv_stream_control(tvi_handle_t *tvh, int cmd, void *arg); extern const struct m_sub_options tv_params_conf; +#define MP_FOURCC(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((unsigned)(d)<<24)) + +#if BYTE_ORDER == BIG_ENDIAN +#define MP_FOURCC_E(a,b,c,d) MP_FOURCC(a,b,c,d) +#else +#define MP_FOURCC_E(a,b,c,d) MP_FOURCC(d,c,b,a) +#endif + +#define MP_FOURCC_RGB8 MP_FOURCC_E(8, 'B', 'G', 'R') +#define MP_FOURCC_RGB12 MP_FOURCC_E(12, 'B', 'G', 'R') +#define MP_FOURCC_RGB15 MP_FOURCC_E(15, 'B', 'G', 'R') +#define MP_FOURCC_RGB16 MP_FOURCC_E(16, 'B', 'G', 'R') +#define MP_FOURCC_RGB24 MP_FOURCC_E(24, 'B', 'G', 'R') +#define MP_FOURCC_RGB32 MP_FOURCC_E('A', 'B', 'G', 'R') + +#define MP_FOURCC_BGR8 MP_FOURCC_E(8, 'R', 'G', 'B') +#define MP_FOURCC_BGR12 MP_FOURCC_E(12, 'R', 'G', 'B') +#define MP_FOURCC_BGR15 MP_FOURCC_E(15, 'R', 'G', 'B') +#define MP_FOURCC_BGR16 MP_FOURCC_E(16, 'R', 'G', 'B') +#define MP_FOURCC_BGR24 MP_FOURCC_E(24, 'R', 'G', 'B') +#define MP_FOURCC_BGR32 MP_FOURCC_E('A', 'R', 'G', 'B') + +#define MP_FOURCC_YVU9 MP_FOURCC('Y', 'U', 'V', '9') +#define MP_FOURCC_YUV9 MP_FOURCC('Y', 'V', 'U', '9') +#define MP_FOURCC_YV12 MP_FOURCC('Y', 'V', '1', '2') +#define MP_FOURCC_I420 MP_FOURCC('I', '4', '2', '0') +#define MP_FOURCC_IYUV MP_FOURCC('I', 'Y', 'U', 'V') +#define MP_FOURCC_Y800 MP_FOURCC('Y', '8', '0', '0') +#define MP_FOURCC_NV12 MP_FOURCC('N', 'V', '1', '2') +#define MP_FOURCC_NV21 MP_FOURCC('N', 'V', '2', '1') + +#define MP_FOURCC_UYVY MP_FOURCC('U', 'Y', 'V', 'Y') +#define MP_FOURCC_YUY2 MP_FOURCC('Y', 'U', 'Y', '2') + +#define MP_FOURCC_MJPEG MP_FOURCC('M', 'J', 'P', 'G') + #endif /* MPLAYER_TV_H */ diff --git a/stream/tvi_def.h b/stream/tvi_def.h index 8f2e72dc10..97d0982c94 100644 --- a/stream/tvi_def.h +++ b/stream/tvi_def.h @@ -20,7 +20,6 @@ #include <stdlib.h> /* malloc */ #include <string.h> /* memset */ -#include "video/img_fourcc.h" #include "tv.h" static int init(priv_t *priv); diff --git a/stream/tvi_dummy.c b/stream/tvi_dummy.c index 9eee9437f0..744a706e3e 100644 --- a/stream/tvi_dummy.c +++ b/stream/tvi_dummy.c @@ -21,7 +21,6 @@ #include <stdio.h> #include "common/common.h" -#include "video/img_fourcc.h" #include "tv.h" static tvi_handle_t *tvi_init_dummy(struct mp_log *log, tv_param_t* tv_param); diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c index ae651f00e1..bd7ecd1e27 100644 --- a/stream/tvi_v4l2.c +++ b/stream/tvi_v4l2.c @@ -55,7 +55,6 @@ known issues: #endif #include "common/msg.h" #include "common/common.h" -#include "video/img_fourcc.h" #include "audio/format.h" #include "tv.h" #include "audio_in.h" diff --git a/video/img_fourcc.h b/video/img_fourcc.h deleted file mode 100644 index 1539a7b4f3..0000000000 --- a/video/img_fourcc.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef MPV_IMG_FOURCC_H -#define MPV_IMG_FOURCC_H - -#include "osdep/endian.h" - -#define MP_FOURCC(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((unsigned)(d)<<24)) - -#if BYTE_ORDER == BIG_ENDIAN -#define MP_FOURCC_E(a,b,c,d) MP_FOURCC(a,b,c,d) -#else -#define MP_FOURCC_E(a,b,c,d) MP_FOURCC(d,c,b,a) -#endif - -#define MP_FOURCC_RGB8 MP_FOURCC_E(8, 'B', 'G', 'R') -#define MP_FOURCC_RGB12 MP_FOURCC_E(12, 'B', 'G', 'R') -#define MP_FOURCC_RGB15 MP_FOURCC_E(15, 'B', 'G', 'R') -#define MP_FOURCC_RGB16 MP_FOURCC_E(16, 'B', 'G', 'R') -#define MP_FOURCC_RGB24 MP_FOURCC_E(24, 'B', 'G', 'R') -#define MP_FOURCC_RGB32 MP_FOURCC_E('A', 'B', 'G', 'R') - -#define MP_FOURCC_BGR8 MP_FOURCC_E(8, 'R', 'G', 'B') -#define MP_FOURCC_BGR12 MP_FOURCC_E(12, 'R', 'G', 'B') -#define MP_FOURCC_BGR15 MP_FOURCC_E(15, 'R', 'G', 'B') -#define MP_FOURCC_BGR16 MP_FOURCC_E(16, 'R', 'G', 'B') -#define MP_FOURCC_BGR24 MP_FOURCC_E(24, 'R', 'G', 'B') -#define MP_FOURCC_BGR32 MP_FOURCC_E('A', 'R', 'G', 'B') - -#define MP_FOURCC_YVU9 MP_FOURCC('Y', 'U', 'V', '9') -#define MP_FOURCC_YUV9 MP_FOURCC('Y', 'V', 'U', '9') -#define MP_FOURCC_YV12 MP_FOURCC('Y', 'V', '1', '2') -#define MP_FOURCC_I420 MP_FOURCC('I', '4', '2', '0') -#define MP_FOURCC_IYUV MP_FOURCC('I', 'Y', 'U', 'V') -#define MP_FOURCC_Y800 MP_FOURCC('Y', '8', '0', '0') -#define MP_FOURCC_Y8 MP_FOURCC('Y', '8', ' ', ' ') -#define MP_FOURCC_NV12 MP_FOURCC('N', 'V', '1', '2') -#define MP_FOURCC_NV21 MP_FOURCC('N', 'V', '2', '1') - -#define MP_FOURCC_UYVY MP_FOURCC('U', 'Y', 'V', 'Y') -#define MP_FOURCC_YUY2 MP_FOURCC('Y', 'U', 'Y', '2') - -#define MP_FOURCC_MJPEG MP_FOURCC('M', 'J', 'P', 'G') - -// NOTE: no "HM12" decoder exists, as vd_hmblck has been removed -// likely breaks video with some TV cards -#define MP_FOURCC_HM12 0x32314D48 - -#endif diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c index 548d3678f3..0d2f1b1a17 100644 --- a/video/out/opengl/hwdec_vaegl.c +++ b/video/out/opengl/hwdec_vaegl.c @@ -24,6 +24,7 @@ #include <va/va_drmcommon.h> +#include <libavutil/common.h> #include <libavutil/hwcontext.h> #include <libavutil/hwcontext_vaapi.h> @@ -31,7 +32,6 @@ #include "hwdec.h" #include "video/vaapi.h" -#include "video/img_fourcc.h" #include "video/mp_image_pool.h" #include "common.h" #include "formats.h" @@ -325,13 +325,13 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image, int drm_fmts[8] = { // 1 bytes per component, 1-4 components - MP_FOURCC('R', '8', ' ', ' '), // DRM_FORMAT_R8 - MP_FOURCC('G', 'R', '8', '8'), // DRM_FORMAT_GR88 + MKTAG('R', '8', ' ', ' '), // DRM_FORMAT_R8 + MKTAG('G', 'R', '8', '8'), // DRM_FORMAT_GR88 0, // untested (DRM_FORMAT_RGB888?) 0, // untested (DRM_FORMAT_RGBA8888?) // 2 bytes per component, 1-4 components - MP_FOURCC('R', '1', '6', ' '), // proposed DRM_FORMAT_R16 - MP_FOURCC('G', 'R', '3', '2'), // proposed DRM_FORMAT_GR32 + MKTAG('R', '1', '6', ' '), // proposed DRM_FORMAT_R16 + MKTAG('G', 'R', '3', '2'), // proposed DRM_FORMAT_GR32 0, // N/A 0, // N/A }; diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index a866266f89..0af6f436be 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -46,7 +46,6 @@ #include "common/msg.h" #include "vo.h" #include "video/mp_image.h" -#include "video/img_fourcc.h" #include "x11_common.h" #include "sub/osd.h" #include "sub/draw_bmp.h" @@ -99,6 +98,14 @@ struct xvctx { #endif }; +#define MP_FOURCC(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((unsigned)(d)<<24)) + +#define MP_FOURCC_YV12 MP_FOURCC('Y', 'V', '1', '2') +#define MP_FOURCC_I420 MP_FOURCC('I', '4', '2', '0') +#define MP_FOURCC_IYUV MP_FOURCC('I', 'Y', 'U', 'V') +#define MP_FOURCC_UYVY MP_FOURCC('U', 'Y', 'V', 'Y') +#define MP_FOURCC_YUY2 MP_FOURCC('Y', 'U', 'Y', '2') + struct fmt_entry { int imgfmt; int fourcc; |