1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-17 20:34:58 +00:00
mpv/video/img_fourcc.h
wm4 4d016a92c8 core: redo how codecs are mapped, remove codecs.conf
Use codec names instead of FourCCs to identify codecs. Rewrite how
codecs are selected and initialized. Now each decoder exports a list
of decoders (and the codec it supports) via add_decoders(). The order
matters, and the first decoder for a given decoder is preferred over
the other decoders. E.g. all ad_mpg123 decoders are preferred over
ad_lavc, because it comes first in the mpcodecs_ad_drivers array.
Likewise, decoders within ad_lavc that are enumerated first by
libavcodec (using av_codec_next()) are preferred. (This is actually
critical to select h264 software decoding by default instead of vdpau.
libavcodec and ffmpeg/avconv use the same method to select decoders by
default, so we hope this is sane.)

The codec names follow libavcodec's codec names as defined by
AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders
have names different from the canonical codec name. The AVCodecDescriptor
API is relatively new, so we need a compatibility layer for older
libavcodec versions for codec names that are referenced internally,
and which are different from the decoder name. (Add a configure check
for that, because checking versions is getting way too messy.)

demux/codec_tags.c is generated from the former codecs.conf (minus
"special" decoders like vdpau, and excluding the mappings that are the
same as the mappings libavformat's exported RIFF tables). It contains
all the mappings from FourCCs to codec name. This is needed for
demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the
codec as determined by libavformat, while the other demuxers have to do
this on their own, using the mp_set_audio/video_codec_from_tag()
functions. Note that the sh_audio/video->format members don't uniquely
identify the codec anymore, and sh->codec takes over this role.

Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which
provide cover the functionality of the removed switched.

Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure
container/video combinations (e.g. the sample Film_200_zygo_pro.mov)
are played flipped. ffplay/avplay doesn't handle this properly either,
so we don't care and blame ffmeg/libav instead.
2013-02-10 17:25:56 +01:00

48 lines
1.7 KiB
C

#ifndef MPV_IMG_FOURCC_H
#define MPV_IMG_FOURCC_H
#include <sys/types.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