diff options
54 files changed, 1220 insertions, 3926 deletions
diff --git a/.gitignore b/.gitignore index 7ceff799c5..6915d4ff65 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ /mpv /mpv.app /version.h -/core/codecs.conf.h /core/input/input_conf.h /tags /TAGS diff --git a/DOCS/OUTDATED-tech/codecs.conf.txt b/DOCS/OUTDATED-tech/codecs.conf.txt deleted file mode 100644 index 75f480933f..0000000000 --- a/DOCS/OUTDATED-tech/codecs.conf.txt +++ /dev/null @@ -1,214 +0,0 @@ -Understanding MPlayer's etc/codecs.conf File - -Introduction ------------- -MPlayer features a very flexible codec architecture which allows it to -use its own open source codecs, as well as open source libraries, Win32 -codec DLLs and other binary codec modules. To the MPlayer user, the -most visible piece of this architecture is the etc/codecs.conf file. This -is a text-based configuration file that controls which MPlayer components -are in charge of handling particular compressed data formats. - -The codecs.conf file is stored either in a shared directory for all system -users to access, or in the .mplayer directory in a user's home -directory. When MPlayer starts, it first looks for a codecs.conf file in a -user's home directory. Failing that, it searches for the shared file. If -no codecs.conf file is found MPlayer falls back on its internal hardcoded -configuration. If the file is present but has syntax errors, MPlayer will -report the error. - -The codecs.conf file is really quite simple. It is simply a collection of -codec definition blocks that define how different media types should be -handled. There are a number of keywords that can occur in a block. Not all -of them are required and no particular order is enforced. - -Editing codecs.conf -------------------- -You can edit codecs.conf using your favorite text editor. Anything that -comes after a semicolon (;) on a line is regarded as a comment. For -example: -; this is a comment - format 0x34616d69 ; "ima4" (MOV files) - -The codec blocks can be in any order; the file parser doesn't -care. However, they are organized in a particular order for the benefit of -human readers. For example, all of the open source decoders that MPlayer -implements natively are grouped in one section. - -Release Number --------------- -Your codecs.conf now requires a release number to avoid codec release -incompatibilities. The format is simple: (YYYYMMDD) - -release 20020520 - -Whenever changes are made to the codecs that *require* an updated -codecs.conf, then MPlayer will no longer accept outdated versions. -It is not recommended to change this line unless you know exactly -what you are doing. - -Video Codecs ------------- -Let's jump right in with an example. Here is an example video codec block: - -videocodec indeo5ds - info "Intel Indeo 5" - status working - fourcc IV50,iv50 - driver dshow - dll "ir50_32.dll" - guid 0x30355649, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 - out YV12 - out YUY2 - out BGR32,BGR24,BGR16,BGR15 - -This is a particularly full-featured video codec. The "videocodec" keyword -identifies the fact that this is the start of a new video -codec. "indeo5ds" is MPlayer's unique name for the codec. You have to use -this name with the -vc/-ac option. - -The next line has the keyword "info" which specifies a human-readable -comment accompanying this codec. This is printed by -vc help / -ac help. - -The "status" keyword carries information about the codec's functional -status. MPlayer currently recognizes 4 status levels: working, buggy, -crashing, and untested. When it gets to codec auto-selection, it tries -untested first (to force users to test it for us and report results :)), -then working and finally buggy ones. Codecs marked crashing won't be tried, -unless explicitly (-vc/-ac) selected. - -The next line lists 4-character codes (FOURCCs) that are associated with -this codec. There can be more than one FOURCC specified on a fourcc line -as long as they are separated with a comma. There can also be multiple -fourcc lines in the codec. A second fourcc can also be given, separated -with a space. MPlayer will replace the original fourcc in the headers with -this one before opening the codec. It's useful for win32 codecs checking for -the fourccs. - -The "driver" keyword associates this codec with an internal MPlayer -decoder module. MPlayer has a module named "dshow" that handles data -encoded by the codec. See -vfm help / -afm help for the available module list. - -The "dll" keyword specifies which Win32/XAnim/Real/Quicktime binary -module needs to be loaded. It's also used to specify which FFmpeg codec -to load. The list of FFmpeg codecs can be found in libavcodec/allcodecs.c. - -The "guid" keyword identifies a 16-byte Microsoft GUID that some media -files use to identify codecs. Used only for win32 dshow and DMO codecs. - -The "out" keyword identifies which output format the decoder is known -to provide. Just like the fourcc line, there can be multiple out lines or -multiple comma-separated output formats on the same line. The output -formats should be listed in order of preference. - -The outfmt values can be followed by one or more flags, like flip, noflip, -static, query. The flags are defined as follows: - -"flip": - If this flag is set for a given format, then o_bih->biHeight will NOT be - set to -bih->biHeight, i.e. the image will be decoded upside-down. - Used only by vfw and vfwex codecs. - -"noflip": - This flag is ignored (no effect) without "flip" being set! - If this flag is set, it means the codec doesn't decode upside-down, - although it's told to do so. - -"yuvhack": - This flag is required for the old win32 ms-mpeg4 vfw codecs, including - MP42 and DIV3 (DivX 3.11). These DLLs actually support YUV formats, - but the query/begin functions are buggy and don't accept YUV fourccs - (the decode function accepts it and works well!) - If this flag is set, then o_bih->biCompression will be set to 0 for - the initialization for the YUV modes. Used only by vfw/vfwex codecs. - -"query": - This flag is used to control VDCTRL_QUERY_FORMAT for vfw/vfewx codecs. - If this flag is set, the control() will query the codec for the csp - support, otherwise it will assume a constant csp table. Required for - some DLLs (like huffyuv, CRAM). - -"static", - This flag forces STATIC (instead of TEMP) buffer allocation for the codec. - Used for some very old DLLs like Indeo 3 and for some XAnim codecs like - cinepak. See dr-methods.txt for details on buffer types. - -The "in" keyword -- UNDOCUMENTED - -Audio Codecs ------------- -Here is an example of a rather full-featured audio codec block: - -audiocodec mp3 - info "MPEG layer-2, layer-3" - status working - comment "Optimized to MMX/SSE/3Dnow!" - format 0x50 - format 0x55 - format 0x33706d2e ; ".mp3" CBR/VBR MP3 (MOV files) - format 0x5500736d ; "ms\0\x55" older mp3 fcc (MOV files) - driver mp3lib - dll "mp3lib (mpglib)" - flags seekable - -Many of the keywords are the same as a video codec block. However, we see -a few that we haven't seen before. The "comment" keyword identifies -another human-readable note for this codec. - -The "format" keyword performs a similar job as the fourcc line. However, -since certain media file formats (notably AVI) identify audio formats with -16-bit numbers rather than 32-bit FOURCCs, it's necessary to use this -convention to accommodate them. However, as shown in this example, FOURCCs -can also be specified with the format keyword as long as they're converted -to their hex representation. It's important to note that this can be -useful for video codecs as well if a FOURCC contains a space (such as -Apple's "rle " codec). - -The "flags" keywords identifies any additional abilities of this -codec. Currently, seekable is the only supported flag. - - -Adding FFmpeg Codecs -------------------- -example codec: - -videocodec ffmdec - info "FFmpeg Sony PlayStation MDEC (Motion DECoder)" - status working - fourcc MDEC ; internal MPlayer FourCC - driver ffmpeg - dll mdec - out YV12 - -The "videocodec" name should start with ff to differentiate it from other -libraries or binary codecs. - -The "dll" name comes from the codec source file or the libavcodec/allcodecs.c -file. - -The "out" colorspace can be found in the codec source file in the PIX_FMT -struct. Note that some codecs may have several pix_fmt structs. -The pix_fmt can be converted to the codecs.conf "out" format by reading -the fmt-conversion.c file. - -If there are BE and LE versions of a pix_fmt, ignore them and use the short -native format instead. e.g. 422P16_LE becomes out 422P16. also to note that -underscores cause parse errors, so 422P16_LE becomes out 422P16LE. - -libmpdemux/mp_taglists.c --------------- -Sometimes the lavf demuxer will not pass on a fourcc (mostly video game -formats or other containers that do not support isom/riff tags). You will have -to make one based on the codec_id listed in the codec source file. - -Note that it is a good idea to mark any fourcc you create as -' ; internal MPlayer FourCC'. In case another codec uses that fourcc, -you can easily change the internal one. Also this will stop other projects -from thinking of the internal tag as a real fourcc found in the wild. - -libmpdemux/demuxer.c --------------- -Some audio codecs require a parser, you can see which ones do -by reading the parsers section in libavcodec/allcodecs.c. - -EOF diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst index 892b3f0af9..adaf1aa0d2 100644 --- a/DOCS/man/en/changes.rst +++ b/DOCS/man/en/changes.rst @@ -120,6 +120,7 @@ Command line switches -vobsub --sub (pass the .idx file) -ass-bottom-margin --vf=sub=bottom:top -vc ffh264vdpau (etc.) --hwdec=vdpau + -ac spdifac3 --ad=spdif:ac3 (see --ad=help) -x W, -y H --geometry=WxH + --no-keepaspect -xy W --autofit=W =================================== =================================== diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst index f146208fd3..6b61578a1a 100644 --- a/DOCS/man/en/input.rst +++ b/DOCS/man/en/input.rst @@ -283,7 +283,7 @@ hr-seek x see ``--hr-seek`` volume x current volume (0-100) mute x current mute status (bool) audio-delay x see ``--audio-delay`` -audio-format audio format (codec tag) +audio-format audio format (string) audio-codec audio codec selected for decoding audio-bitrate audio bitrate samplerate audio samplerate @@ -306,7 +306,7 @@ saturation x see ``--saturation`` hue x see ``--hue`` panscan x see ``--panscan`` vsync x see ``--vsync`` -video-format video format (integer FourCC) +video-format video format (string) video-codec video codec selected for decoding video-bitrate video bitrate width video width diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index ea43b9c49f..12dccdc8c4 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -10,14 +10,32 @@ (``--ao=oss`` only) (OBSOLETE) Override audio driver/card buffer size detection. ---ac=<[-\|+]codec1,[-\|+]codec2,...[,]> - Specify a priority list of audio codecs to be used, according to their - codec name in codecs.conf. Use a '-' before the codec name to omit it. - Use a '+' before the codec name to force it, this will likely crash! If - the list has a trailing ',' mpv will fall back on codecs not contained - in the list. +--ad=<[+|-]family1:(*|decoder1),[+|-]family2:(*|decoder2),...[-]> + Specify a priority list of audio decoders to be used, according to their + family and decoder name. Entries like ``family:*`` prioritize all decoders + of the given family. When determining which decoder to use, the first + decoder that matches the audio format is selected. If that is unavailable, + the next decoder is used. Finally, it tries all other decoders that are not + explicitly selected or rejected by the option. - *NOTE*: See ``--ac=help`` for a full list of available codecs. + ``-`` at the end of the list suppresses fallback to other available + decoders not on the ``--ad`` list. ``+`` in front of an entry forces the + decoder. Both of these shouldn't normally be used, because they break + normal decoder auto-selection! + + ``-`` in front of an entry disables selection of the decoder. + + *EXAMPLE*: + + ``--ad=lavc:mp3float`` + Prefer the FFmpeg/Libav ``mp3float`` decoder over all other mp3 + decoders. + + ``--ad=spdif:ac3,lavc:*`` + Always prefer spdif AC3 over FFmpeg/Libav over anything else. + + ``--ad=help`` + List all available decoders. --af=<filter1[=parameter1:parameter2:...],filter2,...> Specify a list of audio filters to apply to the audio stream. See @@ -60,17 +78,6 @@ list=<filters> Same as ``--af``. ---afm=<driver1,driver2,...> - Specify a priority list of audio codec families to be used, according to - their codec name in codecs.conf. Falls back on the default codecs if none - of the given codec families work. - - *NOTE*: See ``--afm=help`` for a full list of available codec families. - - *EXAMPLE*: - - :``--afm=ffmpeg``: Try FFmpeg's libavcodec codecs first. - --aid=<ID|auto|no> Select audio channel. ``auto`` selects the default, ``no`` disables audio. See also ``--alang``. @@ -409,10 +416,6 @@ the start of the next one then keep playing video normally over the chapter change instead of doing a seek. ---codecs-file=<filename> - Override the standard search path and use the specified file instead of - the builtin codecs.conf. - --colormatrix=<colorspace> Controls the YUV to RGB color space conversion when playing video. There are various standards. Normally, BT.601 should be used for SD video, and @@ -2257,14 +2260,13 @@ Increment verbosity level, one level for each ``-v`` found on the command line. ---vc=<[-\|+]codec1,[-\|+]codec2,...[,]> - Specify a priority list of video codecs to be used, according to their - codec name in ``codecs.conf``. Use a '-' before the codec name to omit it. - Use a '+' before the codec name to force it, this will likely crash! If - the list has a trailing ',' mpv will fall back on codecs not contained - in the list. +--vd=<[+|-]family1:(*|decoder1),[+|-]family2:(*|decoder2),...[-]> + Specify a priority list of video decoders to be used, according to their + family and name. See ``--ad`` for further details. Both of these options + use the same syntax and semantics, the only difference is that they + operate on different codec lists. - *NOTE*: See ``--vc=help`` for a full list of available codecs. + *NOTE*: See ``--vd=help`` for a full list of available decoders. --vf=<filter1[=parameter1:parameter2:...],filter2,...> Specify a list of video filters to apply to the video stream. See @@ -2273,13 +2275,6 @@ ``--vf-clr`` exist to modify a previously specified list, but you shouldn't need these for typical use. ---vfm=<driver1,driver2,...> - Specify a priority list of video codec families to be used, according to - their names in codecs.conf. Falls back on the default codecs if none of - the given codec families work. - - *NOTE*: See ``--vfm=help`` for a full list of available codec families. - --vid=<ID|auto|no> Select video channel. ``auto`` selects the default, ``no`` disables video. diff --git a/DOCS/tech-overview.txt b/DOCS/tech-overview.txt index 0fb20e7e81..9582caaea4 100644 --- a/DOCS/tech-overview.txt +++ b/DOCS/tech-overview.txt @@ -203,7 +203,5 @@ core/timeline/: segments for playing an ordered chapters file is in tl_matroska.c. etc/: - The files codecs.conf and input.conf are actually integrated into the - mplayer binary by the build system. These files define the default settings. - codecs.conf maps video/audio formats to decoders. input.conf contains - the default keybindings. + The file input.conf is actually integrated into the mpv binary by the + build system. It contains the default keybindings. @@ -151,10 +151,11 @@ SOURCES = talloc.c \ audio/out/ao_null.c \ audio/out/ao_pcm.c \ core/asxparser.c \ + core/av_common.c \ core/av_log.c \ core/av_opts.c \ core/bstr.c \ - core/codec-cfg.c \ + core/codecs.c \ core/command.c \ core/cpudetect.c \ core/defaultopts.c \ @@ -181,6 +182,7 @@ SOURCES = talloc.c \ demux/asfheader.c \ demux/aviheader.c \ demux/aviprint.c \ + demux/codec_tags.c \ demux/demux.c \ demux/demux_asf.c \ demux/demux_avi.c \ @@ -343,10 +345,6 @@ mpv$(EXESUF): $(OBJECTS) mpv$(EXESUF): $(CC) -o $@ $^ $(EXTRALIBS) -core/codec-cfg.c: core/codecs.conf.h -core/codecs.conf.h: TOOLS/file2string.pl etc/codecs.conf - ./$^ >$@ - core/input/input.c: core/input/input_conf.h core/input/input_conf.h: TOOLS/file2string.pl etc/input.conf ./$^ >$@ @@ -442,7 +440,6 @@ clean: -$(RM) $(call ADD_ALL_EXESUFS,mpv) -$(RM) DOCS/man/en/mpv.1 -$(RM) version.h - -$(RM) core/codecs.conf.h -$(RM) core/input/input_conf.h -$(RM) video/out/vdpau_template.c -$(RM) demux/ebml_types.h demux/ebml_defs.c diff --git a/audio/decode/ad.c b/audio/decode/ad.c index 9af7112bf0..846cd146d1 100644 --- a/audio/decode/ad.c +++ b/audio/decode/ad.c @@ -32,7 +32,7 @@ /* Missed vorbis, mad, dshow */ extern const ad_functions_t mpcodecs_ad_mpg123; -extern const ad_functions_t mpcodecs_ad_ffmpeg; +extern const ad_functions_t mpcodecs_ad_lavc; extern const ad_functions_t mpcodecs_ad_spdif; const ad_functions_t * const mpcodecs_ad_drivers[] = @@ -40,7 +40,7 @@ const ad_functions_t * const mpcodecs_ad_drivers[] = #ifdef CONFIG_MPG123 &mpcodecs_ad_mpg123, #endif - &mpcodecs_ad_ffmpeg, + &mpcodecs_ad_lavc, &mpcodecs_ad_spdif, NULL }; diff --git a/audio/decode/ad.h b/audio/decode/ad.h index 2de0e0641a..3bc3e39267 100644 --- a/audio/decode/ad.h +++ b/audio/decode/ad.h @@ -19,17 +19,20 @@ #ifndef MPLAYER_AD_H #define MPLAYER_AD_H -#include "core/mpc_info.h" +#include "core/codecs.h" #include "demux/stheader.h" typedef struct mp_codec_info ad_info_t; +struct mp_decoder_list; + /* interface of video decoder drivers */ typedef struct ad_functions { - const ad_info_t *info; + const char *name; + void (*add_decoders)(struct mp_decoder_list *list); int (*preinit)(sh_audio_t *sh); - int (*init)(sh_audio_t *sh); + int (*init)(sh_audio_t *sh, const char *decoder); void (*uninit)(sh_audio_t *sh); int (*control)(sh_audio_t *sh,int cmd,void* arg, ...); int (*decode_audio)(sh_audio_t *sh, unsigned char *buffer, int minlen, diff --git a/audio/decode/ad_internal.h b/audio/decode/ad_internal.h index 1fed350b98..7eca629fca 100644 --- a/audio/decode/ad_internal.h +++ b/audio/decode/ad_internal.h @@ -19,7 +19,7 @@ #ifndef MPLAYER_AD_INTERNAL_H #define MPLAYER_AD_INTERNAL_H -#include "core/codec-cfg.h" +#include "core/codecs.h" #include "audio/format.h" #include "stream/stream.h" @@ -28,14 +28,16 @@ #include "ad.h" -static int init(sh_audio_t *sh); +static void add_decoders(struct mp_decoder_list *list); +static int init(sh_audio_t *sh, const char *decoder); static int preinit(sh_audio_t *sh); static void uninit(sh_audio_t *sh); static int control(sh_audio_t *sh,int cmd,void* arg, ...); static int decode_audio(sh_audio_t *sh,unsigned char *buffer,int minlen,int maxlen); #define LIBAD_EXTERN(x) const ad_functions_t mpcodecs_ad_##x = {\ - &info,\ + #x, \ + add_decoders, \ preinit,\ init,\ uninit,\ diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 9bcbde33cf..26c02b3240 100644 --- a/audio/decode/ad_lavc.c +++ b/ |