aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--Copyright3
-rw-r--r--DOCS/encoding.rst36
-rw-r--r--DOCS/man/en/af.rst42
-rw-r--r--DOCS/man/en/ao.rst4
-rw-r--r--DOCS/man/en/changes.rst72
-rw-r--r--DOCS/man/en/encode.rst46
-rw-r--r--DOCS/man/en/input.rst310
-rw-r--r--DOCS/man/en/mplayer-old.18099
-rw-r--r--DOCS/man/en/mpv.rst (renamed from DOCS/man/en/mplayer.rst)132
-rw-r--r--DOCS/man/en/options.rst241
-rw-r--r--DOCS/man/en/vf.rst652
-rw-r--r--DOCS/man/en/vo.rst474
-rw-r--r--DOCS/tech-overview.txt10
-rw-r--r--Makefile117
-rwxr-xr-xTOOLS/binary_codecs.sh219
-rwxr-xr-xTOOLS/file2string.py8
-rwxr-xr-xTOOLS/matroska.py10
-rwxr-xr-xTOOLS/mpv_identify.sh (renamed from TOOLS/mplayer2_identify.sh)37
-rwxr-xr-xTOOLS/vdpau_functions.py2
-rw-r--r--TOOLS/vf_dlopen/telecine.c19
-rw-r--r--bstr.h12
-rw-r--r--cfg-mplayer.h28
-rw-r--r--command.c1768
-rw-r--r--command.h5
-rwxr-xr-xconfigure82
-rw-r--r--debian/README.debian16
-rw-r--r--debian/TODO.Debian1
-rw-r--r--debian/changelog209
-rw-r--r--debian/compat1
-rw-r--r--debian/control31
-rw-r--r--debian/copyright7
-rw-r--r--debian/dirs5
-rw-r--r--debian/mime20
-rwxr-xr-xdebian/rules108
-rw-r--r--defaultopts.c3
-rw-r--r--encode_lavc.c470
-rw-r--r--encode_lavc.h3
-rw-r--r--etc/encoding-example-profiles.conf24
-rw-r--r--etc/example.conf6
-rw-r--r--etc/input.conf175
-rw-r--r--etc/mplayer.desktop27
-rw-r--r--fmt-conversion.h3
-rw-r--r--input/input.c754
-rw-r--r--input/input.h96
-rw-r--r--input/lirc.c2
-rw-r--r--libaf/af_export.c4
-rw-r--r--libao2/ao_alsa.c2
-rw-r--r--libao2/ao_coreaudio.c2
-rw-r--r--libao2/ao_dsound.c2
-rw-r--r--libao2/ao_jack.c6
-rw-r--r--libao2/ao_lavc.c68
-rw-r--r--libao2/ao_openal.c2
-rw-r--r--libao2/ao_oss.c2
-rw-r--r--libao2/ao_portaudio.c2
-rw-r--r--libao2/ao_pulse.c2
-rw-r--r--libao2/audio_out.c12
-rw-r--r--libmpcodecs/ad_ffmpeg.c43
-rw-r--r--libmpcodecs/cmmx.h202
-rw-r--r--libmpcodecs/vd_null.c56
-rw-r--r--libmpcodecs/vf.c99
-rw-r--r--libmpcodecs/vf_1bpp.c207
-rw-r--r--libmpcodecs/vf_2xsai.c336
-rw-r--r--libmpcodecs/vf_blackframe.c148
-rw-r--r--libmpcodecs/vf_bmovl.c496
-rw-r--r--libmpcodecs/vf_boxblur.c214
-rw-r--r--libmpcodecs/vf_cropdetect.c200
-rw-r--r--libmpcodecs/vf_decimate.c198
-rw-r--r--libmpcodecs/vf_denoise3d.c268
-rw-r--r--libmpcodecs/vf_detc.c458
-rw-r--r--libmpcodecs/vf_dint.c214
-rw-r--r--libmpcodecs/vf_dvbscale.c67
-rw-r--r--libmpcodecs/vf_eq.c258
-rw-r--r--libmpcodecs/vf_field.c89
-rw-r--r--libmpcodecs/vf_fil.c116
-rw-r--r--libmpcodecs/vf_filmdint.c1442
-rw-r--r--libmpcodecs/vf_fixpts.c136
-rw-r--r--libmpcodecs/vf_framestep.c203
-rw-r--r--libmpcodecs/vf_fspp.c2112
-rw-r--r--libmpcodecs/vf_geq.c197
-rw-r--r--libmpcodecs/vf_halfpack.c254
-rw-r--r--libmpcodecs/vf_harddup.c92
-rw-r--r--libmpcodecs/vf_hue.c200
-rw-r--r--libmpcodecs/vf_il.c148
-rw-r--r--libmpcodecs/vf_ivtc.c555
-rw-r--r--libmpcodecs/vf_kerndeint.c345
-rw-r--r--libmpcodecs/vf_lavc.c178
-rw-r--r--libmpcodecs/vf_lavcdeint.c188
-rw-r--r--libmpcodecs/vf_mcdeint.c330
-rw-r--r--libmpcodecs/vf_ow.c322
-rw-r--r--libmpcodecs/vf_palette.c234
-rw-r--r--libmpcodecs/vf_perspective.c341
-rw-r--r--libmpcodecs/vf_pp7.c489
-rw-r--r--libmpcodecs/vf_qp.c177
-rw-r--r--libmpcodecs/vf_remove_logo.c908
-rw-r--r--libmpcodecs/vf_rgbtest.c171
-rw-r--r--libmpcodecs/vf_sab.c292
-rw-r--r--libmpcodecs/vf_smartblur.c236
-rw-r--r--libmpcodecs/vf_softskip.c102
-rw-r--r--libmpcodecs/vf_spp.c612
-rw-r--r--libmpcodecs/vf_telecine.c190
-rw-r--r--libmpcodecs/vf_test.c332
-rw-r--r--libmpcodecs/vf_tfields.c476
-rw-r--r--libmpcodecs/vf_tile.c332
-rw-r--r--libmpcodecs/vf_tinterlace.c235
-rw-r--r--libmpcodecs/vf_uspp.c384
-rw-r--r--libmpcodecs/vf_yuvcsp.c120
-rw-r--r--libmpcodecs/vf_yvu9.c104
-rw-r--r--libmpcodecs/vqf.h228
-rw-r--r--libmpdemux/demux_mkv.c2
-rw-r--r--libvo/gl_common.c1204
-rw-r--r--libvo/gl_common.h95
-rw-r--r--libvo/gl_header_fixes.h14
-rw-r--r--libvo/video_out.c57
-rw-r--r--libvo/video_out.h1
-rw-r--r--libvo/vo_caca.c2
-rw-r--r--libvo/vo_corevideo.m9
-rw-r--r--libvo/vo_lavc.c106
-rw-r--r--libvo/vo_opengl.c (renamed from libvo/vo_gl3.c)307
-rw-r--r--libvo/vo_opengl_old.c (renamed from libvo/vo_gl.c)85
-rw-r--r--libvo/vo_opengl_shaders.glsl (renamed from libvo/vo_gl3_shaders.glsl)94
-rw-r--r--libvo/vo_xv.c4
-rw-r--r--libvo/w32_common.c2
-rw-r--r--libvo/x11_common.c10
-rw-r--r--m_config.c4
-rw-r--r--m_config.h3
-rw-r--r--m_option.c285
-rw-r--r--m_option.h39
-rw-r--r--m_property.c490
-rw-r--r--m_property.h301
-rw-r--r--metadata.h55
-rw-r--r--mixer.c3
-rw-r--r--mp_core.h10
-rw-r--r--mp_msg.c10
-rw-r--r--mp_osd.h4
-rw-r--r--mpcommon.h2
-rw-r--r--mplayer.c308
-rw-r--r--mplayer.h12
-rw-r--r--options.h7
-rw-r--r--osdep/cocoa_events.m2
-rw-r--r--osdep/io.h4
-rw-r--r--osdep/macosx_finder_args.m2
-rw-r--r--osdep/mplayer.exe.manifest4
-rw-r--r--osdep/mplayer.rc12
-rw-r--r--path.c6
-rw-r--r--quvi.c (renamed from stream/open.c)97
-rw-r--r--rpm/mplayer-codecs.spec318
-rw-r--r--rpm/mplayer.spec298
-rw-r--r--screenshot.c25
-rw-r--r--stream/stream.c28
-rw-r--r--stream/stream_dvd.c2
-rw-r--r--sub/ass_mp.c33
-rw-r--r--sub/osd_libass.c15
-rw-r--r--sub/sd_ass.c4
-rw-r--r--talloc.c4
-rw-r--r--version.c2
156 files changed, 4601 insertions, 30614 deletions
diff --git a/.gitignore b/.gitignore
index 1cb98731e4..45b6ab2b9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,13 @@
*.o
*.a
*.d
+*.exe
.depend
/config.h
/config.mak
/config.log
-/mplayer
+/mpv
/version.h
/codecs.conf.h
/input/input_conf.h
@@ -14,10 +15,10 @@
/TAGS
/locale
/po
-/libvo/vo_gl3_shaders.h
+/libvo/vo_opengl_shaders.h
/libmpdemux/ebml_defs.c
/libmpdemux/ebml_types.h
/libvo/vdpau_template.c
/sub/osd_font.h
-DOCS/man/*/mplayer.1
+DOCS/man/*/mpv.1
diff --git a/Copyright b/Copyright
index 491ddea6c2..c0f3970949 100644
--- a/Copyright
+++ b/Copyright
@@ -1,3 +1,6 @@
+mpv is a fork of mplayer2, which is a fork of MPlayer.
+Original MPlayer Copyright file follows below.
+
MPlayer was originally written by Árpád Gereöffy and has been extended and
worked on by many more since then, see the AUTHORS file for an (incomplete)
list. MPlayer as a whole is copyrighted by the MPlayer team. Individual
diff --git a/DOCS/encoding.rst b/DOCS/encoding.rst
index 67ad19bae6..84b1007afd 100644
--- a/DOCS/encoding.rst
+++ b/DOCS/encoding.rst
@@ -3,15 +3,15 @@ General usage
::
- mplayer infile -o outfile [-of outfileformat] [-ofopts formatoptions] \
+ mpv infile -o outfile [-of outfileformat] [-ofopts formatoptions] \
[-ofps outfps | -oautofps] [-oharddup] [-ocopyts | -orawts] [-oneverdrop] \
- [(any other mplayer options)] \
+ [(any other mpv options)] \
-ovc outvideocodec [-ovcopts outvideocodecoptions] \
-oac outaudiocodec [-oacopts outaudiocodecoptions]
Help for these options is provided if giving help as parameter, as in::
- mplayer -ovc help
+ mpv -ovc help
The suboptions of these generally are identical to ffmpeg's (as option parsing
is simply delegated to ffmpeg). The option -ocopyts enables copying timestamps
@@ -25,7 +25,7 @@ from the input video. Note that not all codecs and not all formats support VFR
encoding, and some which do have bugs when a target bitrate is specified - use
-ofps or -oautofps to force CFR encoding in these cases.
-Of course, the options can be stored in a profile, like this .mplayer/config
+Of course, the options can be stored in a profile, like this .mpv/config
section::
[myencprofile]
@@ -40,7 +40,7 @@ section::
One can then encode using this profile using the command::
- mplayer infile -o outfile.mp4 -profile myencprofile
+ mpv infile -o outfile.mp4 -profile myencprofile
Some example profiles are provided in a file
etc/encoding-example-profiles.conf; as for this, see below.
@@ -54,7 +54,7 @@ for.
Typical MPEG-4 Part 2 ("ASP", "DivX") encoding, AVI container::
- mplayer infile -o outfile.avi \
+ mpv infile -o outfile.avi \
-ofps 25 \
-ovc mpeg4 -ovcopts qscale=4 \
-oac libmp3lame -oacopts ab=128k
@@ -65,19 +65,19 @@ for NTSC)
Typical MPEG-4 Part 10 ("AVC", "H.264") encoding, Matroska (MKV) container::
- mplayer infile -o outfile.mkv \
+ mpv infile -o outfile.mkv \
-ovc libx264 -ovcopts preset=medium,crf=23,profile=baseline \
-oac vorbis -oacopts qscale=3
Typical MPEG-4 Part 10 ("AVC", "H.264") encoding, MPEG-4 (MP4) container::
- mplayer infile -o outfile.mp4 \
+ mpv infile -o outfile.mp4 \
-ovc libx264 -ovcopts preset=medium,crf=23,profile=baseline \
-oac aac -oacopts ab=128k
Typical VP8 encoding, WebM (restricted Matroska) container::
- mplayer infile -o outfile.mkv \
+ mpv infile -o outfile.mkv \
-of webm \
-ovc libvpx -ovcopts qmin=6,b=1000000k \
-oac libvorbis -oacopts qscale=3
@@ -90,10 +90,10 @@ As the options for various devices can get complex, profiles can be used.
An example profile file for encoding is provided in
etc/encoding-example-profiles.conf in the source tree. You can include it into
-your configuration by doing, from the mplayer2-build directory::
+your configuration by doing, from the mpv-build directory::
- mkdir -p ~/.mplayer
- echo "include = $PWD/mplayer/etc/encoding-example-profiles.conf" >> ~/.mplayer/config
+ mkdir -p ~/.mpv
+ echo "include = $PWD/mpv/etc/encoding-example-profiles.conf" >> ~/.mpv/config
Refer to the top of that file for more comments - in a nutshell, the following
options are added by it::
@@ -108,7 +108,7 @@ options are added by it::
You can encode using these with a command line like::
- mplayer infile -o outfile.mp4 -profile enc-to-bb-9000
+ mpv infile -o outfile.mp4 -profile enc-to-bb-9000
Of course, you are free to override options set by these profiles by specifying
them after the -profile option.
@@ -122,15 +122,15 @@ What works
* 2-pass encoding (specify flags=+pass1 in the first pass's -ovcopts, specify
flags=+pass2 in the second pass)
* Hardcoding subtitles using vobsub, ass or srt subtitle rendering (just
- configure mplayer for the subtitles as usual)
-* Hardcoding any other mplayer OSD (e.g. time codes, using -osdlevel 3 and -vf
+ configure mpv for the subtitles as usual)
+* Hardcoding any other mpv OSD (e.g. time codes, using -osdlevel 3 and -vf
expand=::::1)
* Encoding directly from a DVD, network stream, webcam, or any other source
- mplayer supports
+ mpv supports
* Using x264 presets/tunings/profiles (by using profile=, tune=, preset= in the
-ovcopts)
-* Deinterlacing/Inverse Telecine with any of mplayer's filters for that
-* Audio file converting: mplayer -o outfile.mp3 infile.flac -novideo -oac
+* Deinterlacing/Inverse Telecine with any of mpv's filters for that
+* Audio file converting: mpv -o outfile.mp3 infile.flac -novideo -oac
libmp3lame -oacopts ab=320k
* inverse telecine filters (confirmed working: detc, pullup, filmdint)
diff --git a/DOCS/man/en/af.rst b/DOCS/man/en/af.rst
index dc0450241f..1fe480dcdc 100644
--- a/DOCS/man/en/af.rst
+++ b/DOCS/man/en/af.rst
@@ -57,7 +57,7 @@ resample[=srate[:sloppy[:type]]]
*EXAMPLE*:
- ``mplayer --af=resample=44100:0:0``
+ ``mpv --af=resample=44100:0:0``
would set the output frequency of the resample filter to 44100Hz using
exact output frequency scaling and linear interpolation.
@@ -200,7 +200,7 @@ equalizer=[g1:g2:g3:...:g10]
*EXAMPLE*:
- ``mplayer --af=equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi``
+ ``mpv --af=equalizer=11:11:10:5:0:-12:0:5:12:12 media.avi``
Would amplify the sound in the upper and lower frequency region while
canceling it almost completely around 1kHz.
@@ -223,13 +223,13 @@ channels=nch[:nr:from1:to1:from2:to2:from3:to3:...]
*EXAMPLE*:
- ``mplayer --af=channels=4:4:0:1:1:0:2:2:3:3 media.avi``
+ ``mpv --af=channels=4:4:0:1:1:0:2:2:3:3 media.avi``
Would change the number of channels to 4 and set up 4 routes that swap
channel 0 and channel 1 and leave channel 2 and 3 intact. Observe that
if media containing two channels was played back, channels 2 and 3
would contain silence but 0 and 1 would still be swapped.
- ``mplayer --af=channels=6:4:0:0:0:1:0:2:0:3 media.avi``
+ ``mpv --af=channels=6:4:0:0:0:1:0:2:0:3 media.avi``
Would change the number of channels to 6 and set up 4 routes that copy
channel 0 to channels 0 to 3. Channel 4 and 5 will contain silence.
@@ -242,7 +242,7 @@ format[=format]
the sign (either 's' for signed or 'u' for unsigned), 'b' denotes the
number of bits per sample (16, 24 or 32) and 'e' denotes the
endianness ('le' means little-endian, 'be' big-endian and 'ne' the
- endianness of the computer MPlayer is running on). Valid values
+ endianness of the computer mpv is running on). Valid values
(amongst others) are: 's16le', 'u32be' and 'u24ne'. Exceptions to this
rule that are also valid format specifiers: u8, s8, floatle, floatbe,
floatne, mulaw, alaw, mpeg2, ac3 and imaadpcm.
@@ -260,7 +260,7 @@ volume[=v[:sc]]
background is gone.
This filter has a second feature: It measures the overall maximum sound
- level and prints out that level when MPlayer exits. This feature currently
+ level and prints out that level when mpv exits. This feature currently
only works with floating-point data, use e.g. ``--af-adv=force=5``, or use
``--af=stats``.
@@ -281,7 +281,7 @@ volume[=v[:sc]]
*EXAMPLE*:
- ``mplayer --af=volume=10.1:0 media.avi``
+ ``mpv --af=volume=10.1:0 media.avi``
Would amplify the sound by 10.1dB and hard-clip if the sound level is
too high.
@@ -306,10 +306,10 @@ pan=n[:L00:L01:L02:...L10:L11:L12:...Ln0:Ln1:Ln2:...]
*EXAMPLE*:
- ``mplayer --af=pan=1:0.5:0.5 media.avi``
+ ``mpv --af=pan=1:0.5:0.5 media.avi``
Would down-mix from stereo to mono.
- ``mplayer --af=pan=3:1:0:0.5:0:1:0.5 media.avi``
+ ``mpv --af=pan=3:1:0:0.5:0:1:0.5 media.avi``
Would give 3 channel output leaving channels 0 and 1 intact, and mix
channels 0 and 1 into output channel 2 (which could be sent to a
subwoofer for example).
@@ -338,7 +338,7 @@ sub[=fc:ch]
*EXAMPLE*:
- ``mplayer --af=sub=100:4 --channels=5 media.avi``
+ ``mpv --af=sub=100:4 --channels=5 media.avi``
Would add a sub-woofer channel with a cutoff frequency of 100Hz to
output channel 4.
@@ -367,7 +367,7 @@ surround[=delay]
*EXAMPLE*:
- ``mplayer --af=surround=15 --channels=4 media.avi``
+ ``mpv --af=surround=15 --channels=4 media.avi``
Would add surround sound decoding with 15ms delay for the sound to the
rear speakers.
@@ -395,7 +395,7 @@ delay[=ch1:ch2:...]
*EXAMPLE*:
- ``mplayer --af=delay=10.5:10.5:0:0:7:0 media.avi``
+ ``mpv --af=delay=10.5:10.5:0:0:7:0 media.avi``
Would delay front left and right by 10.5ms, the two rear channels and
the sub by 0ms and the center channel by 7ms.
@@ -410,14 +410,14 @@ export[=mmapped_file[:nsamples]]
The rest is payload (non-interleaved) 16 bit data.
<mmapped_file>
- file to map data to (default: ``~/.mplayer/mplayer-af_export``)
+ file to map data to (default: ``~/.mpv/mpv-af_export``)
<nsamples>
number of samples per channel (default: 512)
*EXAMPLE*:
- ``mplayer --af=export=/tmp/mplayer-af_export:1024 media.avi``
- Would export 1024 samples per channel to ``/tmp/mplayer-af_export``.
+ ``mpv --af=export=/tmp/mpv-af_export:1024 media.avi``
+ Would export 1024 samples per channel to ``/tmp/mpv-af_export``.
extrastereo[=mul]
(Linearly) increases the difference between left and right channels which
@@ -461,7 +461,7 @@ ladspa=file:label[:controls...]
<controls>
Controls are zero or more floating point values that determine the
behavior of the loaded plugin (for example delay, threshold or gain).
- In verbose mode (add ``-v`` to the MPlayer command line), all
+ In verbose mode (add ``-v`` to the mpv command line), all
available controls and their valid ranges are printed. This eliminates
the use of 'analyseplugin' from the LADSPA SDK.
@@ -516,21 +516,21 @@ scaletempo[=option1:option2:...]
*EXAMPLE*:
- ``mplayer --af=scaletempo --speed=1.2 media.ogg``
+ ``mpv --af=scaletempo --speed=1.2 media.ogg``
Would playback media at 1.2x normal speed, with audio at normal pitch.
Changing playback speed, would change audio tempo to match.
- ``mplayer --af=scaletempo=scale=1.2:speed=none --speed=1.2 media.ogg``
+ ``mpv --af=scaletempo=scale=1.2:speed=none --speed=1.2 media.ogg``
Would playback media at 1.2x normal speed, with audio at normal pitch,
but changing playback speed has no effect on audio tempo.
- ``mplayer --af=scaletempo=stride=30:overlap=.50:search=10 media.ogg``
+ ``mpv --af=scaletempo=stride=30:overlap=.50:search=10 media.ogg``
Would tweak the quality and performace parameters.
- ``mplayer --af=format=floatne,scaletempo media.ogg``
+ ``mpv --af=format=floatne,scaletempo media.ogg``
Would make scaletempo use float code. Maybe faster on some platforms.
- ``mplayer --af=scaletempo=scale=1.2:speed=pitch audio.ogg``
+ ``mpv --af=scaletempo=scale=1.2:speed=pitch audio.ogg``
Would playback audio file at 1.2x normal speed, with audio at normal
pitch. Changing playback speed, would change pitch, leaving audio
tempo at 1.2x.
diff --git a/DOCS/man/en/ao.rst b/DOCS/man/en/ao.rst
index 00dd1e9e6d..412d9ac939 100644
--- a/DOCS/man/en/ao.rst
+++ b/DOCS/man/en/ao.rst
@@ -9,7 +9,7 @@ syntax is:
--ao=<driver1[:suboption1[=value]:...],driver2,...[,]>
Specify a priority list of audio output drivers to be used.
-If the list has a trailing ',' MPlayer will fall back on drivers not contained
+If the list has a trailing ',' mpv will fall back on drivers not contained
in the list. Suboptions are optional and can mostly be omitted.
*NOTE*: See ``--ao=help`` for a list of compiled-in audio output drivers.
@@ -48,7 +48,7 @@ jack
port=<name>
Connects to the ports with the given name (default: physical ports).
name=<client>
- Client name that is passed to JACK (default: MPlayer [<PID>]). Useful
+ Client name that is passed to JACK (default: mpv [<PID>]). Useful
if you want to have certain connections established automatically.
(no-)estimate
Estimate the audio delay, supposed to make the video playback smoother
diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst
index c4fc3a0812..402bdbd336 100644
--- a/DOCS/man/en/changes.rst
+++ b/DOCS/man/en/changes.rst
@@ -3,10 +3,7 @@
CHANGES FROM OTHER VERSIONS OF MPLAYER
======================================
-xxx: since I don't have a new name yet, I'm referring to this version of mplayer
-as **mplayer3**, I don't intend to use that name.
-
-**mplayer3** is based on mplayer2, which in turn is based on the original
+**mpv** is based on mplayer2, which in turn is based on the original
MPlayer (also called mplayer, mplayer-svn, mplayer1). Many changes
have been made. Some changes are incompatible, or completely change how the
player behaves.
@@ -37,7 +34,7 @@ General changes for mplayer-svn to mplayer2
* General code cleanups
* Many more changes
-General changes for mplayer2 to mplayer3
+General changes for mplayer2 to mpv
----------------------------------------
* Removal of lots of unneeded code to encourage developer activity (less
@@ -51,9 +48,9 @@ General changes for mplayer2 to mplayer3
languages like Arabic should be better supported.
* Cleaned up terminal output (nicer status line, less useless noise)
* Support for playing URLs of popular streaming sites directly
- (e.g. ``mplayer3 https://www.youtube.com/watch?v=...``)
-* Improved OpenGL output (``vo_gl3``)
-* Make ``--softvol`` default (**mplayer3** is not a mixer control panel)
+ (e.g. ``mpv https://www.youtube.com/watch?v=...``)
+* Improved OpenGL output (``vo_opengl``)
+* Make ``--softvol`` default (**mpv** is not a mixer control panel)
* Improved support for .cue files
* Screenshot improvements (can save screenshots as JPG, configurable filenames)
* Removal of teletext support
@@ -87,7 +84,7 @@ Command line switches
``-no-opt``, or better ``--no-opt``.
* Per-file options are not the default anymore. You can explicitly specify
file local options. See ``Usage`` section.
-* Table of renamed switches:
+* Table of renamed/replaced switches:
=================================== ===================================
Old New
@@ -95,25 +92,58 @@ Command line switches
-nosound --no-audio
-use-filename-title --title="${filename}"
-loop 0 --loop=inf
+ -hardframedrop --framedrop=hard
+ -osdlevel --osd-level
+ -delay --audio-delay
+ -subdelay --sub-delay
+ -subpos --sub-pos
+ -forcedsubsonly --sub-forced-only
=================================== ===================================
input.conf and slave commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* Table of renamed slave commands:
-
- =================================== ===================================
- Old New
- =================================== ===================================
- pt_step 1 b playlist_next b
- pt_step -1 b playlist_prev b
- pt_clear playlist_clear
- =================================== ===================================
+* Table of renamed input commands:
+
+ This lists only commands that are not always gracefully handled by the
+ internal legacy translation layer. If an input.conf contains any legacy
+ commands, they will be displayed with ``-v`` when it is loaded, and show
+ and the replacement commands.
+
+ Properties containing ``_`` to separate words use ``-`` instead.
+
+ +--------------------------------+----------------------------------------+
+ | Old | New |
+ +================================+========================================+
+ | pt_step 1 [0|1] | playlist_next [weak|force] |
+ | | (translation layer can't deal with |
+ | | whitespace) |
+ +--------------------------------+----------------------------------------+
+ | pt_step -1 [0|1] | playlist_prev [weak|force] (same) |
+ +--------------------------------+----------------------------------------+
+ | switch_ratio [<ratio>] | set aspect <ratio> |
+ | | set aspect 0 (to reset aspect) |
+ +--------------------------------+----------------------------------------+
+ | step_property_osd <prop> <step>| cycle <prop> <step> (wraps), |
+ | <dir> | add <prop> <step> (clamps). |
+ | | <dir> parameter unsupported. Use |
+ | | a negative step instead. |
+ +--------------------------------+----------------------------------------+
+ | step_property <prop> <step> | Prefix cycle or add with no-osd: |
+ | <dur> | no-osd cycle <prop> <step> |
+ +--------------------------------+----------------------------------------+
+ | osd_show_property_text <text> | show_text <text> |
+ | | The property expansion format string |
+ | | syntax slightly changed. |
+ +--------------------------------+----------------------------------------+
+ | osd_show_text | Now does the same as |
+ | | osd_show_property_text. |
+ +--------------------------------+----------------------------------------+
Other
~~~~~
-* The playtree has been removed. **mplayer3**'s internal playlist is a simple and
+* The playtree has been removed. **mpv**'s internal playlist is a simple and
flat list now. This makes the code easier, and makes using it less confusing.
* Slave mode is broken. This mode is entirely insane in the ``old`` versions of
mplayer. A proper slave mode application needed tons of code and hacks to get
@@ -123,7 +153,7 @@ Other
slave mode application, and as such it's virtually impossible to improve
terminal output intended for users without possibly breaking something.
- This is absolutely insane, and **mplayer3** will not try to keep slave mode
+ This is absolutely insane, and **mpv** will not try to keep slave mode
compatible. If you're a developer of a slave mode application, contact us,
and a new and better protocol can be developed.
@@ -152,6 +182,6 @@ Why this fork?
withheld as to not turn this into a rant.
* mplayer-svn rarely merged from mplayer2, and mplayer2 practically stopped
merging from mplayer-svn (not even code cleanups or new features are merged)
-* **mplayer3** intents to continuously merge from mplayer-svn and mplayer2, while
+* **mpv** intents to continuously merge from mplayer-svn and mplayer2, while
speeding up development. There is willingness for significant changes, even
if this means breaking compatibility.
diff --git a/DOCS/man/en/encode.rst b/DOCS/man/en/encode.rst
index 7ebd8e6c01..93b1b84f28 100644
--- a/DOCS/man/en/encode.rst
+++ b/DOCS/man/en/encode.rst
@@ -10,8 +10,8 @@ You can encode files from one format/codec to another using this facility.
--of=<format>
Specifies the output format (overrides autodetection by the extension of
- the file specified by -o).
- See --of=help for a full list of supported formats.
+ the file specified by -o). This can be a comma separated list of possible
+ formats to try. See --of=help for a full list of supported formats.
--ofopts=<options>
Specifies the output format options for libavformat.
@@ -56,8 +56,8 @@ You can encode files from one format/codec to another using this facility.
avoid --oautofps.
--oac=<codec>
- Specifies the output audio codec.
- See --oac=help for a full list of supported codecs.
+ Specifies the output audio codec. This can be a comma separated list of
+ possible codecs to try. See --oac=help for a full list of supported codecs.
--oaoffset=<value>
Shifts audio data by the given time (in seconds) by adding/removing
@@ -86,27 +86,18 @@ You can encode files from one format/codec to another using this facility.
--oacopts-clr
Completely empties the options list.
+--oafirst
+ Force the audio stream to become the first stream in the output. By default
+ the order is unspecified.
+
--ovc=<codec>
- Specifies the output video codec.
- See --ovc=help for a full list of supported codecs.
+ Specifies the output video codec. This can be a comma separated list of
+ possible codecs to try. See --ovc=help for a full list of supported codecs.
--ovoffset=<value>
Shifts video data by the given time (in seconds) by shifting the pts
values.
---ocopyts
- Copies input pts to the output video (not supported by some output
- container formats, e.g. avi). Discontinuities are still fixed.
- By default, audio pts are set to playback time and video pts are
- synchronized to match audio pts, as some output formats do not support
- anything else.
-
---orawts
- Copies input pts to the output video (not supported by some output
- container formats, e.g. avi). In this modem discontinuities are not fixed
- and all pts are passed through as-is. Never seek backwards or use multiple
- input files in this mode!
-
--ovcopts <options>
Specifies the output video codec options for libavcodec.
See --ovcopts=help for a full list of supported options.
@@ -132,3 +123,20 @@ You can encode files from one format/codec to another using this facility.
--ovcopts-clr
Completely empties the options list.
+
+--ovfirst
+ Force the video stream to become the first stream in the output. By default
+ the order is unspecified.
+
+--ocopyts
+ Copies input pts to the output video (not supported by some output
+ container formats, e.g. avi). Discontinuities are still fixed.
+ By default, audio pts are set to playback time and video pts are
+ synchronized to match audio pts, as some output formats do not support
+ anything else.
+
+--orawts
+ Copies input pts to the output video (not supported by some output
+ container formats, e.g. avi). In this modem discontinuities are not fixed
+ and all pts are passed through as-is. Never seek backwards or use multiple
+ input files in this mode!
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst
new file mode 100644
index 0000000000..74c4929684
--- /dev/null
+++ b/DOCS/man/en/input.rst
@@ -0,0 +1,310 @@
+.. _input:
+
+INPUT.CONF
+==========
+
+The input.conf file consists of a list of key bindings, for example:
+
+| s screenshot # take a screenshot with the s key
+
+Each line maps a key to an input command. Keys are specified with their literal
+value (upper case if combined with ``Shift``), or a name for special keys. For
+example, ``a`` maps to the ``a`` key without shift, and ``A`` maps to ``a``
+with shift.
+
+A list of special keys can be obtained with
+
+| **mplayer** --input=keylist
+
+In general, keys can be combined with ``Shift``, ``Ctrl`` and ``Alt``:
+
+| ctrl+q quit
+
+General input command syntax
+----------------------------
+
+`[Shift+][Ctrl+][Alt+][Meta+]<key> [<prefix>] <command> (<argument>)*`
+
+Newlines always start a new binding. ``#`` starts a comment (outside of quoted
+string arguments). To bind commands to the ``#`` key, ``SHARP`` can be used.
+
+<key> is either the literal character the key produces (ASCII or unicode
+character), or a symbol name.
+
+Arguments are separated by whitespace. This applies even to string arguments.
+For this reason, string arguments should be quoted with ``"``. Inside quotes,
+C style escaping can be used.
+
+Optional arguments can be skipped with ``-``.
+
+List of input commands
+----------------------
+
+ignore
+ Use this to "block" keys that should be unbound, and do nothing. Useful for
+ disabling default bindings, without disabling all bindings with
+ ``--input=default-bindings=no``.
+
+seek <seconds> [relative|absolute|absolute-percent] [default-precise|exact|keyframes]
+ Change the playback position. By default, seeks by a relative amount of
+ seconds.
+
+ The second argument sets the seek mode:
+
+ relative (default)
+ Seek relative to current position (a negative value seeks backwards).
+ absolute
+ Seek to a given time.
+ absolute-percent
+ Seek to agiven percent position.
+
+ The third argument defines how exact the seek is:
+
+ default-precise (default)
+ Follow the default behavior as set by ``--hr-seek``, which by default
+ does imprecise seeks (like ``keyframes``).
+ exact
+ Always do exact/hr/precise seeks (slow).
+ keyframes
+ Always restart playback at keyframe boundaries (fast).
+
+frame_step
+ Basically seek forward by one frame. Actually this plays one frame, then
+ pauses again.
+
+set <property> "<value>"
+ Set the given property to the given value.
+
+add <property> [<value>]
+ Add the given value to the property. On overflow or underflow, clamp the
+ property to the maximum. If <value> is omitted, assume ``1``.
+
+cycle <property> [up|down]
+ Cycle the given property. ``up`` and ``down`` set the cycle direction. On
+ overflow, set the property back to the minimum, on underflow set it to the
+ maximum. If ``up`` or ``down`` is omitted, assume ``up``.
+
+speed_mult <value>
+ Multiply the ``speed`` property by the given value.
+
+screenshot [single|each-frame] [video|window]
+ Take a screenshot.
+
+ First argument:
+
+ <single> (default)
+ Take a single screenshot.
+ <each-frame>
+ Take a screenshot each frame. Issue this command again to stop taking
+ screenshots.
+
+ Second argument:
+
+ <video> (default)
+ Save the video image, in its original resolution. Typically without
+ OSD or subtitles, but the exact behavior depends on the selected video
+ output.
+ <window>
+ Save the contents of the mplayer window. Typically scaled, with OSD and
+ subtitles. The exact behavior depends on the selected video output, and
+ if not support is available, this will act like ``video``.
+
+playlist_next [weak|force]
+ Go to the next entry on the playlist.
+
+ weak (default)
+ If the last file on the playlist is currently played, do nothing.
+ force
+ Terminate playback if there are no more files on the playlist.
+
+playlist_prev [weak|force]
+ Go to the previous entry on the playlist.
+
+ weak (default)
+ If the first file on the playlist is currently played, do nothing.
+ force
+ Terminate playback if the first file is being played.
+
+loadfile "<file>" [replace|append]
+ Load the given file and play it.
+
+ Second argument:
+
+ <replace> (default)
+ Stop playback of the current file, and play the new file immediately.
+ <append>
+ Append the file to the playlist.
+
+loadlist "<playlist>" [replace|append]
+ Load the given playlist file (like ``--playlist``).
+
+playlist_clear
+ Clear the playlist, except the currently played file.
+
+run "<command>"
+ Run the given command with ``/bin/sh -c``. The string is expanded like in
+ ``--playing-msg`` before
+
+quit [<code>]
+ Exit the player using the given exit code.
+
+sub_load "<file>"
+ Load the given subtitle file. It's not selected as current subtitle after
+ loading.
+
+sub_step <skip>
+ Change subtitle timing such, that the subtitle event after the next <skip>
+ subtitle events is displayed. <skip> can be negative to step back.
+
+osd [<level>]
+ Toggle OSD level. If <level> is specified, set the OSD mode
+ (see ``--osd-level`` for valid values).
+
+print_text "<string>"
+ Print text to stdout. The string can contain properties, which are expanded
+ like in ``--playing-msg``.
+
+show_text "<string>" [<duration>] [<level>]
+ Show text on the OSD. The string can contain properties, which are expanded
+ like in ``--playing-msg``. This can be used to show playback time, filename,
+ and so on.
+
+ <duration> is the time in ms to show the message. By default, it uses the
+ same value as ``--osd-duration``.
+
+ <level> is the minimum OSD level to show the text (see ``--osd-level``).
+
+show_progress
+ Show the progress bar, the elapsed time and the total duration of the file
+ on the OSD.
+
+show_chapters
+ Show a list of chapters on the OSD.
+
+show_tracks
+ Show a list of video/audio/subtitle tracks on the OSD.
+
+
+
+Undocumented properties: tv_start_scan, tv_step_channel, tv_step_norm,
+tv_step_chanlist, tv_set_channel, tv_last_channel, tv_set_freq, tv_step_freq,
+tv_set_norm, dvb_set_channel, radio_step_channel, radio_set_channel,
+radio_set_freq, radio_step_freq (all of these should be replaced by properties),
+edl_mark, stop (questionable use), get_property (?), af_switch, af_add, af_del,
+af_clr, af_cmdline, vo_cmdline (experimental).
+
+Input command prefixes
+----------------------
+
+osd-auto (default)
+ Use the default behavior for this command.
+no-osd
+ Do not use any OSD for this command.
+osd-bar
+ If possible, show a bar with this command. Seek commands will show the
+ progress bar, property changing commands may show the newly set value.
+osd-msg
+ If possible, show an OSD message with this command. The seek command shows
+ the current playback time (like ``show_progress``), property changing
+ commands show the newly set value as text.
+osd-msg-bar
+ Combine osd-bar and osd-msg.
+
+
+
+All of these are still overridden by the global ``--osd-level`` settings.
+
+Undocumented prefixes: pausing, pausing_keep, pausing_toggle,
+pausing_keep_force. (Should these be made official?)
+
+Properties
+----------
+
+Properties are used to set mplayer options during runtime, or to query arbitrary
+information. They can be manipulated with the ``set``/``add``/``cycle``
+commands, and retrieved with ``show_text``, or anything else that uses property
+expansion. (See ``--playing-msg`` how properties are expanded.)
+
+``W`` indicates whether the property is generally writeable. If an option
+is referenced, the property should take/return exactly the same values as the
+option.
+
+=========================== = ==================================================
+Name W Comment
+=========================== = ==================================================
+osd-level x see ``--osd-level``
+loop x see ``--loop``
+speed x see ``--speed``
+filename currently played file (path stripped)
+path currently played file (full path)
+media-title filename or libquvi QUVIPROP_PAGETITLE
+demuxer
+stream-path filename (full path) of stream layer filename
+stream-pos x byte position in source stream
+stream-start start byte offset in source stream
+stream-end end position in bytes in source stream
+stream-length length in bytes (${stream-end} - ${stream-start})
+stream-time-pos x time position in source stream (also see time-pos)
+length length of the current file in seconds
+percent-pos x position in current file (0-100)
+time-pos x position in current file in seconds
+chapter x current chapter number
+edition x current MKV edition number
+titles number of DVD titles
+chapters number of chapters
+editions number of MKV editions
+angle current DVD angle
+metadata metadata key/value pairs
+metadata/<key> value of metedata entry <key>
+pause x pause status (bool)
+pts-association-mode x see ``--pts-association-mode``
+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-codec audio codec selected for decoding
+audio-bitrate audio bitrate
+samplerate audio samplerate
+channels number of audio channels
+audio x current audio track (similar to ``--aid``)
+balance x audio channel balance
+fullscreen x see ``--fullscreen``
+deinterlace x deinterlacing, if available (bool)
+colormatrix x see ``--colormatrix``
+colormatrix-input-range x see ``--colormatrix-input-range``
+colormatrix-output-range x see ``--colormatrix-output-range``
+ontop x see ``--ontop``
+rootwin x see ``--rootwin``
+border x see ``--border``
+framedrop x see ``--framedrop``
+gamma x see ``--gamma``
+brightness x see ``--brightness``
+contrast x see ``--contrast``
+saturation x see ``--saturation``
+hue x see ``--hue``
+panscan x see ``--panscan``
+vsync x see ``--vsync``
+video-format video format (integer FourCC)
+video-codec video codec selected for decoding
+video-bitrate video bitrate
+width video width
+height video height
+fps FPS (may contain bogus values)
+aspect x video aspect
+video x current video track (similar to ``--vid``)
+program x switch TS program (write-only)
+sub x current subttitle track (similar to ``--sid``)
+sub-delay x see ``--sub-delay``
+sub-pos x see ``--sub-pos``
+sub-visibility x whether current subtitle is rendered
+sub-forced-only x see ``--sub-forced-only``
+sub-scale x subtitle font size multiplicator
+ass-use-margins x see ``--ass-use-margins``
+ass-vsfilter-aspect-compat x see ``--ass-vsfilter-aspect-compat``
+ass-style-override x see ``--ass-style-override``
+tv-brightness
+tv-contrast
+tv-saturation
+tv-hue
+=========================== = ==================================================
diff --git a/DOCS/man/en/mplayer-old.1 b/DOCS/man/en/mplayer-old.1
deleted file mode 100644
index 92592c7f27..0000000000
--- a/DOCS/man/en/mplayer-old.1
+++ /dev/null
@@ -1,8099 +0,0 @@
-.\" $Revision$
-.\" MPlayer (C) 2000-2010 MPlayer Team
-.\" This man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann
-.
-.\" --------------------------------------------------------------------------
-.\" Macro definitions
-.\" --------------------------------------------------------------------------
-.
-.\" define indentation for suboptions
-.nr SS 5
-.\" add new suboption
-.de IPs
-.IP "\\$1" \n(SS
-..
-.\" begin of first level suboptions, end with .RE
-.de RSs
-.RS 10
-..
-.\" begin of 2nd level suboptions
-.de RSss
-.PD 0
-.RS \n(SS+3
-..
-.\" end of 2nd level suboptions
-.de REss
-.RE
-.PD 1
-..
-.
-.\" --------------------------------------------------------------------------
-.\" Title
-.\" --------------------------------------------------------------------------
-.
-.TH MPlayer 1 "2009-03-25" "The MPlayer Project" "The Movie Player"
-.
-.SH NAME
-mplayer \- movie player
-.
-.\" --------------------------------------------------------------------------
-.\" Synopsis
-.\" --------------------------------------------------------------------------
-.
-.SH SYNOPSIS
-.na
-.nh
-.B mplayer
-[options] [file|URL|playlist|\-]
-.
-.br
-.B mplayer
-[options] file1
-[specific options] [file2] [specific options]
-.
-.br
-.B mplayer
-[options]
-{group of files and options}
-[group-specific options]
-.
-.br
-.B mplayer
-[br]://[title][/device]
-[options]
-.
-.br
-.B mplayer
-[dvd|dvdnav]://[title|[start_title]\-end_title][/device]
-[options]
-.
-.br
-.B mplayer
-vcd://track[/device]
-.
-.br
-.B mplayer
-tv://[channel][/input_id]
-[options]
-.
-.br
-.B mplayer
-radio://[channel|frequency][/capture]
-[options]
-.
-.br
-.B mplayer
-pvr://
-[options]
-.
-.br
-.B mplayer
-dvb://[card_number@]channel
-[options]
-.
-.br
-.B mplayer
-mf://[filemask|@listfile]
-[\-mf options] [options]
-.
-.br
-.B mplayer
-[cdda|cddb]://track[\-endtrack][:speed][/device]
-[options]
-.
-.br
-.B mplayer
-cue://file[:track]
-[options]
-.
-.br
-.B mplayer
-[file|mms[t]|http|http_proxy|rt[s]p|ftp|udp|unsv|icyx|noicyx|smb]://
-[user:pass@]URL[:port] [options]
-.
-.br
-.B mplayer
-sdp://file
-[options]
-.
-.br
-.B mplayer
-mpst://host[:port]/URL
-[options]
-.
-.br
-.B mplayer
-tivo://host/[list|llist|fsid]
-[options]
-.ad
-.hy
-.
-.\" --------------------------------------------------------------------------
-.\" Description
-.\" --------------------------------------------------------------------------
-.
-.SH DESCRIPTION
-.B mplayer
-is a movie player for Linux (runs on many other platforms and CPU
-architectures, see the documentation).
-It plays most MPEG/\:VOB, AVI, ASF/\:WMA/\:WMV, RM, QT/\:MOV/\:MP4, Ogg/\:OGM,
-MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM and RoQ files, supported by many
-native and binary codecs.
-You can watch VCD, SVCD, DVD, Blu\-ray, 3ivx, DivX 3/4/5, WMV and even H.264 movies,
-too.
-.PP
-MPlayer supports a wide range of video and audio output drivers.
-It works with X11, Xv, DGA, OpenGL, SVGAlib, fbdev, AAlib, libcaca, DirectFB,
-Quartz, Mac OS X CoreVideo, but you can also use GGI, SDL (and all their drivers),
-VESA (on every VESA-compatible card, even without X11), some low-level
-card-specific drivers (for Matrox, 3dfx and ATI) and some hardware MPEG decoder
-boards, such as the Siemens DVB, Hauppauge PVR (IVTV) and DXR3/\:Hollywood+.
-Most of them support software or hardware scaling, so you can enjoy movies in
-fullscreen mode.
-.PP
-MPlayer has an onscreen display (OSD) for status information, nice big
-antialiased shaded subtitles and visual feedback for keyboard controls.
-European/\:ISO8859-1,2 (Hungarian, English, Czech, etc), Cyrillic and Korean
-fonts are supported along with 12 subtitle formats (MicroDVD, SubRip, OGM,
-SubViewer, Sami, VPlayer, RT, SSA, AQTitle, JACOsub, PJS and our own: MPsub) and
-DVD subtitles (SPU streams, VOBsub and Closed Captions).
-.PP
-Usage examples to get you started quickly can be found at the end
-of this man page.
-.PP
-.B Also see the HTML documentation!
-.
-.
-.\" --------------------------------------------------------------------------
-.\" interactive control
-.\" --------------------------------------------------------------------------
-.
-.SH "INTERACTIVE CONTROL"
-MPlayer has a fully configurable, command-driven control layer
-which allows you to control MPlayer using keyboard, mouse, joystick
-or remote control (with LIRC).
-See the \-input option for ways to customize it.
-.
-.TP
-.B keyboard control
-.PD 0
-.RS
-.IPs "LEFT and RIGHT"
-Seek backward/\:forward 10 seconds.
-Shift+arrow does a 1 second exact seek (see \-hr\-seek; currently modifier
-keys like shift only work if used in an X output window).
-.IPs "UP and DOWN"
-Seek forward/\:backward 1 minute.
-Shift+arrow does a 5 second exact seek (see \-hr\-seek; currently modifier
-keys like shift only work if used in an X output window).
-.IPs "PGUP and PGDWN"
-Seek forward/\:backward 10 minutes.
-.IPs "[ and ]"
-Decrease/increase current playback speed by 10%.
-.IPs "{ and }"
-Halve/double current playback speed.
-.IPs "BACKSPACE"
-Reset playback speed to normal.
-.IPs "< and >"
-Go backward/\:forward in the playlist.
-.IPs "ENTER"
-Go forward in the playlist, even over the end.
-.IPs "HOME and END"
-next/\:previous playtree entry in the parent list
-.IPs "INS and DEL (ASX playlist only)"
-next/\:previous alternative source.
-.IPs "p / SPACE"
-Pause (pressing again unpauses).
-.IPs ".\ \ \ \ "
-Step forward.
-Pressing once will pause movie, every consecutive press will play one frame
-and then go into pause mode again.
-.IPs "q / ESC"
-Stop playing and quit.
-.IPs "U\ \ \ \ "
-Stop playing (and quit if \-idle is not used).
-.IPs "+ and \-"
-Adjust audio delay by +/\- 0.1 seconds.
-.IPs "/ and *"
-Decrease/\:increase volume.
-.IPs "9 and 0"
-Decrease/\:increase volume.
-.IPs "( and )"
-Adjust audio balance in favor of left/\:right channel.
-.IPs "m\ \ \ \ "
-Mute sound.
-.IPs "_ (MPEG-TS, AVI and libavformat only)"
-Cycle through the available video tracks.
-.IPs "# (DVD, Blu-ray, MPEG, Matroska, AVI and libavformat only)"
-Cycle through the available audio tracks.
-.IPs "TAB (MPEG-TS and libavformat only)"
-Cycle through the available programs.
-.IPs "f\ \ \ \ "
-Toggle fullscreen (also see \-fs).
-.IPs "T\ \ \ \ "
-Toggle stay-on-top (also see \-ontop).
-.IPs "w and e"
-Decrease/\:increase pan-and-scan range.
-.IPs "o\ \ \ \ "
-Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
-.IPs "d\ \ \ \ "
-Toggle frame dropping states: none / skip display / skip decoding
-(see \-framedrop and \-hardframedrop).
-.IPs "v\ \ \ \ "
-Toggle subtitle visibility.
-.IPs "j and J"
-Cycle through the available subtitles.
-.IPs "y and g"
-Step forward/backward in the subtitle list.
-.IPs "F\ \ \ \ "
-Toggle displaying "forced subtitles".
-.IPs "a\ \ \ \ "
-Toggle subtitle alignment: top / middle / bottom.
-.IPs "x and z"
-Adjust subtitle delay by +/\- 0.1 seconds.
-.IPs "V\ \ \ \ "
-Toggle subtitle VSFilter aspect compatibility mode.
-See -ass\-vsfilter\-aspect\-compat for more info.
-.IPs "C (\-capture only)"
-Start/stop capturing the primary stream.
-.IPs "r and t"
-Move subtitles up/down.
-.IPs "i (\-edlout mode only)"
-Set start or end of an EDL skip and write it out to the given file.
-.IPs "s (\-vf screenshot only)"
-Take a screenshot.
-.IPs "S (\-vf screenshot only)"
-Start/stop taking screenshots.
-.IPs "I\ \ \ \ "
-Show filename on the OSD.
-.IPs "P\ \ \ \ "
-Show progression bar, elapsed time and total duration on the OSD.
-.IPs "! and @"
-Seek to the beginning of the previous/next chapter.
-.IPs "D (\-vo vdpau, \-vf yadif, \-vf kerndeint only)"
-Activate/deactivate deinterlacer.
-.IPs "A\ \ \ \ "
-Cycle through the available DVD angles.
-.IPs "c (currently -vo vdpau and -vo xv only)"
-Change YUV colorspace.
-.RE
-.PD 1
-.PP
-.RS
-(The following keys are valid only when using a video output that supports
-the corresponding adjustment, the software equalizer
-(\-vf eq or \-vf eq2) or hue filter (\-vf hue).)
-.RE
-.PP
-.PD 0
-.RS
-.IPs "1 and 2"
-Adjust contrast.
-.IPs "3 and 4"
-Adjust brightness.
-.IPs "5 and 6"
-Adjust hue.
-.IPs "7 and 8"
-Adjust saturation.
-.RE
-.PD 1
-.PP
-.RS
-(The following keys are valid only when using the quartz or corevideo
-video output driver.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs "command + 0"
-Resize movie window to half its original size.
-.IPs "command + 1"
-Resize movie window to its original size.
-.IPs "command + 2"
-Resize movie window to double its original size.
-.IPs "command + f"
-Toggle fullscreen (also see \-fs).
-.IPs "command + [ and command + ]"
-Set movie window alpha.
-.RE
-.PD 1
-.PP
-.RS
-(The following keys are valid only when using the sdl
-video output driver.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs "c\ \ \ \ "
-Cycle through available fullscreen modes.
-.IPs "n\ \ \ \ "
-Restore original mode.
-.RE
-.PD 1
-.PP
-.RS
-(The following keys are valid if you have a keyboard
-with multimedia keys.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs PAUSE
-Pause.
-.IPs "STOP\ "
-Stop playing and quit.
-.IPs "PREVIOUS and NEXT"
-Seek backward/\:forward 1 minute.
-.RE
-.PD 1
-.PP
-.RS
-(The following keys are only valid if you compiled with TV or DVB input
-support and will take precedence over the keys defined above.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs "h and k"
-Select previous/\:next channel.
-.IPs "n\ \ \ \ "
-Change norm.
-.IPs "u\ \ \ \ "
-Change channel list.
-.RE
-.PD 1
-.PP
-.RS
-(The following keys are only valid if you compiled with dvdnav
-support: They are used to navigate the menus.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs "keypad 8"
-Select button up.
-.IPs "keypad 2"
-Select button down.
-.IPs "keypad 4"
-Select button left.
-.IPs "keypad 6"
-Select button right.
-.IPs "keypad 5"
-Return to main menu.
-.IPs "keypad 7"
-Return to nearest menu (the order of preference is: chapter->title->root).
-.IPs "keypad ENTER"
-Confirm choice.
-.RE
-.PD 1
-.PP
-.RS
-.
-(The following keys are used for controlling TV teletext. The data may
-come from either an analog TV source or an MPEG transport stream.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs "X\ \ \ \ "
-Switch teletext on/\:off.
-.IPs "Q and W"
-Go to next/\:prev teletext page.
-.RE
-.PD 1
-.
-.TP
-.B mouse control
-.PD 0
-.RS
-.IPs "button 3 and button 4"
-Seek backward/\:forward 1 minute.
-.IPs "button 5 and button 6"
-Decrease/\:increase volume.
-.RE
-.PD 1
-.
-.TP
-.B joystick control
-.PD 0
-.RS
-.IPs "left and right"
-Seek backward/\:forward 10 seconds.
-.IPs "up and down"
-Seek forward/\:backward 1 minute.
-.IPs "button 1"
-Pause.
-.IPs "button 2"
-Toggle OSD states: none / seek / seek + timer / seek + timer + total time.
-.IPs "button 3 and button 4"
-Decrease/\:increase volume.
-.RE
-.PD 1
-.
-.
-.\" --------------------------------------------------------------------------
-.\" Usage
-.\" --------------------------------------------------------------------------
-.
-.SH "USAGE"
-Every 'flag' option has a 'noflag' counterpart, e.g.\& the opposite of the
-\-fs option is \-nofs.
-.PP
-If an option is marked as (XXX only), it will only work in combination with
-the XXX option or if XXX is compiled in.
-.PP
-.I NOTE:
-The suboption parser (used for example for \-ao pcm suboptions) supports
-a special kind of string-escaping intended for use with external GUIs.
-.br
-It has the following format:
-.br
-%n%string_of_length_n
-.br
-.I EXAMPLES:
-.br
-mplayer \-ao pcm:file=%10%C:test.wav test.avi
-.br
-Or in a script:
-.br
-mplayer \-ao pcm:file=%`expr length "$NAME"`%"$NAME" test.avi
-.PP
-.
-.\" --------------------------------------------------------------------------
-.\" Configuration files
-.\" --------------------------------------------------------------------------
-.
-.SH "CONFIGURATION FILES"
-You can put all of the options in configuration files which will be read
-every time MPlayer is run.
-The system-wide configuration file 'mplayer.conf' is in your configuration
-directory (e.g.\& /etc/\:mplayer or /usr/\:local/\:etc/\:mplayer), the user
-specific one is '~/\:.mplayer/\:config'.
-User specific options override system-wide options and options given on the
-command line override either.
-The syntax of the configuration files is 'option=<value>', everything after
-a '#' is considered a comment.
-Options that work without values can be enabled by setting them to 'yes'
-or '1' or 'true' and disabled by setting them to 'no' or '0' or 'false'.
-Even suboptions can be specified in this way.
-.PP
-You can also write file-specific configuration files.
-If you wish to have a configuration file for a file called 'movie.avi', create a file
-named 'movie.avi.conf' with the file-specific options in it and put it in
-~/.mplayer/.
-You can also put the configuration file in the same directory as the file to
-be played, as long as you give the \-use\-filedir\-conf option (either on the
-command line or in your global config file).
-If a file-specific configuration file is found in the same directory, no
-file-specific configuration is loaded from ~/.mplayer.
-In addition, the \-use\-filedir\-conf option enables directory-specific
-configuration files.
-For this, MPlayer first tries to load a mplayer.conf from the same directory as
-the file played and then tries to load any file-specific configuration.
-.PP
-.I EXAMPLE MPLAYER CONFIGURATION FILE:
-.sp 1
-.nf
-# Use Matrox driver by default.
-vo=xmga
-# I love practicing handstands while watching videos.
-flip=yes
-# Decode multiple files from PNG,
-# start with mf://filemask
-mf=type=png:fps=25
-# Eerie negative images are cool.
-vf=eq2=1.0:\-0.8
-.fi
-.
-.\" --------------------------------------------------------------------------
-.\" Profiles
-.\" --------------------------------------------------------------------------
-.
-.SH "PROFILES"
-To ease working with different configurations profiles can be defined in the
-configuration files.
-A profile starts with its name between square brackets, e.g.\& '[my-profile]'.
-All following options will be part of the profile.
-A description (shown by \-profile help) can be defined with the profile-desc
-option.
-To end the profile, start another one or use the profile name 'default'
-to continue with normal options.
-.fi
-.PP
-.I "EXAMPLE MPLAYER PROFILE:"
-.sp 1
-.nf
-
-[protocol.dvd]
-profile-desc="profile for dvd:// streams"
-vf=pp=hb/vb/dr/al/fd
-alang=en
-
-[protocol.dvdnav]
-profile-desc="profile for dvdnav:// streams"
-profile=protocol.dvd
-mouse-movements=yes
-nocache=yes
-
-[extension.flv]
-profile-desc="profile for .flv files"
-flip=yes
-
-[vo.pnm]
-outdir=/tmp
-
-[ao.alsa]
-device=spdif
-.fi
-.
-.\" --------------------------------------------------------------------------
-.\" Options
-.\" --------------------------------------------------------------------------
-.
-.SH "GENERAL OPTIONS"
-.
-.TP
-.B \-codecpath <dir>
-Specify a directory for binary codecs.
-.
-.TP
-.B \-codecs\-file <filename> (also see \-afm, \-ac, \-vfm, \-vc)
-Override the standard search path and use the specified file
-instead of the builtin codecs.conf.
-.
-.TP
-.B \-include <configuration file>
-Specify configuration file to be parsed after the default ones.
-.
-.TP
-.B \-list\-options
-Prints all available options.
-.
-.TP
-.B \-msgcharset <charset>
-Convert console messages to the specified character set (default: autodetect).
-Text will be in the encoding specified with the \-\-charset configure option.
-Set this to "noconv" to disable conversion (for e.g.\& iconv problems).
-.br
-.I NOTE:
-The option takes effect after command line parsing has finished.
-The MPLAYER_CHARSET environment variable can help you get rid of
-the first lines of garbled output.
-.
-.TP
-.B \-msgcolor
-Enable colorful console output on terminals that support ANSI color.
-.
-.TP
-.B \-msglevel <all=<level>:<module>=<level>:...>
-Control verbosity directly for each module.
-The 'all' module changes the verbosity of all the modules not
-explicitly specified on the command line.
-See '\-msglevel help' for a list of all modules.
-.br
-.I NOTE:
-Some messages are printed before the command line is parsed and are
-therefore not affected by \-msglevel.
-To control these messages you have to use the MPLAYER_VERBOSE environment
-variable, see its description below for details.
-.br
-Available levels:
-.PD 0
-.RSs
-.IPs "\-1"
-complete silence
-.IPs " 0"
-fatal messages only
-.IPs " 1"
-error messages
-.IPs " 2"
-warning messages
-.IPs " 3"
-short hints
-.IPs " 4"
-informational messages
-.IPs " 5"
-status messages (default)
-.IPs " 6"
-verbose messages
-.IPs " 7"
-debug level 2
-.IPs " 8"
-debug level 3
-.IPs " 9"
-debug level 4
-.RE
-.PD 1
-.
-.TP
-.B \-msgmodule
-Prepend module name in front of each console message.
-.
-.TP
-.B \-noconfig <options>
-Do not parse selected configuration files.
-.br
-.I NOTE:
-If \-include or \-use\-filedir\-conf options are
-specified at the command line, they will be honoured.
-.sp 1
-Available options are:
-.PD 0
-.RSs
-.IPs "all\ \ "
-all configuration files
-.IPs system
-system configuration file
-.IPs "user\ "
-user configuration file
-.RE
-.PD 1
-.
-.TP
-.B "\-quiet\ "
-Make console output less verbose; in particular, prevents the status line
-(i.e.\& A: 0.7 V: 0.6 A-V: 0.068 ...) from being displayed.
-Particularly useful on slow terminals or broken ones which do not properly
-handle carriage return (i.e.\& \\r).
-.
-.TP
-.B \-priority <prio> (Windows and OS/2 only)
-Set process priority for MPlayer according to the predefined
-priorities available under Windows and OS/2.
-Possible values of <prio>:
-.RSs
-idle|belownormal|normal|abovenormal|high|realtime
-.RE
-.sp 1
-.RS
-.I WARNING:
-Using realtime priority can cause system lockup.
-.RE
-.
-.TP
-.B \-profile <profile1,profile2,...>
-Use the given profile(s), \-profile help displays a list of the defined profiles.
-.
-.TP
-.B \-really\-quiet (also see \-quiet)
-Display even less output and status messages than with \-quiet.
-.
-.TP
-.B \-show\-profile <profile>
-Show the description and content of a profile.
-.
-.TP
-.B \-use\-filedir\-conf
-Look for a file-specific configuration file in the same directory as
-the file that is being played.
-.br
-.I WARNING:
-May be dangerous if playing from untrusted media.
-.
-.TP
-.B "\-v\ \ \ \ \ "
-Increment verbosity level, one level for each \-v
-found on the command line.
-.
-.
-.
-.SH "PLAYER OPTIONS"
-.
-.TP
-.B \-autoq <quality> (use with \-vf [s]pp)
-Dynamically changes the level of postprocessing depending on the available spare
-CPU time.
-The number you specify will be the maximum level used.
-Usually you can use some big number.
-You have to use \-vf [s]pp without parameters in order for this to work.
-.
-.TP
-.B \-autosync <factor>
-Gradually adjusts the A/V sync based on audio delay measurements.
-Specifying \-autosync 0, the default, will cause frame timing to be based
-entirely on audio delay measurements.
-Specifying \-autosync 1 will do the same, but will subtly change the A/V
-correction algorithm.
-An uneven video framerate in a movie which plays fine with \-nosound can
-often be helped by setting this to an integer value greater than 1.
-The higher the value, the closer the timing will be to \-nosound.
-Try \-autosync 30 to smooth out problems with sound drivers which do
-not implement a perfect audio delay measurement.
-With this value, if large A/V sync offsets occur, they will only take about
-1 or 2 seconds to settle out.
-This delay in reaction time to sudden A/V offsets should be the only
-side-effect of turning this option on, for all sound drivers.
-.
-.TP
-.B \-benchmark
-Prints some statistics on CPU usage and dropped frames at the end of playback.
-Use in combination with \-nosound and \-vo null for benchmarking only the
-video codec.
-.br
-.I NOTE:
-With this option MPlayer will also ignore frame duration when playing
-only video (you can think of that as infinite fps).
-.
-.TP
-.B \-chapter\-merge\-threshold <number>
-Threshold for merging almost consecutive ordered chapter parts
-in milliseconds (default: 100).
-Some Matroska files with ordered chapters have inaccurate chapter
-end timestamps, causing a small gap between the end of one chapter and
-the start of the next one when they should match.
-If the end of one playback part is less than the given threshold away
-from the start of the next one then keep playing video normally over the
-chapter change instead of doing a seek.
-.
-.TP
-.B \-colorkey <number>
-Changes the colorkey to an RGB value of your choice.
-0x000000 is black and 0xffffff is white.
-Only supported by the fbdev, svga, vesa, xmga,
-xover, xv (see \-vo xv:ck) and directx video output drivers.
-.
-.TP
-.B \-nocolorkey
-Disables colorkeying.
-Only supported by the fbdev, svga, vesa, xmga,
-xover, xv (see \-vo xv:ck) and directx video output drivers.
-.
-.TP
-.B \-correct\-pts, \-nocorrect\-pts
-Switches MPlayer to a mode where timestamps for video frames
-are calculated differently and video filters which add new frames or
-modify timestamps of existing ones are supported.
-Now enabled automatically for most common file formats.
-The more accurate timestamps can be visible for example when playing
-subtitles timed to scene changes with the \-ass option.
-Without \-correct\-pts the subtitle timing will typically be off by some frames.
-This option does not work correctly with some demuxers and codecs.
-.
-.TP
-.B \-crash\-debug (DEBUG CODE)
-Automatically attaches gdb upon crash or SIGTRAP.
-Support must be compiled in by configuring with \-\-enable\-crash\-debug.
-.
-.TP
-.B \-doubleclick\-time
-Time in milliseconds to recognize two consecutive button presses as
-a double-click (default: 300).
-Set to 0 to let your windowing system decide what a double-click is
-(\-vo directx only).
-.
-.TP
-.B \-edlout <filename>
-Creates a new file and writes edit decision list (EDL) records to it.
-During playback, the user hits 'i' to mark the start or end of a skip block.
-This provides a starting point from which the user can fine-tune EDL entries
-later.
-See http://www.mplayerhq.hu/\:DOCS/\:HTML/\:en/\:edl.html for details.
-.
-.TP
-.B \-fixed\-vo, \-nofixed\-vo
-\-fixed\-vo enforces a fixed video system for multiple files (one
-(un)initialization for all files).
-Therefore only one window will be opened for all files.
-Now enabled by default, use \-nofixed\-vo to disable and create a new window
-whenever the video stream changes.
-Some of the older drivers may not be fixed-vo compliant.
-.
-.TP
-.B \-framedrop (also see \-hardframedrop, experimental without \-nocorrect\-pts)
-Skip displaying some frames to maintain A/V sync on slow systems.
-Video filters are not applied to such frames.
-For B-frames even decoding is skipped completely.
-.
-.TP
-.B \-h, \-help, \-\-help
-Show short summary of options.
-.
-.TP
-.B \-hardframedrop (experimental without \-nocorrect\-pts)
-More intense frame dropping (breaks decoding).
-Leads to image distortion!
-Note that especially the libmpeg2 decoder may crash with this,
-so consider using "\-vc ffmpeg12,".
-.
-.TP
-.B \-heartbeat\-cmd
-Command that is executed every 30 seconds during playback via system() -
-i.e.\& using the shell.
-.sp 1
-.I NOTE:
-MPlayer uses this command without any checking, it is your responsibility
-to ensure it does not cause security problems (e.g.\& make sure to use full
-paths if "." is in your path like on Windows).
-It also only works when playing video (i.e.\& not with \-novideo but works with \-vo null).
-.sp 1
-This can be "misused" to disable screensavers that do not support the proper
-X API (also see \-stop\-xscreensaver).
-If you think this is too complicated, ask the author of the screensaver
-program to support the proper X APIs.
-.sp 1
-.I EXAMPLE for xscreensaver:
-mplayer \-heartbeat\-cmd "xscreensaver\-command \-deactivate" file
-.sp 1
-.I EXAMPLE for GNOME screensaver:
-mplayer \-heartbeat\-cmd "gnome\-screensaver\-command \-p" file
-.RE
-.PD 1
-.
-.TP
-.B \-hr\-seek off|absolute|always
-Select when to use precise seeks that are not limited to keyframes.
-Such seeks require decoding video from the previous keyframe up to the target
-position and so can take some time depending on decoding performance.
-For some video formats precise seeks are disabled. This option selects the
-default choice to use for seeks; it's possible to explicitly override that
-default in the definition of key bindings and in slave mode commands.
-.PD 0
-.RSs
-.IPs off
-Never use precise seeks.
-.IPs absolute
-Use precise seeks if the seek is to an absolute position in the file,
-such as a chapter seek, but not for relative seeks like the default
-behavior of arrow keys (default).
-.IPs always
-Use precise seeks whenever possible.
-.RE
-.PD 1
-.
-.TP
-.B \-identify
-Shorthand for \-msglevel identify=4.
-Show file parameters in an easily parseable format.
-Also prints more detailed information about subtitle and audio
-track languages and IDs.
-In some cases you can get more information by using \-msglevel identify=6.
-For example, for a DVD or Blu\-ray it will list the chapters and time length
-of each title, as well as a disk ID.
-Combine this with \-frames 0 to suppress all video output.
-The wrapper script TOOLS/\:midentify.sh suppresses the other MPlayer output and
-(hopefully) shellescapes the filenames.
-.
-.TP
-.B \-idle (also see \-slave)
-Makes MPlayer wait idly instead of quitting when there is no file to play.
-Mostly useful in slave mode where MPlayer can be controlled
-through input commands.
-.
-.TP
-.B \-input <commands>
-This option can be used to configure certain parts of the input system.
-Paths are relative to ~/.mplayer/.
-.br
-.I NOTE:
-Autorepeat is currently only supported by joysticks.
-.sp 1
-Available commands are:
-.sp 1
-.PD 0
-.RSs
-.IPs conf=<filename>
-Specify input configuration file other than the default
-~/\:.mplayer/\:input.conf.
-~/\:.mplayer/\:<filename> is assumed if no full path is given.
-.IPs ar-dev=<device>
-Device to be used for Apple IR Remote (default is autodetected, Linux only).
-.IPs ar-delay
-Delay in milliseconds before we start to autorepeat a key (0 to disable).
-.IPs ar-rate
-Number of key presses to generate per second on autorepeat.
-.IPs (no)default-bindings
-Use the key bindings that MPlayer ships with by default.
-.IPs keylist
-Prints all keys that can be bound to commands.
-.IPs cmdlist
-Prints all commands that can be bound to keys.
-.IPs js-dev
-Specifies the joystick device to use (default: /dev/\:input/\:js0).
-.IPs file=<filename>
-Read commands from the given file.
-Mostly useful with a FIFO.
-.br
-.I NOTE:
-When the given file is a FIFO MPlayer opens both ends so you can do
-several 'echo "seek 10" > mp_pipe' and the pipe will stay valid.
-.RE
-.PD 1
-.
-.TP
-.B \-key\-fifo\-size <2\-65000>
-Specify the size of the FIFO that buffers key events (default: 7).
-If it is too small some events may be lost.
-The main disadvantage of setting it to a very large value is that if you
-hold down a key triggering some particularly slow command then the player
-may be unresponsive while it processes all the queued commands.
-.
-.TP
-.B \-lircconf <filename> (LIRC only)
-Specifies a configuration file for LIRC (default: ~/.lircrc).
-.
-.TP
-.B \-list\-properties
-Print a list of the available properties.
-.
-.TP
-.B \-loop <number>
-Loops movie playback <number> times.
-0 means forever.
-.
-.TP
-.B \-menu (OSD menu only)
-Turn on OSD menu support.
-.
-.TP
-.B \-menu\-cfg <filename> (OSD menu only)
-Use an alternative menu.conf.
-.
-.TP
-.B \-menu\-chroot <path> (OSD menu only)
-Chroot the file selection menu to a specific location.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-menu\-chroot /home"
-Will restrict the file selection menu to /\:home and downward (i.e.\& no
-access to / will be possible, but /home/user_name will).
-.RE
-.PD 1
-.
-.TP
-.B \-menu\-keepdir (OSD menu only)
-File browser starts from the last known location instead of current directory.
-.
-.TP
-.B \-menu\-root <value> (OSD menu only)
-Specify the main menu.
-.
-.TP
-.B \-menu\-startup (OSD menu only)
-Display the main menu at MPlayer startup.
-.
-.TP
-.B \-mouse\-movements
-Permit MPlayer to receive pointer events reported by the video
-output driver.
-Necessary to select the buttons in DVD menus.
-Supported for X11-based VOs (x11, xv, etc) and the gl, gl2, direct3d and
-corevideo VOs.
-.
-.TP
-.B \-noar
-Turns off AppleIR remote support.
-.
-.TP
-.B \-noconsolecontrols
-Prevent MPlayer from reading key events from standard input.
-Useful when reading data from standard input.
-This is automatically enabled when \- is found on the command line.
-There are situations where you have to set it manually, e.g.\&
-if you open /dev/\:stdin (or the equivalent on your system), use stdin
-in a playlist or intend to read from stdin later on via the loadfile or
-loadlist slave commands.
-.
-.TP
-.B \-noinitial-audio-sync
-When starting a video file or after events such as seeking MPlayer will by
-default modify the audio stream to make it start from the same timestamp as
-video, by either inserting silence at the start or cutting away the first
-samples.
-This option disables that functionality and makes the player behave like
-older MPlayer versions did: video and audio are both started immediately
-even if their start timestamps differ, and then video timing is gradually
-adjusted if necessary to reach correct synchronization later.
-.
-.TP
-.B \-nojoystick
-Turns off joystick support.
-.
-.TP
-.B \-nolirc
-Turns off LIRC support.
-.
-.TP
-.B \-nomouseinput
-Disable mouse button press/\:release input (mozplayerxp's context menu relies
-on this option).
-.TP
-.B \-noordered\-chapters
-Disable support for Matroska ordered chapters.
-MPlayer will not load or search for video segments from other files,
-and will also ignore any chapter order specified for the main file.
-.
-.TP
-.B \-pts\-association\-mode auto|decode|sort
-Select the method used to determine which container packet timestamp
-corresponds to a particular output frame from the video decoder.
-Normally you shouldn't need to change this option.
-.PD 0
-.RSs
-.IPs auto
-Try to pick a working mode from the ones below automatically (default)
-.IPs decoder
-Use decoder reordering functionality.
-.IPs sort
-Maintain a buffer of unused pts values and use the lowest value for the frame.
-.RE
-.PD 1
-.
-.TP
-.B \-rtc (RTC only)
-Turns on usage of the Linux RTC (realtime clock \- /dev/\:rtc) as timing
-mechanism.
-This wakes up the process every 1/1024 seconds to check the current time.
-Useless with modern Linux kernels configured for desktop use as they already
-wake up the process with similar accuracy when using normal timed sleep.
-.
-.TP
-.B \-playing\-msg <string>
-Print out a string before starting playback.
-The following expansions are supported:
-.RSs
-.IPs ${NAME}
-Expand to the value of the property NAME.
-.IPs ?(NAME:TEXT)
-Expand TEXT only if the property NAME is available.
-.IPs ?(!NAME:TEXT)
-Expand TEXT only if the property NAME is not available.
-.RE
-.
-.TP
-.B \-playlist <filename>
-Play files according to a playlist file (ASX, Winamp, SMIL, or
-one-file-per-line format).
-.br
-.I WARNING:
-The way MPlayer parses and uses playlist files is not safe against
-maliciously constructed files.
-Such files may trigger harmful actions.
-This has been the case for all MPlayer versions, but unfortunately this
-fact was not well documented earlier, and some people have even misguidedly
-recommended use of -playlist with untrusted sources.
-Do NOT use -playlist with random internet sources or files you don't trust!
-.br
-.I NOTE:
-This option is considered an entry so options found after it will apply
-only to the elements of this playlist.
-.br
-FIXME: This needs to be clarified and documented thoroughly.
-.
-.TP
-.B \-rtc\-device <device>
-Use the specified device for RTC timing.
-.
-.TP
-.B \-shuffle
-Play files in random order.
-.
-.TP
-.B \-slave (also see \-input)
-Switches on slave mode, in which MPlayer works as a backend for other programs.
-Instead of intercepting keyboard events, MPlayer will read commands separated
-by a newline (\\n) from stdin.
-.br
-.I NOTE:
-See \-input cmdlist for a list of slave commands and DOCS/tech/slave.txt
-for their description.
-Also, this is not intended to disable other inputs, e.g.\& via the video window,
-use some other method like \-input nodefault\-bindings:conf=/dev/null for that.
-.
-.TP
-.B \-softsleep
-Time frames by repeatedly checking the current time instead of asking the
-kernel to wake up MPlayer at the correct time.
-Useful if your kernel timing is imprecise and you cannot use the RTC either.
-Comes at the price of higher CPU consumption.
-.
-.TP
-.B \-sstep <sec>
-Skip <sec> seconds after every frame.
-The normal framerate of the movie is kept, so playback is accelerated.
-Since MPlayer can only seek to the next keyframe this may be inexact.
-.
-.
-.
-.SH "DEMUXER/STREAM OPTIONS"
-.
-.TP
-.B \-a52drc <level>
-Select the Dynamic Range Compression level for AC-3 audio streams.
-<level> is a float value ranging from 0 to 1, where 0 means no compression
-and 1 (which is the default) means full compression (make loud passages more
-silent and vice versa).
-Values up to 2 are also accepted, but are purely experimental.
-This option only shows an effect if the AC-3 stream contains the required range
-compression information.
-.
-.TP
-.B \-aid <ID> (also see \-alang)
-Select audio channel (MPEG: 0\-31, AVI/\:OGM: 1\-99, ASF/\:RM: 0\-127,
-VOB(AC-3): 128\-159, VOB(LPCM): 160\-191, MPEG-TS 17\-8190).
-MPlayer prints the available audio IDs when run in verbose (\-v) mode.
-When playing an MPEG-TS stream, MPlayer will use the first program (if present)
-with the chosen audio stream.
-.
-.TP
-.B \-ausid <ID> (also see \-alang)
-Select audio substream channel.
-Currently the valid range is 0x55..0x75 and applies only to MPEG-TS when handled
-by the native demuxer (not by libavformat).
-The format type may not be correctly identified because of how this information
-(or lack thereof) is embedded in the stream, but it will demux correctly the
-audio streams when multiple substreams are present.
-MPlayer prints the available substream IDs when run with \-identify.
-.
-.TP
-.B \-alang <language code[,language code,...]> (also see \-aid)
-Specify a priority list of audio languages to use.
-Different container formats employ different language codes.
-DVDs use ISO 639-1 two letter language codes, Matroska, MPEG-TS and NUT
-use ISO 639-2 three letter language codes while OGM uses a free-form identifier.
-MPlayer prints the available languages when run in verbose (\-v) mode.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "mplayer dvd://1 \-alang hu,en"
-Chooses the Hungarian language track on a DVD and falls back on English if
-Hungarian is not available.
-.IPs "mplayer \-alang jpn example.mkv"
-Plays a Matroska file in Japanese.
-.RE
-.PD 1
-.
-.TP
-.B \-audio\-demuxer <[+]name> (\-audiofile only)
-Force audio demuxer type for \-audiofile.
-Use a '+' before the name to force it, this will skip some checks!
-Give the demuxer name as printed by \-audio\-demuxer help.
-\-audio\-demuxer audio forces MP3.
-.
-.TP
-.B \-audiofile <filename>
-Play audio from an external file (WAV, MP3 or Ogg Vorbis) while viewing a
-movie.
-.
-.TP
-.B \-audiofile\-cache <kBytes>
-Enables caching for the stream used by \-audiofile, using the specified
-amount of memory.
-.
-.TP
-.B \-reuse\-socket (udp:// only)
-Allows a socket to be reused by other processes as soon as it is closed.
-.
-.TP
-.B \-bandwidth <Bytes> (network only)
-Specify the maximum bandwidth for network streaming (for servers that are
-able to send content in different bitrates).
-Useful if you want to watch live streamed media behind a slow connection.
-With Real RTSP streaming, it is also used to set the maximum delivery
-bandwidth allowing faster cache filling and stream dumping.
-.
-.TP
-.B \-bluray\-angle <angle ID> (Blu\-ray only)
-Some Blu\-ray discs contain scenes that can be viewed from multiple angles.
-Here you can tell MPlayer which angles to use (default: 1).
-.
-.TP
-.B \-bluray\-chapter <chapter ID> (Blu\-ray only)
-Tells MPlayer which Blu\-ray chapter to start the current title from (default: 1).
-.
-.TP
-.B \-bluray\-device <path to disc> (Blu\-ray only)
-Specify the Blu\-ray disc location. Must be a directory with Blu\-ray structure.
-.
-.TP
-.B \-cache <kBytes>
-This option specifies how much memory (in kBytes) to use when precaching a
-file or URL.
-Especially useful on slow media.
-.
-.TP
-.B \-nocache
-Turns off caching.
-.
-.TP
-.B \-cache\-min <percentage>
-Playback will start when the cache has been filled up to <percentage>
-of the total.
-.
-.TP
-.B \-cache\-seek\-min <percentage>
-If a seek is to be made to a position within <percentage> of the cache size
-from the current position, MPlayer will wait for the cache to be filled to
-this position rather than performing a stream seek (default: 50).
-.
-.TP
-.B \-capture
-Allows capturing the primary stream (not additional audio tracks or other
-kind of streams) into the file specified by \-dumpfile or \"stream.dump\"
-by default.
-If this option is given, capturing can be started and stopped by pressing
-the key bound to this function (see section INTERACTIVE CONTROL).
-Same as for \-dumpstream, this will likely not produce usable results for
-anything else than MPEG streams.
-Note that, due to cache latencies, captured data may begin and end
-somewhat delayed compared to what you see displayed.
-.
-.TP
-.B \-cdda <option1:option2> (CDDA only)
-This option can be used to tune the CD Audio reading feature of MPlayer.
-.sp 1
-Available options are:
-.RSs
-.IPs speed=<value>
-Set CD spin speed.
-.IPs paranoia=<0\-2>
-Set paranoia level.
-Values other than 0 seem to break playback of anything but the first track.
-.RSss
-0: disable checking (default)
-.br
-1: overlap checking only
-.br
-2: full data correction and verification
-.REss
-.IPs generic-dev=<value>
-Use specified generic SCSI device.
-.IPs sector-size=<value>
-Set atomic read size.
-.IPs overlap=<value>
-Force minimum overlap search during verification to <value> sectors.
-.IPs toc-bias
-Assume that the beginning offset of track 1 as reported in the TOC will be
-addressed as LBA 0.
-Some Toshiba drives need this for getting track boundaries correct.
-.IPs toc-offset=<value>
-Add <value> sectors to the values reported when addressing tracks.
-May be negative.
-.IPs (no)skip
-(Never) accept imperfect data reconstruction.
-.RE
-.
-.TP
-.B \-cdrom\-device <path to device>
-Specify the CD-ROM device (default: /dev/\:cdrom).
-.
-.TP
-.B \-channels <number> (also see \-af channels)
-Request the number of playback channels (default: 2).
-MPlayer asks the decoder to decode the audio into as many channels as
-specified.
-Then it is up to the decoder to fulfill the requirement.
-This is usually only important when playing videos with AC-3 audio (like DVDs).
-In that case liba52 does the decoding by default and correctly downmixes the
-audio into the requested number of channels.
-To directly control the number of output channels independently of how many
-channels are decoded, use the channels filter.
-.br
-.I NOTE:
-This option is honored by codecs (AC-3 only), filters (surround) and audio
-output drivers (OSS at least).
-.sp 1
-Available options are:
-.sp 1
-.PD 0
-.RSs
-.IPs 2
-stereo
-.IPs 4
-surround
-.IPs 6
-full 5.1
-.IPs 8
-full 7.1
-.RE
-.PD 1
-.
-.TP
-.B \-chapter <chapter ID>[\-<endchapter ID>] (dvd:// and dvdnav:// only)
-Specify which chapter to start playing at.
-Optionally specify which chapter to end playing at (default: 1).
-.
-.TP
-.B \-edition <edition ID> (Matroska only)
-Specify the edition (set of chapters) to use, where 0 is the first. If set to
--1 (the default), MPlayer will choose the first edition declared as a default,
-or if there is no default, the first edition defined.
-.
-.TP
-.B \-cookies (network only)
-Send cookies when making HTTP requests.
-.
-.TP
-.B \-cookies\-file <filename> (network only)
-Read HTTP cookies from <filename> (default: ~/.mozilla/ and ~/.netscape/)
-and skip reading from default locations.
-The file is assumed to be in Netscape format.
-.
-.TP
-.B \-delay <sec>
-audio delay in seconds (positive or negative float value)
-.br
-Negative values delay the audio, and positive values delay the video.
-.
-.TP
-.B \-ignore\-start
-Ignore the specified starting time for streams in AVI files.
-This nullifies stream delays.
-.
-.TP
-.B \-demuxer <[+]name>
-Force demuxer type.
-Use a '+' before the name to force it, this will skip some checks!
-Give the demuxer name as printed by \-demuxer help.
-.
-.TP
-.B \-dumpaudio
-Dumps raw compressed audio stream to ./stream.dump (useful with MPEG/\:AC-3,
-in most other cases the resulting file will not be playable).
-If you give more than one of \-dumpaudio, \-dumpvideo, \-dumpstream
-on the command line only the last one will work.
-.
-.TP
-.B \-dumpfile <filename>
-Specify which file MPlayer should dump to.
-Should be used together with \-dumpaudio / \-dumpvideo / \-dumpstream /
-\-capture.
-.
-.TP
-.B \-dumpstream
-Dumps the raw stream to ./stream.dump.
-Useful when ripping from DVD or network.
-If you give more than one of \-dumpaudio, \-dumpvideo, \-dumpstream
-on the command line only the last one will work.
-.
-.TP
-.B \-dumpvideo
-Dump raw compressed video stream to ./stream.dump (not very usable).
-If you give more than one of \-dumpaudio, \-dumpvideo, \-dumpstream
-on the command line only the last one will work.
-.
-.TP
-.B \-dvbin <options> (DVB only)
-Pass the following parameters to the DVB input module, in order to override
-the default ones:
-.sp 1
-.PD 0
-.RSs
-.IPs card=<1\-4>
-Specifies using card number 1\-4 (default: 1).
-.IPs file=<filename>
-Instructs MPlayer to read the channels list from <filename>.
-Default is ~/.mplayer/\:channels.conf.{sat,ter,cbl,atsc} (based on your card type)
-or ~/.mplayer/\:channels.conf as a last resort.
-.IPs timeout=<1\-30>
-Maximum number of seconds to wait when trying to tune a
-frequency before giving up (default: 30).
-.RE
-.PD 1
-.
-.TP
-.B \-dvd\-device <path to device> (DVD only)
-Specify the DVD device or .iso filename (default: /dev/\:dvd).
-You can also specify a directory that contains files previously copied directly
-from a DVD (with e.g.\& vobcopy).
-.
-.TP
-.B \-dvd\-speed <factor or speed in KB/s> (DVD only)
-Try to limit DVD speed (default: 0, no change).
-DVD base speed is about 1350KB/s, so a 8x drive can read at speeds up to
-10800KB/s.
-Slower speeds make the drive more quiet, for watching DVDs 2700KB/s should be
-quiet and fast enough.
-MPlayer resets the speed to the drive default value on close.
-Values less than 100 mean multiples of 1350KB/s, i.e.\& \-dvd\-speed 8 selects
-10800KB/s.
-.br
-.I NOTE:
-You need write access to the DVD device to change the speed.
-.
-.TP
-.B \-dvdangle <angle ID> (DVD only)
-Some DVD discs contain scenes that can be viewed from multiple angles.
-Here you can tell MPlayer which angles to use (default: 1).
-.
-.TP
-.B \-edl <filename>
-Enables edit decision list (EDL) actions during playback.
-Video will be skipped over and audio will be muted and unmuted according to
-the entries in the given file.
-See http://www.mplayerhq.hu/\:DOCS/\:HTML/\:en/\:edl.html for details
-on how to use this.
-.
-.TP
-.B \-endpos <[[hh:]mm:]ss[.ms]> (also see \-ss and \-sb)
-Stop at given time.
-.br
-.I NOTE:
-When used in conjunction with \-ss option, \-endpos time will shift forward by
-seconds specified with \-ss.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-endpos 56"
-Stop at 56 seconds.
-.IPs "\-endpos 01:10:00"
-Stop at 1 hour 10 minutes.
-.IPs "\-ss 10 \-endpos 56"
-Stop at 1 minute 6 seconds.
-.RE
-.PD 1
-.
-.TP
-.B \-forceidx
-Force index rebuilding.
-Useful for files with broken index (A/V desync, etc).
-This will enable seeking in files where seeking was not possible.
-.br
-.I NOTE:
-This option only works if the underlying media supports seeking
-(i.e.\& not with stdin, pipe, etc).
-.
-.TP
-.B \-fps <float value>
-Override video framerate.
-Useful if the original value is wrong or missing.
-.
-.TP
-.B \-frames <number>
-Play/\:convert only first <number> frames, then quit.
-.
-.TP
-.B \-hr\-mp3\-seek (MP3 only)
-Hi-res MP3 seeking.
-Enabled when playing from an external MP3 file, as we need to seek
-to the very exact position to keep A/V sync.
-Can be slow especially when seeking backwards since it has to rewind
-to the beginning to find an exact frame position.
-.
-.TP
-.B \-http-header-fields <field1,field2>
-Set custom HTTP fields when accessing HTTP stream.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs
-mplayer \-http\-header\-fields 'Field1: value1','Field2: value2' http://localhost:1234
-.br
-Will generate HTTP request:
-.RSss
-.br
-GET / HTTP/1.0
-.br
-Host: localhost:1234
-.br
-User-Agent: MPlayer
-.br
-Icy-MetaData: 1
-.br
-Field1: value1
-.br
-Field2: value2
-.br
-Connection: close
-.REss
-.RE
-.
-.TP
-.B \-idx (also see \-forceidx)
-Rebuilds index of files if no index was found, allowing seeking.
-Useful with broken/\:incomplete downloads, or badly created files.
-.br
-.I NOTE:
-This option only works if the underlying media supports seeking
-(i.e.\& not with stdin, pipe, etc).
-.
-.TP
-.B \-noidx
-Skip rebuilding index file.
-.
-.TP
-.B \-ipv4\-only\-proxy (network only)
-Skip the proxy for IPv6 addresses.
-It will still be used for IPv4 connections.
-.
-.TP
-.B \-lavfdopts <option1:option2:...>
-Specify parameters for libavformat demuxers (\-demuxer lavf).
-Separate multiple options with a colon.
-.sp
-.RS
-Available suboptions are:
-.RE
-.RSs
-.IPs analyzeduration=<value>
-Maximum length in seconds to analyze the stream properties.
-.IPs format=<value>
-Force a specific libavformat demuxer.
-.IPs o=<key>=<value>[,<key>=<value>[,...]]
-Pass AVOptions to libavformat demuxer.
-Note, a patch to make the o= unneeded and pass all unknown options through
-the AVOption system is welcome.
-A full list of AVOptions can be found in the FFmpeg manual.
-Note that some options may conflict with MPlayer options.
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.PD 0
-.IPs o=fflags=+ignidx
-.PD 1
-.RE
-.IPs probesize=<value>
-Maximum amount of data to probe during the detection phase.
-In the case of MPEG-TS this value identifies the maximum number
-of TS packets to scan.
-.IPs cryptokey=<hexstring>
-Encryption key the demuxer should use.
-This is the raw binary data of the key converted to a hexadecimal string.
-.RE
-.
-.TP
-.B \-loadidx <index file>
-The file from which to read the video index data saved by \-saveidx.
-This index will be used for seeking, overriding any index data
-contained in the AVI itself.
-MPlayer will not prevent you from loading an index file generated
-from a different AVI, but this is sure to cause unfavorable results.
-.br
-.I NOTE:
-This option is obsolete now that MPlayer has OpenDML support.
-.
-.TP
-.B \-mc <seconds/frame>
-maximum A-V sync correction per frame (in seconds)
-.
-.TP
-.B \-mf <option1:option2:...>
-Used when decoding from multiple PNG or JPEG files.
-.sp 1
-Available options are:
-.sp 1
-.PD 0
-.RSs
-.IPs w=<value>
-input file width (default: autodetect)
-.IPs h=<value>
-input file height (default: autodetect)
-.IPs fps=<value>
-output fps (default: 25)
-.IPs type=<value>
-input file type (available: jpeg, png, tga, sgi)
-.RE
-.PD 1
-.
-.TP
-.B \-ni (AVI only)
-Force usage of non-interleaved AVI parser (fixes playback
-of some bad AVI files).
-.
-.TP
-.B \-nobps (AVI only)
-Do not use average byte/\:second value for A-V sync.
-Helps with some AVI files with broken header.
-.
-.TP
-.B \-noextbased
-Disables extension-based demuxer selection.
-By default, when the file type (demuxer) cannot be detected reliably
-(the file has no header or it is not reliable enough), the filename
-extension is used to select the demuxer.
-Always falls back on content-based demuxer selection.
-.
-.TP
-.B \-passwd <password> (also see \-user) (network only)
-Specify password for HTTP authentication.
-.
-.TP
-.B \-prefer\-ipv4 (network only)
-Use IPv4 on network connections.
-Falls back on IPv6 automatically.
-.
-.TP
-.B \-prefer\-ipv6 (IPv6 network only)
-Use IPv6 on network connections.
-Falls back on IPv4 automatically.
-.
-.TP
-.B \-psprobe <byte position>
-When playing an MPEG-PS or MPEG-PES streams, this option lets you specify
-how many bytes in the stream you want MPlayer to scan in order to identify
-the video codec used.
-This option is needed to play EVO or VDR files containing H.264 streams.
-.
-.TP
-.B \-pvr <option1:option2:...> (PVR only)
-This option tunes various encoding properties of the PVR capture module.
-It has to be used with any hardware MPEG encoder based card supported by the
-V4L2 driver.
-The Hauppauge WinTV PVR\-150/250/350/500 and all IVTV based
-cards are known as PVR capture cards.
-Be aware that only Linux 2.6.18 kernel
-and above is able to handle MPEG stream through V4L2 layer.
-For hardware capture of an MPEG stream and watching it with
-MPlayer, use 'pvr://' as a movie URL.
-.sp 1
-Available options are:
-.RSs
-.IPs aspect=<0\-3>
-Specify input aspect ratio:
-.RSss
-0: 1:1
-.br
-1: 4:3 (default)
-.br
-2: 16:9
-.br
-3: 2.21:1
-.REss
-.IPs arate=<32000\-48000>
-Specify encoding audio rate (default: 48000 Hz, available: 32000, 44100
-and 48000 Hz).
-.IPs alayer=<1\-3>
-Specify MPEG audio layer encoding (default: 2).
-.IPs abitrate=<32\-448>
-Specify audio encoding bitrate in kbps (default: 384).
-.IPs amode=<value>
-Specify audio encoding mode.
-Available preset values are 'stereo', 'joint_stereo', 'dual' and 'mono' (default: stereo).
-.IPs vbitrate=<value>
-Specify average video bitrate encoding in Mbps (default: 6).
-.IPs vmode=<value>
-Specify video encoding mode:
-.RSss
-vbr: Variable BitRate (default)
-.br
-cbr: Constant BitRate
-.REss
-.IPs vpeak=<value>
-Specify peak video bitrate encoding in Mbps
-(only useful for VBR encoding, default: 9.6).
-.IPs fmt=<value>
-Choose an MPEG format for encoding:
-.RSss
-ps: MPEG-2 Program Stream (default)
-.br
-ts: MPEG-2 Transport Stream
-.br
-mpeg1: MPEG-1 System Stream
-.br
-vcd: Video CD compatible stream
-.br
-svcd: Super Video CD compatible stream
-.br
-dvd: DVD compatible stream
-.REss
-.RE
-.PD 1
-.
-.TP
-.B \-radio <option1:option2:...> (radio only)
-These options set various parameters of the radio capture module.
-For listening to radio with MPlayer use 'radio://<frequency>'
-(if channels option is not given) or 'radio://<channel_number>'
-(if channels option is given) as a movie URL.
-You can see allowed frequency range by running MPlayer with '\-v'.
-To start the grabbing subsystem, use 'radio://<frequency or channel>/capture'.
-If the capture keyword is not given you can listen to radio
-using the line-in cable only.
-Using capture to listen is not recommended due to synchronization
-problems, which makes this process uncomfortable.
-.sp 1
-Available options are:
-.RSs
-.IPs device=<value>
-Radio device to use (default: /dev/radio0 for Linux and /dev/tuner0 for *BSD).
-.IPs driver=<value>
-Radio driver to use (default: v4l2 if available, otherwise v4l).
-Currently, v4l and v4l2 drivers are supported.
-.IPs volume=<0..100>
-sound volume for radio device (default 100)
-.IPs "freq_min=<value> (*BSD BT848 only)"
-minimum allowed frequency (default: 87.50)
-.IPs "freq_max=<value> (*BSD BT848 only)"
-maximum allowed frequency (default: 108.00)
-.IPs channels=<frequency>\-<name>,<frequency>\-<name>,...
-Set channel list.
-Use _ for spaces in names (or play with quoting ;-).
-The channel names will then be written using OSD and the slave commands
-radio_step_channel and radio_set_channel will be usable for
-a remote control (see LIRC).
-If given, number in movie URL will be treated as channel position in
-channel list.
-.br
-.I EXAMPLE:
-radio://1, radio://104.4, radio_set_channel 1
-.IPs "adevice=<value> (radio capture only)"
-Name of device to capture sound from.
-Without such a name capture will be disabled,
-even if the capture keyword appears in the URL.
-For ALSA devices use it in the form hw=<card>.<device>.
-If the device name contains a '=', the module will use
-ALSA to capture, otherwise OSS.
-.IPs "arate=<value> (radio capture only)"
-Rate in samples per second (default: 44100).
-.br
-.I NOTE:
-When using audio capture set also \-rawaudio rate=<value> option
-with the same value as arate.
-If you have problems with sound speed (runs too quickly), try to play
-with different rate values (e.g.\& 48000,44100,32000,...).
-.IPs "achannels=<value> (radio capture only)"
-Number of audio channels to capture.
-.RE
-.
-.TP
-.B \-rawaudio <option1:option2:...>
-This option lets you play raw audio files.
-You have to use \-demuxer rawaudio as well.
-It may also be used to play audio CDs which are not 44kHz 16-bit stereo.
-For playing raw AC-3 streams use \-rawaudio format=0x2000 \-demuxer rawaudio.
-.sp 1
-Available options are:
-.sp 1
-.PD 0
-.RSs
-.IPs channels=<value>
-number of channels
-.IPs rate=<value>
-rate in samples per second
-.IPs samplesize=<value>
-sample size in bytes
-.IPs bitrate=<value>
-bitrate for rawaudio files
-.IPs format=<value>
-fourcc in hex
-.RE
-.PD 1
-.
-.TP
-.B \-rawvideo <option1:option2:...>
-This option lets you play raw video files.
-You have to use \-demuxer rawvideo as well.
-.sp 1
-Available options are:
-.sp 1
-.PD 0
-.RSs
-.IPs fps=<value>
-rate in frames per second (default: 25.0)
-.IPs sqcif|qcif|cif|4cif|pal|ntsc
-set standard image size
-.IPs w=<value>
-image width in pixels
-.IPs h=<value>
-image height in pixels
-.IPs i420|yv12|yuy2|y8
-set colorspace
-.IPs format=<value>
-colorspace (fourcc) in hex or string constant.
-Use \-rawvideo format=help for a list of possible strings.
-.IPs size=<value>
-frame size in Bytes
-.REss
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-.IPs "mplayer foreman.qcif -demuxer rawvideo -rawvideo qcif"
-Play the famous "foreman" sample video.
-.IPs "mplayer sample-720x576.yuv -demuxer rawvideo -rawvideo w=720:h=576"
-Play a raw YUV sample.
-.RE
-.PD 1
-.
-.TP
-.B \-referrer <string> (network only)
-Specify a referrer path or URL for HTTP requests.
-.
-.TP
-.B \-rtsp\-port
-Used with 'rtsp://' URLs to force the client's port number.
-This option may be useful if you are behind a router and want to forward
-the RTSP stream from the server to a specific client.
-.
-.TP
-.B \-rtsp\-destination
-Used with 'rtsp://' URLs to force the destination IP address to be bound.
-This option may be useful with some RTSP server which do not
-send RTP packets to the right interface.
-If the connection to the RTSP server fails, use \-v to see
-which IP address MPlayer tries to bind to and try to force
-it to one assigned to your computer instead.
-.
-.TP
-.B \-rtsp\-stream\-over\-tcp (LIVE555 and NEMESI only)
-Used with 'rtsp://' URLs to specify that the resulting incoming RTP and RTCP
-packets be streamed over TCP (using the same TCP connection as RTSP).
-This option may be useful if you have a broken internet connection that does
-not pass incoming UDP packets (see http://www.live555.com/\:mplayer/).
-.
-.TP
-.B \-rtsp\-stream\-over\-http (LIVE555 only)
-Used with 'http://' URLs to specify that the resulting incoming RTP and RTCP
-packets be streamed over HTTP.
-.
-.TP
-.B \-saveidx <filename>
-Force index rebuilding and dump the index to <filename>.
-Currently this only works with AVI files.
-.br
-.I NOTE:
-This option is obsolete now that MPlayer has OpenDML support.
-.
-.TP
-.B \-sb <byte position> (also see \-ss)
-Seek to byte position.
-Useful for playback from CD-ROM images or VOB files with junk at the beginning.
-.
-.TP
-.B \-speed <0.01\-100>
-Slow down or speed up playback by the factor given as parameter.
-.
-.TP
-.B \-srate <Hz>
-Select the output sample rate to be used
-(of course sound cards have limits on this).
-If the sample frequency selected is different from that
-of the current media, the resample or lavcresample audio filter will be inserted
-into the audio filter layer to compensate for the difference.
-The type of resampling can be controlled by the \-af\-adv option.
-The default is fast resampling that may cause distortion.
-.
-.TP
-.B \-ss <time> (also see \-sb)
-Seek to given time position.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-ss 56"
-Seeks to 56 seconds.
-.IPs "\-ss 01:10:00"
-Seeks to 1 hour 10 min.
-.RE
-.PD 1
-.
-.TP
-.B \-tskeepbroken
-Tells MPlayer not to discard TS packets reported as broken in the stream.
-Sometimes needed to play corrupted MPEG-TS files.
-.
-.TP
-.B \-tsprobe <byte position>
-When playing an MPEG-TS stream, this option lets you specify how many
-bytes in the stream you want MPlayer to search for the desired
-audio and video IDs.
-.
-.TP
-.B \-tsprog <1\-65534>
-When playing an MPEG-TS stream, you can specify with this option which
-program (if present) you want to play.
-Can be used with \-vid and \-aid.
-.
-.TP
-.B \-tv <option1:option2:...> (TV/\:PVR only)
-This option tunes various properties of the TV capture module.
-For watching TV with MPlayer, use 'tv://' or 'tv://<channel_number>'
-or even 'tv://<channel_name> (see option channels for channel_name below)
-as a movie URL.
-You can also use 'tv:///<input_id>' to start watching a
-movie from a composite or S-Video input (see option input for details).
-.sp 1
-Available options are:
-.RSs
-.IPs noaudio
-no sound
-.IPs "automute=<0\-255> (v4l and v4l2 only)"
-If signal strength reported by device is less than this value,
-audio and video will be muted.
-In most cases automute=100 will be enough.
-Default is 0 (automute disabled).
-.IPs driver=<value>
-See \-tv driver=help for a list of compiled-in TV input drivers.
-available: dummy, v4l, v4l2, bsdbt848 (default: autodetect)
-.IPs device=<value>
-Specify TV device (default: /dev/\:video0).
-.I NOTE:
-For the bsdbt848 driver you can provide both bktr and tuner device
-names separating them with a comma, tuner after
-bktr (e.g.\& -tv device=/dev/bktr1,/dev/tuner1).
-.IPs input=<value>
-Specify input (default: 0 (TV), see console output for available inputs).
-.IPs freq=<value>
-Specify the frequency to set the tuner to (e.g.\& 511.250).
-Not compatible with the channels parameter.
-.IPs outfmt=<value>
-Specify the output format of the tuner with a preset value supported by the
-V4L driver (yv12, rgb32, rgb24, rgb16, rgb15, uyvy, yuy2, i420) or an
-arbitrary format given as hex value.
-Try outfmt=help for a list of all available formats.
-.IPs width=<value>
-output window width
-.IPs height=<value>
-output window height
-.IPs fps=<value>
-framerate at which to capture video (frames per second)
-.IPs buffersize=<value>
-maximum size of the capture buffer in megabytes (default: dynamical)
-.IPs norm=<value>
-For bsdbt848 and v4l, PAL, SECAM, NTSC are available.
-For v4l2, see the console output for a list of all available norms,
-also see the normid option below.
-.IPs "normid=<value> (v4l2 only)"
-Sets the TV norm to the given numeric ID.
-The TV norm depends on the capture card.
-See the console output for a list of available TV norms.
-.IPs channel=<value>
-Set tuner to <value> channel.
-.IPs chanlist=<value>
-available: argentina, australia, china-bcast, europe-east, europe-west, france,
-ireland, italy, japan-bcast, japan-cable, newzealand, russia, southafrica,
-us-bcast, us-cable, us-cable-hrc
-.IPs channels=<chan>\-<name>[=<norm>],<chan>\-<name>[=<norm>],...
-Set names for channels.
-.I NOTE:
-If <chan> is an integer greater than 1000, it will be treated as frequency (in kHz)
-rather than channel name from frequency table.
-.br
-Use _ for spaces in names (or play with quoting ;-).
-The channel names will then be written using OSD, and the slave commands
-tv_step_channel, tv_set_channel and tv_last_channel will be usable for
-a remote control (see LIRC).
-Not compatible with the frequency parameter.
-.br
-.I NOTE:
-The channel number will then be the position in the 'channels' list,
-beginning with 1.
-.br
-.I EXAMPLE:
-tv://1, tv://TV1, tv_set_channel 1, tv_set_channel TV1
-.IPs [brightness|contrast|hue|saturation]=<\-100\-100>
-Set the image equalizer on the card.
-.IPs audiorate=<value>
-Set input audio sample rate.
-.IPs forceaudio
-Capture audio even if there are no audio sources reported by v4l.
-.IPs "alsa\ "
-Capture from ALSA.
-.IPs amode=<0\-3>
-Choose an audio mode:
-.RSss
-0: mono
-.br
-1: stereo
-.br
-2: language 1
-.br
-3: language 2
-.REss
-.IPs forcechan=<1\-2>
-By default, the count of recorded audio channels is determined automatically
-by querying the audio mode from the TV card.
-This option allows forcing stereo/\:mono recording regardless of the amode
-option and the values returned by v4l.
-This can be used for troubleshooting when the TV card is unable to report the
-current audio mode.
-.IPs adevice=<value>
-Set an audio device.
-<value> should be /dev/\:xxx for OSS and a hardware ID for ALSA.
-You must replace any ':' by a '.' in the hardware ID for ALSA.
-.IPs audioid=<value>
-Choose an audio output of the capture card, if it has more than one.
-.IPs "[volume|bass|treble|balance]=<0\-65535> (v4l1)"
-.IPs "[volume|bass|treble|balance]=<0\-100> (v4l2)"
-These options set parameters of the mixer on the video capture card.
-They will have no effect, if your card does not have one.
-For v4l2 50 maps to the default value of the
-control, as reported by the driver.
-.IPs "gain=<0\-100> (v4l2)"
-Set gain control for video devices (usually webcams) to the desired
-value and switch off automatic control.
-A value of 0 enables automatic control.
-If this option is omitted, gain control will not be modified.
-.IPs immediatemode=<bool>
-A value of 0 means capture and buffer audio and video together.
-A value of 1 (default) means to do video capture only and let the
-audio go through a loopback cable from the TV card to the sound card.
-.IPs mjpeg
-Use hardware MJPEG compression (if the card supports it).
-When using this option, you do not need to specify the width and height
-of the output window, because MPlayer will determine it automatically
-from the decimation value (see below).
-.IPs decimation=<1|2|4>
-choose the size of the picture that will be compressed by hardware
-MJPEG compression:
-.RSss
-1: full size
- 704x576 PAL
- 704x480 NTSC
-.br
-2: medium size
- 352x288 PAL
- 352x240 NTSC
-.br
-4: small size
- 176x144 PAL
- 176x120 NTSC
-.REss
-.IPs quality=<0\-100>
-Choose the quality of the JPEG compression
-(< 60 recommended for full size).
-.IPs tdevice=<value>
-Specify TV teletext device (example: /dev/\:vbi0) (default: none).
-.IPs tformat=<format>
-Specify TV teletext display format (default: 0):
-.RSss
-0: opaque
-.br
-1: transparent
-.br
-2: opaque with inverted colors
-.br
-3: transparent with inverted colors
-.REss
-.IPs tpage=<100\-899>
-Specify initial TV teletext page number (default: 100).
-.IPs tlang=<\-1\-127>
-Specify default teletext language code (default: 0), which will be used
-as primary language until a type 28 packet is received.
-Useful when the teletext system uses a non-latin character set, but language
-codes are not transmitted via teletext type 28 packets for some reason.
-To see a list of supported language codes set this option to \-1.
-.IPs "hidden_video_renderer (dshow only)"
-Terminate stream with video renderer instead of Null renderer (default: off).
-Will help if video freezes but audio does not.
-.I NOTE:
-May not work with \-vo directx and \-vf crop combination.
-.IPs "hidden_vp_renderer (dshow only)"
-Terminate VideoPort pin stream with video renderer
-instead of removing it from the graph (default: off).
-Useful if your card has a VideoPort pin and video is choppy.
-.I NOTE:
-May not work with \-vo directx and \-vf crop combination.
-.IPs "system_clock (dshow only)"
-Use the system clock as sync source instead of the default graph clock
-(usually the clock from one of the live sources in graph).
-.IPs "normalize_audio_chunks (dshow only)"
-Create audio chunks with a time length equal to
-video frame time length (default: off).
-Some audio cards create audio chunks about 0.5s in size, resulting in
-choppy video when using immediatemode=0.
-.RE
-.
-.TP
-.B \-tvscan <option1:option2:...> (TV only)
-Tune the TV channel scanner.
-MPlayer will also print value for "-tv channels=" option,
-including existing and just found channels.
-.sp 1
-Available suboptions are:
-.RSs
-.IPs autostart
-Begin channel scanning immediately after startup (default: disabled).
-.IPs period=<0.1\-2.0>
-Specify delay in seconds before switching to next channel (default: 0.5).
-Lower values will cause faster scanning, but can detect
-inactive TV channels as active.
-.IPs threshold=<1\-100>
-Threshold value for the signal strength (in percent), as reported
-by the device (default: 50).
-A signal strength higher than this value will indicate that the
-currently scanning channel is active.
-.RE
-.
-.TP
-.B \-user <username> (also see \-passwd) (network only)
-Specify username for HTTP authentication.
-.
-.TP
-.B \-user\-agent <string>
-Use <string> as user agent for HTTP streaming.
-.
-.TP
-.B \-vid <ID>
-Select video channel (MPG: 0\-15, ASF: 0\-255, MPEG-TS: 17\-8190).
-When playing an MPEG-TS stream, MPlayer will use the first program (if present)
-with the chosen video stream.
-.
-.TP
-.B \-vivo <suboption> (DEBUG CODE)
-Force audio parameters for the VIVO demuxer (for debugging purposes).
-FIXME: Document this.
-.
-.
-.
-.SH "OSD/SUBTITLE OPTIONS"
-.I NOTE:
-Also see \-vf expand.
-.
-.TP
-.B \-ass, \-noass (FreeType only)
-Use libass to render all text subtitles.
-This enables support for the native styling of SSA/ASS subtitles,
-and also support for some styling features in other subtitle formats by
-conversion to ASS markup.
-Enabled by default if the player was compiled with libass support.
-.br
-.I NOTE:
-Some of the other subtitle options were written for the old non-libass
-subtitle rendering system and may not work the same way or at all with
-libass rendering enabled.
-.
-.TP
-.B \-ass\-border\-color <value>
-Sets the border (outline) color for text subtitles.
-The color format is RRGGBBAA.
-.
-.TP
-.B \-ass\-bottom\-margin <value>
-Adds a black band at the bottom of the frame.
-The SSA/ASS renderer can place subtitles there (with \-ass\-use\-margins).
-.
-.TP
-.B \-ass\-color <value>
-Sets the color for text subtitles.
-The color format is RRGGBBAA.
-.
-.TP
-.B \-ass\-font\-scale <value>
-Set the scale coefficient to be used for fonts in the SSA/ASS renderer.
-.
-.TP
-.B \-ass\-force\-style <[Style.]Param=Value[,...]>
-Override some style or script info parameters.
-.sp
-.I EXAMPLE:
-.PD 0
-.RSs
-\-ass\-force\-style FontName=Arial,Default.Bold=1
-.br
-\-ass\-force\-style PlayResY=768
-.RE
-.PD 1
-.
-.TP
-.B \-ass\-hinting <type>
-Set hinting type.
-<type> can be:
-.PD 0
-.RSs
-.IPs 0
-no hinting
-.IPs 1
-FreeType autohinter, light mode
-.IPs 2
-FreeType autohinter, normal mode
-.IPs 3
-font native hinter
-.IPs "0-3 + 4"
-The same, but hinting will only be performed if the OSD is rendered at
-screen resolution and will therefore not be scaled.
-.RE
-.RSs
-The default value is 5 (use light hinter for unscaled OSD and no hinting otherwise).
-.RE
-.PD 1
-.
-.TP
-.B \-ass\-line\-spacing <value>
-Set line spacing value for SSA/ASS renderer.
-.
-.TP
-.B \-ass\-styles <filename>
-Load all SSA/ASS styles found in the specified file and use them for
-rendering text subtitles.
-The syntax of the file is exactly like the
-[V4 Styles] / [V4+ Styles] section of SSA/ASS.
-.
-.TP
-.B \-ass\-top\-margin <value>
-Adds a black band at the top of the frame.
-The SSA/ASS renderer can place toptitles there (with \-ass\-use\-margins).
-.
-.TP
-.B \-ass\-use\-margins
-Enables placing toptitles and subtitles in black borders when they
-are available.
-.
-.TP
-.B \-ass\-vsfilter\-aspect\-compat
-Stretch SSA/ASS subtitles when playing anamorphic videos for compatibility
-with traditional VSFilter behavior.
-This switch has no effect when the video is stored with square pixels.
-.sp 1
-The renderer historically most commonly used for the SSA/ASS subtitle formats,
-VSFilter, had questionable behavior that resulted in subtitles being
-stretched too if the video was stored in anamorphic format that required
-scaling for display.
-This behavior is usually undesirable and newer VSFilter versions may
-behave differently.
-However, many existing scripts compensate for the stretching by modifying
-things in the opposite direction.
-Thus if such scripts are displayed "correctly" they will not appear as intended.
-This switch enables emulation of the old VSFilter behavior (undesirable but
-expected by many existing scripts).
-Enabled by default.
-.
-.TP
-.B \-dumpjacosub
-Convert the given subtitle (specified with the \-sub option) to the time-based
-JACOsub subtitle format.
-Creates a dumpsub.js file in the current directory.
-.
-.TP
-.B \-dumpmicrodvdsub
-Convert the given subtitle (specified with the \-sub option) to the
-MicroDVD subtitle format.
-Creates a dumpsub.sub file in the current directory.
-.
-.TP
-.B \-dumpmpsub
-Convert the given subtitle (specified with the \-sub option) to MPlayer's
-subtitle format, MPsub.
-Creates a dump.mpsub file in the current directory.
-.
-.TP
-.B \-dumpsami
-Convert the given subtitle (specified with the \-sub option) to the time-based
-SAMI subtitle format.
-Creates a dumpsub.smi file in the current directory.
-.
-.TP
-.B \-dumpsrtsub
-Convert the given subtitle (specified with the \-sub option) to the time-based
-SubViewer (SRT) subtitle format.
-Creates a dumpsub.srt file in the current directory.
-.br
-.I NOTE:
-Some broken hardware players choke on SRT subtitle files with Unix
-line endings.
-If you are unlucky enough to have such a box, pass your subtitle
-files through unix2dos or a similar program to replace Unix line
-endings with DOS/Windows line endings.
-.
-.TP
-.B \-dumpsub (BETA CODE)
-Dumps the subtitle substream from VOB streams.
-Also see the \-dump*sub options.
-.
-.TP
-.B \-noembeddedfonts
-Disables use of fonts embedded in Matroska containers and ASS scripts (default: enabled).
-These fonts can be used for SSA/ASS subtitle
-rendering (\-ass option).
-.
-.TP
-.B \-ffactor <number>
-Resample the font alphamap.
-Can be:
-.PD 0
-.RSs
-.IPs 0
-plain white fonts
-.IPs 0.75
-very narrow black outline (default)
-.IPs 1
-narrow black outline
-.IPs 10
-bold black outline
-.RE
-.PD 1
-.
-.TP
-.B \-flip\-hebrew (FriBiDi only)
-Turns on flipping subtitles using FriBiDi.
-.
-.TP
-.B \-noflip\-hebrew\-commas
-Change FriBiDi's assumptions about the placements of commas in subtitles.
-Use this if commas in subtitles are shown at the start of a sentence
-instead of at the end.
-.
-.TP
-.B \-font <path to font.desc file, path to font (FreeType), font pattern (Fontconfig)>
-Search for the OSD/\:SUB fonts in an alternative directory (default for normal
-fonts: ~/\:.mplayer/\:font/\:font.desc, default for FreeType fonts:
-~/.mplayer/\:subfont.ttf).
-.br
-.I NOTE:
-With FreeType, this option determines the path to the text font file.
-With Fontconfig, this option determines the Fontconfig font pattern.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-font ~/\:.mplayer/\:arial-14/\:font.desc
-.br
-\-font ~/\:.mplayer/\:arialuni.ttf
-.br
-\-font 'Bitstream Vera Sans'
-.br
-\-font 'Bitstream Vera Sans:style=Bold'
-.RE
-.PD 1
-.
-.TP
-.B \-fontconfig, \-nofontconfig (fontconfig only)
-Enables the use of fontconfig managed fonts. Enabled by default.
-.
-.TP
-.B \-forcedsubsonly
-Display only forced subtitles for the DVD subtitle stream selected by e.g.\&
-\-slang.
-.
-.TP
-.B \-fribidi\-charset <charset name> (FriBiDi only)
-Specifies the character set that will be passed to FriBiDi when
-decoding non-UTF-8 subtitles (default: ISO8859-8).
-.
-.TP
-.B \-ifo <VOBsub IFO file>
-Indicate the file that will be used to load palette and frame size for VOBsub
-subtitles.
-.
-.TP
-.B \-noautosub
-Turns off automatic subtitle file loading.
-.
-.TP
-.B \-osd\-duration <time>
-Set the duration of the OSD messages in ms (default: 1000).
-.
-.TP
-.B \-osd\-fractions <0\-2>
-Set how fractions of seconds of the current timestamp are printed on the OSD:
-.PD 0
-.RSs
-.IPs 0
-Do not display fractions (default).
-.IPs 1
-Show the first two decimals.
-.IPs 2
-Show approximate frame count within current second.
-This frame count is not accurate but only an approximation.
-For variable fps, the approximation is known to be far off the correct frame
-count.
-.RE
-.PD 1
-.
-.TP
-.B \-osdlevel <0\-3>
-Specifies which mode the OSD should start in.
-.PD 0
-.RSs
-.IPs 0
-subtitles only
-.IPs 1
-volume + seek (default)
-.IPs 2
-volume + seek + timer + percentage
-.IPs 3
-volume + seek + timer + percentage + total time
-.RE
-.PD 1
-.
-.TP
-.B \-overlapsub
-Allows the next subtitle to be displayed while the current one is
-still visible (default is to enable the support only for specific
-formats).
-.
-.TP
-.B \-sid <ID> (also see \-slang, \-vobsubid)
-Display the subtitle stream specified by <ID> (0\-31).
-MPlayer prints the available subtitle IDs when run in verbose (\-v) mode.
-If you cannot select one of the subtitles on a DVD, also try \-vobsubid.
-.
-.TP
-.B \-nosub
-Disables any otherwise auto-selected internal subtitles (as e.g.\& the Matroska/mkv
-demuxer supports).
-Use \-noautosub to disable the loading of external subtitle files.
-.
-.TP
-.B \-slang <language code[,language code,...]> (also see \-sid)
-Specify a priority list of subtitle languages to use.
-Different container formats employ different language codes.
-DVDs use ISO 639-1 two letter language codes, Matroska uses ISO 639-2
-three letter language codes while OGM uses a free-form identifier.
-MPlayer prints the available languages when run in verbose (\-v) mode.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "mplayer dvd://1 \-slang hu,en"
-Chooses the Hungarian subtitle track on a DVD and falls back on English if
-Hungarian is not available.
-.IPs "mplayer \-slang jpn example.mkv"
-Plays a Matroska file with Japanese subtitles.
-.RE
-.PD 1
-.
-.TP
-.B \-spuaa <mode>
-Antialiasing/\:scaling mode for DVD/\:VOBsub.
-A value of 16 may be added to <mode> in order to force scaling even
-when original and scaled frame size already match.
-This can be employed to e.g.\& smooth subtitles with gaussian blur.
-Available modes are:
-.PD 0
-.RSs
-.IPs 0
-none (fastest, very ugly)
-.IPs 1
-approximate (broken?)
-.IPs 2
-full (slow)
-.IPs 3
-bilinear (default, fast and not too bad)
-.IPs 4
-uses swscaler gaussian blur (looks very good)
-.RE
-.PD 1
-.
-.TP
-.B \-spualign <\-1\-2>
-Specify how SPU (DVD/\:VOBsub) subtitles should be aligned.
-.PD 0
-.RSs
-.IPs "\-1"
-original position
-.IPs " 0"
-Align at top (original behavior, default).
-.IPs " 1"
-Align at center.
-.IPs " 2"
-Align at bottom.
-.RE
-.PD 1
-.
-.TP
-.B \-spugauss <0.0\-3.0>
-Variance parameter of gaussian used by \-spuaa 4.
-Higher means more blur (default: 1.0).
-.
-.TP
-.B \-sub <subtitlefile1,subtitlefile2,...>
-Use/\:display these subtitle files.
-Only one file can be displayed at the same time.
-.
-.TP
-.B \-sub\-bg\-alpha <0\-255>
-Specify the alpha channel value for subtitles and OSD backgrounds.
-Big values mean more transparency.
-0 means completely transparent.
-.
-.TP
-.B \-sub\-bg\-color <0\-255>
-Specify the color value for subtitles and OSD backgrounds.
-Currently subtitles are grayscale so this value is equivalent to the
-intensity of the color.
-255 means white and 0 black.
-.
-.TP
-.B \-sub\-demuxer <[+]name> (\-subfile only) (BETA CODE)
-Force subtitle demuxer type for \-subfile.
-Use a '+' before the name to force it, this will skip some checks!
-Give the demuxer name as printed by \-sub\-demuxer help.
-.
-.TP
-.B \-sub\-fuzziness <mode>
-Adjust matching fuzziness when searching for subtitles:
-.PD 0
-.RSs
-.IPs 0
-exact match
-.IPs 1
-Load all subs containing movie name.
-.IPs 2
-Load all subs in the current and \-sub\-paths directories.
-.RE
-.PD 1
-.
-.TP
-.B \-sub\-no\-text\-pp
-Disables any kind of text post processing done after loading the subtitles.
-Used for debug purposes.
-.
-.TP
-.B \-subalign <0\-2>
-Specify which edge of the subtitles should be aligned at the height
-given by \-subpos.
-.PD 0
-.RSs
-.IPs 0
-Align subtitle top edge (original behavior).
-.IPs 1
-Align subtitle center.
-.IPs 2
-Align subtitle bottom edge (default).
-.RE
-.PD 1
-.
-.TP
-.B "\-subcc <1\-4>\ "
-Display DVD Closed Caption (CC) subtitles from the specified channel.
-These are
-.B not
-the VOB subtitles, these are special ASCII subtitles for the
-hearing impaired encoded in the VOB userdata stream on most region 1 DVDs.
-CC subtitles have not been spotted on DVDs from other regions so far.
-.
-.TP
-.B \-subcp <codepage> (iconv only)
-If your system supports iconv(3), you can use this option to
-specify the subtitle codepage.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-subcp latin2
-.br
-\-subcp cp1250
-.RE
-.PD 1
-.
-.TP
-.B \-subcp enca:<language>:<fallback codepage> (ENCA only)
-You can specify your language using a two letter language code to
-make ENCA detect the codepage automatically.
-If unsure, enter anything and watch mplayer \-v output for available
-languages.
-Fallback codepage specifies the codepage to use, when autodetection fails.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-subcp enca:cs:latin2"
-Guess the encoding, assuming the subtitles are Czech, fall back on
-latin 2, if the detection fails.
-.IPs "\-subcp enca:pl:cp1250"
-Guess the encoding for Polish, fall back on cp1250.
-.RE
-.PD 1
-.
-.TP
-.B \-sub\-paths <path1:path2:...>
-Specify extra directories where to search for subtitles matching the video.
-Multiple directories can be separated by ":" (";" on Windows).
-Paths can be relative or absolute.
-Relative paths are interpreted relative to video file directory.
-
-.sp 1
-.I EXAMPLE:
-Assuming that /path/\:to/\:movie/\:movie.avi is played and \-sub\-paths
-sub:subtitles:/tmp/subs is specified, MPlayer searches for subtitle files in
-these directories:
-.RSs
-/path/\:to/\:movie/
-.br
-/path/\:to/\:movie/\:sub/
-.br
-/path/\:to/\:movie/\:subtitles/
-.br
-/tmp/\:subs/
-.br
-~/.mplayer/\:sub/
-.RE
-.PD 1
-.
-.TP
-.B \-subdelay <sec>
-Delays subtitles by <sec> seconds.
-Can be negative.
-.
-.TP
-.B \-subfile <filename> (BETA CODE)
-Currently useless.
-Same as \-audiofile, but for subtitle streams (OggDS?).
-.
-.TP
-.B \-subfont <path to font (FreeType), font pattern (Fontconfig)> (FreeType only)
-Sets the subtitle font (see \-font).
-If no \-subfont is given, \-font is used.
-.
-.TP
-.B \-subfont\-autoscale <0\-3> (FreeType only)
-Sets the autoscale mode.
-.br
-.I NOTE:
-0 means that text scale and OSD scale are font heights in points.
-.sp 1
-The mode can be:
-.sp 1
-.PD 0
-.RSs
-.IPs 0
-no autoscale
-.IPs 1
-proportional to movie height
-.IPs 2
-proportional to movie width
-.IPs 3
-proportional to movie diagonal (default)
-.RE
-.PD 1
-.
-.TP
-.B \-subfont\-blur <0\-8> (FreeType only)
-Sets the font blur radius (default: 2).
-.
-.TP
-.B \-subfont\-encoding <value> (FreeType only)
-Sets the font encoding.
-When set to 'unicode', all the glyphs from the font file will be rendered and
-unicode will be used (default: unicode).
-.
-.TP
-.B \-subfont\-osd\-scale <0\-100> (FreeType only)
-Sets the autoscale coefficient of the OSD elements (default: 6).
-.
-.TP
-.B \-subfont\-outline <0\-8> (FreeType only)
-Sets the font outline thickness (default: 2).
-.
-.TP
-.B \-subfont\-text\-scale <0\-100> (FreeType only)
-Sets the subtitle text autoscale coefficient as percentage of the
-screen size (default: 5).
-.
-.TP
-.B \-subfps <rate>
-Specify the framerate of the subtitle file (default: movie fps).
-.br
-.I NOTE:
-<rate> > movie fps speeds the subtitles up for frame-based subtitle files and
-slows them down for time-based ones.
-.
-.TP
-.B \-subpos <0\-100> (useful with \-vf expand)
-Specify the position of subtitles on the screen.
-The value is the vertical position of the subtitle in % of the screen height.
-.
-.TP
-.B \-subwidth <10\-100>
-Specify the maximum width of subtitles on the screen.
-Useful for TV-out.
-The value is the width of the subtitle in % of the screen width.
-.
-.TP
-.B \-noterm\-osd
-Disable the display of OSD messages on the console when no video output is
-available.
-.
-.TP
-.B \-term\-osd\-esc <escape sequence>
-Specify the escape sequence to use before writing an OSD message on the
-console.
-The escape sequence should move the pointer to the beginning of the line
-used for the OSD and clear it (default: ^[[A\\r^[[K).
-.
-.TP
-.B \-unicode
-Tells MPlayer to handle the subtitle file as unicode.
-.
-.TP
-.B \-unrarexec <path to unrar executable> (not supported on MingW)
-Specify the path to the unrar executable so MPlayer can use it to access
-rar-compressed VOBsub files (default: not set, so the feature is off).
-The path must include the executable's filename, i.e.\& /usr/local/bin/unrar.
-.
-.TP
-.B "\-utf8 \ \ "
-Tells MPlayer to handle the subtitle file as UTF-8.
-.
-.TP
-.B \-vobsub <VOBsub file without extension>
-Specify a VOBsub file to use for subtitles.
-Has to be the full pathname without extension, i.e.\& without
-the '.idx', '.ifo' or '.sub'.
-.
-.TP
-.B \-vobsubid <0\-31>
-Specify the VOBsub subtitle ID.
-.
-.
-.
-.SH "AUDIO OUTPUT OPTIONS"
-.
-.TP
-.B \-abs <value> (\-ao oss only) (OBSOLETE)
-Override audio driver/\:card buffer size detection.
-.
-.TP
-.B \-format <format> (also see the format audio filter)
-Select the sample format used for output from the audio filter
-layer to the sound card.
-The values that <format> can adopt are listed below in the
-description of the format audio filter.
-.
-.TP
-.B \-gapless\-audio
-Try to play consecutive audio files with no silence or disruption
-at the point of file change.
-This feature is implemented in a simple manner and relies on audio output
-device buffering to continue playback while moving from one file to another.
-If playback of the new file starts slowly, for example because it's played from
-a remote network location or because you have specified cache settings that
-require time for the initial cache fill, then the buffered audio may run out
-before playback of the new file can start.
-.
-.TP
-.B \-mixer <device>
-Use a mixer device different from the default /dev/\:mixer.
-For ALSA this is the mixer name.
-.
-.TP
-.B \-mixer\-channel <mixer line>[,mixer index] (\-ao oss and \-ao alsa only)
-This option will tell MPlayer to use a different channel for controlling
-volume than the default PCM.
-Options for OSS include
-.B vol, pcm, line.
-For a complete list of options look for SOUND_DEVICE_NAMES in
-/usr/\:include/\:linux/\:soundcard.h.
-For ALSA you can use the names e.g.\& alsamixer displays, like
-.B Master, Line, PCM.
-.br
-.I NOTE:
-ALSA mixer channel names followed by a number must be specified in the
-<name,number> format, i.e.\& a channel labeled 'PCM 1' in alsamixer must
-be converted to
-.BR PCM,1 .
-.
-.TP
-.B \-softvol
-Force the use of the software mixer, instead of using the sound card
-mixer.
-.
-.TP
-.B \-softvol\-max <10.0\-10000.0>
-Set the maximum amplification level in percent (default: 110).
-A value of 200 will allow you to adjust the volume up to a maximum of
-double the current level.
-With values below 100 the initial volume (which is 100%) will be above
-the maximum, which e.g.\& the OSD cannot display correctly.
-.
-.TP
-.B \-volstep <0\-100>
-Set the step size of mixer volume changes in percent of the whole range
-(default: 3).
-.
-.TP
-.B \-volume <-1\-100> (also see \-af volume)
-Set the startup volume in the mixer, either hardware or software (if
-used with \-softvol).
-A value of -1 (the default) will not change the volume.
-.
-.
-.
-.SH "AUDIO OUTPUT DRIVERS"
-Audio output drivers are interfaces to different audio output facilities.
-The syntax is:
-.
-.TP
-.B \-ao <driver1[:suboption1[=value]:...],driver2,...[,]>
-Specify a priority list of audio output drivers to be used.
-.PP
-If the list has a trailing ',' MPlayer will fall back on drivers not
-contained in the list.
-Suboptions are optional and can mostly be omitted.
-.br
-.I NOTE:
-See \-ao help for a list of compiled-in audio output drivers.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-ao alsa,oss,"
-Try the ALSA driver, then the OSS driver, then others.
-.IPs "\-ao alsa:noblock:device=hw=0.3"
-Sets noblock-mode and the device-name as first card, fourth device.
-.RE
-.PD 1
-.sp 1
-Available audio output drivers are:
-.
-.TP
-.B "alsa\ \ \ "
-ALSA 0.9/1.x audio output driver
-.PD 0
-.RSs
-.IPs noblock
-Sets noblock-mode.
-.IPs device=<device>
-Sets the device name.
-Replace any ',' with '.' and any ':' with '=' in the ALSA device name.
-For hwac3 output via S/PDIF, use an "iec958" or "spdif" device, unless
-you really know how to set it correctly.
-.RE
-.PD 1
-.
-.TP
-.B "alsa5\ \ "
-ALSA 0.5 audio output driver
-.
-.TP
-.B "oss\ \ \ \ "
-OSS audio output driver
-.PD 0
-.RSs
-.IPs <dsp-device>
-Sets the audio output device (default: /dev/\:dsp).
-.IPs <mixer-device>
-Sets the audio mixer device (default: /dev/\:mixer).
-.IPs <mixer-channel>
-Sets the audio mixer channel (default: pcm).
-.RE
-.PD 1
-.
-.TP
-.B sdl (SDL only)
-highly platform independent SDL (Simple Directmedia Layer) library
-audio output driver
-.PD 0
-.RSs
-.IPs <driver>
-Explicitly choose the SDL audio driver to use (default: let SDL choose).
-.RE
-.PD 1
-.
-.TP
-.B "arts\ \ \ "
-audio output through the aRts daemon
-.
-.TP
-.B "esd\ \ \ \ "
-audio output through the ESD daemon
-.PD 0
-.RSs
-.IPs <server>
-Explicitly choose the ESD server to use (default: localhost).
-.RE
-.PD 1
-.
-.TP
-.B "jack\ \ \ \ "
-audio output through JACK (Jack Audio Connection Kit)
-.PD 0
-.RSs
-.IPs port=<name>
-Connects to the ports with the given name (default: physical ports).
-.IPs name=<client name>
-Client name that is passed to JACK (default: MPlayer [<PID>]).
-Useful if you want to have certain connections established automatically.
-.IPs (no)estimate
-Estimate the audio delay, supposed to make the video playback smoother
-(default: enabled).
-.IPs (no)autostart
-Automatically start jackd if necessary (default: disabled).
-Note that this seems unreliable and will spam stdout with server messages.
-.RE
-.PD 1
-.
-.TP
-.B "nas\ \ \ \ "
-audio output through NAS
-.
-.TP
-.B coreaudio (Mac OS X only)
-native Mac OS X audio output driver
-.PD 0
-.RSs
-.IPs device_id=<id>
-ID of output device to use (0 = default device)
-.IPs help
-List all available output devices with their IDs.
-.RE
-.PD 1
-.
-.TP
-.B "openal\ "
-Experimental OpenAL audio output driver
-.
-.TP
-.B "pulse\ \ "
-PulseAudio audio output driver
-.PD 0
-.RSs
-.IPs "[<host>][:<output sink>]"
-Specify the host and optionally output sink to use.
-An empty <host> string uses a local connection, "localhost"
-uses network transfer (most likely not what you want).
-.RE
-.PD 1
-.
-.TP
-.B sgi (SGI only)
-native SGI audio output driver
-.PD 0
-.RSs
-.IPs "<output device name>"
-Explicitly choose the output device/\:interface to use
-(default: system-wide default).
-For example, 'Analog Out' or 'Digital Out'.
-.RE
-.PD 1
-.
-.TP
-.B sun (Sun only)
-native Sun audio output driver
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the audio device to use (default: /dev/\:audio).
-.RE
-.PD 1
-.
-.TP
-.B win32 (Windows only)
-native Windows waveout audio output driver
-.
-.TP
-.B dsound (Windows only)
-DirectX DirectSound audio output driver
-.PD 0
-.RSs
-.IPs device=<devicenum>
-Sets the device number to use.
-Playing a file with \-v will show a list of available devices.
-.RE
-.PD 1
-.
-.TP
-.B kai (OS/2 only)
-OS/2 KAI audio output driver
-.PD 0
-.RSs
-.IPs uniaud
-Force UNIAUD mode.
-.IPs dart
-Force DART mode.
-.IPs (no)share
-Open audio in shareable or exclusive mode.
-.IPs bufsize=<size>
-Set buffer size to <size> in samples (default: 2048).
-.RE
-.PD 1
-.
-.TP
-.B dart (OS/2 only)
-OS/2 DART audio output driver
-.PD 0
-.RSs
-.IPs (no)share
-Open DART in shareable or exclusive mode.
-.IPs bufsize=<size>
-Set buffer size to <size> in samples (default: 2048).
-.RE
-.PD 1
-.
-.TP
-.B ivtv (IVTV only)
-IVTV specific MPEG audio output driver.
-Works with \-ac hwmpa only.
-.
-.TP
-.B v4l2 (requires Linux 2.6.22+ kernel)
-Audio output driver for V4L2 cards with hardware MPEG decoder.
-.
-.TP
-.B mpegpes (DVB only)
-Audio output driver for DVB cards that writes the output to an MPEG-PES
-file if no DVB card is installed.
-.PD 0
-.RSs
-.IPs card=<1\-4>
-DVB card to use if more than one card is present.
-If not specified MPlayer will search the first usable card.
-.IPs file=<filename>
-output filename
-.RE
-.PD 1
-.
-.TP
-.B "null\ \ \ "
-Produces no audio output but maintains video playback speed.
-Use \-nosound for benchmarking.
-.
-.TP
-.B "pcm\ \ \ \ "
-raw PCM/wave file writer audio output
-.PD 0
-.RSs
-.IPs (no)waveheader
-Include or do not include the wave header (default: included).
-When not included, raw PCM will be generated.
-.IPs file=<filename>
-Write the sound to <filename> instead of the default
-audiodump.wav.
-If nowaveheader is specified, the default is audiodump.pcm.
-.RE
-.PD 1
-.
-.TP
-.B "rsound\ \ \ \ "
-audio output to an RSound daemon
-.PD 0
-.RSs
-.IPs host=<name/path>
-Set the address of the server (default: localhost).
-Can be either a network hostname for TCP connections or a Unix domain
-socket path starting with '/'.
-.IPs port=<number>
-Set the TCP port used for connecting to the server (default: 12345).
-Not used if connecting to a Unix domain socket.
-.RE
-.PD 1
-.
-.TP
-.B "plugin\ \ "
-plugin audio output driver
-.
-.
-.
-.SH "VIDEO OUTPUT OPTIONS"
-.
-.TP
-.B \-adapter <value>
-Set the graphics card that will receive the image.
-You can get a list of available cards when you run this option with \-v.
-Currently only works with the directx video output driver.
-.
-.TP
-.B \-bpp <depth>
-Override the autodetected color depth.
-Only supported by the fbdev, dga, svga, vesa video output drivers.
-.
-.TP
-.B \-border
-Play movie with window border and decorations.
-Since this is on by default, use \-noborder to disable the standard window
-decorations.
-.
-.TP
-.B \-brightness <\-100\-100>
-Adjust the brightness of the video signal (default: 0).
-Not supported by all video output drivers.
-.
-.TP
-.B \-contrast <\-100\-100>
-Adjust the contrast of the video signal (default: 0).
-Not supported by all video output drivers.
-.
-.TP
-.B \-display <name> (X11 only)
-Specify the hostname and display number of the X server you want to display
-on.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-display xtest.localdomain:0
-.RE
-.PD 1
-.
-.TP
-.B "\-dr \ \ \ "
-Turns on direct rendering (not supported by all codecs and video outputs)
-.br
-.I WARNING:
-May cause OSD/SUB corruption!
-.
-.TP
-.B \-fbmode <modename> (\-vo fbdev only)
-Change video mode to the one that is labeled as <modename> in
-/etc/\:fb.modes.
-.br
-.I NOTE:
-VESA framebuffer does not support mode changing.
-.
-.TP
-.B \-fbmodeconfig <filename> (\-vo fbdev only)
-Override framebuffer mode configuration file (default: /etc/\:fb.modes).
-.
-.TP
-.B \-force\-window\-position
-Forcefully move MPlayer's video output window to default location whenever
-there is a change in video parameters, video stream or file.
-This used to be the default behavior.
-Currently only affects X11 VOs.
-.
-.TP
-.B \-fs (also see \-zoom)
-Fullscreen playback (centers movie, and paints black bands around it).
-Not supported by all video output drivers.
-.
-.TP
-.B \-fsmode\-dontuse <0\-31> (OBSOLETE, use the \-fs option)
-Try this option if you still experience fullscreen problems.
-.
-.TP
-.B \-fstype <type1,type2,...> (X11 only)
-Specify a priority list of fullscreen modes to be used.
-You can negate the modes by prefixing them with '\-'.
-If you experience problems like the fullscreen window being covered
-by other windows try using a different order.
-.br
-.I NOTE:
-See \-fstype help for a full list of available modes.
-.sp 1
-The available types are:
-.sp 1
-.PD 0
-.RSs
-.IPs above
-Use the _NETWM_STATE_ABOVE hint if available.
-.IPs below
-Use the _NETWM_STATE_BELOW hint if available.
-.IPs fullscreen
-Use the _NETWM_STATE_FULLSCREEN hint if available.
-.IPs layer
-Use the _WIN_LAYER hint with the default layer.
-.IPs layer=<0...15>
-Use the _WIN_LAYER hint with the given layer number.
-.IPs netwm
-Force NETWM style.
-.IPs "none\ "
-Clear the list of modes; you can add modes to enable afterward.
-.IPs stays_on_top
-Use _NETWM_STATE_STAYS_ON_TOP hint if available.
-.REss
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-.IPs layer,stays_on_top,above,fullscreen
-Default order, will be used as a fallback if incorrect or
-unsupported modes are specified.
-.IPs \-fullscreen
-Fixes fullscreen switching on OpenBox 1.x.
-.RE
-.PD 1
-.
-.TP
-.B \-gamma <\-100\-100>
-Adjust the gamma of the video signal (default: 0).
-Not supported by all video output drivers.
-.
-.TP
-.B \-geometry x[%][:y[%]] or [WxH][+-x+-y]
-Adjust where the output is on the screen initially.
-The x and y specifications are in pixels measured from the top-left of the
-screen to the top-left of the image being displayed, however if a percentage
-sign is given after the argument it turns the value into a percentage of the
-screen size in that direction.
-It also supports the standard X11 \-geometry option format, in which e.g.
-+10-50 means "place 10 pixels from the left border and 50 pixels from the lower
-border" and "--20+-10" means "place 20 pixels beyond the right and 10 pixels
-beyond the top border".
-If an external window is specified using the \-wid option, then the x and
-y coordinates are relative to the top-left corner of the window rather
-than the screen.
-The coordinates are relative to the screen given with \-xineramascreen for
-the video output drivers that fully support \-xineramascreen (direct3d, gl, gl2,
-vdpau, x11, xv, corevideo).
-.br
-.I NOTE:
-May not be supported by some of the older VO drivers.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs 50:40
-Places the window at x=50, y=40.
-.IPs 50%:50%
-Places the window in the middle of the screen.
-.IPs "100%\ "
-Places the window at the middle of the right edge of the screen.
-.IPs 100%:100%
-Places the window at the bottom right corner of the screen.
-.RE
-.PD 1
-.
-.TP
-.B \-hue <\-100\-100>
-Adjust the hue of the video signal (default: 0).
-You can get a colored negative of the image with this option.
-Not supported by all video output drivers.
-.
-.TP
-.B \-monitor\-dotclock <range[,range,...]> (\-vo fbdev and vesa only)
-Specify the dotclock or pixelclock range of the monitor.
-.
-.TP
-.B \-monitor\-hfreq <range[,range,...]> (\-vo fbdev and vesa only)
-Specify the horizontal frequency range of the monitor.
-.
-.TP
-.B \-monitor\-vfreq <range[,range,...]> (\-vo fbdev and vesa only)
-Specify the vertical frequency range of the monitor.
-.
-.TP
-.B \-monitoraspect <ratio> (also see \-aspect)
-Set the aspect ratio of your monitor or TV screen.
-A value of 0 disables a previous setting (e.g.\& in the config file).
-Overrides the \-monitorpixelaspect setting if enabled.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-monitoraspect 4:3 or 1.3333
-.br
-\-monitoraspect 16:9 or 1.7777
-.RE
-.PD 1
-.
-.TP
-.B \-monitorpixelaspect <ratio> (also see \-aspect)
-Set the aspect of a single pixel of your monitor or TV screen (default: 1).
-A value of 1 means square pixels
-(correct for (almost?) all LCDs).
-.
-.TP
-.B \-name (X11 only)
-Set the window class name.
-.
-.TP
-.B \-nodouble
-Disables double buffering, mostly for debugging purposes.
-Double buffering fixes flicker by storing two frames in memory, and
-displaying one while decoding another.
-It can affect OSD negatively, but often removes OSD flickering.
-.
-.TP
-.B \-nograbpointer
-Do not grab the mouse pointer after a video mode change (\-vm).
-Useful for multihead setups.
-.
-.TP
-.B \-nokeepaspect
-Do not keep window aspect ratio when resizing windows.
-By default MPlayer tries to keep the correct video aspect ratio by
-instructing the window manager to maintain window aspect when resizing,
-and by adding black bars if the window manager nevertheless allows
-window shape to change.
-This option disables window manager aspect hints and scales the video
-to completely fill the window without regard for aspect ratio.
-.
-.TP
-.B "\-ontop\ "
-Makes the player window stay on top of other windows.
-Supported by video output drivers which use X11, except SDL,
-as well as directx, corevideo, quartz, ggi and gl2.
-.
-.TP
-.B \-panscan <0.0\-1.0>
-Enables pan-and-scan functionality (cropping the sides of e.g.\& a 16:9
-movie to make it fit a 4:3 display without black bands).
-The range controls how much of the image is cropped.
-May not work with all video output drivers.
-.br
-.I NOTE:
-Values between \-1 and 0 are allowed as well, but highly experimental
-and may crash or worse.
-Use at your own risk!
-.
-.TP
-.B \-panscanrange <\-19.0\-99.0> (experimental)
-Change the range of the pan-and-scan functionality (default: 1).
-Positive values mean multiples of the default range.
-Negative numbers mean you can zoom in up to a factor of \-panscanrange+1.
-E.g.\& \-panscanrange \-3 allows a zoom factor of up to 4.
-This feature is experimental.
-Do not report bugs unless you are using \-vo gl.
-.
-.TP
-.B \-refreshrate <Hz>
-Set the monitor refreshrate in Hz.
-Currently only supported by \-vo directx combined with the \-vm option.
-.
-.TP
-.B \-rootwin
-Play movie in the root window (desktop background).
-Desktop background images may cover the movie window, though.
-May not work with all video output drivers.
-.
-.TP
-.B \-saturation <\-100\-100>
-Adjust the saturation of the video signal (default: 0).
-You can get grayscale output with this option.
-Not supported by all video output drivers.
-.
-.TP
-.B \-screenh <pixels>
-Specify the screen height for video output drivers which
-do not know the screen resolution like fbdev, x11 and TV-out.
-.
-.TP
-.B \-screenw <pixels>
-Specify the screen width for video output drivers which
-do not know the screen resolution like fbdev, x11 and TV-out.
-.
-.TP
-.B \-(no)stop\-xscreensaver (X11 only)
-Turns off xscreensaver at startup and turns it on again on exit
-(default: enabled).
-If your screensaver supports neither the XSS nor XResetScreenSaver
-API please use \-heartbeat\-cmd instead.
-.
-.TP
-.B \-title (also see \-use\-filename\-title)
-Set the window title.
-Supported by X11-based video output drivers.
-.
-.TP
-.B \-use\-filename\-title (also see \-title)
-Set the window title using the media filename, when not set with \-title.
-Supported by X11-based video output drivers.
-.
-.TP
-.B "\-vm \ \ \ "
-Try to change to a different video mode.
-Supported by the dga, x11, xv, sdl and directx video output drivers.
-If used with the directx video output driver the \-screenw,
-\-screenh, \-bpp and \-refreshrate options can be used to set
-the new display mode.
-.
-.TP
-.B "\-vsync \ \ "
-Enables VBI for the vesa, dfbmga and svga video output drivers.
-.
-.TP
-.B \-wid <window ID> (X11, OpenGL and DirectX only)
-This tells MPlayer to attach to an existing window.
-Useful to embed MPlayer in a browser (e.g.\& the plugger extension).
-This option fills the given window completely, thus aspect scaling,
-panscan, etc are no longer handled by MPlayer but must be managed by the
-application that created the window.
-.
-.TP
-.B \-xineramascreen <\-2\-...>
-In Xinerama configurations (i.e.\& a single desktop that spans across multiple
-displays) this option tells MPlayer which screen to display the movie on.
-A value of \-2 means fullscreen across the whole virtual display (in this case
-Xinerama information is completely ignored), \-1 means
-fullscreen on the display the window currently is on.
-The initial position set via the \-geometry option is relative to the
-specified screen.
-Will usually only work with "\-fstype \-fullscreen" or "\-fstype none".
-This option is not suitable to only set the startup screen (because
-it will always display on the given screen in fullscreen mode),
-\-geometry is the best that is available for that purpose
-currently.
-Supported by at least the direct3d, gl, gl2, x11, xv and corevideo video output
-drivers.
-.
-.
-.
-.SH "VIDEO OUTPUT DRIVERS"
-Video output drivers are interfaces to different video output facilities.
-The syntax is:
-.
-.TP
-.B \-vo <driver1[:suboption1[=value]:...],driver2,...[,]>
-Specify a priority list of video output drivers to be used.
-.PP
-If the list has a trailing ',' MPlayer will fall back on drivers not
-contained in the list.
-Suboptions are optional and can mostly be omitted.
-.br
-.I NOTE:
-See \-vo help for a list of compiled-in video output drivers.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-vo xmga,xv,"
-Try the Matrox X11 driver, then the Xv driver, then others.
-.IPs "\-vo directx:noaccel"
-Uses the DirectX driver with acceleration features turned off.
-.RE
-.PD 1
-.sp 1
-Available video output drivers are:
-.
-.TP
-.B xv (X11 only)
-Uses the XVideo extension of XFree86 4.x to enable hardware
-accelerated playback.
-If you cannot use a hardware specific driver, this is probably
-the best option.
-For information about what colorkey is used and how it is drawn run MPlayer
-with \-v option and look out for the lines tagged with [xv common] at the
-beginning.
-.PD 0
-.RSs
-.IPs adaptor=<number>
-Select a specific XVideo adaptor (check xvinfo results).
-.IPs port=<number>
-Select a specific XVideo port.
-.IPs ck=<cur|use|set>
-Select the source from which the colorkey is taken (default: cur).
-.RSss
-.IPs cur
-The default takes the colorkey currently set in Xv.
-.IPs use
-Use but do not set the colorkey from MPlayer (use \-colorkey option to change
-it).
-.IPs set
-Same as use but also sets the supplied colorkey.
-.RE
-.IPs ck-method=<man|bg|auto>
-Sets the colorkey drawing method (default: man).
-.RSss
-.IPs man
-Draw the colorkey manually (reduces flicker in some cases).
-.IPs bg
-Set the colorkey as window background.
-.IPs auto
-Let Xv draw the colorkey.
-.RE
-.RE
-.PD 1
-.
-.TP
-.B x11 (X11 only)
-Shared memory video output driver without hardware acceleration that
-works whenever X11 is present.
-.
-.TP
-.B xover (X11 only)
-Adds X11 support to all overlay based video output drivers.
-Currently only supported by tdfx_vid.
-.PD 0
-.RSs
-.IPs <vo_driver>
-Select the driver to use as source to overlay on top of X11.
-.RE
-.PD 1
-.
-.TP
-.B vdpau (X11 only)
-Uses the VDPAU interface to display and optionally also decode video.
-Hardware decoding is used with \-vc ffmpeg12vdpau, ffwmv3vdpau, ffvc1vdpau, ffh264vdpau or ffodivxvdpau.
-.PD 0
-.RSs
-.IPs sharpen=<\-1\-1>
-For positive values, apply a sharpening algorithm to the video,
-for negative values a blurring algorithm (default: 0).
-.IPs denoise=<0\-1>
-Apply a noise reduction algorithm to the video (default: 0, no noise reduction).
-.IPs deint=<-4\-4>
-Select deinterlacing mode (default: -3).
-Positive values choose mode and enable deinterlacing.
-Corresponding negative values select the same deinterlacing mode,
-but do not enable deinterlacing on startup (useful in configuration files
-to specify what mode will be enabled by the "D" key).
-All modes respect \-field\-dominance.
-.RSss
-.IPs 0
-same as -3
-.IPs 1
-Show only first field, similar to \-vf field.
-.IPs 2
-Bob deinterlacing, similar to \-vf tfields=1.
-.IPs 3
-motion adaptive temporal deinterlacing.
-May lead to A/V desync with slow video hardware and/or high resolution.
-.IPs 4
-motion adaptive temporal deinterlacing with edge-guided spatial interpolation.
-Needs fast video hardware.
-.RE
-.IPs chroma\-deint
-Makes temporal deinterlacers operate both on luma and chroma (default).
-Use nochroma\-deint to solely use luma and speed up advanced deinterlacing.
-Useful with slow video memory.
-.IPs pullup
-Try to apply inverse telecine, needs motion adaptive temporal deinterlacing.
-.IPs colorspace=<0-3>
-Select the color space for YUV to RGB conversion.
-In general BT.601 should be used for standard definition (SD) content and
-BT.709 for high definition (HD) content.
-Using incorrect color space results in slightly under or over saturated and
-shifted colors.
-.RSss
-.IPs 0
-Guess the color space based on video resolution.
-Video with width >= 1280 or height > 576 is assumed to be HD and BT.709 color
-space will be used.
-.IPs 1
-Use ITU-R BT.601 color space (default).
-.IPs 2
-Use ITU-R BT.709 color space.
-.IPs 3
-Use SMPTE-240M color space.
-.RE
-.IPs hqscaling=<0-9>
-.RSss
-.IPs 0
-Use default VDPAU scaling (default).
-.IPs 1\-9
-Apply high quality VDPAU scaling (needs capable hardware).
-.RE
-.IPs studio
-Output video in studio level RGB (16-235).
-This is what TVs and video monitors generally expect.
-By default PC level RGB (0-255) suitable for PC monitors is used.
-Providing studio level output to a device expecting PC level input results in
-grey blacks and dim whites, the reverse in crushed blacks and whites.
-.IPs fps=<number>
-Override autodetected display refresh rate value (the value is needed for framedrop to allow video playback rates higher than display refresh rate, and for vsync-aware frame timing adjustments).
-Default 0 means use autodetected value.
-A positive value is interpreted as a refresh rate in Hz and overrides the autodetected value.
-A negative value disables all timing adjustment and framedrop logic.
-.IPs queuetime_windowed=<number>
-.IPs queuetime_fs=<number>
-Use VDPAU's presentation queue functionality to queue future video frame
-changes at most this many milliseconds in advance (default: 50).
-See below for additional information.
-.IPs output_surfaces=<2-15>
-Allocate this many output surfaces to display video frames (default: 3).
-See below for additional information.
-.RE
-.RS
-.sp 1
-Using the VDPAU frame queueing functionality controlled by the queuetime
-options makes MPlayer's frame flip timing less sensitive to system CPU load
-and allows MPlayer to start decoding the next frame(s) slightly earlier
-which can reduce jitter caused by individual slow-to-decode frames.
-However the NVIDIA graphics drivers can make other window behavior such as
-window moves choppy if VDPAU is using the blit queue (mainly happens
-if you have the composite extension enabled) and this feature is active.
-If this happens on your system and it bothers you then you can set the
-queuetime value to 0 to disable this feature.
-The settings to use in windowed and fullscreen mode are separate because there
-should be less reason to disable this for fullscreen mode (as the driver issue
-shouldn't affect the video itself).
-.sp 1
-You can queue more frames ahead by increasing the queuetime values and the
-output_surfaces count (to ensure enough surfaces to buffer video for a
-certain time ahead you need at least as many surfaces as the video has
-frames during that time, plus two).
-This could help make video smoother in some cases.
-The main downsides are increased video RAM requirements for the surfaces
-and laggier display response to user commands (display changes only become
-visible some time after they're queued). The graphics driver implementation may
-also have limits on the length of maximum queuing time or number of queued
-surfaces that work well or at all.
-.RE
-.PD 1
-.
-.TP
-.B dga (X11 only)
-Play video through the XFree86 Direct Graphics Access extension.
-Considered obsolete.
-.
-.TP
-.B sdl (SDL only, buggy/outdated)
-Highly platform independent SDL (Simple Directmedia Layer) library
-video output driver.
-Since SDL uses its own X11 layer, MPlayer X11 options do not have
-any effect on SDL.
-Note that it has several minor bugs (\-vm/\-novm is mostly ignored,
-\-fs behaves like \-novm should, window is in top-left corner when
-returning from fullscreen, panscan is not supported, ...).
-.PD 0
-.RSs
-.IPs driver=<driver>
-Explicitly choose the SDL driver to use.
-.IPs (no)forcexv
-Use XVideo through the sdl video output driver (default: forcexv).
-.IPs (no)hwaccel
-Use hardware accelerated scaler (default: hwaccel).
-.RE
-.PD 1
-.
-.TP
-.B direct3d (Windows only) (BETA CODE!)
-Video output driver that uses the Direct3D interface (useful for Vista).
-.
-.TP
-.B directx (Windows only)
-Video output driver that uses the DirectX interface.
-.PD 0
-.RSs
-.IPs noaccel
-Turns off hardware acceleration.
-Try this option if you have display problems.
-.RE
-.PD 1
-.
-.TP
-.B kva (OS/2 only)
-Video output driver that uses the libkva interface.
-.PD 0
-.RSs
-.IPs snap
-Force SNAP mode.
-.IPs wo
-Force WarpOverlay! mode.
-.IPs dive
-Force DIVE mode.
-.IPs (no)t23
-Enable or disable workaround for T23 laptop (default: disabled).
-Try to enable this option if your video card supports upscaling only.
-.RE
-.PD 1
-.
-.TP
-.B quartz (Mac OS X only)
-Mac OS X Quartz video output driver.
-Under some circumstances, it might be more efficient to force a
-packed YUV output format, with e.g.\& \-vf format=yuy2.
-.PD 0
-.RSs
-.IPs device_id=<number>
-Choose the display device to use in fullscreen.
-.IPs fs_res=<width>:<height>
-Specify the fullscreen resolution (useful on slow systems).
-.RE
-.PD 1
-.
-.TP
-.B corevideo (Mac OS X 10.4 or 10.3.9 with QuickTime 7)
-Mac OS X CoreVideo video output driver
-.PD 0
-.RSs
-.IPs device_id=<number>
-Choose the display device to use for fullscreen or set it to \-1 to
-always use the same screen the video window is on (default: \-1 \- auto).
-.IPs shared_buffer
-Write output to a shared memory buffer instead of displaying it and
-try to open an existing NSConnection for communication with a GUI.
-.IPs buffer_name=<name>
-Name of the shared buffer created with shm_open as well as the name of
-the NSConnection MPlayer will try to open (default: "mplayerosx").
-Setting buffer_name implicitly enables shared_buffer.
-.RE
-.PD 1
-.
-.TP
-.B fbdev (Linux only)
-Uses the kernel framebuffer to play video.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the fbdev device name to use (e.g.\& /dev/\:fb0).
-.RE
-.PD 1
-.
-.TP
-.B fbdev2 (Linux only)
-Uses the kernel framebuffer to play video,
-alternative implementation.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the fbdev device name to use (default: /dev/\:fb0).
-.RE
-.PD 1
-.
-.TP
-.B "vesa\ \ \ "
-Very general video output driver that should work on any VESA VBE 2.0
-compatible card.
-.PD 0
-.RSs
-.IPs (no)dga
-Turns DGA mode on or off (default: on).
-.IPs neotv_pal
-Activate the NeoMagic TV out and set it to PAL norm.
-.IPs neotv_ntsc
-Activate the NeoMagic TV out and set it to NTSC norm.
-.IPs "lvo:\ \ \ "
-Activate the Linux Video Overlay on top of VESA mode.
-.RE
-.PD 1
-.
-.TP
-.B "svga\ \ \ "
-Play video using the SVGA library.
-.PD 0
-.RSs
-.IPs "<video mode>"
-Specify video mode to use.
-The mode can be given in a <width>x<height>x<colors> format,
-e.g.\& 640x480x16M or be a graphics mode number, e.g.\& 84.
-.IPs bbosd
-Draw OSD into black bands below the movie (slower).
-.IPs native
-Use only native drawing functions.
-This avoids direct rendering, OSD and hardware acceleration.
-.IPs retrace
-Force frame switch on vertical retrace.
-Usable only with \-double.
-It has the same effect as the \-vsync option.
-.IPs "sq\ \ \ "
-Try to select a video mode with square pixels.
-.RE
-.PD 1
-.
-.TP
-.B "gl\ \ \ \ \ "
-OpenGL video output driver, simple version.
-Video size must be smaller than
-the maximum texture size of your OpenGL implementation.
-Intended to work even with the most basic OpenGL implementations,
-but also makes use of newer extensions, which allow support for more
-colorspaces and direct rendering.
-For optimal speed try adding the options
-.br
-\-dr \-noslices
-.br
-The code performs very few checks, so if a feature does not work, this
-might be because it is not supported by your card/OpenGL implementation
-even if you do not get any error message.
-Use glxinfo or a similar tool to display the supported OpenGL extensions.
-.PD 0
-.RSs
-.IPs (no)ati\-hack
-ATI drivers may give a corrupted image when PBOs are used (when using \-dr
-or force\-pbo).
-This option fixes this, at the expense of using a bit more memory.
-.IPs (no)force\-pbo
-Always uses PBOs to transfer textures even if this involves an extra copy.
-Currently this gives a little extra speed with NVidia drivers and a lot more
-speed with ATI drivers.
-May need \-noslices and the ati\-hack suboption to work correctly.
-.IPs (no)scaled-osd
-Changes the way the OSD behaves when the size of the
-window changes (default: disabled).
-When enabled behaves more like the other video output drivers,
-which is better for fixed-size fonts.
-Disabled looks much better with FreeType fonts and uses the
-borders in fullscreen mode.
-Does not work correctly with ass subtitles (see \-ass), you can instead
-render them without OpenGL support via \-vf ass.
-.IPs osdcolor=<0xAARRGGBB>
-Color for OSD (default: 0x00ffffff, corresponds to non-transparent white).
-.IPs rectangle=<0,1,2>
-Select usage of rectangular textures which saves video RAM, but often is
-slower (default: 0).
-.RSss
-0: Use power-of-two textures (default).
-.br
-1: Use the GL_ARB_texture_rectangle extension.
-.br
-2: Use the GL_ARB_texture_non_power_of_two extension.
-In some cases only supported in software and thus very slow.
-.RE
-.IPs swapinterval=<n>
-Minimum interval between two buffer swaps, counted in
-displayed frames (default: 1).
-1 is equivalent to enabling VSYNC, 0 to disabling VSYNC.
-Values below 0 will leave it at the system default.
-This limits the framerate to (horizontal refresh rate / n).
-Requires GLX_SGI_swap_control support to work.
-With some (most/all?) implementations this only works in fullscreen mode.
-.IPs ycbcr
-Use the GL_MESA_ycbcr_texture extension to convert YUV to RGB.
-In most cases this is probably slower than doing software conversion to RGB.
-.IPs yuv=<n>
-Select the type of YUV to RGB conversion.
-The default is auto-detection deciding between values 0 and 2.
-.RSss
-0: Use software conversion.
-Compatible with all OpenGL versions.
-Provides brightness, contrast and saturation control.
-.br
-1: Use register combiners.
-This uses an nVidia-specific extension (GL_NV_register_combiners).
-At least three texture units are needed.
-Provides saturation and hue control.
-This method is fast but inexact.
-.br
-2: Use a fragment program.
-Needs the GL_ARB_fragment_program extension and at least three texture units.
-Provides brightness, contrast, saturation and hue control.
-.br
-3: Use a fragment program using the POW instruction.
-Needs the GL_ARB_fragment_program extension and at least three texture units.
-Provides brightness, contrast, saturation, hue and gamma control.
-Gamma can also be set independently for red, green and blue.
-Method 4 is usually faster.
-.br
-4: Use a fragment program with additional lookup.
-Needs the GL_ARB_fragment_program extension and at least four texture units.
-Provides brightness, contrast, saturation, hue and gamma control.
-Gamma can also be set independently for red, green and blue.
-.br
-5: Use ATI-specific method (for older cards).
-This uses an ATI-specific extension (GL_ATI_fragment_shader \- not
-GL_ARB_fragment_shader!).
-At least three texture units are needed.
-Provides saturation and hue control.
-This method is fast but inexact.
-.br
-6: Use a 3D texture to do conversion via lookup.
-Needs the GL_ARB_fragment_program extension and at least four texture units.
-Extremely slow (software emulation) on some (all?) ATI cards since it uses
-a texture with border pixels.
-Provides brightness, contrast, saturation, hue and gamma control.
-Gamma can also be set independently for red, green and blue.
-Speed depends more on GPU memory bandwidth than other methods.
-.RE
-.IPs colorspace
-Select the color space for YUV to RGB conversion.
-.RSss
-.IPs 0
-Use the formula used normally by MPlayer (default).
-.IPs 1
-Use ITU-R BT.601 color space.
-.IPs 2
-Use ITU-R BT.709 color space.
-.IPs 3
-Use SMPTE-240M color space.
-.RE
-.IPs levelconv=<n>
-Select the brightness level conversion to use for the YUV to RGB conversion
-.RSss
-.IPs 0
-Convert TV to PC levels (default).
-.IPs 1
-Convert PC to TV levels.
-.IPs 2
-Do not do any conversion.
-.RE
-.IPs lscale=<n>
-Select the scaling function to use for luminance scaling.
-Only valid for yuv modes 2, 3, 4 and 6.
-.RSss
-.IPs 0
-Use simple linear filtering (default).
-.IPs 1
-Use bicubic B-spline filtering (better quality).
-Needs one additional texture unit.
-Older cards will not be able to handle this for chroma at least in fullscreen mode.
-.IPs 2
-Use cubic filtering in horizontal, linear filtering in vertical direction.
-Works on a few more cards than method 1.
-.IPs 3
-Same as 1 but does not use a lookup texture.
-Might be faster on some cards.
-.IPs 4
-Use experimental unsharp masking with 3x3 support and a default strength of 0.5 (see filter-strength).
-.IPs 5
-Use experimental unsharp masking with 5x5 support and a default strength of 0.5 (see filter-strength).
-.RE
-.IPs cscale=<n>
-Select the scaling function to use for chrominance scaling.
-For details see lscale.
-.IPs filter-strength=<value>
-Set the effect strength for the lscale/cscale filters that support it.
-.IPs noise-strength=<value>
-Set how much noise to add. 0 to disable (default), 1.0 for level suitable
-for dithering to 6 bit.
-.IPs stereo=<value>
-Select a method for stereo display.
-You may have to use \-aspect to fix the aspect value.
-Experimental, do not expect too much from it.
-.RSss
-.IPs 0
-normal 2D display
-.IPs 1
-Convert side by side input to full-color red-cyan stereo.
-.IPs 2
-Convert side by side input to full-color green-magenta stereo.
-.IPs 3
-Convert side by side input to quadbuffered stereo.
-Only supported by very few OpenGL cards.
-.RE
-.RE
-.sp 1
-.RS
-The following options are only useful if writing your own fragment programs.
-.RE
-.sp 1
-.RSs
-.IPs customprog=<filename>
-Load a custom fragment program from <filename>.
-See TOOLS/edgedect.fp for an example.
-.IPs customtex=<filename>
-Load a custom "gamma ramp" texture from <filename>.
-This can be used in combination with yuv=4 or with the customprog option.
-.IPs (no)customtlin
-If enabled (default) use GL_LINEAR interpolation, otherwise use GL_NEAREST
-for customtex texture.
-.IPs (no)customtrect
-If enabled, use texture_rectangle for customtex texture.
-Default is disabled.
-.IPs (no)mipmapgen
-If enabled, mipmaps for the video are automatically generated.
-This should be useful together with the customprog and the TXB
-instruction to implement blur filters with a large radius.
-For most OpenGL implementations this is very slow for any non-RGB
-formats.
-Default is disabled.
-.RE
-.sp 1
-.RS
-Normally there is no reason to use the following options, they mostly
-exist for testing purposes.
-.RE
-.sp 1
-.RSs
-.IPs (no)glfinish
-Call glFinish() before swapping buffers.
-Slower but in some cases more correct output (default: disabled).
-.IPs (no)manyfmts
-Enables support for more (RGB and BGR) color formats (default: enabled).
-Needs OpenGL version >= 1.2.
-.IPs slice-height=<0\-...>
-Number of lines copied to texture in one piece (default: 0).
-0 for whole image.
-.br
-.I NOTE:
-If YUV colorspace is used (see yuv suboption), special rules apply:
-.RSss
-If the decoder uses slice rendering (see \-noslices), this setting
-has no effect, the size of the slices as provided by the decoder is used.
-.br
-If the decoder does not use slice rendering, the default is 16.
-.RE
-.IPs (no)osd
-Enable or disable support for OSD rendering via OpenGL (default: enabled).
-This option is for testing; to disable the OSD use \-osdlevel 0 instead.
-.IPs (no)aspect
-Enable or disable aspect scaling and pan-and-scan support (default: enabled).
-Disabling might increase speed.
-.REss
-.RE
-.PD 1
-.
-.TP
-.B "gl2\ \ \ \ "
-Variant of the OpenGL video output driver.
-Supports videos larger than the maximum texture size but lacks many of the
-advanced features and optimizations of the gl driver and is unlikely to be
-extended further.
-.PD 0
-.RSs
-.IPs (no)glfinish
-same as gl (default: enabled)
-.IPs yuv=<n>
-Select the type of YUV to RGB conversion.
-If set to anything except 0 OSD will be disabled and brightness, contrast and
-gamma setting is only available via the global X server settings.
-Apart from this the values have the same meaning as for \-vo gl.
-.REss
-.
-.TP
-.B matrixview
-OpenGL-based renderer creating a Matrix-like running-text effect.
-.PD 0
-.RSs
-.IPs cols=<n>
-Number of text columns to display.
-Very low values (< 16) will probably fail due to scaler limitations.
-Values not divisible by 16 may cause issues as well.
-.IPs rows=<n>
-Number of text rows to display.
-Very low values (< 16) will probably fail due to scaler limitations.
-Values not divisible by 16 may cause issues as well.
-.REss
-.
-.TP
-.B "null\ \ \ "
-Produces no video output.
-Useful for benchmarking.
-.
-.TP
-.B "aa\ \ \ \ \ "
-ASCII art video output driver that works on a text console.
-You can get a list and an explanation of available suboptions
-by executing 'mplayer \-vo aa:help'.
-.br
-.I NOTE:
-The driver does not handle \-aspect correctly.
-.br
-.I HINT:
-You probably have to specify \-monitorpixelaspect.
-Try 'mplayer \-vo aa \-monitorpixelaspect 0.5'.
-.
-.TP
-.B "caca\ \ \ "
-Color ASCII art video output driver that works on a text console.
-.
-.TP
-.B "bl\ \ \ \ \ "
-Video playback using the Blinkenlights UDP protocol.
-This driver is highly hardware specific.
-.PD 0
-.RSs
-.IPs <subdevice>
-Explicitly choose the Blinkenlights subdevice driver to use.
-It is something like arcade:host=localhost:2323 or
-hdl:file=name1,file=name2.
-You must specify a subdevice.
-.RE
-.PD 1
-.
-.TP
-.B "ggi\ \ \ \ "
-GGI graphics system video output driver
-.PD 0
-.RSs
-.IPs <driver>
-Explicitly choose the GGI driver to use.
-Replace any ',' that would appear in the driver string by a '.'.
-.RE
-.PD 1
-.
-.TP
-.B directfb
-Play video using the DirectFB library.
-.PD 0
-.RSs
-.IPs (no)input
-Use the DirectFB instead of the MPlayer keyboard code (default: enabled).
-.IPs buffermode=single|double|triple
-Double and triple buffering give best results if you want to avoid tearing issues.
-Triple buffering is more efficient than double buffering as it does
-not block MPlayer while waiting for the vertical retrace.
-Single buffering should be avoided (default: single).
-.IPs fieldparity=top|bottom
-Control the output order for interlaced frames (default: disabled).
-Valid values are top = top fields first, bottom = bottom fields first.
-This option does not have any effect on progressive film material
-like most MPEG movies are.
-You need to enable this option if you have tearing issues or unsmooth
-motions watching interlaced film material.
-.IPs layer=N
-Will force layer with ID N for playback (default: \-1 \- auto).
-.IPs dfbopts=<list>
-Specify a parameter list for DirectFB.
-.RE
-.PD 1
-.
-.TP
-.B "dfbmga\ "
-Matrox G400/\:G450/\:G550 specific video output driver that uses the
-DirectFB library to make use of special hardware features.
-Enables CRTC2 (second head), displaying video independently of the first head.
-.PD 0
-.RSs
-.IPs (no)input
-same as directfb (default: disabled)
-.IPs buffermode=single|double|triple
-same as directfb (default: triple)
-.IPs fieldparity=top|bottom
-same as directfb
-.IPs (no)bes
-Enable the use of the Matrox BES (backend scaler) (default: disabled).
-Gives very good results concerning speed and output quality as interpolated
-picture processing is done in hardware.
-Works only on the primary head.
-.IPs (no)spic
-Make use of the Matrox sub picture layer to display the OSD (default: enabled).
-.IPs (no)crtc2
-Turn on TV-out on the second head (default: enabled).
-The output quality is amazing as it is a full interlaced picture
-with proper sync to every odd/\:even field.
-.IPs tvnorm=pal|ntsc|auto
-Will set the TV norm of the Matrox card without the need
-for modifying /etc/\:directfbrc (default: disabled).
-Valid norms are pal = PAL, ntsc = NTSC.
-Special norm is auto (auto-adjust using PAL/\:NTSC) because it decides
-which norm to use by looking at the framerate of the movie.
-.RE
-.PD 1
-.
-.TP
-.B mga (Linux only)
-Matrox specific video output driver that makes use of the YUV back
-end scaler on Gxxx cards through a kernel module.
-If you have a Matrox card, this is the fastest option.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the Matrox device name to use (default: /dev/\:mga_vid).
-.RE
-.PD 1
-.
-.TP
-.B xmga (Linux, X11 only)
-The mga video output driver, running in an X11 window.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the Matrox device name to use (default: /dev/\:mga_vid).
-.RE
-.PD 1
-.
-.TP
-.B s3fb (Linux only) (also see \-dr)
-S3 Virge specific video output driver.
-This driver supports the card's YUV conversion and scaling, double
-buffering and direct rendering features.
-Use \-vf format=yuy2 to get hardware-accelerated YUY2 rendering, which is
-much faster than YV12 on this card.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the fbdev device name to use (default: /dev/\:fb0).
-.RE
-.PD 1
-.
-.TP
-.B wii (Linux only)
-Nintendo Wii/GameCube specific video output driver.
-.
-.TP
-.B 3dfx (Linux only)
-3dfx-specific video output driver that directly uses
-the hardware on top of X11.
-Only 16 bpp are supported.
-.
-.TP
-.B tdfxfb (Linux only)
-This driver employs the tdfxfb framebuffer driver to play movies with
-YUV acceleration on 3dfx cards.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the fbdev device name to use (default: /dev/\:fb0).
-.RE
-.PD 1
-.
-.TP
-.B tdfx_vid (Linux only)
-3dfx-specific video output driver that works in combination with
-the tdfx_vid kernel module.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the device name to use (default: /dev/\:tdfx_vid).
-.RE
-.PD 1
-.
-.TP
-.B dxr3 (DXR3 only)
-Sigma Designs em8300 MPEG decoder chip (Creative DXR3, Sigma Designs
-Hollywood Plus) specific video output driver.
-Also see the lavc video filter.
-.PD 0
-.RSs
-.IPs overlay
-Activates the overlay instead of TV-out.
-.IPs prebuf
-Turns on prebuffering.
-.IPs "sync\ "
-Will turn on the new sync-engine.
-.IPs norm=<norm>
-Specifies the TV norm.
-.RSss
-0: Does not change current norm (default).
-.br
-1: Auto-adjust using PAL/\:NTSC.
-.br
-2: Auto-adjust using PAL/\:PAL-60.
-.br
-3: PAL
-.br
-4: PAL-60
-.br
-5: NTSC
-.RE
-.IPs <0\-3>
-Specifies the device number to use if you have more than one em8300 card.
-.RE
-.PD 1
-.
-.TP
-.B ivtv (IVTV only)
-Conexant CX23415 (iCompression iTVC15) or Conexant CX23416 (iCompression
-iTVC16) MPEG decoder chip (Hauppauge WinTV PVR-150/250/350/500)
-specific video output driver for TV-out.
-Also see the lavc video filter.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the MPEG decoder device name to use (default: /dev/video16).
-.IPs <output>
-Explicitly choose the TV-out output to be used for the video signal.
-.RE
-.PD 1
-.
-.TP
-.B v4l2 (requires Linux 2.6.22+ kernel)
-Video output driver for V4L2 compliant cards with built-in hardware MPEG decoder.
-Also see the lavc video filter.
-.PD 0
-.RSs
-.IPs <device>
-Explicitly choose the MPEG decoder device name to use (default: /dev/video16).
-.IPs <output>
-Explicitly choose the TV-out output to be used for the video signal.
-.RE
-.PD 1
-.
-.TP
-.B mpegpes (DVB only)
-Video output driver for DVB cards that writes the output to an MPEG-PES file
-if no DVB card is installed.
-.PD 0
-.RSs
-.IPs card=<1\-4>
-Specifies the device number to use if you have more than one DVB output card
-(V3 API only, such as 1.x.y series drivers).
-If not specified MPlayer will search the first usable card.
-.IPs <filename>
-output filename (default: ./grab.mpg)
-.RE
-.PD 1
-.
-.TP
-.B "md5sum\ "
-Calculate MD5 sums of each frame and write them to a file.
-Supports RGB24 and YV12 colorspaces.
-Useful for debugging.
-.PD 0
-.RSs
-.IPs outfile=<value>
-Specify the output filename (default: ./md5sums).
-.RE
-.PD 1
-.
-.TP
-.B yuv4mpeg
-Transforms the video stream into a sequence of uncompressed YUV 4:2:0
-images and stores it in a file (default: ./stream.yuv).
-The format is the same as the one employed by mjpegtools, so this is
-useful if you want to process the video with the mjpegtools suite.
-It supports the YV12 format.
-If your source file has a different format and is interlaced, make sure
-to use -vf scale=::1 to ensure the conversion uses interlaced mode.
-You can combine it with the \-fixed\-vo option to concatenate files
-with the same dimensions and fps value.
-.PD 0
-.RSs
-.IPs interlaced
-Write the output as interlaced frames, top field first.
-.IPs interlaced_bf
-Write the output as interlaced frames, bottom field first.
-.IPs file=<filename>
-Write the output to <filename> instead of the default stream.yuv.
-.REss
-.PD 1
-.RS
-.sp 1
-.I NOTE:
-If you do not specify any option the output is progressive
-(i.e.\& not interlaced).
-.RE
-.
-.TP
-.B "gif89a\ "
-Output each frame into a single animated GIF file in the current directory.
-It supports only RGB format with 24 bpp and the output is converted to 256
-colors.
-.PD 0
-.RSs
-.IPs <fps>
-Float value to specify framerate (default: 5.0).
-.IPs <output>
-Specify the output filename (default: ./out.gif).
-.REss
-.PD 1
-.RS
-.sp 1
-.I NOTE:
-You must specify the framerate before the filename or the framerate will
-be part of the filename.
-.sp 1
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-mplayer video.nut \-vo gif89a:fps=15:output=test.gif
-.RE
-.PD 1
-.
-.TP
-.B "jpeg\ \ \ "
-Output each frame into a JPEG file in the current directory.
-Each file takes the frame number padded with leading zeros as name.
-.PD 0
-.RSs
-.IPs [no]progressive
-Specify standard or progressive JPEG (default: noprogressive).
-.IPs [no]baseline
-Specify use of baseline or not (default: baseline).
-.IPs optimize=<0\-100>
-optimization factor (default: 100)
-.IPs smooth=<0\-100>
-smooth factor (default: 0)
-.IPs quality=<0\-100>
-quality factor (default: 75)
-.IPs outdir=<dirname>
-Specify the directory to save the JPEG files to (default: ./).
-.IPs subdirs=<prefix>
-Create numbered subdirectories with the specified prefix to
-save the files in instead of the current directory.
-.IPs "maxfiles=<value> (subdirs only)"
-Maximum number of files to be saved per subdirectory.
-Must be equal to or larger than 1 (default: 1000).
-.RE
-.PD 1
-.
-.TP
-.B "pnm\ \ \ \ "
-Output each frame into a PNM file in the current directory.
-Each file takes the frame number padded with leading zeros as name.
-It supports PPM, PGM and PGMYUV files in both raw and ASCII mode.
-Also see pnm(5), ppm(5) and pgm(5).
-.PD 0
-.RSs
-.IPs "ppm\ \ "
-Write PPM files (default).
-.IPs "pgm\ \ "
-Write PGM files.
-.IPs pgmyuv
-Write PGMYUV files.
-PGMYUV is like PGM, but it also contains the U and V plane, appended at the
-bottom of the picture.
-.IPs "raw\ \ "
-Write PNM files in raw mode (default).
-.IPs ascii
-Write PNM files in ASCII mode.
-.IPs outdir=<dirname>
-Specify the directory to save the PNM files to (default: ./).
-.IPs subdirs=<prefix>
-Create numbered subdirectories with the specified prefix to
-save the files in instead of the current directory.
-.IPs "maxfiles=<value> (subdirs only)"
-Maximum number of files to be saved per subdirectory.
-Must be equal to or larger than 1 (default: 1000).
-.RE
-.PD 1
-.
-.TP
-.B "png\ \ \ \ "
-Output each frame into a PNG file in the current directory.
-Each file takes the frame number padded with leading zeros as name.
-24bpp RGB and BGR formats are supported.
-.PD 0
-.RSs
-.IPs z=<0\-9>
-Specifies the compression level.
-0 is no compression, 9 is maximum compression.
-.IPs alpha (default: noalpha)
-Create PNG files with an alpha channel.
-Note that MPlayer in general does not support alpha, so this will only
-be useful in some rare cases.
-.RE
-.PD 1
-.
-.TP
-.B "tga\ \ \ \ "
-Output each frame into a Targa file in the current directory.
-Each file takes the frame number padded with leading zeros as name.
-The purpose of this video output driver is to have a simple lossless
-image writer to use without any external library.
-It supports the BGR[A] color format, with 15, 24 and 32 bpp.
-You can force a particular format with the format video filter.
-.sp 1
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-mplayer video.nut \-vf format=bgr15 \-vo tga
-.RE
-.PD 1
-.
-.
-.
-.SH "DECODING/FILTERING OPTIONS"
-.
-.TP
-.B \-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 ',' MPlayer will fall back on codecs not
-contained in the list.
-.br
-.I NOTE:
-See \-ac help for a full list of available codecs.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-ac mp3acm"
-Force the l3codeca.acm MP3 codec.
-.IPs "\-ac mad,"
-Try libmad first, then fall back on others.
-.IPs "\-ac hwac3,a52,"
-Try hardware AC-3 passthrough, software AC-3, then others.
-.IPs "\-ac hwdts,"
-Try hardware DTS passthrough, then fall back on others.
-.IPs "\-ac \-ffmp3,"
-Skip FFmpeg's MP3 decoder.
-.RE
-.PD 1
-.
-.TP
-.B \-af\-adv <force=(0\-7):list=(filters)> (also see \-af)
-Specify advanced audio filter options:
-.RSs
-.IPs force=<0\-7>
-Forces the insertion of audio filters to one of the following:
-.RSss
-0: Use completely automatic filter insertion (currently identical to 1).
-.br
-1: Optimize for accuracy (default).
-.br
-2: Optimize for speed.
-.I Warning:
-Some features in the audio filters may silently fail,
-and the sound quality may drop.
-.br
-3: Use no automatic insertion of filters and no optimization.
-.I Warning:
-It may be possible to crash MPlayer using this setting.
-.br
-4: Use automatic insertion of filters according to 0 above,
-but use floating point processing when possible.
-.br
-5: Use automatic insertion of filters according to 1 above,
-but use floating point processing when possible.
-.br
-6: Use automatic insertion of filters according to 2 above,
-but use floating point processing when possible.
-.br
-7: Use no automatic insertion of filters according to 3 above,
-and use floating point processing when possible.
-.REss
-.IPs list=<filters>
-Same as \-af.
-.RE
-.
-.TP
-.B \-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.
-.br
-.I NOTE:
-See \-afm help for a full list of available codec families.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-afm ffmpeg"
-Try FFmpeg's libavcodec codecs first.
-.IPs "\-afm acm,dshow"
-Try Win32 codecs first.
-.RE
-.PD 1
-.
-.TP
-.B \-aspect <ratio> (also see \-zoom)
-Override movie aspect ratio, in case aspect information is
-incorrect or missing in the file being played.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-aspect 4:3 or \-aspect 1.3333
-.br
-\-aspect 16:9 or \-aspect 1.7777
-.RE
-.PD 1
-.
-.TP
-.B \-noaspect
-Disable automatic movie aspect ratio compensation.
-.
-.TP
-.B "\-field\-dominance <\-1\-1>"
-Set first field for interlaced content.
-Useful for deinterlacers that double the framerate: \-vf tfields=1,
-\-vf yadif=1 and \-vo vdpau:deint.
-.PD 0
-.RSs
-.IPs \-1
-auto (default): If the decoder does not export the appropriate information,
-it falls back to 0 (top field first).
-.IPs 0
-top field first
-.IPs 1
-bottom field first
-.RE
-.PD 1
-.
-.TP
-.B "\-flip \ "
-Flip image upside-down.
-.
-.TP
-.B \-lavdopts <option1:option2:...> (DEBUG CODE)
-Specify libavcodec decoding parameters.
-Separate multiple options with a colon.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-lavdopts gray:skiploopfilter=all:skipframe=nonref
-.RE
-.PD 1
-.sp 1
-.RS
-Available options are:
-.RE
-.RSs
-.IPs bitexact
-Only use bit-exact algorithms in all decoding steps (for codec testing).
-.IPs bug=<value>
-Manually work around encoder bugs.
-.RSss
-0: nothing
-.br
-1: autodetect bugs (default)
-.br
-2 (msmpeg4v3): some old lavc generated msmpeg4v3 files (no autodetection)
-.br
-4 (mpeg4): Xvid interlacing bug (autodetected if fourcc==XVIX)
-.br
-8 (mpeg4): UMP4 (autodetected if fourcc==UMP4)
-.br
-16 (mpeg4): padding bug (autodetected)
-.br
-32 (mpeg4): illegal vlc bug (autodetected per fourcc)
-.br
-64 (mpeg4): Xvid and DivX qpel bug (autodetected per fourcc/\:version)
-.br
-128 (mpeg4): old standard qpel (autodetected per fourcc/\:version)
-.br
-256 (mpeg4): another qpel bug (autodetected per fourcc/\:version)
-.br
-512 (mpeg4): direct-qpel-blocksize bug (autodetected per fourcc/\:version)
-.br
-1024 (mpeg4): edge padding bug (autodetected per fourcc/\:version)
-.REss
-.IPs debug=<value>
-Display debugging information.
-.RSss
-.br
-0: disabled
-.br
-1: picture info
-.br
-2: rate control
-.br
-4: bitstream
-.br
-8: macroblock (MB) type
-.br
-16: per-block quantization parameter (QP)
-.br
-32: motion vector
-.br
-0x0040: motion vector visualization (use \-noslices)
-.br
-0x0080: macroblock (MB) skip
-.br
-0x0100: startcode
-.br
-0x0200: PTS
-.br
-0x0400: error resilience
-.br
-0x0800: memory management control operations (H.264)
-.br
-0x1000: bugs
-.br
-0x2000: Visualize quantization parameter (QP), lower QP are tinted greener.
-.br
-0x4000: Visualize block types.
-.REss
-.IPs ec=<value>
-Set error concealment strategy.
-.RSss
-1: Use strong deblock filter for damaged MBs.
-.br
-2: iterative motion vector (MV) search (slow)
-.br
-3: all (default)
-.REss
-.IPs er=<value>
-Set error resilience strategy.
-.RSss
-.br
-0: disabled
-.br
-1: careful (Should work with broken encoders.)
-.br
-2: normal (default) (Works with compliant encoders.)
-.br
-3: aggressive (More checks, but might cause problems even for valid bitstreams.)
-.br
-4: very aggressive
-.REss
-.IPs "fast (MPEG-2, MPEG-4, and H.264 only)"
-Enable optimizations which do not comply to the specification and might
-potentially cause problems, like simpler dequantization, simpler motion
-compensation, assuming use of the default quantization matrix, assuming
-YUV 4:2:0 and skipping a few checks to detect damaged bitstreams.
-.IPs "gray\ "
-grayscale only decoding (a bit faster than with color)
-.IPs "idct=<0\-99> (see \-lavcopts)"
-For best decoding quality use the same IDCT algorithm for decoding and encoding.
-This may come at a price in accuracy, though.
-.IPs lowres=<number>[,<w>]
-Decode at lower resolutions.
-Low resolution decoding is not supported by all codecs, and it will
-often result in ugly artifacts.
-This is not a bug, but a side effect of not decoding at full resolution.
-.RSss
-.br
-0: disabled
-.br
-1: 1/2 resolution
-.br
-2: 1/4 resolution
-.br
-3: 1/8 resolution
-.REss
-.RS
-If <w> is specified lowres decoding will be used only if the width of the
-video is major than or equal to <w>.
-.RE
-.B o=<key>=<value>[,<key>=<value>[,...]]
-Pass AVOptions to libavcodec decoder.
-Note, a patch to make the o= unneeded and pass all unknown options through
-the AVOption system is welcome.
-A full list of AVOptions can be found in the FFmpeg manual.
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.PD 0
-.IPs o=debug=pict
-.PD 1
-.RE
-.IPs "sb=<number> (MPEG-2 only)"
-Skip the given number of macroblock rows at the bottom.
-.IPs "st=<number> (MPEG-2 only)"
-Skip the given number of macroblock rows at the top.
-.IPs "skiploopfilter=<skipvalue> (H.264 only)"
-Skips the loop filter (AKA deblocking) during H.264 decoding.
-Since the filtered frame is supposed to be used as reference
-for decoding dependent frames this has a worse effect on quality
-than not doing deblocking on e.g.\& MPEG-2 video.
-But at least for high bitrate HDTV this provides a big speedup with
-no visible quality loss.
-.sp 1
-<skipvalue> can be either one of the following:
-.RSss
-.br
-none: Never skip.
-.br
-default: Skip useless processing steps (e.g.\& 0 size packets in AVI).
-.br
-nonref: Skip frames that are not referenced (i.e.\& not used for
-decoding other frames, the error cannot "build up").
-.br
-bidir: Skip B-Frames.
-.br
-nonkey: Skip all frames except keyframes.
-.br
-all: Skip all frames.
-.REss
-.IPs "skipidct=<skipvalue> (MPEG-1/2 only)"
-Skips the IDCT step.
-This degrades quality a lot of in almost all cases
-(see skiploopfilter for available skip values).
-.IPs skipframe=<skipvalue>
-Skips decoding of frames completely.
-Big speedup, but jerky motion and sometimes bad artifacts
-(see skiploopfilter for available skip values).
-.IPs "threads=<0\-16>"
-Number of threads to use for decoding.
-Whether threading is actually supported depends on codec.
-0 means autodetect number of cores on the machine and use that, up to the
-maximum of 16.
-(default: 0)
-.IPs vismv=<value>
-Visualize motion vectors.
-.RSss
-.br
-0: disabled
-.br
-1: Visualize forward predicted MVs of P-frames.
-.br
-2: Visualize forward predicted MVs of B-frames.
-.br
-4: Visualize backward predicted MVs of B-frames.
-.REss
-.IPs vstats
-Prints some statistics and stores them in ./vstats_*.log.
-.RE
-.
-.TP
-.B \-noslices
-Disable drawing video by 16-pixel height slices/\:bands, instead draws the
-whole frame in a single run.
-May be faster or slower, depending on video card and available cache.
-It has effect only with libmpeg2 and libavcodec codecs.
-.
-.TP
-.B \-nosound
-Do not play sound.
-Useful for benchmarking.
-.
-.TP
-.B \-novideo
-Do not play video.
-With some demuxers this may not work. In those cases you can try \-vc null \-vo null instead; but "\-vc null" is always unreliable.
-.
-.TP
-.B \-pp <quality> (also see \-vf pp)
-Set the DLL postprocess level.
-This option is no longer usable with \-vf pp.
-It only works with Win32 DirectShow DLLs with internal postprocessing routines.
-The valid range of \-pp values varies by codec, it is mostly
-0\-6, where 0=disable, 6=slowest/\:best.
-.
-.TP
-.B \-pphelp (also see \-vf pp)
-Show a summary about the available postprocess filters and their usage.
-.
-.TP
-.B \-ssf <mode>
-Specifies software scaler parameters.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-\-vf scale \-ssf lgb=3.0
-.RE
-.PD 1
-.PD 0
-.RSs
-.IPs lgb=<0\-100>
-gaussian blur filter (luma)
-.IPs cgb=<0\-100>
-gaussian blur filter (chroma)
-.IPs ls=<\-100\-100>
-sharpen filter (luma)
-.IPs cs=<\-100\-100>
-sharpen filter (chroma)
-.IPs chs=<h>
-chroma horizontal shifting
-.IPs cvs=<v>
-chroma vertical shifting
-.RE
-.PD 1
-.
-.TP
-.B \-stereo <mode>
-Select type of MP2/\:MP3 stereo output.
-.PD 0
-.RSs
-.IPs 0
-stereo
-.IPs 1
-left channel
-.IPs 2
-right channel
-.RE
-.PD 1
-.
-.TP
-.B \-sws <software scaler type> (also see \-vf scale and \-zoom)
-Specify the software scaler algorithm to be used with the \-zoom option.
-This affects video output drivers which lack hardware acceleration, e.g.\& x11.
-.sp 1
-Available types are:
-.sp 1
-.PD 0
-.RSs
-.IPs 0
-fast bilinear
-.IPs 1
-bilinear
-.IPs 2
-bicubic (good quality) (default)
-.IPs 3
-experimental
-.IPs 4
-nearest neighbor (bad quality)
-.IPs 5
-area
-.IPs 6
-luma bicubic / chroma bilinear
-.IPs 7
-gauss
-.IPs 8
-sincR
-.IPs 9
-lanczos
-.IPs 10
-natural bicubic spline
-.RE
-.PD 1
-.sp 1
-.RS
-.I NOTE:
-Some \-sws options are tunable.
-The description of the scale video filter has further information.
-.RE
-.
-.TP
-.B \-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 ',' MPlayer will fall back on codecs not
-contained in the list.
-.br
-.I NOTE:
-See \-vc help for a full list of available codecs.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-vc divx"
-Force Win32/\:VfW DivX codec, no fallback.
-.IPs "\-vc \-divxds,\-divx,"
-Skip Win32 DivX codecs.
-.IPs "\-vc ffmpeg12,mpeg12,"
-Try libavcodec's MPEG-1/2 codec, then libmpeg2, then others.
-.RE
-.PD 1
-.
-.TP
-.B \-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.
-.br
-.I NOTE:
-See \-vfm help for a full list of available codec families.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-vfm ffmpeg,dshow,vfw"
-Try the libavcodec, then Directshow, then VfW codecs and fall back
-on others, if they do not work.
-.IPs "\-vfm xanim"
-Try XAnim codecs first.
-.RE
-.PD 1
-.
-.TP
-.B \-x <x> (also see \-zoom)
-Scale image to width <x> (if software/\:hardware scaling is available).
-Disables aspect calculations.
-.
-.TP
-.B \-xvidopts <option1:option2:...>
-Specify additional parameters when decoding with Xvid.
-.br
-.I NOTE:
-Since libavcodec is faster than Xvid you might want to use the libavcodec
-postprocessing filter (\-vf pp) and decoder (\-vfm ffmpeg) instead.
-.sp 1
-Xvid's internal postprocessing filters:
-.PD 0
-.RSs
-.IPs "deblock-chroma (also see \-vf pp)"
-chroma deblock filter
-.IPs "deblock-luma (also see \-vf pp)"
-luma deblock filter
-.IPs "dering-luma (also see \-vf pp)"
-luma deringing filter
-.IPs "dering-chroma (also see \-vf pp)"
-chroma deringing filter
-.IPs "filmeffect (also see \-vf noise)"
-Adds artificial film grain to the video.
-May increase perceived quality, while lowering true quality.
-.RE
-.sp 1
-.RS
-rendering methods:
-.RE
-.PD 0
-.RSs
-.IPs "dr2\ \ "
-Activate direct rendering method 2.
-.IPs nodr2
-Deactivate direct rendering method 2.
-.RE
-.PD 1
-.
-.TP
-.B \-xy <value> (also see \-zoom)
-.PD 0
-.RSs
-.IPs value<=8
-Scale image by factor <value>.
-.IPs value>8
-Set width to value and calculate height to keep correct aspect ratio.
-.RE
-.PD 1
-.
-.TP
-.B \-y <y> (also see \-zoom)
-Scale image to height <y> (if software/\:hardware scaling is available).
-Disables aspect calculations.
-.
-.TP
-.B "\-zoom\ \ "
-Allow software scaling, where available.
-This will allow scaling with output drivers (like x11, fbdev) that
-do not support hardware scaling where MPlayer disables scaling by
-default for performance reasons.
-.
-.
-.
-.SH "AUDIO FILTERS"
-Audio filters allow you to modify the audio stream and its properties.
-The syntax is:
-.
-.TP
-.B \-af <filter1[=parameter1:parameter2:...],filter2,...>
-Setup a chain of audio filters.
-.PP
-.I NOTE:
-To get a full list of available audio filters, see \-af help.
-.sp 1
-Audio filters are managed in lists.
-There are a few commands to manage the filter list.
-.
-.TP
-.B \-af\-add <filter1[,filter2,...]>
-Appends the filters given as arguments to the filter list.
-.
-.TP
-.B \-af\-pre <filter1[,filter2,...]>
-Prepends the filters given as arguments to the filter list.
-.
-.TP
-.B \-af\-del <index1[,index2,...]>
-Deletes the filters at the given indexes.
-Index numbers start at 0, negative numbers address the end of the
-list (\-1 is the last).
-.
-.TP
-.B \-af\-clr
-Completely empties the filter list.
-.PP
-Available filters are:
-.
-.TP
-.B resample[=srate[:sloppy[:type]]]
-Changes the sample rate of the audio stream.
-Can be used if you have a fixed frequency sound card or if you are
-stuck with an old sound card that is only capable of max 44.1kHz.
-This filter is automatically enabled if necessary.
-It only supports 16-bit integer and float in native-endian format as input.
-.PD 0
-.RSs
-.IPs <srate>
-output sample frequency in Hz.
-The valid range for this parameter is 8000 to 192000.
-If the input and output sample frequency are the same or if this
-parameter is omitted the filter is automatically unloaded.
-A high sample frequency normally improves the audio quality,
-especially when used in combination with other filters.
-.IPs <sloppy>
-Allow (1) or disallow (0) the output frequency to differ slightly
-from the frequency given by <srate> (default: 1).
-Can be used if the startup of the playback is extremely slow.
-.IPs <type>
-Select which resampling method to use.
-.RSss
-0: linear interpolation (fast, poor quality especially when upsampling)
-.br
-1: polyphase filterbank and integer processing
-.br
-2: polyphase filterbank and floating point processing (slow, best quality)
-.REss
-.PD 1
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-.IPs "mplayer \-af resample=44100:0:0"
-would set the output frequency of the resample filter to 44100Hz using
-exact output frequency scaling and linear interpolation.
-.RE
-.PD 1
-.
-.TP
-.B lavcresample[=srate[:length[:linear[:count[:cutoff]]]]]
-Changes the sample rate of the audio stream to an integer <srate> in Hz.
-It only supports the 16-bit native-endian format.
-.PD 0
-.RSs
-.IPs <srate>
-the output sample rate
-.IPs <length>
-length of the filter with respect to the lower sampling rate (default: 16)
-.IPs <linear>
-if 1 then filters will be linearly interpolated between polyphase entries
-.IPs <count>
-log2 of the number of polyphase entries
-(..., 10->1024, 11->2048, 12->4096, ...)
-(default: 10->1024)
-.IPs <cutoff>
-cutoff frequency (0.0\-1.0), default set depending upon filter length
-.RE
-.PD 1
-.
-.TP
-.B lavcac3enc[=tospdif[:bitrate[:minchn]]]
-Encode multi-channel audio to AC-3 at runtime using libavcodec.
-Supports 16-bit native-endian input format, maximum 6 channels.
-The output is big-endian when outputting a raw AC-3 stream,
-native-endian when outputting to S/PDIF.
-The output sample rate of this filter is same with the input sample rate.
-When input sample rate is 48kHz, 44.1kHz, or 32kHz, this filter directly use it.
-Otherwise a resampling filter is auto-inserted before this filter to make
-the input and output sample rate be 48kHz.
-You need to specify '\-channels N' to make the decoder decode audio into
-N-channel, then the filter can encode the N-channel input to AC-3.
-.br
-.PD 0
-.RSs
-.IPs <tospdif>
-Output raw AC-3 stream if zero or not set,
-output to S/PDIF for passthrough when <tospdif> is set non-zero.
-.IPs <bitrate>
-The bitrate to encode the AC-3 stream.
-Set it to either 384 or 384000 to get 384kbits.
-Valid values: 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256,
- 320, 384, 448, 512, 576, 640
-Default bitrate is based on the input channel number:
-1ch: 96, 2ch: 192, 3ch: 224, 4ch: 384, 5ch: 448, 6ch: 448
-.IPs <minchn>
-If the input channel number is less than <minchn>, the filter will
-detach itself (default: 5).
-.RE
-.PD 1
-.
-.TP
-.B sweep[=speed]
-Produces a sine sweep.
-.PD 0
-.RSs
-.IPs <0.0\-1.0>
-Sine function delta, use very low values to hear the sweep.
-.RE
-.PD 1
-.
-.TP
-.B sinesuppress[=freq:decay]
-Remove a sine at the specified frequency.
-Useful to get rid of the 50/60Hz noise on low quality audio equipment.
-It probably only works on mono input.
-.PD 0
-.RSs
-.IPs <freq>
-The frequency of the sine which should be removed (in Hz) (default: 50)
-.IPs <decay>
-Controls the adaptivity (a larger value will make the filter adapt to
-amplitude and phase changes quicker, a smaller value will make the
-adaptation slower) (default: 0.0001).
-Reasonable values are around 0.001.
-.RE
-.PD 1
-.
-.TP
-.B bs2b[=option1:option2:...]
-Bauer stereophonic to binaural transformation using libbs2b.
-Improves the headphone listening experience by making the sound
-similar to that from loudspeakers, allowing each ear to hear both
-channels and taking into account the distance difference and the
-head shadowing effect.
-It is applicable only to 2 channel audio.
-.PD 0
-.RSs
-.IPs fcut=<300\-1000>
-Set cut frequency in Hz.
-.IPs feed=<10\-150>
-Set feed level for low frequencies in 0.1*dB.
-.IPs profile=<value>
-Several profiles are available for convenience:
-.PD 0
-.RSs
-.IPs default
-will be used if nothing else was specified (fcut=700, feed=45)
-.IPs "cmoy\ "
-Chu Moy circuit implementation (fcut=700, feed=60)
-.IPs jmeier
-Jan Meier circuit implementation (fcut=650, feed=95)
-.RE
-.RE
-.sp 1
-.RS
-If fcut or feed options are specified together with a profile, they
-will be applied on top of the selected profile.
-.RE
-.PD 1
-.
-.TP
-.B hrtf[=flag]
-Head-related transfer function: Converts multichannel audio to
-2 channel output for headphones, preserving the spatiality of the sound.
-.sp 1
-.PD 0
-.RS
-.IPs "Flag Meaning"
-.IPs "m matrix decoding of the rear channel"
-.IPs "s 2-channel matrix decoding"
-.IPs "0 no matrix decoding (default)"
-.RE
-.PD 1
-.
-.TP
-.B equalizer=[g1:g2:g3:...:g10]
-10 octave band graphic equalizer, implemented using 10 IIR band pass filters.
-This means that it works regardless of what type of audio is being played back.
-The center frequencies for the 10 bands are:
-.sp 1
-.PD 0
-.RS
-.IPs "No. frequency"
-.IPs "0 31.25 Hz"
-.IPs "1 62.50 Hz"
-.IPs "2 125.00 Hz"
-.IPs "3 250.00 Hz"
-.IPs "4 500.00 Hz"
-.IPs "5 1.00 kHz"
-.IPs "6 2.00 kHz"
-.IPs "7 4.00 kHz"
-.IPs "8 8.00 kHz"
-.IPs "9 16.00 kHz"
-.RE
-.PD 1
-.sp 1
-.RS
-If the sample rate of the sound being played is lower than the center
-frequency for a frequency band, then that band will be disabled.
-A known bug with this filter is that the characteristics for the
-uppermost band are not completely symmetric if the sample
-rate is close to the center frequency of that band.
-This problem can be worked around by upsampling the sound
-using the resample filter before it reaches this filter.
-.RE
-.PD 0
-.RSs
-.IPs <g1>:<g2>:<g3>:...:<g10>
-floating point numbers representing the gain in dB
-for each frequency band (\-12\-12)
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af equalizer=11:11:10:5:0:\-12:0:5:12:12 media.avi"
-Would amplify the sound in the upper and lower frequency region
-while canceling it almost completely around 1kHz.
-.RE
-.PD 1
-.
-.TP
-.B channels=nch[:nr:from1:to1:from2:to2:from3:to3:...]
-Can be used for adding, removing, routing and copying audio channels.
-If only <nch> is given the default routing is used, it works as
-follows: If the number of output channels is bigger than the number of
-input channels empty channels are inserted (except mixing from mono to
-stereo, then the mono channel is repeated in both of the output
-channels).
-If the number of output channels is smaller than the number
-of input channels the exceeding channels are truncated.
-.PD 0
-.RSs
-.IPs <nch>
-number of output channels (1\-8)
-.IPs "<nr>\ "
-number of routes (1\-8)
-.IPs <from1:to1:from2:to2:from3:to3:...>
-Pairs of numbers between 0 and 7 that define where to route each channel.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af channels=4:4:0:1:1:0:2:2:3:3 media.avi"
-Would change the number of channels to 4 and set up 4 routes that
-swap channel 0 and channel 1 and leave channel 2 and 3 intact.
-Observe that if media containing two channels was played back, channels
-2 and 3 would contain silence but 0 and 1 would still be swapped.
-.IPs "mplayer \-af channels=6:4:0:0:0:1:0:2:0:3 media.avi"
-Would change the number of channels to 6 and set up 4 routes
-that copy channel 0 to channels 0 to 3.
-Channel 4 and 5 will contain silence.
-.RE
-.PD 1
-.
-.TP
-.B format[=format] (also see \-format)
-Convert between different sample formats.
-Automatically enabled when needed by the sound card or another filter.
-.PD 0
-.RSs
-.IPs <format>
-Sets the desired format.
-The general form is 'sbe', where 's' denotes the sign (either 's' for signed
-or 'u' for unsigned), 'b' denotes the number of bits per sample (16, 24 or 32)
-and 'e' denotes the endianness ('le' means little-endian, 'be' big-endian
-and 'ne' the endianness of the computer MPlayer is running on).
-Valid values (amongst others) are: 's16le', 'u32be' and 'u24ne'.
-Exceptions to this rule that are also valid format specifiers: u8, s8,
-floatle, floatbe, floatne, mulaw, alaw, mpeg2, ac3 and imaadpcm.
-.RE
-.PD 1
-.
-.TP
-.B volume[=v[:sc]]
-Implements software volume control.
-Use this filter with caution since it can reduce the signal
-to noise ratio of the sound.
-In most cases it is best to set the level for the PCM sound to max,
-leave this filter out and control the output level to your
-speakers with the master volume control of the mixer.
-In case your sound card has a digital PCM mixer instead of an analog
-one, and you hear distortion, use the MASTER mixer instead.
-If there is an external amplifier connected to the computer (this
-is almost always the case), the noise level can be minimized by
-adjusting the master level and the volume knob on the amplifier
-until the hissing noise in the background is gone.
-.br
-This filter has a second feature: It measures the overall maximum
-sound level and prints out that level when MPlayer exits.
-This feature currently only works with floating-point data,
-use e.g. \-af\-adv force=5, or use \-af stats.
-.br
-.I NOTE:
-This filter is not reentrant and can therefore only be enabled
-once for every audio stream.
-.PD 0
-.RSs
-.IPs "<v>\ \ "
-Sets the desired gain in dB for all channels in the stream
-from \-200dB to +60dB, where \-200dB mutes the sound
-completely and +60dB equals a gain of 1000 (default: 0).
-.IPs "<sc>\ "
-Turns soft clipping on (1) or off (0).
-Soft-clipping can make the sound more smooth if very
-high volume levels are used.
-Enable this option if the dynamic range of the
-loudspeakers is very low.
-.br
-.I WARNING:
-This feature creates distortion and should be considered a last resort.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af volume=10.1:0 media.avi"
-Would amplify the sound by 10.1dB and hard-clip if the
-sound level is too high.
-.RE
-.PD 1
-.
-.TP
-.B pan=n[:L00:L01:L02:...L10:L11:L12:...Ln0:Ln1:Ln2:...]
-Mixes channels arbitrarily.
-Basically a combination of the volume and the channels filter
-that can be used to down-mix many channels to only a few,
-e.g.\& stereo to mono or vary the "width" of the center
-speaker in a surround sound system.
-This filter is hard to use, and will require some tinkering
-before the desired result is obtained.
-The number of options for this filter depends on
-the number of output channels.
-An example how to downmix a six-channel file to two channels with
-this filter can be found in the examples section near the end.
-.PD 0
-.RSs
-.IPs "<n>\ \ "
-number of output channels (1\-8)
-.IPs <Lij>
-How much of input channel i is mixed into output channel j (0\-1).
-So in principle you first have n numbers saying what to do with the
-first input channel, then n numbers that act on the second input channel
-etc.
-If you do not specify any numbers for some input channels, 0 is assumed.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af pan=1:0.5:0.5 media.avi"
-Would down-mix from stereo to mono.
-.IPs "mplayer \-af pan=3:1:0:0.5:0:1:0.5 media.avi"
-Would give 3 channel output leaving channels 0 and 1 intact,
-and mix channels 0 and 1 into output channel 2 (which could
-be sent to a subwoofer for example).
-.RE
-.PD 1
-.
-.TP
-.B sub[=fc:ch]
-Adds a subwoofer channel to the audio stream.
-The audio data used for creating the subwoofer channel is
-an average of the sound in channel 0 and channel 1.
-The resulting sound is then low-pass filtered by a 4th order
-Butterworth filter with a default cutoff frequency of 60Hz
-and added to a separate channel in the audio stream.
-.br
-.I Warning:
-Disable this filter when you are playing DVDs with Dolby
-Digital 5.1 sound, otherwise this filter will disrupt
-the sound to the subwoofer.
-.PD 0
-.RSs
-.IPs "<fc>\ "
-cutoff frequency in Hz for the low-pass filter (20Hz to 300Hz) (default: 60Hz)
-For the best result try setting the cutoff frequency as low as possible.
-This will improve the stereo or surround sound experience.
-.IPs "<ch>\ "
-Determines the channel number in which to insert the sub-channel audio.
-Channel number can be between 0 and 7 (default: 5).
-Observe that the number of channels will automatically
-be increased to <ch> if necessary.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af sub=100:4 \-channels 5 media.avi"
-Would add a sub-woofer channel with a cutoff frequency of
-100Hz to output channel 4.
-.RE
-.PD 1
-.
-.TP
-.B "center\ "
-Creates a center channel from the front channels.
-May currently be low quality as it does not implement a
-high-pass filter for proper extraction yet, but averages and
-halves the channels instead.
-.PD 0
-.RSs
-.IPs "<ch>\ "
-Determines the channel number in which to insert the center channel.
-Channel number can be between 0 and 7 (default: 5).
-Observe that the number of channels will automatically
-be increased to <ch> if necessary.
-.RE
-.PD 1
-.
-.TP
-.B surround[=delay]
-Decoder for matrix encoded surround sound like Dolby Surround.
-Many files with 2 channel audio actually contain matrixed surround sound.
-Requires a sound card supporting at least 4 channels.
-.PD 0
-.RSs
-.IPs <delay>
-delay time in ms for the rear speakers (0 to 1000) (default: 20)
-This delay should be set as follows: If d1 is the distance
-from the listening position to the front speakers and d2 is the distance
-from the listening position to the rear speakers, then the delay should
-be set to 15ms if d1 <= d2 and to 15 + 5*(d1-d2) if d1 > d2.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af surround=15 \-channels 4 media.avi"
-Would add surround sound decoding with 15ms delay for the sound to the
-rear speakers.
-.RE
-.PD 1
-.
-.TP
-.B delay[=ch1:ch2:...]
-Delays the sound to the loudspeakers such that the sound from the
-different channels arrives at the listening position simultaneously.
-It is only useful if you have more than 2 loudspeakers.
-.PD 0
-.RSs
-.IPs ch1,ch2,...
-The delay in ms that should be imposed on each channel
-(floating point number between 0 and 1000).
-.RE
-.PD 1
-.sp 1
-.RS
-To calculate the required delay for the different channels do as follows:
-.IP 1. 3
-Measure the distance to the loudspeakers in meters in relation
-to your listening position, giving you the distances s1 to s5
-(for a 5.1 system).
-There is no point in compensating for the subwoofer (you will not hear the
-difference anyway).
-.IP 2. 3
-Subtract the distances s1 to s5 from the maximum distance,
-i.e.\& s[i] = max(s) \- s[i]; i = 1...5.
-.IP 3.
-Calculate the required delays in ms as d[i] = 1000*s[i]/342; i = 1...5.
-.RE
-.PD 0
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af delay=10.5:10.5:0:0:7:0 media.avi"
-Would delay front left and right by 10.5ms, the two rear channels
-and the sub by 0ms and the center channel by 7ms.
-.RE
-.PD 1
-.
-.TP
-.B export[=mmapped_file[:nsamples]]
-Exports the incoming signal to other processes using memory mapping (mmap()).
-Memory mapped areas contain a header:
-.sp 1
-.nf
-int nch /*number of channels*/
-int size /*buffer size*/
-unsigned long long counter /*Used to keep sync, updated every
- time new data is exported.*/
-.fi
-.sp 1
-The rest is payload (non-interleaved) 16 bit data.
-.PD 0
-.RSs
-.IPs <mmapped_file>
-file to map data to (default: ~/.mplayer/\:mplayer-af_export)
-.IPs <nsamples>
-number of samples per channel (default: 512)
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af export=/tmp/mplayer-af_export:1024 media.avi"
-Would export 1024 samples per channel to '/tmp/mplayer-af_export'.
-.RE
-.PD 1
-.
-.TP
-.B extrastereo[=mul]
-(Linearly) increases the difference between left and right channels
-which adds some sort of "live" effect to playback.
-.PD 0
-.RSs
-.IPs <mul>
-Sets the difference coefficient (default: 2.5).
-0.0 means mono sound (average of both channels), with 1.0 sound will be
-unchanged, with \-1.0 left and right channels will be swapped.
-.RE
-.PD 1
-.
-.TP
-.B volnorm[=method:target]
-Maximizes the volume without distorting the sound.
-.PD 0
-.RSs
-.IPs <method>
-Sets the used method.
-.RSss
-1: Use a single sample to smooth the variations via the standard
-weighted mean over past samples (default).
-.br
-2: Use several samples to smooth the variations via the standard
-weighted mean over past samples.
-.REss
-.IPs <target>
-Sets the target amplitude as a fraction of the maximum for the
-sample type (default: 0.25).
-.RE
-.PD 1
-.
-.TP
-.B ladspa=file:label[:controls...]
-Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
-This filter is reentrant, so multiple LADSPA plugins can be used at once.
-.PD 0
-.RSs
-.IPs <file>
-Specifies the LADSPA plugin library file.
-If LADSPA_PATH is set, it searches for the specified file.
-If it is not set, you must supply a fully specified pathname.
-.IPs <label>
-Specifies the filter within the library.
-Some libraries contain only one filter, but others contain many of them.
-Entering 'help' here, will list all available filters within the specified
-library, which eliminates the use of 'listplugins' from the LADSPA SDK.
-.IPs <controls>
-Controls are zero or more floating point values that determine the
-behavior of the loaded plugin (for example delay, threshold or gain).
-In verbose mode (add \-v to the MPlayer command line), all available controls
-and their valid ranges are printed.
-This eliminates the use of 'analyseplugin' from the LADSPA SDK.
-.RE
-.PD 1
-.
-.TP
-.B "comp\ \ \ "
-Compressor/expander filter usable for microphone input.
-Prevents artifacts on very loud sound and raises the volume on
-very low sound.
-This filter is untested, maybe even unusable.
-.
-.TP
-.B "gate\ \ \ "
-Noise gate filter similar to the comp audio filter.
-This filter is untested, maybe even unusable.
-.
-.TP
-.B karaoke
-Simple voice removal filter exploiting the fact that voice is
-usually recorded with mono gear and later 'center' mixed onto
-the final audio stream.
-Beware that this filter will turn your signal into mono.
-Works well for 2 channel tracks; do not bother trying it
-on anything but 2 channel stereo.
-.
-.TP
-.B scaletempo[=option1:option2:...]
-Scales audio tempo without altering pitch, optionally synced to playback
-speed (default).
-.br
-This works by playing \'stride\' ms of audio at normal speed then
-consuming \'stride*scale\' ms of input audio.
-It pieces the strides together by blending \'overlap\'% of stride with
-audio following the previous stride.
-It optionally performs a short statistical analysis on the next \'search\'
-ms of audio to determine the best overlap position.
-.PD 0
-.RSs
-.IPs scale=<amount>
-Nominal amount to scale tempo.
-Scales this amount in addition to speed.
-(default: 1.0)
-.IPs stride=<amount>
-Length in milliseconds to output each stride.
-Too high of value will cause noticable skips at high scale amounts and
-an echo at low scale amounts.
-Very low values will alter pitch.
-Increasing improves performance.
-(default: 60)
-.IPs overlap=<percent>
-Percentage of stride to overlap.
-Decreasing improves performance.
-(default: .20)
-.IPs search=<amount>
-Length in milliseconds to search for best overlap position.
-Decreasing improves performance greatly.
-On slow systems, you will probably want to set this very low.
-(default: 14)
-.IPs speed=<tempo|pitch|both|none>
-Set response to speed change.
-.RSss
-.IPs tempo
-Scale tempo in sync with speed (default).
-.IPs pitch
-Reverses effect of filter.
-Scales pitch without altering tempo.
-Add \'[ speed_mult 0.9438743126816935\' and \'] speed_mult 1.059463094352953\'
-to your input.conf to step by musical semi-tones.
-.I WARNING:
-Loses sync with video.
-.IPs both
-Scale both tempo and pitch.
-.IPs none
-Ignore speed changes.
-.RE
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.RSs
-.IPs "mplayer \-af scaletempo \-speed 1.2 media.ogg"
-Would playback media at 1.2x normal speed, with audio at normal pitch.
-Changing playback speed, would change audio tempo to match.
-.IPs "mplayer \-af scaletempo=scale=1.2:speed=none \-speed 1.2 media.ogg"
-Would playback media at 1.2x normal speed, with audio at normal pitch,
-but changing playback speed has no effect on audio tempo.
-.IPs "mplayer \-af scaletempo=stride=30:overlap=.50:search=10 media.ogg"
-Would tweak the quality and performace parameters.
-.IPs "mplayer \-af format=floatne,scaletempo media.ogg"
-Would make scaletempo use float code.
-Maybe faster on some platforms.
-.IPs "mplayer \-af scaletempo=scale=1.2:speed=pitch audio.ogg"
-Would playback audio file at 1.2x normal speed, with audio at normal pitch.
-Changing playback speed, would change pitch, leaving audio tempo at 1.2x.
-.RE
-.PD 1
-.
-.TP
-.B "stats\ \ "
-Collects and prints statistics about the audio stream, especially the volume.
-These statistics are especially intended to help adjusting the volume while
-avoiding clipping.
-The volumes are printed in dB and compatible with the volume audio filter.
-.
-.
-.
-.SH "VIDEO FILTERS"
-Video filters allow you to modify the video stream and its properties.
-The syntax is:
-.
-.TP
-.B \-vf <filter1[=parameter1:parameter2:...],filter2,...>
-Setup a chain of video filters.
-.PP
-Many parameters are optional and set to default values if omitted.
-To explicitly use a default value set a parameter to '\-1'.
-Parameters w:h means width x height in pixels, x:y means x;y position counted
-from the upper left corner of the bigger image.
-.br
-.I NOTE:
-To get a full list of available video filters, see \-vf help.
-.sp 1
-Video filters are managed in lists.
-There are a few commands to manage the filter list.
-.
-.TP
-.B \-vf\-add <filter1[,filter2,...]>
-Appends the filters given as arguments to the filter list.
-.
-.TP
-.B \-vf\-pre <filter1[,filter2,...]>
-Prepends the filters given as arguments to the filter list.
-.
-.TP
-.B \-vf\-del <index1[,index2,...]>
-Deletes the filters at the given indexes.
-Index numbers start at 0, negative numbers address the end of the
-list (\-1 is the last).
-.
-.TP
-.B \-vf\-clr
-Completely empties the filter list.
-.PP
-With filters that support it, you can access parameters by their name.
-.
-.TP
-.B \-vf <filter>=help
-Prints the parameter names and parameter value ranges for a particular
-filter.
-.
-.TP
-.B \-vf <filter=named_parameter1=value1[:named_parameter2=value2:...]>
-Sets a named parameter to the given value.
-Use on and off or yes and no to set flag parameters.
-.PP
-Available filters are:
-.
-.TP
-.B crop[=w:h:x:y]
-Crops the given part of the image and discards the rest.
-Useful to remove black bands from widescreen movies.
-.PD 0
-.RSs
-.IPs <w>,<h>
-Cropped width and height, defaults to original width and height.
-.IPs <x>,<y>
-Position of the cropped picture, defaults to center.
-.RE
-.PD 1
-.
-.TP
-.B cropdetect[=limit:round[:reset]]
-Calculates necessary cropping parameters and prints the recommended parameters
-to stdout.
-.PD 0
-.RSs
-.IPs <limit>
-Threshold, which can be optionally specified from nothing (0) to
-everything (255) (default: 24).
-.br
-.IPs <round>
-Value which the width/\:height should be divisible by (default: 16).
-The offset is automatically adjusted to center the video.
-Use 2 to get only even dimensions (needed for 4:2:2 video).
-16 is best when encoding to most video codecs.
-.br
-.IPs <reset>
-Counter that determines after how many frames cropdetect will reset the
-previously detected largest video area and start over to detect the current
-optimal crop area (default: 0).
-This can be useful when channel logos distort the video area.
-0 indicates never reset and return the largest area encountered during playback.
-.RE
-.PD 1
-.
-.TP
-.B rectangle[=w:h:x:y]
-Draws a rectangle of the requested width and height at the specified
-coordinates over the image and prints current rectangle parameters
-to the console.
-This can be used to find optimal cropping parameters.
-If you bind the input.conf directive 'change_rectangle' to keystrokes,
-you can move and resize the rectangle on the fly.
-.PD 0
-.RSs
-.IPs <w>,<h>
-width and height (default: \-1, maximum possible width where boundaries
-are still visible.)
-.IPs <x>,<y>
-top left corner position (default: \-1, uppermost leftmost)
-.RE
-.PD 1
-.
-.TP
-.B expand[=w:h:x:y:o:a:r]
-Expands (not scales) movie resolution to the given value and places the
-unscaled original at coordinates x, y.
-Can be used for placing subtitles/\:OSD in the resulting black bands.
-.RSs
-.IPs <w>,<h>
-Expanded width,height (default: original width,height).
-Negative values for w and h are treated as offsets to the original size.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IP expand=0:\-50:0:0
-Adds a 50 pixel border to the bottom of the picture.
-.RE
-.PD 1
-.IPs <x>,<y>
-position of original image on the expanded image (default: center)
-.IPs "<o>\ \ "
-OSD/\:subtitle rendering
-.RSss
-0: disable (default)
-.br
-1: enable
-.REss
-.IPs "<a>\ \ "
-Expands to fit an aspect instead of a resolution (default: 0).
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IP expand=800:::::4/3
-Expands to 800x600, unless the source is higher resolution, in which
-case it expands to fill a 4/3 aspect.
-.RE
-.PD 1
-.IPs "<r>\ \ "
-Rounds up to make both width and height divisible by <r> (default: 1).
-.RE
-.
-.TP
-.B flip (also see \-flip)
-Flips the image upside down.
-.
-.TP
-.B "mirror\ "
-Mirrors the image on the Y axis.
-.
-.TP
-.B rotate[=<0\-7>]
-Rotates the image by 90 degrees and optionally flips it.
-For values between 4\-7 rotation is only done if the movie geometry is
-portrait and not landscape.
-.RSs
-.IPs 0
-Rotate by 90 degrees clockwise and flip (default).
-.IPs 1
-Rotate by 90 degrees clockwise.
-.IPs 2
-Rotate by 90 degrees counterclockwise.
-.IPs 3
-Rotate by 90 degrees counterclockwise and flip.
-.RE
-.
-.TP
-.B scale[=w:h[:interlaced[:chr_drop[:par[:par2[:presize[:noup[:arnd]]]]]]]]
-Scales the image with the software scaler (slow) and performs a YUV<\->RGB
-colorspace conversion (also see \-sws).
-.RSs
-.IPs <w>,<h>
-scaled width/\:height (default: original width/\:height)
-.br
-.I NOTE:
-If \-zoom is used, and underlying filters (including libvo) are
-incapable of scaling, it defaults to d_width/\:d_height!
-.RSss
- 0: scaled d_width/\:d_height
-.br
-\-1: original width/\:height
-.br
-\-2: Calculate w/h using the other dimension and the prescaled aspect ratio.
-.br
-\-3: Calculate w/h using the other dimension and the original aspect ratio.
-.br
-\-(n+8): Like \-n above, but rounding the dimension to the closest multiple of 16.
-.REss
-.IPs <interlaced>
-Toggle interlaced scaling.
-.RSss
-0: off (default)
-.br
-1: on
-.REss
-.IPs <chr_drop>
-chroma skipping
-.RSss
-0: Use all available input lines for chroma.
-.br
-1: Use only every 2. input line for chroma.
-.br
-2: Use only every 4. input line for chroma.
-.br
-3: Use only every 8. input line for chroma.
-.REss
-.IPs "<par>[:<par2>] (also see \-sws)"
-Set some scaling parameters depending on the type of scaler selected
-with \-sws.
-.RSss
-\-sws 2 (bicubic): B (blurring) and C (ringing)
-.br
-0.00:0.60 default
-.br
-0.00:0.75 VirtualDub's "precise bicubic"
-.br
-0.00:0.50 Catmull-Rom spline
-.br
-0.33:0.33 Mitchell-Netravali spline
-.br
-1.00:0.00 cubic B-spline
-.br
-\-sws 7 (gaussian): sharpness (0 (soft) \- 100 (sharp))
-.br
-\-sws 9 (lanczos): filter length (1\-10)
-.REss
-.IPs <presize>
-Scale to preset sizes.
-.RSss
-qntsc: 352x240 (NTSC quarter screen)
-.br
-qpal: 352x288 (PAL quarter screen)
-.br
-ntsc: 720x480 (standard NTSC)
-.br
-pal: 720x576 (standard PAL)
-.br
-sntsc: 640x480 (square pixel NTSC)
-.br
-spal: 768x576 (square pixel PAL)
-.REss
-.IPs <noup>
-Disallow upscaling past the original dimensions.
-.RSss
-0: Allow upscaling (default).
-.br
-1: Disallow upscaling if one dimension exceeds its original value.
-.br
-2: Disallow upscaling if both dimensions exceed their original values.
-.REss
-.IPs <arnd>
-Accurate rounding for the vertical scaler, which may be faster
-or slower than the default rounding.
-.RSss
-0: Disable accurate rounding (default).
-.br
-1: Enable accurate rounding.
-.REss
-.RE
-.
-.TP
-.B dsize[=aspect|w:h:aspect-method:r]
-Changes the intended display size/\:aspect at an arbitrary point in the
-filter chain.
-Aspect can be given as a fraction (4/3) or floating point number
-(1.33).
-Alternatively, you may specify the exact display width and height
-desired.
-Note that this filter does
-.B not
-do any scaling itself; it just affects
-what later scalers (software or hardware) will do when auto-scaling to
-correct aspect.
-.RSs
-.IPs <w>,<h>
-New display width and height.
-Can also be these special values:
-.RSss
- 0: original display width and height
-.br
-\-1: original video width and height (default)
-.br
-\-2: Calculate w/h using the other dimension and the original display
-aspect ratio.
-.br
-\-3: Calculate w/h using the other dimension and the original video
-aspect ratio.
-.REss
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IP dsize=800:\-2
-Specifies a display resolution of 800x600 for a 4/3 aspect video, or
-800x450 for a 16/9 aspect video.
-.RE
-.IPs <aspect-method>
-Modifies width and height according to original aspect ratios.
-.RSss
-\-1: Ignore original aspect ratio (default).
-.br
- 0: Keep display aspect ratio by using <w> and <h> as maximum
-resolution.
-.br
- 1: Keep display aspect ratio by using <w> and <h> as minimum
-resolution.
-.br
- 2: Keep video aspect ratio by using <w> and <h> as maximum
-resolution.
-.br
- 3: Keep video aspect ratio by using <w> and <h> as minimum
-resolution.
-.REss
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IP dsize=800:600:0
-Specifies a display resolution of at most 800x600, or smaller, in order
-to keep aspect.
-.RE
-.PD 1
-.IPs "<r>\ \ "
-Rounds up to make both width and height divisible by <r> (default: 1).
-.RE
-.
-.TP
-.B "yvu9\ \ \ "
-Forces software YVU9 to YV12 colorspace conversion.
-Deprecated in favor of the software scaler.
-.
-.TP
-.B "yuvcsp\ "
-Clamps YUV color values to the CCIR 601 range without doing real conversion.
-.
-.TP
-.B palette
-RGB/BGR 8 \-> 15/16/24/32bpp colorspace conversion using palette.
-.
-.TP
-.B format[=fourcc[:outfourcc]]
-Restricts the colorspace for the next filter without doing any conversion.
-Use together with the scale filter for a real conversion.
-.br
-.I NOTE:
-For a list of available formats see format=fmt=help.
-.PD 0
-.RSs
-.IPs <fourcc>
-format name like rgb15, bgr24, yv12, etc (default: yuy2)
-.IPs <outfourcc>
-Format name that should be substituted for the output.
-If this is not 100% compatible with the <fourcc> value it will crash.
-.br
-Valid examples:
-.br
-format=rgb24:bgr24 format=yuyv:yuy2
-.br
-Invalid examples (will crash):
-.br
-format=rgb24:yv12
-.RE
-.PD 1
-.
-.TP
-.B noformat[=fourcc]
-Restricts the colorspace for the next filter without doing any conversion.
-Unlike the format filter, this will allow any colorspace
-.B except
-the one you specify.
-.br
-.I NOTE:
-For a list of available formats see noformat=fmt=help.
-.PD 0
-.RSs
-.IPs <fourcc>
-format name like rgb15, bgr24, yv12, etc (default: yv12)
-.RE
-.PD 1
-.
-.TP
-.B pp[=filter1[:option1[:option2...]]/[\-]filter2...] (also see \-pphelp)
-Enables the specified chain of postprocessing subfilters.
-Subfilters must be separated by '/' and can be disabled by
-prepending a '\-'.
-Each subfilter and some options have a short and a long name that can be
-used interchangeably, i.e.\& dr/dering are the same.
-All subfilters share common options to determine their scope:
-.PD 0
-.RSs
-.IPs a/autoq
-Automatically switch the subfilter off if the CPU is too slow.
-.IPs c/chrom
-Do chrominance filtering, too (default).
-.IPs y/nochrom
-Do luminance filtering only (no chrominance).
-.IPs n/noluma
-Do chrominance filtering only (no luminance).
-.RE
-.PD 1
-.sp 1
-.RS
-.br
-.I NOTE:
-\-pphelp shows a list of available subfilters.
-.sp 1
-Available subfilters are
-.RE
-.RSs
-.IPs hb/hdeblock[:difference[:flatness]]
-horizontal deblocking filter
-.RSss
-<difference>: Difference factor where higher values mean
-more deblocking (default: 32).
-.br
-<flatness>: Flatness threshold where lower values mean
-more deblocking (default: 39).
-.REss
-.IPs vb/vdeblock[:difference[:flatness]]
-vertical deblocking filter
-.RSss
-<difference>: Difference factor where higher values mean
-more deblocking (default: 32).
-.br
-<flatness>: Flatness threshold where lower values mean
-more deblocking (default: 39).
-.REss
-.IPs ha/hadeblock[:difference[:flatness]]
-accurate horizontal deblocking filter
-.RSss
-<difference>: Difference factor where higher values mean
-more deblocking (default: 32).
-.br
-<flatness>: Flatness threshold where lower values mean
-more deblocking (default: 39).
-.REss
-.IPs va/vadeblock[:difference[:flatness]]
-accurate vertical deblocking filter
-.RSss
-<difference>: Difference factor where higher values mean
-more deblocking (default: 32).
-.br
-<flatness>: Flatness threshold where lower values mean
-more deblocking (default: 39).
-.REss
-.sp 1
-The horizontal and vertical deblocking filters share the
-difference and flatness values so you cannot set
-different horizontal and vertical thresholds.
-.sp 1
-.IPs h1/x1hdeblock
-experimental horizontal deblocking filter
-.IPs v1/x1vdeblock
-experimental vertical deblocking filter
-.IPs dr/dering
-deringing filter
-.IPs tn/tmpnoise[:threshold1[:threshold2[:threshold3]]]
-temporal noise reducer
-.RSss
-<threshold1>: larger -> stronger filtering
-.br
-<threshold2>: larger -> stronger filtering
-.br
-<threshold3>: larger -> stronger filtering
-.REss
-.IPs al/autolevels[:f/fullyrange]
-automatic brightness / contrast correction
-.RSss
-f/fullyrange: Stretch luminance to (0\-255).
-.REss
-.IPs lb/linblenddeint
-Linear blend deinterlacing filter that deinterlaces the given block
-by filtering all lines with a (1 2 1) filter.
-.IPs li/linipoldeint
-Linear interpolating deinterlacing filter that deinterlaces the given block
-by linearly interpolating every second line.
-.IPs ci/cubicipoldeint
-Cubic interpolating deinterlacing filter deinterlaces the given block
-by cubically interpolating every second line.
-.IPs md/mediandeint
-Median deinterlacing filter that deinterlaces the given block
-by applying a median filter to every second line.
-.IPs fd/ffmpegdeint
-FFmpeg deinterlacing filter that deinterlaces the given block
-by filtering every second line with a (\-1 4 2 4 \-1) filter.
-.IPs l5/lowpass5
-Vertically applied FIR lowpass deinterlacing filter that deinterlaces
-the given block by filtering all lines with a (\-1 2 6 2 \-1) filter.
-.IPs fq/forceQuant[:quantizer]
-Overrides the quantizer table from the input with the constant
-quantizer you specify.
-.RSss
-<quantizer>: quantizer to use
-.REss
-.IPs de/default
-default pp filter combination (hb:a,vb:a,dr:a)
-.IPs fa/fast
-fast pp filter combination (h1:a,v1:a,dr:a)
-.IPs "ac\ \ \ "
-high quality pp filter combination (ha:a:128:7,va:a,dr:a)
-.RE
-.RS
-.sp 1
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-.IPs "\-vf pp=hb/vb/dr/al"
-horizontal and vertical deblocking, deringing and automatic
-brightness/\:contrast
-.IPs "\-vf pp=de/\-al"
-default filters without brightness/\:contrast correction
-.IPs "\-vf pp=default/tmpnoise:1:2:3"
-Enable default filters & temporal denoiser.
-.IPs "\-vf pp=hb:y/vb:a"
-Horizontal deblocking on luminance only, and switch vertical deblocking
-on or off automatically depending on available CPU time.
-.RE
-.PD 1
-.
-.TP
-.B spp[=quality[:qp[:mode]]]
-Simple postprocessing filter that compresses and decompresses the
-image at several (or \- in the case of quality level 6 \- all)
-shifts and averages the results.
-.RSs
-.IPs <quality>
-0\-6 (default: 3)
-.IPs "<qp>\ "
-Force quantization parameter (default: 0, use QP from video).
-.IPs <mode>
-0: hard thresholding (default)
-.br
-1: soft thresholding (better deringing, but blurrier)
-.br
-4: like 0, but also use B-frames' QP (may cause flicker)
-.br
-5: like 1, but also use B-frames' QP (may cause flicker)
-.RE
-.
-.TP
-.B uspp[=quality[:qp]]
-Ultra simple & slow postprocessing filter that compresses and
-decompresses the image at several (or \- in the case of quality
-level 8 \- all) shifts and averages the results.
-The way this differs from the behavior of spp is that uspp actually
-encodes & decodes each case with libavcodec Snow, whereas spp uses
-a simplified intra only 8x8 DCT similar to MJPEG.
-.RSs
-.IPs <quality>
-0\-8 (default: 3)
-.IPs "<qp>\ "
-Force quantization parameter (default: 0, use QP from video).
-.RE
-.
-.TP
-.B fspp[=quality[:qp[:strength[:bframes]]]]
-faster version of the simple postprocessing filter
-.RSs
-.IPs <quality>
-4\-5 (equivalent to spp; default: 4)
-.IPs "<qp>\ "
-Force quantization parameter (default: 0, use QP from video).
-.IPs <\-15\-32>
-Filter strength, lower values mean more details but also more artifacts,
-while higher values make the image smoother but also blurrier (default:
-0 \- PSNR optimal).
-.IPs <bframes>
-0: do not use QP from B-frames (default)
-.br
-1: use QP from B-frames too (may cause flicker)
-.RE
-.
-.TP
-.B pp7[=qp[:mode]]
-Variant of the spp filter, similar to spp=6 with 7 point DCT where
-only the center sample is used after IDCT.
-.RSs
-.IPs "<qp>\ "
-Force quantization parameter (default: 0, use QP from video).
-.IPs <mode>
-0: hard thresholding
-.br
-1: soft thresholding (better deringing, but blurrier)
-.br
-2: medium thresholding (default, good results)
-.RE
-.
-.TP
-.B qp=equation
-quantization parameter (QP) change filter
-.RSs
-.IPs <equation>
-some equation like "2+2*sin(PI*qp)"
-.RE
-.
-.TP
-.B geq=equation
-generic equation change filter
-.RSs
-.IPs <equation>
-Some equation, e.g.\& 'p(W-X\\,Y)' to flip the image horizontally.
-You can use whitespace to make the equation more readable.
-There are a couple of constants that can be used in the equation:
-.RSss
-PI: the number pi
-.br
-E: the number e
-.br
-X / Y: the coordinates of the current sample
-.br
-W / H: width and height of the image
-.br
-SW / SH: width/height scale depending on the currently filtered plane, e.g.\&
-1,1 and 0.5,0.5 for YUV 4:2:0.
-.br
-p(x,y): returns the value of the pixel at location x/y of the current plane.
-.REss
-.RE
-.
-.TP
-.B "test\ \ \ "
-Generate various test patterns.
-.
-.TP
-.B rgbtest[=width:height]
-Generate an RGB test pattern useful for detecting RGB vs BGR issues.
-You should see a red, green and blue stripe from top to bottom.
-.RSs
-.IPs <width>
-Desired width of generated image (default: 0).
-0 means width of input image.
-.br
-.IPs <height>
-Desired height of generated image (default: 0).
-0 means height of input image.
-.RE
-.
-.TP
-.B lavc[=quality:fps]
-Fast software YV12 to MPEG-1 conversion with libavcodec for use with DVB/\:DXR3/\:IVTV/\:V4L2.
-.RSs
-.IPs <quality>
-1\-31: fixed qscale
-.br
-32\-: fixed bitrate in kbits
-.IPs <fps>
-force output fps (float value) (default: 0, autodetect based on height)
-.RE
-.
-.TP
-.B dvbscale[=aspect]
-Set up optimal scaling for DVB cards, scaling the x axis in hardware and
-calculating the y axis scaling in software to keep aspect.
-Only useful together with expand and scale.
-.RSs
-.IPs <aspect>
-Control aspect ratio, calculate as DVB_HEIGHT*ASPECTRATIO (default:
-576*4/3=768), set it to 576*(16/9)=1024 for a 16:9 TV.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-.IPs "\-vf dvbscale,scale=\-1:0,expand=\-1:576:\-1:\-1:1,lavc"
-FIXME: Explain what this does.
-.RE
-.PD 1
-.
-.TP
-.B noise[=luma[u][t|a][h][p]:chroma[u][t|a][h][p]]
-Adds noise.
-.PD 0
-.RSs
-.IPs <0\-100>
-luma noise
-.IPs <0\-100>
-chroma noise
-.IPs u
-uniform noise (gaussian otherwise)
-.IPs t
-temporal noise (noise pattern changes between frames)
-.IPs a
-averaged temporal noise (smoother, but a lot slower)
-.IPs h
-high quality (slightly better looking, slightly slower)
-.IPs p
-mix random noise with a (semi)regular pattern
-.RE
-.PD 1
-.
-.TP
-.B denoise3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]
-This filter aims to reduce image noise producing smooth images and making still
-images really still (This should enhance compressibility.).
-.PD 0
-.RSs
-.IPs <luma_spatial>
-spatial luma strength (default: 4)
-.IPs <chroma_spatial>
-spatial chroma strength (default: 3)
-.IPs <luma_tmp>
-luma temporal strength (default: 6)
-.IPs <chroma_tmp>
-chroma temporal strength (default: luma_tmp*chroma_spatial/luma_spatial)
-.RE
-.PD 1
-.
-.TP
-.B hqdn3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]
-High precision/\:quality version of the denoise3d filter.
-Parameters and usage are the same.
-.
-.TP
-.B ow[=depth[:luma_strength[:chroma_strength]]]
-Overcomplete Wavelet denoiser.
-.PD 0
-.RSs
-.IPs <depth>
-Larger depth values will denoise lower frequency components more, but
-slow down filtering (default: 8).
-.IPs <luma_strength>
-luma strength (default: 1.0)
-.IPs <chroma_strength>
-chroma strength (default: 1.0)
-.RE
-.PD 1
-.
-.TP
-.B eq[=brightness:contrast] (OBSOLETE)
-Software equalizer with interactive controls just like the hardware
-equalizer, for cards/\:drivers that do not support brightness and
-contrast controls in hardware.
-.PD 0
-.RSs
-.IPs <\-100\-100>
-initial brightness
-.IPs <\-100\-100>
-initial contrast
-.RE
-.PD 1
-.
-.TP
-.B eq2[=gamma:contrast:brightness:saturation:rg:gg:bg:weight]
-Alternative software equalizer that uses lookup tables (very slow),
-allowing gamma correction in addition to simple brightness
-and contrast adjustment.
-Note that it uses the same MMX optimized code as \-vf eq if all
-gamma values are 1.0.
-The parameters are given as floating point values.
-.PD 0
-.RSs
-.IPs <0.1\-10>
-initial gamma value (default: 1.0)
-.IPs <\-2\-2>
-initial contrast, where negative values result in a
-negative image (default: 1.0)
-.IPs <\-1\-1>
-initial brightness (default: 0.0)
-.IPs <0\-3>
-initial saturation (default: 1.0)
-.IPs <0.1\-10>
-gamma value for the red component (default: 1.0)
-.IPs <0.1\-10>
-gamma value for the green component (default: 1.0)
-.IPs <0.1\-10>
-gamma value for the blue component (default: 1.0)
-.IPs <0\-1>
-The weight parameter can be used to reduce the effect of a high gamma value on
-bright image areas, e.g.\& keep them from getting overamplified and just plain
-white.
-A value of 0.0 turns the gamma correction all the way down while 1.0 leaves it
-at its full strength (default: 1.0).
-.RE
-.PD 1
-.
-.TP
-.B hue[=hue:saturation]
-Software equalizer with interactive controls just like the hardware
-equalizer, for cards/\:drivers that do not support hue and
-saturation controls in hardware.
-.PD 0
-.RSs
-.IPs <\-180\-180>
-initial hue (default: 0.0)
-.IPs <\-100\-100>
-initial saturation, where negative values result
-in a negative chroma (default: 1.0)
-.RE
-.PD 1
-.
-.TP
-.B halfpack[=f]
-Convert planar YUV 4:2:0 to half-height packed 4:2:2, downsampling luma but
-keeping all chroma samples.
-Useful for output to low-resolution display devices when hardware downscaling
-is poor quality or is not available.
-Can also be used as a primitive luma-only deinterlacer with very low CPU
-usage.
-.PD 0
-.RSs
-.IPs "<f>\ \ "
-By default, halfpack averages pairs of lines when downsampling.
-Any value different from 0 or 1 gives the default (averaging) behavior.
-.RSss
-0: Only use even lines when downsampling.
-.br
-1: Only use odd lines when downsampling.
-.REss
-.RE
-.PD 1
-.
-.TP
-.B ilpack[=mode]
-When interlaced video is stored in YUV 4:2:0 formats, chroma
-interlacing does not line up properly due to vertical downsampling of
-the chroma channels.
-This filter packs the planar 4:2:0 data into YUY2 (4:2:2) format with
-the chroma lines in their proper locations, so that in any given
-scanline, the luma and chroma data both come from the same field.
-.PD 0
-.RSs
-.IPs <mode>
-Select the sampling mode.
-.RSss
-0: nearest-neighbor sampling, fast but incorrect
-.br
-1: linear interpolation (default)
-.REss
-.RE
-.PD 1
-.
-.TP
-.B decimate[=max:hi:lo:frac]
-Drops frames that do not differ greatly from the previous frame in
-order to reduce framerate.
-The main use of this filter is for very-low-bitrate encoding (e.g.\&
-streaming over dialup modem), but it could in theory be used for
-fixing movies that were inverse-telecined incorrectly.
-.PD 0
-.RSs
-.IPs <max>
-Sets the maximum number of consecutive frames which can be
-dropped (if positive), or the minimum interval between
-dropped frames (if negative).
-.IPs <hi>,<lo>,<frac>
-A frame is a candidate for dropping if no 8x8 region differs by more
-than a threshold of <hi>, and if not more than <frac> portion (1
-meaning the whole image) differs by more than a threshold of <lo>.
-Values of <hi> and <lo> are for 8x8 pixel blocks and represent actual
-pixel value differences, so a threshold of 64 corresponds to 1 unit of
-difference for each pixel, or the same spread out differently over the
-block.
-.RE
-.PD 1
-.
-.TP
-.B dint[=sense:level]
-The drop-deinterlace (dint) filter detects and drops the first from a set
-of interlaced video frames.
-.PD 0
-.RSs
-.IPs <0.0\-1.0>
-relative difference between neighboring pixels (default: 0.1)
-.IPs <0.0\-1.0>
-What part of the image has to be detected as interlaced to
-drop the frame (default: 0.15).
-.RE
-.PD 1
-.
-.TP
-.B lavcdeint (OBSOLETE)
-FFmpeg deinterlacing filter, same as \-vf pp=fd
-.
-.TP
-.B kerndeint[=thresh[:map[:order[:sharp[:twoway]]]]]
-Donald Graft's adaptive kernel deinterlacer.
-Deinterlaces parts of a video if a configurable threshold is exceeded.
-.PD 0
-.RSs
-.IPs <0\-255>
-threshold (default: 10)
-.IPs <map>
-.RSss
-0: Ignore pixels exceeding the threshold (default).
-.br
-1: Paint pixels exceeding the threshold white.
-.REss
-.IPs <order>
-.RSss
-0: Leave fields alone (default).
-.br
-1: Swap fields.
-.REss
-.IPs <sharp>
-.RSss
-0: Disable additional sharpening (default).
-.br
-1: Enable additional sharpening.
-.REss
-.IPs <twoway>
-.RSss
-0: Disable twoway sharpening (default).
-.br
-1: Enable twoway sharpening.
-.REss
-.RE
-.PD 1
-.
-.TP
-.B unsharp[=l|cWxH:amount[:l|cWxH:amount]]
-unsharp mask / gaussian blur
-.RSs
-.IPs "l\ \ \ \ "
-Apply effect on luma component.
-.IPs "c\ \ \ \ "
-Apply effect on chroma components.
-.IPs <width>x<height>
-width and height of the matrix, odd sized in both directions
-(min = 3x3, max = 13x11 or 11x13, usually something between 3x3 and 7x7)
-.IPs amount
-Relative amount of sharpness/\:blur to add to the image
-(a sane range should be \-1.5\-1.5).
-.RSss
-<0: blur
-.br
->0: sharpen
-.REss
-.RE
-.
-.TP
-.B "swapuv\ "
-Swap U & V plane.
-.
-.TP
-.B il[=d|i][s][:[d|i][s]]
-(De)interleaves lines.
-The goal of this filter is to add the ability to process interlaced images
-pre-field without deinterlacing them.
-You can filter your interlaced DVD and play it on a TV without breaking the
-interlacing.
-While deinterlacing (with the postprocessing filter) removes interlacing
-permanently (by smoothing, averaging, etc) deinterleaving splits the frame into
-2 fields (so called half pictures), so you can process (filter) them
-independently and then re-interleave them.
-.PD 0
-.RSs
-.IPs d
-deinterleave (placing one above the other)
-.IPs i
-interleave
-.IPs s
-swap fields (exchange even & odd lines)
-.RE
-.PD 1
-.
-.TP
-.B fil[=i|d]
-(De)interleaves lines.
-This filter is very similar to the il filter but much faster, the main
-disadvantage is that it does not always work.
-Especially if combined with other filters it may produce randomly messed
-up images, so be happy if it works but do not complain if it does not for
-your combination of filters.
-.PD 0
-.RSs
-.IPs d
-Deinterleave fields, placing them side by side.
-.IPs i
-Interleave fields again (reversing the effect of fil=d).
-.RE
-.PD 1
-.
-.TP
-.B field[=n]
-Extracts a single field from an interlaced image using stride arithmetic
-to avoid wasting CPU time.
-The optional argument n specifies whether to extract the even or the odd
-field (depending on whether n is even or odd).
-.
-.TP
-.B detc[=var1=value1:var2=value2:...]
-Attempts to reverse the 'telecine' process to recover a clean,
-non-interlaced stream at film framerate.
-This was the first and most primitive inverse telecine filter to be
-added to MPlayer.
-It works by latching onto the telecine 3:2 pattern and following it as
-long as possible.
-This makes it suitable for perfectly-telecined material, even in the
-presence of a fair degree of noise, but it will fail in the presence
-of complex post-telecine edits.
-Development on this filter is no longer taking place, as ivtc, pullup,
-and filmdint are better for most applications.
-The following arguments (see syntax above) may be used to control
-detc's behavior:
-.RSs
-.IPs "<dr>\ "
-Set the frame dropping mode.
-.RSss
-0: Do not drop frames to maintain fixed output framerate (default).
-.br
-1: Always drop a frame when there have been no drops or telecine
-merges in the past 5 frames.
-.br
-2: Always maintain exact 5:4 input to output frame ratio.
-.REss
-.IPs "<am>\ "
-Analysis mode.
-.RSss
-0: Fixed pattern with initial frame number specified by <fr>.
-.br
-1: aggressive search for telecine pattern (default)
-.REss
-.IPs "<fr>\ "
-Set initial frame number in sequence.
-0\-2 are the three clean progressive frames; 3 and 4 are the two
-interlaced frames.
-The default, \-1, means 'not in telecine sequence'.
-The number specified here is the type for the imaginary previous
-frame before the movie starts.
-.IPs "<t0>, <t1>, <t2>, <t3>"
-Threshold values to be used in certain modes.
-.RE
-.
-.TP
-.B ivtc[=1]
-Experimental 'stateless' inverse telecine filter.
-Rather than trying to lock on to a pattern like the detc filter does,
-ivtc makes its decisions independently for each frame.
-This will give much better results for material that has undergone
-heavy editing after telecine was applied, but as a result it is not as
-forgiving of noisy input, for example TV capture.
-The optional parameter (ivtc=1) corresponds to the dr=1 option for the
-detc filter, and should not be used for playback.
-Further development on ivtc has stopped, as the pullup and filmdint
-filters appear to be much more accurate.
-.
-.TP
-.B pullup[=jl:jr:jt:jb:sb:mp]
-Third-generation pulldown reversal (inverse telecine) filter,
-capable of handling mixed hard-telecine, 24000/1001 fps progressive, and 30000/1001
-fps progressive content.
-The pullup filter is designed to be much more robust than detc or
-ivtc, by taking advantage of future context in making its decisions.
-Like ivtc, pullup is stateless in the sense that it does not lock onto
-a pattern to follow, but it instead looks forward to the following
-fields in order to identify matches and rebuild progressive frames.
-It is still under development, but believed to be quite accurate.
-.RSs
-.IPs "jl, jr, jt, and jb"
-These options set the amount of "junk" to ignore at
-the left, right, top, and bottom of the image, respectively.
-Left/\:right are in units of 8 pixels, while top/\:bottom are in units of
-2 lines.
-The default is 8 pixels on each side.
-.br
-.IPs "sb (strict breaks)"
-Setting this option to 1 will reduce the chances of
-pullup generating an occasional mismatched frame, but it may also
-cause an excessive number of frames to be dropped during high motion
-sequences.
-Conversely, setting it to \-1 will make pullup match fields more
-easily.
-This may help processing of video where there is slight blurring
-between the fields, but may also cause there to be interlaced frames
-in the output.
-.br
-.IPs "mp (metric plane)"
-This option may be set to 1 or 2 to use a chroma
-plane instead of the luma plane for doing pullup's computations.
-This may improve accuracy on very clean source material, but more
-likely will decrease accuracy, especially if there is chroma noise
-(rainbow effect) or any grayscale video.
-The main purpose of setting mp to a chroma plane is to reduce CPU load
-and make pullup usable in realtime on slow machines.
-.REss
-.
-.TP
-.B filmdint[=options]
-Inverse telecine filter, similar to the pullup filter above.
-It is designed to handle any pulldown pattern, including mixed soft and
-hard telecine and limited support for movies that are slowed down or sped
-up from their original framerate for TV.
-Only the luma plane is used to find the frame breaks.
-If a field has no match, it is deinterlaced with simple linear
-approximation.
-If the source is MPEG-2, this must be the first filter to allow
-access to the field-flags set by the MPEG-2 decoder.
-Depending on the source MPEG, you may be fine ignoring this advice, as
-long as you do not see lots of "Bottom-first field" warnings.
-With no options it does normal inverse telecine.
-Multiple options can be specified separated by /.
-.RSs
-.IPs crop=<w>:<h>:<x>:<y>
-Just like the crop filter, but faster, and works on mixed hard and soft
-telecined content as well as when y is not a multiple of 4.
-If x or y would require cropping fractional pixels from the chroma
-planes, the crop area is extended.
-This usually means that x and y must be even.
-.IPs io=<ifps>:<ofps>
-For each ifps input frames the filter will output ofps frames.
-This could be used to filter movies that are broadcast on TV at a frame
-rate different from their original framerate.
-.IPs luma_only=<n>
-If n is nonzero, the chroma plane is copied unchanged.
-This is useful for YV12 sampled TV, which discards one of the chroma
-fields.
-.IPs mmx2=<n>
-On x86, if n=1, use MMX2 optimized functions, if n=2, use 3DNow!
-optimized functions, otherwise, use plain C.
-If this option is not specified, MMX2 and 3DNow! are auto-detected, use
-this option to override auto-detection.
-.IPs fast=<n>
-The larger n will speed up the filter at the expense of accuracy.
-The default value is n=3.
-If n is odd, a frame immediately following a frame marked with the
-REPEAT_FIRST_FIELD MPEG flag is assumed to be progressive, thus filter
-will not spend any time on soft-telecined MPEG-2 content.
-This is the only effect of this flag if MMX2 or 3DNow! is available.
-Without MMX2 and 3DNow, if n=0 or 1, the same calculations will be used
-as with n=2 or 3.
-If n=2 or 3, the number of luma levels used to find the frame breaks is
-reduced from 256 to 128, which results in a faster filter without losing
-much accuracy.
-If n=4 or 5, a faster, but much less accurate metric will be used to
-find the frame breaks, which is more likely to misdetect high vertical
-detail as interlaced content.
-.IPs verbose=<n>
-If n is nonzero, print the detailed metrics for each frame.
-Useful for debugging.
-.IPs dint_thres=<n>
-Deinterlace threshold.
-Used during de-interlacing of unmatched frames.
-Larger value means less deinterlacing, use n=256 to completely turn off
-deinterlacing.
-Default is n=8.
-.IPs comb_thres=<n>
-Threshold for comparing a top and bottom fields.
-Defaults to 128.
-.IPs diff_thres=<n>
-Threshold to detect temporal change of a field.
-Default is 128.
-.IPs sad_thres=<n>
-Sum of Absolute Difference threshold, default is 64.
-.RE
-.
-.TP
-.B divtc[=options]
-Inverse telecine for deinterlaced video.
-If 3:2-pulldown telecined video has lost one of the fields or is deinterlaced
-using a method that keeps one field and interpolates the other, the result is
-a juddering video that has every fourth frame duplicated.
-This filter is intended to find and drop those duplicates and restore the
-original film framerate.
-Two different modes are available:
-One pass mode is the default and is straightforward to use,
-but has the disadvantage that any changes in the telecine
-phase (lost frames or bad edits) cause momentary judder
-until the filter can resync again.
-Two pass mode avoids this by analyzing the whole video
-beforehand so it will have forward knowledge about the
-phase changes and can resync at the exact spot.
-These passes do
-.B not
-correspond to pass one and two of the encoding process.
-You must run an extra pass using divtc pass one before the
-actual encoding throwing the resulting video away.
-Use \-nosound \-ovc raw \-o /dev/null to avoid
-wasting CPU power for this pass.
-You may add something like crop=2:2:0:0 after divtc
-to speed things up even more.
-Then use divtc pass two for the actual encoding.
-If you use multiple encoder passes, use divtc
-pass two for all of them.
-The options are:
-.RSs
-.IPs pass=1|2
-Use two pass mode.
-.IPs file=<filename>
-Set the two pass log filename (default: "framediff.log").
-.IPs threshold=<value>
-Set the minimum strength the telecine pattern must have for the filter to
-believe in it (default: 0.5).
-This is used to avoid recognizing false pattern from the parts of the video
-that are very dark or very still.
-.IPs window=<numframes>
-Set the number of past frames to look at when searching for pattern
-(default: 30).
-Longer window improves the reliability of the pattern search, but shorter
-window improves the reaction time to the changes in the telecine phase.
-This only affects the one pass mode.
-The two pass mode currently uses fixed window that extends to both future
-and past.
-.IPs phase=0|1|2|3|4
-Sets the initial telecine phase for one pass mode (default: 0).
-The two pass mode can see the future, so it is able to use the correct
-phase from the beginning, but one pass mode can only guess.
-It catches the correct phase when it finds it, but this option can be used
-to fix the possible juddering at the beginning.
-The first pass of the two pass mode also uses this, so if you save the output
-from the first pass, you get constant phase result.
-.IPs deghost=<value>
-Set the deghosting threshold (0\-255 for one pass mode, \-255\-255 for two pass
-mode, default 0).
-If nonzero, deghosting mode is used.
-This is for video that has been deinterlaced by blending the fields
-together instead of dropping one of the fields.
-Deghosting amplifies any compression artifacts in the blended frames, so the
-parameter value is used as a threshold to exclude those pixels from
-deghosting that differ from the previous frame less than specified value.
-If two pass mode is used, then negative value can be used to make the
-filter analyze the whole video in the beginning of pass-2 to determine
-whether it needs deghosting or not and then select either zero or the
-absolute value of the parameter.
-Specify this option for pass-2, it makes no difference on pass-1.
-.RE
-.
-.TP
-.B phase[=t|b|p|a|u|T|B|A|U][:v]
-Delay interlaced video by one field time so that the field order
-changes.
-The intended use is to fix PAL movies that have been captured with the
-opposite field order to the film-to-video transfer.
-The options are:
-.RSs
-.IPs t
-Capture field order top-first, transfer bottom-first.
-Filter will delay the bottom field.
-.IPs b
-Capture bottom-first, transfer top-first.
-Filter will delay the top field.
-.IPs p
-Capture and transfer with the same field order.
-This mode only exists for the documentation of the other options to refer to,
-but if you actually select it, the filter will faithfully do nothing ;-)
-.IPs a
-Capture field order determined automatically by field flags, transfer opposite.
-Filter selects among t and b modes on a frame by frame basis using field flags.
-If no field information is available, then this works just like u.
-.IPs u
-Capture unknown or varying, transfer opposite.
-Filter selects among t and b on a frame by frame basis by analyzing the
-images and selecting the alternative that produces best match between the
-fields.
-.IPs T
-Capture top-first, transfer unknown or varying.
-Filter selects among t and p using image analysis.
-.IPs B
-Capture bottom-first, transfer unknown or varying.
-Filter selects among b and p using image analysis.
-.IPs A
-Capture determined by field flags, transfer unknown or varying.
-Filter selects among t, b and p using field flags and image analysis.
-If no field information is available, then this works just like U.
-This is the default mode.
-.IPs U
-Both capture and transfer unknown or varying.
-Filter selects among t, b and p using image analysis only.
-.IPs v
-Verbose operation.
-Prints the selected mode for each frame and the average squared difference
-between fields for t, b, and p alternatives.
-.RE
-.
-.TP
-.B telecine[=start]
-Apply 3:2 'telecine' process to increase framerate by 20%.
-This most likely will not work correctly with MPlayer.
-The optional start parameter tells the filter where in the telecine
-pattern to start (0\-3).
-.
-.TP
-.B tinterlace[=mode]
-Temporal field interlacing \- merge pairs of frames into an interlaced
-frame, halving the framerate.
-Even frames are moved into the upper field, odd frames to the lower field.
-This can be used to fully reverse the effect of the tfields filter (in mode 0).
-Available modes are:
-.PD 0
-.RSs
-.IPs 0
-Move odd frames into the upper field, even into the lower field, generating
-a full-height frame at half framerate.
-.IPs 1
-Only output odd frames, even frames are dropped; height unchanged.
-.IPs 2
-Only output even frames, odd frames are dropped; height unchanged.
-.IPs 3
-Expand each frame to full height, but pad alternate lines with black;
-framerate unchanged.
-.IPs 4
-Interleave even lines from even frames with odd lines from odd frames.
-Height unchanged at half framerate.
-.RE
-.PD 1
-.
-.TP
-.B tfields[=mode[:field_dominance]]
-Temporal field separation \- split fields into frames, doubling the
-output framerate.
-.PD 0
-.RSs
-.IPs <mode>
-0: Leave fields unchanged (will jump/\:flicker).
-.br
-1: Interpolate missing lines. (The algorithm used might not be so good.)
-.br
-2: Translate fields by 1/4 pixel with linear interpolation (no jump).
-.br
-4: Translate fields by 1/4 pixel with 4tap filter (higher quality) (default).
-.IPs <field_dominance>\ (DEPRECATED)
-\-1: auto (default)
-Only works if the decoder exports the appropriate information and
-no other filters which discard that information come before tfields
-in the filter chain, otherwise it falls back to 0 (top field first).
-.br
-0: top field first
-.br
-1: bottom field first
-.br
-.I NOTE:
-This option will possibly be removed in a future version.
-Use \-field\-dominance instead.
-.RE
-.PD 1
-.
-.TP
-.B yadif=[mode[:field_dominance]]
-Yet another deinterlacing filter
-.PD 0
-.RSs
-.IPs <mode>
-0: Output 1 frame for each frame.
-.br
-1: Output 1 frame for each field.
-.br
-2: Like 0 but skips spatial interlacing check.
-.br
-3: Like 1 but skips spatial interlacing check.
-.IPs <field_dominance>\ (DEPRECATED)
-Operates like tfields.
-.br
-.I NOTE:
-This option will possibly be removed in a future version.
-Use \-field\-dominance instead.
-.RE
-.PD 1
-.
-.TP
-.B mcdeint=[mode[:parity[:qp]]]
-Motion compensating deinterlacer.
-It needs one field per frame as input and must thus be used together
-with tfields=1 or yadif=1/3 or equivalent.
-.PD 0
-.RSs
-.IPs <mode>
-0: fast
-.br
-1: medium
-.br
-2: slow, iterative motion estimation
-.br
-3: extra slow, like 2 plus multiple reference frames
-.IPs <parity>
-0 or 1 selects which field to use (note: no autodetection yet!).
-.IPs "<qp>\ "
-Higher values should result in a smoother motion vector
-field but less optimal individual vectors.
-.RE
-.PD 1
-.
-.TP
-.B boxblur=radius:power[:radius:power]
-box blur
-.PD 0
-.RSs
-.IPs <radius>
-blur filter strength
-.IPs <power>
-number of filter applications
-.RE
-.PD 1
-.
-.TP
-.B sab=radius:pf:colorDiff[:radius:pf:colorDiff]
-shape adaptive blur
-.PD 0
-.RSs
-.IPs <radius>
-blur filter strength (~0.1\-4.0) (slower if larger)
-.IPs "<pf>\ "
-prefilter strength (~0.1\-2.0)
-.IPs <colorDiff>
-maximum difference between pixels to still be considered (~0.1\-100.0)
-.RE
-.PD 1
-.
-.TP
-.B smartblur=radius:strength:threshold[:radius:strength:threshold]
-smart blur
-.PD 0
-.RSs
-.IPs <radius>
-blur filter strength (~0.1\-5.0) (slower if larger)
-.IPs <strength>
-blur (0.0\-1.0) or sharpen (\-1.0\-0.0)
-.IPs <threshold>
-filter all (0), filter flat areas (0\-30) or filter edges (\-30\-0)
-.RE
-.PD 1
-.
-.TP
-.B perspective=x0:y0:x1:y1:x2:y2:x3:y3:t
-Correct the perspective of movies not filmed perpendicular to the screen.
-.PD 0
-.RSs
-.IPs <x0>,<y0>,...
-coordinates of the top left, top right, bottom left, bottom right corners
-.IPs "<t>\ \ "
-linear (0) or cubic resampling (1)
-.RE
-.PD 1
-.
-.TP
-.B "2xsai\ \ "
-Scale and smooth the image with the 2x scale and interpolate algorithm.
-.
-.TP
-.B "1bpp\ \ \ "
-1bpp bitmap to YUV/\:BGR 8/\:15/\:16/\:32 conversion
-.
-.TP
-.B down3dright[=lines]
-Reposition and resize stereoscopic images.
-Extracts both stereo fields and places them side by side, resizing
-them to maintain the original movie aspect.
-.PD 0
-.RSs
-.IPs <lines>
-number of lines to select from the middle of the image (default: 12)
-.RE
-.PD 1
-.
-.TP
-.B bmovl=hidden:opaque:fifo
-The bitmap overlay filter reads bitmaps from a FIFO and displays them
-on top of the movie, allowing some transformations on the image.
-Also see TOOLS/bmovl-test.c for a small bmovl test program.
-.PD 0
-.RSs
-.IPs <hidden>
-Set the default value of the 'hidden' flag (0=visible, 1=hidden).
-.IPs <opaque>
-Set the default value of the 'opaque' flag (0=transparent, 1=opaque).
-.IPs <fifo>
-path/\:filename for the FIFO (named pipe connecting 'mplayer \-vf bmovl' to the
-controlling application)
-.RE
-.PD 1
-.sp 1
-.RS
-FIFO commands are:
-.RE
-.PD 0
-.RSs
-.IPs "RGBA32 width height xpos ypos alpha clear"
-followed by width*height*4 Bytes of raw RGBA32 data.
-.IPs "ABGR32 width height xpos ypos alpha clear"
-followed by width*height*4 Bytes of raw ABGR32 data.
-.IPs "RGB24 width height xpos ypos alpha clear"
-followed by width*height*3 Bytes of raw RGB24 data.
-.IPs "BGR24 width height xpos ypos alpha clear"
-followed by width*height*3 Bytes of raw BGR24 data.
-.IPs "ALPHA width height xpos ypos alpha"
-Change alpha transparency of the specified area.
-.IPs "CLEAR width height xpos ypos"
-Clear area.
-.IPs OPAQUE
-Disable all alpha transparency.
-Send "ALPHA 0 0 0 0 0" to enable it again.
-.IPs "HIDE\ "
-Hide bitmap.
-.IPs "SHOW\ "
-Show bitmap.
-.RE
-.PD 1
-.sp 1
-.RS
-Arguments are:
-.RE
-.PD 0
-.RSs
-.IPs "<width>, <height>"
-image/area size
-.IPs "<xpos>, <ypos>"
-Start blitting at position x/y.
-.IPs <alpha>
-Set alpha difference.
-If you set this to \-255 you can then send a sequence of ALPHA-commands to set
-the area to \-225, \-200, \-175 etc for a nice fade-in-effect! ;)
-.RSss
-0: same as original
-.br
-255: Make everything opaque.
-.br
-\-255: Make everything transparent.
-.REss
-.IPs <clear>
-Clear the framebuffer before blitting.
-.RSss
-0: The image will just be blitted on top of the old one, so you do not need to
-send 1.8MB of RGBA32 data every time a small part of the screen is updated.
-.br
-1: clear
-.REss
-.RE
-.PD 1
-.
-.TP
-.B framestep=I|[i]step
-Renders only every nth frame or every intra frame (keyframe).
-.sp 1
-If you call the filter with I (uppercase) as the parameter, then
-.B only
-keyframes are rendered.
-For DVDs it generally means one in every 15/12 frames (IBBPBBPBBPBBPBB),
-for AVI it means every scene change or every keyint value.
-.sp 1
-When a keyframe is found, an 'I!' string followed by a newline character is
-printed, leaving the current line of MPlayer output on the screen, because it
-contains the time (in seconds) and frame number of the keyframe (You can use
-this information to split the AVI.).
-.sp 1
-If you call the filter with a numeric parameter 'step' then only one in
-every 'step' frames is rendered.
-.sp 1
-If you put an 'i' (lowercase) before the number then an 'I!' is printed
-(like the I parameter).
-.sp 1
-If you give only the i then nothing is done to the frames, only I! is
-printed.
-.
-.TP
-.B tile=xtiles:ytiles:output:start:delta
-Tile a series of images into a single, bigger image.
-If you omit a parameter or use a value less than 0, then the default
-value is used.
-You can also stop when you are satisfied (... \-vf tile=10:5 ...).
-It is probably a good idea to put the scale filter before the tile :-)
-.sp 1
-The parameters are:
-.sp 1
-.PD 0
-.RSs
-.IPs <xtiles>
-number of tiles on the x axis (default: 5)
-.IPs <ytiles>
-number of tiles on the y axis (default: 5)
-.IPs <output>
-Render the tile when 'output' number of frames are reached, where 'output'
-should be a number less than xtile * ytile.
-Missing tiles are left blank.
-You could, for example, write an 8 * 7 tile every 50 frames to have one
-image every 2 seconds @ 25 fps.
-.IPs <start>
-outer border thickness in pixels (default: 2)
-.IPs <delta>
-inner border thickness in pixels (default: 4)
-.RE
-.PD 1
-.
-.TP
-.B delogo[=x:y:w:h:t]
-Suppresses a TV station logo by a simple interpolation of the
-surrounding pixels.
-Just set a rectangle covering the logo and watch it disappear (and
-sometimes something even uglier appear \- your mileage may vary).
-.PD 0
-.RSs
-.IPs <x>,<y>
-top left corner of the logo
-.IPs <w>,<h>
-width and height of the cleared rectangle
-.IPs <t>
-Thickness of the fuzzy edge of the rectangle (added to w and h).
-When set to \-1, a green rectangle is drawn on the screen to
-simplify finding the right x,y,w,h parameters.
-.IPs file=<file>
-You can specify a text file to load the coordinates from.
-Each line must have a timestamp (in seconds, and in ascending order) and the
-"x:y:w:h:t" coordinates (t can be omitted).
-.RE
-.PD 1
-.
-.TP
-.B remove\-logo=/path/to/logo_bitmap_file_name.pgm
-Suppresses a TV station logo, using a PGM or PPM image
-file to determine which pixels comprise the logo.
-The width and height of the image file must match
-those of the video stream being processed.
-Uses the filter image and a circular blur
-algorithm to remove the logo.
-.RSs
-.IPs /path/to/logo_bitmap_file_name.pgm
-[path] + filename of the filter image.
-.RE
-.
-.TP
-.B screenshot
-Allows acquiring screenshots of the movie using slave mode
-commands that can be bound to keypresses.
-See the slave mode documentation and the INTERACTIVE CONTROL
-section for details.
-Files named 'shotNNNN.png' will be saved in the working directory,
-using the first available number \- no files will be overwritten.
-The filter has no overhead when not used and accepts an arbitrary
-colorspace, so it is safe to add it to the configuration file.
-Make sure that the screenshot filter is added after all other filters
-whose effect you want to record on the saved image.
-E.g.\& it should be the last filter if you want to have an exact
-screenshot of what you see on the monitor.
-.RE
-.
-.TP
-.B "ass\ \ \ \ "
-Moves SSA/ASS subtitle rendering to an arbitrary point in the filter chain.
-Only useful with the \-ass option.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-vf ass,screenshot"
-Moves SSA/ASS rendering before the screenshot filter.
-Screenshots taken this way will contain subtitles.
-.RE
-.PD 1
-.
-.TP
-.B blackframe[=amount:threshold]
-Detect frames that are (almost) completely black.
-Can be useful to detect chapter transitions or commercials.
-Output lines consist of the frame number of the detected frame, the
-percentage of blackness, the frame type and the frame number of the last
-encountered keyframe.
-.RSs
-.IPs <amount>
-Percentage of the pixels that have to be below the threshold (default: 98).
-.IPs <threshold>
-Threshold below which a pixel value is considered black (default: 32).
-.RE
-.PD 1
-.
-.TP
-.B stereo3d[=in:out]
-Stereo3d converts between different stereoscopic image formats.
-.RSs
-.IPs <in>
-Stereoscopic image format of input. Possible values:
-.RS
-.B sbsl or side_by_side_left_first
-.RS
-side by side parallel (left eye left, right eye right)
-.RE
-.B sbsr or side_by_side_right_first
-.RS
-side by side crosseye (right eye left, left eye right)
-.RE
-.B sbs2l or side_by_side_half_width_left_first
-.RS
-side by side with half width resolution (left eye left, right eye right)
-.RE
-.B sbs2r or side_by_side_half_width_right_first
-.RS
-side by side with half width resolution (right eye left, left eye right)
-.RE
-.B abl or above_below_left_first
-.RS
-above-below (left eye above, right eye below)
-.RE
-.B abl or above_below_right_first
-.RS
-above-below (right eye above, left eye below)
-.RE
-.B ab2l or above_below_half_height_left_first
-.RS
-above-below with half height resolution (left eye above, right eye below)
-.RE
-.B ab2r or above_below_half_height_right_first
-.RS
-above-below with half height resolution (right eye above, left eye below)
-.RE
-.RE
-.IPs <out>
-Stereoscopic image format of output. Possible values are all the input formats
-as well as:
-.RS
-.B arcg or anaglyph_red_cyan_gray
-.RS
-anaglyph red/cyan gray (red filter on left eye, cyan filter on right eye)
-.RE
-.B arch or anaglyph_red_cyan_half_color
-.RS
-anaglyph red/cyan half colored (red filter on left eye, cyan filter on right
-eye)
-.RE
-.B arcc or anaglyph_red_cyan_color
-.RS
-anaglyph red/cyan color (red filter on left eye, cyan filter on right eye)
-.RE
-.B arcd or anaglyph_red_cyan_dubois
-.RS
-anaglyph red/cyan color optimized with the least squares projection of dubois
-(red filter on left eye, cyan filter on right eye)
-.RE
-.B agmg or anaglyph_green_magenta_gray
-.RS
-anaglyph green/magenta gray (green filter on left eye, magenta filter on right
-eye)
-.RE
-.B agmh or anaglyph_green_magenta_half_color
-.RS
-anaglyph green/magenta half colored (green filter on left eye, magenta filter on
-right eye)
-.RE
-.B agmc or anaglyph_green_magenta_color
-.RS
-anaglyph green/magenta colored (green filter on left eye, magenta filter on
-right eye)
-.RE
-.B aybg or anaglyph_yellow_blue_gray
-.RS
-anaglyph yellow/blue gray (yellow filter on left eye, blue filter on right eye)
-.RE
-.B aybh or anaglyph_yellow_blue_half_color
-.RS
-anaglyph yellow/blue half colored (yellow filter on left eye, blue filter on
-right eye)
-.RE
-.B aybc or anaglyph_yellow_blue_color
-.RS
-anaglyph yellow/blue colored (yellow filter on left eye, blue filter on right
-eye)
-.RE
-.B irl or interleave_rows_left_first
-.RS
-Interleaved rows (left eye has top row, right eye starts on next row)
-.RE
-.B irr or interleave_rows_right_first
-.RS
-Interleaved rows (right eye has top row, left eye starts on next row)
-.RE
-.B ml or mono_left
-.RS
-mono output (left eye only)
-.RE
-.B mr or mono_right
-.RS
-mono output (right eye only)
-.RE
-.RE
-.I NOTE:
-To use either of the interleaved-rows output formats to display
-full-screen on a row-interleaved 3D display, you will need to scale the
-video to the correct height first using the "scale" filter, if it is not
-already the right height. Typically, that is 1080 rows (so use e.g.
-"-vf scale=1440:1080,stereo3d=sbsl:irl" for a 720p side-by-side encoded
-movie).
-.RE
-.PD 1
-.
-.TP
-.B gradfun[=strength[:radius]]
-Fix the banding artifacts that are sometimes introduced into nearly flat
-regions by truncation to 8bit colordepth.
-Interpolates the gradients that should go where the bands are, and
-dithers them.
-.sp 1
-This filter is designed for playback only.
-Do not use it prior to lossy compression, because compression tends
-to lose the dither and bring back the bands.
-.RSs
-.IPs <strength>
-Maximum amount by which the filter will change any one pixel.
-Also the threshold for detecting nearly flat regions (default: 1.2).
-.IPs <radius>
-Neighborhood to fit the gradient to.
-Larger radius makes for smoother gradients, but also prevents the filter
-from modifying pixels near detailed regions (default: 16).
-.RE
-.
-.TP
-.B fixpts[=options]
-Fixes the presentation timestamps (PTS) of the frames.
-By default, the PTS passed to the next filter is dropped, but the following
-options can change that:
-.RSs
-.IPs print
-Print the incoming PTS.
-.IPs fps=<fps>
-Specify a frame per second value.
-.IPs start=<pts>
-Specify an initial value for the PTS.
-.IPs autostart=<n>
-Uses the
-.IR n th
-incoming PTS as the initial PTS.
-All previous PTS are kept, so setting a huge value or \-1 keeps the PTS
-intact.
-.IPs autofps=<n>
-Uses the
-.IR n th
-incoming PTS after the end of autostart to determine the framerate.
-.RE
-.sp 1
-.RS
-.I EXAMPLE:
-.RE
-.PD 0
-.RSs
-.IPs "\-vf fixpts=fps=24000/1001,ass,fixpts"
-Generates a new sequence of PTS, uses it for ASS subtitles, then drops it.
-Generating a new sequence is useful when the timestamps are reset during the
-program; this is frequent on DVDs.
-Dropping it may be necessary to avoid confusing encoders.
-.RE
-.PD 1
-.sp 1
-.RS
-.I NOTE:
-Using this filter together with any sort of seeking (including -ss and EDLs)
-may make demons fly out of your nose.
-.RE
-.
-.\" --------------------------------------------------------------------------
-.\" encoding
-.\" --------------------------------------------------------------------------
-.
-.SH ENCODING OPTIONS
-.
-.TP
-.B \-o <filename>
-Enable encoding mode and specify the output file name.
-.RE
-.
-.TP
-.B \-of <format>
-Specify the output format (overrides autodetection by the extension of the file specified by \-o).
-See \-of help for a full list of supported formats.
-.RE
-.
-.TP
-.B \-ofopts <options>
-Specify the output format options for libavformat.
-See \-ofopts help for a full list of supported options.
-.RE
-.PP
-.I NOTE:
-To get a full list of available format options, see \-ofopts help.
-.sp 1
-Options are managed in lists.
-There are a few commands to manage the options list.
-.
-.TP
-.B \-ofopts\-add <option1[,option2,...]>
-Appends the options given as arguments to the options list.
-.
-.TP
-.B \-ofopts\-pre <option1[,option2,...]>
-Prepends the options given as arguments to the options list.
-.
-.TP
-.B \-ofopts\-del <index1[,index2,...]>
-Deletes the options at the given indexes.
-Index numbers start at 0, negative numbers address the end of the
-list (\-1 is the last).
-.
-.TP
-.B \-ofopts\-clr
-Completely empties the options list.
-.
-.RE
-.
-.TP
-.B \-ofps <float value>
-Specifies the output format time base (default: 24000). Low values like 25 limit video fps by dropping frames.
-.RE
-.
-.TP
-.B \-oautofps
-Sets the output format time base to the guessed frame rate of the input video (simulates mencoder behaviour, useful for AVI; may cause frame drops). Note that not all codecs and not all formats support VFR encoding, and some which do have bugs when a target bitrate is specified - use
-.B \-ofps
-or
-.B \-oautofps
-to force CFR encoding in these cases.
-.RE
-.
-.TP
-.B \-oharddup
-If set, the frame rate given by
-.B \-ofps
-is attained not by skipping time codes, but by duplicating frames (constant frame rate mode).
-.RE
-.
-.TP
-.B \-oneverdrop
-If set, frames are never dropped. Instead, time codes of video are readjusted
-to always increase. This may cause AV desync, though; to work around this,
-use a high-fps time base using
-.B \-ofps
-and absolutely avoid
-.B \-oautofps
-.RE
-.
-.TP
-.B \-oac <codec>
-Specify the output audio codec.
-See \-oac help for a full list of supported codecs.
-.RE
-.
-.TP
-.B \-oaoffset <value>
-Shifts audio data by the given time (in seconds) by adding/removing samples at the start.
-.RE
-.
-.TP
-.B \-oacopts <options>
-Specify the output audio codec options for libavcodec.
-See \-oacopts help for a full list of supported options.
-.RE
-.PP
-.I EXAMPLE:
-.B \-oac libmp3lame \-oacopts b=128000
-selects 128kbps MP3 encoding.
-.PP
-.I NOTE:
-To get a full list of available audio codec options, see \-oacopts help.
-.sp 1
-Options are managed in lists.
-There are a few commands to manage the options list.
-.
-.TP
-.B \-oacopts\-add <option1[,option2,...]>
-Appends the options given as arguments to the options list.
-.
-.TP
-.B \-oacopts\-pre <option1[,option2,...]>
-Prepends the options given as arguments to the options list.
-.
-.TP
-.B \-oacopts\-del <index1[,index2,...]>
-Deletes the options at the given indexes.
-Index numbers start at 0, negative numbers address the end of the
-list (\-1 is the last).
-.
-.TP
-.B \-oacopts\-clr
-Completely empties the options list.
-.
-.TP
-.B \-ovc <codec>
-Specify the output video codec.
-See \-ovc help for a full list of supported codecs.
-.RE
-.
-.TP
-.B \-ovoffset <value>
-Shifts video data by the given time (in seconds) by shifting the pts values.
-.RE
-.
-.TP
-.B \-ocopyts
-Copies input pts to the output video (not supported by some output container formats, e.g. avi).
-By default, audio pts are set to playback time and video pts are synchronized to match audio pts, as some output formats do not support anything else.
-.RE
-.
-.TP
-.B \-ovcopts <options>
-Specify the output video codec options for libavcodec.
-See \-ovcopts help for a full list of supported options.
-.RE
-.PP
-.I EXAMPLE:
-.B \-ovc mpeg4 \-ovcopts qscale=5
-selects constant quantizer scale 5 for MPEG-4 encoding.
-.PP
-.B \-ovc libx264 \-ovcopts crf=23
-selects VBR quality factor 23 for H.264 encoding.
-.I NOTE:
-To get a full list of available video codec options, see \-ovcopts help.
-.PP
-.sp 1
-Options are managed in lists.
-There are a few commands to manage the options list.
-.
-.TP
-.B \-ovcopts\-add <option1[,option2,...]>
-Appends the options given as arguments to the options list.
-.
-.TP
-.B \-ovcopts\-pre <option1[,option2,...]>
-Prepends the options given as arguments to the options list.
-.
-.TP
-.B \-ovcopts\-del <index1[,index2,...]>
-Deletes the options at the given indexes.
-Index numbers start at 0, negative numbers address the end of the
-list (\-1 is the last).
-.
-.TP
-.B \-ovcopts\-clr
-Completely empties the options list.
-.
-.PP
-.I NOTE for \-ovc libx264:
-The x264 codec provides a set of presets/tunings/profiles which can be included with the ovcopts.
-.PP
-Available presets: preset=ultrafast, preset=superfast, preset=veryfast, preset=faster, preset=fast, preset=medium, preset=slow, preset=slower, preset=veryslow, preset=placebo (default: preset=medium)
-.PP
-Available tunings: tune=film, tune=animation, tune=grain, tune=stillimage, tune=psnr, tune=ssim, tune=fastdecode, tune=zerolatency (default: none)
-.PP
-Available profiles: profile=baseline, profile=main, profile=high (default: profile=high)
-.PP
-.I EXAMPLE:
-.B mplayer \-o <outfile> <infile> \-ovc libx264 \-ovcopts preset=veryslow,crf=23,tune=animation,profile=main \-oac aac \-oacopts b=128000
-.
-.\" --------------------------------------------------------------------------
-.\" environment variables
-.\" --------------------------------------------------------------------------
-.
-.SH ENVIRONMENT VARIABLES
-.
-There are a number of environment variables that can be used to
-control the behavior of MPlayer.
-.
-.TP
-.B MPLAYER_CHARSET (also see \-msgcharset)
-Convert console messages to the specified charset (default: autodetect).
-A value of "noconv" means no conversion.
-.
-.TP
-.B MPLAYER_HOME
-Directory where MPlayer looks for user settings.
-.
-.TP
-.B MPLAYER_LOCALEDIR
-Directory where MPlayer looks for gettext translation files (if enabled).
-.
-.TP
-.B MPLAYER_VERBOSE (also see \-v and \-msglevel)
-Set the initial verbosity level across all message modules (default: 0).
-The resulting verbosity corresponds to that of \-msglevel 5 plus the
-value of MPLAYER_VERBOSE.
-.
-.SS libaf:
-.
-.TP
-.B LADSPA_PATH
-If LADSPA_PATH is set, it searches for the specified file.
-If it is not set, you must supply a fully specified pathname.
-FIXME: This is also mentioned in the ladspa section.
-.
-.SS libdvdcss:
-.
-.TP
-.B DVDCSS_CACHE
-Specify a directory in which to store title key values.
-This will speed up descrambling of DVDs which are in the cache.
-The DVDCSS_CACHE directory is created if it does not exist,
-and a subdirectory is created named after the DVD's title
-or manufacturing date.
-If DVDCSS_CACHE is not set or is empty, libdvdcss will use
-the default value which is "${HOME}/.dvdcss/" under Unix and
-"C:\\Documents and Settings\\$USER\\Application Data\\dvdcss\\" under Win32.
-The special value "off" disables caching.
-.
-.TP
-.B DVDCSS_METHOD
-Sets the authentication and decryption method that
-libdvdcss will use to read scrambled discs.
-Can be one of title, key or disc.
-.PD 0
-.RSs
-.IPs "key\ \ "
-is the default method.
-libdvdcss will use a set of calculated player keys to try and get the disc key.
-This can fail if the drive does not recognize any of the player keys.
-.IPs "disc\ "
-is a fallback method when key has failed.
-Instead of using player keys, libdvdcss will crack the disc key using
-a brute force algorithm.
-This process is CPU intensive and requires 64 MB of memory to store
-temporary data.
-.IPs title
-is the fallback when all other methods have failed.
-It does not rely on a key exchange with the DVD drive, but rather uses
-a crypto attack to guess the title key.
-On rare cases this may fail because there is not enough encrypted data
-on the disc to perform a statistical attack, but in the other hand it
-is the only way to decrypt a DVD stored on a hard disc, or a DVD with
-the wrong region on an RPC2 drive.
-.RE
-.PD 1
-.
-.TP
-.B DVDCSS_RAW_DEVICE
-Specify the raw device to use.
-Exact usage will depend on your operating system, the Linux
-utility to set up raw devices is raw(8) for instance.
-Please note that on most operating systems, using a raw device
-requires highly aligned buffers: Linux requires a 2048 bytes
-alignment (which is the size of a DVD sector).
-.
-.TP
-.B DVDCSS_VERBOSE
-Sets the libdvdcss verbosity level.
-.PD 0
-.RSs
-.IPs 0
-Outputs no messages at all.
-.IPs 1
-Outputs error messages to stderr.
-.IPs 2
-Outputs error messages and debug messages to stderr.
-.RE
-.PD 1
-.
-.TP
-.B DVDREAD_NOKEYS
-Skip retrieving all keys on startup.
-Currently disabled.
-.
-.TP
-.B HOME
-FIXME: Document this.
-.
-.SS libao2:
-.
-.TP
-.B AO_SUN_DISABLE_SAMPLE_TIMING
-FIXME: Document this.
-.
-.TP
-.B AUDIODEV
-FIXME: Document this.
-.
-.TP
-.B AUDIOSERVER
-Specifies the Network Audio System server to which the
-nas audio output driver should connect and the transport
-that should be used.
-If unset DISPLAY is used instead.
-The transport can be one of tcp and unix.
-Syntax is tcp/<somehost>:<someport>, <somehost>:<instancenumber>
-or [unix]:<instancenumber>.
-The NAS base port is 8000 and <instancenumber> is added to that.
-.sp 1
-.RS
-.I EXAMPLES:
-.RE
-.PD 0
-.RSs
-.IPs AUDIOSERVER=somehost:0
-Connect to NAS server on somehost using default port and transport.
-.IPs AUDIOSERVER=tcp/somehost:8000
-Connect to NAS server on somehost listening on TCP port 8000.
-.IPs AUDIOSERVER=(unix)?:0
-Connect to NAS server instance 0 on localhost using unix domain sockets.
-.RE
-.PD 1
-.
-.TP
-.B DISPLAY
-FIXME: Document this.
-.
-.SS osdep:
-.
-.TP
-.B TERM
-FIXME: Document this.
-.
-.SS libvo:
-.
-.TP
-.B DISPLAY
-FIXME: Document this.
-.
-.TP
-.B FRAMEBUFFER
-FIXME: Document this.
-.
-.TP
-.B HOME
-FIXME: Document this.
-.
-.SS libmpdemux:
-.
-.TP
-.B HOME
-FIXME: Document this.
-.
-.TP
-.B HOMEPATH
-FIXME: Document this.
-.
-.TP
-.B http_proxy
-FIXME: Document this.
-.
-.TP
-.B LOGNAME
-FIXME: Document this.
-.
-.TP
-.B USERPROFILE
-FIXME: Document this.
-.
-.SS GUI:
-.
-.TP
-.B CHARSET
-FIXME: Document this.
-.
-.TP
-.B DISPLAY
-FIXME: Document this.
-.
-.TP
-.B HOME
-FIXME: Document this.
-.
-.SS libavformat:
-.
-.TP
-.B AUDIO_FLIP_LEFT
-FIXME: Document this.
-.
-.TP
-.B BKTR_DEV
-FIXME: Document this.
-.
-.TP
-.B BKTR_FORMAT
-FIXME: Document this.
-.
-.TP
-.B BKTR_FREQUENCY
-FIXME: Document this.
-.
-.TP
-.B http_proxy
-FIXME: Document this.
-.
-.TP
-.B no_proxy
-FIXME: Document this.
-.
-.
-.
-.\" --------------------------------------------------------------------------
-.\" Files
-.\" --------------------------------------------------------------------------
-.
-.SH FILES
-.
-.TP
-/usr/\:local/\:etc/\:mplayer/\:mplayer.conf
-MPlayer system-wide settings
-.
-.TP
-~/.mplayer/\:config
-MPlayer user settings
-.
-.TP
-~/.mplayer/\:input.conf
-input bindings (see '\-input keylist' for the full list)
-.
-.TP
-~/.mplayer/\:font/
-font directory (There must be a font.desc file and files with .RAW extension.)
-.
-.TP
-~/.mplayer/\:DVDkeys/
-cached CSS keys
-.RE
-.PD 1
-.
-.
-.\" --------------------------------------------------------------------------
-.\" Examples
-.\" --------------------------------------------------------------------------
-.
-.SH EXAMPLES OF MPLAYER USAGE
-.
-.PP
-.B Quickstart Blu\-ray playing:
-.nf
-mplayer br:////path/to/disc
-mplayer br:// \-bluray\-device /path/to/disc
-.fi
-.
-.PP
-.B Quickstart DVD playing:
-.nf
-mplayer dvd://1
-.fi
-.
-.PP
-.B Play in Japanese with English subtitles:
-.nf
-mplayer dvd://1 \-alang ja \-slang en
-.fi
-.
-.PP
-.B Play only chapters 5, 6, 7:
-.nf
-mplayer dvd://1 \-chapter 5\-7
-.fi
-.
-.PP
-.B Play only titles 5, 6, 7:
-.nf
-mplayer dvd://5\-7
-.fi
-.
-.PP
-.B Play a multiangle DVD:
-.nf
-mplayer dvd://1 \-dvdangle 2
-.fi
-.
-.PP
-.B Play from a different DVD device:
-.nf
-mplayer dvd://1 \-dvd\-device /dev/\:dvd2
-.fi
-.
-.PP
-.B Play DVD video from a directory with VOB files:
-.nf
-mplayer dvd://1 \-dvd\-device /path/\:to/\:directory/
-.fi
-.
-.PP
-.B Copy a DVD title to hard disk, saving to file "title1.vob":
-.nf
-mplayer dvd://1 \-dumpstream \-dumpfile title1.vob
-.fi
-.
-.PP
-.B Play a DVD with dvdnav from path /dev/sr1:
-.nf
-mplayer dvdnav:////dev/sr1
-.fi
-.
-.PP
-.B Stream from HTTP:
-.nf
-mplayer http://mplayer.hq/example.avi
-.fi
-.
-.PP
-.B Stream using RTSP:
-.nf
-mplayer rtsp://server.example.com/streamName
-.fi
-.
-.PP
-.B Convert subtitles to MPsub format:
-.nf
-mplayer dummy.avi \-sub source.sub \-dumpmpsub
-.fi
-.
-.PP
-.B Convert subtitles to MPsub format without watching the movie:
-.nf
-mplayer /dev/\:zero \-rawvideo pal:fps=xx \-demuxer rawvideo \-vc null \-vo null \-noframedrop \-benchmark \-sub source.sub \-dumpmpsub
-.fi
-.
-.PP
-.B input from standard V4L:
-.nf
-mplayer tv:// \-tv driver=v4l:width=640:height=480:outfmt=i420 \-vc rawi420 \-vo xv
-.fi
-.
-.PP
-.B Play DTS-CD with passthrough:
-.nf
-mplayer \-ac hwdts \-rawaudio format=0x2001 \-cdrom\-device /dev/cdrom cdda://
-.fi
-.br
-You can also use \-afm hwac3 instead of \-ac hwdts.
-Adjust '/dev/cdrom' to match the CD-ROM device on your system.
-If your external receiver supports decoding raw DTS streams,
-you can directly play it via cdda:// without setting format, hwac3 or hwdts.
-.
-.PP
-.B Play a 6-channel AAC file with only two speakers:
-.nf
-mplayer \-rawaudio format=0xff \-demuxer rawaudio \-af pan=2:.32:.32:.39:.06:.06:.39:.17:-.17:-.17:.17:.33:.33 adts_he-aac160_51.aac
-.fi
-.br
-You might want to play a bit with the pan values (e.g multiply with a value) to
-increase volume or avoid clipping.
-.
-.PP
-.B checkerboard invert with geq filter:
-.nf
-mplayer \-vf geq='128+(p(X\\,Y)\-128)*(0.5\-gt(mod(X/SW\\,128)\\,64))*(0.5\-gt(mod(Y/SH\\,128)\\,64))*4'
-.fi
-.
-.
-.\" --------------------------------------------------------------------------
-.\" Bugs, authors, standard disclaimer
-.\" --------------------------------------------------------------------------
-.
-.SH AUTHORS
-MPlayer was initially written by Arpad Gereoffy.
-See the AUTHORS file for a list of some of the many other contributors.
-.PP
-MPlayer is (C) 2000\-2011 The MPlayer Team
-.PP
-This man page was written mainly by Gabucino, Jonas Jermann and Diego Biurrun.
-.\" end of file
diff --git a/DOCS/man/en/mplayer.rst b/DOCS/man/en/mpv.rst
index 89b03737c3..6de386fdf9 100644
--- a/DOCS/man/en/mplayer.rst
+++ b/DOCS/man/en/mpv.rst
@@ -1,32 +1,32 @@
-mplayer2 manual page
+mpv manual page
####################
Synopsis
========
-| **mplayer** [options] [file|URL|-]
-| **mplayer** [options] --playlist=PLAYLIST
-| **mplayer** [options] files
-| **mplayer** [options] {group of files and options}
-| **mplayer** [bd]://[title][/device] [options]
-| **mplayer** dvd://[title|[start\_title]-end\_title][/device] [options]
-| **mplayer** \vcd://track[/device]
-| **mplayer** \tv://[channel][/input_id] [options]
-| **mplayer** radio://[channel|frequency][/capture] [options]
-| **mplayer** \pvr:// [options]
-| **mplayer** \dvb://[card\_number@]channel [options]
-| **mplayer** \mf://[filemask|\@listfile] [-mf options] [options]
-| **mplayer** [cdda|cddb]://track[-endtrack][:speed][/device] [options]
-| **mplayer** [file|mms[t]|http|http\_proxy|rt[s]p|ftp|udp|unsv|icyx|noicyx|smb]:// [user:pass\@]URL[:port] [options]
-| **mplayer** \sdp://file [options]
-| **mplayer** \mpst://host[:port]/URL [options]
-| **mplayer** \tivo://host/[list|llist|fsid] [options]
+| **mpv** [options] [file|URL|-]
+| **mpv** [options] --playlist=PLAYLIST
+| **mpv** [options] files
+| **mpv** [options] {group of files and options}
+| **mpv** [bd]://[title][/device] [options]
+| **mpv** dvd://[title|[start\_title]-end\_title][/device] [options]
+| **mpv** \vcd://track[/device]
+| **mpv** \tv://[channel][/input_id] [options]
+| **mpv** radio://[channel|frequency][/capture] [options]
+| **mpv** \pvr:// [options]
+| **mpv** \dvb://[card\_number@]channel [options]
+| **mpv** \mf://[filemask|\@listfile] [-mf options] [options]
+| **mpv** [cdda|cddb]://track[-endtrack][:speed][/device] [options]
+| **mpv** [file|mms[t]|http|http\_proxy|rt[s]p|ftp|udp|unsv|icyx|noicyx|smb]:// [user:pass\@]URL[:port] [options]
+| **mpv** \sdp://file [options]
+| **mpv** \mpst://host[:port]/URL [options]
+| **mpv** \tivo://host/[list|llist|fsid] [options]
DESCRIPTION
===========
-**mplayer** is a movie player for Linux. It supports a wide variety of video
+**mpv** is a movie player based on MPlayer and mplayer2. It supports a wide variety of video
file formats, audio and video codecs, and subtitle types. Special input URL
types are available to read input from a variety of sources other than disk
files. Depending on platform, a variety of different video and audio output
@@ -39,8 +39,8 @@ page.
INTERACTIVE CONTROL
===================
-MPlayer has a fully configurable, command-driven control layer which allows you
-to control MPlayer using keyboard, mouse, joystick or remote control (with
+mpv has a fully configurable, command-driven control layer which allows you
+to control mpv using keyboard, mouse, joystick or remote control (with
LIRC). See the ``--input`` option for ways to customize it.
keyboard control
@@ -283,9 +283,9 @@ the *XXX* option or if *XXX* is compiled in.
| It has the following format:
| %n%string\_of\_length\_n
| *EXAMPLES*:
-| `mplayer --ao pcm:file=%10%C:test.wav test.avi`
+| `mpv --ao pcm:file=%10%C:test.wav test.avi`
| Or in a script:
-| `mplayer --ao pcm:file=%\`expr length "$NAME"\`%"$NAME" test.avi`
+| `mpv --ao pcm:file=%\`expr length "$NAME"\`%"$NAME" test.avi`
Per-file options
@@ -294,7 +294,7 @@ Per-file options
When playing multiple files, any option given on the command line usually
affects all files. Example:
-`mplayer --a file1.mkv --b file2.mkv --c`
+`mpv --a file1.mkv --b file2.mkv --c`
+-----------+-------------------------+
| File | Active options |
@@ -311,7 +311,7 @@ Sometimes, it's useful to change options per-file. This can be achieved by
adding the special per-file markers `--{` and `--}`. (Note that you must
escape these on some shells.) Example:
-`mplayer --a file1.mkv --b --\\\{ --c file2.mkv --d file3.mkv --e --\\\} file4.mkv --f`
+`mpv --a file1.mkv --b --\\\{ --c file2.mkv --d file3.mkv --e --\\\} file4.mkv --f`
+-----------+-------------------------+
| File | Active options |
@@ -334,9 +334,9 @@ CONFIGURATION FILES
===================
You can put all of the options in configuration files which will be read every
-time MPlayer is run. The system-wide configuration file 'mplayer.conf' is in
-your configuration directory (e.g. ``/etc/mplayer`` or
-``/usr/local/etc/mplayer``), the user specific one is ``~/.mplayer/config``.
+time mpv is run. The system-wide configuration file 'mpv.conf' is in
+your configuration directory (e.g. ``/etc/mpv`` or
+``/usr/local/etc/mpv``), the user specific one is ``~/.mpv/config``.
User specific options override system-wide options and options given on the
command line override either. The syntax of the configuration files is
``option=<value>``, everything after a *#* is considered a comment. Options
@@ -347,16 +347,16 @@ can be specified in this way.
You can also write file-specific configuration files. If you wish to have a
configuration file for a file called 'movie.avi', create a file named
'movie.avi.conf' with the file-specific options in it and put it in
-``~/.mplayer/``. You can also put the configuration file in the same directory
+``~/.mpv/``. You can also put the configuration file in the same directory
as the file to be played, as long as you give the ``--use-filedir-conf``
option (either on the command line or in your global config file). If a
file-specific configuration file is found in the same directory, no
-file-specific configuration is loaded from ``~/.mplayer``. In addition, the
+file-specific configuration is loaded from ``~/.mpv``. In addition, the
``--use-filedir-conf`` option enables directory-specific configuration files.
-For this, MPlayer first tries to load a mplayer.conf from the same directory
+For this, mpv first tries to load a mpv.conf from the same directory
as the file played and then tries to load any file-specific configuration.
-*EXAMPLE MPLAYER CONFIGURATION FILE:*
+*EXAMPLE MPV CONFIGURATION FILE:*
| # Use gl3 video output by default.
| vo=gl3
@@ -379,7 +379,7 @@ description (shown by ``--profile=help``) can be defined with the profile-desc
option. To end the profile, start another one or use the profile name
*default* to continue with normal options.
-*EXAMPLE MPLAYER PROFILE:*
+*EXAMPLE MPV PROFILE:*
| [protocol.dvd]
| profile-desc="profile for dvd:// streams"
@@ -409,6 +409,8 @@ OPTIONS
.. include:: encode.rst
+.. include:: input.rst
+
Taking screenshots
==================
@@ -438,22 +440,22 @@ ENVIRONMENT VARIABLES
=====================
There are a number of environment variables that can be used to control the
-behavior of MPlayer.
+behavior of mpv.
-``MPLAYER_CHARSET`` (see also ``--msgcharset``)
+``MPV_CHARSET`` (see also ``--msgcharset``)
Convert console messages to the specified charset (default: autodetect). A
value of "noconv" means no conversion.
-``MPLAYER_HOME``
- Directory where MPlayer looks for user settings.
+``MPV_HOME``
+ Directory where mpv looks for user settings.
-``MPLAYER_LOCALEDIR``
- Directory where MPlayer looks for gettext translation files (if enabled).
+``MPV_LOCALEDIR``
+ Directory where mpv looks for gettext translation files (if enabled).
-``MPLAYER_VERBOSE`` (see also ``-v`` and ``--msglevel``)
+``MPV_VERBOSE`` (see also ``-v`` and ``--msglevel``)
Set the initial verbosity level across all message modules (default: 0).
The resulting verbosity corresponds to that of ``--msglevel=5`` plus the
- value of ``MPLAYER_VERBOSE``.
+ value of ``MPV_VERBOSE``.
libaf:
``LADSPA_PATH``
@@ -595,58 +597,58 @@ libavformat:
FILES
=====
-``/usr/local/etc/mplayer/mplayer.conf``
- MPlayer system-wide settings
+``/usr/local/etc/mpv/mpv.conf``
+ mpv system-wide settings
-``~/.mplayer/config``
- MPlayer user settings
+``~/.mpv/config``
+ mpv user settings
-``~/.mplayer/input.conf``
+``~/.mpv/input.conf``
input bindings (see ``--input=keylist`` for the full list)
-``~/.mplayer/DVDkeys/``
+``~/.mpv/DVDkeys/``
cached CSS keys
-EXAMPLES OF MPLAYER USAGE
+EXAMPLES OF MPV USAGE
=========================
Quickstart Blu-ray playing:
- - ``mplayer bd:////path/to/disc``
- - ``mplayer bd:// --bluray-device=/path/to/disc``
+ - ``mpv bd:////path/to/disc``
+ - ``mpv bd:// --bluray-device=/path/to/disc``
Quickstart DVD playing:
- ``mplayer dvd://1``
+ ``mpv dvd://1``
Play in Japanese with English subtitles:
- ``mplayer dvd://1 --alang=ja --slang=en``
+ ``mpv dvd://1 --alang=ja --slang=en``
Play only chapters 5, 6, 7:
- ``mplayer dvd://1 --chapter=5-7``
+ ``mpv dvd://1 --chapter=5-7``
Play only titles 5, 6, 7:
- ``mplayer dvd://5-7``
+ ``mpv dvd://5-7``
Play a multiangle DVD:
- ``mplayer dvd://1 --dvdangle=2``
+ ``mpv dvd://1 --dvdangle=2``
Play from a different DVD device:
- ``mplayer dvd://1 --dvd-device=/dev/dvd2``
+ ``mpv dvd://1 --dvd-device=/dev/dvd2``
Play DVD video from a directory with VOB files:
- ``mplayer dvd://1 --dvd-device=/path/to/directory/``
+ ``mpv dvd://1 --dvd-device=/path/to/directory/``
Stream from HTTP:
- ``mplayer http://mplayer.hq/example.avi``
+ ``mpv http://mpv.hq/example.avi``
Stream using RTSP:
- ``mplayer rtsp://server.example.com/streamName``
+ ``mpv rtsp://server.example.com/streamName``
input from standard V4L:
- ``mplayer tv:// --tv=driver=v4l:width=640:height=480:outfmt=i420 --vc=rawi420 --vo=xv``
+ ``mpv tv:// --tv=driver=v4l:width=640:height=480:outfmt=i420 --vc=rawi420 --vo=xv``
Play DTS-CD with passthrough:
- ``mplayer --ac=hwdts --rawaudio=format=0x2001 --cdrom-device=/dev/cdrom cdda://``
+ ``mpv --ac=hwdts --rawaudio=format=0x2001 --cdrom-device=/dev/cdrom cdda://``
You can also use ``--afm=hwac3`` instead of ``--ac=hwdts``. Adjust
``/dev/cdrom`` to match the CD-ROM device on your system. If your external
@@ -654,21 +656,23 @@ Play DTS-CD with passthrough:
``cdda://`` without setting format, hwac3 or hwdts.
Play a 6-channel AAC file with only two speakers:
- ``mplayer --rawaudio=format=0xff --demuxer=rawaudio --af=pan=2:.32:.32:.39:.06:.06:.39:.17:-.17:-.17:.17:.33:.33 adts_he-aac160_51.aac``
+ ``mpv --rawaudio=format=0xff --demuxer=rawaudio --af=pan=2:.32:.32:.39:.06:.06:.39:.17:-.17:-.17:.17:.33:.33 adts_he-aac160_51.aac``
You might want to play a bit with the pan values (e.g multiply with a
value) to increase volume or avoid clipping.
checkerboard invert with geq filter:
- ``mplayer --vf=geq='128+(p(X\,Y)-128)*(0.5-gt(mod(X/SW\,128)\,64))*(0.5-gt(mod(Y/SH\,128)\,64))*4'``
+ ``mpv --vf=geq='128+(p(X\,Y)-128)*(0.5-gt(mod(X/SW\,128)\,64))*(0.5-gt(mod(Y/SH\,128)\,64))*4'``
AUTHORS
=======
+mpv is a MPlayer fork based on mplayer2, which in turn is a fork of MPlayer.
+
MPlayer was initially written by Arpad Gereoffy. See the ``AUTHORS`` file for
a list of some of the many other contributors.
-MPlayer is (C) 2000-2011 The MPlayer Team
+MPlayer is (C) 2000-2012 The MPlayer Team
This man page was written mainly by Gabucino, Jonas Jermann and Diego Biurrun.
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 0b623859e5..ca245f6d32 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -14,7 +14,7 @@
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 ',' MPlayer will fall back on codecs not contained
+ the list has a trailing ',' mpv will fall back on codecs not contained
in the list.
*NOTE*: See ``--ac=help`` for a full list of available codecs.
@@ -58,7 +58,7 @@
may silently fail, and the sound quality may drop.
3
Use no automatic insertion of filters and no optimization.
- *Warning*: It may be possible to crash MPlayer using this setting.
+ *Warning*: It may be possible to crash mpv using this setting.
4
Use automatic insertion of filters according to 0 above, but use
floating point processing when possible.
@@ -95,15 +95,15 @@
Specify a priority list of audio languages to use. Different container
formats employ different language codes. DVDs use ISO 639-1 two letter
language codes, Matroska, MPEG-TS and NUT use ISO 639-2 three letter
- language codes while OGM uses a free-form identifier. MPlayer prints the
+ language codes while OGM uses a free-form identifier. mpv prints the
available languages when run in verbose (``-v``) mode. See also ``--aid``.
*EXAMPLE*:
- ``mplayer dvd://1 --alang=hu,en``
+ ``mpv dvd://1 --alang=hu,en``
Chooses the Hungarian language track on a DVD and falls back on
English if Hungarian is not available.
- ``mplayer --alang=jpn example.mkv``
+ ``mpv --alang=jpn example.mkv``
Plays a Matroska file in Japanese.
--ao=<driver1[:suboption1[=value]:...],driver2,...[,]>
@@ -174,6 +174,14 @@
rendering text subtitles. The syntax of the file is exactly like the ``[V4
Styles]`` / ``[V4+ Styles]`` section of SSA/ASS.
+--ass-style-override=<yes|no>
+ Control whether user style overrides should be applied.
+
+ :yes: Apply all the ``--ass-*`` style override options. Changing the default
+ for any of these options can lead to incorrect subtitle rendering.
+ (Default.)
+ :no: Render subtitles as forced by subtitle scripts.
+
--ass-top-margin=<value>
Adds a black band at the top of the frame. The SSA/ASS renderer can place
toptitles there (with ``--ass-use-margins``).
@@ -243,11 +251,11 @@
--bluray-angle=<ID>
Some Blu-ray discs contain scenes that can be viewed from multiple angles.
- Here you can tell MPlayer which angles to use (default: 1).
+ Here you can tell mpv which angles to use (default: 1).
--bluray-chapter=<ID>
(Blu-ray only)
- Tells MPlayer which Blu-ray chapter to start the current title from
+ Tells mpv which Blu-ray chapter to start the current title from
(default: 1).
--bluray-device=<path>
@@ -276,12 +284,12 @@
--cache-seek-min=<percentage>
If a seek is to be made to a position within <percentage> of the cache
- size from the current position, MPlayer will wait for the cache to be
+ size from the current position, mpv will wait for the cache to be
filled to this position rather than performing a stream seek (default:
50).
--cdda=<option1:option2>
- This option can be used to tune the CD Audio reading feature of MPlayer.
+ This option can be used to tune the CD Audio reading feature of mpv.
Available options are:
@@ -321,7 +329,7 @@
Specify the CD-ROM device (default: ``/dev/cdrom``).
--channels=<number>
- Request the number of playback channels (default: 2). MPlayer asks the
+ Request the number of playback channels (default: 2). mpv asks the
decoder to decode the audio into as many channels as specified. Then it is
up to the decoder to fulfill the requirement. This is usually only
important when playing videos with AC-3 audio (like DVDs). In that case
@@ -455,7 +463,7 @@
assumed to be in Netscape format.
--correct-pts, --no-correct-pts
- Switches MPlayer to a mode where timestamps for video frames are
+ Switches mpv to a mode where timestamps for video frames are
calculated differently and video filters which add new frames or modify
timestamps of existing ones are supported. Now enabled automatically for
most common file formats. The more accurate timestamps can be visible for
@@ -470,7 +478,7 @@
will stay hidden. Supported by video output drivers which use X11 or
OS X Cocoa.
---delay=<sec>
+--audio-delay=<sec>
audio delay in seconds (positive or negative float value). Negative values
delay the audio, and positive values delay the video.
@@ -496,10 +504,10 @@
override the default ones:
:card=<1-4>: Specifies using card number 1-4 (default: 1).
- :file=<filename>: Instructs MPlayer to read the channels list from
+ :file=<filename>: Instructs mpv to read the channels list from
<filename>. Default is
- ``~/.mplayer/channels.conf.{sat,ter,cbl,atsc}`` (based
- on your card type) or ``~/.mplayer/channels.conf`` as a
+ ``~/.mpv/channels.conf.{sat,ter,cbl,atsc}`` (based
+ on your card type) or ``~/.mpv/channels.conf`` as a
last resort.
:timeout=<1-30>: Maximum number of seconds to wait when trying to tune a
frequency before giving up (default: 30).
@@ -513,7 +521,7 @@
Try to limit DVD speed (default: 0, no change). DVD base speed is 1385
kB/s, so a 8x drive can read at speeds up to 11080 kB/s. Slower speeds
make the drive more quiet. For watching DVDs 2700 kB/s should be quiet and
- fast enough. MPlayer resets the speed to the drive default value on close.
+ fast enough. mpv resets the speed to the drive default value on close.
Values of at least 100 mean speed in kB/s. Values less than 100 mean
multiples of 1385 kB/s, i.e. ``--dvd-speed=8`` selects 11080 kB/s.
@@ -521,12 +529,12 @@
--dvdangle=<ID>
Some DVD discs contain scenes that can be viewed from multiple angles.
- Here you can tell MPlayer which angles to use (default: 1).
+ Here you can tell mpv which angles to use (default: 1).
--edition=<ID>
(Matroska files only)
Specify the edition (set of chapters) to use, where 0 is the first. If set
- to -1 (the default), MPlayer will choose the first edition declared as a
+ to -1 (the default), mpv will choose the first edition declared as a
default, or if there is no default, the first edition defined.
--edlout=<filename>
@@ -605,20 +613,20 @@
specify a particular font. See also ``--subfont``. With fontconfig enabled
the argument is a fontconfig pattern and the default is ``sans``. Without
fontconfig the argument is a filename and the default is
- ``~/.mplayer/subfont.ttf``.
+ ``~/.mpv/subfont.ttf``.
*EXAMPLE*:
- - ``--font=~/.mplayer/arialuni.ttf`` (no fontconfig)
+ - ``--font=~/.mpv/arialuni.ttf`` (no fontconfig)
- ``--font='Bitstream Vera Sans'`` (usual case with fontconfig)
- ``--font='Bitstream Vera Sans:style=Bold'`` (usual case with fontconfig)
--force-window-position
- Forcefully move MPlayer's video output window to default location whenever
+ Forcefully move mpv's video output window to default location whenever
there is a change in video parameters, video stream or file. This used to
be the default behavior. Currently only affects X11 VOs.
---forcedsubsonly
+--sub-forced-only
Display only forced subtitles for the DVD subtitle stream selected by e.g.
``--slang``.
@@ -637,11 +645,14 @@
--fps=<float>
Override video framerate. Useful if the original value is wrong or missing.
---framedrop
+--framedrop=<no|yes|hard>
Skip displaying some frames to maintain A/V sync on slow systems. Video
filters are not applied to such frames. For B-frames even decoding is
- skipped completely. May produce unwatchably choppy output. See also
- ``--hardframedrop``.
+ skipped completely. May produce unwatchably choppy output. With ``hard``,
+ decoding and output of any frame can be skipped, and will lead to an even
+ worse playback experience.
+
+ Practical use of this feature is questionable. Disabled by default.
--frames=<number>
Play/convert only first <number> frames, then quit.
@@ -650,6 +661,7 @@
Specifies the character set that will be passed to FriBiDi when decoding
non-UTF-8 subtitles (default: ISO8859-8).
+--fullscreen
--fs
Fullscreen playback (centers movie, and paints black bands around it).
@@ -747,14 +759,11 @@
``--no-grabpointer`` tells the player to not grab the mouse pointer after a
video mode change (``--vm``). Useful for multihead setups.
---hardframedrop
- More intense frame dropping (breaks decoding). Leads to image distortion!
-
--heartbeat-cmd
Command that is executed every 30 seconds during playback via *system()* -
i.e. using the shell.
- *NOTE*: mplayer uses this command without any checking, it is your
+ *NOTE*: mpv uses this command without any checking, it is your
responsibility to ensure it does not cause security problems (e.g. make
sure to use full paths if "." is in your path like on Windows). It also
only works when playing video (i.e. not with ``--no-video`` but works with
@@ -765,10 +774,10 @@
complicated, ask the author of the screensaver program to support the
proper X APIs.
- *EXAMPLE for xscreensaver*: ``mplayer --heartbeat-cmd="xscreensaver-command
+ *EXAMPLE for xscreensaver*: ``mpv --heartbeat-cmd="xscreensaver-command
-deactivate" file``
- *EXAMPLE for GNOME screensaver*: ``mplayer
+ *EXAMPLE for GNOME screensaver*: ``mpv
--heartbeat-cmd="gnome-screensaver-command -p" file``
--help
@@ -815,7 +824,7 @@
*EXAMPLE*:
- ``mplayer --http-header-fields='Field1: value1','Field2: value2' http://localhost:1234``
+ ``mpv --http-header-fields='Field1: value1','Field2: value2' http://localhost:1234``
Will generate HTTP request:
@@ -839,12 +848,12 @@
by using ``--msglevel=identify=6``. For example, for a DVD or Blu-ray it
will list the chapters and time length of each title, as well as a disk
ID. Combine this with ``--frames=0`` to suppress all video output. The
- wrapper script ``TOOLS/midentify.sh`` suppresses the other MPlayer output
+ wrapper script ``TOOLS/midentify.sh`` suppresses the other mpv output
and (hopefully) shellescapes the filenames.
--idle
- Makes MPlayer wait idly instead of quitting when there is no file to play.
- Mostly useful in slave mode where MPlayer can be controlled through input
+ Makes mpv wait idly instead of quitting when there is no file to play.
+ Mostly useful in slave mode where mpv can be controlled through input
commands (see also ``--slave``).
--idx
@@ -868,17 +877,17 @@
Specify configuration file to be parsed after the default ones.
--initial-audio-sync, --no-initial-audio-sync
- When starting a video file or after events such as seeking MPlayer will by
+ When starting a video file or after events such as seeking mpv will by
default modify the audio stream to make it start from the same timestamp
as video, by either inserting silence at the start or cutting away the
first samples. Disabling this option makes the player behave like older
- MPlayer versions did: video and audio are both started immediately even if
+ mpv versions did: video and audio are both started immediately even if
their start timestamps differ, and then video timing is gradually adjusted
if necessary to reach correct synchronization later.
--input=<commands>
This option can be used to configure certain parts of the input system.
- Paths are relative to ``~/.mplayer/``.
+ Paths are relative to ``~/.mpv/``.
*NOTE*: Autorepeat is currently only supported by joysticks.
@@ -886,7 +895,7 @@
conf=<filename>
Specify input configuration file other than the default
- ``~/.mplayer/input.conf``. ``~/.mplayer/<filename>`` is assumed if no
+ ``~/.mpv/input.conf``. ``~/.mpv/<filename>`` is assumed if no
full path is given.
ar-dev=<device>
@@ -901,7 +910,7 @@
Number of key presses to generate per second on autorepeat.
(no)default-bindings
- Use the key bindings that MPlayer ships with by default.
+ Use the key bindings that mpv ships with by default.
keylist
Prints all keys that can be bound to commands.
@@ -916,10 +925,17 @@
Read commands from the given file. Mostly useful with a FIFO.
See also ``--slave``.
- *NOTE*: When the given file is a FIFO MPlayer opens both ends so you
+ *NOTE*: When the given file is a FIFO mpv opens both ends so you
can do several `echo "seek 10" > mp_pipe` and the pipe will stay
valid.
+ test
+ Input test mode. Instead of executing commands on key presses, mpv
+ will show the keys and the bound commands on the OSD. Has to be used
+ with a dummy video, and the normal ways to quit the player will not
+ work (key bindings that normally quit will be shown on OSD only, just
+ like any other binding).
+
--ipv4-only-proxy
Skip any HTTP proxy for IPv6 addresses. It will still be used for IPv4
connections.
@@ -929,7 +945,7 @@
--keepaspect, --no-keepaspect
Keep window aspect ratio when resizing windows. Enabled by default. By
- default MPlayer tries to keep the correct video aspect ratio by
+ default mpv tries to keep the correct video aspect ratio by
instructing the window manager to maintain window aspect when resizing,
and by adding black bars if the window manager nevertheless allows window
shape to change. --no-keepaspect disables window manager aspect hints and
@@ -1100,7 +1116,7 @@
Note, a patch to make the *o=* unneeded and pass all unknown options
through the AVOption system is welcome. A full list of AVOptions can
be found in the FFmpeg manual. Note that some options may conflict
- with MPlayer options.
+ with mpv options.
*EXAMPLE*: ``o=fflags=+ignidx``
probesize=<value>
@@ -1127,11 +1143,11 @@
--loadidx=<filename>
The file from which to read the video index data saved by ``--saveidx``.
This index will be used for seeking, overriding any index data contained
- in the AVI itself. MPlayer will not prevent you from loading an index file
+ in the AVI itself. mpv will not prevent you from loading an index file
generated from a different AVI, but this is sure to cause unfavorable
results.
- *NOTE*: This option is obsolete now that MPlayer has OpenDML support.
+ *NOTE*: This option is obsolete now that mpv has OpenDML support.
--loop=<number|inf|no>
Loops playback <number> times. ``inf`` means forever and ``no`` disables
@@ -1156,7 +1172,7 @@
--mixer-channel=<name[,index]>
(``--ao=oss`` and ``--ao=alsa`` only)
- This option will tell MPlayer to use a different channel for controlling
+ This option will tell mpv to use a different channel for controlling
volume than the default PCM. Options for OSS include **vol, pcm, line**.
For a complete list of options look for ``SOUND_DEVICE_NAMES`` in
``/usr/include/linux/soundcard.h``. For ALSA you can use the names e.g.
@@ -1183,7 +1199,7 @@
also ``--monitoraspect`` and ``--aspect``.
--mouse-movements
- Permit MPlayer to receive pointer events reported by the video output
+ Permit mpv to receive pointer events reported by the video output
driver. Necessary to select the buttons in DVD menus. Supported for
X11-based VOs (x11, xv, etc) and the gl, direct3d and corevideo VOs.
@@ -1202,7 +1218,7 @@
*NOTE*: Some messages are printed before the command line is parsed and
are therefore not affected by ``--msglevel``. To control these messages
- you have to use the ``MPLAYER_VERBOSE`` environment variable; see its
+ you have to use the ``MPV_VERBOSE`` environment variable; see its
description below for details.
Available levels:
@@ -1278,7 +1294,7 @@
--ordered-chapters, --no-ordered-chapters
Enabled by default.
- Disable support for Matroska ordered chapters. MPlayer will not load or
+ Disable support for Matroska ordered chapters. mpv will not load or
search for video segments from other files, and will also ignore any
chapter order specified for the main file.
@@ -1288,7 +1304,7 @@
--osd-fractions
Show OSD times with fractions of seconds.
---osdlevel=<0-3>
+--osd-level=<0-3>
Specifies which mode the OSD should start in.
:0: subtitles only
@@ -1306,9 +1322,6 @@
controls how much of the image is cropped. May not work with all video
output drivers.
- *NOTE*: Values between -1 and 0 are allowed as well, but highly
- experimental and may crash or worse. Use at your own risk!
-
--panscanrange=<-19.0-99.0>
(experimental)
Change the range of the pan-and-scan functionality (default: 1). Positive
@@ -1322,23 +1335,45 @@
See also ``--user``.
--playing-msg=<string>
- Print out a string before starting playback. The following expansions are
- supported:
+ Print out a string before starting playback. The string is expanded for
+ properties, e.g. ``--playing-msg=file: ${filename}`` will print the string
+ ``file: `` followed by the currently played filename.
+
+ The following expansions are supported:
${NAME}
- Expand to the value of the property ``NAME``.
- ?(NAME:TEXT)
- Expand ``TEXT`` only if the property ``NAME`` is available.
- ?(!NAME:TEXT)
- Expand ``TEXT`` only if the property ``NAME`` is not available.
+ Expands to the value of the property ``NAME``. If ``NAME`` starts with
+ ``=``, use the raw value of the property. If retrieving the property
+ fails, expand to an error string. (Use ``${NAME:}`` with a trailing
+ ``:`` to expand to an empty string instead.)
+ ${NAME:STR}
+ Expands to the value of the property ``NAME``, or ``STR`` if the
+ property can't be retrieved. ``STR`` is expanded recursively.
+ ${!NAME:STR}
+ Expands to ``STR`` (recursively) if the property ``NAME`` can't be
+ retrieved.
+ ${?NAME:STR}
+ Expands to ``STR`` (recursively) if the property ``NAME`` is available.
+ $$
+ Expands to ``$``.
+ $}
+ Expands to ``}``. (To produce this character inside rexursive
+ expansion.)
+ $>
+ Disable property expansion and special handling of ``$`` for the rest
+ of the string.
+
+--status-msg=<string>
+ Print out a custom string during playback instead of the standard status
+ line. Expands properties. See ``--playing-msg``.
--playlist=<filename>
Play files according to a playlist file (ASX, Winamp, SMIL, or
one-file-per-line format).
- *WARNING*: The way MPlayer parses and uses playlist files is not safe
+ *WARNING*: The way mpv parses and uses playlist files is not safe
against maliciously constructed files. Such files may trigger harmful
- actions. This has been the case for all MPlayer versions, but
+ actions. This has been the case for all mpv and MPlayer versions, but
unfortunately this fact was not well documented earlier, and some people
have even misguidedly recommended use of ``--playlist`` with untrusted
sources. Do NOT use ``--playlist`` with random internet sources or files
@@ -1367,7 +1402,7 @@
--priority=<prio>
(Windows only.)
- Set process priority for MPlayer according to the predefined priorities
+ Set process priority for mpv according to the predefined priorities
available under Windows.
Possible values of <prio>:
@@ -1396,7 +1431,7 @@
the V4L2 driver. The Hauppauge WinTV PVR-150/250/350/500 and all IVTV
based cards are known as PVR capture cards. Be aware that only Linux
2.6.18 kernel and above is able to handle MPEG stream through V4L2 layer.
- For hardware capture of an MPEG stream and watching it with MPlayer, use
+ For hardware capture of an MPEG stream and watching it with mpv, use
``pvr://`` as a movie URL.
Available options are:
@@ -1454,10 +1489,10 @@
--radio=<option1:option2:...>
These options set various parameters of the radio capture module. For
- listening to radio with MPlayer use ``radio://<frequency>`` (if channels
+ listening to radio with mpv use ``radio://<frequency>`` (if channels
option is not given) or ``radio://<channel_number>`` (if channels option
is given) as a movie URL. You can see allowed frequency range by running
- MPlayer with ``-v``. To start the grabbing subsystem, use
+ mpv with ``-v``. To start the grabbing subsystem, use
``radio://<frequency or channel>/capture``. If the capture keyword is not
given you can listen to radio using the line-in cable only. Using capture
to listen is not recommended due to synchronization problems, which makes
@@ -1517,7 +1552,7 @@
:channels=<value>: number of channels
:rate=<value>: rate in samples per second
- :format=<value>: mplayer audio format (e.g. s16le)
+ :format=<value>: mpv audio format (e.g. s16le)
--rawvideo=<option1:option2:...>
This option lets you play raw video files. You have to use
@@ -1537,10 +1572,10 @@
*EXAMPLE*:
- - ``mplayer foreman.qcif --demuxer=rawvideo --rawvideo=qcif`` Play the
+ - ``mpv foreman.qcif --demuxer=rawvideo --rawvideo=qcif`` Play the
famous "foreman" sample video.
- - ``mplayer sample-720x576.yuv --demuxer=rawvideo --rawvideo=w=720:h=576``
+ - ``mpv sample-720x576.yuv --demuxer=rawvideo --rawvideo=w=720:h=576``
Play a raw YUV sample.
--really-quiet
@@ -1562,7 +1597,7 @@
Used with ``rtsp://`` URLs to force the destination IP address to be
bound. This option may be useful with some RTSP server which do not send
RTP packets to the right interface. If the connection to the RTSP server
- fails, use ``-v`` to see which IP address MPlayer tries to bind to and try
+ fails, use ``-v`` to see which IP address mpv tries to bind to and try
to force it to one assigned to your computer instead.
--rtsp-port
@@ -1570,18 +1605,6 @@
may be useful if you are behind a router and want to forward the RTSP
stream from the server to a specific client.
---rtsp-stream-over-http
- (LIVE555 only)
- Used with ``http://`` URLs to specify that the resulting incoming RTP and
- RTCP packets be streamed over HTTP.
-
---rtsp-stream-over-tcp
- (LIVE555 and NEMESI only)
- Used with ``rtsp://`` URLs to specify that the resulting incoming RTP and
- RTCP packets be streamed over TCP (using the same TCP connection as RTSP).
- This option may be useful if you have a broken internet connection that
- does not pass incoming UDP packets (see http://www.live555.com/mplayer/).
-
--saturation=<-100-100>
Adjust the saturation of the video signal (default: 0). You can get
grayscale output with this option. Not supported by all video output
@@ -1591,7 +1614,7 @@
Force index rebuilding and dump the index to <filename>. Currently this
only works with AVI files.
- *NOTE*: This option is obsolete now that MPlayer has OpenDML support.
+ *NOTE*: This option is obsolete now that mpv has OpenDML support.
--sb=<n>
Seek to byte position. Useful for playback from CD-ROM images or VOB files
@@ -1641,7 +1664,7 @@
passing the format ``%04n`` will yield ``0012`` on the 12th screenshot.
The number is incremented every time a screenshot is taken, or if the
file already exists. The length ``X`` must be in the range 0-9. With
- the optional # sign mplayer will use the lowest available number. For
+ the optional # sign mpv will use the lowest available number. For
example, if you take three screenshots--0001, 0002, 0003--and delete
the first two, the next two screenshots won't be 0004 and 0005, but
0001 and 0002 again.
@@ -1697,14 +1720,14 @@
Specify a priority list of subtitle languages to use. Different container
formats employ different language codes. DVDs use ISO 639-1 two letter
language codes, Matroska uses ISO 639-2 three letter language codes while
- OGM uses a free-form identifier. MPlayer prints the available languages
+ OGM uses a free-form identifier. mpv prints the available languages
when run in verbose (``-v``) mode. See also ``--sid``.
*EXAMPLE*:
- - ``mplayer dvd://1 --slang=hu,en`` chooses the Hungarian subtitle track on
+ - ``mpv dvd://1 --slang=hu,en`` chooses the Hungarian subtitle track on
a DVD and falls back on English if Hungarian is not available.
- - ``mplayer --slang=jpn example.mkv`` plays a Matroska file with Japanese
+ - ``mpv --slang=jpn example.mkv`` plays a Matroska file with Japanese
subtitles.
--slave-broken
@@ -1715,7 +1738,7 @@
particular, the status line output was changed, which is used by some
applications to determine the current playback position. This switch has
been renamed to prevent these applications from working with this version
- of mplayer, because it would lead to buggy and confusing behavior only.
+ of mpv, because it would lead to buggy and confusing behavior only.
Moreover, the slave mode protocol is so horribly bad that it should not be
used for new programs, nor should existing programs attempt to adapt to the
changed output and use the --slave-broken switch. Instead, a new, saner
@@ -1731,13 +1754,13 @@
--softsleep
Time frames by repeatedly checking the current time instead of asking
- the kernel to wake up MPlayer at the correct time. Useful if your kernel
+ the kernel to wake up mpv at the correct time. Useful if your kernel
timing is imprecise and you cannot use the RTC either. Comes at the
price of higher CPU consumption.
--softvol=<mode>
Control whether to use the volume controls of the audio output driver, or
- the internal mplayer volume filter.
+ the internal mpv volume filter.
:no: prefer audio driver controls, use the volume filter only if
absolutely needed
@@ -1745,7 +1768,7 @@
:auto: prefer the volume filter if the audio driver uses the system mixer (default)
The intention with ``auto`` is to avoid changing system mixer settings with
- default settings. mplayer is a video player, not a mixer panel. On the other
+ default settings. mpv is a video player, not a mixer panel. On the other
hand, mixer controls should be used for sound servers like PulseAudio, which
provide per-application volume.
@@ -1812,7 +1835,7 @@
*EXAMPLE*: ``--vf=scale=-ssf=lgb=3.0``
--sstep=<sec>
- Skip <sec> seconds after every frame. Since MPlayer will only seek to
+ Skip <sec> seconds after every frame. Since mpv will only seek to
the next keyframe unless you use ``--hr-seek`` this may be inexact.
--stereo=<mode>
@@ -1864,14 +1887,14 @@
to video file directory.
*EXAMPLE*: Assuming that ``/path/to/movie/movie.avi`` is played and
- ``--sub-paths=sub:subtitles:/tmp/subs`` is specified, MPlayer searches for
+ ``--sub-paths=sub:subtitles:/tmp/subs`` is specified, mpv searches for
subtitle files in these directories:
- ``/path/to/movie/``
- ``/path/to/movie/sub/``
- ``/path/to/movie/subtitles/``
- ``/tmp/subs/``
- - ``~/.mplayer/sub/``
+ - ``~/.mpv/sub/``
--subcp=<codepage>
If your system supports ``iconv(3)``, you can use this option to specify
@@ -1888,7 +1911,7 @@
You can specify your language using a two letter language code to make
ENCA detect the codepage automatically. If unsure, enter anything and
- watch mplayer ``-v`` output for available languages. Fallback codepage
+ watch mpv ``-v`` output for available languages. Fallback codepage
specifies the codepage to use, when autodetection fails.
*EXAMPLE*:
@@ -1898,7 +1921,7 @@
- ``--subcp=enca:pl:cp1250`` guess the encoding for Polish, fall back on
cp1250.
---subdelay=<sec>
+--sub-delay=<sec>
Delays subtitles by <sec> seconds. Can be negative.
--subfile=<filename>
@@ -1945,7 +1968,7 @@
*NOTE*: <rate> > movie fps speeds the subtitles up for frame-based
subtitle files and slows them down for time-based ones.
---subpos=<0-100>
+--sub-pos=<0-100>
Specify the position of subtitles on the screen. The value is the vertical
position of the subtitle in % of the screen height.
Can be useful with ``--vf=expand``.
@@ -1986,11 +2009,11 @@
the line used for the OSD and clear it (default: ``^[[A\r^[[K``).
--title
- Set the window title. The string can contain property names.
+ Set the window title. Properties are expanded (see ``--playing-msg``).
--tv=<option1:option2:...>
This option tunes various properties of the TV capture module. For
- watching TV with MPlayer, use ``tv://`` or ``tv://<channel_number>`` or
+ watching TV with mpv, use ``tv://`` or ``tv://<channel_number>`` or
even ``tv://<channel_name>`` (see option channels for channel_name below)
as a movie URL. You can also use ``tv:///<input_id>`` to start watching a
movie from a composite or S-Video input (see option input for details).
@@ -2130,7 +2153,7 @@
mjpeg
Use hardware MJPEG compression (if the card supports it). When using
this option, you do not need to specify the width and height of the
- output window, because MPlayer will determine it automatically from
+ output window, because mpv will determine it automatically from
the decimation value (see below).
decimation=<1|2|4>
@@ -2181,7 +2204,7 @@
in size, resulting in choppy video when using immediatemode=0.
--tvscan=<option1:option2:...>
- Tune the TV channel scanner. MPlayer will also print value for "-tv
+ Tune the TV channel scanner. mpv will also print value for "-tv
channels=" option, including existing and just found channels.
Available suboptions are:
@@ -2200,7 +2223,7 @@
indicate that the currently scanning channel is active.
--unicode
- Tells MPlayer to handle the subtitle file as unicode.
+ Tells mpv to handle the subtitle file as unicode.
--use-filedir-conf
Look for a file-specific configuration file in the same directory as the
@@ -2216,7 +2239,7 @@
Use <string> as user agent for HTTP streaming.
--utf8
- Tells MPlayer to handle the subtitle file as UTF-8.
+ Tells mpv to handle the subtitle file as UTF-8.
-v
Increment verbosity level, one level for each ``-v`` found on the command
@@ -2226,7 +2249,7 @@
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 ',' MPlayer will fall back on codecs not contained
+ the list has a trailing ',' mpv will fall back on codecs not contained
in the list.
*NOTE*: See ``--vc=help`` for a full list of available codecs.
@@ -2294,10 +2317,10 @@
--wid=<ID>
(X11, OpenGL and DirectX only)
- This tells MPlayer to attach to an existing window. Useful to embed
- MPlayer in a browser (e.g. the plugger extension). Earlier this option
+ This tells mpv to attach to an existing window. Useful to embed
+ mpv in a browser (e.g. the plugger extension). Earlier this option
always filled the given window completely, thus aspect scaling, panscan,
- etc were no longer handled by MPlayer but had to be managed by the
+ etc were no longer handled by mpv but had to be managed by the
application that created the window. Now aspect is maintained by default.
If you don't want that use ``--no-keepaspect``.
@@ -2307,7 +2330,7 @@
--xineramascreen=<-2-...>
In Xinerama configurations (i.e. a single desktop that spans across
- multiple displays) this option tells MPlayer which screen to display the
+ multiple displays) this option tells mpv which screen to display the
movie on. A value of -2 means fullscreen across the whole virtual display
(in this case Xinerama information is completely ignored), -1 means
fullscreen on the display the window currently is on. The initial position
@@ -2354,4 +2377,4 @@
--zoom
Allow software scaling, where available. This will allow scaling with
output drivers (like x11) that do not support hardware scaling,
- where MPlayer disables scaling by default for performance reasons.
+ where mpv disables scaling by default for performance reasons.
diff --git a/DOCS/man/en/vf.rst b/DOCS/man/en/vf.rst
index 434c2faec3..d46bd5bc06 100644
--- a/DOCS/man/en/vf.rst
+++ b/DOCS/man/en/vf.rst
@@ -217,17 +217,6 @@ dsize[=aspect|w:h:aspect-method:r]
<r>
Rounds up to make both width and height divisible by <r> (default: 1).
-yvu9
- Forces software YVU9 to YV12 colorspace conversion. Deprecated in favor of
- the software scaler.
-
-yuvcsp
- Clamps YUV color values to the CCIR 601 range without doing real
- conversion.
-
-palette
- RGB/BGR 8 -> 15/16/24/32bpp colorspace conversion using palette.
-
format[=fourcc[:outfourcc]]
Restricts the colorspace for the next filter without doing any conversion.
Use together with the scale filter for a real conversion.
@@ -391,132 +380,6 @@ pp[=filter1[:option1[:option2...]]/[-]filter2...]
Horizontal deblocking on luminance only, and switch vertical
deblocking on or off automatically depending on available CPU time.
-spp[=quality[:qp[:mode]]]
- Simple postprocessing filter that compresses and decompresses the image at
- several (or - in the case of quality level 6 - all) shifts and averages
- the results.
-
- <quality>
- 0-6 (default: 3)
-
- <qp>
- Force quantization parameter (default: 0, use QP from video).
-
- <mode>
-
- :0: hard thresholding (default)
- :1: soft thresholding (better deringing, but blurrier)
- :4: like 0, but also use B-frames' QP (may cause flicker)
- :5: like 1, but also use B-frames' QP (may cause flicker)
-
-uspp[=quality[:qp]]
- Ultra simple & slow postprocessing filter that compresses and decompresses
- the image at several (or - in the case of quality level 8 - all) shifts
- and averages the results.
-
- The way this differs from the behavior of spp is that uspp actually
- encodes & decodes each case with libavcodec Snow, whereas spp uses a
- simplified intra only 8x8 DCT similar to MJPEG.
-
- <quality>
- 0-8 (default: 3)
-
- <qp>
- Force quantization parameter (default: 0, use QP from video).
-
-fspp[=quality[:qp[:strength[:bframes]]]]
- faster version of the simple postprocessing filter
-
- <quality>
- 4-5 (equivalent to spp; default: 4)
-
- <qp>
- Force quantization parameter (default: 0, use QP from video).
-
- <-15-32>
- Filter strength, lower values mean more details but also more
- artifacts, while higher values make the image smoother but also
- blurrier (default: 0 - PSNR optimal).
-
- <bframes>
- 0: do not use QP from B-frames (default)
- 1: use QP from B-frames too (may cause flicker)
-
-pp7[=qp[:mode]]
- Variant of the spp filter, similar to spp=6 with 7 point DCT where only
- the center sample is used after IDCT.
-
- <qp>
- Force quantization parameter (default: 0, use QP from video).
-
- <mode>
- :0: hard thresholding
- :1: soft thresholding (better deringing, but blurrier)
- :2: medium thresholding (default, good results)
-
-qp=equation
- quantization parameter (QP) change filter
-
- <equation>
- some equation like ``2+2*sin(PI*qp)``
-
-geq=equation
- generic equation change filter
-
- <equation>
- Some equation, e.g. ``p(W-X\,Y)`` to flip the image horizontally. You
- can use whitespace to make the equation more readable. There are a
- couple of constants that can be used in the equation:
-
- :PI: the number pi
- :E: the number e
- :X / Y: the coordinates of the current sample
- :W / H: width and height of the image
- :SW / SH: width/height scale depending on the currently filtered plane,
- e.g. 1,1 and 0.5,0.5 for YUV 4:2:0.
- :p(x,y): returns the value of the pixel at location x/y of the current
- plane.
-
-test
- Generate various test patterns.
-
-rgbtest[=width:height]
- Generate an RGB test pattern useful for detecting RGB vs BGR issues. You
- should see a red, green and blue stripe from top to bottom.
-
- <width>
- Desired width of generated image (default: 0). 0 means width of input
- image.
-
- <height>
- Desired height of generated image (default: 0). 0 means height of
- input image.
-
-lavc[=quality:fps]
- Fast software YV12 to MPEG-1 conversion with libavcodec for use with
- DVB/DXR3/IVTV/V4L2.
-
- <quality>
- :1-31: fixed qscale
- :32-: fixed bitrate in kbits
-
- <fps>
- force output fps (float value) (default: 0, autodetect based on height)
-
-dvbscale[=aspect]
- Set up optimal scaling for DVB cards, scaling the x axis in hardware and
- calculating the y axis scaling in software to keep aspect. Only useful
- together with expand and scale.
-
- <aspect>
- Control aspect ratio, calculate as ``DVB_HEIGHT*ASPECTRATIO`` (default:
- ``576*4/3=768``), set it to ``576*(16/9)=1024`` for a 16:9 TV.
-
- *EXAMPLE*:
-
- ``--vf=dvbscale,scale=-1:0,expand=-1:576:-1:-1:1,lavc``
- FIXME: Explain what this does.
-
noise[=luma[u][t|a][h][p]:chroma[u][t|a][h][p]]
Adds noise.
@@ -528,7 +391,7 @@ noise[=luma[u][t|a][h][p]:chroma[u][t|a][h][p]]
:h: high quality (slightly better looking, slightly slower)
:p: mix random noise with a (semi)regular pattern
-denoise3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]
+hqdn3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]
This filter aims to reduce image noise producing smooth images and making
still images really still (This should enhance compressibility.).
@@ -542,36 +405,10 @@ denoise3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]
chroma temporal strength (default:
``luma_tmp*chroma_spatial/luma_spatial``)
-hqdn3d[=luma_spatial:chroma_spatial:luma_tmp:chroma_tmp]
- High precision/quality version of the denoise3d filter. Parameters and
- usage are the same.
-
-ow[=depth[:luma_strength[:chroma_strength]]]
- Overcomplete Wavelet denoiser.
-
- <depth>
- Larger depth values will denoise lower frequency components more, but
- slow down filtering (default: 8).
- <luma_strength>
- luma strength (default: 1.0)
- <chroma_strength>
- chroma strength (default: 1.0)
-
-eq[=brightness:contrast] (OBSOLETE)
- Software equalizer with interactive controls just like the hardware
- equalizer, for cards/drivers that do not support brightness and contrast
- controls in hardware.
-
- <-100-100>
- initial brightness
- <-100-100>
- initial contrast
-
eq2[=gamma:contrast:brightness:saturation:rg:gg:bg:weight]
- Alternative software equalizer that uses lookup tables (very slow),
+ Software equalizer that uses lookup tables (slow),
allowing gamma correction in addition to simple brightness and contrast
- adjustment. Note that it uses the same MMX optimized code as ``--vf=eq``
- if all gamma values are 1.0. The parameters are given as floating point
+ adjustment. The parameters are given as floating point
values.
<0.1-10>
@@ -595,31 +432,6 @@ eq2[=gamma:contrast:brightness:saturation:rg:gg:bg:weight]
and just plain white. A value of 0.0 turns the gamma correction all
the way down while 1.0 leaves it at its full strength (default: 1.0).
-hue[=hue:saturation]
- Software equalizer with interactive controls just like the hardware
- equalizer, for cards/drivers that do not support hue and saturation
- controls in hardware.
-
- <-180-180>
- initial hue (default: 0.0)
- <-100-100>
- initial saturation, where negative values result in a negative chroma
- (default: 1.0)
-
-halfpack[=f]
- Convert planar YUV 4:2:0 to half-height packed 4:2:2, downsampling luma
- but keeping all chroma samples. Useful for output to low-resolution
- display devices when hardware downscaling is poor quality or is not
- available. Can also be used as a primitive luma-only deinterlacer with
- very low CPU usage.
-
- <f>
- By default, halfpack averages pairs of lines when downsampling. Any
- value different from 0 or 1 gives the default (averaging) behavior.
-
- :0: Only use even lines when downsampling.
- :1: Only use odd lines when downsampling.
-
ilpack[=mode]
When interlaced video is stored in YUV 4:2:0 formats, chroma interlacing
does not line up properly due to vertical downsampling of the chroma
@@ -633,60 +445,6 @@ ilpack[=mode]
:0: nearest-neighbor sampling, fast but incorrect
:1: linear interpolation (default)
-decimate[=max:hi:lo:frac]
- Drops frames that do not differ greatly from the previous frame in order
- to reduce framerate. The main use of this filter is for very-low- bitrate
- encoding (e.g. streaming over dialup modem), but it could in theory be
- used for fixing movies that were inverse-telecined incorrectly.
-
- <max>
- Sets the maximum number of consecutive frames which can be dropped (if
- positive), or the minimum interval between dropped frames (if
- negative).
- <hi>,<lo>,<frac>
- A frame is a candidate for dropping if no 8x8 region differs by more
- than a threshold of <hi>, and if not more than <frac> portion (1
- meaning the whole image) differs by more than a threshold of <lo>.
- Values of <hi> and <lo> are for 8x8 pixel blocks and represent actual
- pixel value differences, so a threshold of 64 corresponds to 1 unit of
- difference for each pixel, or the same spread out differently over the
- block.
-
-dint[=sense:level]
- The drop-deinterlace (dint) filter detects and drops the first from a set
- of interlaced video frames.
-
- <0.0-1.0>
- relative difference between neighboring pixels (default: 0.1)
- <0.0-1.0>
- What part of the image has to be detected as interlaced to drop the
- frame (default: 0.15).
-
-lavcdeint (OBSOLETE)
- FFmpeg deinterlacing filter, same as ``--vf=pp=fd``
-
-kerndeint[=thresh[:map[:order[:sharp[:twoway]]]]]
- Donald Graft's adaptive kernel deinterlacer. Deinterlaces parts of a video
- if a configurable threshold is exceeded.
-
- <0-255>
- threshold (default: 10)
- <map>
- :0: Ignore pixels exceeding the threshold (default).
- :1: Paint pixels exceeding the threshold white.
-
- <order>
- :0: Leave fields alone (default).
- :1: Swap fields.
-
- <sharp>
- :0: Disable additional sharpening (default).
- :1: Enable additional sharpening.
-
- <twoway>
- :0: Disable twoway sharpening (default).
- :1: Enable twoway sharpening.
-
unsharp[=l|cWxH:amount[:l|cWxH:amount]]
unsharp mask / gaussian blur
@@ -710,81 +468,6 @@ unsharp[=l|cWxH:amount[:l|cWxH:amount]]
swapuv
Swap U & V plane.
-il[=d|i][s][:[d|i][s]]
- (De)interleaves lines. The goal of this filter is to add the ability to
- process interlaced images pre-field without deinterlacing them. You can
- filter your interlaced DVD and play it on a TV without breaking the
- interlacing. While deinterlacing (with the postprocessing filter) removes
- interlacing permanently (by smoothing, averaging, etc) deinterleaving
- splits the frame into 2 fields (so called half pictures), so you can
- process (filter) them independently and then re-interleave them.
-
- :d: deinterleave (placing one above the other)
- :i: interleave
- :s: swap fields (exchange even & odd lines)
-
-fil[=i|d]
- (De)interleaves lines. This filter is very similar to the il filter but
- much faster, the main disadvantage is that it does not always work.
- Especially if combined with other filters it may produce randomly messed
- up images, so be happy if it works but do not complain if it does not for
- your combination of filters.
-
- :d: Deinterleave fields, placing them side by side.
- :i: Interleave fields again (reversing the effect of fil=d).
-
-field[=n]
- Extracts a single field from an interlaced image using stride arithmetic
- to avoid wasting CPU time. The optional argument n specifies whether to
- extract the even or the odd field (depending on whether n is even or odd).
-
-detc[=var1=value1:var2=value2:...]
- Attempts to reverse the 'telecine' process to recover a clean,
- non-interlaced stream at film framerate. This was the first and most
- primitive inverse telecine filter to be added to MPlayer. It works by
- latching onto the telecine 3:2 pattern and following it as long as
- possible. This makes it suitable for perfectly-telecined material, even in
- the presence of a fair degree of noise, but it will fail in the presence
- of complex post-telecine edits. Development on this filter is no longer
- taking place, as ivtc, pullup, and filmdint are better for most
- applications. The following arguments (see syntax above) may be used to
- control detc's behavior:
-
- <dr>
- Set the frame dropping mode.
-
- :0: Do not drop frames to maintain fixed output framerate (default).
- :1: Always drop a frame when there have been no drops or telecine
- merges in the past 5 frames.
- :2: Always maintain exact 5:4 input to output frame ratio.
-
- <am>
- Analysis mode.
-
- :0: Fixed pattern with initial frame number specified by <fr>.
- :1: aggressive search for telecine pattern (default)
-
- <fr>
- Set initial frame number in sequence. 0-2 are the three clean
- progressive frames; 3 and 4 are the two interlaced frames. The
- default, -1, means 'not in telecine sequence'. The number specified
- here is the type for the imaginary previous frame before the movie
- starts.
-
- <t0>, <t1>, <t2>, <t3>
- Threshold values to be used in certain modes.
-
-ivtc[=1]
- Experimental 'stateless' inverse telecine filter. Rather than trying to
- lock on to a pattern like the detc filter does, ivtc makes its decisions
- independently for each frame. This will give much better results for
- material that has undergone heavy editing after telecine was applied, but
- as a result it is not as forgiving of noisy input, for example TV capture.
- The optional parameter (ivtc=1) corresponds to the dr=1 option for the
- detc filter, and should not be used with MPlayer. Further development on
- ivtc has stopped, as the pullup and filmdint filters appear to be much
- more accurate.
-
pullup[=jl:jr:jt:jb:sb:mp]
Third-generation pulldown reversal (inverse telecine) filter, capable of
handling mixed hard-telecine, 24000/1001 fps progressive, and 30000/1001
@@ -818,75 +501,6 @@ pullup[=jl:jr:jt:jb:sb:mp]
video. The main purpose of setting mp to a chroma plane is to reduce
CPU load and make pullup usable in realtime on slow machines.
-filmdint[=options]
- Inverse telecine filter, similar to the pullup filter above. It is
- designed to handle any pulldown pattern, including mixed soft and hard
- telecine and limited support for movies that are slowed down or sped up
- from their original framerate for TV. Only the luma plane is used to find
- the frame breaks. If a field has no match, it is deinterlaced with simple
- linear approximation. If the source is MPEG-2, this must be the first
- filter to allow access to the field-flags set by the MPEG-2 decoder.
- Depending on the source MPEG, you may be fine ignoring this advice, as
- long as you do not see lots of "Bottom-first field" warnings. With no
- options it does normal inverse telecine. When this filter is used with
- MPlayer, it will result in an uneven framerate during playback, but it is
- still generally better than using pp=lb or no deinterlacing at all.
- Multiple options can be specified separated by /.
-
- crop=<w>:<h>:<x>:<y>
- Just like the crop filter, but faster, and works on mixed hard and
- soft telecined content as well as when y is not a multiple of 4. If x
- or y would require cropping fractional pixels from the chroma planes,
- the crop area is extended. This usually means that x and y must be
- even.
-
- io=<ifps>:<ofps>
- For each ifps input frames the filter will output ofps frames. This
- could be used to filter movies that are broadcast on TV at a frame
- rate different from their original framerate.
-
- luma_only=<n>
- If n is nonzero, the chroma plane is copied unchanged. This is useful
- for YV12 sampled TV, which discards one of the chroma fields.
-
- mmx2=<n>
- On x86, if n=1, use MMX2 optimized functions, if n=2, use 3DNow!
- optimized functions, otherwise, use plain C. If this option is not
- specified, MMX2 and 3DNow! are auto-detected, use this option to
- override auto-detection.
-
- fast=<n>
- The larger n will speed up the filter at the expense of accuracy. The
- default value is n=3. If n is odd, a frame immediately following a
- frame marked with the REPEAT_FIRST_FIELD MPEG flag is assumed to be
- progressive, thus filter will not spend any time on soft-telecined
- MPEG-2 content. This is the only effect of this flag if MMX2 or 3DNow!
- is available. Without MMX2 and 3DNow, if n=0 or 1, the same
- calculations will be used as with n=2 or 3. If n=2 or 3, the number of
- luma levels used to find the frame breaks is reduced from 256 to 128,
- which results in a faster filter without losing much accuracy. If n=4
- or 5, a faster, but much less accurate metric will be used to find the
- frame breaks, which is more likely to misdetect high vertical detail
- as interlaced content.
-
- verbose=<n>
- If n is nonzero, print the detailed metrics for each frame. Useful for
- debugging.
-
- dint_thres=<n>
- Deinterlace threshold. Used during de-interlacing of unmatched frames.
- Larger value means less deinterlacing, use n=256 to completely turn
- off deinterlacing. Default is n=8.
-
- comb_thres=<n>
- Threshold for comparing a top and bottom fields. Defaults to 128.
-
- diff_thres=<n>
- Threshold to detect temporal change of a field. Default is 128.
-
- sad_thres=<n>
- Sum of Absolute Difference threshold, default is 64.
-
divtc[=options]
Inverse telecine for deinterlaced video. If 3:2-pulldown telecined video
has lost one of the fields or is deinterlaced using a method that keeps
@@ -1002,49 +616,6 @@ phase[=t|b|p|a|u|T|B|A|U][:v]
average squared difference between fields for t, b, and p
alternatives.
-telecine[=start]
- Apply 3:2 'telecine' process to increase framerate by 20%. This most
- likely will not work correctly with MPlayer. The optional start parameter
- tells the filter where in the telecine pattern to start (0-3).
-
-tinterlace[=mode]
- Temporal field interlacing - merge pairs of frames into an interlaced
- frame, halving the framerate. Even frames are moved into the upper field,
- odd frames to the lower field. This can be used to fully reverse the
- effect of the tfields filter (in mode 0). Available modes are:
-
- :0: Move odd frames into the upper field, even into the lower field,
- generating a full-height frame at half framerate.
- :1: Only output odd frames, even frames are dropped; height unchanged.
- :2: Only output even frames, odd frames are dropped; height unchanged.
- :3: Expand each frame to full height, but pad alternate lines with black;
- framerate unchanged.
- :4: Interleave even lines from even frames with odd lines from odd frames.
- Height unchanged at half framerate.
-
-tfields[=mode[:field_dominance]]
- Temporal field separation - split fields into frames, doubling the output
- framerate.
-
- <mode>
- :0: Leave fields unchanged (will jump/flicker).
- :1: Interpolate missing lines. (The algorithm used might not be so
- good.)
- :2: Translate fields by 1/4 pixel with linear interpolation (no jump).
- :4: Translate fields by 1/4 pixel with 4tap filter (higher quality)
- (default).
-
- <field_dominance> (DEPRECATED)
- :-1: auto (default) Only works if the decoder exports the appropriate
- information and no other filters which discard that information
- come before tfields in the filter chain, otherwise it falls back
- to 0 (top field first).
- :0: top field first
- :1: bottom field first
-
- *NOTE*: This option will possibly be removed in a future version. Use
- ``--field-dominance`` instead.
-
yadif=[mode[:field_dominance]]
Yet another deinterlacing filter
@@ -1060,66 +631,6 @@ yadif=[mode[:field_dominance]]
*NOTE*: This option will possibly be removed in a future version. Use
``--field-dominance`` instead.
-mcdeint=[mode[:parity[:qp]]]
- Motion compensating deinterlacer. It needs one field per frame as input
- and must thus be used together with tfields=1 or yadif=1/3 or equivalent.
-
- <mode>
- :0: fast
- :1: medium
- :2: slow, iterative motion estimation
- :3: extra slow, like 2 plus multiple reference frames
-
- <parity>
- 0 or 1 selects which field to use (note: no autodetection yet!).
-
- <qp>
- Higher values should result in a smoother motion vector field but less
- optimal individual vectors.
-
-boxblur=radius:power[:radius:power]
- box blur
-
- <radius>
- blur filter strength
- <power>
- number of filter applications
-
-sab=radius:pf:colorDiff[:radius:pf:colorDiff]
- shape adaptive blur
-
- <radius>
- blur filter strength (~0.1-4.0) (slower if larger)
- <pf>
- prefilter strength (~0.1-2.0)
- <colorDiff>
- maximum difference between pixels to still be considered (~0.1-100.0)
-
-smartblur=radius:strength:threshold[:radius:strength:threshold]
- smart blur
-
- <radius>
- blur filter strength (~0.1-5.0) (slower if larger)
- <strength>
- blur (0.0-1.0) or sharpen (-1.0-0.0)
- <threshold>
- filter all (0), filter flat areas (0-30) or filter edges (-30-0)
-
-perspective=x0:y0:x1:y1:x2:y2:x3:y3:t
- Correct the perspective of movies not filmed perpendicular to the screen.
-
- <x0>,<y0>,...
- coordinates of the top left, top right, bottom left, bottom right
- corners
- <t>
- linear (0) or cubic resampling (1)
-
-2xsai
- Scale and smooth the image with the 2x scale and interpolate algorithm.
-
-1bpp
- 1bpp bitmap to YUV/BGR 8/15/16/32 conversion
-
down3dright[=lines]
Reposition and resize stereoscopic images. Extracts both stereo fields and
places them side by side, resizing them to maintain the original movie
@@ -1128,108 +639,6 @@ down3dright[=lines]
<lines>
number of lines to select from the middle of the image (default: 12)
-bmovl=hidden:opaque:fifo
- The bitmap overlay filter reads bitmaps from a FIFO and displays them on
- top of the movie, allowing some transformations on the image. See also
- ``TOOLS/bmovl-test.c`` for a small bmovl test program.
-
- <hidden>
- Set the default value of the 'hidden' flag (0=visible, 1=hidden).
- <opaque>
- Set the default value of the 'opaque' flag (0=transparent, 1=opaque).
- <fifo>
- path/filename for the FIFO (named pipe connecting ``mplayer
- --vf=bmovl`` to the controlling application)
-
- FIFO commands are:
-
- RGBA32 width height xpos ypos alpha clear
- followed by width*height*4 Bytes of raw RGBA32 data.
- ABGR32 width height xpos ypos alpha clear
- followed by width*height*4 Bytes of raw ABGR32 data.
- RGB24 width height xpos ypos alpha clear
- followed by width*height*3 Bytes of raw RGB24 data.
- BGR24 width height xpos ypos alpha clear
- followed by width*height*3 Bytes of raw BGR24 data.
- ALPHA width height xpos ypos alpha
- Change alpha transparency of the specified area.
- CLEAR width height xpos ypos
- Clear area.
- OPAQUE
- Disable all alpha transparency. Send "ALPHA 0 0 0 0 0" to enable it
- again.
- HIDE
- Hide bitmap.
- SHOW
- Show bitmap.
-
- Arguments are:
-
- <width>, <height>
- image/area size
- <xpos>, <ypos>
- Start blitting at position x/y.
- <alpha>
- Set alpha difference. If you set this to -255 you can then send a
- sequence of ALPHA-commands to set the area to -225, -200, -175 etc for
- a nice fade-in-effect! ;)
-
- :0: same as original
- :255: Make everything opaque.
- :-255: Make everything transparent.
-
- <clear>
- Clear the framebuffer before blitting.
-
- :0: The image will just be blitted on top of the old one, so you do
- not need to send 1.8MB of RGBA32 data every time a small part of
- the screen is updated.
- :1: clear
-
-framestep=I|[i]step
- Renders only every nth frame or every intra frame (keyframe).
-
- If you call the filter with I (uppercase) as the parameter, then *only*
- keyframes are rendered. For DVDs it generally means one in every 15/12
- frames (IBBPBBPBBPBBPBB), for AVI it means every scene change or every
- keyint value.
-
- When a keyframe is found, an 'I!' string followed by a newline character
- is printed, leaving the current line of MPlayer output on the screen,
- because it contains the time (in seconds) and frame number of the keyframe
- (You can use this information to split the AVI.).
-
- If you call the filter with a numeric parameter 'step' then only one in
- every 'step' frames is rendered.
-
- If you put an 'i' (lowercase) before the number then an 'I!' is printed
- (like the I parameter).
-
- If you give only the i then nothing is done to the frames, only I! is
- printed.
-
-tile=xtiles:ytiles:output:start:delta
- Tile a series of images into a single, bigger image. If you omit a
- parameter or use a value less than 0, then the default value is used. You
- can also stop when you are satisfied (``... --vf=tile=10:5 ...``). It is
- probably a good idea to put the scale filter before the tile :-)
-
- The parameters are:
-
- <xtiles>
- number of tiles on the x axis (default: 5)
- <ytiles>
- number of tiles on the y axis (default: 5)
- <output>
- Render the tile when 'output' number of frames are reached, where
- 'output' should be a number less than xtile * ytile. Missing tiles are
- left blank. You could, for example, write an 8 * 7 tile every 50
- frames to have one image every 2 seconds @ 25 fps.
- <start>
- outer border thickness in pixels (default: 2)
- <delta>
- inner border thickness in pixels (default: 4)
-
delogo[=x:y:w:h:t]
Suppresses a TV station logo by a simple interpolation of the surrounding
pixels. Just set a rectangle covering the logo and watch it disappear (and
@@ -1248,15 +657,6 @@ delogo[=x:y:w:h:t]
must have a timestamp (in seconds, and in ascending order) and the
"x:y:w:h:t" coordinates (*t* can be omitted).
-remove-logo=/path/to/logo_bitmap_file_name.pgm
- Suppresses a TV station logo, using a PGM or PPM image file to determine
- which pixels comprise the logo. The width and height of the image file
- must match those of the video stream being processed. Uses the filter
- image and a circular blur algorithm to remove the logo.
-
- ``/path/to/logo_bitmap_file_name.pgm``
- [path] + filename of the filter image.
-
screenshot
Optional filter for screenshot support. This is only needed if the video
output doesn't provide working direct screenshot support. Note that it is
@@ -1275,19 +675,6 @@ ass
subtitle colors and video under the influence of the video equalizer
settings.
-blackframe[=amount:threshold]
- Detect frames that are (almost) completely black. Can be useful to detect
- chapter transitions or commercials. Output lines consist of the frame
- number of the detected frame, the percentage of blackness, the frame type
- and the frame number of the last encountered keyframe.
-
- <amount>
- Percentage of the pixels that have to be below the threshold (default:
- 98).
-
- <threshold>
- Threshold below which a pixel value is considered black (default: 32).
-
stereo3d[=in:out]
Stereo3d converts between different stereoscopic image formats.
@@ -1373,39 +760,6 @@ gradfun[=strength[:radius]]
gradients, but also prevents the filter from modifying pixels near
detailed regions (default: 16).
-fixpts[=options]
- Fixes the presentation timestamps (PTS) of the frames. By default, the PTS
- passed to the next filter is dropped, but the following options can change
- that:
-
- print
- Print the incoming PTS.
-
- fps=<fps>
- Specify a frame per second value.
-
- start=<pts>
- Specify an initial value for the PTS.
-
- autostart=<n>
- Uses the *n*\th incoming PTS as the initial PTS. All previous PTS are
- kept, so setting a huge value or -1 keeps the PTS intact.
-
- autofps=<n>
- Uses the *n*\th incoming PTS after the end of autostart to determine
- the framerate.
-
- *EXAMPLE*:
-
- ``--vf=fixpts=fps=24000/1001,ass,fixpts``
- Generates a new sequence of PTS, uses it for ASS subtitles, then drops
- it. Generating a new sequence is useful when the timestamps are reset
- during the program; this is frequent on DVDs. Dropping it may be
- necessary to avoid confusing encoders.
-
- *NOTE*: Using this filter together with any sort of seeking (including
- ``--ss``) may make demons fly out of your nose.
-
dlopen=dll[:a0[:a1[:a2[:a3]]]]
Loads an external library to filter the image. The library interface
is the vf_dlopen interface specified using libmpcodecs/vf_dlopen.h.
diff --git a/DOCS/man/en/vo.rst b/DOCS/man/en/vo.rst
index 0ba7fe8b9f..6248073944 100644
--- a/DOCS/man/en/vo.rst
+++ b/DOCS/man/en/vo.rst
@@ -9,15 +9,15 @@ syntax is:
--vo=<driver1[:suboption1[=value]:...],driver2,...[,]>
Specify a priority list of video output drivers to be used.
-If the list has a trailing ',' MPlayer will fall back on drivers not contained
+If the list has a trailing ',' mpv will fall back on drivers not contained
in the list. Suboptions are optional and can mostly be omitted.
*NOTE*: See ``--vo=help`` for a list of compiled-in video output drivers.
*EXAMPLE*:
- ``--vo=gl,xv,``
- Try the gl driver, then the Xv driver, then others.
+ ``--vo=opengl,xv,``
+ Try the OpenGL driver, then the Xv driver, then others.
Available video output drivers are:
@@ -26,7 +26,7 @@ xv (X11 only)
the most compatible VO on X, but may be low quality, and has issues with
OSD and subtitle display.
For information about what colorkey is used and how it is drawn run
- MPlayer with ``-v`` option and look out for the lines tagged with ``[xv
+ mpv with ``-v`` option and look out for the lines tagged with ``[xv
common]`` at the beginning.
adaptor=<number>
@@ -39,7 +39,7 @@ xv (X11 only)
cur
The default takes the colorkey currently set in Xv.
use
- Use but do not set the colorkey from MPlayer (use the ``--colorkey``
+ Use but do not set the colorkey from mpv (use the ``--colorkey``
option to change it).
set
Same as use but also sets the supplied colorkey.
@@ -128,8 +128,8 @@ vdpau (X11 only)
3). See below for additional information.
Using the VDPAU frame queueing functionality controlled by the queuetime
- options makes MPlayer's frame flip timing less sensitive to system CPU
- load and allows MPlayer to start decoding the next frame(s) slightly
+ options makes mpv's frame flip timing less sensitive to system CPU
+ load and allows mpv to start decoding the next frame(s) slightly
earlier which can reduce jitter caused by individual slow-to-decode
frames. However the NVIDIA graphics drivers can make other window behavior
such as window moves choppy if VDPAU is using the blit queue (mainly
@@ -225,11 +225,247 @@ direct3d (Windows only)
corevideo (Mac OS X 10.6 and later)
Mac OS X CoreVideo video output driver. Uses the CoreVideo APIs to fill
PixelBuffers and generate OpenGL textures from them (useful as a fallback
- for vo_gl_).
+ for vo_opengl_).
-.. _vo_gl:
-gl
- OpenGL video output driver, simple version. Video size must be smaller
+.. _vo_opengl:
+
+opengl
+ OpenGL video output driver. It supports extended scaling methods, dithering
+ and color management.
+
+ By default, it tries to use fast and fail-safe settings. Use the driver
+ ``opengl-hq`` to use this driver with a high quality rendering preset.
+
+ Requires at least OpenGL 2.1 and the GL_ARB_texture_rg extension. For older
+ drivers, ``opengl-old`` may work.
+
+ Some features are available with OpenGL 3 capable graphics drivers only
+ (or if the necessary extensions are available).
+
+ lscale=<filter>
+ Set the scaling filter. Possible choices:
+ bilinear
+ bicubic_fast
+ sharpen3
+ sharpen5
+ hanning
+ hamming
+ hermite
+ quadric
+ bicubic
+ kaiser
+ catmull_rom
+ mitchell
+ spline16
+ spline36
+ gaussian
+ sinc2
+ sinc3
+ sinc4
+ lanczos2
+ lanczos3
+ lanczos4
+ blackman2
+ blackman3
+ blackman4
+
+ bilinear
+ Bilinear hardware texture filtering (fastest, mid-quality).
+ This is the default.
+
+ lanczos2
+ Lanczos scaling with radius=2. Provides good quality and speed.
+ This is the default when using ``opengl-hq``.
+
+ lanczos3
+ Lanczos with radius=3.
+
+ bicubic_fast
+ Bicubic filter. Has a blurring effect on the image, even if no
+ scaling is done.
+
+ sharpen3
+ Unsharp masking (sharpening) with radius=3 and a default strength
+ of 0.5 (see ``lparam1``).
+
+ sharpen5
+ Unsharp masking (sharpening) with radius=5 and a default strength
+ of 0.5 (see ``lparam1``).
+
+ mitchell
+ Mitchell-Netravali. The ``b`` and ``c`` parameters can be set with
+ ``lparam1`` and ``lparam2``. Both are set to 1/3 by default.
+
+ lparam1=<value>
+ Set filter parameters. Ignored if the filter is not tunable. These are
+ unset by default, and use the filter specific default if applicable.
+
+ lparam2=<value>
+ See ``lparam1``.
+
+ osdcolor=<0xAARRGGBB>
+ Use the given color for the OSD.
+
+ stereo=<value>
+ Select a method for stereo display. You may have to use ``--aspect`` to
+ fix the aspect value. Experimental, do not expect too much from it.
+
+ 0
+ Normal 2D display
+ 1
+ Convert side by side input to full-color red-cyan stereo.
+ 2
+ Convert side by side input to full-color green-magenta stereo.
+ 3
+ Convert side by side input to quadbuffered stereo. Only supported
+ by very few OpenGL cards.
+
+ srgb
+ Enable gamma-correct scaling by working in linear light. This
+ makes use of sRGB textures and framebuffers.
+ This option forces the options 'indirect' and 'gamma'.
+ NOTE: for YUV colorspaces, gamma 2.2 is assumed. RGB input is always
+ assumed to be in sRGB.
+ This option is not really useful, as gamma-correct scaling has not much
+ influence on typical video playback.
+
+ pbo
+ Enable use of PBOs. This is faster, but can sometimes lead to
+ sporadic and temporary image corruption.
+
+ dither-depth=<n>
+ Positive non-zero values select the target bit depth. Default: 0.
+
+ \-1
+ Disable any dithering done by mpv.
+ 0
+ Automatic selection. If output bit depth can't be detected,
+ 8 bits per component are assumed.
+ 8
+ Dither to 8 bit output.
+
+ Note that dithering will always be disabled if the bit depth
+ of the video is lower or equal to the detected dither-depth.
+ If color management is enabled, input depth is assumed to be
+ 16 bits, because the 3D LUT output is 16 bit wide.
+
+ Note that the depth of the connected video display device can not be
+ detected. Often, LCD panels will do dithering on their own, which
+ conflicts with vo_opengl's dithering, and leads to ugly output.
+
+ debug
+ Check for OpenGL errors, i.e. call glGetError(). Also request a
+ debug OpenGL context (which does nothing with current graphics drivers
+ as of this writing).
+
+
+ swapinterval=<n>
+ Interval in displayed frames between two buffer swaps.
+ 1 is equivalent to enable VSYNC, 0 to disable VSYNC.
+
+ no-scale-sep
+ When using a separable scale filter for luma, usually two filter
+ passes are done. This is often faster. However, it forces
+ conversion to RGB in an extra pass, so it can actually be slower
+ if used with fast filters on small screen resolutions. Using
+ this options will make rendering a single operation.
+ Note that chroma scalers are always done as 1-pass filters.
+
+ cscale=<n>
+ As lscale but for chroma (2x slower with little visible effect).
+ Note that with some scaling filters, upscaling is always done in
+ RGB. If chroma is not subsampled, this option is ignored, and the
+ luma scaler is used instead. Setting this option is often useless.
+
+ fancy-downscaling
+ When using convolution based filters, extend the filter size
+ when downscaling. Trades quality for reduced downscaling performance.
+
+ no-npot
+ Force use of power-of-2 texture sizes. For debugging only.
+ Borders will be distorted due to filtering.
+
+ glfinish
+ Call glFinish() before swapping buffers
+
+ sw
+ Continue even if a software renderer is detected.
+
+ backend=<sys>
+ auto
+ auto-select (default)
+ cocoa
+ Cocoa/OSX
+ win
+ Win32/WGL
+ x11
+ X11/GLX
+
+ indirect
+ Do YUV conversion and scaling as separate passes. This will
+ first render the video into a video-sized RGB texture, and
+ draw the result on screen. The luma scaler is used to scale
+ the RGB image when rendering to screen. The chroma scaler
+ is used only on YUV conversion, and only if the video uses
+ chroma-subsampling.
+ This mechanism is disabled on RGB input.
+ Specifying this option directly is generally useful for debugging only.
+
+ fbo-format=<fmt>
+ Selects the internal format of textures used for FBOs. The format can
+ influence performance and quality of the video output. (FBOs are not
+ always used, and typically only when using extended scalers.)
+ fmt can be one of: rgb, rgba, rgb8, rgb10, rgb16, rgb16f, rgb32f
+ Default: rgb.
+
+ gamma
+ Always enable gamma control. (Disables delayed enabling.)
+
+ icc-profile=<file>
+ Load an ICC profile and use it to transform linear RGB to
+ screen output. Needs LittleCMS2 support compiled in.
+
+ icc-cache=<file>
+ Store and load the 3D LUT created from the ICC profile in
+ this file. This can be used to speed up loading, since
+ LittleCMS2 can take a while to create the 3D LUT.
+ Note that this file contains an uncompressed LUT. Its size depends on
+ the ``3dlut-size``, and can be very big.
+
+ icc-intent=<value>
+ 0
+ perceptual
+ 1
+ relative colorimetric
+ 2
+ saturation
+ 3
+ absolute colorimetric (default)
+
+ 3dlut-size=<r>x<g>x<b>
+ Size of the 3D LUT generated from the ICC profile in each
+ dimension. Default is 128x256x64.
+ Sizes must be a power of two, and 256 at most.
+
+opengl-hq
+ Same as ``opengl``, but with default settings for high quality rendering.
+
+ This is equivalent to:
+
+ | --vo=opengl:lscale=lanczos2:fancy-downscaling:dither-depth=0:pbo:fbo-format=rgb16
+
+ Note that some cheaper LCDs do dithering that gravely interferes with
+ vo_opengl's dithering. Disabling dithering with ``dither-depth=-1`` helps.
+
+ Unlike ``opengl``, ``opengl-hq`` makes use of FBOs by default. Sometimes you
+ can achieve better quality or performance by changing the fbo-format
+ sub-option to ``rgb16f``, ``rgb32f`` or ``rgb``. (Known problems include
+ Mesa/Intel not accepting ``rgb16``, Mesa sometimes not being compiled with
+ float texture support, and some OSX setups being very slow with ``rgb16``,
+ but fast with ``rgb32f``.)
+
+opengl-old
+ OpenGL video output driver, old version. Video size must be smaller
than the maximum texture size of your OpenGL implementation. Intended to
work even with the most basic OpenGL implementations, but also makes use
of newer extensions, which allow support for more colorspaces and direct
@@ -411,173 +647,10 @@ gl
(no-)osd
Enable or disable support for OSD rendering via OpenGL (default:
enabled). This option is for testing; to disable the OSD use
- ``--osdlevel=0`` instead.
+ ``--osd-level=0`` instead.
- backend=<sys>
- auto
- auto-select (default)
- cocoa
- Cocoa/OSX
- win
- Win32/WGL
- x11
- X11/GLX
-
-gl3
- OpenGL video output driver, extended version. The requires an OpenGL 3
- capable graphics driver. (Note: this is only because of developer pedantry.
- The dependency on actual OpenGL 3 features is rather low.)
-
- It supports extended scaling methods, dithering and color management.
- It tries to use sane defaults for good quality output.
-
- Note that some cheaper LCDs do dithering that gravely interferes with
- vo_gl3's dithering. Disabling dithering with ``dither-depth=-1`` helps.
-
- lscale=<filter>
- Set the scaling filter. Possible choices:
- bilinear
- bicubic_fast
- sharpen3
- sharpen5
- hanning
- hamming
- hermite
- quadric
- bicubic
- kaiser
- catmull_rom
- mitchell
- spline16
- spline36
- gaussian
- sinc2
- sinc3
- sinc4
- lanczos2
- lanczos3
- lanczos4
- blackman2
- blackman3
- blackman4
-
- bilinear
- Bilinear hardware texture filtering (fastest, mid-quality).
-
- lanczos2
- Lanczos scaling with radius=2. Provides a good quality and speed.
- This is the default.
-
- lanczos3
- Lanczos with radius=3.
-
- bicubic_fast
- Bicubic filter. Has a blurring effect on the image, even if no
- scaling is done.
-
- sharpen3
- Unsharp masking (sharpening) with radius=3 and a default strength
- of 0.5 (see ``lparam1``).
-
- sharpen5
- Unsharp masking (sharpening) with radius=5 and a default strength
- of 0.5 (see ``lparam1``).
-
- mitchell
- Mitchell-Netravali. The ``b`` and ``c`` parameters can be set with
- ``lparam1`` and ``lparam2``. Both are set to 1/3 by default.
-
- lparam1=<value>
- Set filter parameters. Ignored if the filter is not tunable. These are
- unset by default, and use the filter specific default if applicable.
-
- lparam2=<value>
- See ``lparam1``.
-
- osdcolor=<0xAARRGGBB>
- Use the given color for the OSD.
-
- stereo=<value>
- Select a method for stereo display. You may have to use ``--aspect`` to
- fix the aspect value. Experimental, do not expect too much from it.
-
- 0
- Normal 2D display
- 1
- Convert side by side input to full-color red-cyan stereo.
- 2
- Convert side by side input to full-color green-magenta stereo.
- 3
- Convert side by side input to quadbuffered stereo. Only supported
- by very few OpenGL cards.
-
- srgb
- Enable gamma-correct scaling by working in linear light. This
- makes use of sRGB textures and framebuffers.
- This option forces the options 'indirect' and 'gamma'.
- NOTE: for BT.709 colorspaces, a gamma of 2.35 is assumed. For
- other YUV colorspaces, 2.2 is assumed. RGB input is always
- assumed to be in sRGB.
-
- pbo
- Enable use of PBOs. This is faster, but can sometimes lead to
- sporadic and temporary image corruption.
-
- dither-depth=<n>
- Positive non-zero values select the target bit depth. Default: 0.
-
- \-1
- Disable any dithering done by mplayer.
- 0
- Automatic selection. If output bit depth can't be detected,
- 8 bits per component are assumed.
- 8
- Dither to 8 bit output.
-
- Note that dithering will always be disabled if the bit depth
- of the video is lower or equal to the detected dither-depth.
- If color management is enabled, input depth is assumed to be
- 16 bits, because the 3D LUT output is 16 bit wide.
-
- Note that the depth of the connected video display device can not be
- detected. Often, LCD panels will do dithering on their own, which
- conflicts with vo_gl3's dithering, and leads to ugly output.
-
- debug
- Check for OpenGL errors, i.e. call glGetError(). Also request a
- debug OpenGL context (which does nothing with current graphics drivers
- as of this writing).
-
-
- swapinterval=<n>
- Interval in displayed frames between two buffer swaps.
- 1 is equivalent to enable VSYNC, 0 to disable VSYNC.
-
- no-scale-sep
- When using a separable scale filter for luma, usually two filter
- passes are done. This is often faster. However, it forces
- conversion to RGB in an extra pass, so it can actually be slower
- if used with fast filters on small screen resolutions. Using
- this options will make rendering a single operation.
- Note that chroma scalers are always done as 1-pass filters.
-
- cscale=<n>
- As lscale but for chroma (2x slower with little visible effect).
- Note that with some scaling filters, upscaling is always done in
- RGB. If chroma is not subsampled, this option is ignored, and the
- luma scaler is used instead. Setting this option is often useless.
-
- no-fancy-downscaling
- When using convolution based filters, don't extend the filter
- size when downscaling. Trades downscaling performance for
- reduced quality.
-
- no-npot
- Force use of power-of-2 texture sizes. For debugging only.
- Borders will be distorted due to filtering.
-
- glfinish
- Call glFinish() before swapping buffers
+ sw
+ Continue even if a software renderer is detected.
backend=<sys>
auto
@@ -589,53 +662,6 @@ gl3
x11
X11/GLX
- indirect
- Do YUV conversion and scaling as separate passes. This will
- first render the video into a video-sized RGB texture, and
- draw the result on screen. The luma scaler is used to scale
- the RGB image when rendering to screen. The chroma scaler
- is used only on YUV conversion, and only if the video uses
- chroma-subsampling.
- This mechanism is disabled on RGB input.
-
- fbo-format=<fmt>
- Selects the internal format of any FBO textures used.
- fmt can be one of: rgb, rgba, rgb8, rgb16, rgb16f, rgb32f
- Default: rgb16.
-
- gamma
- Always enable gamma control. (Disables delayed enabling.)
-
- force-gl2
- Create a legacy GL context. This will randomly malfunction
- if the proper extensions are not supported.
-
- icc-profile=<file>
- Load an ICC profile and use it to transform linear RGB to
- screen output. Needs LittleCMS2 support compiled in.
-
- icc-cache=<file>
- Store and load the 3D LUT created from the ICC profile in
- this file. This can be used to speed up loading, since
- LittleCMS2 can take a while to create the 3D LUT.
- Note that this file contains an uncompressed LUT. Its size depends on
- the ``3dlut-size``, can become very big.
-
- icc-intent=<value>
- 0
- perceptual
- 1
- relative colorimetric
- 2
- saturation
- 3
- absolute colorimetric (default)
-
- 3dlut-size=<r>x<g>x<b>
- Size of the 3D LUT generated from the ICC profile in each
- dimension. Default is 128x256x64.
- Sizes must be a power of two, and 256 at most.
-
null
Produces no video output. Useful for benchmarking.
diff --git a/DOCS/tech-overview.txt b/DOCS/tech-overview.txt
index 7faffec616..9ffe891c5c 100644
--- a/DOCS/tech-overview.txt
+++ b/DOCS/tech-overview.txt
@@ -1,6 +1,6 @@
NOTE: DOCS/OUTDATED-tech/* may contain more detailed information, but most of it
is possibly or definitely outdated. This file intends to give a big
- picture of how mplayer is structured.
+ picture of how mplayer/mpv is structured.
mplayer.c:
This contains the main play loop, anything related to mplayer and playback
@@ -65,8 +65,8 @@ talloc.h & talloc.c:
One very useful feature of talloc is fast tracking of memory leaks. ("Fast"
as in it doesn't require valgrind.) You can enable it by passing the option
--leak-report as first parameter, or better, setting the
- MPLAYER_LEAK_REPORT environment variable to "1":
- export MPLAYER_LEAK_REPORT=1
+ MPV_LEAK_REPORT environment variable to "1":
+ export MPV_LEAK_REPORT=1
This will list all unfree'd allocations on exit.
Documentation can be found here:
@@ -160,13 +160,13 @@ libvo/:
Video output. They also create GUI windows and handle user input. In most
cases, the windowing code is shared among VOs, like x11_common.c for X11 and
w32_common.c for Windows. The VOs stand between frontend and windowing code.
- vo_gl can pick a windowing system at runtime, e.g. the same binary can
+ vo_opengl can pick a windowing system at runtime, e.g. the same binary can
provide both X11 and Cocoa support on OSX.
VOs can be reconfigured at runtime. A config() call can change the video
resolution and format, without destroying the window.
- vo_vdpau and vo_gl3 should be taken as reference.
+ vo_vdpau and vo_opengl should be taken as reference.
libaf/:
Audio filter chain. format.h/format.c define the audio formats.
diff --git a/Makefile b/Makefile
index 1bfccf04ea..ce1a369f77 100644
--- a/Makefile
+++ b/Makefile
@@ -34,13 +34,8 @@ SRCS_COMMON-$(DVBIN) += stream/dvb_tune.c \
SRCS_COMMON-$(DVDREAD) += stream/stream_dvd.c \
stream/stream_dvd_common.c
-# These filters use private headers and do not work with shared libavcodec.
-SRCS_COMMON-$(FFMPEG_INTERNALS) += libmpcodecs/vf_mcdeint.c \
- libmpcodecs/vf_spp.c \
-
SRCS_COMMON-$(FTP) += stream/stream_ftp.c
SRCS_COMMON-$(GIF) += libmpdemux/demux_gif.c
-SRCS_COMMON-$(HAVE_POSIX_SELECT) += libmpcodecs/vf_bmovl.c
SRCS_COMMON-$(HAVE_SYS_MMAN_H) += libaf/af_export.c osdep/mmap_anon.c
SRCS_COMMON-$(LADSPA) += libaf/af_ladspa.c
SRCS_COMMON-$(LIBASS) += libmpcodecs/vf_ass.c \
@@ -152,77 +147,33 @@ SRCS_COMMON = asxparser.c \
libmpcodecs/vd.c \
libmpcodecs/vd_ffmpeg.c \
libmpcodecs/vf.c \
- libmpcodecs/vf_1bpp.c \
- libmpcodecs/vf_2xsai.c \
- libmpcodecs/vf_blackframe.c \
- libmpcodecs/vf_boxblur.c \
libmpcodecs/vf_crop.c \
- libmpcodecs/vf_cropdetect.c \
- libmpcodecs/vf_decimate.c \
libmpcodecs/vf_delogo.c \
- libmpcodecs/vf_denoise3d.c \
- libmpcodecs/vf_detc.c \
- libmpcodecs/vf_dint.c \
libmpcodecs/vf_divtc.c \
libmpcodecs/vf_dlopen.c \
libmpcodecs/vf_down3dright.c \
libmpcodecs/vf_dsize.c \
- libmpcodecs/vf_dvbscale.c \
- libmpcodecs/vf_eq.c \
libmpcodecs/vf_eq2.c \
libmpcodecs/vf_expand.c \
- libmpcodecs/vf_field.c \
- libmpcodecs/vf_fil.c \
- libmpcodecs/vf_filmdint.c \
- libmpcodecs/vf_fixpts.c \
libmpcodecs/vf_flip.c \
libmpcodecs/vf_format.c \
- libmpcodecs/vf_framestep.c \
- libmpcodecs/vf_fspp.c \
- libmpcodecs/vf_geq.c \
libmpcodecs/vf_gradfun.c \
- libmpcodecs/vf_halfpack.c \
- libmpcodecs/vf_harddup.c \
libmpcodecs/vf_hqdn3d.c \
- libmpcodecs/vf_hue.c \
- libmpcodecs/vf_il.c \
libmpcodecs/vf_ilpack.c \
- libmpcodecs/vf_ivtc.c \
- libmpcodecs/vf_kerndeint.c \
- libmpcodecs/vf_lavc.c \
- libmpcodecs/vf_lavcdeint.c \
libmpcodecs/vf_mirror.c \
libmpcodecs/vf_noformat.c \
libmpcodecs/vf_noise.c \
- libmpcodecs/vf_ow.c \
- libmpcodecs/vf_palette.c \
- libmpcodecs/vf_perspective.c \
libmpcodecs/vf_phase.c \
- libmpcodecs/vf_pp7.c \
libmpcodecs/vf_pullup.c \
- libmpcodecs/vf_qp.c \
- libmpcodecs/vf_remove_logo.c \
- libmpcodecs/vf_rgbtest.c \
libmpcodecs/vf_rotate.c \
- libmpcodecs/vf_sab.c \
libmpcodecs/vf_scale.c \
libmpcodecs/vf_screenshot.c \
- libmpcodecs/vf_smartblur.c \
libmpcodecs/vf_softpulldown.c \
libmpcodecs/vf_stereo3d.c \
- libmpcodecs/vf_softskip.c \
libmpcodecs/vf_swapuv.c \
- libmpcodecs/vf_telecine.c \
- libmpcodecs/vf_test.c \
- libmpcodecs/vf_tfields.c \
- libmpcodecs/vf_tile.c \
- libmpcodecs/vf_tinterlace.c \
libmpcodecs/vf_unsharp.c \
- libmpcodecs/vf_uspp.c \
libmpcodecs/vf_vo.c \
libmpcodecs/vf_yadif.c \
- libmpcodecs/vf_yuvcsp.c \
- libmpcodecs/vf_yvu9.c \
libmpdemux/asfheader.c \
libmpdemux/aviheader.c \
libmpdemux/aviprint.c \
@@ -252,7 +203,6 @@ SRCS_COMMON = asxparser.c \
osdep/io.c \
osdep/$(GETCH) \
osdep/$(TIMER) \
- stream/open.c \
stream/stream.c \
stream/stream_ffmpeg.c \
stream/stream_file.c \
@@ -282,14 +232,16 @@ SRCS_MPLAYER-$(CACA) += libvo/vo_caca.c
SRCS_MPLAYER-$(COREAUDIO) += libao2/ao_coreaudio.c
SRCS_MPLAYER-$(COREVIDEO) += libvo/vo_corevideo.m
SRCS_MPLAYER-$(DIRECT3D) += libvo/vo_direct3d.c libvo/w32_common.c
-SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_gl.c libvo/vo_gl3.c \
- pnm_loader.c libvo/gl_osd.c
+SRCS_MPLAYER-$(DSOUND) += libao2/ao_dsound.c
+SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_opengl.c \
+ libvo/gl_osd.c libvo/vo_opengl_old.c pnm_loader.c
SRCS_MPLAYER-$(ENCODING) += libvo/vo_lavc.c libao2/ao_lavc.c encode_lavc.c
SRCS_MPLAYER-$(GL_WIN32) += libvo/w32_common.c
SRCS_MPLAYER-$(GL_X11) += libvo/x11_common.c
SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c
SRCS_MPLAYER-$(JOYSTICK) += input/joystick.c
+SRCS_MPLAYER-$(LIBQUVI) += quvi.c
SRCS_MPLAYER-$(LIRC) += input/lirc.c
SRCS_MPLAYER-$(OPENAL) += libao2/ao_openal.c
SRCS_MPLAYER-$(OSS) += libao2/ao_oss.c
@@ -332,15 +284,15 @@ OBJS_MPLAYER += $(OBJS_MPLAYER-yes)
MPLAYER_DEPS = $(OBJS_MPLAYER) $(OBJS_COMMON) $(COMMON_LIBS)
DEP_FILES = $(patsubst %.S,%.d,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SRCS_COMMON:.m=.d) $(SRCS_MPLAYER:.m=.d))))
-ALL_PRG-$(MPLAYER) += mplayer$(EXESUF)
+ALL_PRG-$(MPLAYER) += mpv$(EXESUF)
INSTALL_TARGETS-$(MPLAYER) += check_rst2man \
- install-mplayer \
- install-mplayer-man \
- install-mplayer-msg
+ install-mpv \
+ install-mpv-man \
+ install-mpv-msg
-INSTALL_NO_MAN_TARGETS-$(MPLAYER) += install-mplayer \
- install-mplayer-msg
+INSTALL_NO_MAN_TARGETS-$(MPLAYER) += install-mpv \
+ install-mpv-msg
DIRS = . \
input \
@@ -354,7 +306,7 @@ DIRS = . \
sub \
timeline \
-MOFILES := $(MSG_LANGS:%=locale/%/LC_MESSAGES/mplayer.mo)
+MOFILES := $(MSG_LANGS:%=locale/%/LC_MESSAGES/mpv.mo)
ALLHEADERS = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.h))
@@ -391,9 +343,9 @@ all: $(ALL_PRG-yes) locales
%-rc.o: %.rc
$(WINDRES) -I. $< $@
-mplayer$(EXESUF): $(MPLAYER_DEPS)
-mplayer$(EXESUF): EXTRALIBS += $(EXTRALIBS_MPLAYER)
-mplayer$(EXESUF):
+mpv$(EXESUF): $(MPLAYER_DEPS)
+mpv$(EXESUF): EXTRALIBS += $(EXTRALIBS_MPLAYER)
+mpv$(EXESUF):
$(CC) -o $@ $^ $(EXTRALIBS)
codec-cfg.c: codecs.conf.h
@@ -416,8 +368,8 @@ libmpdemux/ebml.c: libmpdemux/ebml_defs.c
libmpdemux/ebml_defs.c: TOOLS/matroska.py
./$< --generate-definitions > $@
-libvo/vo_gl3.c: libvo/vo_gl3_shaders.h
-libvo/vo_gl3_shaders.h: TOOLS/file2string.py libvo/vo_gl3_shaders.glsl
+libvo/vo_opengl.c: libvo/vo_opengl_shaders.h
+libvo/vo_opengl_shaders.h: TOOLS/file2string.py libvo/vo_opengl_shaders.glsl
./$^ >$@
sub/osd_libass.c: sub/osd_font.h
@@ -441,7 +393,7 @@ version.h .version: version.sh
locales: $(MOFILES)
-locale/%/LC_MESSAGES/mplayer.mo: po/%.po
+locale/%/LC_MESSAGES/mpv.mo: po/%.po
mkdir -p $(dir $@)
msgfmt -c -o $@ $<
@@ -456,9 +408,6 @@ checkheaders: $(ALLHEADERS:.h=.ho)
version.c osdep/mplayer-rc.o: version.h
-# Files that depend on libavcodec internals
-libmpcodecs/vf_fspp.o libmpcodecs/vf_mcdeint.o libmpcodecs/vf_spp.o: CFLAGS := -I$(FFMPEG_SOURCE_PATH) $(CFLAGS)
-
osdep/mplayer-rc.o: osdep/mplayer.exe.manifest
@@ -479,49 +428,47 @@ install-dirs:
install-%: %$(EXESUF) install-dirs
$(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR)
-install-mplayer-man: $(foreach lang,$(MAN_LANGS),install-mplayer-man-$(lang))
-install-mplayer-msg: $(foreach lang,$(MSG_LANGS),install-mplayer-msg-$(lang))
+install-mpv-man: $(foreach lang,$(MAN_LANGS),install-mpv-man-$(lang))
+install-mpv-msg: $(foreach lang,$(MSG_LANGS),install-mpv-msg-$(lang))
-install-mplayer-man-en: DOCS/man/en/mplayer.1
+install-mpv-man-en: DOCS/man/en/mpv.1
if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
- $(INSTALL) -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/
+ $(INSTALL) -m 644 DOCS/man/en/mpv.1 $(MANDIR)/man1/
define MPLAYER_MAN_RULE
-install-mplayer-man-$(lang): DOCS/man/$(lang)/mplayer.1
+install-mpv-man-$(lang): DOCS/man/$(lang)/mpv.1
if test ! -d $(MANDIR)/$(lang)/man1 ; then $(INSTALL) -d $(MANDIR)/$(lang)/man1 ; fi
- $(INSTALL) -m 644 DOCS/man/$(lang)/mplayer.1 $(MANDIR)/$(lang)/man1/
+ $(INSTALL) -m 644 DOCS/man/$(lang)/mpv.1 $(MANDIR)/$(lang)/man1/
endef
$(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MPLAYER_MAN_RULE)))
define MPLAYER_MSG_RULE
-install-mplayer-msg-$(lang):
+install-mpv-msg-$(lang):
if test ! -d $(LOCALEDIR)/$(lang)/LC_MESSAGES ; then $(INSTALL) -d $(LOCALEDIR)/$(lang)/LC_MESSAGES ; fi
- $(INSTALL) -m 644 locale/$(lang)/LC_MESSAGES/mplayer.mo $(LOCALEDIR)/$(lang)/LC_MESSAGES/
+ $(INSTALL) -m 644 locale/$(lang)/LC_MESSAGES/mpv.mo $(LOCALEDIR)/$(lang)/LC_MESSAGES/
endef
$(foreach lang,$(MSG_LANG_ALL),$(eval $(MPLAYER_MSG_RULE)))
uninstall:
- $(RM) $(BINDIR)/mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
- $(RM) $(prefix)/share/pixmaps/mplayer.xpm
- $(RM) $(prefix)/share/applications/mplayer.desktop
- $(RM) $(MANDIR)/man1/mplayer.1
- $(RM) $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1,$(MANDIR)/$(lang)/man1/$(man)))
- $(RM) $(foreach lang,$(MSG_LANGS),$(LOCALEDIR)/$(lang)/LC_MESSAGES/mplayer.1)
+ $(RM) $(BINDIR)/mpv$(EXESUF)
+ $(RM) $(MANDIR)/man1/mpv.1
+ $(RM) $(foreach lang,$(MAN_LANGS),$(foreach man,mpv.1,$(MANDIR)/$(lang)/man1/$(man)))
+ $(RM) $(foreach lang,$(MSG_LANGS),$(LOCALEDIR)/$(lang)/LC_MESSAGES/mpv.1)
clean:
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.d /*.a /*.ho /*~)
- -$(RM) $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1,DOCS/man/$(lang)/$(man)))
+ -$(RM) $(foreach lang,$(MAN_LANGS),$(foreach man,mpv.1,DOCS/man/$(lang)/$(man)))
-$(RM) $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
- -$(RM) $(call ADD_ALL_EXESUFS,mplayer)
+ -$(RM) $(call ADD_ALL_EXESUFS,mpv)
-$(RM) $(MOFILES)
-$(RM) version.h
-$(RM) codecs.conf.h
-$(RM) input/input_conf.h
-$(RM) libvo/vdpau_template.c
-$(RM) libmpdemux/ebml_types.h libmpdemux/ebml_defs.c
- -$(RM) libvo/vo_gl3_shaders.h
+ -$(RM) libvo/vo_opengl_shaders.h
-$(RM) sub/osd_font.h
distclean: clean
diff --git a/TOOLS/binary_codecs.sh b/TOOLS/binary_codecs.sh
deleted file mode 100755
index 5ab3b3993c..0000000000
--- a/TOOLS/binary_codecs.sh
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/bin/sh
-set -e
-
-# avoid insecure tempfile creation
-umask 0022
-
-# This script will download binary codecs for MPlayer unto a Debian system.
-
-# Author: thuglife, mennucc1
-#
-
-CODECDIR=/usr/lib/codecs
-PREFDIR=/var/lib/mplayer/prefs
-MYSITE='http://people.debian.org/~mennucc1/mplayer'
-
-dpkgarch=$(dpkg --print-architecture)
-
-[ -d $PREFDIR ] || mkdir -v $PREFDIR
-[ -d $CODECDIR ] || mkdir -v $CODECDIR
-cd $CODECDIR
-[ -d mplayer_binary_codecs ] || mkdir -v mplayer_binary_codecs
-
-choosemirror ()
-{
- cd $PREFDIR
-
- #if [ ! -r mirrors ] || find mirrors -mtime +20 ; then
- echo "Downloading mirrors list"
- wget -nv -c -N $MYSITE/mirrors || true
- #fi
- if [ ! -r bestsites ] || [ mirrors -nt bestsites ] || \
- find bestsites -mtime +20 | grep -q bestsites ; then
- if which netselect > /dev/null ; then
- echo Choosing best mirrors using netselect
- netselect -s 5 -t 5 $( cat mirrors ) | awk '{print $2}' > bestsites
- elif which fping > /dev/null ; then
- fping -C 1 $( sed 's#.*//##;s#/.*##' mirrors ) 2>&1 | \
- egrep -v 'bytes.*loss' | sort -n -k3 | \
- grep -v ': *-' | awk '/:/{print $1}' | head -5 | ( while read mainsite ; do
- grep $mainsite $PREFDIR/mirrors ; done ) > bestsites
- else
- echo "(If you install 'netselect' or 'fping', it will select the best mirror for you"
- echo " you may wish to stop this script and rerun after installation)"
- sleep 3
- fi
- fi
-}
-
-INSTALL () {
- filename="$3"
- dir="$2"
- url="$1"
-
- cd $CODECDIR/mplayer_binary_codecs
-
- if [ -r $filename ] ; then
- cp $filename $filename.bak
- fi
-
- if [ "$url" = @MAINSITE@ ] ; then
- list=$PREFDIR/bestsites
- test -r $list || list=$PREFDIR/mirrors
- cat $list | while read mainsite ; do
- echo Downloading $filename from $mainsite ...
- wget -c -N $mainsite/$dir/$filename || true
- if [ -r "$filename" ] ; then
- UNPACK "$filename"
- return 0
- fi
- done
- else
- wget -c -N $url/$dir/$filename || true
- if [ -r "$filename" ] ; then
- UNPACK "$filename"
- return 0
- fi
- fi
-}
-
-
-UNPACK ()
-{
- filename="$1"
- if [ -r $filename.bak ] && cmp $filename.bak $filename && [ -r $filename.list ] ; then
- echo It appears that $filename was already succesfully installed
- [ -r $filename.bak ] && rm $filename.bak
- else
- if grep -q " $filename$" $PREFDIR/MD5SUMS ; then
- echo Checking MD5 for $filename
- grep " $filename$" $PREFDIR/MD5SUMS | md5sum -c -
- else
- echo Warning: no MD5 for $filename were found. Hit enter to continue.
- read dummy
- fi
- echo Installing $filename ...
- if [ -r $filename.list ] ; then
- tr '\n' '\000' < $filename.list | xargs -r0 rm || true
- UNLINK $filename.list
- rm $filename.list
- fi
-
- tarfail () { echo FAILED $filename ; rm $filename.list ; exit 1 ; }
-
- case "$filename" in
- *.tar.gz)
- tar xvzf $filename > $filename.list || tarfail
- #rm $filename
- ;;
- *.tgz)
- tar xvzf $filename > $filename.list || tarfail
- #rm $filename
- ;;
- *.tar.bz2)
- tar --bzip2 -xvf $filename > $filename.list || tarfail
- #rm $filename
- ;;
- esac
- [ -r $filename.bak ] && rm $filename.bak
- LINK $filename.list
- echo "Installed $filename Succesfully!"
- fi
-}
-
-LINK () {
- cd $CODECDIR/
- cat $CODECDIR/mplayer_binary_codecs/$1 | while read f ; do
- ln -sbf mplayer_binary_codecs/"$f" .
- done
-}
-
-UNLINK () {
-### FIXME
-# cd $CODECDIR
-# cat $CODECDIR/mplayer_binary_codecs/$1 | while f do
-# ln -sbf mplayer_binary_codecs/"$f"
-# done
- if which symlinks > /dev/null ; then
- symlinks -d $CODECDIR
- fi
-}
-
-if [ `whoami` != root ]; then
- echo "You must be 'root' to use this script. Login as root first!"
- exit 1
-fi
-
-case "$1" in
- install)
- if test -x /bin/bzip2 || test -x /usr/bin/bzip2 ; then : ; else
- echo You need to install bzip2
- exit 1
- fi
- choosemirror
- cd $PREFDIR
- #if [ ! -r codecs_list ] || find codecs_list -mtime +20 ; then
- echo "Getting codecs list"
- wget -nv -c -N $MYSITE/codecs_list || true
- #fi
-
- cd $PREFDIR
- echo Downloading MD5 sums from main site
- [ -r MD5SUMS ] && mv MD5SUMS MD5SUMS.bak
- if wget -nv -N http://www.mplayerhq.hu/MPlayer/releases/codecs/MD5SUMS ; then
- [ -r MD5SUMS.bak ] && rm MD5SUMS.bak
- else
- echo "failed"
- if [ -r MD5SUMS.bak ] ; then
- echo "trying to use backup"
- mv MD5SUMS.bak MD5SUMS
- fi
- fi
-
- if grep -q "^$dpkgarch" $PREFDIR/codecs_list ; then
- egrep -v "^[[:space:]]*(#|$)" $PREFDIR/codecs_list | \
- while read arch url dir file info ; do
- if [ "$dpkgarch" = "$arch" ]; then
- echo Downloading and installing $file $info...
- INSTALL "$url" "$dir" "$file"
- fi
- done
- needlibstd=no
- test "$dpkgarch" = "powerpc" && needlibstd=yes
- test "$dpkgarch" = "i386" && needlibstd=yes
- if test "$needlibstd" = "yes" && ! test -r /usr/lib/libstdc++.so.5 ; then
- echo "Warning: you need to install libstdc++ 5 libraries"
- echo -n "Do it now? "
- read R
- case $R in
- y*) apt-get install libstdc++5 ;;
- *) echo "If you change your mind, use the command"
- echo " apt-get install libstdc++5" ;;
- esac
- fi
- else
- echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :("
- exit 1
- fi
- ;;
-
- uninstall)
- cd $CODECDIR/
- rm -rf mplayer_binary_codecs
- #FIXME we need a better clean system
- if which symlinks > /dev/null ; then
- symlinks -d .
- else
- echo "please install the package 'symlinks' and run 'symlinks -d $CODECDIR' "
- fi
- echo "Uninstalled Succesfully!"
- ;;
-
- *)
- echo "Usage: {install|uninstall}"
- echo "This program will install binary codecs for MPlayer."
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/TOOLS/file2string.py b/TOOLS/file2string.py
index cb121e4884..6cdd1a72ae 100755
--- a/TOOLS/file2string.py
+++ b/TOOLS/file2string.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Convert the contents of a file into a C string constant.
# Note that the compiler will implicitly add an extra 0 byte at the end
@@ -7,6 +7,10 @@
import sys
+# Indexing a byte string yields int on Python 3.x, and a str on Python 2.x
+def pord(c):
+ return ord(c) if type(c) == str else c
+
def main(infile):
conv = ['\\' + ("%03o" % c) for c in range(256)]
safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
@@ -16,7 +20,7 @@ def main(infile):
for c, esc in ("\nn", "\tt", r"\\", '""'):
conv[ord(c)] = '\\' + esc
for line in infile:
- sys.stdout.write('"' + ''.join(conv[c] for c in line) + '"\n')
+ sys.stdout.write('"' + ''.join(conv[pord(c)] for c in line) + '"\n')
with open(sys.argv[1], 'rb') as infile:
sys.stdout.write("// Generated from %s\n\n" % sys.argv[1])
diff --git a/TOOLS/matroska.py b/TOOLS/matroska.py
index ffa388e47b..848b033cbd 100755
--- a/TOOLS/matroska.py
+++ b/TOOLS/matroska.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
"""
Generate C definitions for parsing Matroska files.
Can also be used to directly parse Matroska files and display their contents.
@@ -22,6 +22,8 @@ Can also be used to directly parse Matroska files and display their contents.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+# for compatibility with Python 2.x
+from __future__ import print_function
elements_ebml = (
'EBML, 1a45dfa3, sub', (
@@ -205,7 +207,7 @@ class MatroskaElement(object):
def __init__(self, name, elid, valtype, namespace):
self.name = name
- self.definename = '{}_ID_{}'.format(namespace, name.upper())
+ self.definename = '{0}_ID_{1}'.format(namespace, name.upper())
self.fieldname = camelcase_to_words(name)
self.structname = 'ebml_' + self.fieldname
self.elid = elid
@@ -290,7 +292,7 @@ def generate_C_definitions():
print()
if el.subelements:
print('#define N', el.fieldname)
- print('E_S("{}", {})'.format(el.name, len(el.subelements)))
+ print('E_S("{0}", {1})'.format(el.name, len(el.subelements)))
for subel, multiple in el.subelements:
print('F({0.definename}, {0.fieldname}, {1})'.format(
subel, int(multiple)))
@@ -391,7 +393,7 @@ def parse_one(s, depth, parent, maxlen):
if len(t) < 20:
t = hexlify(t).decode('ascii')
else:
- t = '<skipped {} bytes>'.format(len(t))
+ t = '<skipped {0} bytes>'.format(len(t))
print('binary', t, dec)
elif elem.valtype == 'uint':
print('uint', read_uint(s, length))
diff --git a/TOOLS/mplayer2_identify.sh b/TOOLS/mpv_identify.sh
index 04902124ab..d09504ab57 100755
--- a/TOOLS/mplayer2_identify.sh
+++ b/TOOLS/mpv_identify.sh
@@ -3,22 +3,22 @@
# file identification script
#
# manual usage:
-# mplayer2_identify.sh foo.mkv
+# mpv_identify.sh foo.mkv
#
# sh/dash/ksh/bash usage:
-# . mplayer2_identify.sh FOO_ foo.mkv
+# . mpv_identify.sh FOO_ foo.mkv
# will fill properties into variables like FOO_length
#
# zsh usage:
-# mplayer2_identify() { emulate -L sh; . mplayer2_identify.sh "$@"; }
-# mplayer2_identify FOO_ foo.mkv
+# mpv_identify() { emulate -L sh; . mpv_identify.sh "$@"; }
+# mpv_identify FOO_ foo.mkv
# will fill properties into variables like FOO_length
#
# When multiple files were specified, their info will be put into FOO_* for the
# first file, FOO_1_* for the second file, FOO_2_* for the third file, etc.
case "$0" in
- mplayer2_identify.sh|*/mplayer2_identify.sh)
+ mpv_identify.sh|*/mpv_identify.sh)
# we are NOT being sourced
case "$1" in
'')
@@ -59,30 +59,29 @@ fi
__midentify__allprops="
filename
path
- stream_start
- stream_end
- stream_length
+ stream-start
+ stream-end
+ stream-length
demuxer
- switch_program
length
chapters
editions
titles
- switch_audio
- audio_bitrate
- audio_codec
- audio_format
+ audio
+ audio-bitrate
+ audio-codec
+ audio-format
channels
samplerate
- switch_video
+ video
angle
- video_bitrate
- video_codec
- video_format
+ video-bitrate
+ video-codec
+ video-format
aspect
fps
width
@@ -90,7 +89,7 @@ __midentify__allprops="
sub
"
-# TODO add metadata support once mplayer can do it
+# TODO add metadata support once mpv can do it
__midentify__propstr="X-MIDENTIFY-START:\\n"
for __midentify__key in $__midentify__allprops; do
@@ -98,7 +97,7 @@ for __midentify__key in $__midentify__allprops; do
eval unset $__midentify__nextprefix$__midentify__key
done
-__midentify__output=`mplayer --playing-msg="$__midentify__propstr" --vo=null --ao=null --frames=0 "$@"`
+__midentify__output=`mpv --playing-msg="$__midentify__propstr" --vo=null --ao=null --frames=0 "$@"`
__midentify__fileindex=0
__midentify__prefix=
while :; do
diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py
index 39e38a8bbe..85e6f1d942 100755
--- a/TOOLS/vdpau_functions.py
+++ b/TOOLS/vdpau_functions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Generate vdpau_template.c
diff --git a/TOOLS/vf_dlopen/telecine.c b/TOOLS/vf_dlopen/telecine.c
index 109fef2d6b..1b3db26a20 100644
--- a/TOOLS/vf_dlopen/telecine.c
+++ b/TOOLS/vf_dlopen/telecine.c
@@ -11,7 +11,7 @@
/*
* telecine filter
*
- * usage: -vf dlopen=./telecine.so:t:32
+ * usage: -vf dlopen=./telecine.so:t:23
*
* Parameter: first parameter is "t" for top field first, "b" for bottom field first
* then digits (0-9) for how many fields a frame is to be displayed
@@ -44,6 +44,7 @@ typedef struct {
int occupied;
double lastpts_in;
double lastpts_out;
+ int first_frame_of_group;
} tc_data_t;
static int tc_config(struct vf_dlopen_context *ctx)
@@ -116,9 +117,9 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
if (tc->pattern_pos == 0 && !tc->occupied) {
// at the start of the pattern, reset pts
- double newpts = ctx->inpic.pts - (delta * tc->pts_num) / tc->pts_denom;
- // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, newpts, newpts - tc->lastpts_out);
- tc->lastpts_out = newpts;
+ // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, ctx->inpic.pts, ctx->inpic.pts - tc->lastpts_out);
+ tc->lastpts_out = ctx->inpic.pts;
+ tc->first_frame_of_group = 1;
}
++tc->pattern_pos;
if (!tc->pattern[tc->pattern_pos])
@@ -150,7 +151,10 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
(ctx->inpic.planeheight[p] - !tc->firstfield + 1) / 2
);
}
- tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ if (tc->first_frame_of_group)
+ tc->first_frame_of_group = 0;
+ else
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;
@@ -167,7 +171,10 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
ctx->inpic.planeheight[p]
);
- tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ if (tc->first_frame_of_group)
+ tc->first_frame_of_group = 0;
+ else
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;
diff --git a/bstr.h b/bstr.h
index 5f04a75db8..dfe6f3a556 100644
--- a/bstr.h
+++ b/bstr.h
@@ -142,6 +142,16 @@ static inline int bstrcmp0(struct bstr str1, const char *str2)
return bstrcmp(str1, bstr0(str2));
}
+static inline bool bstr_equals(struct bstr str1, struct bstr str2)
+{
+ return bstrcmp(str1, str2) == 0;
+}
+
+static inline bool bstr_equals0(struct bstr str1, const char *str2)
+{
+ return bstrcmp(str1, bstr0(str2)) == 0;
+}
+
static inline int bstrcasecmp0(struct bstr str1, const char *str2)
{
return bstrcasecmp(str1, bstr0(str2));
@@ -152,7 +162,7 @@ static inline int bstr_find0(struct bstr haystack, const char *needle)
return bstr_find(haystack, bstr0(needle));
}
-static inline int bstr_eatstart0(struct bstr *s, char *prefix)
+static inline int bstr_eatstart0(struct bstr *s, const char *prefix)
{
return bstr_eatstart(s, bstr0(prefix));
}
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index f84a2afb96..581f363148 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -382,7 +382,7 @@ const m_option_t common_opts[] = {
{"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
// seek to byte/seconds position
- {"sb", &seek_to_byte, CONF_TYPE_POSITION, CONF_MIN, 0, 0, NULL},
+ {"sb", &seek_to_byte, CONF_TYPE_INT64, CONF_MIN, 0, 0, NULL},
OPT_TIME("ss", seek_to_sec, 0),
// start paused
@@ -460,7 +460,7 @@ const m_option_t common_opts[] = {
OPT_FLOATRANGE("speed", playback_speed, 0, 0.01, 100.0),
// set a-v distance
- {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
+ {"audio-delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
// ignore header-specified delay (dwStart)
{"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL},
@@ -513,12 +513,12 @@ const m_option_t common_opts[] = {
OPT_STRINGLIST("sub", sub_name, 0),
OPT_PATHLIST("sub-paths", sub_paths, 0),
{"subcp", &sub_cp, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"subdelay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
+ {"sub-delay", &sub_delay, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
{"subfps", &sub_fps, CONF_TYPE_FLOAT, 0, 0.0, 10.0, NULL},
OPT_MAKE_FLAGS("autosub", sub_auto, 0),
{"unicode", &sub_unicode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"utf8", &sub_utf8, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"forcedsubsonly", &forced_subs_only, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"sub-forced-only", &forced_subs_only, CONF_TYPE_FLAG, 0, 0, 1, NULL},
// specify IFO file for VOBSUB subtitle
{"ifo", &spudec_ifo, CONF_TYPE_STRING, 0, 0, 0, NULL},
// enable Closed Captioning display
@@ -530,7 +530,7 @@ const m_option_t common_opts[] = {
{"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"subfont", &sub_font_name, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
- {"subpos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
+ {"sub-pos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
{"subwidth", &sub_width_p, CONF_TYPE_INT, CONF_RANGE, 10, 100, NULL},
{"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL},
{"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
@@ -554,6 +554,8 @@ const m_option_t common_opts[] = {
OPT_STRING("ass-border-color", ass_border_color, 0),
OPT_STRING("ass-styles", ass_styles_file, 0),
OPT_INTRANGE("ass-hinting", ass_hinting, 0, 0, 7),
+ OPT_CHOICE("ass-style-override", ass_style_override, 0,
+ ({"no", 0}, {"yes", 1})),
{NULL, NULL, 0, 0, 0, 0, NULL}
};
@@ -622,6 +624,7 @@ const m_option_t mplayer_opts[]={
// video mode switching: (x11,xv,dga)
OPT_MAKE_FLAGS("vm", vidmode, 0),
// start in fullscreen mode:
+ OPT_MAKE_FLAGS("fullscreen", fullscreen, CONF_GLOBAL),
OPT_MAKE_FLAGS("fs", fullscreen, CONF_GLOBAL),
// set fullscreen switch method (workaround for buggy WMs)
{"fsmode-dontuse", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
@@ -631,7 +634,7 @@ const m_option_t mplayer_opts[]={
{"no-colorkey", &vo_colorkey, CONF_TYPE_FLAG, 0, 0, 0x1000000, NULL},
// wait for v-sync (gl)
{"vsync", &vo_vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
+ {"panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1.0, NULL},
OPT_FLOATRANGE("panscanrange", vo_panscanrange, 0, -19.0, 99.0),
OPT_CHOICE("colormatrix", requested_colorspace, 0,
({"auto", MP_CSP_AUTO},
@@ -673,16 +676,20 @@ const m_option_t mplayer_opts[]={
{"use-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
OPT_INTRANGE("osdlevel", osd_level, 0, 0, 3),
+ OPT_CHOICE("osd-level", osd_level, 0,
+ ({"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})),
OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000),
OPT_MAKE_FLAGS("osd-fractions", osd_fractions, 0),
OPT_STRING("vobsub", vobsub_name, 0),
{"vobsubid", &vobsub_id, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
- {"sstep", &step_sec, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+ {"sstep", &step_sec, CONF_TYPE_DOUBLE, CONF_MIN, 0, 0, NULL},
- {"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL},
+ OPT_CHOICE("framedrop", frame_dropping, 0,
+ ({"no", 0},
+ {"yes", 1}, {"", 1},
+ {"hard", 2})),
OPT_FLAG_ON("untimed", untimed, 0),
@@ -725,6 +732,7 @@ const m_option_t mplayer_opts[]={
OPT_STRING("term-osd-esc", term_osd_esc, 0, OPTDEF_STR("\x1b[A\r\x1b[K")),
OPT_STRING("playing-msg", playing_msg, 0),
+ OPT_STRING("status-msg", status_msg, 0),
{"slave-broken", &slave_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL},
OPT_MAKE_FLAGS("idle", player_idle_mode, CONF_GLOBAL),
@@ -759,6 +767,8 @@ const m_option_t mplayer_opts[]={
OPT_MAKE_FLAGS("orawts", encode_output.rawts, CONF_GLOBAL),
OPT_MAKE_FLAGS("oautofps", encode_output.autofps, CONF_GLOBAL),
OPT_MAKE_FLAGS("oneverdrop", encode_output.neverdrop, CONF_GLOBAL),
+ OPT_MAKE_FLAGS("ovfirst", encode_output.video_first, CONF_GLOBAL),
+ OPT_MAKE_FLAGS("oafirst", encode_output.audio_first, CONF_GLOBAL),
{NULL, NULL, 0, 0, 0, 0, NULL}
};
diff --git a/command.c b/command.c
index 5f15cecf62..28625a108a 100644
--- a/command.c
+++ b/command.c
@@ -39,7 +39,6 @@
#include "m_option.h"
#include "m_property.h"
#include "m_config.h"
-#include "metadata.h"
#include "libmpcodecs/vf.h"
#include "libmpcodecs/vd.h"
#include "mp_osd.h"
@@ -72,6 +71,16 @@
#include "mp_fifo.h"
#include "libavutil/avstring.h"
+static char *format_bitrate(int rate)
+{
+ return talloc_asprintf(NULL, "%d kbps", rate * 8 / 1000);
+}
+
+static char *format_delay(double time)
+{
+ return talloc_asprintf(NULL, "%d ms", ROUND(time * 1000));
+}
+
static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
double *dx, double *dy)
{
@@ -105,110 +114,29 @@ static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
vo->dheight, vo_fs);
}
-static void choice_get_min_max(const struct m_option *opt, int *min, int *max)
-{
- assert(opt->type == &m_option_type_choice);
- *min = INT_MAX;
- *max = INT_MIN;
- for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++) {
- *min = FFMIN(*min, alt->value);
- *max = FFMAX(*max, alt->value);
- }
- if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) {
- *min = FFMIN(*min, opt->min);
- *max = FFMAX(*max, opt->max);
- }
-}
-
-static void check_choice(int dir, int val, bool *found, int *best, int choice)
-{
- if ((dir == -1 && (!(*found) || choice > (*best)) && choice < val) ||
- (dir == +1 && (!(*found) || choice < (*best)) && choice > val))
- {
- *found = true;
- *best = choice;
- }
-}
-
-static int step_choice(const struct m_option *opt, int val, int add, bool wrap)
-{
- assert(opt->type == &m_option_type_choice);
- int dir = add > 0 ? +1 : -1;
- bool found = false;
- int best = 0; // init. value unused
-
- if (add == 0)
- return val;
-
- if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) {
- int newval = val + add;
- if (val >= opt->min && val <= opt->max &&
- newval >= opt->min && newval <= opt->max)
- {
- found = true;
- best = newval;
- } else {
- check_choice(dir, val, &found, &best, opt->min);
- check_choice(dir, val, &found, &best, opt->max);
- }
- }
-
- for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++)
- check_choice(dir, val, &found, &best, alt->value);
-
- if (!found) {
- int min, max;
- choice_get_min_max(opt, &min, &max);
- best = (dir == -1) ^ wrap ? min : max;
- }
-
- return best;
-}
-
+// Property-option bridge.
static int mp_property_generic_option(struct m_option *prop, int action,
void *arg, MPContext *mpctx)
{
char *optname = prop->priv;
- const struct m_option *opt = m_config_get_option(mpctx->mconfig,
- bstr0(optname));
- void *valptr = m_option_get_ptr(opt, &mpctx->opts);
+ struct m_config_option *opt = m_config_get_co(mpctx->mconfig,
+ bstr0(optname));
+ void *valptr = opt->data;
switch (action) {
case M_PROPERTY_GET_TYPE:
- *(const struct m_option **)arg = opt;
+ *(struct m_option *)arg = *(opt->opt);
return M_PROPERTY_OK;
case M_PROPERTY_GET:
- m_option_copy(opt, arg, valptr);
+ m_option_copy(opt->opt, arg, valptr);
return M_PROPERTY_OK;
case M_PROPERTY_SET:
- m_option_copy(opt, valptr, arg);
+ m_option_copy(opt->opt, valptr, arg);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- if (opt->type == &m_option_type_choice) {
- int add = arg ? (*(int *)arg) : +1;
- int v = *(int *) valptr;
- *(int *) valptr = step_choice(opt, v, add, true);
- return M_PROPERTY_OK;
- }
- break;
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
-/// OSD level (RW)
-static int mp_property_osdlevel(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
-{
- return m_property_choice(prop, action, arg, &mpctx->opts.osd_level);
-}
-
-/// Loop (RW)
-static int mp_property_loop(m_option_t *prop, int action, void *arg,
- MPContext *mpctx)
-{
- return mp_property_generic_option(prop, action, arg, mpctx);
-}
-
/// Playback speed (RW)
static int mp_property_playback_speed(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
@@ -216,43 +144,57 @@ static int mp_property_playback_speed(m_option_t *prop, int action,
struct MPOpts *opts = &mpctx->opts;
double orig_speed = opts->playback_speed;
switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
+ case M_PROPERTY_SET: {
opts->playback_speed = *(float *) arg;
- goto set;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- opts->playback_speed += (arg ? *(float *) arg : 0.1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- set:
- M_PROPERTY_CLAMP(prop, opts->playback_speed);
// Adjust time until next frame flip for nosound mode
mpctx->time_frame *= orig_speed / opts->playback_speed;
reinit_audio_chain(mpctx);
return M_PROPERTY_OK;
}
- return m_property_float_range(prop, action, arg, &opts->playback_speed);
+ case M_PROPERTY_PRINT:
+ *(char **)arg = talloc_asprintf(NULL, "x %6.2f", orig_speed);
+ return M_PROPERTY_OK;
+ }
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
/// filename with path (RO)
static int mp_property_path(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- return m_property_string_ro(prop, action, arg, mpctx->filename);
+ if (!mpctx->filename)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_strdup_ro(prop, action, arg, mpctx->filename);
+}
+
+static int mp_property_media_title(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ char *name = mpctx->filename;
+ if (mpctx->resolve_result)
+ name = mpctx->resolve_result->title;
+ if (!name)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_strdup_ro(prop, action, arg, name);
+}
+
+static int mp_property_stream_path(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
+{
+ struct stream *stream = mpctx->stream;
+ if (!stream || !stream->url)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_strdup_ro(prop, action, arg, stream->url);
}
/// filename without path (RO)
static int mp_property_filename(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- char *f;
if (!mpctx->filename)
return M_PROPERTY_UNAVAILABLE;
- f = (char *)mp_basename(mpctx->filename);
- if (!*f)
- f = mpctx->filename;
- return m_property_string_ro(prop, action, arg, f);
+ char *f = (char *)mp_basename(mpctx->filename);
+ return m_property_strdup_ro(prop, action, arg, (*f) ? f : mpctx->filename);
}
/// Demuxer name (RO)
@@ -262,7 +204,7 @@ static int mp_property_demuxer(m_option_t *prop, int action, void *arg,
struct demuxer *demuxer = mpctx->master_demuxer;
if (!demuxer)
return M_PROPERTY_UNAVAILABLE;
- return m_property_string_ro(prop, action, arg, (char *)demuxer->desc->name);
+ return m_property_strdup_ro(prop, action, arg, demuxer->desc->name);
}
/// Position in the stream (RW)
@@ -272,15 +214,12 @@ static int mp_property_stream_pos(m_option_t *prop, int action, void *arg,
struct stream *stream = mpctx->stream;
if (!stream)
return M_PROPERTY_UNAVAILABLE;
- if (!arg)
- return M_PROPERTY_ERROR;
switch (action) {
case M_PROPERTY_GET:
- *(off_t *) arg = stream_tell(stream);
+ *(int64_t *) arg = stream_tell(stream);
return M_PROPERTY_OK;
case M_PROPERTY_SET:
- M_PROPERTY_CLAMP(prop, *(off_t *) arg);
- stream_seek(stream, *(off_t *) arg);
+ stream_seek(stream, *(int64_t *) arg);
return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
@@ -293,12 +232,7 @@ static int mp_property_stream_start(m_option_t *prop, int action,
struct stream *stream = mpctx->stream;
if (!stream)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_GET:
- *(off_t *) arg = stream->start_pos;
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
+ return m_property_int64_ro(prop, action, arg, stream->start_pos);
}
/// Stream end offset (RO)
@@ -308,12 +242,7 @@ static int mp_property_stream_end(m_option_t *prop, int action, void *arg,
struct stream *stream = mpctx->stream;
if (!stream)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_GET:
- *(off_t *) arg = stream->end_pos;
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
+ return m_property_int64_ro(prop, action, arg, stream->end_pos);
}
/// Stream length (RO)
@@ -323,12 +252,8 @@ static int mp_property_stream_length(m_option_t *prop, int action,
struct stream *stream = mpctx->stream;
if (!stream)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_GET:
- *(off_t *) arg = stream->end_pos - stream->start_pos;
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
+ return m_property_int64_ro(prop, action, arg,
+ stream->end_pos - stream->start_pos);
}
/// Current stream position in seconds (RO)
@@ -342,7 +267,7 @@ static int mp_property_stream_time_pos(m_option_t *prop, int action,
if (pts == MP_NOPTS_VALUE)
return M_PROPERTY_UNAVAILABLE;
- return m_property_time_ro(prop, action, arg, pts);
+ return m_property_double_ro(prop, action, arg, pts);
}
@@ -355,38 +280,26 @@ static int mp_property_length(m_option_t *prop, int action, void *arg,
if (!(int) (len = get_time_length(mpctx)))
return M_PROPERTY_UNAVAILABLE;
- return m_property_time_ro(prop, action, arg, len);
+ return m_property_double_ro(prop, action, arg, len);
}
/// Current position in percent (RW)
static int mp_property_percent_pos(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- int pos;
-
if (!mpctx->num_sources)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *)arg);
- pos = *(int *)arg;
- break;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- pos = get_percent_pos(mpctx);
- pos += (arg ? *(int *)arg : 10) *
- (action == M_PROPERTY_STEP_UP ? 1 : -1);
- M_PROPERTY_CLAMP(prop, pos);
- break;
- default:
- return m_property_int_ro(prop, action, arg, get_percent_pos(mpctx));
+ case M_PROPERTY_SET: ;
+ int pos = *(int *)arg;
+ queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, 0);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ *(int *)arg = get_percent_pos(mpctx);
+ return M_PROPERTY_OK;
}
-
- queue_seek(mpctx, MPSEEK_FACTOR, pos / 100.0, 0);
- return M_PROPERTY_OK;
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Current position in seconds (RW)
@@ -398,83 +311,48 @@ static int mp_property_time_pos(m_option_t *prop, int action,
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(double *)arg);
queue_seek(mpctx, MPSEEK_ABSOLUTE, *(double *)arg, 0);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- queue_seek(mpctx, MPSEEK_RELATIVE, (arg ? *(double *)arg : 10.0) *
- (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0), 0);
+ case M_PROPERTY_GET:
+ *(double *)arg = get_current_time(mpctx);
return M_PROPERTY_OK;
}
- return m_property_time_ro(prop, action, arg, get_current_time(mpctx));
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Current chapter (RW)
static int mp_property_chapter(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- struct MPOpts *opts = &mpctx->opts;
- int step_all;
- char *chapter_name = NULL;
-
int chapter = get_current_chapter(mpctx);
if (chapter < -1)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
*(int *) arg = chapter;
return M_PROPERTY_OK;
case M_PROPERTY_PRINT: {
- if (!arg)
- return M_PROPERTY_ERROR;
- chapter_name = chapter_display_name(mpctx, chapter);
+ char *chapter_name = chapter_display_name(mpctx, chapter);
if (!chapter_name)
return M_PROPERTY_UNAVAILABLE;
*(char **) arg = chapter_name;
return M_PROPERTY_OK;
}
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *)arg);
- step_all = *(int *)arg - chapter;
+ case M_PROPERTY_SET: ;
+ int step_all = *(int *)arg - chapter;
chapter += step_all;
- break;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN: {
- step_all = (arg && *(int *)arg != 0 ? *(int *)arg : 1)
- * (action == M_PROPERTY_STEP_UP ? 1 : -1);
- chapter += step_all;
- if (chapter < 0)
- chapter = 0;
- break;
- }
- default:
- return M_PROPERTY_NOT_IMPLEMENTED;
+ double next_pts = 0;
+ queue_seek(mpctx, MPSEEK_NONE, 0, 0);
+ chapter = seek_chapter(mpctx, chapter, &next_pts);
+ if (chapter >= 0) {
+ if (next_pts > -1.0)
+ queue_seek(mpctx, MPSEEK_ABSOLUTE, next_pts, 0);
+ } else if (step_all > 0)
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ return M_PROPERTY_OK;
}
-
- double next_pts = 0;
- queue_seek(mpctx, MPSEEK_NONE, 0, 0);
- chapter = seek_chapter(mpctx, chapter, &next_pts);
- if (chapter >= 0) {
- if (next_pts > -1.0)
- queue_seek(mpctx, MPSEEK_ABSOLUTE, next_pts, 0);
- chapter_name = chapter_display_name(mpctx, chapter);
- set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration,
- "Chapter: %s", chapter_name);
- } else if (step_all > 0)
- mpctx->stop_play = PT_NEXT_ENTRY;
- else
- set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration,
- "Chapter: (%d) %s", 0, mp_gtext("unknown"));
- talloc_free(chapter_name);
- return M_PROPERTY_OK;
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
static int mp_property_edition(m_option_t *prop, int action, void *arg,
@@ -491,35 +369,29 @@ static int mp_property_edition(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_GET:
- case M_PROPERTY_PRINT:
- return m_property_int_ro(prop, action, arg, edition);
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *)arg);
+ *(int *)arg = edition;
+ return M_PROPERTY_OK;
+ case M_PROPERTY_SET: {
edition = *(int *)arg;
- break;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN: {
- edition += arg ? *(int *)arg : (action == M_PROPERTY_STEP_UP ? 1 : -1);
- if (edition < 0)
- edition = demuxer->num_editions - 1;
- if (edition >= demuxer->num_editions)
- edition = 0;
- break;
+ if (edition != demuxer->edition) {
+ opts->edition_id = edition;
+ mpctx->stop_play = PT_RESTART;
+ }
+ return M_PROPERTY_OK;
}
- default:
- return M_PROPERTY_NOT_IMPLEMENTED;
+ case M_PROPERTY_GET_TYPE: {
+ struct m_option opt = {
+ .name = prop->name,
+ .type = CONF_TYPE_INT,
+ .flags = CONF_RANGE,
+ .min = 0,
+ .max = demuxer->num_editions - 1,
+ };
+ *(struct m_option *)arg = opt;
+ return M_PROPERTY_OK;
}
-
- if (edition != demuxer->edition) {
- opts->edition_id = edition;
- mpctx->stop_play = PT_RESTART;
- set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration,
- "Playing edition %d of %d.", edition + 1,
- demuxer->num_editions);
}
- return M_PROPERTY_OK;
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Number of titles in file
@@ -559,7 +431,6 @@ static int mp_property_editions(m_option_t *prop, int action, void *arg,
static int mp_property_angle(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- struct MPOpts *opts = &mpctx->opts;
struct demuxer *demuxer = mpctx->master_demuxer;
int angle = -1;
int angles;
@@ -574,54 +445,26 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
*(int *) arg = angle;
return M_PROPERTY_OK;
case M_PROPERTY_PRINT: {
- if (!arg)
- return M_PROPERTY_ERROR;
*(char **) arg = talloc_asprintf(NULL, "%d/%d", angle, angles);
return M_PROPERTY_OK;
}
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- angle = *(int *)arg;
- M_PROPERTY_CLAMP(prop, angle);
- break;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN: {
- int step = 0;
- if (arg)
- step = *(int *)arg;
- if (!step)
- step = 1;
- step *= (action == M_PROPERTY_STEP_UP ? 1 : -1);
- angle += step;
- if (angle < 1) //cycle
- angle = angles;
- else if (angle > angles)
- angle = 1;
- break;
- }
- default:
- return M_PROPERTY_NOT_IMPLEMENTED;
- }
- angle = demuxer_set_angle(demuxer, angle);
- if (angle >= 0) {
- struct sh_video *sh_video = demuxer->video->sh;
- if (sh_video)
- resync_video_stream(sh_video);
-
- struct sh_audio *sh_audio = demuxer->audio->sh;
- if (sh_audio)
- resync_audio_stream(sh_audio);
+ angle = demuxer_set_angle(demuxer, *(int *)arg);
+ if (angle >= 0) {
+ struct sh_video *sh_video = demuxer->video->sh;
+ if (sh_video)
+ resync_video_stream(sh_video);
+
+ struct sh_audio *sh_audio = demuxer->audio->sh;
+ if (sh_audio)
+ resync_audio_stream(sh_audio);
+ }
+ return M_PROPERTY_OK;
}
-
- set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, opts->osd_duration,
- "Angle: %d/%d", angle, angles);
- return M_PROPERTY_OK;
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Demuxer meta data
@@ -632,38 +475,33 @@ static int mp_property_metadata(m_option_t *prop, int action, void *arg,
if (!demuxer)
return M_PROPERTY_UNAVAILABLE;
- m_property_action_t *ka;
- char *meta;
static const m_option_t key_type =
{
"metadata", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL
};
switch (action) {
- case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
- *(char ***)arg = demuxer->info;
+ case M_PROPERTY_GET: {
+ char **slist = NULL;
+ m_option_copy(prop, &slist, &demuxer->info);
+ *(char ***)arg = slist;
return M_PROPERTY_OK;
- case M_PROPERTY_KEY_ACTION:
- if (!arg)
- return M_PROPERTY_ERROR;
- ka = arg;
- if (!(meta = demux_info_get(demuxer, ka->key)))
+ }
+ case M_PROPERTY_KEY_ACTION: {
+ struct m_property_action_arg *ka = arg;
+ char *meta = demux_info_get(demuxer, ka->key);
+ if (!meta)
return M_PROPERTY_UNKNOWN;
switch (ka->action) {
case M_PROPERTY_GET:
- if (!ka->arg)
- return M_PROPERTY_ERROR;
- *(char **)ka->arg = meta;
+ *(char **)ka->arg = talloc_strdup(NULL, meta);
return M_PROPERTY_OK;
case M_PROPERTY_GET_TYPE:
- if (!ka->arg)
- return M_PROPERTY_ERROR;
- *(const m_option_t **)ka->arg = &key_type;
+ *(struct m_option *)ka->arg = key_type;
return M_PROPERTY_OK;
}
}
+ }
return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -674,21 +512,17 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- if (mpctx->paused == (bool) * (int *)arg)
- return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- if (mpctx->paused) {
- unpause_player(mpctx);
- } else {
+ if (*(int *)arg) {
pause_player(mpctx);
+ } else {
+ unpause_player(mpctx);
}
return M_PROPERTY_OK;
- default:
- return m_property_flag(prop, action, arg, &mpctx->paused);
+ case M_PROPERTY_GET:
+ *(int *)arg = mpctx->paused;
+ return M_PROPERTY_OK;
}
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -702,44 +536,19 @@ static int mp_property_volume(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
mixer_getbothvolume(&mpctx->mixer, arg);
return M_PROPERTY_OK;
- case M_PROPERTY_PRINT: {
- float vol;
- if (!arg)
- return M_PROPERTY_ERROR;
- mixer_getbothvolume(&mpctx->mixer, &vol);
- return m_property_float_range(prop, action, arg, &vol);
- }
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- case M_PROPERTY_SET:
- break;
- default:
- return M_PROPERTY_NOT_IMPLEMENTED;
- }
-
- switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(float *) arg);
mixer_setvolume(&mpctx->mixer, *(float *) arg, *(float *) arg);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- if (arg && *(float *) arg <= 0)
+ case M_PROPERTY_SWITCH: {
+ struct m_property_switch_arg *sarg = arg;
+ if (sarg->inc <= 0)
mixer_decvolume(&mpctx->mixer);
else
mixer_incvolume(&mpctx->mixer);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_DOWN:
- if (arg && *(float *) arg <= 0)
- mixer_incvolume(&mpctx->mixer);
- else
- mixer_decvolume(&mpctx->mixer);
- return M_PROPERTY_OK;
+ }
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -754,18 +563,13 @@ static int mp_property_mute(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
mixer_setmute(&mpctx->mixer, *(int *) arg);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- mixer_setmute(&mpctx->mixer, !mixer_getmute(&mpctx->mixer));
+ case M_PROPERTY_GET:
+ *(int *)arg = mixer_getmute(&mpctx->mixer);
return M_PROPERTY_OK;
- default:
- return m_property_flag_ro(prop, action, arg,
- mixer_getmute(&mpctx->mixer));
}
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Audio delay (RW)
@@ -775,21 +579,14 @@ static int mp_property_audio_delay(m_option_t *prop, int action,
if (!(mpctx->sh_audio && mpctx->sh_video))
return M_PROPERTY_UNAVAILABLE;
switch (action) {
+ case M_PROPERTY_PRINT:
+ *(char **)arg = format_delay(audio_delay);
+ return M_PROPERTY_OK;
case M_PROPERTY_SET:
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN: {
- int ret;
- float delay = audio_delay;
- ret = m_property_delay(prop, action, arg, &audio_delay);
- if (ret != M_PROPERTY_OK)
- return ret;
- if (mpctx->sh_audio)
- mpctx->delay -= audio_delay - delay;
- }
+ mpctx->delay -= audio_delay - *(float *)arg;
return M_PROPERTY_OK;
- default:
- return m_property_delay(prop, action, arg, &audio_delay);
}
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Audio codec tag (RO)
@@ -807,8 +604,11 @@ static int mp_property_audio_codec(m_option_t *prop, int action,
{
if (!mpctx->sh_audio || !mpctx->sh_audio->codec)
return M_PROPERTY_UNAVAILABLE;
- return m_property_string_ro(prop, action, arg,
- mpctx->sh_audio->codec->name);
+ if (action == M_PROPERTY_GET) {
+ *(char **)arg = talloc_strdup(NULL, mpctx->sh_audio->codec->name);
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Audio bitrate (RO)
@@ -817,7 +617,15 @@ static int mp_property_audio_bitrate(m_option_t *prop, int action,
{
if (!mpctx->sh_audio)
return M_PROPERTY_UNAVAILABLE;
- return m_property_bitrate(prop, action, arg, mpctx->sh_audio->i_bps);
+ switch (action) {
+ case M_PROPERTY_PRINT:
+ *(char **)arg = format_bitrate(mpctx->sh_audio->i_bps);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ *(int *)arg = mpctx->sh_audio->i_bps;
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Samplerate (RO)
@@ -828,13 +636,14 @@ static int mp_property_samplerate(m_option_t *prop, int action, void *arg,
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
*(char **)arg = talloc_asprintf(NULL, "%d kHz",
mpctx->sh_audio->samplerate / 1000);
return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ *(int *)arg = mpctx->sh_audio->samplerate;
+ return M_PROPERTY_OK;
}
- return m_property_int_ro(prop, action, arg, mpctx->sh_audio->samplerate);
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Number of channels (RO)
@@ -845,8 +654,6 @@ static int mp_property_channels(m_option_t *prop, int action, void *arg,
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
switch (mpctx->sh_audio->channels) {
case 1:
*(char **) arg = talloc_strdup(NULL, "mono");
@@ -859,8 +666,11 @@ static int mp_property_channels(m_option_t *prop, int action, void *arg,
mpctx->sh_audio->channels);
}
return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ *(int *)arg = mpctx->sh_audio->channels;
+ return M_PROPERTY_OK;
}
- return m_property_int_ro(prop, action, arg, mpctx->sh_audio->channels);
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Balance (RW)
@@ -871,14 +681,10 @@ static int mp_property_balance(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
mixer_getbalance(&mpctx->mixer, arg);
return M_PROPERTY_OK;
case M_PROPERTY_PRINT: {
char **str = arg;
- if (!arg)
- return M_PROPERTY_ERROR;
mixer_getbalance(&mpctx->mixer, &bal);
if (bal == 0.f)
*str = talloc_strdup(NULL, "center");
@@ -893,18 +699,7 @@ static int mp_property_balance(m_option_t *prop, int action, void *arg,
}
return M_PROPERTY_OK;
}
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- mixer_getbalance(&mpctx->mixer, &bal);
- bal += (arg ? *(float *)arg : .1f) *
- (action == M_PROPERTY_STEP_UP ? 1.f : -1.f);
- M_PROPERTY_CLAMP(prop, bal);
- mixer_setbalance(&mpctx->mixer, bal);
- return M_PROPERTY_OK;
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(float *)arg);
mixer_setbalance(&mpctx->mixer, *(float *)arg);
return M_PROPERTY_OK;
}
@@ -943,14 +738,9 @@ static int property_switch_track(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
*(int *) arg = track ? track->user_tid : -1;
return M_PROPERTY_OK;
case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
-
if (!track)
*(char **) arg = talloc_strdup(NULL, mp_gtext("disabled"));
else {
@@ -967,18 +757,15 @@ static int property_switch_track(m_option_t *prop, int action, void *arg,
}
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- case M_PROPERTY_SET: {
- int i = (arg ? *((int *) arg) : +1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : +1);
- if (action == M_PROPERTY_SET && arg)
- track = mp_track_by_tid(mpctx, type, i);
- else
- track = track_next(mpctx, type, i > 0 ? +1 : -1, track);
- mp_switch_track(mpctx, type, track);
+ case M_PROPERTY_SWITCH: {
+ struct m_property_switch_arg *sarg = arg;
+ mp_switch_track(mpctx, type,
+ track_next(mpctx, type, sarg->inc >= 0 ? +1 : -1, track));
return M_PROPERTY_OK;
}
+ case M_PROPERTY_SET:
+ mp_switch_track(mpctx, type, mp_track_by_tid(mpctx, type, *(int *)arg));
+ return M_PROPERTY_OK;
default:
return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -998,6 +785,18 @@ static int mp_property_video(m_option_t *prop, int action, void *arg,
return property_switch_track(prop, action, arg, mpctx, STREAM_VIDEO);
}
+static struct track *find_track_by_demuxer_id(MPContext *mpctx,
+ enum stream_type type,
+ int demuxer_id)
+{
+ for (int n = 0; n < mpctx->num_tracks; n++) {
+ struct track *track = mpctx->tracks[n];
+ if (track->type == type && track->demuxer_id == demuxer_id)
+ return track;
+ }
+ return NULL;
+}
+
static int mp_property_program(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
@@ -1008,7 +807,7 @@ static int mp_property_program(m_option_t *prop, int action, void *arg,
return M_PROPERTY_UNAVAILABLE;
switch (action) {
- case M_PROPERTY_STEP_UP:
+ case M_PROPERTY_SWITCH:
case M_PROPERTY_SET:
if (action == M_PROPERTY_SET && arg)
prog.progid = *((int *) arg);
@@ -1023,13 +822,13 @@ static int mp_property_program(m_option_t *prop, int action, void *arg,
"Selected program contains no audio or video streams!\n");
return M_PROPERTY_ERROR;
}
- mp_property_do("switch_audio", M_PROPERTY_SET, &prog.aid, mpctx);
- mp_property_do("switch_video", M_PROPERTY_SET, &prog.vid, mpctx);
+ mp_switch_track(mpctx, STREAM_AUDIO,
+ find_track_by_demuxer_id(mpctx, STREAM_AUDIO, prog.aid));
+ mp_switch_track(mpctx, STREAM_VIDEO,
+ find_track_by_demuxer_id(mpctx, STREAM_VIDEO, prog.vid));
return M_PROPERTY_OK;
-
- default:
- return M_PROPERTY_NOT_IMPLEMENTED;
}
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -1041,68 +840,42 @@ static int mp_property_fullscreen(m_option_t *prop, int action, void *arg,
if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *) arg);
+ if (action == M_PROPERTY_SET) {
if (vo_fs == !!*(int *) arg)
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
if (mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
mpctx->opts.fullscreen = vo_fs;
return M_PROPERTY_OK;
- default:
- return m_property_flag(prop, action, arg, &vo_fs);
}
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
static int mp_property_deinterlace(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- int deinterlace;
vf_instance_t *vf;
if (!mpctx->sh_video || !mpctx->sh_video->vfilter)
return M_PROPERTY_UNAVAILABLE;
vf = mpctx->sh_video->vfilter;
switch (action) {
case M_PROPERTY_GET:
- if (!arg)
- return M_PROPERTY_ERROR;
vf->control(vf, VFCTRL_GET_DEINTERLACE, arg);
return M_PROPERTY_OK;
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *) arg);
vf->control(vf, VFCTRL_SET_DEINTERLACE, arg);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- vf->control(vf, VFCTRL_GET_DEINTERLACE, &deinterlace);
- deinterlace = !deinterlace;
- vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace);
- return M_PROPERTY_OK;
}
- int value = 0;
- vf->control(vf, VFCTRL_GET_DEINTERLACE, &value);
- return m_property_flag_ro(prop, action, arg, value);
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
static int colormatrix_property_helper(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
int r = mp_property_generic_option(prop, action, arg, mpctx);
- // testing for an actual change is too much effort
- switch (action) {
- case M_PROPERTY_SET:
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
+ if (action == M_PROPERTY_SET) {
if (mpctx->sh_video)
set_video_colorspace(mpctx->sh_video);
- break;
}
return r;
}
@@ -1110,81 +883,75 @@ static int colormatrix_property_helper(m_option_t *prop, int action,
static int mp_property_colormatrix(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
+ if (action != M_PROPERTY_PRINT)
+ return colormatrix_property_helper(prop, action, arg, mpctx);
+
struct MPOpts *opts = &mpctx->opts;
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
- struct mp_csp_details actual = { .format = -1 };
- char *req_csp = mp_csp_names[opts->requested_colorspace];
- char *real_csp = NULL;
- if (mpctx->sh_video) {
- struct vf_instance *vf = mpctx->sh_video->vfilter;
- if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual) == true) {
- real_csp = mp_csp_names[actual.format];
- } else {
- real_csp = "Unknown";
- }
+ struct mp_csp_details actual = { .format = -1 };
+ char *req_csp = mp_csp_names[opts->requested_colorspace];
+ char *real_csp = NULL;
+ if (mpctx->sh_video) {
+ struct vf_instance *vf = mpctx->sh_video->vfilter;
+ if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual) == true) {
+ real_csp = mp_csp_names[actual.format];
+ } else {
+ real_csp = "Unknown";
}
- char *res;
- if (opts->requested_colorspace == MP_CSP_AUTO && real_csp) {
- // Caveat: doesn't handle the case when the autodetected colorspace
- // is different from the actual colorspace as used by the
- // VO - the OSD will display the VO colorspace without
- // indication that it doesn't match the requested colorspace.
- res = talloc_asprintf(NULL, "Auto (%s)", real_csp);
- } else if (opts->requested_colorspace == actual.format || !real_csp) {
- res = talloc_strdup(NULL, req_csp);
- } else
- res = talloc_asprintf(NULL, mp_gtext("%s, but %s used"),
- req_csp, real_csp);
- *(char **)arg = res;
- return M_PROPERTY_OK;
- default:;
- return colormatrix_property_helper(prop, action, arg, mpctx);
}
+ char *res;
+ if (opts->requested_colorspace == MP_CSP_AUTO && real_csp) {
+ // Caveat: doesn't handle the case when the autodetected colorspace
+ // is different from the actual colorspace as used by the
+ // VO - the OSD will display the VO colorspace without
+ // indication that it doesn't match the requested colorspace.
+ res = talloc_asprintf(NULL, "Auto (%s)", real_csp);
+ } else if (opts->requested_colorspace == actual.format || !real_csp) {
+ res = talloc_strdup(NULL, req_csp);
+ } else
+ res = talloc_asprintf(NULL, mp_gtext("%s, but %s used"),
+ req_csp, real_csp);
+ *(char **)arg = res;
+ return M_PROPERTY_OK;
}
static int levels_property_helper(int offset, m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
- char *optname = prop->priv;
- const struct m_option *opt = m_config_get_option(mpctx->mconfig,
- bstr0(optname));
- int *valptr = (int *)m_option_get_ptr(opt, &mpctx->opts);
+ if (action != M_PROPERTY_PRINT)
+ return colormatrix_property_helper(prop, action, arg, mpctx);
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
- struct mp_csp_details actual = {0};
- int actual_level = -1;
- char *req_level = m_option_print(opt, valptr);
- char *real_level = NULL;
- if (mpctx->sh_video) {
- struct vf_instance *vf = mpctx->sh_video->vfilter;
- if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual) == true) {
- actual_level = *(enum mp_csp_levels *)(((char *)&actual) + offset);
- real_level = m_option_print(opt, &actual_level);
- } else {
- real_level = talloc_strdup(NULL, "Unknown");
- }
+ struct m_option opt = {0};
+ mp_property_generic_option(prop, M_PROPERTY_GET_TYPE, &opt, mpctx);
+ assert(opt.type);
+
+ int requested = 0;
+ mp_property_generic_option(prop, M_PROPERTY_GET, &requested, mpctx);
+
+ struct mp_csp_details actual = {0};
+ int actual_level = -1;
+ char *req_level = m_option_print(&opt, &requested);
+ char *real_level = NULL;
+ if (mpctx->sh_video) {
+ struct vf_instance *vf = mpctx->sh_video->vfilter;
+ if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &actual) == true) {
+ actual_level = *(enum mp_csp_levels *)(((char *)&actual) + offset);
+ real_level = m_option_print(&opt, &actual_level);
+ } else {
+ real_level = talloc_strdup(NULL, "Unknown");
}
- char *res;
- if (*valptr == MP_CSP_LEVELS_AUTO && real_level) {
- res = talloc_asprintf(NULL, "Auto (%s)", real_level);
- } else if (*valptr == actual_level || !real_level) {
- res = talloc_strdup(NULL, real_level);
- } else
- res = talloc_asprintf(NULL, mp_gtext("%s, but %s used"),
- req_level, real_level);
- talloc_free(req_level);
- talloc_free(real_level);
- *(char **)arg = res;
- return M_PROPERTY_OK;
- default:;
- return colormatrix_property_helper(prop, action, arg, mpctx);
}
+ char *res;
+ if (requested == MP_CSP_LEVELS_AUTO && real_level) {
+ res = talloc_asprintf(NULL, "Auto (%s)", real_level);
+ } else if (requested == actual_level || !real_level) {
+ res = talloc_strdup(NULL, real_level);
+ } else
+ res = talloc_asprintf(NULL, mp_gtext("%s, but %s used"),
+ req_level, real_level);
+ talloc_free(req_level);
+ talloc_free(real_level);
+ *(char **)arg = res;
+ return M_PROPERTY_OK;
}
static int mp_property_colormatrix_input_range(m_option_t *prop, int action,
@@ -1210,27 +977,10 @@ static int mp_property_panscan(m_option_t *prop, int action, void *arg,
|| vo_control(mpctx->video_out, VOCTRL_GET_PANSCAN, NULL) != VO_TRUE)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(float *) arg);
- vo_panscan = *(float *) arg;
- vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
- return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- vo_panscan += (arg ? *(float *) arg : 0.1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- if (vo_panscan > 1)
- vo_panscan = 1;
- else if (vo_panscan < 0)
- vo_panscan = 0;
+ int r = mp_property_generic_option(prop, action, arg, mpctx);
+ if (action == M_PROPERTY_SET)
vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
- return M_PROPERTY_OK;
- default:
- return m_property_float_range(prop, action, arg, &vo_panscan);
- }
+ return r;
}
/// Helper to set vo flags.
@@ -1243,21 +993,14 @@ static int mp_property_vo_flag(m_option_t *prop, int action, void *arg,
if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *) arg);
+ if (action == M_PROPERTY_SET) {
if (*vo_var == !!*(int *) arg)
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
if (mpctx->video_out->config_ok)
vo_control(mpctx->video_out, vo_ctrl, 0);
return M_PROPERTY_OK;
- default:
- return m_property_flag(prop, action, arg, vo_var);
}
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
/// Window always on top (RW)
@@ -1284,26 +1027,13 @@ static int mp_property_border(m_option_t *prop, int action, void *arg,
&vo_border, mpctx);
}
-/// Framedropping state (RW)
-static int mp_property_framedropping(m_option_t *prop, int action,
+static int mp_property_framedrop(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
{
-
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
- *(char **) arg = talloc_strdup(NULL, frame_dropping == 1 ?
- mp_gtext("enabled") :
- (frame_dropping == 2 ? mp_gtext("hard") :
- mp_gtext("disabled")));
- return M_PROPERTY_OK;
- default:
- return m_property_choice(prop, action, arg, &frame_dropping);
- }
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
/// Color settings, try to use vf/vo then fall back on TV. (RW)
@@ -1323,9 +1053,6 @@ static int mp_property_gamma(m_option_t *prop, int action, void *arg,
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *) arg);
*gamma = *(int *) arg;
r = set_video_colors(mpctx->sh_video, prop->name, *gamma);
if (r <= 0)
@@ -1333,30 +1060,19 @@ static int mp_property_gamma(m_option_t *prop, int action, void *arg,
return r;
case M_PROPERTY_GET:
if (get_video_colors(mpctx->sh_video, prop->name, &val) > 0) {
- if (!arg)
- return M_PROPERTY_ERROR;
*(int *)arg = val;
return M_PROPERTY_OK;
}
break;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- *gamma += (arg ? *(int *) arg : 1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- M_PROPERTY_CLAMP(prop, *gamma);
- r = set_video_colors(mpctx->sh_video, prop->name, *gamma);
- if (r <= 0)
- break;
- return r;
default:
- return M_PROPERTY_NOT_IMPLEMENTED;
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
#ifdef CONFIG_TV
if (mpctx->sh_video->gsh->demuxer->type == DEMUXER_TYPE_TV) {
int l = strlen(prop->name);
char tv_prop[3 + l + 1];
- sprintf(tv_prop, "tv_%s", prop->name);
+ sprintf(tv_prop, "tv-%s", prop->name);
return mp_property_do(tv_prop, action, arg, mpctx);
}
#endif
@@ -1368,7 +1084,7 @@ static int mp_property_gamma(m_option_t *prop, int action, void *arg,
static int mp_property_vsync(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- return m_property_flag(prop, action, arg, &vo_vsync);
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
/// Video codec tag (RO)
@@ -1380,8 +1096,6 @@ static int mp_property_video_format(m_option_t *prop, int action,
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
switch (mpctx->sh_video->format) {
case 0x10000001:
meta = talloc_strdup(NULL, "mpeg1");
@@ -1404,8 +1118,11 @@ static int mp_property_video_format(m_option_t *prop, int action,
}
*(char **)arg = meta;
return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ *(int *)arg = mpctx->sh_video->format;
+ return M_PROPERTY_OK;
}
- return m_property_int_ro(prop, action, arg, mpctx->sh_video->format);
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Video codec name (RO)
@@ -1414,8 +1131,11 @@ static int mp_property_video_codec(m_option_t *prop, int action,
{
if (!mpctx->sh_video || !mpctx->sh_video->codec)
return M_PROPERTY_UNAVAILABLE;
- return m_property_string_ro(prop, action, arg,
- mpctx->sh_video->codec->name);
+ if (action == M_PROPERTY_GET) {
+ *(char **)arg = talloc_strdup(NULL, mpctx->sh_video->codec->name);
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -1425,7 +1145,11 @@ static int mp_property_video_bitrate(m_option_t *prop, int action,
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
- return m_property_bitrate(prop, action, arg, mpctx->sh_video->i_bps);
+ if (action == M_PROPERTY_PRINT) {
+ *(char **)arg = format_bitrate(mpctx->sh_video->i_bps);
+ return M_PROPERTY_OK;
+ }
+ return m_property_int_ro(prop, action, arg, mpctx->sh_video->i_bps);
}
/// Video display width (RO)
@@ -1461,24 +1185,33 @@ static int mp_property_aspect(m_option_t *prop, int action, void *arg,
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
- return m_property_float_ro(prop, action, arg, mpctx->sh_video->aspect);
+ switch (action) {
+ case M_PROPERTY_SET: {
+ float f = *(float *)arg;
+ if (f < 0.1)
+ f = (float)mpctx->sh_video->disp_w / mpctx->sh_video->disp_h;
+ mpctx->opts.movie_aspect = f;
+ video_reset_aspect(mpctx->sh_video);
+ return M_PROPERTY_OK;
+ }
+ case M_PROPERTY_GET:
+ *(float *)arg = mpctx->sh_video->aspect;
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
-
-/// Text subtitle position (RW)
-static int mp_property_sub_pos(m_option_t *prop, int action, void *arg,
+// For subtitle related properties using the generic option bridge.
+// - Fail as unavailable if no video is active
+// - Trigger OSD state update when property is set
+static int property_sub_helper(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
+ if (!mpctx->sh_video)
+ return M_PROPERTY_UNAVAILABLE;
+ if (action == M_PROPERTY_SET)
vo_osd_changed(OSDTYPE_SUBTITLE);
- default:
- return m_property_int_range(prop, action, arg, &sub_pos);
- }
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
/// Selected subtitles (RW)
@@ -1494,74 +1227,49 @@ static int mp_property_sub_delay(m_option_t *prop, int action, void *arg,
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
- return m_property_delay(prop, action, arg, &sub_delay);
-}
-
-/// Subtitle visibility (RW)
-static int mp_property_sub_visibility(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
-{
- struct MPOpts *opts = &mpctx->opts;
-
- if (!mpctx->sh_video)
- return M_PROPERTY_UNAVAILABLE;
-
switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- vo_osd_changed(OSDTYPE_SUBTITLE);
- if (vo_spudec)
- vo_osd_changed(OSDTYPE_SPU);
- default:
- return m_property_flag(prop, action, arg, &opts->sub_visibility);
+ case M_PROPERTY_PRINT:
+ *(char **)arg = format_delay(sub_delay);
+ return M_PROPERTY_OK;
}
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
-#ifdef CONFIG_ASS
-/// Use margins for libass subtitles (RW)
-static int mp_property_ass_use_margins(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
+static int mp_property_sub_pos(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
- struct MPOpts *opts = &mpctx->opts;
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
-
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- vo_osd_changed(OSDTYPE_SUBTITLE);
- default:
- return m_property_flag(prop, action, arg, &opts->ass_use_margins);
+ if (action == M_PROPERTY_PRINT) {
+ *(char **)arg = talloc_asprintf(NULL, "%d/100", sub_pos);
+ return M_PROPERTY_OK;
}
+ return property_sub_helper(prop, action, arg, mpctx);
}
-static int mp_property_ass_vsfilter_aspect_compat(m_option_t *prop, int action,
- void *arg, MPContext *mpctx)
+/// Subtitle visibility (RW)
+static int mp_property_sub_visibility(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
+
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
+ opts->sub_visibility = *(int *)arg;
vo_osd_changed(OSDTYPE_SUBTITLE);
- default:
- return m_property_flag(prop, action, arg,
- &mpctx->opts.ass_vsfilter_aspect_compat);
+ if (vo_spudec)
+ vo_osd_changed(OSDTYPE_SPU);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ *(int *)arg = opts->sub_visibility;
+ return M_PROPERTY_OK;
}
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
-#endif
-
/// Show only forced subtitles (RW)
static int mp_property_sub_forced_only(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
@@ -1569,19 +1277,12 @@ static int mp_property_sub_forced_only(m_option_t *prop, int action,
if (!vo_spudec)
return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- m_property_flag(prop, action, arg, &forced_subs_only);
+ if (action == M_PROPERTY_SET) {
+ forced_subs_only = *(int *)arg;
spudec_set_forced_subs_only(vo_spudec, forced_subs_only);
return M_PROPERTY_OK;
- default:
- return m_property_flag(prop, action, arg, &forced_subs_only);
}
-
+ return mp_property_generic_option(prop, action, arg, mpctx);
}
/// Subtitle scale (RW)
@@ -1590,36 +1291,20 @@ static int mp_property_sub_scale(m_option_t *prop, int action, void *arg,
{
struct MPOpts *opts = &mpctx->opts;
+ float *pscale = opts->ass_enabled
+ ? &opts->ass_font_scale : &text_font_scale_factor;
+
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(float *) arg);
- if (opts->ass_enabled)
- opts->ass_font_scale = *(float *) arg;
- text_font_scale_factor = *(float *) arg;
+ *pscale = *(float *) arg;
vo_osd_changed(OSDTYPE_SUBTITLE);
vo_osd_changed(OSDTYPE_OSD);
return M_PROPERTY_OK;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- if (opts->ass_enabled) {
- opts->ass_font_scale += (arg ? *(float *) arg : 0.1) *
- (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
- M_PROPERTY_CLAMP(prop, opts->ass_font_scale);
- }
- text_font_scale_factor += (arg ? *(float *) arg : 0.1) *
- (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
- M_PROPERTY_CLAMP(prop, text_font_scale_factor);
- vo_osd_changed(OSDTYPE_SUBTITLE);
- vo_osd_changed(OSDTYPE_OSD);
+ case M_PROPERTY_GET:
+ *(float *)arg = *pscale;
return M_PROPERTY_OK;
- default:
- if (opts->ass_enabled)
- return m_property_float_ro(prop, action, arg, opts->ass_font_scale);
- else
- return m_property_float_ro(prop, action, arg, text_font_scale_factor);
}
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
@@ -1636,73 +1321,69 @@ static tvi_handle_t *get_tvh(struct MPContext *mpctx)
static int mp_property_tv_color(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- int r, val;
tvi_handle_t *tvh = get_tvh(mpctx);
if (!tvh)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_SET:
- if (!arg)
- return M_PROPERTY_ERROR;
- M_PROPERTY_CLAMP(prop, *(int *) arg);
return tv_set_color_options(tvh, prop->offset, *(int *) arg);
case M_PROPERTY_GET:
return tv_get_color_options(tvh, prop->offset, arg);
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- if ((r = tv_get_color_options(tvh, prop->offset, &val)) >= 0) {
- if (!r)
- return M_PROPERTY_ERROR;
- val += (arg ? *(int *) arg : 1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- M_PROPERTY_CLAMP(prop, val);
- return tv_set_color_options(tvh, prop->offset, val);
- }
- return M_PROPERTY_ERROR;
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
#endif
+// Use option-to-property-bridge. (The property and option have the same names.)
+#define M_OPTION_PROPERTY(name) \
+ {(name), mp_property_generic_option, &m_option_type_dummy, 0, 0, 0, (name)}
+
+// OPTION_PROPERTY(), but with a custom property handler. The custom handler
+// must let unknown operations fall back to mp_property_generic_option().
+#define M_OPTION_PROPERTY_CUSTOM(name, handler) \
+ {(name), (handler), &m_option_type_dummy, 0, 0, 0, (name)}
+#define M_OPTION_PROPERTY_CUSTOM_(name, handler, ...) \
+ {(name), (handler), &m_option_type_dummy, 0, 0, 0, (name), __VA_ARGS__}
+
/// All properties available in MPlayer.
/** \ingroup Properties
*/
static const m_option_t mp_properties[] = {
// General
- { "osdlevel", mp_property_osdlevel, CONF_TYPE_INT,
- M_OPT_RANGE, 0, 3, NULL },
- { "loop", mp_property_loop, &m_option_type_choice,
- 0, 0, 0, "loop" },
- { "speed", mp_property_playback_speed, CONF_TYPE_FLOAT,
- M_OPT_RANGE, 0.01, 100.0, NULL },
+ M_OPTION_PROPERTY("osd-level"),
+ M_OPTION_PROPERTY("loop"),
+ M_OPTION_PROPERTY_CUSTOM("speed", mp_property_playback_speed),
{ "filename", mp_property_filename, CONF_TYPE_STRING,
0, 0, 0, NULL },
{ "path", mp_property_path, CONF_TYPE_STRING,
0, 0, 0, NULL },
+ { "media-title", mp_property_media_title, CONF_TYPE_STRING,
+ 0, 0, 0, NULL },
+ { "stream-path", mp_property_stream_path, CONF_TYPE_STRING,
+ 0, 0, 0, NULL },
{ "demuxer", mp_property_demuxer, CONF_TYPE_STRING,
0, 0, 0, NULL },
- { "stream_pos", mp_property_stream_pos, CONF_TYPE_POSITION,
+ { "stream-pos", mp_property_stream_pos, CONF_TYPE_INT64,
M_OPT_MIN, 0, 0, NULL },
- { "stream_start", mp_property_stream_start, CONF_TYPE_POSITION,
+ { "stream-start", mp_property_stream_start, CONF_TYPE_INT64,
M_OPT_MIN, 0, 0, NULL },
- { "stream_end", mp_property_stream_end, CONF_TYPE_POSITION,
+ { "stream-end", mp_property_stream_end, CONF_TYPE_INT64,
M_OPT_MIN, 0, 0, NULL },
- { "stream_length", mp_property_stream_length, CONF_TYPE_POSITION,
+ { "stream-length", mp_property_stream_length, CONF_TYPE_INT64,
M_OPT_MIN, 0, 0, NULL },
- { "stream_time_pos", mp_property_stream_time_pos, CONF_TYPE_TIME,
+ { "stream-time-pos", mp_property_stream_time_pos, CONF_TYPE_TIME,
M_OPT_MIN, 0, 0, NULL },
{ "length", mp_property_length, CONF_TYPE_TIME,
M_OPT_MIN, 0, 0, NULL },
- { "percent_pos", mp_property_percent_pos, CONF_TYPE_INT,
+ { "percent-pos", mp_property_percent_pos, CONF_TYPE_INT,
M_OPT_RANGE, 0, 100, NULL },
- { "time_pos", mp_property_time_pos, CONF_TYPE_TIME,
+ { "time-pos", mp_property_time_pos, CONF_TYPE_TIME,
M_OPT_MIN, 0, 0, NULL },
{ "chapter", mp_property_chapter, CONF_TYPE_INT,
M_OPT_MIN, 0, 0, NULL },
- { "edition", mp_property_edition, CONF_TYPE_INT,
- M_OPT_MIN, -1, 0, NULL },
+ M_OPTION_PROPERTY_CUSTOM("edition", mp_property_edition),
{ "titles", mp_property_titles, CONF_TYPE_INT,
0, 0, 0, NULL },
{ "chapters", mp_property_chapters, CONF_TYPE_INT,
@@ -1714,71 +1395,60 @@ static const m_option_t mp_properties[] = {
0, 0, 0, NULL },
{ "pause", mp_property_pause, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
- { "pts_association_mode", mp_property_generic_option, &m_option_type_choice,
- 0, 0, 0, "pts-association-mode" },
- { "hr_seek", mp_property_generic_option, &m_option_type_choice,
- 0, 0, 0, "hr-seek" },
+ M_OPTION_PROPERTY("pts-association-mode"),
+ M_OPTION_PROPERTY("hr-seek"),
// Audio
{ "volume", mp_property_volume, CONF_TYPE_FLOAT,
M_OPT_RANGE, 0, 100, NULL },
{ "mute", mp_property_mute, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
- { "audio_delay", mp_property_audio_delay, CONF_TYPE_FLOAT,
- M_OPT_RANGE, -100, 100, NULL },
- { "audio_format", mp_property_audio_format, CONF_TYPE_INT,
+ M_OPTION_PROPERTY_CUSTOM("audio-delay", mp_property_audio_delay),
+ { "audio-format", mp_property_audio_format, CONF_TYPE_INT,
0, 0, 0, NULL },
- { "audio_codec", mp_property_audio_codec, CONF_TYPE_STRING,
+ { "audio-codec", mp_property_audio_codec, CONF_TYPE_STRING,
0, 0, 0, NULL },
- { "audio_bitrate", mp_property_audio_bitrate, CONF_TYPE_INT,
+ { "audio-bitrate", mp_property_audio_bitrate, CONF_TYPE_INT,
0, 0, 0, NULL },
{ "samplerate", mp_property_samplerate, CONF_TYPE_INT,
0, 0, 0, NULL },
{ "channels", mp_property_channels, CONF_TYPE_INT,
0, 0, 0, NULL },
- { "switch_audio", mp_property_audio, CONF_TYPE_INT,
+ { "audio", mp_property_audio, CONF_TYPE_INT,
CONF_RANGE, -2, 65535, NULL },
{ "balance", mp_property_balance, CONF_TYPE_FLOAT,
M_OPT_RANGE, -1, 1, NULL },
// Video
- { "fullscreen", mp_property_fullscreen, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
+ M_OPTION_PROPERTY_CUSTOM("fullscreen", mp_property_fullscreen),
{ "deinterlace", mp_property_deinterlace, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
- { "colormatrix", mp_property_colormatrix, &m_option_type_choice,
- 0, 0, 0, "colormatrix" },
- { "colormatrix_input_range", mp_property_colormatrix_input_range, &m_option_type_choice,
- 0, 0, 0, "colormatrix-input-range" },
- { "colormatrix_output_range", mp_property_colormatrix_output_range, &m_option_type_choice,
- 0, 0, 0, "colormatrix-output-range" },
- { "ontop", mp_property_ontop, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
- { "rootwin", mp_property_rootwin, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
- { "border", mp_property_border, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
- { "framedropping", mp_property_framedropping, CONF_TYPE_INT,
- M_OPT_RANGE, 0, 2, NULL },
- { "gamma", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, .offset = offsetof(struct MPOpts, vo_gamma_gamma)},
- { "brightness", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, .offset = offsetof(struct MPOpts, vo_gamma_brightness) },
- { "contrast", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, .offset = offsetof(struct MPOpts, vo_gamma_contrast) },
- { "saturation", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, .offset = offsetof(struct MPOpts, vo_gamma_saturation) },
- { "hue", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, .offset = offsetof(struct MPOpts, vo_gamma_hue) },
- { "panscan", mp_property_panscan, CONF_TYPE_FLOAT,
- M_OPT_RANGE, 0, 1, NULL },
- { "vsync", mp_property_vsync, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
- { "video_format", mp_property_video_format, CONF_TYPE_INT,
+ M_OPTION_PROPERTY_CUSTOM("colormatrix", mp_property_colormatrix),
+ M_OPTION_PROPERTY_CUSTOM("colormatrix-input-range",
+ mp_property_colormatrix_input_range),
+ M_OPTION_PROPERTY_CUSTOM("colormatrix-output-range",
+ mp_property_colormatrix_output_range),
+ M_OPTION_PROPERTY_CUSTOM("ontop", mp_property_ontop),
+ M_OPTION_PROPERTY_CUSTOM("rootwin", mp_property_rootwin),
+ M_OPTION_PROPERTY_CUSTOM("border", mp_property_border),
+ M_OPTION_PROPERTY_CUSTOM("framedrop", mp_property_framedrop),
+ M_OPTION_PROPERTY_CUSTOM_("gamma", mp_property_gamma,
+ .offset = offsetof(struct MPOpts, vo_gamma_gamma)),
+ M_OPTION_PROPERTY_CUSTOM_("brightness", mp_property_gamma,
+ .offset = offsetof(struct MPOpts, vo_gamma_brightness)),
+ M_OPTION_PROPERTY_CUSTOM_("contrast", mp_property_gamma,
+ .offset = offsetof(struct MPOpts, vo_gamma_contrast)),
+ M_OPTION_PROPERTY_CUSTOM_("saturation", mp_property_gamma,
+ .offset = offsetof(struct MPOpts, vo_gamma_saturation)),
+ M_OPTION_PROPERTY_CUSTOM_("hue", mp_property_gamma,
+ .offset = offsetof(struct MPOpts, vo_gamma_hue)),
+ M_OPTION_PROPERTY_CUSTOM("panscan", mp_property_panscan),
+ M_OPTION_PROPERTY_CUSTOM_("vsync", mp_property_vsync),
+ { "video-format", mp_property_video_format, CONF_TYPE_INT,
0, 0, 0, NULL },
- { "video_codec", mp_property_video_codec, CONF_TYPE_STRING,
+ { "video-codec", mp_property_video_codec, CONF_TYPE_STRING,
0, 0, 0, NULL },
- { "video_bitrate", mp_property_video_bitrate, CONF_TYPE_INT,
+ { "video-bitrate", mp_property_video_bitrate, CONF_TYPE_INT,
0, 0, 0, NULL },
{ "width", mp_property_width, CONF_TYPE_INT,
0, 0, 0, NULL },
@@ -1787,53 +1457,49 @@ static const m_option_t mp_properties[] = {
{ "fps", mp_property_fps, CONF_TYPE_FLOAT,
0, 0, 0, NULL },
{ "aspect", mp_property_aspect, CONF_TYPE_FLOAT,
- 0, 0, 0, NULL },
- { "switch_video", mp_property_video, CONF_TYPE_INT,
+ CONF_RANGE, 0, 10, NULL },
+ { "video", mp_property_video, CONF_TYPE_INT,
CONF_RANGE, -2, 65535, NULL },
- { "switch_program", mp_property_program, CONF_TYPE_INT,
+ { "program", mp_property_program, CONF_TYPE_INT,
CONF_RANGE, -1, 65535, NULL },
// Subs
{ "sub", mp_property_sub, CONF_TYPE_INT,
M_OPT_MIN, -1, 0, NULL },
- { "sub_delay", mp_property_sub_delay, CONF_TYPE_FLOAT,
- 0, 0, 0, NULL },
- { "sub_pos", mp_property_sub_pos, CONF_TYPE_INT,
- M_OPT_RANGE, 0, 100, NULL },
- { "sub_visibility", mp_property_sub_visibility, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
- { "sub_forced_only", mp_property_sub_forced_only, CONF_TYPE_FLAG,
+ M_OPTION_PROPERTY_CUSTOM("sub-delay", mp_property_sub_delay),
+ M_OPTION_PROPERTY_CUSTOM("sub-pos", mp_property_sub_pos),
+ { "sub-visibility", mp_property_sub_visibility, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
- { "sub_scale", mp_property_sub_scale, CONF_TYPE_FLOAT,
+ M_OPTION_PROPERTY_CUSTOM("sub-forced-only", mp_property_sub_forced_only),
+ { "sub-scale", mp_property_sub_scale, CONF_TYPE_FLOAT,
M_OPT_RANGE, 0, 100, NULL },
#ifdef CONFIG_ASS
- { "ass_use_margins", mp_property_ass_use_margins, CONF_TYPE_FLAG,
- M_OPT_RANGE, 0, 1, NULL },
- { "ass_vsfilter_aspect_compat", mp_property_ass_vsfilter_aspect_compat,
- CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL },
+ M_OPTION_PROPERTY_CUSTOM("ass-use-margins", property_sub_helper),
+ M_OPTION_PROPERTY_CUSTOM("ass-vsfilter-aspect-compat", property_sub_helper),
+ M_OPTION_PROPERTY_CUSTOM("ass-style-override", property_sub_helper),
#endif
#ifdef CONFIG_TV
- { "tv_brightness", mp_property_tv_color, CONF_TYPE_INT,
+ { "tv-brightness", mp_property_tv_color, CONF_TYPE_INT,
M_OPT_RANGE, -100, 100, .offset = TV_COLOR_BRIGHTNESS },
- { "tv_contrast", mp_property_tv_color, CONF_TYPE_INT,
+ { "tv-contrast", mp_property_tv_color, CONF_TYPE_INT,
M_OPT_RANGE, -100, 100, .offset = TV_COLOR_CONTRAST },
- { "tv_saturation", mp_property_tv_color, CONF_TYPE_INT,
+ { "tv-saturation", mp_property_tv_color, CONF_TYPE_INT,
M_OPT_RANGE, -100, 100, .offset = TV_COLOR_SATURATION },
- { "tv_hue", mp_property_tv_color, CONF_TYPE_INT,
+ { "tv-hue", mp_property_tv_color, CONF_TYPE_INT,
M_OPT_RANGE, -100, 100, .offset = TV_COLOR_HUE },
#endif
{0},
};
-
-int mp_property_do(const char *name, int action, void *val, void *ctx)
+int mp_property_do(const char *name, int action, void *val,
+ struct MPContext *ctx)
{
return m_property_do(mp_properties, name, action, val, ctx);
}
-char *mp_property_print(const char *name, void *ctx)
+char *mp_property_print(const char *name, struct MPContext *ctx)
{
char *ret = NULL;
if (mp_property_do(name, M_PROPERTY_PRINT, &ret, ctx) <= 0)
@@ -1841,7 +1507,7 @@ char *mp_property_print(const char *name, void *ctx)
return ret;
}
-char *property_expand_string(MPContext *mpctx, char *str)
+char *mp_property_expand_string(struct MPContext *mpctx, char *str)
{
return m_properties_expand_string(mp_properties, str, mpctx);
}
@@ -1854,227 +1520,140 @@ void property_print_help(void)
/* List of default ways to show a property on OSD.
*
- * Setting osd_progbar to -1 displays seek bar, other nonzero displays
- * a bar showing the current position between min/max values of the
- * property. In this case osd_msg is only used for terminal output
- * if there is no video; it'll be a label shown together with percentage.
- *
- * Otherwise setting osd_msg will show the string on OSD, formatted with
- * the text value of the property as argument.
+ * If osd_progbar is set, a bar showing the current position between min/max
+ * values of the property is shown. In this case osd_msg is only used for
+ * terminal output if there is no video; it'll be a label shown together with
+ * percentage.
*/
static struct property_osd_display {
- /// property name
+ // property name
const char *name;
- /// progressbar type
- int osd_progbar; // -1 is special value for seek indicators
- /// osd msg id if it must be shared
+ // name used on OSD
+ const char *osd_name;
+ // progressbar type
+ int osd_progbar;
+ // osd msg id if it must be shared
int osd_id;
- /// osd msg template
- const char *osd_msg;
+ // Needs special ways to display the new value (seeks are delayed)
+ int seek_msg, seek_bar;
} property_osd_display[] = {
// general
- { "loop", 0, -1, _("Loop: %s") },
- { "chapter", -1, -1, NULL },
- { "pts_association_mode", 0, -1, "PTS association mode: %s" },
- { "hr_seek", 0, -1, "hr-seek: %s" },
- { "speed", 0, -1, _("Speed: x %6s") },
+ { "loop", _("Loop") },
+ { "chapter", .seek_msg = OSD_SEEK_INFO_CHAPTER_TEXT,
+ .seek_bar = OSD_SEEK_INFO_BAR },
+ { "edition", .seek_msg = OSD_SEEK_INFO_EDITION },
+ { "pts-association-mode", "PTS association mode" },
+ { "hr-seek", "hr-seek" },
+ { "speed", _("Speed") },
// audio
- { "volume", OSD_VOLUME, -1, _("Volume") },
- { "mute", 0, -1, _("Mute: %s") },
- { "audio_delay", 0, -1, _("A-V delay: %s") },
- { "switch_audio", 0, -1, _("Audio: %s") },
- { "balance", OSD_BALANCE, -1, _("Balance") },
+ { "volume", _("Volume"), .osd_progbar = OSD_VOLUME },
+ { "mute", _("Mute") },
+ { "audio-delay", _("A-V delay") },
+ { "audio", _("Audio") },
+ { "balance", _("Balance"), .osd_progbar = OSD_BALANCE },
// video
- { "panscan", OSD_PANSCAN, -1, _("Panscan") },
- { "ontop", 0, -1, _("Stay on top: %s") },
- { "rootwin", 0, -1, _("Rootwin: %s") },
- { "border", 0, -1, _("Border: %s") },
- { "framedropping", 0, -1, _("Framedropping: %s") },
- { "deinterlace", 0, -1, _("Deinterlace: %s") },
- { "colormatrix", 0, -1, _("YUV colormatrix: %s") },
- { "colormatrix_input_range", 0, -1, _("YUV input range: %s") },
- { "colormatrix_output_range", 0, -1, _("RGB output range: %s") },
- { "gamma", OSD_BRIGHTNESS, -1, _("Gamma") },
- { "brightness", OSD_BRIGHTNESS, -1, _("Brightness") },
- { "contrast", OSD_CONTRAST, -1, _("Contrast") },
- { "saturation", OSD_SATURATION, -1, _("Saturation") },
- { "hue", OSD_HUE, -1, _("Hue") },
- { "vsync", 0, -1, _("VSync: %s") },
+ { "panscan", _("Panscan"), .osd_progbar = OSD_PANSCAN },
+ { "ontop", _("Stay on top") },
+ { "rootwin", _("Rootwin") },
+ { "border", _("Border") },
+ { "framedrop", _("Framedrop") },
+ { "deinterlace", _("Deinterlace") },
+ { "colormatrix", _("YUV colormatrix") },
+ { "colormatrix-input-range", _("YUV input range") },
+ { "colormatrix-output-range", _("RGB output range") },
+ { "gamma", _("Gamma"), .osd_progbar = OSD_BRIGHTNESS },
+ { "brightness", _("Brightness"), .osd_progbar = OSD_BRIGHTNESS },
+ { "contrast", _("Contrast"), .osd_progbar = OSD_CONTRAST },
+ { "saturation", _("Saturation"), .osd_progbar = OSD_SATURATION },
+ { "hue", _("Hue"), .osd_progbar = OSD_HUE },
+ { "vsync", _("VSync") },
+ { "angle", _("Angle") },
// subs
- { "sub", 0, -1, _("Subtitles: %s") },
- { "sub_pos", 0, -1, _("Sub position: %s/100") },
- { "sub_delay", 0, OSD_MSG_SUB_DELAY, _("Sub delay: %s") },
- { "sub_visibility", 0, -1, _("Subtitles: %s") },
- { "sub_forced_only", 0, -1, _("Forced sub only: %s") },
- { "sub_scale", 0, -1, _("Sub Scale: %s")},
- { "ass_vsfilter_aspect_compat", 0, -1,
- _("Subtitle VSFilter aspect compat: %s")},
+ { "sub", _("Subtitles") },
+ { "sub-pos", _("Sub position") },
+ { "sub-delay", _("Sub delay"), .osd_id = OSD_MSG_SUB_DELAY },
+ { "sub-visibility", _("Subtitles") },
+ { "sub-forced-only", _("Forced sub only") },
+ { "sub-scale", _("Sub Scale")},
+ { "ass-vsfilter-aspect-compat", _("Subtitle VSFilter aspect compat")},
+ { "ass-style-override", _("ASS subtitle style override")},
#ifdef CONFIG_TV
- { "tv_brightness", OSD_BRIGHTNESS, -1, _("Brightness") },
- { "tv_hue", OSD_HUE, -1, _("Hue") },
- { "tv_saturation", OSD_SATURATION, -1, _("Saturation") },
- { "tv_contrast", OSD_CONTRAST, -1, _("Contrast") },
+ { "tv-brightness", _("Brightness"), .osd_progbar = OSD_BRIGHTNESS },
+ { "tv-hue", _("Hue"), .osd_progbar = OSD_HUE},
+ { "tv-saturation", _("Saturation"), .osd_progbar = OSD_SATURATION },
+ { "tv-contrast", _("Contrast"), .osd_progbar = OSD_CONTRAST },
#endif
- {}
+ {0}
};
-static int show_property_osd(MPContext *mpctx, const char *pname)
+static void show_property_osd(MPContext *mpctx, const char *pname,
+ enum mp_on_osd osd_mode)
{
struct MPOpts *opts = &mpctx->opts;
- int r;
- m_option_t *prop;
+ struct m_option prop = {0};
struct property_osd_display *p;
+ if (mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0)
+ return;
+
+ int osd_progbar = 0;
+ const char *osd_name = NULL;
+
// look for the command
- for (p = property_osd_display; p->name; p++)
- if (!strcmp(p->name, pname))
+ for (p = property_osd_display; p->name; p++) {
+ if (!strcmp(p->name, prop.name)) {
+ osd_progbar = p->seek_bar ? 1 : p->osd_progbar;
+ osd_name = p->seek_msg ? "" : mp_gtext(p->osd_name);
break;
-
+ }
+ }
if (!p->name)
- return -1;
-
- if (mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0 || !prop)
- return -1;
-
- if (p->osd_progbar == -1)
- mpctx->add_osd_seek_info = true;
- else if (p->osd_progbar) {
- if (prop->type == CONF_TYPE_INT) {
- if (mp_property_do(pname, M_PROPERTY_GET, &r, mpctx) > 0)
- set_osd_bar(mpctx, p->osd_progbar, mp_gtext(p->osd_msg),
- prop->min, prop->max, r);
- } else if (prop->type == CONF_TYPE_FLOAT) {
+ p = NULL;
+
+ if (osd_mode != MP_ON_OSD_AUTO) {
+ osd_name = osd_name ? osd_name : prop.name;
+ if (!(osd_mode & MP_ON_OSD_MSG))
+ osd_name = NULL;
+ osd_progbar = osd_progbar ? osd_progbar : ' ';
+ if (!(osd_mode & MP_ON_OSD_BAR))
+ osd_progbar = 0;
+ }
+
+ if (p && (p->seek_msg || p->seek_bar)) {
+ mpctx->add_osd_seek_info |=
+ (osd_name ? p->seek_msg : 0) | (osd_progbar ? p->seek_bar : 0);
+ return;
+ }
+
+ if (osd_progbar && (prop.flags & CONF_RANGE) == CONF_RANGE) {
+ if (prop.type == CONF_TYPE_INT) {
+ int i;
+ if (mp_property_do(prop.name, M_PROPERTY_GET, &i, mpctx) > 0)
+ set_osd_bar(mpctx, osd_progbar, osd_name,
+ prop.min, prop.max, i);
+ } else if (prop.type == CONF_TYPE_FLOAT) {
float f;
- if (mp_property_do(pname, M_PROPERTY_GET, &f, mpctx) > 0)
- set_osd_bar(mpctx, p->osd_progbar, mp_gtext(p->osd_msg),
- prop->min, prop->max, f);
- } else {
- mp_msg(MSGT_CPLAYER, MSGL_ERR,
- "Property use an unsupported type.\n");
- return -1;
+ if (mp_property_do(prop.name, M_PROPERTY_GET, &f, mpctx) > 0)
+ set_osd_bar(mpctx, osd_progbar, osd_name,
+ prop.min, prop.max, f);
}
- return 0;
+ if (osd_mode == MP_ON_OSD_AUTO)
+ return;
}
- if (p->osd_msg) {
- char *val = mp_property_print(pname, mpctx);
+ if (osd_name) {
+ char *val = mp_property_print(prop.name, mpctx);
if (val) {
- int index = p - property_osd_display;
- set_osd_tmsg(mpctx, p->osd_id >= 0 ? p->osd_id : OSD_MSG_PROPERTY + index,
- 1, opts->osd_duration, p->osd_msg, val);
+ int osd_id = 0;
+ if (p) {
+ int index = p - property_osd_display;
+ osd_id = p->osd_id ? p->osd_id : OSD_MSG_PROPERTY + index;
+ }
+ set_osd_tmsg(mpctx, osd_id, 1, opts->osd_duration,
+ "%s: %s", osd_name, val);
talloc_free(val);
}
}
- return 0;
-}
-
-
-/**
- * Command to property bridge
- *
- * It is used to handle most commands that just set a property
- * and optionally display something on the OSD.
- * Two kinds of commands are handled: adjust or toggle.
- *
- * Adjust commands take 1 or 2 parameters: <value> <abs>
- * If <abs> is non-zero the property is set to the given value
- * otherwise it is adjusted.
- *
- * Toggle commands take 0 or 1 parameters. With no parameter
- * or a value less than the property minimum it just steps the
- * property to its next or previous value respectively.
- * Otherwise it sets it to the given value.
- */
-
-/// List of the commands that can be handled by setting a property.
-static struct {
- /// property name
- const char *name;
- /// cmd id
- int cmd;
- /// set/adjust or toggle command
- int toggle;
-} set_prop_cmd[] = {
- // general
- { "loop", MP_CMD_LOOP, 0},
- { "chapter", MP_CMD_SEEK_CHAPTER, 0},
- { "angle", MP_CMD_SWITCH_ANGLE, 0},
- { "pause", MP_CMD_PAUSE, 0},
- // audio
- { "volume", MP_CMD_VOLUME, 0},
- { "mute", MP_CMD_MUTE, 1},
- { "audio_delay", MP_CMD_AUDIO_DELAY, 0},
- { "switch_audio", MP_CMD_SWITCH_AUDIO, 1},
- { "balance", MP_CMD_BALANCE, 0},
- // video
- { "fullscreen", MP_CMD_VO_FULLSCREEN, 1},
- { "panscan", MP_CMD_PANSCAN, 0},
- { "ontop", MP_CMD_VO_ONTOP, 1},
- { "rootwin", MP_CMD_VO_ROOTWIN, 1},
- { "border", MP_CMD_VO_BORDER, 1},
- { "framedropping", MP_CMD_FRAMEDROPPING, 1},
- { "gamma", MP_CMD_GAMMA, 0},
- { "brightness", MP_CMD_BRIGHTNESS, 0},
- { "contrast", MP_CMD_CONTRAST, 0},
- { "saturation", MP_CMD_SATURATION, 0},
- { "hue", MP_CMD_HUE, 0},
- { "vsync", MP_CMD_SWITCH_VSYNC, 1},
- // subs
- { "sub", MP_CMD_SUB_SELECT, 1},
- { "sub_pos", MP_CMD_SUB_POS, 0},
- { "sub_delay", MP_CMD_SUB_DELAY, 0},
- { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1},
- { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1},
- { "sub_scale", MP_CMD_SUB_SCALE, 0},
-#ifdef CONFIG_ASS
- { "ass_use_margins", MP_CMD_ASS_USE_MARGINS, 1},
-#endif
-#ifdef CONFIG_TV
- { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0},
- { "tv_hue", MP_CMD_TV_SET_HUE, 0},
- { "tv_saturation", MP_CMD_TV_SET_SATURATION, 0},
- { "tv_contrast", MP_CMD_TV_SET_CONTRAST, 0},
-#endif
- {}
-};
-
-/// Handle commands that set a property.
-static bool set_property_command(MPContext *mpctx, mp_cmd_t *cmd)
-{
- int i, r;
- m_option_t *prop;
- const char *pname;
-
- // look for the command
- for (i = 0; set_prop_cmd[i].name; i++)
- if (set_prop_cmd[i].cmd == cmd->id)
- break;
- if (!(pname = set_prop_cmd[i].name))
- return 0;
-
- if (mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0 || !prop)
- return 0;
-
- // toggle command
- if (set_prop_cmd[i].toggle) {
- // set to value
- if (cmd->nargs > 0 && cmd->args[0].v.i >= prop->min)
- r = mp_property_do(pname, M_PROPERTY_SET, &cmd->args[0].v.i, mpctx);
- else if (cmd->nargs > 0)
- r = mp_property_do(pname, M_PROPERTY_STEP_DOWN, NULL, mpctx);
- else
- r = mp_property_do(pname, M_PROPERTY_STEP_UP, NULL, mpctx);
- } else if (cmd->args[1].v.i) //set
- r = mp_property_do(pname, M_PROPERTY_SET, &cmd->args[0].v, mpctx);
- else // adjust
- r = mp_property_do(pname, M_PROPERTY_STEP_UP, &cmd->args[0].v, mpctx);
-
- if (r <= 0)
- return 1;
-
- show_property_osd(mpctx, pname);
-
- return 1;
}
static const char *property_error_string(int error_value)
@@ -2088,8 +1667,6 @@ static const char *property_error_string(int error_value)
return "NOT_IMPLEMENTED";
case M_PROPERTY_UNKNOWN:
return "PROPERTY_UNKNOWN";
- case M_PROPERTY_DISABLED:
- return "DISABLED";
}
return "UNKNOWN";
}
@@ -2178,34 +1755,37 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
sh_audio_t *const sh_audio = mpctx->sh_audio;
sh_video_t *const sh_video = mpctx->sh_video;
int osd_duration = opts->osd_duration;
- int case_fallthrough_hack = 0;
- if (set_property_command(mpctx, cmd))
- goto old_pause_hack; // was handled already
+ bool auto_osd = cmd->on_osd == MP_ON_OSD_AUTO;
+ bool msg_osd = auto_osd || (cmd->on_osd & MP_ON_OSD_MSG);
+ bool bar_osd = auto_osd || (cmd->on_osd & MP_ON_OSD_BAR);
+ int osdl = msg_osd ? 1 : OSD_LEVEL_INVISIBLE;
switch (cmd->id) {
case MP_CMD_SEEK: {
- mpctx->add_osd_seek_info = true;
float v = cmd->args[0].v.f;
int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
int exact = (cmd->nargs > 2) ? cmd->args[2].v.i : 0;
+ int function;
if (abs == 2) { // Absolute seek to a timestamp in seconds
queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact);
- mpctx->osd_function = v > get_current_time(mpctx) ?
- OSD_FFW : OSD_REW;
+ function = v > get_current_time(mpctx) ? OSD_FFW : OSD_REW;
} else if (abs) { /* Absolute seek by percentage */
queue_seek(mpctx, MPSEEK_FACTOR, v / 100.0, exact);
- mpctx->osd_function = OSD_FFW; // Direction isn't set correctly
+ function = OSD_FFW; // Direction isn't set correctly
} else {
queue_seek(mpctx, MPSEEK_RELATIVE, v, exact);
- mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW;
+ function = (v > 0) ? OSD_FFW : OSD_REW;
}
+ if (bar_osd)
+ mpctx->add_osd_seek_info |= OSD_SEEK_INFO_BAR;
+ if (msg_osd && !auto_osd)
+ mpctx->add_osd_seek_info |= OSD_SEEK_INFO_TEXT;
+ if (mpctx->add_osd_seek_info)
+ mpctx->osd_function = function;
break;
}
- case MP_CMD_SET_PROPERTY_OSD:
- case_fallthrough_hack = 1;
-
- case MP_CMD_SET_PROPERTY: {
- int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_PARSE,
+ case MP_CMD_SET: {
+ int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_SET_STRING,
cmd->args[1].v.s, mpctx);
if (r == M_PROPERTY_UNKNOWN)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
@@ -2214,67 +1794,36 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"Failed to set property '%s' to '%s'.\n",
cmd->args[0].v.s, cmd->args[1].v.s);
- else if (case_fallthrough_hack)
- show_property_osd(mpctx, cmd->args[0].v.s);
- if (r <= 0)
- mp_msg(MSGT_GLOBAL, MSGL_INFO,
- "ANS_ERROR=%s\n", property_error_string(r));
+ else
+ show_property_osd(mpctx, cmd->args[0].v.s, cmd->on_osd);
break;
}
- case MP_CMD_STEP_PROPERTY_OSD:
- case_fallthrough_hack = 1;
-
- case MP_CMD_STEP_PROPERTY: {
- void *arg = NULL;
- int r, i;
- double d;
- off_t o;
- if (cmd->args[1].v.f) {
- m_option_t *prop;
- if ((r = mp_property_do(cmd->args[0].v.s,
- M_PROPERTY_GET_TYPE,
- &prop, mpctx)) <= 0)
- goto step_prop_err;
- if (prop->type == CONF_TYPE_INT ||
- prop->type == CONF_TYPE_FLAG ||
- prop->type == &m_option_type_choice)
- i = cmd->args[1].v.f, arg = &i;
- else if (prop->type == CONF_TYPE_FLOAT)
- arg = &cmd->args[1].v.f;
- else if (prop->type == CONF_TYPE_DOUBLE ||
- prop->type == CONF_TYPE_TIME)
- d = cmd->args[1].v.f, arg = &d;
- else if (prop->type == CONF_TYPE_POSITION)
- o = cmd->args[1].v.f, arg = &o;
- else
- mp_msg(MSGT_CPLAYER, MSGL_WARN,
- "Ignoring step size stepping property '%s'.\n",
- cmd->args[0].v.s);
- }
- r = mp_property_do(cmd->args[0].v.s,
- cmd->args[2].v.i < 0 ?
- M_PROPERTY_STEP_DOWN : M_PROPERTY_STEP_UP,
- arg, mpctx);
- step_prop_err:
+ case MP_CMD_ADD:
+ case MP_CMD_CYCLE:
+ {
+ struct m_property_switch_arg s = {
+ .inc = 1,
+ .wrap = cmd->id == MP_CMD_CYCLE,
+ };
+ if (cmd->args[1].v.f)
+ s.inc = cmd->args[1].v.f;
+ int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_SWITCH, &s, mpctx);
if (r == M_PROPERTY_UNKNOWN)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"Unknown property: '%s'\n", cmd->args[0].v.s);
else if (r <= 0)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
- "Failed to increment property '%s' by %f.\n",
- cmd->args[0].v.s, cmd->args[1].v.f);
- else if (case_fallthrough_hack)
- show_property_osd(mpctx, cmd->args[0].v.s);
- if (r <= 0)
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n",
- property_error_string(r));
+ "Failed to increment property '%s' by %g.\n",
+ cmd->args[0].v.s, s.inc);
+ else
+ show_property_osd(mpctx, cmd->args[0].v.s, cmd->on_osd);
break;
}
case MP_CMD_GET_PROPERTY: {
char *tmp;
- int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_TO_STRING,
+ int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_GET_STRING,
&tmp, mpctx);
if (r <= 0) {
mp_msg(MSGT_CPLAYER, MSGL_WARN,
@@ -2311,32 +1860,11 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
break;
- case MP_CMD_SWITCH_RATIO:
- if (!sh_video)
- break;
- if (cmd->nargs == 0 || cmd->args[0].v.f == -1)
- opts->movie_aspect = (float) sh_video->disp_w / sh_video->disp_h;
- else
- opts->movie_aspect = cmd->args[0].v.f;
- video_reset_aspect(sh_video);
- break;
-
- case MP_CMD_SPEED_INCR: {
+ case MP_CMD_SPEED_MULT: {
float v = cmd->args[0].v.f;
- mp_property_do("speed", M_PROPERTY_STEP_UP, &v, mpctx);
- show_property_osd(mpctx, "speed");
- break;
- }
-
- case MP_CMD_SPEED_MULT:
- case_fallthrough_hack = true;
-
- case MP_CMD_SPEED_SET: {
- float v = cmd->args[0].v.f;
- if (case_fallthrough_hack)
- v *= mpctx->opts.playback_speed;
+ v *= mpctx->opts.playback_speed;
mp_property_do("speed", M_PROPERTY_SET, &v, mpctx);
- show_property_osd(mpctx, "speed");
+ show_property_osd(mpctx, "speed", cmd->on_osd);
break;
}
@@ -2382,7 +1910,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
#endif
if (available)
- set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, 1, osd_duration,
+ set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, osdl, osd_duration,
"Sub delay: %d ms", ROUND(sub_delay * 1000));
}
break;
@@ -2397,9 +1925,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
opts->osd_level = (opts->osd_level + 1) % (max + 1);
else
opts->osd_level = v > max ? max : v;
- /* Show OSD state when disabled, but not when an explicit
- argument is given to the OSD command, i.e. in slave mode. */
- if (v == -1 && opts->osd_level <= 1)
+ if (msg_osd && opts->osd_level <= 1)
set_osd_tmsg(mpctx, OSD_MSG_OSD_STATUS, 0, osd_duration,
"OSD: %s",
opts->osd_level ? mp_gtext("enabled") :
@@ -2409,24 +1935,23 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
break;
}
- case MP_CMD_OSD_SHOW_TEXT:
- set_osd_msg(mpctx, OSD_MSG_TEXT, cmd->args[2].v.i,
- (cmd->args[1].v.i <
- 0 ? osd_duration : cmd->args[1].v.i),
- "%s", cmd->args[0].v.s);
+ case MP_CMD_PRINT_TEXT: {
+ char *txt = mp_property_expand_string(mpctx, cmd->args[0].v.s);
+ if (txt) {
+ mp_msg(MSGT_GLOBAL, MSGL_INFO, "%s\n", txt);
+ talloc_free(txt);
+ }
break;
+ }
- case MP_CMD_OSD_SHOW_PROPERTY_TEXT: {
- char *txt = m_properties_expand_string(mp_properties,
- cmd->args[0].v.s,
- mpctx);
- // if no argument supplied use default osd_duration, else <arg> ms.
+ case MP_CMD_SHOW_TEXT: {
+ char *txt = mp_property_expand_string(mpctx, cmd->args[0].v.s);
if (txt) {
+ // if no argument supplied use default osd_duration, else <arg> ms.
set_osd_msg(mpctx, OSD_MSG_TEXT, cmd->args[2].v.i,
- (cmd->args[1].v.i <
- 0 ? osd_duration : cmd->args[1].v.i),
+ (cmd->args[1].v.i < 0 ? osd_duration : cmd->args[1].v.i),
"%s", txt);
- free(txt);
+ talloc_free(txt);
}
break;
}
@@ -2488,8 +2013,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
mpctx->stop_play = PT_STOP;
break;
- case MP_CMD_OSD_SHOW_PROGRESSION:
- mp_show_osd_progression(mpctx);
+ case MP_CMD_SHOW_PROGRESS:
+ mpctx->add_osd_seek_info |=
+ (msg_osd ? OSD_SEEK_INFO_TEXT : 0) |
+ (bar_osd ? OSD_SEEK_INFO_BAR : 0);
break;
#ifdef CONFIG_RADIO
@@ -2501,7 +2028,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
else
radio_step_channel(mpctx->stream, RADIO_CHANNEL_LOWER);
if (radio_get_channel_name(mpctx->stream)) {
- set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
+ set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, osdl, osd_duration,
"Channel: %s",
radio_get_channel_name(mpctx->stream));
}
@@ -2512,7 +2039,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (mpctx->stream && mpctx->stream->type == STREAMTYPE_RADIO) {
radio_set_channel(mpctx->stream, cmd->args[0].v.s);
if (radio_get_channel_name(mpctx->stream)) {
- set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
+ set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, osdl, osd_duration,
"Channel: %s",
radio_get_channel_name(mpctx->stream));
}
@@ -2541,7 +2068,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#ifdef CONFIG_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_freq(mpctx->stream, ROUND(cmd->args[0].v.f));
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -2554,7 +2081,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#ifdef CONFIG_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_force_freq_step(mpctx->stream, ROUND(cmd->args[0].v.f));
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: f %d",
+ set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: f %d",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_frequency(mpctx->stream));
}
@@ -2575,7 +2102,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
tv_step_channel(get_tvh(mpctx), TV_CHANNEL_LOWER);
}
if (tv_channel_list) {
- set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration,
+ set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
"Channel: %s", tv_channel_current->name);
//vo_osd_changed(OSDTYPE_SUBTITLE);
}
@@ -2584,7 +2111,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
else if (mpctx->stream &&
mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_channel_step(mpctx->stream, cmd->args[0].v.i);
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -2613,7 +2140,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (get_tvh(mpctx)) {
tv_set_channel(get_tvh(mpctx), cmd->args[0].v.s);
if (tv_channel_list) {
- set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration,
+ set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
"Channel: %s", tv_channel_current->name);
//vo_osd_changed(OSDTYPE_SUBTITLE);
}
@@ -2621,7 +2148,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#ifdef CONFIG_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_channel(mpctx->stream, cmd->args[0].v.s);
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -2646,7 +2173,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (get_tvh(mpctx)) {
tv_last_channel(get_tvh(mpctx));
if (tv_channel_list) {
- set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration,
+ set_osd_tmsg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
"Channel: %s", tv_channel_current->name);
//vo_osd_changed(OSDTYPE_SUBTITLE);
}
@@ -2654,7 +2181,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#ifdef CONFIG_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_lastchannel(mpctx->stream);
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, 1, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -2678,143 +2205,17 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
}
break;
- case MP_CMD_GET_SUB_VISIBILITY:
- if (sh_video) {
- mp_msg(MSGT_GLOBAL, MSGL_INFO,
- "ANS_SUB_VISIBILITY=%d\n", opts->sub_visibility);
- }
- break;
-
case MP_CMD_SCREENSHOT:
screenshot_request(mpctx, cmd->args[0].v.i, cmd->args[1].v.i);
break;
- case MP_CMD_GET_TIME_LENGTH:
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2f\n",
- get_time_length(mpctx));
- break;
-
- case MP_CMD_GET_FILENAME: {
- char *inf = get_metadata(mpctx, META_NAME);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_FILENAME='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_VIDEO_CODEC: {
- char *inf = get_metadata(mpctx, META_VIDEO_CODEC);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_CODEC='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_VIDEO_BITRATE: {
- char *inf = get_metadata(mpctx, META_VIDEO_BITRATE);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_BITRATE='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_VIDEO_RESOLUTION: {
- char *inf = get_metadata(mpctx, META_VIDEO_RESOLUTION);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_RESOLUTION='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_AUDIO_CODEC: {
- char *inf = get_metadata(mpctx, META_AUDIO_CODEC);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_CODEC='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_AUDIO_BITRATE: {
- char *inf = get_metadata(mpctx, META_AUDIO_BITRATE);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_BITRATE='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_AUDIO_SAMPLES: {
- char *inf = get_metadata(mpctx, META_AUDIO_SAMPLES);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_SAMPLES='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_TITLE: {
- char *inf = get_metadata(mpctx, META_INFO_TITLE);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TITLE='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_ARTIST: {
- char *inf = get_metadata(mpctx, META_INFO_ARTIST);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ARTIST='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_ALBUM: {
- char *inf = get_metadata(mpctx, META_INFO_ALBUM);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ALBUM='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_YEAR: {
- char *inf = get_metadata(mpctx, META_INFO_YEAR);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_YEAR='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_COMMENT: {
- char *inf = get_metadata(mpctx, META_INFO_COMMENT);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_COMMENT='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_TRACK: {
- char *inf = get_metadata(mpctx, META_INFO_TRACK);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TRACK='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_META_GENRE: {
- char *inf = get_metadata(mpctx, META_INFO_GENRE);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_GENRE='%s'\n", inf);
- talloc_free(inf);
- break;
- }
-
- case MP_CMD_GET_VO_FULLSCREEN:
- if (mpctx->video_out && mpctx->video_out->config_ok)
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VO_FULLSCREEN=%d\n", vo_fs);
- break;
-
- case MP_CMD_GET_PERCENT_POS:
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_PERCENT_POSITION=%d\n",
- get_percent_pos(mpctx));
- break;
-
- case MP_CMD_GET_TIME_POS: {
- float pos = get_current_time(mpctx);
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_TIME_POSITION=%.1f\n", pos);
- break;
- }
-
case MP_CMD_RUN:
#ifndef __MINGW32__
if (!fork()) {
- char *exp_cmd = property_expand_string(mpctx, cmd->args[0].v.s);
- if (exp_cmd) {
- execl("/bin/sh", "sh", "-c", exp_cmd, NULL);
- free(exp_cmd);
+ char *s = mp_property_expand_string(mpctx, cmd->args[0].v.s);
+ if (s) {
+ execl("/bin/sh", "sh", "-c", s, NULL);
+ talloc_free(s);
}
exit(0);
}
@@ -2840,9 +2241,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
mp_msg(MSGT_CPLAYER, MSGL_INFO, "Setting vo cmd line to '%s'.\n",
s);
if (vo_control(mpctx->video_out, VOCTRL_SET_COMMAND_LINE, s) > 0) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, 1, osd_duration, "vo='%s'", s);
+ set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "vo='%s'", s);
} else {
- set_osd_msg(mpctx, OSD_MSG_TEXT, 1, osd_duration, "Failed!");
+ set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "Failed!");
}
}
break;
@@ -2903,7 +2304,6 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
"Received unknown cmd %s\n", cmd->name);
}
-old_pause_hack:
switch (cmd->pausing) {
case 1: // "pausing"
pause_player(mpctx);
diff --git a/command.h b/command.h
index 1367fa88e4..0a339c5705 100644
--- a/command.h
+++ b/command.h
@@ -23,7 +23,10 @@ struct MPContext;
struct mp_cmd;
void run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
-char *property_expand_string(struct MPContext *mpctx, char *str);
+char *mp_property_expand_string(struct MPContext *mpctx, char *str);
void property_print_help(void);
+int mp_property_do(const char* name, int action, void* val,
+ struct MPContext *mpctx);
+char* mp_property_print(const char *name, struct MPContext *mpctx);
#endif /* MPLAYER_COMMAND_H */
diff --git a/configure b/configure
index d0fedf2d59..a8753ec3b0 100755
--- a/configure
+++ b/configure
@@ -274,7 +274,7 @@ esac
msg_lang_all=''
ls po/*.po >/dev/null 2>&1 && msg_lang_all=$(echo po/*.po | sed -e 's:po/\([^[:space:]]*\)\.po:\1:g')
-man_lang_all=$(echo DOCS/man/??/mplayer.1 DOCS/man/??_??/mplayer.1 | sed -e "s:DOCS/man/\(..\)/mplayer.1:\1:g" -e "s:DOCS/man/\(.._..\)/mplayer.1:\1:g")
+man_lang_all=$(echo DOCS/man/??/mpv.1 DOCS/man/??_??/mpv.1 | sed -e "s:DOCS/man/\(..\)/mpv.1:\1:g" -e "s:DOCS/man/\(.._..\)/mpv.1:\1:g")
doc_lang_all=$(echo DOCS/xml/??/ DOCS/xml/??_??/ | sed -e "s:DOCS/xml/\(..\)/:\1:g" -e "s:DOCS/xml/\(.._..\)/:\1:g")
show_help(){
@@ -288,16 +288,16 @@ Installation directories:
--prefix=DIR prefix directory for installation [/usr/local]
--bindir=DIR directory for installing binaries [PREFIX/bin]
--datadir=DIR directory for installing machine independent
- data files (skins, etc) [PREFIX/share/mplayer]
+ data files (skins, etc) [PREFIX/share/mpv]
--mandir=DIR directory for installing man pages [PREFIX/share/man]
--confdir=DIR directory for installing configuration files
- [PREFIX/etc/mplayer]
+ [PREFIX/etc/mpv]
--localedir=DIR directory for locale tree [PREFIX/share/locale]
--libdir=DIR directory for object code libraries [PREFIX/lib]
--codecsdir=DIR directory for binary codecs [LIBDIR/codecs]
Optional features:
- --disable-mplayer disable MPlayer compilation [enable]
+ --disable-mpv disable mpv compilation [enable]
--disable-encoding disable encoding functionality [enable]
--enable-termcap use termcap database for key codes [autodetect]
--enable-termios use termios database for key codes [autodetect]
@@ -375,6 +375,7 @@ Audio output:
--disable-jack disable JACK audio output [autodetect]
--enable-openal enable OpenAL audio output [disable]
--disable-coreaudio disable CoreAudio audio output [autodetect]
+ --disable-dsound disable DirectSound audio output [autodetect]
--disable-select disable using select() on the audio device [enable]
Language options:
@@ -396,9 +397,9 @@ Available values for --language-msg are: all $msg_lang_all
Miscellaneous options:
--enable-cross-compile enable cross-compilation [disable]
- --cc=COMPILER C compiler to build MPlayer [gcc]
+ --cc=COMPILER C compiler to build mpv [gcc]
--pkg-config=PKGCONFIG pkg-config to find some libraries [pkg-config]
- --windres=WINDRES windres to build MPlayer [windres]
+ --windres=WINDRES windres to build mpv [windres]
--target=PLATFORM target platform (i386-linux, arm-linux, etc)
--enable-static build a statically linked binary
--with-install=PATH path to a custom install program
@@ -412,7 +413,7 @@ Use these options if autodetection fails:
--extra-cflags=FLAGS extra CFLAGS
--extra-ldflags=FLAGS extra LDFLAGS
--extra-libs=FLAGS extra linker flags
- --extra-libs-mplayer=FLAGS extra linker flags for MPlayer
+ --extra-libs-mpv=FLAGS extra linker flags for mpv
This configure script is NOT autoconf-based, even though its output is similar.
It will try to autodetect all configuration options. If you --enable an option
@@ -435,7 +436,6 @@ _opt=-O2
_cross_compile=no
_prefix="/usr/local"
ffmpeg=auto
-ffmpeg_internals=no
_mplayer=yes
_encoding=yes
_x11=auto
@@ -444,6 +444,7 @@ _xss=auto
_xv=auto
_vdpau=auto
_direct3d=auto
+_dsound=auto
_nas=auto
_png=auto
_mng=auto
@@ -564,7 +565,7 @@ for ac_option do
--extra-libs=*)
extra_libs=$(echo $ac_option | cut -d '=' -f 2)
;;
- --extra-libs-mplayer=*)
+ --extra-libs-mpv=*)
libs_mplayer=$(echo $ac_option | cut -d '=' -f 2)
;;
@@ -620,8 +621,8 @@ for ac_option do
--disable-translation) _translation=no ;;
--enable-cross-compile) _cross_compile=yes ;;
--disable-cross-compile) _cross_compile=no ;;
- --enable-mplayer) _mplayer=yes ;;
- --disable-mplayer) _mplayer=no ;;
+ --enable-mpv) _mplayer=yes ;;
+ --disable-mpv) _mplayer=no ;;
--enable-encoding) _encoding=yes ;;
--disable-encoding) _encoding=no ;;
--enable-x11) _x11=yes ;;
@@ -636,6 +637,8 @@ for ac_option do
--disable-vdpau) _vdpau=no ;;
--enable-direct3d) _direct3d=yes ;;
--disable-direct3d) _direct3d=no ;;
+ --enable-dsound) _dsound=yes ;;
+ --disable-dsound) _dsound=no ;;
--enable-png) _png=yes ;;
--disable-png) _png=no ;;
--enable-mng) _mng=yes ;;
@@ -715,8 +718,6 @@ for ac_option do
--enable-joystick) _joystick=yes ;;
--disable-joystick) _joystick=no ;;
--enable-libav) ffmpeg=yes ;;
- --ffmpeg-source-dir=*)
- _ffmpeg_source=$(echo $ac_option | cut -d '=' -f 2 ) ;;
--enable-lirc) _lirc=yes ;;
--disable-lirc) _lirc=no ;;
@@ -784,9 +785,9 @@ done
# Atmos: moved this here, to be correct, if --prefix is specified
test -z "$_bindir" && _bindir="$_prefix/bin"
-test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
+test -z "$_datadir" && _datadir="$_prefix/share/mpv"
test -z "$_mandir" && _mandir="$_prefix/share/man"
-test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
+test -z "$_confdir" && _confdir="$_prefix/etc/mpv"
test -z "$_libdir" && _libdir="$_prefix/lib"
test -z "$_localedir" && _localedir="$_prefix/share/locale"
@@ -794,7 +795,7 @@ for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
test "$tmpdir" && break
done
-mplayer_tmpdir="$tmpdir/mplayer-configure-$RANDOM-$$"
+mplayer_tmpdir="$tmpdir/mpv-configure-$RANDOM-$$"
mkdir $mplayer_tmpdir || die "Unable to create tmpdir."
TMPLOG="config.log"
@@ -931,7 +932,7 @@ fi
if win32 ; then
_exesuf=".exe"
- extra_cflags="$extra_cflags -fno-common"
+ extra_cflags="$extra_cflags -fno-common -DWINVER=0x0500"
# -lwinmm is always needed for osdep/timer-win2.c
extra_ldflags="$extra_ldflags -lwinmm"
_pe_executable=yes
@@ -951,6 +952,10 @@ if mingw32 ; then
extra_cflags="$extra_cflags -DBYTE_ORDER=1234 -DLITTLE_ENDIAN=1234 -DBIG_ENDIAN=4321"
fi
+if cygwin ; then
+ extra_cflags="$extra_cflags -mwin32"
+fi
+
TMPC="$mplayer_tmpdir/tmp.c"
TMPCPP="$mplayer_tmpdir/tmp.cpp"
TMPEXE="$mplayer_tmpdir/tmp$_exesuf"
@@ -1019,8 +1024,8 @@ echocheck "working compiler"
cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ."
echo "yes"
-echocheck "python3"
-command_check python3 -c '' || die "Python 3 is not functioning correctly. Check your installation and PATH."
+echocheck "python"
+command_check python -c '' || die "Python is not functioning correctly. Check your installation and PATH."
echo yes
if test -z "$_target" && x86 ; then
@@ -1135,7 +1140,7 @@ case "$host_arch" in
*)
echo "The architecture of your CPU ($host_arch) is not supported by this configure script"
- echo "It seems nobody has ported MPlayer to your OS or CPU type yet."
+ echo "It seems nobody has ported mpv to your OS or CPU type yet."
die "unsupported architecture $host_arch"
;;
esac # case "$host_arch" in
@@ -2477,6 +2482,7 @@ echores "$_gl"
if win32; then
+
echocheck "Direct3D"
if test "$_direct3d" = auto ; then
_direct3d=no
@@ -2491,6 +2497,22 @@ else
fi
echores "$_direct3d"
+
+echocheck "DirectSound"
+if test "$_dsound" = auto ; then
+ _dsound=no
+ header_check dsound.h && _dsound=yes
+fi
+if test "$_dsound" = yes ; then
+ def_dsound='#define CONFIG_DSOUND 1'
+ aomodules="dsound $aomodules"
+else
+ def_dsound='#undef CONFIG_DSOUND'
+ noaomodules="dsound $noaomodules"
+fi
+echores "$_dsound"
+
+
fi #if win32; then
@@ -2929,10 +2951,6 @@ if test "$ffmpeg" = auto ; then
fi
echores "yes"
-def_ffmpeg_internals="#undef CONFIG_FFMPEG_INTERNALS"
-if ! test -z "$_ffmpeg_source" ; then
- def_ffmpeg_internals="#define CONFIG_FFMPEG_INTERNALS 1" && ffmpeg_internals=yes
-fi
echocheck "libpostproc >= 52.0.0"
if test "$libpostproc" = auto ; then
@@ -3342,6 +3360,7 @@ COCOA = $_cocoa
COREAUDIO = $_coreaudio
COREVIDEO = $_corevideo
DIRECT3D = $_direct3d
+DSOUND = $_dsound
DVBIN = $_dvbin
DVDREAD = $_dvdread
DXR3 = $_dxr3
@@ -3395,8 +3414,6 @@ XV = $_xv
# FFmpeg
ENCODING = $_encoding
-FFMPEG_INTERNALS = $ffmpeg_internals
-FFMPEG_SOURCE_PATH = $_ffmpeg_source
CONFIG_VDPAU = $_vdpau
CONFIG_ZLIB = $_zlib
@@ -3588,6 +3605,7 @@ $def_caca
$def_corevideo
$def_cocoa
$def_direct3d
+$def_dsound
$def_dvb
$def_dvbin
$def_gif
@@ -3613,7 +3631,6 @@ $def_xv
/* FFmpeg */
$def_encoding
-$def_ffmpeg_internals
$def_fast_64bit
$def_mkstemp
@@ -3660,10 +3677,10 @@ Config files successfully generated by ./configure $configuration !
Video output: $novomodules
'config.h' and 'config.mak' contain your configuration options.
-Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
+Note: If you alter theses files (for instance CFLAGS) mpv may no longer
compile *** DO NOT REPORT BUGS if you tweak these files ***
-'make' will now compile MPlayer and 'make install' will install it.
+'make' will now compile mpv and 'make install' will install it.
Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.
EOF
@@ -3682,19 +3699,16 @@ If you used one of these options and experience a compilation or
linking failure, make sure you have passed the necessary compiler/linker flags
to configure.
-If you suspect a bug, please read DOCS/HTML/$language_doc/bugreports.html.
-
EOF
if test "$warn_cflags" = yes; then
cat <<EOF
-MPlayer compilation will use the CPPFLAGS/CFLAGS/LDFLAGS set by you,
-but:
+mpv compilation will use the CPPFLAGS/CFLAGS/LDFLAGS set by you, but:
*** *** DO NOT REPORT BUGS IF IT DOES NOT COMPILE/WORK! *** ***
-It is strongly recommended to let MPlayer choose the correct CFLAGS!
+It is strongly recommended to let mpv choose the correct CFLAGS!
To do so, execute 'CFLAGS= ./configure <options>'
EOF
diff --git a/debian/README.debian b/debian/README.debian
deleted file mode 100644
index 80874c8de6..0000000000
--- a/debian/README.debian
+++ /dev/null
@@ -1,16 +0,0 @@
-mplayer for Debian
-----------------------
-
- Most options are autodetected or configured during compilation thus
- users are supposed to build this package themselves.
-
- Recommended method is running "fakeroot debian/rules binary" in the top
- directory
-
- In case you would like to pass some parameters to ./configure, set variable
- DEB_BUILD_CONFIGURE like that:
-
- eyck@ghost$ DEB_BUILD_CONFIGURE"--enable-streaming" fakeroot debian/rules binary
-
-
-Dariush Pietrzak <eyck@ghost.anime.pl> Sat Jan 5 20:28:23 CET 2002
diff --git a/debian/TODO.Debian b/debian/TODO.Debian
deleted file mode 100644
index 8b13789179..0000000000
--- a/debian/TODO.Debian
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index ace71aa772..0000000000
--- a/debian/changelog
+++ /dev/null
@@ -1,209 +0,0 @@
-mplayer (1.0git) unstable; urgency=low
-
- * change version name to git.
- * update standards version to 3.8.2
-
- -- Anton Khirnov <wyskas@gmail.com> Sat, 08 Aug 2009 13:15:57 +0200
-
-mplayer (1.0svn) unstable; urgency=low
-
- * change version naming from cvs to svn.
-
- -- Aurelien Jacobs <aurel@gnuage.org> Tue, 20 Jun 2006 13:02:14 +0200
-
-mplayer (1.0cvs) unstable; urgency=low
-
- * debian/rules: now compiled without --enable-runtime-cpudetection.
- If you plan to install the target .deb on a wide variety of machines,
- you may want to add that option to the configure command.
-
- -- Guillaume POIRIER <gpoirier@mplayerhq.hu> Mon, 20 Nov 2005 22:56:40 +0100
-
-mplayer (0.90cvs) unstable; urgency=low
-
- * this is a placeholder message
-
- -- Gabucino <gabucino@mplayerhq.hu> Fri, 7 Feb 2003 23:43:55 +0100
-
-mplayer (0.90rc4-0) unstable; urgency=low
-
- * new rc-release.
-
- -- Alex Beregszaszi <alex@naxine.org> Fri, 7 Feb 2003 23:43:55 +0100
-
-mplayer (0.90rc3-0) unstable; urgency=low
-
- * new release.
-
- -- Gabucino <gabucino@mplayerhq.hu> Mon, 16 Dec 2002 22:03:55 +0100
-
-mplayer (0.90rc1-0) unstable; urgency=low
-
- * new release.
- * now compiled with --enable-runtime-cpudetection for safety reasons.
- Disable it for slightly better performance, but the package will run only
- on the CPU the build machine had.
- * updated package description
-
- -- Gabucino <gabucino@mplayerhq.hu> Sun, 24 Nov 2002 17:01:12 +0100
-
-mplayer (0.90pre9-0) unstable; urgency=low
-
- * new release.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Mon, 21 Oct 2002 22:30:06 +0200
-
-mplayer (0.90pre8-0) unstable; urgency=low
-
- * new release, fix version, we are not at 0.90, we're still at preX
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Thu, 19 Sep 2002 09:50:43 +0200
-
-mplayer (0.90-4) unstable; urgency=low
-
- * Fix package building by adding BINDIR.
-
- -- Diego Biurrun <diego@biurrun.de> Wed, 4 Sep 2002 00:49:03 +0200
-
-mplayer (0.90-3) unstable; urgency=low
-
- * Remove configuration files on purge.
-
- -- Diego Biurrun <diego@biurrun.de> Sun, 1 Sep 2002 11:03:13 +0200
-
-mplayer (0.90-2) unstable; urgency=low
-
- * Use the confdir we compile with in the helper scripts
- (/etc/mplayer/mplayer.conf instead of /etc/mplayer).
-
- -- Diego Biurrun <diego@biurrun.de> Tue, 27 Aug 2002 11:18:50 +0200
-
-mplayer (0.90-1) unstable; urgency=low
-
- * 0.90 release including latest alsa9 fixes
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Wed, 3 Jul 2002 23:32:49 +0200
-
-mplayer (0.90pre5-1) unstable; urgency=low
-
- * rc1 to become 0.90
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Fri, 7 Jun 2002 15:31:20 +0200
-
-mplayer (0.90pre4-1) unstable; urgency=low
-
- * new pre-release
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Mon, 13 May 2002 08:06:34 +0200
-
-mplayer (0.90pre3-1) unstable; urgency=low
-
- * new pre-release
- * gtk bug fixed.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Tue, 30 Apr 2002 11:32:43 +0200
-
-mplayer (0.90pre2-1) unstable; urgency=low
-
- * new release.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Sun, 21 Apr 2002 12:49:35 +0200
-
-mplayer (0.60-3) unstable; urgency=low
-
- * install xvidix correctly
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Sun, 17 Mar 2002 16:38:54 +0100
-
-mplayer (0.60-2) unstable; urgency=low
-
- * This is meaningless, just to mark that more then 2 months have passed
- since last release and lots of thing in mplayer have changed.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Thu, 7 Mar 2002 00:34:20 +0100
-
-mplayer (0.60-1) unstable; urgency=low
-
- * Post 0.60 release.
- * Changed installation - make install now handles codecs.conf, manpages
- * and fontdir, so we now use make install for those.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Fri, 4 Jan 2002 11:28:54 +0100
-
-mplayer (0.60pre2-1) unstable; urgency=low
-
- * 0.60 pre2 release
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Fri, 28 Dec 2001 22:12:54 +0100
-
-mplayer (0.60pre1-1) unstable; urgency=low
-
- * 0.60 pre-release.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Tue, 25 Dec 2001 00:47:36 +0100
-
-mplayer (0.50-3) unstable; urgency=low
-
- * debian/rules: improve install routine; will include mencore if it is
- built
- * debian/control: remove invalid source recommends
- * debian/copyright: mention that binary distribution is not allowed
- * debian/rules: install /usr/share/mplayer/codecs.conf; this should
- probably be a config file
- * turn on fbdev option
-
- -- Adam Di Carlo <aph@debian.org> Sat, 15 Dec 2001 03:33:44 -0500
-
-mplayer (0.50-2) unstable; urgency=low
-
- * gui added to package/menu
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Wed, 7 Nov 2001 11:31:46 +0100
-
-mplayer (0.50-1) unstable; urgency=low
-
- * 0.50 released.
-
- -- Dariush Pietrzak <eyck@ghost.anime.pl> Fri, 12 Oct 2001 13:26:03 +0200
-
-mplayer (0.18-4) unstable; urgency=low
-
- * Changes to debian packaging suggested Josip Rodin
-
- -- Dariush Pietrzak <eyck@ghost.forumakad.pl> Wed, 22 Aug 2001 22:40:58 +0200
-
-mplayer (0.18-3) unstable; urgency=low
-
- * fixed templates.
-
- -- Dariush Pietrzak <eyck@ghost.tinet.pl> Sat, 28 Jul 2001 09:45:45 +0200
-
-mplayer (0.18-2) unstable; urgency=low
-
- * modified debian scripts
-
- -- Dariush Pietrzak <eyck@ghost.tinet.pl> Fri, 27 Jul 2001 09:25:52 +0200
-
-mplayer (0.18-1) unstable; urgency=low
-
- * lots of changes in mplayer
-
- -- Dariush Pietrzak <eyck@incubus.ar.lublin.pl> Mon, 25 Jun 2001 15:59:18 +0200
-
-mplayer (0.17a-2) unstable; urgency=low
-
- * mplayer.conf file, automatic menu files update
-
- -- Dariush Pietrzak <eyck@incubus.ar.lublin.pl> Sun, 20 May 2001 22:50:41 +0200
-
-mplayer (0.17a-1) unstable; urgency=low
-
- * Version change, debian scripts update (rm), maintainer switch
-
- -- Dariush Pietrzak <eyck@incubus.ar.lublin.pl> Thu, 17 May 2001 13:25:12 +0200
-
-mplayer (0.11pre-1) unstable; urgency=low
-
- * Initial release.
-
- -- * TeLeNiEkO * <telenieko@telenieko.com> Mon, 26 Feb 2001 12:24:04 +0100
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index 7f8f011eb7..0000000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/debian/control b/debian/control
deleted file mode 100644
index fb578fee1c..0000000000
--- a/debian/control
+++ /dev/null
@@ -1,31 +0,0 @@
-Source: mplayer
-Section: misc
-Priority: optional
-Maintainer: Diego Biurrun <diego@biurrun.de>
-Standards-Version: 3.8.2
-Build-Depends: libpng12-dev, zlib1g-dev, x11proto-core-dev, libx11-dev, libxext-dev, libxinerama-dev, libxv-dev, debhelper (>= 7)
-
-Package: mplayer
-Architecture: any
-Depends: ${shlibs:Depends},debconf
-Description: The Ultimate Movie Player
- MPlayer is a movie player for LINUX (runs on many other Unices, and non-x86
- CPUs, see the ports section). It plays most MPEG, VOB, AVI, OGG/OGM, VIVO,
- ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM, RoQ, PVA files,
- supported by many native, XAnim, RealPlayer, and Win32 DLL codecs. You can
- watch VideoCD, SVCD, DVD, 3ivx, RealMedia, and DivX movies too (and you don't
- need the avifile library at all!).
- .
- Another big feature of MPlayer is the wide range of supported output drivers.
- It works with X11, Xv, DGA, OpenGL, SVGAlib, fbdev, AAlib, DirectFB, but you
- can also use GGI and SDL (and this way all their drivers) and some lowlevel
- card-specific drivers (for Matrox, 3Dfx and Radeon, Mach64, Permedia3) too!
- Most of them supports software or hardware scaling, so you can enjoy movies in
- fullscreen.
- .
- MPlayer supports displaying through some hardware MPEG decoder boards, such as
- the DVB and DXR3/Hollywood+.
- .
- And what about the nice big antialiased shaded subtitles (10 supported types)
- with European/ISO 8859-1,2 (Hungarian, English, Czech, etc), Cyrillic, Korean
- fonts, and the onscreen display (OSD)?
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index 9aec96a800..0000000000
--- a/debian/copyright
+++ /dev/null
@@ -1,7 +0,0 @@
-This package was debianized by * TeLeNiEkO * telenieko@telenieko.com on
-Mon, 26 Feb 2001 12:24:04 +0100.
-
-Original source can be found at: http://www.mplayerHQ.hu/homepage/
-
-Copyrighted by various authors. Licensed under the terms of GNU GPL.
-See /usr/share/common-licenses/GPL for details.
diff --git a/debian/dirs b/debian/dirs
deleted file mode 100644
index 8d1744ab78..0000000000
--- a/debian/dirs
+++ /dev/null
@@ -1,5 +0,0 @@
-usr/bin
-usr/share/man/man1
-usr/share/mplayer
-usr/lib/mplayer
-usr/share/applications
diff --git a/debian/mime b/debian/mime
deleted file mode 100644
index 422c07e4b6..0000000000
--- a/debian/mime
+++ /dev/null
@@ -1,20 +0,0 @@
-application/x-ogg; mplayer %s; description="Ogg Stream"
-application/ogg; mplayer %s; description="Ogg Stream"
-audio/mpeg; mplayer %s; description="MPEG Audio"
-audio/x-mpegurl; mplayer %s; description="Icecast Playlist"
-audio/x-ms-wax; mplayer %s; description="Windows Media Audio"
-audio/x-ms-wma; mplayer %s; description="Windows Media Audio"
-audio/x-pls; mplayer %s; description="MP3 ShoutCast/IceCast Playlist"
-audio/x-scpls; mplayer %s; description="Shoutcast Playlist"
-audio/x-wav; mplayer %s; description="WAV Audio"
-video/mpeg; mplayer %s; description="MPEG Video";
-video/quicktime; mplayer %s; description="Apple QuickTime Video";
-video/x-mpeg; mplayer %s; description="MPEG Video";
-video/x-mpeg2; mplayer %s; description="MPEG-2 Video";
-video/x-msvideo; mplayer %s; description="MS Video (AVI)";
-video/x-ms-afs; mplayer %s; description="Microsoft ASF Video";
-video/x-ms-asf; mplayer %s; description="Microsoft ASF Video";
-video/x-ms-wma; mplayer %s; description="Windows Media Audio";
-video/x-ms-wmv; mplayer %s; description="Windows Media Video";
-video/x-ms-wmx; mplayer %s; description="Windows Media Video";
-video/x-ms-wvx; mplayer %s; description="Windows Media Video";
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index d72bef3434..0000000000
--- a/debian/rules
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/make -f
-# Made with the aid of debmake, by Christoph Lameter,
-# based on the sample debian/rules file for GNU hello by Ian Jackson.
-#export DH_VERBOSE=1
-
-# do not run the actual rules of this makefile in parallel. sub-makes
-# can go in parallel
-.NOTPARALLEL:
-
-package := mplayer
-prefix := $(shell pwd)/debian/$(package)
-
-arch := $(shell dpkg --print-architecture)
-
-# See http://wiki.debian.org/Teams/Dpkg/DebianRules; #465282 and
-# https://wiki.ubuntu.com/DistCompilerFlags
-CLEAN_ENV=env -u CFLAGS -u CPPFLAGS -u LDFLAGS -u FFLAGS -u CXXFLAGS
-
-ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
- NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
- MAKEFLAGS += -j$(NUMJOBS)
-endif
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- # Add here commands to configure the package.
- $(checkdir)
- # If you plan to install the target .deb on a wide variety of machines,
- # you may want to add the "--enable-runtime-cpudetection" option to
- # the line below, but beware: the resulting binary will run slower
- $(CLEAN_ENV) \
- ./configure --prefix=/usr --confdir=/etc/mplayer $(DEB_BUILD_CONFIGURE)
-
- touch configure-stamp
-
-build: configure-stamp build-stamp
-build-stamp:
- dh_testdir
-
- # commands to compile the package.
- $(CLEAN_ENV) \
- ${MAKE}
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
-
- # commands to clean up after the build process.
- -$(MAKE) distclean
- dh_clean
-
-# Build architecture-independent files here.
-binary-indep: build
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # commands to install the package into debian/<packagename>
- $(MAKE) prefix=$(prefix)/usr BINDIR=$(prefix)/usr/bin CONFDIR=$(prefix)/etc/mplayer LIBDIR=$(prefix)/usr/lib DATADIR=$(prefix)/usr/share/mplayer MANDIR=$(prefix)/usr/share/man install
-
- install -D -m 644 etc/example.conf $(prefix)/etc/mplayer/mplayer.conf
- dh_installdocs -X.svn -Xmplayer.1 DOCS/*
- dh_installexamples etc/example.conf etc/input.conf
- dh_installmime
- dh_installinfo
- dh_installchangelogs
- #ChangeLog
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_perl
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-
-
-#binary-arch: checkroot build
-# $(checkdir)
-# -rm -rf debian/tmp
-# install -d debian/tmp
-# cd debian/tmp && install -d `cat ../dirs`
-
-
-# Must have debmake installed for this to work. Otherwise please copy
-# /usr/bin/debstd into the debian directory and change debstd to debian/debstd
-# debstd
-# dpkg-gencontrol -isp
-# chown -R root.root debian/tmp
-# chmod -R go=rX debian/tmp
-# dpkg --build debian/tmp ..
-
-binary: binary-indep binary-arch
-
-.PHONY: binary binary-arch binary-indep clean checkroot
diff --git a/defaultopts.c b/defaultopts.c
index 422841ad65..072bf606d1 100644
--- a/defaultopts.c
+++ b/defaultopts.c
@@ -14,7 +14,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.softvol = SOFTVOL_AUTO,
.softvol_max = 200,
.ao_buffersize = -1,
- .vo_wintitle = "mplayer - ${filename}",
+ .vo_wintitle = "mpv - ${media-title}",
.monitor_pixel_aspect = 1.0,
.vo_panscanrange = 1.0,
.cursor_autohide_delay = 1000,
@@ -55,6 +55,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
#endif
.ass_font_scale = 1,
.ass_vsfilter_aspect_compat = 1,
+ .ass_style_override = 1,
.use_embedded_fonts = 1,
.lavc_param = {
diff --git a/encode_lavc.c b/encode_lavc.c
index f8e04f99bc..e38ca5bca8 100644
--- a/encode_lavc.c
+++ b/encode_lavc.c
@@ -30,83 +30,62 @@
#include "talloc.h"
#include "stream/stream.h"
-static int set_to_avdictionary(void *ctx, AVDictionary **dictp, void *octx,
- const char *str, const char *key_val_sep,
- const char *pairs_sep)
+static int set_to_avdictionary(AVDictionary **dictp, const char *key,
+ const char *val)
{
- int good = 0;
- int errorcode = 0;
- const AVOption *o;
-
- while (*str) {
- char *key_ = av_get_token(&str, key_val_sep);
- char *val_;
- char *key, *val;
- char valuebuf[1024];
-
- if (*key_ && strspn(str, key_val_sep)) {
- str++;
- val_ = av_get_token(&str, pairs_sep);
- } else {
- av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value "
- "separator found after key '%s'\n", key_);
- av_free(key_);
- if (!errorcode)
- errorcode = AVERROR(EINVAL);
- if (*str)
- ++str;
- continue;
- }
-
- key = key_;
- val = val_;
+ char keybuf[1024];
+ char valuebuf[1024];
- if(!strcmp(key, "qscale") && val[0] != '+' && val[0] != '-' && !av_opt_find(octx, key, NULL, 0, AV_OPT_SEARCH_CHILDREN))
- {
- // hack: support "qscale" key as virtual "global_quality" key that multiplies by QP2LAMBDA
- key = "global_quality";
- snprintf(valuebuf, sizeof(valuebuf), "(%s)*QP2LAMBDA", val);
- valuebuf[sizeof(valuebuf)-1] = 0;
- val = valuebuf;
+ if (key == NULL) {
+ // we need to split at equals sign
+ const char *equals = strchr(val, '=');
+ if (!equals || equals - val >= sizeof(keybuf)) {
+ mp_msg(MSGT_ENCODE, MSGL_WARN,
+ "encode-lavc: option '%s' does not contain an equals sign\n",
+ val);
+ return 0;
}
+ memcpy(keybuf, val, equals - val);
+ keybuf[equals - val] = 0;
+ key = keybuf;
+ val = equals + 1;
+ }
- av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n",
- val, key);
+ // hack: support "qscale" key as virtual "global_quality" key that multiplies by QP2LAMBDA
+ if (!strcmp(key, "qscale")) {
+ key = "global_quality";
+ snprintf(valuebuf, sizeof(valuebuf),
+ "%.1s(%s)*QP2LAMBDA",
+ (val[0] == '+' || val[0] == '-') ? val : "",
+ (val[0] == '+' || val[0] == '-') ? val + 1 : val);
+ valuebuf[sizeof(valuebuf) - 1] = 0;
+ val = valuebuf;
+ }
- if((o = av_opt_find(octx, key, NULL, 0, AV_OPT_SEARCH_CHILDREN))) {
- if (av_dict_set(dictp, key, *val ? val : NULL, (o->type == FF_OPT_TYPE_FLAGS && (val[0] == '+' || val[0] == '-')) ? AV_DICT_APPEND : 0) >= 0)
- ++good;
- else
- errorcode = AVERROR(EINVAL);
- } else {
- errorcode = AVERROR(ENOENT);
- }
+ mp_msg(MSGT_ENCODE, MSGL_V,
+ "encode-lavc: setting value '%s' for key '%s'\n",
+ val,
+ key);
- av_free(key_);
- av_free(val_);
+ if (av_dict_set(dictp, key, *val ? val : NULL,
+ (val[0] == '+' || val[0] == '-') ? AV_DICT_APPEND : 0) >= 0)
+ return 1;
- if (*str)
- ++str;
- }
- return errorcode ? errorcode : good;
+ return 0;
}
static bool value_has_flag(const char *value, const char *flag)
{
bool state = true;
bool ret = false;
- while(*value)
- {
+ while (*value) {
size_t l = strcspn(value, "+-");
- if(l == 0)
- {
+ if (l == 0) {
state = (*value == '+');
++value;
- }
- else
- {
- if(l == strlen(flag))
- if(!memcmp(value, flag, l))
+ } else {
+ if (l == strlen(flag))
+ if (!memcmp(value, flag, l))
ret = state;
value += l;
}
@@ -115,8 +94,10 @@ static bool value_has_flag(const char *value, const char *flag)
}
#define CHECK_FAIL(ctx, val) \
- if(ctx && (ctx->failed || ctx->finished)) { \
- mp_msg(MSGT_ENCODE, MSGL_ERR, "Called a function on a %s encoding context. Bailing out.\n", ctx->failed ? "failed" : "finished"); \
+ if (ctx && (ctx->failed || ctx->finished)) { \
+ mp_msg(MSGT_ENCODE, MSGL_ERR, \
+ "Called a function on a %s encoding context. Bailing out.\n", \
+ ctx->failed ? "failed" : "finished"); \
return val; \
}
@@ -147,19 +128,15 @@ struct encode_lavc_context *encode_lavc_init(struct encode_output_conf *options)
const char *in = ctx->options->format;
while (*in) {
tok = av_get_token(&in, ",");
- ctx->vc = avcodec_find_encoder_by_name(tok);
ctx->avc->oformat = av_guess_format(tok, ctx->options->file, NULL);
av_free(tok);
if (ctx->avc->oformat)
- ctx->vc = NULL;
- if (ctx->vc)
break;
if (*in)
++in;
}
- } else {
+ } else
ctx->avc->oformat = av_guess_format(NULL, ctx->options->file, NULL);
- }
if (!ctx->avc->oformat) {
encode_lavc_fail(ctx, "encode-lavc: format not found\n");
@@ -173,8 +150,7 @@ struct encode_lavc_context *encode_lavc_init(struct encode_output_conf *options)
if (ctx->options->fopts) {
char **p;
for (p = ctx->options->fopts; *p; ++p) {
- if (set_to_avdictionary(ctx->avc, &ctx->foptions, ctx->avc, *p, "=", "")
- <= 0)
+ if (!set_to_avdictionary(&ctx->foptions, NULL, *p))
mp_msg(MSGT_ENCODE, MSGL_WARN,
"encode-lavc: could not set option %s\n", *p);
}
@@ -196,7 +172,8 @@ struct encode_lavc_context *encode_lavc_init(struct encode_output_conf *options)
}
} else
ctx->vc = avcodec_find_encoder(av_guess_codec(ctx->avc->oformat, NULL,
- ctx->avc->filename, NULL, AVMEDIA_TYPE_VIDEO));
+ ctx->avc->filename, NULL,
+ AVMEDIA_TYPE_VIDEO));
if (ctx->options->acodec) {
char *tok;
@@ -214,10 +191,12 @@ struct encode_lavc_context *encode_lavc_init(struct encode_output_conf *options)
}
} else
ctx->ac = avcodec_find_encoder(av_guess_codec(ctx->avc->oformat, NULL,
- ctx->avc->filename, NULL, AVMEDIA_TYPE_AUDIO));
+ ctx->avc->filename, NULL,
+ AVMEDIA_TYPE_AUDIO));
if (!ctx->vc && !ctx->ac) {
- encode_lavc_fail(ctx, "encode-lavc: neither audio nor video codec was found\n");
+ encode_lavc_fail(
+ ctx, "encode-lavc: neither audio nor video codec was found\n");
return NULL;
}
@@ -230,6 +209,11 @@ struct encode_lavc_context *encode_lavc_init(struct encode_output_conf *options)
ctx->vbytes = 0;
ctx->frames = 0;
+ if (options->video_first)
+ ctx->video_first = true;
+ if (options->audio_first)
+ ctx->audio_first = true;
+
return ctx;
}
@@ -263,8 +247,10 @@ int encode_lavc_start(struct encode_lavc_context *ctx)
ctx->header_written = -1;
if (!(ctx->avc->oformat->flags & AVFMT_NOFILE)) {
- if (avio_open(&ctx->avc->pb, ctx->avc->filename, AVIO_FLAG_WRITE) < 0) {
- encode_lavc_fail(ctx, "encode-lavc: could not open '%s'\n", ctx->avc->filename);
+ if (avio_open(&ctx->avc->pb, ctx->avc->filename,
+ AVIO_FLAG_WRITE) < 0) {
+ encode_lavc_fail(ctx, "encode-lavc: could not open '%s'\n",
+ ctx->avc->filename);
return 0;
}
}
@@ -278,7 +264,7 @@ int encode_lavc_start(struct encode_lavc_context *ctx)
for (de = NULL; (de = av_dict_get(ctx->foptions, "", de,
AV_DICT_IGNORE_SUFFIX));)
- av_log(ctx->avc, AV_LOG_ERROR, "Key '%s' not found.\n", de->key);
+ mp_msg(MSGT_ENCODE, MSGL_WARN, "ofopts: key '%s' not found.\n", de->key);
av_dict_free(&ctx->foptions);
ctx->header_written = 1;
@@ -291,7 +277,8 @@ void encode_lavc_free(struct encode_lavc_context *ctx)
return;
if (!ctx->finished)
- encode_lavc_fail(ctx, "called encode_lavc_free without encode_lavc_finish\n");
+ encode_lavc_fail(ctx,
+ "called encode_lavc_free without encode_lavc_finish\n");
talloc_free(ctx);
}
@@ -366,7 +353,8 @@ void encode_lavc_finish(struct encode_lavc_context *ctx)
ctx->finished = true;
}
-static void encode_2pass_prepare(struct encode_lavc_context *ctx, AVDictionary **dictp, void *octx,
+static void encode_2pass_prepare(struct encode_lavc_context *ctx,
+ AVDictionary **dictp,
AVStream *stream, struct stream **bytebuf,
const char *prefix)
{
@@ -383,7 +371,7 @@ static void encode_2pass_prepare(struct encode_lavc_context *ctx, AVDictionary *
mp_msg(MSGT_ENCODE, MSGL_WARN, "%s: could not open '%s', "
"disabling 2-pass encoding at pass 2\n", prefix, buf);
stream->codec->flags &= ~CODEC_FLAG_PASS2;
- set_to_avdictionary(stream->codec, dictp, octx, "flags=-pass2", "=", "");
+ set_to_avdictionary(dictp, "flags", "-pass2");
} else {
struct bstr content = stream_read_complete(*bytebuf, NULL,
1000000000, 1);
@@ -402,10 +390,12 @@ static void encode_2pass_prepare(struct encode_lavc_context *ctx, AVDictionary *
if (value_has_flag(de ? de->value : "", "pass1")) {
if (!(*bytebuf = open_output_stream(buf, NULL))) {
- mp_msg(MSGT_ENCODE, MSGL_WARN, "%s: could not open '%s', disabling "
- "2-pass encoding at pass 1\n",
- prefix, ctx->avc->filename);
- set_to_avdictionary(stream->codec, dictp, octx, "flags=-pass1", "=", "");
+ mp_msg(
+ MSGT_ENCODE, MSGL_WARN,
+ "%s: could not open '%s', disabling "
+ "2-pass encoding at pass 1\n",
+ prefix, ctx->avc->filename);
+ set_to_avdictionary(dictp, "flags", "-pass1");
}
}
}
@@ -418,7 +408,6 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
AVStream *stream = NULL;
char **p;
int i;
- AVCodecContext *dummy;
CHECK_FAIL(ctx, NULL);
@@ -430,6 +419,28 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
// already have a stream of that type, this cannot really happen
return NULL;
+ if (ctx->avc->nb_streams == 0) {
+ // if this stream isn't stream #0, allocate a dummy stream first for
+ // the next loop to use
+ if (mt == AVMEDIA_TYPE_VIDEO && ctx->audio_first) {
+ mp_msg(MSGT_ENCODE, MSGL_INFO,
+ "vo-lavc: preallocated audio stream for later use\n");
+ avformat_new_stream(ctx->avc, NULL); // this one is AVMEDIA_TYPE_UNKNOWN for now
+ }
+ if (mt == AVMEDIA_TYPE_AUDIO && ctx->video_first) {
+ mp_msg(MSGT_ENCODE, MSGL_INFO,
+ "ao-lavc: preallocated video stream for later use\n");
+ avformat_new_stream(ctx->avc, NULL); // this one is AVMEDIA_TYPE_UNKNOWN for now
+ }
+ } else {
+ // find possibly preallocated stream
+ for (i = 0; i < ctx->avc->nb_streams; ++i)
+ if (ctx->avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_UNKNOWN) // preallocated stream
+ stream = ctx->avc->streams[i];
+ }
+ if (!stream)
+ stream = avformat_new_stream(ctx->avc, NULL);
+
if (ctx->timebase.den == 0) {
AVRational r;
@@ -437,9 +448,10 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
r = av_d2q(ctx->options->fps, ctx->options->fps * 1001 + 2);
else if (ctx->options->autofps && vo_fps > 0) {
r = av_d2q(vo_fps, vo_fps * 1001 + 2);
- mp_msg(MSGT_ENCODE, MSGL_INFO, "vo-lavc: option -ofps not specified "
- "but -oautofps is active, using guess of %u/%u\n",
- (unsigned)r.num, (unsigned)r.den);
+ mp_msg(
+ MSGT_ENCODE, MSGL_INFO, "vo-lavc: option -ofps not specified "
+ "but -oautofps is active, using guess of %u/%u\n",
+ (unsigned)r.num, (unsigned)r.den);
} else {
// we want to handle:
// 1/25
@@ -450,9 +462,10 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
// so let's take 1001/30000 out
r.num = 24000;
r.den = 1;
- mp_msg(MSGT_ENCODE, MSGL_INFO, "vo-lavc: option -ofps not specified "
- "and fps could not be inferred, using guess of %u/%u\n",
- (unsigned)r.num, (unsigned)r.den);
+ mp_msg(
+ MSGT_ENCODE, MSGL_INFO, "vo-lavc: option -ofps not specified "
+ "and fps could not be inferred, using guess of %u/%u\n",
+ (unsigned)r.num, (unsigned)r.den);
}
if (ctx->vc && ctx->vc->supported_framerates)
@@ -469,49 +482,33 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
encode_lavc_fail(ctx, "vo-lavc: encoder not found\n");
return NULL;
}
- stream = avformat_new_stream(ctx->avc, ctx->vc);
+ avcodec_get_context_defaults3(stream->codec, ctx->vc);
// stream->time_base = ctx->timebase;
// doing this breaks mpeg2ts in ffmpeg
// which doesn't properly force the time base to be 90000
// furthermore, ffmpeg.c doesn't do this either and works
- stream->codec->codec_id = ctx->vc->id;
stream->codec->time_base = ctx->timebase;
- stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-
- dummy = avcodec_alloc_context3(ctx->vc);
- dummy->codec = ctx->vc; // FIXME remove this once we can, caused by a bug in libav, elenril is aware of this
- // FIXME:
- // currently, to eradicate this dummy:
- // add here: stream->codec->codec = ctx->vc; // SAME PROBLEM AS ABOVE
- // replace dummy by stream->codec
- // at the end of this block: stream->codec->codec = NULL; // OR SEGV LATER
ctx->voptions = NULL;
- // libx264: default to preset=medium
- if (!strcmp(ctx->vc->name, "libx264"))
- set_to_avdictionary(stream->codec, &ctx->voptions, dummy, "preset=medium", "=", "");
-
if (ctx->options->vopts)
for (p = ctx->options->vopts; *p; ++p)
- if (set_to_avdictionary(stream->codec, &ctx->voptions, dummy,
- *p, "=", "") <= 0)
+ if (!set_to_avdictionary(&ctx->voptions, NULL, *p))
mp_msg(MSGT_ENCODE, MSGL_WARN,
"vo-lavc: could not set option %s\n", *p);
de = av_dict_get(ctx->voptions, "global_quality", NULL, 0);
- if(de)
- set_to_avdictionary(stream->codec, &ctx->voptions, dummy, "flags=+qscale", "=", "");
+ if (de)
+ set_to_avdictionary(&ctx->voptions, "flags", "+qscale");
if (ctx->avc->oformat->flags & AVFMT_GLOBALHEADER)
- set_to_avdictionary(stream->codec, &ctx->voptions, dummy, "flags=+global_header", "=", "");
+ set_to_avdictionary(&ctx->voptions, "flags", "+global_header");
- encode_2pass_prepare(ctx, &ctx->voptions, dummy, stream, &ctx->twopass_bytebuffer_v,
+ encode_2pass_prepare(ctx, &ctx->voptions, stream,
+ &ctx->twopass_bytebuffer_v,
"vo-lavc");
-
- av_free(dummy);
break;
case AVMEDIA_TYPE_AUDIO:
@@ -519,40 +516,28 @@ AVStream *encode_lavc_alloc_stream(struct encode_lavc_context *ctx,
encode_lavc_fail(ctx, "ao-lavc: encoder not found\n");
return NULL;
}
- stream = avformat_new_stream(ctx->avc, ctx->ac);
+ avcodec_get_context_defaults3(stream->codec, ctx->ac);
- stream->codec->codec_id = ctx->ac->id;
stream->codec->time_base = ctx->timebase;
- stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-
- dummy = avcodec_alloc_context3(ctx->ac);
- dummy->codec = ctx->ac; // FIXME remove this once we can, caused by a bug in libav, elenril is aware of this
- // FIXME:
- // currently, to eradicate this dummy:
- // add here: stream->codec->codec = ctx->ac; // SAME PROBLEM AS ABOVE
- // replace dummy by stream->codec
- // at the end of this block: stream->codec->codec = NULL; // OR SEGV LATER
ctx->aoptions = NULL;
if (ctx->options->aopts)
for (p = ctx->options->aopts; *p; ++p)
- if (set_to_avdictionary(stream->codec, &ctx->aoptions, dummy,
- *p, "=", "") <= 0)
+ if (!set_to_avdictionary(&ctx->aoptions, NULL, *p))
mp_msg(MSGT_ENCODE, MSGL_WARN,
"ao-lavc: could not set option %s\n", *p);
de = av_dict_get(ctx->aoptions, "global_quality", NULL, 0);
- if(de)
- set_to_avdictionary(stream->codec, &ctx->aoptions, dummy, "flags=+qscale", "=", "");
+ if (de)
+ set_to_avdictionary(&ctx->aoptions, "flags", "+qscale");
if (ctx->avc->oformat->flags & AVFMT_GLOBALHEADER)
- set_to_avdictionary(stream->codec, &ctx->aoptions, dummy, "flags=+global_header", "=", "");
+ set_to_avdictionary(&ctx->aoptions, "flags", "+global_header");
- encode_2pass_prepare(ctx, &ctx->aoptions, dummy, stream, &ctx->twopass_bytebuffer_a,
+ encode_2pass_prepare(ctx, &ctx->aoptions, stream,
+ &ctx->twopass_bytebuffer_a,
"ao-lavc");
-
- av_free(dummy);
break;
default:
@@ -587,77 +572,79 @@ int encode_lavc_open_codec(struct encode_lavc_context *ctx, AVStream *stream)
CHECK_FAIL(ctx, -1);
switch (stream->codec->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- if (ctx->vc->capabilities & CODEC_CAP_EXPERIMENTAL) {
- stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
- av_log(ctx->avc, AV_LOG_ERROR, _(
- "\n\n"
- " ********************************************\n"
- " **** Experimental VIDEO codec selected! ****\n"
- " ********************************************\n\n"
- "This means the output file may be broken or bad.\n"
- "Possible reasons, problems, workarounds:\n"
- "- Codec implementation in ffmpeg/libav is not finished yet.\n"
- " Try updating ffmpeg or libav.\n"
- "- Bad picture quality, blocks, blurriness.\n"
- " Experiment with codec settings (-ovcopts) to maybe still get the\n"
- " desired quality output at the expense of bitrate.\n"
- "- Slow compression.\n"
- " Bear with it.\n"
- "- Crashes.\n"
- " Happens. Try varying options to work around.\n"
- "If none of this helps you, try another codec in place of %s.\n\n"),
- ctx->vc->name);
- }
+ case AVMEDIA_TYPE_VIDEO:
+ if (ctx->vc->capabilities & CODEC_CAP_EXPERIMENTAL) {
+ stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
+ mp_msg(MSGT_ENCODE, MSGL_WARN, _(
+ "\n\n"
+ " ********************************************\n"
+ " **** Experimental VIDEO codec selected! ****\n"
+ " ********************************************\n\n"
+ "This means the output file may be broken or bad.\n"
+ "Possible reasons, problems, workarounds:\n"
+ "- Codec implementation in ffmpeg/libav is not finished yet.\n"
+ " Try updating ffmpeg or libav.\n"
+ "- Bad picture quality, blocks, blurriness.\n"
+ " Experiment with codec settings (-ovcopts) to maybe still get the\n"
+ " desired quality output at the expense of bitrate.\n"
+ "- Slow compression.\n"
+ " Bear with it.\n"
+ "- Crashes.\n"
+ " Happens. Try varying options to work around.\n"
+ "If none of this helps you, try another codec in place of %s.\n\n"),
+ ctx->vc->name);
+ }
- ret = avcodec_open2(stream->codec, ctx->vc, &ctx->voptions);
+ ret = avcodec_open2(stream->codec, ctx->vc, &ctx->voptions);
- // complain about all remaining options, then free the dict
- for (de = NULL; (de = av_dict_get(ctx->voptions, "", de,
- AV_DICT_IGNORE_SUFFIX));)
- av_log(ctx->avc, AV_LOG_ERROR, "Key '%s' not found.\n", de->key);
- av_dict_free(&ctx->voptions);
+ // complain about all remaining options, then free the dict
+ for (de = NULL; (de = av_dict_get(ctx->voptions, "", de,
+ AV_DICT_IGNORE_SUFFIX));)
+ mp_msg(MSGT_ENCODE, MSGL_WARN, "ovcopts: key '%s' not found.\n",
+ de->key);
+ av_dict_free(&ctx->voptions);
- break;
- case AVMEDIA_TYPE_AUDIO:
- if (ctx->ac->capabilities & CODEC_CAP_EXPERIMENTAL) {
- stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
- av_log(ctx->avc, AV_LOG_ERROR, _(
- "\n\n"
- " ********************************************\n"
- " **** Experimental AUDIO codec selected! ****\n"
- " ********************************************\n\n"
- "This means the output file may be broken or bad.\n"
- "Possible reasons, problems, workarounds:\n"
- "- Codec implementation in ffmpeg/libav is not finished yet.\n"
- " Try updating ffmpeg or libav.\n"
- "- Bad sound quality, noise, clicking, whistles, choppiness.\n"
- " Experiment with codec settings (-oacopts) to maybe still get the\n"
- " desired quality output at the expense of bitrate.\n"
- "- Slow compression.\n"
- " Bear with it.\n"
- "- Crashes.\n"
- " Happens. Try varying options to work around.\n"
- "If none of this helps you, try another codec in place of %s.\n\n"),
- ctx->ac->name);
- }
- ret = avcodec_open2(stream->codec, ctx->ac, &ctx->aoptions);
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ if (ctx->ac->capabilities & CODEC_CAP_EXPERIMENTAL) {
+ stream->codec->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
+ mp_msg(MSGT_ENCODE, MSGL_WARN, _(
+ "\n\n"
+ " ********************************************\n"
+ " **** Experimental AUDIO codec selected! ****\n"
+ " ********************************************\n\n"
+ "This means the output file may be broken or bad.\n"
+ "Possible reasons, problems, workarounds:\n"
+ "- Codec implementation in ffmpeg/libav is not finished yet.\n"
+ " Try updating ffmpeg or libav.\n"
+ "- Bad sound quality, noise, clicking, whistles, choppiness.\n"
+ " Experiment with codec settings (-oacopts) to maybe still get the\n"
+ " desired quality output at the expense of bitrate.\n"
+ "- Slow compression.\n"
+ " Bear with it.\n"
+ "- Crashes.\n"
+ " Happens. Try varying options to work around.\n"
+ "If none of this helps you, try another codec in place of %s.\n\n"),
+ ctx->ac->name);
+ }
+ ret = avcodec_open2(stream->codec, ctx->ac, &ctx->aoptions);
- // complain about all remaining options, then free the dict
- for (de = NULL; (de = av_dict_get(ctx->aoptions, "", de,
- AV_DICT_IGNORE_SUFFIX));)
- av_log(ctx->avc, AV_LOG_ERROR, "Key '%s' not found.\n", de->key);
- av_dict_free(&ctx->aoptions);
+ // complain about all remaining options, then free the dict
+ for (de = NULL; (de = av_dict_get(ctx->aoptions, "", de,
+ AV_DICT_IGNORE_SUFFIX));)
+ mp_msg(MSGT_ENCODE, MSGL_WARN, "oacopts: key '%s' not found.\n",
+ de->key);
+ av_dict_free(&ctx->aoptions);
- break;
- default:
- ret = -1;
- break;
+ break;
+ default:
+ ret = -1;
+ break;
}
- if(ret < 0) {
- encode_lavc_fail(ctx, "unable to open encoder (see above for the cause)");
- }
+ if (ret < 0)
+ encode_lavc_fail(ctx,
+ "unable to open encoder (see above for the cause)");
return ret;
}
@@ -695,14 +682,19 @@ int encode_lavc_write_frame(struct encode_lavc_context *ctx, AVPacket *packet)
if (ctx->header_written <= 0)
return -1;
- mp_msg(MSGT_ENCODE, MSGL_DBG2,
- "encode-lavc: write frame: stream %d ptsi %d (%f) size %d\n",
- (int)packet->stream_index,
- (int)packet->pts,
- packet->pts * (double)ctx->avc->streams[packet->stream_index]->
- time_base.num / (double)ctx->avc->streams[packet->
- stream_index]->time_base.den,
- (int)packet->size);
+ mp_msg(
+ MSGT_ENCODE, MSGL_DBG2,
+ "encode-lavc: write frame: stream %d ptsi %d (%f) dtsi %d (%f) size %d\n",
+ (int)packet->stream_index,
+ (int)packet->pts,
+ packet->pts
+ * (double)ctx->avc->streams[packet->stream_index]->time_base.num
+ / (double)ctx->avc->streams[packet->stream_index]->time_base.den,
+ (int)packet->dts,
+ packet->dts
+ * (double)ctx->avc->streams[packet->stream_index]->time_base.num
+ / (double)ctx->avc->streams[packet->stream_index]->time_base.den,
+ (int)packet->size);
switch (ctx->avc->streams[packet->stream_index]->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
@@ -731,9 +723,9 @@ int encode_lavc_supports_pixfmt(struct encode_lavc_context *ctx,
if (pix_fmt == PIX_FMT_NONE)
return 0;
- if (!ctx->vc->pix_fmts) {
+ if (!ctx->vc->pix_fmts)
return VFCAP_CSP_SUPPORTED;
- } else {
+ else {
const enum PixelFormat *p;
for (p = ctx->vc->pix_fmts; *p >= 0; ++p) {
if (pix_fmt == *p)
@@ -829,10 +821,12 @@ static void encode_lavc_printoptions(void *obj, const char *indent,
bool encode_lavc_showhelp(struct MPOpts *opts)
{
bool help_output = false;
- if(av_codec_next(NULL) == NULL)
+ if (av_codec_next(NULL) == NULL)
mp_msg(MSGT_ENCODE, MSGL_ERR, "NO CODECS\n");
-#define CHECKS(str) ((str) && strcmp((str), "help") == 0 ? (help_output |= 1) : 0)
-#define CHECKV(strv) ((strv) && (strv)[0] && strcmp((strv)[0], "help") == 0 ? (help_output |= 1) : 0)
+#define CHECKS(str) ((str) && \
+ strcmp((str), "help") == 0 ? (help_output |= 1) : 0)
+#define CHECKV(strv) ((strv) && (strv)[0] && \
+ strcmp((strv)[0], "help") == 0 ? (help_output |= 1) : 0)
if (CHECKS(opts->encode_output.format)) {
AVOutputFormat *c = NULL;
mp_msg(MSGT_ENCODE, MSGL_INFO, "Available output formats:\n");
@@ -844,7 +838,8 @@ bool encode_lavc_showhelp(struct MPOpts *opts)
if (CHECKV(opts->encode_output.fopts)) {
AVFormatContext *c = avformat_alloc_context();
AVOutputFormat *format = NULL;
- mp_msg(MSGT_ENCODE, MSGL_INFO, "Available output format ctx->options:\n");
+ mp_msg(MSGT_ENCODE, MSGL_INFO,
+ "Available output format ctx->options:\n");
encode_lavc_printoptions(c, " -ofopts ", " ", NULL,
AV_OPT_FLAG_ENCODING_PARAM,
AV_OPT_FLAG_ENCODING_PARAM);
@@ -865,24 +860,31 @@ bool encode_lavc_showhelp(struct MPOpts *opts)
AVCodec *codec = NULL;
mp_msg(MSGT_ENCODE, MSGL_INFO,
"Available output video codec ctx->options:\n");
- encode_lavc_printoptions(c, " -ovcopts ", " ", NULL,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM);
+ encode_lavc_printoptions(
+ c, " -ovcopts ", " ", NULL,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_VIDEO_PARAM,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_VIDEO_PARAM);
av_free(c);
while ((codec = av_codec_next(codec))) {
if (!av_codec_is_encoder(codec))
continue;
if (codec->type != AVMEDIA_TYPE_VIDEO)
continue;
- if (opts->encode_output.vcodec && opts->encode_output.vcodec[0] && strcmp(opts->encode_output.vcodec, codec->name) != 0)
+ if (opts->encode_output.vcodec && opts->encode_output.vcodec[0] &&
+ strcmp(opts->encode_output.vcodec, codec->name) != 0)
continue;
if (codec->priv_class) {
mp_msg(MSGT_ENCODE, MSGL_INFO, "Additionally, for -ovc %s:\n",
codec->name);
- encode_lavc_printoptions(&codec->priv_class, " -ovcopts ",
- " ", NULL,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM);
+ encode_lavc_printoptions(
+ &codec->priv_class, " -ovcopts ",
+ " ", NULL,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_VIDEO_PARAM,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_VIDEO_PARAM);
}
}
}
@@ -891,24 +893,31 @@ bool encode_lavc_showhelp(struct MPOpts *opts)
AVCodec *codec = NULL;
mp_msg(MSGT_ENCODE, MSGL_INFO,
"Available output audio codec ctx->options:\n");
- encode_lavc_printoptions(c, " -oacopts ", " ", NULL,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM);
+ encode_lavc_printoptions(
+ c, " -oacopts ", " ", NULL,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_AUDIO_PARAM,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_AUDIO_PARAM);
av_free(c);
while ((codec = av_codec_next(codec))) {
if (!av_codec_is_encoder(codec))
continue;
if (codec->type != AVMEDIA_TYPE_AUDIO)
continue;
- if (opts->encode_output.acodec && opts->encode_output.acodec[0] && strcmp(opts->encode_output.acodec, codec->name) != 0)
+ if (opts->encode_output.acodec && opts->encode_output.acodec[0] &&
+ strcmp(opts->encode_output.acodec, codec->name) != 0)
continue;
if (codec->priv_class) {
mp_msg(MSGT_ENCODE, MSGL_INFO, "Additionally, for -oac %s:\n",
codec->name);
- encode_lavc_printoptions(&codec->priv_class, " -oacopts ",
- " ", NULL,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM,
- AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM);
+ encode_lavc_printoptions(
+ &codec->priv_class, " -oacopts ",
+ " ", NULL,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_AUDIO_PARAM,
+ AV_OPT_FLAG_ENCODING_PARAM |
+ AV_OPT_FLAG_AUDIO_PARAM);
}
}
}
@@ -967,7 +976,7 @@ int encode_lavc_getstatus(struct encode_lavc_context *ctx,
CHECK_FAIL(ctx, -1);
- minutes = (GetTimerMS() - ctx->t0) / 60000.0 * (1-f) / f;
+ minutes = (GetTimerMS() - ctx->t0) / 60000.0 * (1 - f) / f;
megabytes = ctx->avc->pb ? (avio_size(ctx->avc->pb) / 1048576.0 / f) : 0;
fps = ctx->frames / ((GetTimerMS() - ctx->t0) / 1000.0);
x = playback_time / ((GetTimerMS() - ctx->t0) / 1000.0);
@@ -981,11 +990,12 @@ int encode_lavc_getstatus(struct encode_lavc_context *ctx,
return 0;
}
-void encode_lavc_expect_stream(struct encode_lavc_context *ctx, enum AVMediaType mt)
+void encode_lavc_expect_stream(struct encode_lavc_context *ctx,
+ enum AVMediaType mt)
{
CHECK_FAIL(ctx, );
- switch(mt) {
+ switch (mt) {
case AVMEDIA_TYPE_VIDEO:
ctx->expect_video = true;
break;
@@ -1005,7 +1015,7 @@ void encode_lavc_fail(struct encode_lavc_context *ctx, const char *format, ...)
va_list va;
va_start(va, format);
mp_msg_va(MSGT_ENCODE, MSGL_ERR, format, va);
- if(ctx->failed)
+ if (ctx->failed)
return;
ctx->failed = true;
encode_lavc_finish(ctx);
diff --git a/encode_lavc.h b/encode_lavc.h
index 7c1ca07545..29b35c6335 100644
--- a/encode_lavc.h
+++ b/encode_lavc.h
@@ -59,8 +59,11 @@ struct encode_lavc_context {
struct stream *twopass_bytebuffer_v;
unsigned int t0;
unsigned int frames;
+
bool expect_video;
bool expect_audio;
+ bool video_first;
+ bool audio_first;
// has encoding failed?
bool failed;
diff --git a/etc/encoding-example-profiles.conf b/etc/encoding-example-profiles.conf
index 41f9dc4e66..f24c11d3ef 100644
--- a/etc/encoding-example-profiles.conf
+++ b/etc/encoding-example-profiles.conf
@@ -1,5 +1,5 @@
#
-# MPlayer configuration file
+# mpv configuration file
#
#########################
@@ -8,10 +8,10 @@
#
# Usage of this file: copy/symlink it to a fixed location, and add
# include = /path/to/this/encoding-example-profiles.conf
-# to your ~/.mplayer/config
+# to your ~/.mpv/config
#
# Then, list all profiles by
-# mplayer -profile help | grep enc-
+# mpv -profile help | grep enc-
#
# The following kinds of encoding profiles exist:
# enc-a-*: initialize an audio codec including good defaults
@@ -26,19 +26,19 @@
# options, or even switch to another codec.
#
# You can view the exact options a profile sets by
-# mplayer -show-profile enc-to-bb-9000
+# mpv -show-profile enc-to-bb-9000
#
# Examples:
-# mplayer -profile enc-to-dvdpal -o outfile.mpg infile.mkv
-# mplayer -profile enc-f-avi -ofps 30 -o outfile.avi infile.mkv
-# mplayer -profile enc-v-mpeg4 -ovcopts-add global_quality=7 -profile enc-a-mp3 -oacopts-add b=320k -o outfile.avi infile.mkv
+# mpv -profile enc-to-dvdpal -o outfile.mpg infile.mkv
+# mpv -profile enc-f-avi -ofps 30 -o outfile.avi infile.mkv
+# mpv -profile enc-v-mpeg4 -ovcopts-add global_quality=7 -profile enc-a-mp3 -oacopts-add b=320k -o outfile.avi infile.mkv
################
# audio codecs #
################
[enc-a-aac]
profile-desc = "AAC (libfaac or FFmpeg)"
-oac = libfaac,aac
+oac = libfdk_aac,libfaac,libvo_aacenc,aac
oacopts = b=128k
[enc-a-ac3]
@@ -124,26 +124,26 @@ ofopts-clr = yes
# target devices #
##################
[enc-to-dvdpal]
-profile-desc = "DVD-Video PAL, use dvdauthor -v pal+4:3 -a ac3+en"
+profile-desc = "DVD-Video PAL, use dvdauthor -v pal -a ac3+en (MUST be used with 4:3 or 16:9 aspect, and 720x576, 704x576, 352x576 or 352x288 resolution)"
profile = enc-v-mpeg2
profile = enc-a-ac3
of = dvd
ofopts-add = packetsize=2048,muxrate=10080000
ofps = 25
oharddup = yes
-vf-add = expand=aspect=4/3,scale=w=720:h=576
+ovfirst = yes # dvdauthor needs this
srate = 48000
ovcopts-add = g=15,b=6000000,maxrate=9000000,minrate=0,bufsize=1835008
[enc-to-dvdntsc]
-profile-desc = "DVD-Video NTSC, use dvdauthor -v ntsc+4:3 -a ac3+en"
+profile-desc = "DVD-Video NTSC, use dvdauthor -v ntsc -a ac3+en (MUST be used with 4:3 or 16:9 aspect, and 720x480, 704x480, 352x480 or 352x240 resolution)"
profile = enc-v-mpeg2
profile = enc-a-ac3
of = dvd
ofopts-add = packetsize=2048,muxrate=10080000
ofps = 24000/1001
oharddup = yes
-vf-add = expand=aspect=4/3,scale=w=720:h=480
+ovfirst = yes # dvdauthor needs this
srate = 48000
ovcopts-add = g=18,b=6000000,maxrate=9000000,minrate=0,bufsize=1835008
diff --git a/etc/example.conf b/etc/example.conf
index 588ec00b7e..a68dc39cca 100644
--- a/etc/example.conf
+++ b/etc/example.conf
@@ -1,8 +1,8 @@
#
-# MPlayer configuration file
+# mpv configuration file
#
-# Configuration files are read system-wide from /usr/local/etc/mplayer.conf
-# and per-user from ~/.mplayer/config, where per-user settings override
+# Configuration files are read system-wide from /usr/local/etc/mpv.conf
+# and per-user from ~/.mpv/config, where per-user settings override
# system-wide settings, all of which are overrriden by the command line.
#
# The configuration file settings are the same as the command line
diff --git a/etc/input.conf b/etc/input.conf
index 2dd9fee758..67ce10f72f 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -1,37 +1,38 @@
-# MPlayer input control file
+# mpv input control file
#
# You are able to redefine default keyboard/joystick/mouse/LIRC bindings, or
# add new ones here.
-# See DOCS/tech/slave.txt for possible commands that can be bound.
-# Also see mplayer -input cmdlist for other possible options.
-# The file should be placed in the $HOME/.mplayer directory.
+# See DOCS/man/en/input.rst for possible commands that can be bound.
+# Also see mpv --input=cmdlist for other possible options.
+# The file should be placed in the $HOME/.mpv directory.
+#
+# mpv --input=test --pause dummy.mkv can be used to test which commands keys are
+# bound to.
#
# If you wish to unbind a key, use key ignore.
# e.g. ENTER ignore
#
# Note that merely removing default key bindings from this file won't remove
-# the default bindings mplayer was compiled with, unless
-# --input=nodefault-bindings
+# the default bindings mpv was compiled with, unless
+# --input=no-default-bindings
# is specified.
#
# Lines starting with # are comments. Use SHARP to assign the # key.
#
-# Some characters need to be escaped. In particular, if you want to display
-# a '\' character as part of an osd_show_property_text OSD message, you have to
-# escape 2 times:
-# key osd_show_property_text "This is a single backslash: \\\\!"
+# Strings need to be quoted and escaped:
+# KEY show_text "This is a single backslash: \\ and a quote: \" !"
#
# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
# modifiers Shift, Ctrl, Alt and Meta, but note that currently reading
# key combinations is only supported through the video windows of certain
# output drivers (not in output windows of other drivers or in a terminal).
-MOUSE_BTN0_DBL vo_fullscreen # toggle fullscreen on/off
-MOUSE_BTN2 pause # toggle pause on/off
+MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
+MOUSE_BTN2 cycle pause # toggle pause on/off
MOUSE_BTN3 seek 10
MOUSE_BTN4 seek -10
-MOUSE_BTN5 volume 1
-MOUSE_BTN6 volume -1
+MOUSE_BTN5 add volume 1
+MOUSE_BTN6 add volume -1
# Seek units are in seconds, but note that these are limited by keyframes
RIGHT seek 10
@@ -39,95 +40,95 @@ LEFT seek -10
UP seek 60
DOWN seek -60
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
-Shift+RIGHT seek 1 0 1
-Shift+LEFT seek -1 0 1
-Shift+UP seek 5 0 1
-Shift+DOWN seek -5 0 1
+# Don't show them on the OSD (no-osd).
+Shift+RIGHT no-osd seek 1 - exact
+Shift+LEFT no-osd seek -1 - exact
+Shift+UP no-osd seek 5 - exact
+Shift+DOWN no-osd seek -5 - exact
PGUP seek 600
PGDWN seek -600
-+ audio_delay 0.100 # this changes audio/video sync
-- audio_delay -0.100
++ add audio-delay 0.100 # this changes audio/video sync
+- add audio-delay -0.100
[ speed_mult 0.9091 # scale playback speed
] speed_mult 1.1
{ speed_mult 0.5
} speed_mult 2.0
-BS speed_set 1.0 # reset speed to normal
+BS set speed 1.0 # reset speed to normal
q quit
q {encode} quit
ESC quit
-p pause # toggle pause/playback mode
+p cycle pause # toggle pause/playback mode
. frame_step # advance one frame and pause
-SPACE pause
+SPACE cycle pause
> playlist_next # skip to next file
-ENTER playlist_next 1 # skip to next file or quit
+ENTER playlist_next force # skip to next file or quit
< playlist_prev # skip to previous file
o osd # cycle through OSD mode
-I osd_show_property_text "${filename}" # display filename in osd
-P osd_show_progression
-z sub_delay -0.1 # subtract 100 ms delay from subs
-x sub_delay +0.1 # add
+I show_text "${filename}" # display filename in osd
+P show_progress
+z add sub-delay -0.1 # subtract 100 ms delay from subs
+x add sub-delay +0.1 # add
g sub_step -1 # immediately display next subtitle
y sub_step +1 # previous
-9 volume -1
-/ volume -1
-0 volume 1
-* volume 1
-( balance -0.1 # adjust audio balance in favor of left
-) balance 0.1 # right
-m mute
-1 contrast -1
-2 contrast 1
-3 brightness -1
-4 brightness 1
-5 hue -1
-6 hue 1
-7 saturation -1
-8 saturation 1
-d frame_drop # cycle through framedrop modes
+9 add volume -1
+/ add volume -1
+0 add volume 1
+* add volume 1
+( add balance -0.1 # adjust audio balance in favor of left
+) add balance 0.1 # right
+m cycle mute
+1 add contrast -1
+2 add contrast 1
+3 add brightness -1
+4 add brightness 1
+5 add hue -1
+6 add hue 1
+7 add saturation -1
+8 add saturation 1
+d cycle framedrop # cycle through framedrop modes
# toggle deinterlacer; requires either vdpau output, -vf yadif or kerndeint
-D step_property_osd deinterlace
-c step_property_osd colormatrix
+D cycle deinterlace
+c cycle colormatrix
# Next 3 currently only work with --no-ass
-r sub_pos -1 # move subtitles up
-t sub_pos +1 # down
-v sub_visibility
+r add sub-pos -1 # move subtitles up
+t add sub-pos +1 # down
+v cycle sub-visibility
# stretch SSA/ASS subtitles with anamorphic videos to match historical
-V step_property_osd ass_vsfilter_aspect_compat
-j sub_select # cycle through subtitles
-J sub_select -3 # ...backwards
-F forced_subs_only
-SHARP switch_audio # switch audio streams
-_ step_property switch_video
-TAB step_property switch_program
+V cycle ass-vsfilter-aspect-compat
+j cycle sub # cycle through subtitles
+J cycle sub down # ...backwards
+F cycle sub-forced-only
+SHARP cycle audio # switch audio streams
+_ cycle video
+TAB cycle program
i edl_mark # for use with --edlout mode
-T vo_ontop # toggle video window ontop of other windows
-f vo_fullscreen # toggle fullscreen
-C step_property_osd capturing
-s screenshot 0 # take a png screenshot
-S screenshot 1 # ...on every frame
-Alt+s screenshot 0 1 # take a screenshot of window contents
-Alt+S screenshot 1 1 # ...on every frame
-w panscan -0.1 # zoom out with -panscan 0 -fs
-e panscan +0.1 # in
+T cycle ontop # toggle video window ontop of other windows
+f cycle fullscreen # toggle fullscreen
+s screenshot # take a png screenshot
+S screenshot each-frame # ...on every frame
+Alt+s screenshot - window # take a screenshot of window contents
+Alt+S screenshot each-frame window # ...on every frame
+w add panscan -0.1 # zoom out with -panscan 0 -fs
+e add panscan +0.1 # in
POWER quit
-MENU osd
-PLAY pause
-PAUSE pause
-PLAYPAUSE pause
+MENU cycle osd
+PLAY cycle pause
+PAUSE cycle pause
+PLAYPAUSE cycle pause
STOP quit
FORWARD seek 60
REWIND seek -60
NEXT playlist_next
PREV playlist_prev
-VOLUME_UP volume 1
-VOLUME_DOWN volume -1
-MUTE mute
+VOLUME_UP add volume 1
+VOLUME_DOWN add volume -1
+MUTE cycle mute
CLOSE_WIN quit
CLOSE_WIN {encode} quit
-! seek_chapter -1 # skip to previous chapter
-@ seek_chapter 1 # next
-E step_property_osd edition # next edition
-A switch_angle 1
+! add chapter -1 # skip to previous chapter
+@ add chapter 1 # next
+E cycle edition # next edition
+A cycle angle
U stop
# TV
@@ -140,16 +141,16 @@ u tv_step_chanlist
# Apple Remote section
#
-AR_PLAY pause
+AR_PLAY cycle pause
AR_PLAY_HOLD quit
AR_NEXT seek 30
AR_NEXT_HOLD seek 120
AR_PREV seek -10
AR_PREV_HOLD seek -120
-AR_MENU osd
-AR_MENU_HOLD mute
-AR_VUP volume 1
-AR_VDOWN volume -1
+AR_MENU cycle osd
+AR_MENU_HOLD cycle mute
+AR_VUP add volume 1
+AR_VDOWN add volume -1
#
# Joystick section
@@ -161,15 +162,15 @@ JOY_AXIS0_PLUS seek 10
JOY_AXIS0_MINUS seek -10
JOY_AXIS1_MINUS seek 60
JOY_AXIS1_PLUS seek -60
-JOY_BTN0 pause
-JOY_BTN1 osd
-JOY_BTN2 volume 1
-JOY_BTN3 volume -1
+JOY_BTN0 cycle pause
+JOY_BTN1 cycle osd
+JOY_BTN2 add volume 1
+JOY_BTN3 add volume -1
#
# Not assigned by default
# (not an exhaustive list of unbound commands)
#
-#? sub_scale +0.1 # increase subtitle font size
-#? sub_scale -0.1 # decrease subtitle font size
+#? add sub-scale +0.1 # increase subtitle font size
+#? add sub-scale -0.1 # decrease subtitle font size
diff --git a/etc/mplayer.desktop b/etc/mplayer.desktop
deleted file mode 100644
index c7c9648524..0000000000
--- a/etc/mplayer.desktop
+++ /dev/null
@@ -1,27 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=MPlayer
-GenericName=Media Player
-GenericName[ca]=Reproductor multimèdia
-GenericName[de]=Medienwiedergabe
-GenericName[fr]=Lecteur multimédia
-GenericName[it]=Lettore multimediale
-GenericName[ja]=メディアプレーヤー
-X-GNOME-FullName=MPlayer Media Player
-X-GNOME-FullName[ca]=MPlayer Reproductor multimèdia
-X-GNOME-FullName[de]=MPlayer Medienwiedergabe
-X-GNOME-FullName[fr]=MPlayer Lecteur multimédia
-X-GNOME-FullName[it]=MPlayer Lettore multimediale
-X-GNOME-FullName[ja]=MPlayer メディアプレーヤー
-Comment=Play movies and songs
-Comment[ca]=Reproduïu vídeos i cançons
-Comment[de]=Filme und Musik wiedergeben
-Comment[fr]=Lit les films et musiques
-Comment[it]=Riproduce filmati e musica
-Comment[ja]=動画や音声のファイルを再生します
-Icon=mplayer
-TryExec=gmplayer
-Exec=gmplayer %F
-Terminal=false
-Categories=GTK;AudioVideo;Audio;Video;Player;TV;
-MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/msvideo;video/x-msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-theora;video/x-matroska;video/3gpp;application/x-flash-video;
diff --git a/fmt-conversion.h b/fmt-conversion.h
index 9e133a8222..f7114b0aef 100644
--- a/fmt-conversion.h
+++ b/fmt-conversion.h
@@ -19,8 +19,7 @@
#ifndef MPLAYER_FMT_CONVERSION_H
#define MPLAYER_FMT_CONVERSION_H
-#include "config.h"
-#include "libavutil/avutil.h"
+#include <libavutil/pixfmt.h>
enum PixelFormat imgfmt2pixfmt(int fmt);
int pixfmt2imgfmt(enum PixelFormat pix_fmt);
diff --git a/input/input.c b/input/input.c
index 54be75c439..f2b601fdbe 100644
--- a/input/input.c
+++ b/input/input.c
@@ -69,6 +69,8 @@
struct cmd_bind {
int input[MP_MAX_KEY_DOWN + 1];
char *cmd;
+ char *location; // filename/line number of definition
+ struct cmd_bind_section *owner;
};
struct key_name {
@@ -85,80 +87,65 @@ struct key_name {
* argument value if the user didn't give enough arguments to specify it.
* A command can take a maximum of MP_CMD_MAX_ARGS arguments (10).
*/
-#define ARG_INT { .type = MP_CMD_ARG_INT }
-#define OARG_INT(def) { .type = MP_CMD_ARG_INT, .optional = true, .v.i = def }
-#define ARG_FLOAT { .type = MP_CMD_ARG_FLOAT }
-#define OARG_FLOAT(def) { .type = MP_CMD_ARG_FLOAT, .optional = true, .v.f = def }
-#define ARG_STRING { .type = MP_CMD_ARG_STRING }
-#define OARG_STRING(def) { .type = MP_CMD_ARG_STRING, .optional = true, .v.s = def }
+
+#define ARG_INT { .type = {"", NULL, &m_option_type_int} }
+#define ARG_FLOAT { .type = {"", NULL, &m_option_type_float} }
+#define ARG_STRING { .type = {"", NULL, &m_option_type_string} }
+#define ARG_CHOICE(c) { .type = {"", NULL, &m_option_type_choice, \
+ M_CHOICES(c)} }
+
+#define OARG_FLOAT(def) { .type = {"", NULL, &m_option_type_float}, \
+ .optional = true, .v.f = def }
+#define OARG_INT(def) { .type = {"", NULL, &m_option_type_int}, \
+ .optional = true, .v.i = def }
+#define OARG_CHOICE(def, c) { .type = {"", NULL, &m_option_type_choice, \
+ M_CHOICES(c)}, \
+ .optional = true, .v.i = def }
+
+static int parse_cycle_dir(const struct m_option *opt, struct bstr name,
+ struct bstr param, void *dst);
+static const struct m_option_type m_option_type_cycle_dir = {
+ .name = "up|down",
+ .parse = parse_cycle_dir,
+};
static const mp_cmd_t mp_cmds[] = {
-#ifdef CONFIG_RADIO
+ { MP_CMD_IGNORE, "ignore", },
+
{ MP_CMD_RADIO_STEP_CHANNEL, "radio_step_channel", { ARG_INT } },
{ MP_CMD_RADIO_SET_CHANNEL, "radio_set_channel", { ARG_STRING } },
{ MP_CMD_RADIO_SET_FREQ, "radio_set_freq", { ARG_FLOAT } },
{ MP_CMD_RADIO_STEP_FREQ, "radio_step_freq", {ARG_FLOAT } },
-#endif
- { MP_CMD_SEEK, "seek", { ARG_FLOAT, OARG_INT(0), OARG_INT(0) } },
+
+ { MP_CMD_SEEK, "seek", {
+ ARG_FLOAT,
+ OARG_CHOICE(0, ({"relative", 0}, {"0", 0},
+ {"absolute-percent", 1}, {"1", 1},
+ {"absolute", 2}, {"2", 2})),
+ OARG_CHOICE(0, ({"default-precise", 0}, {"0", 0},
+ {"exact", 1}, {"1", 1},
+ {"keyframes", -1}, {"-1", -1})),
+ }},
{ MP_CMD_EDL_MARK, "edl_mark", },
- { MP_CMD_AUDIO_DELAY, "audio_delay", { ARG_FLOAT, OARG_INT(0) } },
- { MP_CMD_SPEED_INCR, "speed_incr", { ARG_FLOAT } },
{ MP_CMD_SPEED_MULT, "speed_mult", { ARG_FLOAT } },
- { MP_CMD_SPEED_SET, "speed_set", { ARG_FLOAT } },
{ MP_CMD_QUIT, "quit", { OARG_INT(0) } },
{ MP_CMD_STOP, "stop", },
- { MP_CMD_PAUSE, "pause", },
{ MP_CMD_FRAME_STEP, "frame_step", },
- { MP_CMD_PLAYLIST_NEXT, "playlist_next", { OARG_INT(0) } },
- { MP_CMD_PLAYLIST_PREV, "playlist_prev", { OARG_INT(0) } },
- { MP_CMD_LOOP, "loop", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_SUB_DELAY, "sub_delay", { ARG_FLOAT, OARG_INT(0) } },
- { MP_CMD_SUB_STEP, "sub_step", { ARG_INT, OARG_INT(0) } },
+ { MP_CMD_PLAYLIST_NEXT, "playlist_next", {
+ OARG_CHOICE(0, ({"weak", 0}, {"0", 0},
+ {"force", 1}, {"1", 1})),
+ }},
+ { MP_CMD_PLAYLIST_PREV, "playlist_prev", {
+ OARG_CHOICE(0, ({"weak", 0}, {"0", 0},
+ {"force", 1}, {"1", 1})),
+ }},
+ { MP_CMD_SUB_STEP, "sub_step", { ARG_INT } },
{ MP_CMD_OSD, "osd", { OARG_INT(-1) } },
- { MP_CMD_OSD_SHOW_TEXT, "osd_show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
- { MP_CMD_OSD_SHOW_PROPERTY_TEXT, "osd_show_property_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
- { MP_CMD_OSD_SHOW_PROGRESSION, "osd_show_progression", },
- { MP_CMD_VOLUME, "volume", { ARG_FLOAT, OARG_INT(0) } },
- { MP_CMD_BALANCE, "balance", { ARG_FLOAT, OARG_INT(0) } },
- { MP_CMD_MIXER_USEMASTER, "use_master", },
- { MP_CMD_MUTE, "mute", { OARG_INT(-1) } },
- { MP_CMD_CONTRAST, "contrast", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_GAMMA, "gamma", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_BRIGHTNESS, "brightness", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_HUE, "hue", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_SATURATION, "saturation", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_FRAMEDROPPING, "frame_drop", { OARG_INT(-1) } },
- { MP_CMD_SUB_POS, "sub_pos", { ARG_INT, OARG_INT(0) } },
- { MP_CMD_SUB_ALIGNMENT, "sub_alignment", { OARG_INT(-1) } },
- { MP_CMD_SUB_VISIBILITY, "sub_visibility", { OARG_INT(-1) } },
+ { MP_CMD_PRINT_TEXT, "print_text", { ARG_STRING } },
+ { MP_CMD_SHOW_TEXT, "show_text", { ARG_STRING, OARG_INT(-1), OARG_INT(0) } },
+ { MP_CMD_SHOW_PROGRESS, "show_progress", },
{ MP_CMD_SUB_LOAD, "sub_load", { ARG_STRING } },
- { MP_CMD_SUB_SELECT, "vobsub_lang", { OARG_INT(-2) } }, // for compatibility
- { MP_CMD_SUB_SELECT, "sub_select", { OARG_INT(-2) } },
- { MP_CMD_SUB_SCALE, "sub_scale", { ARG_FLOAT, OARG_INT(0) } },
-#ifdef CONFIG_ASS
- { MP_CMD_ASS_USE_MARGINS, "ass_use_margins", { OARG_INT(-1) } },
-#endif
- { MP_CMD_GET_PERCENT_POS, "get_percent_pos", },
- { MP_CMD_GET_TIME_POS, "get_time_pos", },
- { MP_CMD_GET_TIME_LENGTH, "get_time_length", },
- { MP_CMD_GET_FILENAME, "get_file_name", },
- { MP_CMD_GET_VIDEO_CODEC, "get_video_codec", },
- { MP_CMD_GET_VIDEO_BITRATE, "get_video_bitrate", },
- { MP_CMD_GET_VIDEO_RESOLUTION, "get_video_resolution", },
- { MP_CMD_GET_AUDIO_CODEC, "get_audio_codec", },
- { MP_CMD_GET_AUDIO_BITRATE, "get_audio_bitrate", },
- { MP_CMD_GET_AUDIO_SAMPLES, "get_audio_samples", },
- { MP_CMD_GET_META_TITLE, "get_meta_title", },
- { MP_CMD_GET_META_ARTIST, "get_meta_artist", },
- { MP_CMD_GET_META_ALBUM, "get_meta_album", },
- { MP_CMD_GET_META_YEAR, "get_meta_year", },
- { MP_CMD_GET_META_COMMENT, "get_meta_comment", },
- { MP_CMD_GET_META_TRACK, "get_meta_track", },
- { MP_CMD_GET_META_GENRE, "get_meta_genre", },
- { MP_CMD_SWITCH_AUDIO, "switch_audio", { OARG_INT(-1) } },
- { MP_CMD_SWITCH_ANGLE, "switch_angle", { OARG_INT(-1) } },
- { MP_CMD_SWITCH_TITLE, "switch_title", { OARG_INT(-1) } },
-#ifdef CONFIG_TV
+
{ MP_CMD_TV_START_SCAN, "tv_start_scan", },
{ MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", { ARG_INT } },
{ MP_CMD_TV_STEP_NORM, "tv_step_norm", },
@@ -168,38 +155,39 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_TV_SET_FREQ, "tv_set_freq", { ARG_FLOAT } },
{ MP_CMD_TV_STEP_FREQ, "tv_step_freq", { ARG_FLOAT } },
{ MP_CMD_TV_SET_NORM, "tv_set_norm", { ARG_STRING } },
- { MP_CMD_TV_SET_BRIGHTNESS, "tv_set_brightness", { ARG_INT, OARG_INT(1) } },
- { MP_CMD_TV_SET_CONTRAST, "tv_set_contrast", { ARG_INT, OARG_INT(1) } },
- { MP_CMD_TV_SET_HUE, "tv_set_hue", { ARG_INT, OARG_INT(1) } },
- { MP_CMD_TV_SET_SATURATION, "tv_set_saturation", { ARG_INT, OARG_INT(1) } },
-#endif
- { MP_CMD_SUB_FORCED_ONLY, "forced_subs_only", { OARG_INT(-1) } },
-#ifdef CONFIG_DVBIN
+
{ MP_CMD_DVB_SET_CHANNEL, "dvb_set_channel", { ARG_INT, ARG_INT } },
-#endif
- { MP_CMD_SWITCH_RATIO, "switch_ratio", { OARG_FLOAT(0) } },
- { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", { OARG_INT(-1) } },
- { MP_CMD_VO_ONTOP, "vo_ontop", { OARG_INT(-1) } },
- { MP_CMD_VO_ROOTWIN, "vo_rootwin", { OARG_INT(-1) } },
- { MP_CMD_VO_BORDER, "vo_border", { OARG_INT(-1) } },
- { MP_CMD_SCREENSHOT, "screenshot", { OARG_INT(0), OARG_INT(0) } },
- { MP_CMD_PANSCAN, "panscan", { ARG_FLOAT, OARG_INT(0) } },
- { MP_CMD_SWITCH_VSYNC, "switch_vsync", { OARG_INT(0) } },
- { MP_CMD_LOADFILE, "loadfile", { ARG_STRING, OARG_INT(0) } },
- { MP_CMD_LOADLIST, "loadlist", { ARG_STRING, OARG_INT(0) } },
+
+ { MP_CMD_SCREENSHOT, "screenshot", {
+ OARG_CHOICE(0, ({"single", 0}, {"0", 0},
+ {"each-frame", 1}, {"1", 1})),
+ OARG_CHOICE(0, ({"video", 0}, {"0", 0},
+ {"window", 1}, {"1", 1})),
+ }},
+ { MP_CMD_LOADFILE, "loadfile", {
+ ARG_STRING,
+ OARG_CHOICE(0, ({"replace", 0}, {"0", 0},
+ {"append", 1}, {"1", 1})),
+ }},
+ { MP_CMD_LOADLIST, "loadlist", {
+ ARG_STRING,
+ OARG_CHOICE(0, ({"replace", 0}, {"0", 0},
+ {"append", 1}, {"1", 1})),
+ }},
{ MP_CMD_PLAYLIST_CLEAR, "playlist_clear", },
{ MP_CMD_RUN, "run", { ARG_STRING } },
- { MP_CMD_GET_VO_FULLSCREEN, "get_vo_fullscreen", },
- { MP_CMD_GET_SUB_VISIBILITY, "get_sub_visibility", },
{ MP_CMD_KEYDOWN_EVENTS, "key_down_event", { ARG_INT } },
- { MP_CMD_SET_PROPERTY, "set_property", { ARG_STRING, ARG_STRING } },
- { MP_CMD_SET_PROPERTY_OSD, "set_property_osd", { ARG_STRING, ARG_STRING } },
+ { MP_CMD_SET, "set", { ARG_STRING, ARG_STRING } },
{ MP_CMD_GET_PROPERTY, "get_property", { ARG_STRING } },
- { MP_CMD_STEP_PROPERTY, "step_property", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } },
- { MP_CMD_STEP_PROPERTY_OSD, "step_property_osd", { ARG_STRING, OARG_FLOAT(0), OARG_INT(0) } },
+ { MP_CMD_ADD, "add", { ARG_STRING, OARG_FLOAT(0) } },
+ { MP_CMD_CYCLE, "cycle", {
+ ARG_STRING,
+ { .type = {"", NULL, &m_option_type_cycle_dir},
+ .optional = true,
+ .v.f = 1 },
+ }},
- { MP_CMD_SEEK_CHAPTER, "seek_chapter", { ARG_INT, OARG_INT(0) } },
{ MP_CMD_SET_MOUSE_POS, "set_mouse_pos", { ARG_INT, ARG_INT } },
{ MP_CMD_AF_SWITCH, "af_switch", { ARG_STRING } },
@@ -208,14 +196,71 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_AF_CLR, "af_clr", },
{ MP_CMD_AF_CMDLINE, "af_cmdline", { ARG_STRING, ARG_STRING } },
- { MP_CMD_SHOW_CHAPTERS, "show_chapters_osd", },
- { MP_CMD_SHOW_TRACKS, "show_tracks_osd", },
+ { MP_CMD_SHOW_CHAPTERS, "show_chapters", },
+ { MP_CMD_SHOW_TRACKS, "show_tracks", },
{ MP_CMD_VO_CMDLINE, "vo_cmdline", { ARG_STRING } },
{0}
};
+// Map legacy commands to proper commands
+struct legacy_cmd {
+ const char *old, *new;
+};
+static const struct legacy_cmd legacy_cmds[] = {
+ {"loop", "cycle loop"},
+ {"seek_chapter", "add chapter"},
+ {"switch_angle", "cycle angle"},
+ {"pause", "cycle pause"},
+ {"volume", "add volume"},
+ {"mute", "cycle mute"},
+ {"audio_delay", "add audio-delay"},
+ {"switch_audio", "cycle audio"},
+ {"balance", "add balance"},
+ {"vo_fullscreen", "no-osd cycle fullscreen"},
+ {"panscan", "add panscan"},
+ {"vo_ontop", "cycle ontop"},
+ {"vo_rootwin", "cycle rootwin"},
+ {"vo_border", "cycle border"},
+ {"frame_drop", "cycle framedrop"},
+ {"gamma", "add gamma"},
+ {"brightness", "add brightness"},
+ {"contrast", "add contrast"},
+ {"saturation", "add saturation"},
+ {"hue", "add hue"},
+ {"switch_vsync", "cycle vsync"},
+ {"sub_select", "cycle sub"},
+ {"sub_pos", "add sub-pos"},
+ {"sub_delay", "add sub-delay"},
+ {"sub_visibility", "cycle sub-visibility"},
+ {"forced_subs_only", "cycle sub-forced-only"},
+ {"sub_scale", "add sub-scale"},
+ {"ass_use_margins", "cycle ass-use-margins"},
+ {"tv_set_brightness", "add tv-brightness"},
+ {"tv_set_hue", "add tv-hue"},
+ {"tv_set_saturation", "add tv-saturation"},
+ {"tv_set_contrast", "add tv-contrast"},
+ {"step_property_osd", "cycle"},
+ {"step_property", "no-osd cycle"},
+ {"set_property", "no-osd set"},
+ {"set_property_osd", "set"},
+ {"speed_set", "set speed"},
+ {"osd_show_text", "show_text"},
+ {"osd_show_property_text", "show_text"},
+ {"osd_show_progression", "show_progress"},
+ {"show_chapters_osd", "show_chapters"},
+ {"show_tracks_osd", "show_tracks"},
+ // Approximate (can fail if user added additional whitespace)
+ {"pt_step 1", "playlist_next"},
+ {"pt_step -1", "playlist_prev"},
+ // Switch_ratio without argument resets aspect ratio
+ {"switch_ratio ", "set aspect "},
+ {"switch_ratio", "set aspect 0"},
+ {0}
+};
+
+
/// The names of the keys as used in input.conf
/// If you add some new keys, you also need to add them here
@@ -440,6 +485,8 @@ struct input_ctx {
unsigned int num_key_down;
unsigned int last_key_down;
+ bool test;
+
bool default_bindings;
// List of command binding sections
struct cmd_bind_section *cmd_bind_sections;
@@ -481,6 +528,7 @@ static const m_option_t input_conf[] = {
OPT_STRING("ar-dev", input.ar_dev, CONF_GLOBAL),
OPT_STRING("file", input.in_file, CONF_GLOBAL),
OPT_MAKE_FLAGS("default-bindings", input.default_bindings, CONF_GLOBAL),
+ OPT_MAKE_FLAGS("test", input.test, CONF_GLOBAL),
{ NULL, NULL, 0, 0, 0, 0, NULL}
};
@@ -584,11 +632,6 @@ static void queue_remove(struct cmd_queue *queue, struct mp_cmd *cmd)
*p_prev = cmd->queue_next;
}
-static void queue_pop(struct cmd_queue *queue)
-{
- queue_remove(queue, queue->first);
-}
-
static void queue_add(struct cmd_queue *queue, struct mp_cmd *cmd,
bool at_head)
{
@@ -698,146 +741,246 @@ int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select,
return 1;
}
-mp_cmd_t *mp_input_parse_cmd(char *str)
+static int parse_cycle_dir(const struct m_option *opt, struct bstr name,
+ struct bstr param, void *dst)
{
- int i, l;
- int pausing = 0;
- char *ptr;
- const mp_cmd_t *cmd_def;
+ float val;
+ if (bstrcmp0(param, "up") == 0) {
+ val = +1;
+ } else if (bstrcmp0(param, "down") == 0) {
+ val = -1;
+ } else {
+ return m_option_type_float.parse(opt, name, param, dst);
+ }
+ *(float *)dst = val;
+ return 1;
+}
+
+static bool read_token(bstr str, bstr *out_rest, bstr *out_token)
+{
+ bstr t = bstr_lstrip(str);
+ int next = bstrcspn(t, WHITESPACE "#");
+ // Handle comments
+ if (t.start[next] == '#')
+ t = bstr_splice(t, 0, next);
+ if (!t.len)
+ return false;
+ *out_token = bstr_splice(t, 0, next);
+ *out_rest = bstr_cut(t, next);
+ return true;
+}
+
+static bool eat_token(bstr *str, const char *tok)
+{
+ bstr rest, token;
+ if (read_token(*str, &rest, &token) && bstrcmp0(token, tok) == 0) {
+ *str = rest;
+ return true;
+ }
+ return false;
+}
+
+static bool append_escape(bstr *code, char **str)
+{
+ if (code->len < 1)
+ return false;
+ char replace = 0;
+ switch (code->start[0]) {
+ case '"': replace = '"'; break;
+ case '\\': replace = '\\'; break;
+ case 'b': replace = '\b'; break;
+ case 'f': replace = '\f'; break;
+ case 'n': replace = '\n'; break;
+ case 'r': replace = '\r'; break;
+ case 't': replace = '\t'; break;
+ case 'e': replace = '\x1b'; break;
+ case '\'': replace = '\''; break;
+ }
+ if (replace) {
+ *str = talloc_strndup_append_buffer(*str, &replace, 1);
+ *code = bstr_cut(*code, 1);
+ return true;
+ }
+ if (code->start[0] == 'x' && code->len >= 3) {
+ bstr num = bstr_splice(*code, 1, 3);
+ char c = bstrtoll(num, &num, 16);
+ if (!num.len)
+ return false;
+ *str = talloc_strndup_append_buffer(*str, &c, 1);
+ *code = bstr_cut(*code, 3);
+ return true;
+ }
+ if (code->start[0] == 'u' && code->len >= 5) {
+ bstr num = bstr_splice(*code, 1, 5);
+ int c = bstrtoll(num, &num, 16);
+ if (num.len)
+ return false;
+ *str = append_utf8_buffer(*str, c);
+ *code = bstr_cut(*code, 5);
+ return true;
+ }
+ return false;
+}
+
+static bool read_escaped_string(void *talloc_ctx, bstr *str, bstr *literal)
+{
+ bstr t = *str;
+ char *new = talloc_strdup(talloc_ctx, "");
+ while (t.len) {
+ if (t.start[0] == '"')
+ break;
+ if (t.start[0] == '\\') {
+ t = bstr_cut(t, 1);
+ if (!append_escape(&t, &new))
+ goto error;
+ } else {
+ new = talloc_strndup_append_buffer(new, t.start, 1);
+ t = bstr_cut(t, 1);
+ }
+ }
+ int len = str->len - t.len;
+ *literal = new ? bstr0(new) : bstr_splice(*str, 0, len);
+ *str = bstr_cut(*str, len);
+ return true;
+error:
+ talloc_free(new);
+ return false;
+}
- // Ignore heading spaces.
- while (str[0] == ' ' || str[0] == '\t')
- ++str;
+mp_cmd_t *mp_input_parse_cmd(bstr str, const char *loc)
+{
+ int pausing = 0;
+ int on_osd = MP_ON_OSD_AUTO;
+ struct mp_cmd *cmd = NULL;
+ bstr start = str;
+ void *tmp = talloc_new(NULL);
- if (strncmp(str, "pausing ", 8) == 0) {
+ if (eat_token(&str, "pausing")) {
pausing = 1;
- str = &str[8];
- } else if (strncmp(str, "pausing_keep ", 13) == 0) {
+ } else if (eat_token(&str, "pausing_keep")) {
pausing = 2;
- str = &str[13];
- } else if (strncmp(str, "pausing_toggle ", 15) == 0) {
+ } else if (eat_token(&str, "pausing_toggle")) {
pausing = 3;
- str = &str[15];
- } else if (strncmp(str, "pausing_keep_force ", 19) == 0) {
+ } else if (eat_token(&str, "pausing_keep_force")) {
pausing = 4;
- str = &str[19];
}
- ptr = str + strcspn(str, "\t ");
- if (*ptr != 0)
- l = ptr - str;
- else
- l = strlen(str);
-
- if (l == 0)
- return NULL;
-
- for (i = 0; mp_cmds[i].name != NULL; i++) {
- if (strncasecmp(mp_cmds[i].name, str, l) == 0)
+ str = bstr_lstrip(str);
+ for (const struct legacy_cmd *entry = legacy_cmds; entry->old; entry++) {
+ size_t old_len = strlen(entry->old);
+ if (bstrcasecmp(bstr_splice(str, 0, old_len),
+ (bstr) {(char *)entry->old, old_len}) == 0)
+ {
+ mp_tmsg(MSGT_INPUT, MSGL_V, "Warning: command '%s' is "
+ "deprecated, replaced with '%s' at %s.\n",
+ entry->old, entry->new, loc);
+ bstr s = bstr_cut(str, old_len);
+ str = bstr0(talloc_asprintf(tmp, "%s%.*s", entry->new, BSTR_P(s)));
+ start = str;
break;
+ }
}
- if (mp_cmds[i].name == NULL)
- return NULL;
+ if (eat_token(&str, "no-osd")) {
+ on_osd = MP_ON_OSD_NO;
+ } else if (eat_token(&str, "osd-bar")) {
+ on_osd = MP_ON_OSD_BAR;
+ } else if (eat_token(&str, "osd-msg")) {
+ on_osd = MP_ON_OSD_MSG;
+ } else if (eat_token(&str, "osd-msg-bar")) {
+ on_osd = MP_ON_OSD_MSG | MP_ON_OSD_BAR;
+ } else if (eat_token(&str, "osd-auto")) {
+ // default
+ }
- cmd_def = &mp_cmds[i];
+ int cmd_idx = 0;
+ while (mp_cmds[cmd_idx].name != NULL) {
+ if (eat_token(&str, mp_cmds[cmd_idx].name))
+ break;
+ cmd_idx++;
+ }
- mp_cmd_t *cmd = talloc_ptrtype(NULL, cmd);
- *cmd = (mp_cmd_t){
- .id = cmd_def->id,
- .name = talloc_strdup(cmd, cmd_def->name),
- .pausing = pausing,
- };
+ if (mp_cmds[cmd_idx].name == NULL) {
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command '%.*s' not found.\n",
+ BSTR_P(str));
+ goto error;
+ }
- ptr = str;
+ cmd = talloc_ptrtype(NULL, cmd);
+ *cmd = mp_cmds[cmd_idx];
+ cmd->pausing = pausing;
+ cmd->on_osd = on_osd;
- for (i = 0; ptr && i < MP_CMD_MAX_ARGS; i++) {
- while (ptr[0] != ' ' && ptr[0] != '\t' && ptr[0] != '\0')
- ptr++;
- if (ptr[0] == '\0')
- break;
- while (ptr[0] == ' ' || ptr[0] == '\t')
- ptr++;
- if (ptr[0] == '\0' || ptr[0] == '#')
+ for (int i = 0; i < MP_CMD_MAX_ARGS; i++) {
+ struct mp_cmd_arg *cmdarg = &cmd->args[i];
+ if (!cmdarg->type.type)
break;
- cmd->args[i].type = cmd_def->args[i].type;
- switch (cmd_def->args[i].type) {
- case MP_CMD_ARG_INT:
- errno = 0;
- cmd->args[i].v.i = atoi(ptr);
- if (errno != 0) {
+ cmd->nargs++;
+ str = bstr_lstrip(str);
+ bstr arg = {0};
+ if (cmdarg->type.type == &m_option_type_string &&
+ bstr_eatstart0(&str, "\""))
+ {
+ if (!read_escaped_string(tmp, &str, &arg)) {
mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s: argument %d "
- "isn't an integer.\n", cmd_def->name, i + 1);
+ "has broken string escapes.\n", cmd->name, i + 1);
goto error;
}
- break;
- case MP_CMD_ARG_FLOAT:
- errno = 0;
- cmd->args[i].v.f = atof(ptr);
- if (errno != 0) {
- mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s: argument %d "
- "isn't a float.\n", cmd_def->name, i + 1);
+ if (!bstr_eatstart0(&str, "\"")) {
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s: argument %d is "
+ "unterminated.\n", cmd->name, i + 1);
goto error;
}
- break;
- case MP_CMD_ARG_STRING: {
- int term = ' ';
- if (*ptr == '\'' || *ptr == '"')
- term = *ptr++;
- char *argptr = talloc_size(cmd, strlen(ptr) + 1);
- cmd->args[i].v.s = argptr;
- while (1) {
- if (*ptr == 0) {
- if (term == ' ')
- break;
- mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s: argument %d is "
- "unterminated.\n", cmd_def->name, i + 1);
- goto error;
- }
- if (*ptr == term || (*ptr == '\t' && term == ' '))
- break;
- if (*ptr == '\\')
- ptr++;
- if (*ptr != 0)
- *argptr++ = *ptr++;
- }
- *argptr = 0;
- break;
+ } else {
+ if (!read_token(str, &str, &arg))
+ break;
+ if (cmdarg->optional && bstrcmp0(arg, "-") == 0)
+ continue;
}
- case 0:
- ptr = NULL;
- break;
- default:
- mp_tmsg(MSGT_INPUT, MSGL_ERR, "Unknown argument %d\n", i);
+ // Prevent option API from trying to deallocate static strings
+ cmdarg->v = ((struct mp_cmd_arg) {{0}}).v;
+ int r = m_option_parse(&cmdarg->type, bstr0(cmd->name), arg, &cmdarg->v);
+ if (r < 0) {
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s: argument %d "
+ "can't be parsed: %s.\n", cmd->name, i + 1,
+ m_option_strerror(r));
+ goto error;
}
+ if (cmdarg->type.type == &m_option_type_string)
+ cmdarg->v.s = talloc_steal(cmd, cmdarg->v.s);
}
- cmd->nargs = i;
- int min_args;
- for (min_args = 0; min_args < MP_CMD_MAX_ARGS
- && cmd_def->args[min_args].type
- && !cmd_def->args[min_args].optional; min_args++);
- if (cmd->nargs < min_args) {
- mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command \"%s\" requires at least %d "
- "arguments, we found only %d so far.\n", cmd_def->name,
- min_args, cmd->nargs);
+ bstr dummy;
+ if (read_token(str, &dummy, &dummy)) {
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s has trailing unused "
+ "arguments: '%.*s'.\n", cmd->name, BSTR_P(str));
+ // Better make it fatal to make it clear something is wrong.
goto error;
}
- for (; i < MP_CMD_MAX_ARGS && cmd_def->args[i].type; i++) {
- memcpy(&cmd->args[i], &cmd_def->args[i], sizeof(struct mp_cmd_arg));
- if (cmd_def->args[i].type == MP_CMD_ARG_STRING
- && cmd_def->args[i].v.s != NULL)
- cmd->args[i].v.s = talloc_strdup(cmd, cmd_def->args[i].v.s);
+ int min_args = 0;
+ while (min_args < MP_CMD_MAX_ARGS && cmd->args[min_args].type.type
+ && !cmd->args[min_args].optional)
+ {
+ min_args++;
+ }
+ if (cmd->nargs < min_args) {
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command %s requires at least %d "
+ "arguments, we found only %d so far.\n", cmd->name, min_args,
+ cmd->nargs);
+ goto error;
}
- if (i < MP_CMD_MAX_ARGS)
- cmd->args[i].type = 0;
+ bstr orig = (bstr) {start.start, str.start - start.start};
+ cmd->original = bstrdup(cmd, bstr_strip(orig));
+ talloc_free(tmp);
return cmd;
- error:
- mp_cmd_free(cmd);
+error:
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Command was defined at %s.\n", loc);
+ talloc_free(cmd);
+ talloc_free(tmp);
return NULL;
}
@@ -950,37 +1093,91 @@ static int read_wakeup(void *ctx, int fd)
return MP_INPUT_NOTHING;
}
+static bool bind_matches_key(struct cmd_bind *bind, int n, int *keys);
+
+static void append_bind_info(char **pmsg, struct cmd_bind *bind)
+{
+ char *msg = *pmsg;
+ struct mp_cmd *cmd = mp_input_parse_cmd(bstr0(bind->cmd), bind->location);
+ bstr stripped = cmd ? cmd->original : bstr0(bind->cmd);
+ msg = talloc_asprintf_append(msg, " '%.*s'", BSTR_P(stripped));
+ if (!cmd)
+ msg = talloc_asprintf_append(msg, " (invalid)");
+ if (strcmp(bind->owner->section, "default") != 0)
+ msg = talloc_asprintf_append(msg, " in section {%s}",
+ bind->owner->section);
+ if (bind->owner->is_builtin) {
+ msg = talloc_asprintf_append(msg, " (default binding)");
+ } else {
+ msg = talloc_asprintf_append(msg, " in %s", bind->location);
+ }
+ *pmsg = msg;
+}
-static char *find_bind_for_key(const struct cmd_bind *binds, int n, int *keys)
+static mp_cmd_t *handle_test(struct input_ctx *ictx, int n, int *keys)
+{
+ char *key_buf = get_key_combo_name(keys, n);
+ // "$>" to disable property substitution when invoking "show_text"
+ char *msg = talloc_asprintf(NULL, "$>Key %s is bound to:\n", key_buf);
+ talloc_free(key_buf);
+
+ int count = 0;
+ for (struct cmd_bind_section *bs = ictx->cmd_bind_sections;
+ bs; bs = bs->next)
+ {
+ for (struct cmd_bind *bind = bs->cmd_binds; bind->cmd; bind++) {
+ if (bind_matches_key(bind, n, keys)) {
+ count++;
+ msg = talloc_asprintf_append(msg, "%d. ", count);
+ append_bind_info(&msg, bind);
+ msg = talloc_asprintf_append(msg, "\n");
+ }
+ }
+ }
+
+ if (!count)
+ msg = talloc_asprintf_append(msg, "(nothing)");
+
+ mp_cmd_t *res = mp_input_parse_cmd(bstr0("show_text \"\""), "");
+ res->args[0].v.s = talloc_steal(res, msg);
+ return res;
+}
+
+static bool bind_matches_key(struct cmd_bind *bind, int n, int *keys)
+{
+ int found = 1, s;
+ for (s = 0; s < n && bind->input[s] != 0; s++) {
+ if (bind->input[s] != keys[s]) {
+ found = 0;
+ break;
+ }
+ }
+ return found && bind->input[s] == 0 && s == n;
+}
+
+static struct cmd_bind *find_bind_for_key(struct cmd_bind *binds, int n,
+ int *keys)
{
int j;
if (n <= 0)
return NULL;
for (j = 0; binds[j].cmd != NULL; j++) {
- int found = 1, s;
- for (s = 0; s < n && binds[j].input[s] != 0; s++) {
- if (binds[j].input[s] != keys[s]) {
- found = 0;
- break;
- }
- }
- if (found && binds[j].input[s] == 0 && s == n)
+ if (bind_matches_key(&binds[j], n, keys))
break;
}
- return binds[j].cmd;
+ return binds[j].cmd ? &binds[j] : NULL;
}
static struct cmd_bind_section *get_bind_section(struct input_ctx *ictx,
- bool builtin,
- char *section)
+ bool builtin, bstr section)
{
struct cmd_bind_section *bind_section = ictx->cmd_bind_sections;
- if (section == NULL)
- section = "default";
+ if (section.len == 0)
+ section = bstr0("default");
while (bind_section) {
- if (strcmp(section, bind_section->section) == 0
+ if (bstrcmp0(section, bind_section->section) == 0
&& builtin == bind_section->is_builtin)
return bind_section;
if (bind_section->next == NULL)
@@ -995,27 +1192,28 @@ static struct cmd_bind_section *get_bind_section(struct input_ctx *ictx,
bind_section = ictx->cmd_bind_sections;
}
bind_section->cmd_binds = NULL;
- bind_section->section = talloc_strdup(bind_section, section);
+ bind_section->section = bstrdup0(bind_section, section);
bind_section->is_builtin = builtin;
bind_section->next = NULL;
return bind_section;
}
-static char *section_find_bind_for_key(struct input_ctx *ictx,
- bool builtin, char *section,
- int n, int *keys)
+static struct cmd_bind *section_find_bind_for_key(struct input_ctx *ictx,
+ bool builtin, char *section,
+ int n, int *keys)
{
- struct cmd_bind_section *bs = get_bind_section(ictx, builtin, section);
- const struct cmd_bind *binds = bs->cmd_binds;
- return binds ? find_bind_for_key(binds, n, keys) : NULL;
+ struct cmd_bind_section *bs = get_bind_section(ictx, builtin,
+ bstr0(section));
+ return bs->cmd_binds ? find_bind_for_key(bs->cmd_binds, n, keys) : NULL;
}
static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys)
{
- char *cmd = NULL;
- mp_cmd_t *ret;
+ if (ictx->test)
+ return handle_test(ictx, n, keys);
- cmd = section_find_bind_for_key(ictx, false, ictx->section, n, keys);
+ struct cmd_bind *cmd
+ = section_find_bind_for_key(ictx, false, ictx->section, n, keys);
if (ictx->default_bindings && cmd == NULL)
cmd = section_find_bind_for_key(ictx, true, ictx->section, n, keys);
if (!(ictx->section_flags & MP_INPUT_NO_DEFAULT_SECTION)) {
@@ -1032,13 +1230,11 @@ static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys)
talloc_free(key_buf);
return NULL;
}
- if (strcmp(cmd, "ignore") == 0)
- return NULL;
- ret = mp_input_parse_cmd(cmd);
+ mp_cmd_t *ret = mp_input_parse_cmd(bstr0(cmd->cmd), cmd->location);
if (!ret) {
char *key_buf = get_key_combo_name(keys, n);
mp_tmsg(MSGT_INPUT, MSGL_ERR,
- "Invalid command for bound key '%s': '%s'\n", key_buf, cmd);
+ "Invalid command for bound key '%s': '%s'\n", key_buf, cmd->cmd);
talloc_free(key_buf);
}
return ret;
@@ -1166,7 +1362,10 @@ void mp_input_feed_key(struct input_ctx *ictx, int code)
struct cmd_queue *queue = &ictx->key_cmd_queue;
if (queue_count_cmds(queue) >= ictx->key_fifo_size &&
(!mp_input_is_abort_cmd(cmd->id) || queue_has_abort_cmds(queue)))
+ {
+ talloc_free(cmd);
return;
+ }
queue_add(queue, cmd, false);
}
@@ -1176,7 +1375,7 @@ static void read_cmd_fd(struct input_ctx *ictx, struct input_fd *cmd_fd)
char *text;
while ((r = read_cmd(cmd_fd, &text)) >= 0) {
ictx->got_new_events = true;
- struct mp_cmd *cmd = mp_input_parse_cmd(text);
+ struct mp_cmd *cmd = mp_input_parse_cmd(bstr0(text), "<pipe>");
talloc_free(text);
if (cmd)
queue_add(&ictx->control_cmd_queue, cmd, false);
@@ -1323,25 +1522,25 @@ int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t *cmd)
mp_cmd_t *mp_input_get_cmd(struct input_ctx *ictx, int time, int peek_only)
{
if (async_quit_request)
- return mp_input_parse_cmd("quit 1");
+ return mp_input_parse_cmd(bstr0("quit 1"), "");
if (ictx->control_cmd_queue.first || ictx->key_cmd_queue.first)
time = 0;
read_all_events(ictx, time);
- struct mp_cmd *ret;
struct cmd_queue *queue = &ictx->control_cmd_queue;
if (!queue->first)
queue = &ictx->key_cmd_queue;
if (!queue->first) {
- ret = check_autorepeat(ictx);
- if (!ret)
- return NULL;
- queue_add(queue, ret, false);
- } else
- ret = queue->first;
+ struct mp_cmd *repeated = check_autorepeat(ictx);
+ if (repeated)
+ queue_add(queue, repeated, false);
+ }
+ struct mp_cmd *ret = queue->first;
+ if (!ret)
+ return NULL;
if (!peek_only)
- queue_pop(queue);
+ queue_remove(queue, ret);
return ret;
}
@@ -1358,8 +1557,8 @@ mp_cmd_t *mp_cmd_clone(mp_cmd_t *cmd)
ret = talloc_memdup(NULL, cmd, sizeof(mp_cmd_t));
ret->name = talloc_strdup(ret, cmd->name);
- for (i = 0; i < MP_CMD_MAX_ARGS && cmd->args[i].type; i++) {
- if (cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL)
+ for (i = 0; i < MP_CMD_MAX_ARGS; i++) {
+ if (cmd->args[i].type.type == &m_option_type_string)
ret->args[i].v.s = talloc_strdup(ret, cmd->args[i].v.s);
}
@@ -1428,24 +1627,15 @@ static int get_input_from_name(char *name, int *keys)
return 1;
}
-static void bind_keys(struct input_ctx *ictx, bool builtin,
- const int keys[MP_MAX_KEY_DOWN + 1], bstr command)
+static void bind_keys(struct input_ctx *ictx, bool builtin, bstr section,
+ const int keys[MP_MAX_KEY_DOWN + 1], bstr command,
+ const char *loc)
{
int i = 0, j;
struct cmd_bind *bind = NULL;
struct cmd_bind_section *bind_section = NULL;
- char *section = NULL;
-
- if (bstr_startswith0(command, "{")) {
- int p = bstrchr(command, '}');
- if (p != -1) {
- bstr bsection = bstr_strip(bstr_splice(command, 1, p));
- section = bstrdup0(NULL, bsection);
- command = bstr_lstrip(bstr_cut(command, p + 1));
- }
- }
+
bind_section = get_bind_section(ictx, builtin, section);
- talloc_free(section);
if (bind_section->cmd_binds) {
for (i = 0; bind_section->cmd_binds[i].cmd != NULL; i++) {
@@ -1467,14 +1657,24 @@ static void bind_keys(struct input_ctx *ictx, bool builtin,
}
talloc_free(bind->cmd);
bind->cmd = bstrdup0(bind_section->cmd_binds, command);
+ bind->location = talloc_strdup(bind_section->cmd_binds, loc);
+ bind->owner = bind_section;
memcpy(bind->input, keys, (MP_MAX_KEY_DOWN + 1) * sizeof(int));
}
-static int parse_config(struct input_ctx *ictx, bool builtin, bstr data)
+static int parse_config(struct input_ctx *ictx, bool builtin, bstr data,
+ const char *location)
{
int n_binds = 0, keys[MP_MAX_KEY_DOWN + 1];
+ int line_no = 0;
+ char *cur_loc = NULL;
while (data.len) {
+ line_no++;
+ if (cur_loc)
+ talloc_free(cur_loc);
+ cur_loc = talloc_asprintf(NULL, "%s:%d", location, line_no);
+
bstr line = bstr_strip_linebreaks(bstr_getline(data, &data));
line = bstr_lstrip(line);
if (line.len == 0 || bstr_startswith0(line, "#"))
@@ -1485,21 +1685,37 @@ static int parse_config(struct input_ctx *ictx, bool builtin, bstr data)
command = bstr_strip(command);
if (command.len == 0) {
mp_tmsg(MSGT_INPUT, MSGL_ERR,
- "Unfinished key binding: %.*s\n", BSTR_P(line));
+ "Unfinished key binding: %.*s at %s\n", BSTR_P(line),
+ cur_loc);
continue;
}
char *name = bstrdup0(NULL, keyname);
if (!get_input_from_name(name, keys)) {
talloc_free(name);
mp_tmsg(MSGT_INPUT, MSGL_ERR,
- "Unknown key '%.*s'\n", BSTR_P(keyname));
+ "Unknown key '%.*s' at %s\n", BSTR_P(keyname), cur_loc);
continue;
}
talloc_free(name);
- bind_keys(ictx, builtin, keys, command);
+
+ bstr section = {0};
+ if (bstr_startswith0(command, "{")) {
+ int p = bstrchr(command, '}');
+ if (p != -1) {
+ section = bstr_strip(bstr_splice(command, 1, p));
+ command = bstr_lstrip(bstr_cut(command, p + 1));
+ }
+ }
+
+ bind_keys(ictx, builtin, section, keys, command, cur_loc);
n_binds++;
+
+ // Print warnings if invalid commands are encountered.
+ talloc_free(mp_input_parse_cmd(command, cur_loc));
}
+ talloc_free(cur_loc);
+
return n_binds;
}
@@ -1514,7 +1730,7 @@ static int parse_config_file(struct input_ctx *ictx, char *file)
res = stream_read_complete(s, NULL, 1000000, 0);
free_stream(s);
mp_msg(MSGT_INPUT, MSGL_V, "Parsing input config file %s\n", file);
- int n_binds = parse_config(ictx, false, res);
+ int n_binds = parse_config(ictx, false, res, file);
talloc_free(res.start);
mp_msg(MSGT_INPUT, MSGL_V, "Input config file %s parsed: %d binds\n",
file, n_binds);
@@ -1542,11 +1758,12 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf)
.ar_delay = input_conf->ar_delay,
.ar_rate = input_conf->ar_rate,
.default_bindings = input_conf->default_bindings,
+ .test = input_conf->test,
.wakeup_pipe = {-1, -1},
};
ictx->section = talloc_strdup(ictx, "default");
- parse_config(ictx, true, bstr0(builtin_input_conf));
+ parse_config(ictx, true, bstr0(builtin_input_conf), "<default>");
#ifdef CONFIG_COCOA
cocoa_events_init(ictx, read_all_fd_events);
@@ -1612,7 +1829,7 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf)
#ifdef CONFIG_LIRCC
if (input_conf->use_lircc) {
- int fd = lircc_init("mplayer", NULL);
+ int fd = lircc_init("mpv", NULL);
if (fd >= 0)
mp_input_add_cmd_fd(ictx, fd, 1, NULL, lircc_cleanup);
}
@@ -1702,24 +1919,11 @@ static int print_cmd_list(m_option_t *cfg, char *optname, char *optparam)
{
const mp_cmd_t *cmd;
int i, j;
- const char *type;
for (i = 0; (cmd = &mp_cmds[i])->name != NULL; i++) {
printf("%-20.20s", cmd->name);
- for (j = 0; j < MP_CMD_MAX_ARGS && cmd->args[j].type; j++) {
- switch (cmd->args[j].type) {
- case MP_CMD_ARG_INT:
- type = "Integer";
- break;
- case MP_CMD_ARG_FLOAT:
- type = "Float";
- break;
- case MP_CMD_ARG_STRING:
- type = "String";
- break;
- default:
- type = "??";
- }
+ for (j = 0; j < MP_CMD_MAX_ARGS && cmd->args[j].type.type; j++) {
+ const char *type = cmd->args[j].type.type->name;
if (cmd->args[j].optional)
printf(" [%s]", type);
else
diff --git a/input/input.h b/input/input.h
index ddd9016203..59f2d031ff 100644
--- a/input/input.h
+++ b/input/input.h
@@ -20,106 +20,49 @@
#define MPLAYER_INPUT_H
#include <stdbool.h>
+#include "bstr.h"
+#include "m_option.h"
// All command IDs
enum mp_command_type {
+ MP_CMD_IGNORE,
MP_CMD_SEEK,
- MP_CMD_AUDIO_DELAY,
MP_CMD_QUIT,
- MP_CMD_PAUSE,
- MP_CMD_GRAB_FRAMES, // deprecated: was a no-op command for years
MP_CMD_PLAYLIST_NEXT,
MP_CMD_PLAYLIST_PREV,
- MP_CMD_SUB_DELAY,
MP_CMD_OSD,
- MP_CMD_VOLUME,
- MP_CMD_MIXER_USEMASTER,
- MP_CMD_CONTRAST,
- MP_CMD_BRIGHTNESS,
- MP_CMD_HUE,
- MP_CMD_SATURATION,
- MP_CMD_FRAMEDROPPING,
MP_CMD_TV_STEP_CHANNEL,
MP_CMD_TV_STEP_NORM,
MP_CMD_TV_STEP_CHANNEL_LIST,
- MP_CMD_VO_FULLSCREEN,
- MP_CMD_SUB_POS,
MP_CMD_SCREENSHOT,
- MP_CMD_PANSCAN,
- MP_CMD_MUTE,
MP_CMD_LOADFILE,
MP_CMD_LOADLIST,
MP_CMD_PLAYLIST_CLEAR,
- MP_CMD_GAMMA,
- MP_CMD_SUB_VISIBILITY,
- MP_CMD_VOBSUB_LANG, // deprecated: combined with SUB_SELECT
- MP_CMD_GET_TIME_LENGTH,
- MP_CMD_GET_PERCENT_POS,
MP_CMD_SUB_STEP,
MP_CMD_TV_SET_CHANNEL,
MP_CMD_EDL_MARK,
- MP_CMD_SUB_ALIGNMENT,
MP_CMD_TV_LAST_CHANNEL,
- MP_CMD_OSD_SHOW_TEXT,
MP_CMD_TV_SET_FREQ,
MP_CMD_TV_SET_NORM,
- MP_CMD_TV_SET_BRIGHTNESS,
- MP_CMD_TV_SET_CONTRAST,
- MP_CMD_TV_SET_HUE,
- MP_CMD_TV_SET_SATURATION,
- MP_CMD_GET_VO_FULLSCREEN,
- MP_CMD_GET_SUB_VISIBILITY,
- MP_CMD_SUB_FORCED_ONLY,
- MP_CMD_VO_ONTOP,
- MP_CMD_SUB_SELECT,
- MP_CMD_VO_ROOTWIN,
- MP_CMD_SWITCH_VSYNC,
- MP_CMD_SWITCH_RATIO,
MP_CMD_FRAME_STEP,
- MP_CMD_SPEED_INCR,
MP_CMD_SPEED_MULT,
- MP_CMD_SPEED_SET,
MP_CMD_RUN,
- MP_CMD_SWITCH_AUDIO,
- MP_CMD_GET_TIME_POS,
MP_CMD_SUB_LOAD,
MP_CMD_KEYDOWN_EVENTS,
- MP_CMD_VO_BORDER,
- MP_CMD_SET_PROPERTY,
- MP_CMD_SET_PROPERTY_OSD,
+ MP_CMD_SET,
MP_CMD_GET_PROPERTY,
- MP_CMD_OSD_SHOW_PROPERTY_TEXT,
- MP_CMD_OSD_SHOW_PROGRESSION,
- MP_CMD_SEEK_CHAPTER,
- MP_CMD_GET_FILENAME,
- MP_CMD_GET_VIDEO_CODEC,
- MP_CMD_GET_VIDEO_BITRATE,
- MP_CMD_GET_VIDEO_RESOLUTION,
- MP_CMD_GET_AUDIO_CODEC,
- MP_CMD_GET_AUDIO_BITRATE,
- MP_CMD_GET_AUDIO_SAMPLES,
- MP_CMD_GET_META_TITLE,
- MP_CMD_GET_META_ARTIST,
- MP_CMD_GET_META_ALBUM,
- MP_CMD_GET_META_YEAR,
- MP_CMD_GET_META_COMMENT,
- MP_CMD_GET_META_TRACK,
- MP_CMD_GET_META_GENRE,
+ MP_CMD_PRINT_TEXT,
+ MP_CMD_SHOW_TEXT,
+ MP_CMD_SHOW_PROGRESS,
MP_CMD_RADIO_STEP_CHANNEL,
MP_CMD_RADIO_SET_CHANNEL,
MP_CMD_RADIO_SET_FREQ,
MP_CMD_SET_MOUSE_POS,
- MP_CMD_STEP_PROPERTY,
- MP_CMD_STEP_PROPERTY_OSD,
+ MP_CMD_ADD,
+ MP_CMD_CYCLE,
MP_CMD_RADIO_STEP_FREQ,
MP_CMD_TV_STEP_FREQ,
- MP_CMD_LOOP,
- MP_CMD_BALANCE,
- MP_CMD_SUB_SCALE,
MP_CMD_TV_START_SCAN,
- MP_CMD_SWITCH_ANGLE,
- MP_CMD_ASS_USE_MARGINS,
- MP_CMD_SWITCH_TITLE,
MP_CMD_STOP,
/// DVB commands
@@ -139,11 +82,6 @@ enum mp_command_type {
MP_CMD_VO_CMDLINE,
};
-// The arg types
-#define MP_CMD_ARG_INT 1
-#define MP_CMD_ARG_FLOAT 2
-#define MP_CMD_ARG_STRING 3
-
#define MP_CMD_MAX_ARGS 10
// Error codes for the drivers
@@ -159,6 +97,13 @@ enum mp_command_type {
// Key FIFO was full - release events may be lost, zero button-down status
#define MP_INPUT_RELEASE_ALL -5
+enum mp_on_osd {
+ MP_ON_OSD_NO = 0, // prefer not using OSD
+ MP_ON_OSD_AUTO = 1, // use default behavior of the specific command
+ MP_ON_OSD_BAR = 2, // force a bar, if applicable
+ MP_ON_OSD_MSG = 4, // force a message, if applicable
+};
+
enum mp_input_section_flags {
// If a key binding is not defined in the current section, search the
// default section for it ("default" refers to bindings with no section
@@ -169,7 +114,7 @@ enum mp_input_section_flags {
struct input_ctx;
struct mp_cmd_arg {
- int type;
+ struct m_option type;
bool optional;
union {
int i;
@@ -184,6 +129,8 @@ typedef struct mp_cmd {
struct mp_cmd_arg args[MP_CMD_MAX_ARGS];
int nargs;
int pausing;
+ enum mp_on_osd on_osd;
+ bstr original;
struct mp_cmd *queue_next;
} mp_cmd_t;
@@ -234,8 +181,9 @@ int mp_input_queue_cmd(struct input_ctx *ictx, struct mp_cmd *cmd);
struct mp_cmd *mp_input_get_cmd(struct input_ctx *ictx, int time,
int peek_only);
-/* Parse text and return corresponding struct mp_cmd. */
-struct mp_cmd *mp_input_parse_cmd(char *str);
+// Parse text and return corresponding struct mp_cmd.
+// The location parameter is for error messages.
+struct mp_cmd *mp_input_parse_cmd(bstr str, const char *location);
// After getting a command from mp_input_get_cmd you need to free it using this
// function
diff --git a/input/lirc.c b/input/lirc.c
index 23454d6aee..fd64beb479 100644
--- a/input/lirc.c
+++ b/input/lirc.c
@@ -41,7 +41,7 @@ mp_input_lirc_init(void) {
int mode;
mp_tmsg(MSGT_LIRC,MSGL_V,"Setting up LIRC support...\n");
- if((lirc_sock=lirc_init("mplayer",0))==-1){
+ if((lirc_sock=lirc_init("mpv",0))==-1){
mp_tmsg(MSGT_LIRC,MSGL_V,"Failed to open LIRC support. You will not be able to use your remote control.\n");
return -1;
}
diff --git a/libaf/af_export.c b/libaf/af_export.c
index 193271b45e..b5e5a884c0 100644
--- a/libaf/af_export.c
+++ b/libaf/af_export.c
@@ -41,8 +41,8 @@
#include "path.h"
#define DEF_SZ 512 // default buffer size (in samples)
-#define SHARED_FILE "mplayer-af_export" /* default file name
- (relative to ~/.mplayer/ */
+#define SHARED_FILE "mpv-af_export" /* default file name
+ (relative to ~/.mpv/ */
#define SIZE_HEADER (2 * sizeof(int) + sizeof(unsigned long long))
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c
index ba665d9b73..e0322c70d5 100644
--- a/libao2/ao_alsa.c
+++ b/libao2/ao_alsa.c
@@ -269,7 +269,7 @@ static void print_help (void)
{
mp_tmsg (MSGT_AO, MSGL_FATAL,
"\n[AO_ALSA] -ao alsa commandline help:\n"\
- "[AO_ALSA] Example: mplayer -ao alsa:device=hw=0.3\n"\
+ "[AO_ALSA] Example: mpv -ao alsa:device=hw=0.3\n"\
"[AO_ALSA] Sets first card fourth hardware device.\n\n"\
"[AO_ALSA] Options:\n"\
"[AO_ALSA] noblock\n"\
diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c
index e78973ec04..e0d2d6d26c 100644
--- a/libao2/ao_coreaudio.c
+++ b/libao2/ao_coreaudio.c
@@ -378,7 +378,7 @@ static void print_help(void)
mp_msg(MSGT_AO, MSGL_FATAL,
"\n-ao coreaudio commandline help:\n"
- "Example: mplayer -ao coreaudio:device_id=266\n"
+ "Example: mpv -ao coreaudio:device_id=266\n"
" open Core Audio with output device ID 266.\n"
"\nOptions:\n"
" device_id\n"
diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c
index a72ed32022..4ef7029c29 100644
--- a/libao2/ao_dsound.c
+++ b/libao2/ao_dsound.c
@@ -184,7 +184,7 @@ static void print_help(void)
{
mp_msg(MSGT_AO, MSGL_FATAL,
"\n-ao dsound commandline help:\n"
- "Example: mplayer -ao dsound:device=1\n"
+ "Example: mpv -ao dsound:device=1\n"
" sets 1st device\n"
"\nOptions:\n"
" device=<device-number>\n"
diff --git a/libao2/ao_jack.c b/libao2/ao_jack.c
index 5a80bb34bb..b30f99a14e 100644
--- a/libao2/ao_jack.c
+++ b/libao2/ao_jack.c
@@ -188,8 +188,8 @@ static void print_help (void)
{
mp_msg (MSGT_AO, MSGL_FATAL,
"\n-ao jack commandline help:\n"
- "Example: mplayer -ao jack:port=myout\n"
- " connects MPlayer to the jack ports named myout\n"
+ "Example: mpv -ao jack:port=myout\n"
+ " connects mpv to the jack ports named myout\n"
"\nOptions:\n"
" port=<port name>\n"
" Connects to the given ports instead of the default physical ones\n"
@@ -228,7 +228,7 @@ static int init(int rate, int channels, int format, int flags) {
}
if (!client_name) {
client_name = malloc(40);
- sprintf(client_name, "MPlayer [%d]", getpid());
+ sprintf(client_name, "mpv [%d]", getpid());
}
if (!autostart)
open_options |= JackNoStartServer;
diff --git a/libao2/ao_lavc.c b/libao2/ao_lavc.c
index b22cd325dc..d4523f0d54 100644
--- a/libao2/ao_lavc.c
+++ b/libao2/ao_lavc.c
@@ -56,6 +56,7 @@ struct priv {
int64_t lastpts;
int sample_size;
const void *sample_padding;
+ double expected_next_pts;
AVRational worst_time_base;
int worst_time_base_is_stream;
@@ -288,7 +289,7 @@ static void fill_with_padding(void *buf, int cnt, int sz, const void *padding)
}
// close audio device
-static int encode(struct ao *ao, int ptsvalid, double apts, void *data);
+static int encode(struct ao *ao, double apts, void *data);
static void uninit(struct ao *ao, bool cut_audio)
{
struct priv *ac = ao->priv;
@@ -302,12 +303,12 @@ static void uninit(struct ao *ao, bool cut_audio)
(ac->aframesize * ao->channels * ac->sample_size
- ao->buffer.len) / ac->sample_size,
ac->sample_size, ac->sample_padding);
- encode(ao, ao->pts != MP_NOPTS_VALUE, pts, paddingbuf);
+ encode(ao, pts, paddingbuf);
pts += ac->aframesize / (double) ao->samplerate;
talloc_free(paddingbuf);
ao->buffer.len = 0;
}
- while (encode(ao, true, pts, NULL) > 0) ;
+ while (encode(ao, pts, NULL) > 0) ;
}
ao->priv = NULL;
@@ -320,7 +321,7 @@ static int get_space(struct ao *ao)
}
// must get exactly ac->aframesize amount of data
-static int encode(struct ao *ao, int ptsvalid, double apts, void *data)
+static int encode(struct ao *ao, double apts, void *data)
{
AVFrame *frame;
AVPacket packet;
@@ -338,7 +339,7 @@ static int encode(struct ao *ao, int ptsvalid, double apts, void *data)
ac->aframesize * ao->channels, ac->sample_size);
}
- if (data && ptsvalid)
+ if (data)
ectx->audio_pts_offset = realapts - apts;
av_init_packet(&packet);
@@ -354,12 +355,9 @@ static int encode(struct ao *ao, int ptsvalid, double apts, void *data)
return -1;
}
- if (ao->encode_lavc_ctx->options->rawts) {
- // raw audio pts
- frame->pts = floor(apts * ac->stream->codec->time_base.den / ac->stream->codec->time_base.num + 0.5);
- } else if (ectx->options->copyts) {
+ if (ectx->options->rawts || ectx->options->copyts) {
// real audio pts
- frame->pts = floor((apts + ectx->discontinuity_pts_offset) * ac->stream->codec->time_base.den / ac->stream->codec->time_base.num + 0.5);
+ frame->pts = floor(apts * ac->stream->codec->time_base.den / ac->stream->codec->time_base.num + 0.5);
} else {
// audio playback time
frame->pts = floor(realapts * ac->stream->codec->time_base.den / ac->stream->codec->time_base.num + 0.5);
@@ -385,7 +383,7 @@ static int encode(struct ao *ao, int ptsvalid, double apts, void *data)
ac->savepts = frame->pts;
}
- av_free(frame);
+ av_free(frame);
}
else
{
@@ -407,6 +405,8 @@ static int encode(struct ao *ao, int ptsvalid, double apts, void *data)
encode_lavc_write_stats(ao->encode_lavc_ctx, ac->stream);
+ packet.stream_index = ac->stream->index;
+
// Do we need this at all? Better be safe than sorry...
if (packet.pts == AV_NOPTS_VALUE) {
mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: encoder lost pts, why?\n");
@@ -449,6 +449,8 @@ static int play(struct ao *ao, void *data, int len, int flags)
int64_t ptsoffset;
void *paddingbuf = NULL;
double nextpts;
+ double pts = ao->pts;
+ double outpts;
len /= ac->sample_size * ao->channels;
@@ -456,6 +458,11 @@ static int play(struct ao *ao, void *data, int len, int flags)
mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: NOTE: deferred initial audio frame (probably because video is not there yet)\n");
return 0;
}
+ if (pts == MP_NOPTS_VALUE) {
+ mp_msg(MSGT_ENCODE, MSGL_WARN, "ao-lavc: frame without pts, please report; synthesizing pts instead\n");
+ // synthesize pts from previous expected next pts
+ pts = ac->expected_next_pts;
+ }
if (ac->worst_time_base.den == 0) {
//if (ac->stream->codec->time_base.num / ac->stream->codec->time_base.den >= ac->stream->time_base.num / ac->stream->time_base.den)
@@ -549,26 +556,43 @@ static int play(struct ao *ao, void *data, int len, int flags)
}
}
- // fix the discontinuity pts offset
- if (ectx->discontinuity_pts_offset == MP_NOPTS_VALUE) {
- nextpts = ao->pts + ptsoffset / (double) ao->samplerate;
- ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
+ if (!ectx->options->rawts && ectx->options->copyts) {
+ // fix the discontinuity pts offset
+ nextpts = pts + ptsoffset / (double) ao->samplerate;
+ if (ectx->discontinuity_pts_offset == MP_NOPTS_VALUE) {
+ ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
+ }
+ else if (fabs(nextpts + ectx->discontinuity_pts_offset - ectx->next_in_pts) > 30) {
+ mp_msg(MSGT_ENCODE, MSGL_WARN,
+ "ao-lavc: detected an unexpected discontinuity (pts jumped by "
+ "%f seconds)\n",
+ nextpts + ectx->discontinuity_pts_offset - ectx->next_in_pts);
+ ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
+ }
+
+ outpts = pts + ectx->discontinuity_pts_offset;
}
+ else
+ outpts = pts;
while (len - bufpos >= ac->aframesize) {
- encode(ao, ao->pts != MP_NOPTS_VALUE,
- ao->pts + (bufpos + ptsoffset) / (double) ao->samplerate +
- encode_lavc_getoffset(ectx, ac->stream),
+ encode(ao,
+ outpts + (bufpos + ptsoffset) / (double) ao->samplerate + encode_lavc_getoffset(ectx, ac->stream),
(char *) data + ac->sample_size * bufpos * ao->channels);
bufpos += ac->aframesize;
}
talloc_free(paddingbuf);
- // set next allowed output pts value
- nextpts = ao->pts + ectx->discontinuity_pts_offset + (bufpos + ptsoffset) / (double) ao->samplerate;
- if (nextpts > ectx->next_in_pts)
- ectx->next_in_pts = nextpts;
+ // calculate expected pts of next audio frame
+ ac->expected_next_pts = pts + (bufpos + ptsoffset) / (double) ao->samplerate;
+
+ if (!ectx->options->rawts && ectx->options->copyts) {
+ // set next allowed output pts value
+ nextpts = ac->expected_next_pts + ectx->discontinuity_pts_offset;
+ if (nextpts > ectx->next_in_pts)
+ ectx->next_in_pts = nextpts;
+ }
return bufpos * ac->sample_size * ao->channels;
}
diff --git a/libao2/ao_openal.c b/libao2/ao_openal.c
index 8245f4f1d7..e5a40a769d 100644
--- a/libao2/ao_openal.c
+++ b/libao2/ao_openal.c
@@ -88,7 +88,7 @@ static int control(int cmd, void *arg) {
static void print_help(void) {
mp_msg(MSGT_AO, MSGL_FATAL,
"\n-ao openal commandline help:\n"
- "Example: mplayer -ao openal:device=subdevice\n"
+ "Example: mpv -ao openal:device=subdevice\n"
"\nOptions:\n"
" device=subdevice\n"
" Audio device OpenAL should use. Devices can be listed\n"
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index a8d06aee00..a79361a6a8 100644
--- a/libao2/ao_oss.c
+++ b/libao2/ao_oss.c
@@ -403,7 +403,7 @@ ac3_retry:
}
free(data);
if(ao_data.buffersize==0){
- mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS]\n *** Your audio driver DOES NOT support select() ***\n Recompile MPlayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS]\n *** Your audio driver DOES NOT support select() ***\n Recompile mpv with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
return 0;
}
#endif
diff --git a/libao2/ao_portaudio.c b/libao2/ao_portaudio.c
index 00016ac3f3..36b08f8288 100644
--- a/libao2/ao_portaudio.c
+++ b/libao2/ao_portaudio.c
@@ -68,7 +68,7 @@ static void print_help(void)
{
mp_msg(MSGT_AO, MSGL_FATAL,
"\n-ao portaudio commandline help:\n"
- "Example: mplayer -ao portaudio:device=subdevice\n"
+ "Example: mpv -ao portaudio:device=subdevice\n"
"\nOptions:\n"
" device=subdevice\n"
" Audio device PortAudio should use. Devices can be listed\n"
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index b8e4f1cbdd..1d2ebc5281 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -32,7 +32,7 @@
#include "audio_out.h"
#include "input/input.h"
-#define PULSE_CLIENT_NAME "mplayer2"
+#define PULSE_CLIENT_NAME "mpv"
#define VOL_PA2MP(v) ((v) * 100 / PA_VOLUME_UI_MAX)
#define VOL_MP2PA(v) ((v) * PA_VOLUME_UI_MAX / 100)
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index 47c18655f3..ab8e60b753 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -48,9 +48,6 @@ extern const struct ao_driver audio_out_portaudio;
static const struct ao_driver * const audio_out_drivers[] = {
// native:
-#ifdef CONFIG_DIRECTX
- &audio_out_dsound,
-#endif
#ifdef CONFIG_COREAUDIO
&audio_out_coreaudio,
#endif
@@ -66,6 +63,9 @@ static const struct ao_driver * const audio_out_drivers[] = {
#ifdef CONFIG_PORTAUDIO
&audio_out_portaudio,
#endif
+#ifdef CONFIG_DSOUND
+ &audio_out_dsound,
+#endif
// wrappers:
#ifdef CONFIG_JACK
&audio_out_jack,
@@ -73,12 +73,12 @@ static const struct ao_driver * const audio_out_drivers[] = {
#ifdef CONFIG_OPENAL
&audio_out_openal,
#endif
-#ifdef CONFIG_ENCODING
- &audio_out_lavc,
-#endif
&audio_out_null,
// should not be auto-selected:
&audio_out_pcm,
+#ifdef CONFIG_ENCODING
+ &audio_out_lavc,
+#endif
#ifdef CONFIG_RSOUND
&audio_out_rsound,
#endif
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index c4d7c13941..cca7725490 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -52,6 +52,7 @@ struct priv {
AVCodecContext *avctx;
AVFrame *avframe;
char *output;
+ char *output_packed; // used by deplanarize to store packed audio samples
int output_left;
int unitsize;
int previous_data_left; // input demuxer packet data
@@ -71,7 +72,7 @@ static int setup_format(sh_audio_t *sh_audio,
const AVCodecContext *lavc_context)
{
int sample_format = sh_audio->sample_format;
- switch (lavc_context->sample_fmt) {
+ switch (av_get_packed_sample_fmt(lavc_context->sample_fmt)) {
case AV_SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break;
case AV_SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break;
case AV_SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break;
@@ -218,7 +219,7 @@ static int init(sh_audio_t *sh_audio)
if (sh_audio->wf && sh_audio->wf->nAvgBytesPerSec)
sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
- switch (lavc_context->sample_fmt) {
+ switch (av_get_packed_sample_fmt(lavc_context->sample_fmt)) {
case AV_SAMPLE_FMT_U8:
case AV_SAMPLE_FMT_S16:
case AV_SAMPLE_FMT_S32:
@@ -264,6 +265,34 @@ static int control(sh_audio_t *sh, int cmd, void *arg, ...)
return CONTROL_UNKNOWN;
}
+static av_always_inline void deplanarize(struct sh_audio *sh)
+{
+ struct priv *priv = sh->context;
+
+ size_t bps = av_get_bytes_per_sample(priv->avctx->sample_fmt);
+ size_t nb_samples = priv->avframe->nb_samples;
+ size_t channels = priv->avctx->channels;
+ size_t size = bps * nb_samples * channels;
+
+ if (talloc_get_size(priv->output_packed) != size)
+ priv->output_packed =
+ talloc_realloc_size(priv, priv->output_packed, size);
+
+ size_t offset = 0;
+ unsigned char *output_ptr = priv->output_packed;
+ unsigned char **src = priv->avframe->data;
+
+ for (size_t s = 0; s < nb_samples; s++) {
+ for (size_t c = 0; c < channels; c++) {
+ memcpy(output_ptr, src[c] + offset, bps);
+ output_ptr += bps;
+ }
+ offset += bps;
+ }
+
+ priv->output = priv->output_packed;
+}
+
static int decode_new_packet(struct sh_audio *sh)
{
struct priv *priv = sh->context;
@@ -320,10 +349,6 @@ static int decode_new_packet(struct sh_audio *sh)
priv->previous_data_left = insize - ret;
if (!got_frame)
return 0;
- /* An error is reported later from output format checking, but make
- * sure we don't crash by overreading first plane. */
- if (av_sample_fmt_is_planar(avctx->sample_fmt) && avctx->channels > 1)
- return 0;
uint64_t unitsize = (uint64_t)av_get_bytes_per_sample(avctx->sample_fmt) *
avctx->channels;
if (unitsize > 100000)
@@ -333,7 +358,11 @@ static int decode_new_packet(struct sh_audio *sh)
if (output_left > 500000000)
abort();
priv->output_left = output_left;
- priv->output = priv->avframe->data[0];
+ if (av_sample_fmt_is_planar(avctx->sample_fmt) && avctx->channels > 1) {
+ deplanarize(sh);
+ } else {
+ priv->output = priv->avframe->data[0];
+ }
mp_dbg(MSGT_DECAUDIO, MSGL_DBG2, "Decoded %d -> %d \n", insize,
priv->output_left);
return 0;
diff --git a/libmpcodecs/cmmx.h b/libmpcodecs/cmmx.h
deleted file mode 100644
index 51ffd235bc..0000000000
--- a/libmpcodecs/cmmx.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * x86 MMX and MMX2 packed byte operations in portable C.
- * Extra instructions: pdiffub, pcmpzb, psumbw, pcmpgtub
- * Author: Zoltan Hidvegi
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_CMMX_H
-#define MPLAYER_CMMX_H
-
-typedef unsigned long cmmx_t;
-
-#define ONE_BYTES (~(cmmx_t)0 / 255)
-#define SIGN_BITS (ONE_BYTES << 7)
-#define LOWBW_MASK (~(cmmx_t)0 / 257)
-
-static inline cmmx_t
-paddb(cmmx_t a, cmmx_t b)
-{
- return ((a & ~SIGN_BITS) + (b & ~SIGN_BITS)) ^ ((a^b) & SIGN_BITS);
-}
-
-static inline cmmx_t
-psubb(cmmx_t a, cmmx_t b)
-{
- return ((a | SIGN_BITS) - (b & ~SIGN_BITS)) ^ (~(a^b) & SIGN_BITS);
-}
-
-static inline cmmx_t
-paddusb(cmmx_t a, cmmx_t b)
-{
- cmmx_t s = (a & ~SIGN_BITS) + (b & ~SIGN_BITS);
- cmmx_t abs = (a | b) & SIGN_BITS;
- cmmx_t c = abs & (s | (a & b));
- return s | abs | (abs - (c >> 7));
-}
-
-static inline cmmx_t
-paddusb_s(cmmx_t a, cmmx_t b)
-{
- cmmx_t sum = a+b;
- cmmx_t ov = sum & SIGN_BITS;
- return sum + (sum ^ (ov - (ov>>7)));
-}
-
-static inline cmmx_t
-psubusb(cmmx_t a, cmmx_t b)
-{
- cmmx_t s = (a | SIGN_BITS) - (b & ~SIGN_BITS);
- cmmx_t anb = a & ~b;
- cmmx_t c = (anb | (s & ~(a^b))) & SIGN_BITS;
- return s & ((c & anb) | (c - (c >> 7)));
-}
-
-static inline cmmx_t
-psubusb_s(cmmx_t a, cmmx_t b)
-{
- cmmx_t d = (a|SIGN_BITS) - b;
- cmmx_t m = d & SIGN_BITS;
- return d & (m - (m>>7));
-}
-
-static inline cmmx_t
-pcmpgtub(cmmx_t b, cmmx_t a)
-{
- cmmx_t s = (a | SIGN_BITS) - (b & ~SIGN_BITS);
- cmmx_t ret = ((~a & b) | (~s & ~(a ^ b))) & SIGN_BITS;
- return ret | (ret - (ret >> 7));
-}
-
-static inline cmmx_t
-pdiffub(cmmx_t a, cmmx_t b)
-{
- cmmx_t xs = (~a ^ b) & SIGN_BITS;
- cmmx_t s = ((a | SIGN_BITS) - (b & ~SIGN_BITS)) ^ xs;
- cmmx_t gt = ((~a & b) | (s & xs)) & SIGN_BITS;
- cmmx_t gt7 = gt >> 7;
- return (s ^ gt ^ (gt - gt7)) + gt7;
-}
-
-static inline cmmx_t
-pdiffub_s(cmmx_t a, cmmx_t b)
-{
- cmmx_t d = (a|SIGN_BITS) - b;
- cmmx_t g = (~d & SIGN_BITS) >> 7;
- return (d ^ (SIGN_BITS-g)) + g;
-}
-
-static inline cmmx_t
-pmaxub(cmmx_t a, cmmx_t b)
-{
- return psubusb(a,b) + b;
-}
-
-static inline cmmx_t
-pminub(cmmx_t a, cmmx_t b)
-{
- return paddusb(a,~b) - ~b;
-}
-
-static inline cmmx_t
-pminub_s(cmmx_t a, cmmx_t b)
-{
- cmmx_t d = (a|SIGN_BITS) - b;
- cmmx_t m = ~SIGN_BITS + ((d&SIGN_BITS)>>7);
- return ((d&m) + b) & ~SIGN_BITS;
-}
-
-static inline cmmx_t
-pavgb(cmmx_t a, cmmx_t b)
-{
- cmmx_t ao = a & ONE_BYTES;
- cmmx_t bo = b & ONE_BYTES;
- return ((a^ao)>>1) + ((b^bo)>>1) + (ao|bo);
-}
-
-static inline cmmx_t
-pavgb_s(cmmx_t a, cmmx_t b)
-{
- return ((a+b+ONE_BYTES)>>1) & ~SIGN_BITS;
-}
-
-static inline cmmx_t
-p31avgb(cmmx_t a, cmmx_t b)
-{
- cmmx_t ao = a & (3*ONE_BYTES);
- cmmx_t bo = b & (3*ONE_BYTES);
- return 3*((a^ao)>>2) + ((b^bo)>>2) +
- (((3*ao+bo+2*ONE_BYTES)>>2) & (3*ONE_BYTES));
-}
-
-static inline cmmx_t
-p31avgb_s(cmmx_t a, cmmx_t b)
-{
- cmmx_t avg = ((a+b)>>1) & ~SIGN_BITS;
- return pavgb_s(avg, a);
-}
-
-static inline unsigned long
-psumbw(cmmx_t a)
-{
- cmmx_t t = (a & LOWBW_MASK) + ((a>>8) & LOWBW_MASK);
- unsigned long ret =
- (unsigned long)t + (unsigned long)(t >> (4*sizeof(cmmx_t)));
- if (sizeof(cmmx_t) > 4)
- ret += ret >> 16;
- return ret & 0xffff;
-}
-
-static inline unsigned long
-psumbw_s(cmmx_t a)
-{
- unsigned long ret =
- (unsigned long)a + (unsigned long)(a >> (4*sizeof(cmmx_t)));
- if (sizeof(cmmx_t) <= 4)
- return (ret & 0xff) + ((ret>>8) & 0xff);
- ret = (ret & 0xff00ff) + ((ret>>8) & 0xff00ff);
- ret += ret >> 16;
- return ret & 0xffff;
-}
-
-static inline unsigned long
-psadbw(cmmx_t a, cmmx_t b)
-{
- return psumbw(pdiffub(a,b));
-}
-
-static inline unsigned long
-psadbw_s(cmmx_t a, cmmx_t b)
-{
- return psumbw_s(pdiffub_s(a,b));
-}
-
-static inline cmmx_t
-pcmpzb(cmmx_t a)
-{
- cmmx_t ret = (((a | SIGN_BITS) - ONE_BYTES) | a) & SIGN_BITS;
- return ~(ret | (ret - (ret >> 7)));
-}
-
-static inline cmmx_t
-pcmpeqb(cmmx_t a, cmmx_t b)
-{
- return pcmpzb(a ^ b);
-}
-
-#endif /* MPLAYER_CMMX_H */
diff --git a/libmpcodecs/vd_null.c b/libmpcodecs/vd_null.c
deleted file mode 100644
index 894585b42f..0000000000
--- a/libmpcodecs/vd_null.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "vd_internal.h"
-
-static const vd_info_t info =
-{
- "Null video decoder",
- "null",
- "A'rpi",
- "A'rpi",
- "no decoding"
-};
-
-LIBVD_EXTERN(null)
-
-// to set/get/query special features/parameters
-static int control(sh_video_t *sh,int cmd,void* arg,...){
- return CONTROL_UNKNOWN;
-}
-
-// init driver
-static int init(sh_video_t *sh){
- if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_BGR24)) return 0;
- return 1;
-}
-
-// uninit driver
-static void uninit(sh_video_t *sh){
-}
-
-// decode a frame
-static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
- return NULL;
-}
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index f847dd69b8..5ec7d19570 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -38,7 +38,6 @@
#include "libvo/fastmemcpy.h"
extern const vf_info_t vf_info_vo;
-extern const vf_info_t vf_info_bmovl;
extern const vf_info_t vf_info_crop;
extern const vf_info_t vf_info_expand;
extern const vf_info_t vf_info_pp;
@@ -48,161 +47,65 @@ extern const vf_info_t vf_info_noformat;
extern const vf_info_t vf_info_flip;
extern const vf_info_t vf_info_rotate;
extern const vf_info_t vf_info_mirror;
-extern const vf_info_t vf_info_palette;
-extern const vf_info_t vf_info_lavc;
-extern const vf_info_t vf_info_dvbscale;
-extern const vf_info_t vf_info_cropdetect;
-extern const vf_info_t vf_info_test;
extern const vf_info_t vf_info_noise;
-extern const vf_info_t vf_info_yvu9;
-extern const vf_info_t vf_info_lavcdeint;
-extern const vf_info_t vf_info_eq;
extern const vf_info_t vf_info_eq2;
extern const vf_info_t vf_info_gradfun;
-extern const vf_info_t vf_info_halfpack;
-extern const vf_info_t vf_info_dint;
-extern const vf_info_t vf_info_1bpp;
-extern const vf_info_t vf_info_2xsai;
extern const vf_info_t vf_info_unsharp;
extern const vf_info_t vf_info_swapuv;
-extern const vf_info_t vf_info_il;
-extern const vf_info_t vf_info_fil;
-extern const vf_info_t vf_info_boxblur;
-extern const vf_info_t vf_info_sab;
-extern const vf_info_t vf_info_smartblur;
-extern const vf_info_t vf_info_perspective;
extern const vf_info_t vf_info_down3dright;
-extern const vf_info_t vf_info_field;
-extern const vf_info_t vf_info_denoise3d;
extern const vf_info_t vf_info_hqdn3d;
-extern const vf_info_t vf_info_detc;
-extern const vf_info_t vf_info_telecine;
-extern const vf_info_t vf_info_tinterlace;
-extern const vf_info_t vf_info_tfields;
-extern const vf_info_t vf_info_ivtc;
extern const vf_info_t vf_info_ilpack;
extern const vf_info_t vf_info_dsize;
-extern const vf_info_t vf_info_decimate;
extern const vf_info_t vf_info_softpulldown;
extern const vf_info_t vf_info_pullup;
-extern const vf_info_t vf_info_filmdint;
-extern const vf_info_t vf_info_framestep;
-extern const vf_info_t vf_info_tile;
extern const vf_info_t vf_info_delogo;
-extern const vf_info_t vf_info_remove_logo;
-extern const vf_info_t vf_info_hue;
-extern const vf_info_t vf_info_spp;
-extern const vf_info_t vf_info_uspp;
-extern const vf_info_t vf_info_fspp;
-extern const vf_info_t vf_info_pp7;
-extern const vf_info_t vf_info_yuvcsp;
-extern const vf_info_t vf_info_kerndeint;
-extern const vf_info_t vf_info_rgbtest;
-extern const vf_info_t vf_info_qp;
extern const vf_info_t vf_info_phase;
extern const vf_info_t vf_info_divtc;
-extern const vf_info_t vf_info_harddup;
extern const vf_info_t vf_info_softskip;
extern const vf_info_t vf_info_screenshot;
extern const vf_info_t vf_info_screenshot_force;
extern const vf_info_t vf_info_ass;
-extern const vf_info_t vf_info_mcdeint;
extern const vf_info_t vf_info_yadif;
-extern const vf_info_t vf_info_blackframe;
-extern const vf_info_t vf_info_geq;
-extern const vf_info_t vf_info_ow;
-extern const vf_info_t vf_info_fixpts;
extern const vf_info_t vf_info_stereo3d;
extern const vf_info_t vf_info_dlopen;
// list of available filters:
static const vf_info_t *const filter_list[] = {
-#ifdef HAVE_POSIX_SELECT
- &vf_info_bmovl,
-#endif
&vf_info_crop,
&vf_info_expand,
&vf_info_scale,
-// &vf_info_osd,
&vf_info_vo,
&vf_info_format,
&vf_info_noformat,
&vf_info_flip,
&vf_info_rotate,
&vf_info_mirror,
- &vf_info_palette,
- &vf_info_pp7,
#ifdef CONFIG_LIBPOSTPROC
&vf_info_pp,
#endif
- &vf_info_lavc,
- &vf_info_lavcdeint,
+
&vf_info_screenshot,
&vf_info_screenshot_force,
- &vf_info_fspp,
- &vf_info_uspp,
- &vf_info_dvbscale,
- &vf_info_cropdetect,
- &vf_info_test,
&vf_info_noise,
- &vf_info_yvu9,
- &vf_info_eq,
&vf_info_eq2,
&vf_info_gradfun,
- &vf_info_halfpack,
- &vf_info_dint,
- &vf_info_1bpp,
- &vf_info_2xsai,
&vf_info_unsharp,
&vf_info_swapuv,
- &vf_info_il,
- &vf_info_fil,
- &vf_info_boxblur,
- &vf_info_sab,
- &vf_info_smartblur,
- &vf_info_perspective,
&vf_info_down3dright,
- &vf_info_field,
- &vf_info_denoise3d,
&vf_info_hqdn3d,
- &vf_info_detc,
- &vf_info_telecine,
- &vf_info_tinterlace,
- &vf_info_tfields,
- &vf_info_ivtc,
&vf_info_ilpack,
&vf_info_dsize,
- &vf_info_decimate,
&vf_info_softpulldown,
&vf_info_pullup,
- &vf_info_filmdint,
- &vf_info_framestep,
- &vf_info_tile,
&vf_info_delogo,
- &vf_info_remove_logo,
- &vf_info_hue,
-#ifdef CONFIG_FFMPEG_INTERNALS
- &vf_info_spp,
- &vf_info_mcdeint,
-#endif
- &vf_info_geq,
- &vf_info_qp,
- &vf_info_yuvcsp,
- &vf_info_kerndeint,
- &vf_info_rgbtest,
&vf_info_phase,
&vf_info_divtc,
- &vf_info_harddup,
- &vf_info_softskip,
#ifdef CONFIG_ASS
&vf_info_ass,
#endif
&vf_info_yadif,
- &vf_info_blackframe,
- &vf_info_ow,
- &vf_info_fixpts,
&vf_info_stereo3d,
&vf_info_dlopen,
NULL
diff --git a/libmpcodecs/vf_1bpp.c b/libmpcodecs/vf_1bpp.c
deleted file mode 100644
index 8d13735942..0000000000
--- a/libmpcodecs/vf_1bpp.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-//===========================================================================//
-
-static const unsigned int bgr_list[]={
- IMGFMT_Y800,
- IMGFMT_Y8,
- IMGFMT_BGR8,
- IMGFMT_RGB8,
-
- IMGFMT_YVU9,
- IMGFMT_411P,
- IMGFMT_YV12,
- IMGFMT_I420,
- IMGFMT_IYUV,
- IMGFMT_422P,
- IMGFMT_444P,
-
- IMGFMT_YUY2,
- IMGFMT_BGR12,
- IMGFMT_RGB12,
- IMGFMT_BGR15,
- IMGFMT_RGB15,
- IMGFMT_BGR16,
- IMGFMT_RGB16,
-
- IMGFMT_BGR32,
- IMGFMT_RGB32,
-
-// IMGFMT_BGR24,
-// IMGFMT_RGB24,
- 0
-};
-
-static unsigned int find_best(struct vf_instance *vf){
- unsigned int best=0;
- int ret;
- const unsigned int* p=bgr_list;
- while(*p){
- ret=vf->next->query_format(vf->next,*p);
- mp_msg(MSGT_VFILTER,MSGL_V,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
- if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo!
- if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion
- ++p;
- }
- return best;
-}
-
-//===========================================================================//
-
-struct vf_priv_s {
- unsigned int fmt;
-};
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- if (!vf->priv->fmt)
- vf->priv->fmt=find_best(vf);
- if(!vf->priv->fmt){
- // no matching fmt, so force one...
- if(outfmt==IMGFMT_RGB8) vf->priv->fmt=IMGFMT_RGB32;
- else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32;
- else return 0;
- }
- return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
-}
-
-static const int bittab[8]={128,64,32,16,8,4,2,1};
-
-static void convert(mp_image_t *mpi, mp_image_t *dmpi, int value0, int value1,int bpp){
- int y;
- for(y=0;y<mpi->h;y++){
- unsigned char* src=mpi->planes[0]+mpi->stride[0]*y;
- switch(bpp){
- case 1: {
- unsigned char* dst=dmpi->planes[0]+dmpi->stride[0]*y;
- int x;
- for(x=0;x<mpi->w;x++)
- dst[x]=(src[x>>3]&bittab[x&7]) ? value1 : value0;
- break; }
- case 2: {
- uint16_t* dst=(uint16_t*)(dmpi->planes[0]+dmpi->stride[0]*y);
- int x;
- for(x=0;x<mpi->w;x++)
- dst[x]=(src[x>>3]&bittab[x&7]) ? value1 : value0;
- break; }
- case 4: {
- uint32_t* dst=(uint32_t*)(dmpi->planes[0]+dmpi->stride[0]*y);
- int x;
- for(x=0;x<mpi->w;x++)
- dst[x]=(src[x>>3]&bittab[x&7]) ? value1 : value0;
- break; }
- }
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,vf->priv->fmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w, mpi->h);
-
- switch(dmpi->imgfmt){
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_BGR8:
- case IMGFMT_RGB8:
- convert(mpi,dmpi,0,255,1);
- break;
- case IMGFMT_YVU9:
- case IMGFMT_411P:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_422P:
- case IMGFMT_444P:
- convert(mpi,dmpi,0,255,1);
- memset(dmpi->planes[1],128,dmpi->stride[1]*dmpi->chroma_height);
- memset(dmpi->planes[2],128,dmpi->stride[2]*dmpi->chroma_height);
- break;
- case IMGFMT_YUY2:
- convert(mpi,dmpi,0x8000,0x80ff,2);
- break;
- case IMGFMT_BGR12:
- case IMGFMT_RGB12:
- convert(mpi,dmpi,0,0x0fff,2);
- break;
- case IMGFMT_BGR15:
- case IMGFMT_RGB15:
- convert(mpi,dmpi,0,0x7fff,2);
- break;
- case IMGFMT_BGR16:
- case IMGFMT_RGB16:
- convert(mpi,dmpi,0,0xffff,2);
- break;
- case IMGFMT_BGR32:
- case IMGFMT_RGB32:
- convert(mpi,dmpi,0,0x00ffffff,4);
- break;
- default:
- mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt);
- return 0;
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- int best;
- if(fmt!=IMGFMT_RGB1 && fmt!=IMGFMT_BGR1) return 0;
- best=find_best(vf);
- if(!best) return 0; // no match
- return vf->next->query_format(vf->next,best);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
- return 1;
-}
-
-const vf_info_t vf_info_1bpp = {
- "1bpp bitmap -> YUV/BGR 8/15/16/32 conversion",
- "1bpp",
- "A'rpi",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_2xsai.c b/libmpcodecs/vf_2xsai.c
deleted file mode 100644
index dc33d9fccf..0000000000
--- a/libmpcodecs/vf_2xsai.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-//===========================================================================//
-
-/* FIXME: these all belong in the context, not as globals! */
-
-static uint32_t colorMask = 0xF7DEF7DE;
-static uint32_t lowPixelMask = 0x08210821;
-static uint32_t qcolorMask = 0xE79CE79C;
-static uint32_t qlowpixelMask = 0x18631863;
-static uint32_t redblueMask = 0xF81F;
-static uint32_t greenMask = 0x7E0;
-static int PixelsPerMask = 2;
-
-#define makecol(r,g,b) (r+(g<<8)+(b<<16))
-#define makecol_depth(d,r,g,b) (r+(g<<8)+(b<<16))
-
-static int Init_2xSaI(int d)
-{
-
- int minr = 0, ming = 0, minb = 0;
- int i;
-
-// if (d != 15 && d != 16 && d != 24 && d != 32)
-// return -1;
-
- /* Get lowest color bit */
- for (i = 0; i < 255; i++) {
- if (!minr)
- minr = makecol(i, 0, 0);
- if (!ming)
- ming = makecol(0, i, 0);
- if (!minb)
- minb = makecol(0, 0, i);
- }
-
- colorMask = (makecol_depth(d, 255, 0, 0) - minr) | (makecol_depth(d, 0, 255, 0) - ming) | (makecol_depth(d, 0, 0, 255) - minb);
- lowPixelMask = minr | ming | minb;
- qcolorMask = (makecol_depth(d, 255, 0, 0) - 3 * minr) | (makecol_depth(d, 0, 255, 0) - 3 * ming) | (makecol_depth(d, 0, 0, 255) - 3 * minb);
- qlowpixelMask = (minr * 3) | (ming * 3) | (minb * 3);
- redblueMask = makecol_depth(d, 255, 0, 255);
- greenMask = makecol_depth(d, 0, 255, 0);
-
- PixelsPerMask = (d <= 16) ? 2 : 1;
-
- if (PixelsPerMask == 2) {
- colorMask |= (colorMask << 16);
- qcolorMask |= (qcolorMask << 16);
- lowPixelMask |= (lowPixelMask << 16);
- qlowpixelMask |= (qlowpixelMask << 16);
- }
-
-// TRACE("Color Mask: 0x%lX\n", colorMask);
-// TRACE("Low Pixel Mask: 0x%lX\n", lowPixelMask);
-// TRACE("QColor Mask: 0x%lX\n", qcolorMask);
-// TRACE("QLow Pixel Mask: 0x%lX\n", qlowpixelMask);
-
- return 0;
-}
-
-
-#define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
-
-#define INTERPOLATE(A, B) (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask))
-
-#define Q_INTERPOLATE(A, B, C, D) ((A & qcolorMask) >> 2) + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2) \
- + ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask)
-
-
-static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
- uint8_t *dst, uint32_t dst_pitch,
- uint32_t width, uint32_t height, int sbpp)
-{
-
- unsigned int x, y;
- uint32_t color[16];
- unsigned char *src_line[4];
-
- /* Point to the first 3 lines. */
- src_line[0] = src;
- src_line[1] = src;
- src_line[2] = src + src_pitch;
- src_line[3] = src + src_pitch * 2;
-
- x = 0, y = 0;
-
- if (PixelsPerMask == 2) {
- unsigned short *sbp;
- sbp = (unsigned short*)src_line[0];
- color[0] = *sbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0];
- color[4] = color[0]; color[5] = color[0]; color[6] = *(sbp + 1); color[7] = *(sbp + 2);
- sbp = (unsigned short*)src_line[2];
- color[8] = *sbp; color[9] = color[8]; color[10] = *(sbp + 1); color[11] = *(sbp + 2);
- sbp = (unsigned short*)src_line[3];
- color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2);
- }
- else {
- uint32_t *lbp;
- lbp = (uint32_t*)src_line[0];
- color[0] = *lbp; color[1] = color[0]; color[2] = color[0]; color[3] = color[0];
- color[4] = color[0]; color[5] = color[0]; color[6] = *(lbp + 1); color[7] = *(lbp + 2);
- lbp = (uint32_t*)src_line[2];
- color[8] = *lbp; color[9] = color[8]; color[10] = *(lbp + 1); color[11] = *(lbp + 2);
- lbp = (uint32_t*)src_line[3];
- color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2);
- }
-
- for (y = 0; y < height; y++) {
- unsigned char *dst_line[2];
-
- dst_line[0] = dst + dst_pitch*2*y;
- dst_line[1] = dst + dst_pitch*(2*y+1);
-
- /* Todo: x = width - 2, x = width - 1 */
-
- for (x = 0; x < width; x++) {
- uint32_t product1a, product1b, product2a, product2b;
-
-//--------------------------------------- B0 B1 B2 B3 0 1 2 3
-// 4 5* 6 S2 -> 4 5* 6 7
-// 1 2 3 S1 8 9 10 11
-// A0 A1 A2 A3 12 13 14 15
-//--------------------------------------
- if (color[9] == color[6] && color[5] != color[10]) {
- product2b = color[9];
- product1b = product2b;
- }
- else if (color[5] == color[10] && color[9] != color[6]) {
- product2b = color[5];
- product1b = product2b;
- }
- else if (color[5] == color[10] && color[9] == color[6]) {
- int r = 0;
-
- r += GET_RESULT(color[6], color[5], color[8], color[13]);
- r += GET_RESULT(color[6], color[5], color[4], color[1]);
- r += GET_RESULT(color[6], color[5], color[14], color[11]);
- r += GET_RESULT(color[6], color[5], color[2], color[7]);
-
- if (r > 0)
- product1b = color[6];
- else if (r < 0)
- product1b = color[5];
- else
- product1b = INTERPOLATE(color[5], color[6]);
-
- product2b = product1b;
-
- }
- else {
- if (color[6] == color[10] && color[10] == color[13] && color[9] != color[14] && color[10] != color[12])
- product2b = Q_INTERPOLATE(color[10], color[10], color[10], color[9]);
- else if (color[5] == color[9] && color[9] == color[14] && color[13] != color[10] && color[9] != color[15])
- product2b = Q_INTERPOLATE(color[9], color[9], color[9], color[10]);
- else
- product2b = INTERPOLATE(color[9], color[10]);
-
- if (color[6] == color[10] && color[6] == color[1] && color[5] != color[2] && color[6] != color[0])
- product1b = Q_INTERPOLATE(color[6], color[6], color[6], color[5]);
- else if (color[5] == color[9] && color[5] == color[2] && color[1] != color[6] && color[5] != color[3])
- product1b = Q_INTERPOLATE(color[6], color[5], color[5], color[5]);
- else
- product1b = INTERPOLATE(color[5], color[6]);
- }
-
- if (color[5] == color[10] && color[9] != color[6] && color[4] == color[5] && color[5] != color[14])
- product2a = INTERPOLATE(color[9], color[5]);
- else if (color[5] == color[8] && color[6] == color[5] && color[4] != color[9] && color[5] != color[12])
- product2a = INTERPOLATE(color[9], color[5]);
- else
- product2a = color[9];
-
- if (color[9] == color[6] && color[5] != color[10] && color[8] == color[9] && color[9] != color[2])
- product1a = INTERPOLATE(color[9], color[5]);
- else if (color[4] == color[9] && color[10] == color[9] && color[8] != color[5] && color[9] != color[0])
- product1a = INTERPOLATE(color[9], color[5]);
- else
- product1a = color[5];
-
- if (PixelsPerMask == 2) {
- *((uint32_t *) (&dst_line[0][x * 4])) = product1a | (product1b << 16);
- *((uint32_t *) (&dst_line[1][x * 4])) = product2a | (product2b << 16);
- }
- else {
- *((uint32_t *) (&dst_line[0][x * 8])) = product1a;
- *((uint32_t *) (&dst_line[0][x * 8 + 4])) = product1b;
- *((uint32_t *) (&dst_line[1][x * 8])) = product2a;
- *((uint32_t *) (&dst_line[1][x * 8 + 4])) = product2b;
- }
-
- /* Move color matrix forward */
- color[0] = color[1]; color[4] = color[5]; color[8] = color[9]; color[12] = color[13];
- color[1] = color[2]; color[5] = color[6]; color[9] = color[10]; color[13] = color[14];
- color[2] = color[3]; color[6] = color[7]; color[10] = color[11]; color[14] = color[15];
-
- if (x < width - 3) {
- x += 3;
- if (PixelsPerMask == 2) {
- color[3] = *(((unsigned short*)src_line[0]) + x);
- color[7] = *(((unsigned short*)src_line[1]) + x);
- color[11] = *(((unsigned short*)src_line[2]) + x);
- color[15] = *(((unsigned short*)src_line[3]) + x);
- }
- else {
- color[3] = *(((uint32_t*)src_line[0]) + x);
- color[7] = *(((uint32_t*)src_line[1]) + x);
- color[11] = *(((uint32_t*)src_line[2]) + x);
- color[15] = *(((uint32_t*)src_line[3]) + x);
- }
- x -= 3;
- }
- }
-
- /* We're done with one line, so we shift the source lines up */
- src_line[0] = src_line[1];
- src_line[1] = src_line[2];
- src_line[2] = src_line[3];
-
- /* Read next line */
- if (y + 3 >= height)
- src_line[3] = src_line[2];
- else
- src_line[3] = src_line[2] + src_pitch;
-
- /* Then shift the color matrix up */
- if (PixelsPerMask == 2) {
- unsigned short *sbp;
- sbp = (unsigned short*)src_line[0];
- color[0] = *sbp; color[1] = color[0]; color[2] = *(sbp + 1); color[3] = *(sbp + 2);
- sbp = (unsigned short*)src_line[1];
- color[4] = *sbp; color[5] = color[4]; color[6] = *(sbp + 1); color[7] = *(sbp + 2);
- sbp = (unsigned short*)src_line[2];
- color[8] = *sbp; color[9] = color[9]; color[10] = *(sbp + 1); color[11] = *(sbp + 2);
- sbp = (unsigned short*)src_line[3];
- color[12] = *sbp; color[13] = color[12]; color[14] = *(sbp + 1); color[15] = *(sbp + 2);
- }
- else {
- uint32_t *lbp;
- lbp = (uint32_t*)src_line[0];
- color[0] = *lbp; color[1] = color[0]; color[2] = *(lbp + 1); color[3] = *(lbp + 2);
- lbp = (uint32_t*)src_line[1];
- color[4] = *lbp; color[5] = color[4]; color[6] = *(lbp + 1); color[7] = *(lbp + 2);
- lbp = (uint32_t*)src_line[2];
- color[8] = *lbp; color[9] = color[9]; color[10] = *(lbp + 1); color[11] = *(lbp + 2);
- lbp = (uint32_t*)src_line[3];
- color[12] = *lbp; color[13] = color[12]; color[14] = *(lbp + 1); color[15] = *(lbp + 2);
- }
-
- } // y loop
-
-}
-
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- Init_2xSaI(outfmt&255);
-
- return vf_next_config(vf,2*width,2*height,2*d_width,2*d_height,flags,outfmt);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- 2*mpi->w, 2*mpi->h);
-
- Super2xSaI_ex(mpi->planes[0], mpi->stride[0],
- dmpi->planes[0], dmpi->stride[0],
- mpi->w, mpi->h, mpi->bpp/8);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
-// case IMGFMT_BGR15:
-// case IMGFMT_BGR16:
- case IMGFMT_BGR32:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- return 1;
-}
-
-const vf_info_t vf_info_2xsai = {
- "2xSai BGR bitmap 2x scaler",
- "2xsai",
- "A'rpi",
- "http://elektron.its.tudelft.nl/~dalikifa/",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_blackframe.c b/libmpcodecs/vf_blackframe.c
deleted file mode 100644
index 244da01be2..0000000000
--- a/libmpcodecs/vf_blackframe.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * detect frames that are (almost) black
- * search for black frames to detect scene transitions
- * (c) 2006 Julian Hall
- *
- * based on code designed for skipping commercials
- * (c) 2002-2003 Brian J. Murrell
- *
- * cleanup, simplify, speedup (c) 2006 by Ivo van Poorten
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- unsigned int bamount, bthresh, frame, lastkeyframe;
-};
-
-static int config(struct vf_instance *vf, int width, int height, int d_width,
- int d_height, unsigned int flags, unsigned int outfmt) {
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static int query_format(struct vf_instance *vf, unsigned fmt) {
- switch(fmt) {
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_NV12:
- case IMGFMT_NV21:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- case IMGFMT_HM12:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int x, y;
- int nblack=0, pblack=0;
- unsigned char *yplane = mpi->planes[0];
- unsigned int ystride = mpi->stride[0];
- int pict_type = mpi->pict_type;
- int w = mpi->w, h = mpi->h;
- int bthresh = vf->priv->bthresh;
- int bamount = vf->priv->bamount;
- static const char *const picttypes[4] = { "unknown", "I", "P", "B" };
-
- for (y=1; y<=h; y++) {
- for (x=0; x<w; x++)
- nblack += yplane[x] < bthresh;
- pblack = nblack*100/(w*y);
- if (pblack < bamount) break;
- yplane += ystride;
- }
-
- if (pict_type > 3 || pict_type < 0) pict_type = 0;
- if (pict_type == 1) vf->priv->lastkeyframe = vf->priv->frame;
-
- if (pblack >= bamount)
- mp_msg(MSGT_VFILTER, MSGL_INFO,"vf_blackframe: %u, %i%%, %s (I:%u)\n",
- vf->priv->frame, pblack, picttypes[pict_type],
- vf->priv->lastkeyframe);
-
- vf->priv->frame++;
-
- dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT, 0,
- mpi->width, mpi->height);
- dmpi->planes[0] = mpi->planes[0];
- dmpi->stride[0] = mpi->stride[0];
- dmpi->planes[1] = mpi->planes[1];
- dmpi->stride[1] = mpi->stride[1];
- dmpi->planes[2] = mpi->planes[2];
- dmpi->stride[2] = mpi->stride[2];
-
- vf_clone_mpi_attributes(dmpi, mpi);
-
- return vf_next_put_image(vf, dmpi, pts);
-}
-
-static int control(struct vf_instance *vf, int request, void* data){
- return vf_next_control(vf,request,data);
-}
-
-static void uninit(struct vf_instance *vf) {
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->priv = malloc(sizeof(struct vf_priv_s));
- if (!vf->priv) return 0;
-
- vf->config = config;
- vf->put_image = put_image;
- vf->control = control;
- vf->uninit = uninit;
- vf->query_format = query_format;
-
- vf->priv->bamount = 98;
- vf->priv->bthresh = 0x20;
- vf->priv->frame = 0;
- vf->priv->lastkeyframe = 0;
-
- if (args)
- sscanf(args, "%u:%u", &vf->priv->bamount, &vf->priv->bthresh);
- return 1;
-}
-
-const vf_info_t vf_info_blackframe = {
- "detects black frames",
- "blackframe",
- "Brian J. Murrell, Julian Hall, Ivo van Poorten",
- "Useful for detecting scene transitions",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c
deleted file mode 100644
index da5dc97f50..0000000000
--- a/libmpcodecs/vf_bmovl.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * BitMap OVerLay video filter for MPlayer
- *
- * (C) 2002 Per Wigren <wigren@home.se>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*
- * Use MPlayer as a framebuffer to read bitmaps and commands from a FIFO
- * and display them in the window.
- *
- * Commands are:
- *
- * RGBA32 width height xpos ypos alpha clear
- * * Followed by width*height*4 bytes of raw RGBA32 data.
- * ABGR32 width height xpos ypos alpha clear
- * * Followed by width*height*4 bytes of raw ABGR32 data.
- * RGB24 width height xpos ypos alpha clear
- * * Followed by width*height*3 bytes of raw RGB32 data.
- * BGR24 width height xpos ypos alpha clear
- * * Followed by width*height*3 bytes of raw BGR32 data.
- *
- * ALPHA width height xpos ypos alpha
- * * Change alpha for area
- * CLEAR width height xpos ypos
- * * Clear area
- * OPAQUE
- * * Disable all alpha transparency!
- * Send "ALPHA 0 0 0 0 0" to enable again!
- * HIDE
- * * Hide bitmap
- * SHOW
- * * Show bitmap
- *
- * Arguments are:
- * width, height Size of image/area
- * xpos, ypos Start blitting at X/Y position
- * alpha Set alpha difference. 0 means same as original.
- * 255 makes everything opaque
- * -255 makes everything transparent
- * If you set this to -255 you can then send a sequence of
- * ALPHA-commands to set the area to -225, -200, -175 etc
- * for a nice fade-in-effect! ;)
- * clear Clear the framebuffer before blitting. 1 means clear.
- * If 0, the image will just be blitted on top of the old
- * one, so you don't need to send 1,8MB of RGBA32 data
- * everytime a small part of the screen is updated.
- *
- * Arguments for the filter are hidden:opaque:fifo
- * For example 1:0:/tmp/myfifo.fifo will start the filter hidden, transparent
- * and use /tmp/myfifo.fifo as the fifo.
- *
- * If you find bugs, please send me patches! ;)
- *
- * This filter was developed for use in Freevo (http://freevo.sf.net), but
- * anyone is free to use it! ;)
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include "config.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "img_format.h"
-
-#include "mp_msg.h"
-#include "libavutil/common.h"
-
-#include "libvo/fastmemcpy.h"
-
-#define IS_RAWIMG 0x100
-#define IS_IMG 0x200
-
-#define NONE 0x000
-#define IMG_RGBA32 0x101
-#define IMG_ABGR32 0x102
-#define IMG_RGB24 0x103
-#define IMG_BGR24 0x104
-#define IMG_PNG 0x201
-#define CMD_CLEAR 0x001
-#define CMD_ALPHA 0x002
-
-#define TRUE 1
-#define FALSE 0
-
-#define INRANGE(a,b,c) ( ((a) < (b)) ? (b) : ( ((a) > (c)) ? (c) : (a) ) )
-
-#define rgb2y(R,G,B) ( (( 263*R + 516*G + 100*B) >> 10) + 16 )
-#define rgb2u(R,G,B) ( ((-152*R - 298*G + 450*B) >> 10) + 128 )
-#define rgb2v(R,G,B) ( (( 450*R - 376*G - 73*B) >> 10) + 128 )
-
-#define DBG(a) (mp_msg(MSGT_VFILTER, MSGL_DBG2, "DEBUG: %d\n", a))
-
-struct vf_priv_s {
- int w, h, x1, y1, x2, y2;
- struct {
- unsigned char *y, *u, *v, *a, *oa;
- } bitmap;
- int stream_fd;
- fd_set stream_fdset;
- int opaque, hidden;
-};
-
-static int
-query_format(struct vf_instance *vf, unsigned int fmt){
- if(fmt==IMGFMT_YV12) return VFCAP_CSP_SUPPORTED;
- return 0;
-}
-
-
-static int
-config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- vf->priv->bitmap.y = malloc( width*height );
- vf->priv->bitmap.u = malloc( width*height/4 );
- vf->priv->bitmap.v = malloc( width*height/4 );
- vf->priv->bitmap.a = malloc( width*height );
- vf->priv->bitmap.oa = malloc( width*height );
- if(!( vf->priv->bitmap.y &&
- vf->priv->bitmap.u &&
- vf->priv->bitmap.v &&
- vf->priv->bitmap.a &&
- vf->priv->bitmap.oa )) {
- mp_msg(MSGT_VFILTER, MSGL_ERR, "vf_bmovl: Could not allocate memory for bitmap buffer: %s\n", strerror(errno) );
- return FALSE;
- }
-
- // Set default to black...
- memset( vf->priv->bitmap.u, 128, width*height/4 );
- memset( vf->priv->bitmap.v, 128, width*height/4 );
-
- vf->priv->w = vf->priv->x1 = width;
- vf->priv->h = vf->priv->y1 = height;
- vf->priv->y2 = vf->priv->x2 = 0;
-
- return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
-}
-
-static void
-uninit(struct vf_instance *vf)
-{
- if(vf->priv) {
- free(vf->priv->bitmap.y);
- free(vf->priv->bitmap.u);
- free(vf->priv->bitmap.v);
- free(vf->priv->bitmap.a);
- free(vf->priv->bitmap.oa);
- if (vf->priv->stream_fd >= 0)
- close(vf->priv->stream_fd);
- free(vf->priv);
- }
-}
-
-static int
-_read_cmd(int fd, char *cmd, char *args) {
- int done=FALSE, pos=0;
- char tmp;
-
- while(!done) {
- if(! read( fd, &tmp, 1 ) ) return FALSE;
- if( (tmp>='A' && tmp<='Z') || (tmp>='0' && tmp<='9') )
- cmd[pos]=tmp;
- else if(tmp == ' ') {
- cmd[pos]='\0';
- done=TRUE;
- }
- else if(tmp == '\n') {
- cmd[pos]='\0';
- args[0]='\0';
- return TRUE;
- }
- if(pos++>20) {
- cmd[0]='\0';
- return TRUE;
- }
- }
- done=FALSE; pos=0;
- while(!done) {
- if(! read( fd, &tmp, 1 ) ) return FALSE;
- if( (tmp >= ' ') && (pos<100) ) args[pos]=tmp;
- else {
- args[pos]='\0';
- done=TRUE;
- }
- pos++;
- }
- return TRUE;
-}
-
-
-static int
-put_image(struct vf_instance *vf, mp_image_t* mpi, double pts){
- int buf_x=0, buf_y=0, buf_pos=0;
- int have, got, want;
- int xpos=0, ypos=0, pos=0;
- unsigned char red=0, green=0, blue=0;
- mp_image_t* dmpi;
-
- dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->w, mpi->h);
-
- memcpy_pic( dmpi->planes[0], mpi->planes[0], mpi->width, mpi->height, dmpi->stride[0], mpi->stride[0] );
- memcpy_pic( dmpi->planes[1], mpi->planes[1], mpi->chroma_width, mpi->chroma_height, dmpi->stride[1], mpi->stride[1] );
- memcpy_pic( dmpi->planes[2], mpi->planes[2], mpi->chroma_width, mpi->chroma_height, dmpi->stride[2], mpi->stride[2] );
-
- if(vf->priv->stream_fd >= 0) {
- struct timeval tv;
- int ready;
-
- FD_SET( vf->priv->stream_fd, &vf->priv->stream_fdset );
- tv.tv_sec=0; tv.tv_usec=0;
-
- ready = select( vf->priv->stream_fd+1, &vf->priv->stream_fdset, NULL, NULL, &tv );
- if(ready > 0) {
- // We've got new data from the FIFO
-
- char cmd[20], args[100];
- int imgw,imgh,imgx,imgy,clear,imgalpha,pxsz=1,command;
- unsigned char *buffer = NULL;
-
- if(! _read_cmd( vf->priv->stream_fd, cmd, args) ) {
- mp_msg(MSGT_VFILTER, MSGL_ERR, "\nvf_bmovl: Error reading commands: %s\n\n", strerror(errno));
- return FALSE;
- }
- mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: Got: %s+%s\n", cmd, args);
-
- command=NONE;
- if ( strncmp(cmd,"RGBA32",6)==0 ) { pxsz=4; command = IMG_RGBA32; }
- else if( strncmp(cmd,"ABGR32",6)==0 ) { pxsz=4; command = IMG_ABGR32; }
- else if( strncmp(cmd,"RGB24" ,5)==0 ) { pxsz=3; command = IMG_RGB24; }
- else if( strncmp(cmd,"BGR24" ,5)==0 ) { pxsz=3; command = IMG_BGR24; }
- else if( strncmp(cmd,"CLEAR" ,5)==0 ) { pxsz=1; command = CMD_CLEAR; }
- else if( strncmp(cmd,"ALPHA" ,5)==0 ) { pxsz=1; command = CMD_ALPHA; }
- else if( strncmp(cmd,"OPAQUE",6)==0 ) vf->priv->opaque=TRUE;
- else if( strncmp(cmd,"SHOW", 4)==0 ) vf->priv->hidden=FALSE;
- else if( strncmp(cmd,"HIDE", 4)==0 ) vf->priv->hidden=TRUE;
- else if( strncmp(cmd,"FLUSH" ,5)==0 ) return vf_next_put_image(vf, dmpi, pts);
- else {
- mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Unknown command: '%s'. Ignoring.\n", cmd);
- return vf_next_put_image(vf, dmpi, pts);
- }
-
- if(command == CMD_ALPHA) {
- sscanf( args, "%d %d %d %d %d", &imgw, &imgh, &imgx, &imgy, &imgalpha);
- mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: ALPHA: %d %d %d %d %d\n\n",
- imgw, imgh, imgx, imgy, imgalpha);
- if(imgw==0 && imgh==0) vf->priv->opaque=FALSE;
- }
-
- if(command & IS_RAWIMG) {
- sscanf( args, "%d %d %d %d %d %d",
- &imgw, &imgh, &imgx, &imgy, &imgalpha, &clear);
- mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: RAWIMG: %d %d %d %d %d %d\n\n",
- imgw, imgh, imgx, imgy, imgalpha, clear);
-
- buffer = malloc(imgw*imgh*pxsz);
- if(!buffer) {
- mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Couldn't allocate temporary buffer! Skipping...\n\n");
- return vf_next_put_image(vf, dmpi, pts);
- }
- /* pipes/sockets might need multiple calls to read(): */
- want = (imgw*imgh*pxsz);
- have = 0;
- while (have < want) {
- got = read( vf->priv->stream_fd, buffer+have, want-have );
- if (got == 0) {
- mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: premature EOF...\n\n");
- break;
- }
- if (got < 0) {
- mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: read error: %s\n\n", strerror(errno));
- break;
- }
- have += got;
- }
- mp_msg(MSGT_VFILTER, MSGL_DBG2, "Got %d bytes... (wanted %d)\n", have, want );
-
- if(clear) {
- memset( vf->priv->bitmap.y, 0, vf->priv->w*vf->priv->h );
- memset( vf->priv->bitmap.u, 128, vf->priv->w*vf->priv->h/4 );
- memset( vf->priv->bitmap.v, 128, vf->priv->w*vf->priv->h/4 );
- memset( vf->priv->bitmap.a, 0, vf->priv->w*vf->priv->h );
- memset( vf->priv->bitmap.oa, 0, vf->priv->w*vf->priv->h );
- vf->priv->x1 = dmpi->width;
- vf->priv->y1 = dmpi->height;
- vf->priv->x2 = vf->priv->y2 = 0;
- }
- // Define how much of our bitmap that contains graphics!
- vf->priv->x1 = av_clip(imgx, 0, vf->priv->x1);
- vf->priv->y1 = av_clip(imgy, 0, vf->priv->y1);
- vf->priv->x2 = av_clip(imgx + imgw, vf->priv->x2, vf->priv->w);
- vf->priv->y2 = av_clip(imgy + imgh, vf->priv->y2, vf->priv->h);
- }
-
- if( command == CMD_CLEAR ) {
- sscanf( args, "%d %d %d %d", &imgw, &imgh, &imgx, &imgy);
- mp_msg(MSGT_VFILTER, MSGL_DBG2, "\nDEBUG: CLEAR: %d %d %d %d\n\n", imgw, imgh, imgx, imgy);
-
- for( ypos=imgy ; (ypos < (imgy+imgh)) && (ypos < vf->priv->y2) ; ypos++ ) {
- memset( vf->priv->bitmap.y + (ypos*vf->priv->w) + imgx, 0, imgw );
- memset( vf->priv->bitmap.a + (ypos*vf->priv->w) + imgx, 0, imgw );
- memset( vf->priv->bitmap.oa + (ypos*vf->priv->w) + imgx, 0, imgw );
- if(ypos%2) {
- memset( vf->priv->bitmap.u + ((ypos/2)*dmpi->stride[1]) + (imgx/2), 128, imgw/2 );
- memset( vf->priv->bitmap.v + ((ypos/2)*dmpi->stride[2]) + (imgx/2), 128, imgw/2 );
- }
- } // Recalculate area that contains graphics
- if( (imgx <= vf->priv->x1) && ( (imgw+imgx) >= vf->priv->x2) ) {
- if( (imgy <= vf->priv->y1) && ( (imgy+imgh) >= vf->priv->y1) )
- vf->priv->y1 = imgy+imgh;
- if( (imgy <= vf->priv->y2) && ( (imgy+imgh) >= vf->priv->y2) )
- vf->priv->y2 = imgy;
- }
- if( (imgy <= vf->priv->y1) && ( (imgy+imgh) >= vf->priv->y2) ) {
- if( (imgx <= vf->priv->x1) && ( (imgx+imgw) >= vf->priv->x1) )
- vf->priv->x1 = imgx+imgw;
- if( (imgx <= vf->priv->x2) && ( (imgx+imgw) >= vf->priv->x2) )
- vf->priv->x2 = imgx;
- }
- return vf_next_put_image(vf, dmpi, pts);
- }
-
- for( buf_y=0 ; (buf_y < imgh) && (buf_y < (vf->priv->h-imgy)) ; buf_y++ ) {
- for( buf_x=0 ; (buf_x < (imgw*pxsz)) && (buf_x < ((vf->priv->w+imgx)*pxsz)) ; buf_x += pxsz ) {
- int alpha = 0xff;
-
- if(command & IS_RAWIMG) buf_pos = (buf_y * imgw * pxsz) + buf_x;
- pos = ((buf_y+imgy) * vf->priv->w) + ((buf_x/pxsz)+imgx);
-
- switch(command) {
- case IMG_RGBA32:
- red = buffer[buf_pos+0];
- green = buffer[buf_pos+1];
- blue = buffer[buf_pos+2];
- alpha = buffer[buf_pos+3];
- break;
- case IMG_ABGR32:
- alpha = buffer[buf_pos+0];
- blue = buffer[buf_pos+1];
- green = buffer[buf_pos+2];
- red = buffer[buf_pos+3];
- break;
- case IMG_RGB24:
- red = buffer[buf_pos+0];
- green = buffer[buf_pos+1];
- blue = buffer[buf_pos+2];
- break;
- case IMG_BGR24:
- blue = buffer[buf_pos+0];
- green = buffer[buf_pos+1];
- red = buffer[buf_pos+2];
- break;
- case CMD_ALPHA:
- vf->priv->bitmap.a[pos] = INRANGE((vf->priv->bitmap.oa[pos]+imgalpha),0,255);
- break;
- default:
- mp_msg(MSGT_VFILTER, MSGL_ERR, "vf_bmovl: Internal error!\n");
- return FALSE;
- }
- if( command & IS_RAWIMG ) {
- vf->priv->bitmap.y[pos] = rgb2y(red,green,blue);
- vf->priv->bitmap.oa[pos] = alpha;
- vf->priv->bitmap.a[pos] = INRANGE((alpha+imgalpha),0,255);
- if((buf_y%2) && ((buf_x/pxsz)%2)) {
- pos = ( ((buf_y+imgy)/2) * dmpi->stride[1] ) + (((buf_x/pxsz)+imgx)/2);
- vf->priv->bitmap.u[pos] = rgb2u(red,green,blue);
- vf->priv->bitmap.v[pos] = rgb2v(red,green,blue);
- }
- }
- } // for buf_x
- } // for buf_y
- free (buffer);
- } else if(ready < 0) {
- mp_msg(MSGT_VFILTER, MSGL_WARN, "\nvf_bmovl: Error %d in fifo: %s\n\n", errno, strerror(errno));
- }
- }
-
- if(vf->priv->hidden) return vf_next_put_image(vf, dmpi, pts);
-
- if(vf->priv->opaque) { // Just copy buffer memory to screen
- for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) {
- fast_memcpy( dmpi->planes[0] + (ypos*dmpi->stride[0]) + vf->priv->x1,
- vf->priv->bitmap.y + (ypos*vf->priv->w) + vf->priv->x1,
- vf->priv->x2 - vf->priv->x1 );
- if(ypos%2) {
- fast_memcpy( dmpi->planes[1] + ((ypos/2)*dmpi->stride[1]) + (vf->priv->x1/2),
- vf->priv->bitmap.u + (((ypos/2)*(vf->priv->w)/2)) + (vf->priv->x1/2),
- (vf->priv->x2 - vf->priv->x1)/2 );
- fast_memcpy( dmpi->planes[2] + ((ypos/2)*dmpi->stride[2]) + (vf->priv->x1/2),
- vf->priv->bitmap.v + (((ypos/2)*(vf->priv->w)/2)) + (vf->priv->x1/2),
- (vf->priv->x2 - vf->priv->x1)/2 );
- }
- }
- } else { // Blit the bitmap to the videoscreen, pixel for pixel
- for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) {
- for ( xpos=vf->priv->x1 ; xpos < vf->priv->x2 ; xpos++ ) {
- pos = (ypos * dmpi->stride[0]) + xpos;
-
- int alpha = vf->priv->bitmap.a[pos];
-
- if (alpha == 0) continue; // Completly transparent pixel
-
- if (alpha == 255) { // Opaque pixel
- dmpi->planes[0][pos] = vf->priv->bitmap.y[pos];
- if ((ypos%2) && (xpos%2)) {
- pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
- dmpi->planes[1][pos] = vf->priv->bitmap.u[pos];
- dmpi->planes[2][pos] = vf->priv->bitmap.v[pos];
- }
- } else { // Alphablended pixel
- dmpi->planes[0][pos] =
- ((255 - alpha) * (int)dmpi->planes[0][pos] +
- alpha * (int)vf->priv->bitmap.y[pos]) >> 8;
-
- if ((ypos%2) && (xpos%2)) {
- pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2);
-
- dmpi->planes[1][pos] =
- ((255 - alpha) * (int)dmpi->planes[1][pos] +
- alpha * (int)vf->priv->bitmap.u[pos]) >> 8;
-
- dmpi->planes[2][pos] =
- ((255 - alpha) * (int)dmpi->planes[2][pos] +
- alpha * (int)vf->priv->bitmap.v[pos]) >> 8;
- }
- }
- } // for xpos
- } // for ypos
- } // if !opaque
- return vf_next_put_image(vf, dmpi, pts);
-} // put_image
-
-static int
-vf_open(vf_instance_t *vf, char *args)
-{
- char filename[1000];
-
- vf->config = config;
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->uninit = uninit;
-
- vf->priv = malloc(sizeof(struct vf_priv_s));
-
- if(!args || sscanf(args, "%d:%d:%s", &vf->priv->hidden, &vf->priv->opaque, filename) < 3 ) {
- mp_msg(MSGT_VFILTER, MSGL_ERR, "vf_bmovl: Bad arguments!\n");
- mp_msg(MSGT_VFILTER, MSGL_ERR, "vf_bmovl: Arguments are 'bool hidden:bool opaque:string fifo'\n");
- return FALSE;
- }
-
- vf->priv->stream_fd = open(filename, O_RDWR);
- if(vf->priv->stream_fd >= 0) {
- FD_ZERO( &vf->priv->stream_fdset );
- mp_msg(MSGT_VFILTER, MSGL_INFO, "vf_bmovl: Opened fifo %s as FD %d\n", filename, vf->priv->stream_fd);
- } else {
- mp_msg(MSGT_VFILTER, MSGL_WARN, "vf_bmovl: Error! Couldn't open FIFO %s: %s\n", filename, strerror(errno));
- vf->priv->stream_fd = -1;
- }
-
- return TRUE;
-}
-
-const vf_info_t vf_info_bmovl = {
- "Read bitmaps from a FIFO and display them in window",
- "bmovl",
- "Per Wigren",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c
deleted file mode 100644
index cc15efccf4..0000000000
--- a/libmpcodecs/vf_boxblur.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "mp_msg.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-
-//===========================================================================//
-
-typedef struct FilterParam{
- int radius;
- int power;
-}FilterParam;
-
-struct vf_priv_s {
- FilterParam lumaParam;
- FilterParam chromaParam;
-};
-
-
-/***************************************************************************/
-
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstStep, int srcStep){
- int x;
- const int length= radius*2 + 1;
- const int inv= ((1<<16) + length/2)/length;
-
- int sum= 0;
-
- for(x=0; x<radius; x++){
- sum+= src[x*srcStep]<<1;
- }
- sum+= src[radius*srcStep];
-
- for(x=0; x<=radius; x++){
- sum+= src[(radius+x)*srcStep] - src[(radius-x)*srcStep];
- dst[x*dstStep]= (sum*inv + (1<<15))>>16;
- }
-
- for(; x<w-radius; x++){
- sum+= src[(radius+x)*srcStep] - src[(x-radius-1)*srcStep];
- dst[x*dstStep]= (sum*inv + (1<<15))>>16;
- }
-
- for(; x<w; x++){
- sum+= src[(2*w-radius-x-1)*srcStep] - src[(x-radius-1)*srcStep];
- dst[x*dstStep]= (sum*inv + (1<<15))>>16;
- }
-}
-
-static inline void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){
- uint8_t temp[2][4096];
- uint8_t *a= temp[0], *b=temp[1];
-
- if(radius){
- blur(a, src, w, radius, 1, srcStep);
- for(; power>2; power--){
- uint8_t *c;
- blur(b, a, w, radius, 1, 1);
- c=a; a=b; b=c;
- }
- if(power>1)
- blur(dst, a, w, radius, dstStep, 1);
- else{
- int i;
- for(i=0; i<w; i++)
- dst[i*dstStep]= a[i];
- }
- }else{
- int i;
- for(i=0; i<w; i++)
- dst[i*dstStep]= src[i*srcStep];
- }
-}
-
-static void hBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){
- int y;
-
- if(radius==0 && dst==src) return;
-
- for(y=0; y<h; y++){
- blur2(dst + y*dstStride, src + y*srcStride, w, radius, power, 1, 1);
- }
-}
-
-//FIXME optimize (x before y !!!)
-static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int radius, int power){
- int x;
-
- if(radius==0 && dst==src) return;
-
- for(x=0; x<w; x++){
- blur2(dst + x, src + x, h, radius, power, dstStride, srcStride);
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
-
- mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_READABLE,
- mpi->w,mpi->h);
-
- assert(mpi->flags&MP_IMGFLAG_PLANAR);
-
- hBlur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h,
- dmpi->stride[0], mpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power);
- hBlur(dmpi->planes[1], mpi->planes[1], cw,ch,
- dmpi->stride[1], mpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
- hBlur(dmpi->planes[2], mpi->planes[2], cw,ch,
- dmpi->stride[2], mpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
-
- vBlur(dmpi->planes[0], dmpi->planes[0], mpi->w,mpi->h,
- dmpi->stride[0], dmpi->stride[0], vf->priv->lumaParam.radius, vf->priv->lumaParam.power);
- vBlur(dmpi->planes[1], dmpi->planes[1], cw,ch,
- dmpi->stride[1], dmpi->stride[1], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
- vBlur(dmpi->planes[2], dmpi->planes[2], cw,ch,
- dmpi->stride[2], dmpi->stride[2], vf->priv->chromaParam.radius, vf->priv->chromaParam.power);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt)
- {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YVU9:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- int e;
-
- vf->config=config;
- vf->put_image=put_image;
-// vf->get_image=get_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if(args==NULL) return 0;
-
- e=sscanf(args, "%d:%d:%d:%d",
- &vf->priv->lumaParam.radius,
- &vf->priv->lumaParam.power,
- &vf->priv->chromaParam.radius,
- &vf->priv->chromaParam.power
- );
-
- if(e==2){
- vf->priv->chromaParam.radius= vf->priv->lumaParam.radius;
- vf->priv->chromaParam.power = vf->priv->lumaParam.power;
- }else if(e!=4)
- return 0;
-
- if(vf->priv->lumaParam.radius < 0) return 0;
- if(vf->priv->chromaParam.radius < 0) return 0;
-
- return 1;
-}
-
-const vf_info_t vf_info_boxblur = {
- "box blur",
- "boxblur",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_cropdetect.c b/libmpcodecs/vf_cropdetect.c
deleted file mode 100644
index 2401db19d4..0000000000
--- a/libmpcodecs/vf_cropdetect.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- int x1,y1,x2,y2;
- int limit;
- int round;
- int reset_count;
- int fno;
-};
-
-static int checkline(unsigned char* src,int stride,int len,int bpp){
- int total=0;
- int div=len;
- switch(bpp){
- case 1:
- while(--len>=0){
- total+=src[0]; src+=stride;
- }
- break;
- case 3:
- case 4:
- while(--len>=0){
- total+=src[0]+src[1]+src[2]; src+=stride;
- }
- div*=3;
- break;
- }
- total/=div;
-// printf("total=%d\n",total);
- return total;
-}
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- vf->priv->x1=width - 1;
- vf->priv->y1=height - 1;
- vf->priv->x2=0;
- vf->priv->y2=0;
- vf->priv->fno=-2;
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int bpp=mpi->bpp/8;
- int w,h,x,y,shrink_by;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_EXPORT, 0,
- mpi->w, mpi->h);
-
- dmpi->planes[0]=mpi->planes[0];
- dmpi->planes[1]=mpi->planes[1];
- dmpi->planes[2]=mpi->planes[2];
- dmpi->stride[0]=mpi->stride[0];
- dmpi->stride[1]=mpi->stride[1];
- dmpi->stride[2]=mpi->stride[2];
- dmpi->width=mpi->width;
- dmpi->height=mpi->height;
-
-if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty
-
- // Reset the crop area every reset_count frames, if reset_count is > 0
- if(vf->priv->reset_count > 0 && vf->priv->fno > vf->priv->reset_count){
- vf->priv->x1=mpi->w-1;
- vf->priv->y1=mpi->h-1;
- vf->priv->x2=0;
- vf->priv->y2=0;
- vf->priv->fno=1;
- }
-
- for(y=0;y<vf->priv->y1;y++){
- if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){
- vf->priv->y1=y;
- break;
- }
- }
-
- for(y=mpi->h-1;y>vf->priv->y2;y--){
- if(checkline(mpi->planes[0]+mpi->stride[0]*y,bpp,mpi->w,bpp)>vf->priv->limit){
- vf->priv->y2=y;
- break;
- }
- }
-
- for(y=0;y<vf->priv->x1;y++){
- if(checkline(mpi->planes[0]+bpp*y,mpi->stride[0],mpi->h,bpp)>vf->priv->limit){
- vf->priv->x1=y;
- break;
- }
- }
-
- for(y=mpi->w-1;y>vf->priv->x2;y--){
- if(checkline(mpi->planes[0]+bpp*y,mpi->stride[0],mpi->h,bpp)>vf->priv->limit){
- vf->priv->x2=y;
- break;
- }
- }
-
- // round x and y (up), important for yuv colorspaces
- // make sure they stay rounded!
- x=(vf->priv->x1+1)&(~1);
- y=(vf->priv->y1+1)&(~1);
-
- w = vf->priv->x2 - x + 1;
- h = vf->priv->y2 - y + 1;
-
- // w and h must be divisible by 2 as well because of yuv
- // colorspace problems.
- if (vf->priv->round <= 1)
- vf->priv->round = 16;
- if (vf->priv->round % 2)
- vf->priv->round *= 2;
-
- shrink_by = w % vf->priv->round;
- w -= shrink_by;
- x += (shrink_by / 2 + 1) & ~1;
-
- shrink_by = h % vf->priv->round;
- h -= shrink_by;
- y += (shrink_by / 2 + 1) & ~1;
-
- mp_tmsg(MSGT_VFILTER, MSGL_INFO, "[CROP] Crop area: X: %d..%d Y: %d..%d (-vf crop=%d:%d:%d:%d).\n",
- vf->priv->x1,vf->priv->x2,
- vf->priv->y1,vf->priv->y2,
- w,h,x,y);
-
-
-}
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt) {
- switch(fmt) {
- // the default limit value works only right with YV12 right now.
- case IMGFMT_YV12:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-//===========================================================================//
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- vf->priv->limit=24; // should be option
- vf->priv->round = 0;
- vf->priv->reset_count = 0;
- if(args) sscanf(args, "%d:%d:%d",
- &vf->priv->limit,
- &vf->priv->round,
- &vf->priv->reset_count);
- return 1;
-}
-
-const vf_info_t vf_info_cropdetect = {
- "autodetect crop size",
- "cropdetect",
- "A'rpi",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_decimate.c b/libmpcodecs/vf_decimate.c
deleted file mode 100644
index 4ee78b420b..0000000000
--- a/libmpcodecs/vf_decimate.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-
-struct vf_priv_s {
- int hi, lo;
- float frac;
- int max, last, cnt;
-};
-
-#if HAVE_MMX && HAVE_EBX_AVAILABLE
-static int diff_MMX(unsigned char *old, unsigned char *new, int os, int ns)
-{
- volatile short out[4];
- __asm__ (
- "movl $8, %%ecx \n\t"
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
-
- ASMALIGN(4)
- "1: \n\t"
-
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S"), %%mm2 \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "movq (%%"REG_D"), %%mm1 \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "psubusb %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpckhbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm0, %%mm4 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm2, %%mm4 \n\t"
- "paddw %%mm3, %%mm4 \n\t"
-
- "decl %%ecx \n\t"
- "jnz 1b \n\t"
- "movq %%mm4, (%%"REG_d") \n\t"
- "emms \n\t"
- :
- : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out)
- : "%ecx", "memory"
- );
- return out[0]+out[1]+out[2]+out[3];
-}
-#endif
-
-static int diff_C(unsigned char *old, unsigned char *new, int os, int ns)
-{
- int x, y, d=0;
- for (y = 8; y; y--) {
- for (x = 8; x; x--) {
- d += abs(new[x] - old[x]);
- }
- new += ns;
- old += os;
- }
- return d;
-}
-
-static int (*diff)(unsigned char *, unsigned char *, int, int);
-
-static int diff_to_drop_plane(int hi, int lo, float frac, unsigned char *old, unsigned char *new, int w, int h, int os, int ns)
-{
- int x, y;
- int d, c=0;
- int t = (w/16)*(h/16)*frac;
- for (y = 0; y < h-7; y += 4) {
- for (x = 8; x < w-7; x += 4) {
- d = diff(old+x+y*os, new+x+y*ns, os, ns);
- if (d > hi) return 0;
- if (d > lo) {
- c++;
- if (c > t) return 0;
- }
- }
- }
- return 1;
-}
-
-static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t *new)
-{
- if (new->flags & MP_IMGFLAG_PLANAR) {
- return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0],
- new->w, new->h, old->stride[0], new->stride[0])
- && diff_to_drop_plane(hi,lo,frac, old->planes[1], new->planes[1],
- new->chroma_width, new->chroma_height,
- old->stride[1], new->stride[1])
- && diff_to_drop_plane(hi,lo,frac, old->planes[2], new->planes[2],
- new->chroma_width, new->chroma_height,
- old->stride[2], new->stride[2]);
- }
- return diff_to_drop_plane(hi,lo,frac, old->planes[0], new->planes[0],
- new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
-
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE,
- mpi->width, mpi->height);
- dmpi->qscale = mpi->qscale;
- dmpi->qstride = mpi->qstride;
- dmpi->qscale_type = mpi->qscale_type;
-
- if (diff_to_drop(vf->priv->hi, vf->priv->lo, vf->priv->frac, dmpi, mpi)) {
- if (vf->priv->max == 0)
- return 0;
- else if ((vf->priv->max > 0) && (vf->priv->cnt++ < vf->priv->max))
- return 0;
- else if ((vf->priv->max < 0) && (vf->priv->last+1 >= -vf->priv->max))
- return vf->priv->last=0;
- }
- vf->priv->last++;
- vf->priv->cnt=0;
-
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0], mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2], mpi->stride[2]);
- }
- return vf_next_put_image(vf, dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- vf->put_image = put_image;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- p->max = 0;
- p->hi = 64*12;
- p->lo = 64*5;
- p->frac = 0.33;
- if (args) sscanf(args, "%d:%d:%d:%f", &p->max, &p->hi, &p->lo, &p->frac);
- diff = diff_C;
-#if HAVE_MMX && HAVE_EBX_AVAILABLE
- if(gCpuCaps.hasMMX) diff = diff_MMX;
-#endif
- return 1;
-}
-
-const vf_info_t vf_info_decimate = {
- "near-duplicate frame remover",
- "decimate",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c
deleted file mode 100644
index 4d1f16c8b7..0000000000
--- a/libmpcodecs/vf_denoise3d.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (C) 2003 Daniel Moreno <comac@comac.darktech.org>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "mp_msg.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#define PARAM1_DEFAULT 4.0
-#define PARAM2_DEFAULT 3.0
-#define PARAM3_DEFAULT 6.0
-
-//===========================================================================//
-
-struct vf_priv_s {
- int Coefs[4][512];
- unsigned char *Line;
- mp_image_t *pmpi;
-};
-
-
-/***************************************************************************/
-
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- free(vf->priv->Line);
- vf->priv->Line = malloc(width);
- vf->priv->pmpi=NULL;
-// vf->default_caps &= !VFCAP_ACCEPT_STRIDE;
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv->Line);
-}
-
-#define LowPass(Prev, Curr, Coef) (Curr + Coef[Prev - Curr])
-
-static void deNoise(unsigned char *Frame, // mpi->planes[x]
- unsigned char *FramePrev, // pmpi->planes[x]
- unsigned char *FrameDest, // dmpi->planes[x]
- unsigned char *LineAnt, // vf->priv->Line (width bytes)
- int W, int H, int sStride, int pStride, int dStride,
- int *Horizontal, int *Vertical, int *Temporal)
-{
- int X, Y;
- int sLineOffs = 0, pLineOffs = 0, dLineOffs = 0;
- unsigned char PixelAnt;
-
- /* First pixel has no left nor top neighbor. Only previous frame */
- LineAnt[0] = PixelAnt = Frame[0];
- FrameDest[0] = LowPass(FramePrev[0], LineAnt[0], Temporal);
-
- /* Fist line has no top neighbor. Only left one for each pixel and
- * last frame */
- for (X = 1; X < W; X++)
- {
- PixelAnt = LowPass(PixelAnt, Frame[X], Horizontal);
- LineAnt[X] = PixelAnt;
- FrameDest[X] = LowPass(FramePrev[X], LineAnt[X], Temporal);
- }
-
- for (Y = 1; Y < H; Y++)
- {
- sLineOffs += sStride, pLineOffs += pStride, dLineOffs += dStride;
- /* First pixel on each line doesn't have previous pixel */
- PixelAnt = Frame[sLineOffs];
- LineAnt[0] = LowPass(LineAnt[0], PixelAnt, Vertical);
- FrameDest[dLineOffs] = LowPass(FramePrev[pLineOffs], LineAnt[0], Temporal);
-
- for (X = 1; X < W; X++)
- {
- /* The rest are normal */
- PixelAnt = LowPass(PixelAnt, Frame[sLineOffs+X], Horizontal);
- LineAnt[X] = LowPass(LineAnt[X], PixelAnt, Vertical);
- FrameDest[dLineOffs+X] = LowPass(FramePrev[pLineOffs+X], LineAnt[X], Temporal);
- }
- }
-}
-
-
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
- int W = mpi->w, H = mpi->h;
-
- mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE,
- mpi->w,mpi->h);
-
- if(!dmpi) return 0;
- if (!vf->priv->pmpi) vf->priv->pmpi=mpi;
-
- deNoise(mpi->planes[0], vf->priv->pmpi->planes[0], dmpi->planes[0],
- vf->priv->Line, W, H,
- mpi->stride[0], vf->priv->pmpi->stride[0], dmpi->stride[0],
- vf->priv->Coefs[0] + 256,
- vf->priv->Coefs[0] + 256,
- vf->priv->Coefs[1] + 256);
- deNoise(mpi->planes[1], vf->priv->pmpi->planes[1], dmpi->planes[1],
- vf->priv->Line, cw, ch,
- mpi->stride[1], vf->priv->pmpi->stride[1], dmpi->stride[1],
- vf->priv->Coefs[2] + 256,
- vf->priv->Coefs[2] + 256,
- vf->priv->Coefs[3] + 256);
- deNoise(mpi->planes[2], vf->priv->pmpi->planes[2], dmpi->planes[2],
- vf->priv->Line, cw, ch,
- mpi->stride[2], vf->priv->pmpi->stride[2], dmpi->stride[2],
- vf->priv->Coefs[2] + 256,
- vf->priv->Coefs[2] + 256,
- vf->priv->Coefs[3] + 256);
-
- vf->priv->pmpi=dmpi; // save reference image
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt)
- {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YVU9:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-
-#define ABS(A) ( (A) > 0 ? (A) : -(A) )
-
-static void PrecalcCoefs(int *Ct, double Dist25)
-{
- int i;
- double Gamma, Simil, C;
-
- Gamma = log(0.25) / log(1.0 - Dist25/255.0);
-
- for (i = -256; i <= 255; i++)
- {
- Simil = 1.0 - ABS(i) / 255.0;
-// Ct[256+i] = lround(pow(Simil, Gamma) * (double)i);
- C = pow(Simil, Gamma) * (double)i;
- Ct[256+i] = (C<0) ? (C-0.5) : (C+0.5);
- }
-}
-
-
-static int vf_open(vf_instance_t *vf, char *args){
- double LumSpac, LumTmp, ChromSpac, ChromTmp;
- double Param1, Param2, Param3;
-
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if (args)
- {
- switch(sscanf(args, "%lf:%lf:%lf",
- &Param1, &Param2, &Param3
- ))
- {
- case 0:
- LumSpac = PARAM1_DEFAULT;
- LumTmp = PARAM3_DEFAULT;
-
- ChromSpac = PARAM2_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
- break;
-
- case 1:
- LumSpac = Param1;
- LumTmp = PARAM3_DEFAULT * Param1 / PARAM1_DEFAULT;
-
- ChromSpac = PARAM2_DEFAULT * Param1 / PARAM1_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
- break;
-
- case 2:
- LumSpac = Param1;
- LumTmp = PARAM3_DEFAULT * Param1 / PARAM1_DEFAULT;
-
- ChromSpac = Param2;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
- break;
-
- case 3:
- LumSpac = Param1;
- LumTmp = Param3;
-
- ChromSpac = Param2;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
- break;
-
- default:
- LumSpac = PARAM1_DEFAULT;
- LumTmp = PARAM3_DEFAULT;
-
- ChromSpac = PARAM2_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
- }
- }
- else
- {
- LumSpac = PARAM1_DEFAULT;
- LumTmp = PARAM3_DEFAULT;
-
- ChromSpac = PARAM2_DEFAULT;
- ChromTmp = LumTmp * ChromSpac / LumSpac;
- }
-
- PrecalcCoefs(vf->priv->Coefs[0], LumSpac);
- PrecalcCoefs(vf->priv->Coefs[1], LumTmp);
- PrecalcCoefs(vf->priv->Coefs[2], ChromSpac);
- PrecalcCoefs(vf->priv->Coefs[3], ChromTmp);
-
- return 1;
-}
-
-const vf_info_t vf_info_denoise3d = {
- "3D Denoiser (variable lowpass filter)",
- "denoise3d",
- "Daniel Moreno",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_detc.c b/libmpcodecs/vf_detc.c
deleted file mode 100644
index bbc22fca6c..0000000000
--- a/libmpcodecs/vf_detc.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-struct metrics {
- int even;
- int odd;
- int noise;
- int temp;
-};
-
-struct vf_priv_s {
- int frame;
- int drop, lastdrop;
- struct metrics pm;
- int thres[5];
- int inframes, outframes;
- int mode;
- int (*analyze)(struct vf_priv_s *, mp_image_t *, mp_image_t *);
- int needread;
- struct vf_detc_pts_buf ptsbuf;
-};
-
-#define COMPE(a,b,e) (abs((a)-(b)) < (((a)+(b))>>(e)))
-#define COMPARABLE(a,b) COMPE((a),(b),2)
-#define VERYCLOSE(a,b) COMPE((a),(b),3)
-
-#define OUTER_TC_NBHD(s) ( \
- COMPARABLE((s)[-1].m.even,(s)[-1].m.odd) && \
- COMPARABLE((s)[1].m.even,(s)[0].m.odd) && \
- COMPARABLE((s)[2].m.even,(s)[1].m.odd) && \
- COMPARABLE((s)[-1].m.noise,(s)[0].m.temp) && \
- COMPARABLE((s)[2].m.noise,(s)[2].m.temp) )
-
-#define INNER_TC_NBHD(s,l,h) ( \
- COMPARABLE((s)[0].m.even,(l)) && \
- COMPARABLE((s)[2].m.odd,(l)) && ( \
- COMPARABLE((s)[0].m.noise,(h)) || \
- COMPARABLE((s)[1].m.noise,(h)) ) )
-
-enum {
- TC_DROP,
- TC_PROG,
- TC_IL1,
- TC_IL2
-};
-
-static void block_diffs(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns)
-{
- int x, y, even=0, odd=0, noise, temp;
- unsigned char *oldp, *newp;
- m->noise = m->temp = 0;
- for (x = 8; x; x--) {
- oldp = old++;
- newp = new++;
- noise = temp = 0;
- for (y = 4; y; y--) {
- even += abs(newp[0]-oldp[0]);
- odd += abs(newp[ns]-oldp[os]);
- noise += newp[ns]-newp[0];
- temp += oldp[os]-newp[0];
- oldp += os<<1;
- newp += ns<<1;
- }
- m->noise += abs(noise);
- m->temp += abs(temp);
- }
- m->even = even;
- m->odd = odd;
-}
-
-static void diff_planes(struct metrics *m, unsigned char *old, unsigned char *new, int w, int h, int os, int ns)
-{
- int x, y, me=0, mo=0, mn=0, mt=0;
- struct metrics l;
- for (y = 0; y < h-7; y += 8) {
- for (x = 0; x < w-7; x += 8) {
- block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns);
- if (l.even > me) me = l.even;
- if (l.odd > mo) mo = l.odd;
- if (l.noise > mn) mn = l.noise;
- if (l.temp > mt) mt = l.temp;
- }
- }
- m->even = me;
- m->odd = mo;
- m->noise = mn;
- m->temp = mt;
-}
-
-static void diff_fields(struct metrics *metr, mp_image_t *old, mp_image_t *new)
-{
- struct metrics m, mu, mv;
- diff_planes(&m, old->planes[0], new->planes[0],
- new->w, new->h, old->stride[0], new->stride[0]);
- if (new->flags & MP_IMGFLAG_PLANAR) {
- diff_planes(&mu, old->planes[1], new->planes[1],
- new->chroma_width, new->chroma_height,
- old->stride[1], new->stride[1]);
- diff_planes(&mv, old->planes[2], new->planes[2],
- new->chroma_width, new->chroma_height,
- old->stride[2], new->stride[2]);
- if (mu.even > m.even) m.even = mu.even;
- if (mu.odd > m.odd) m.odd = mu.odd;
- if (mu.noise > m.noise) m.noise = mu.noise;
- if (mu.temp > m.temp) m.temp = mu.temp;
- if (mv.even > m.even) m.even = mv.even;
- if (mv.odd > m.odd) m.odd = mv.odd;
- if (mv.noise > m.noise) m.noise = mv.noise;
- if (mv.temp > m.temp) m.temp = mv.temp;
- }
- *metr = m;
-}
-
-static void status(int f, struct metrics *m)
-{
- mp_msg(MSGT_VFILTER, MSGL_V, "frame %d: e=%d o=%d n=%d t=%d\n",
- f, m->even, m->odd, m->noise, m->temp);
-}
-
-static int analyze_fixed_pattern(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old)
-{
- if (p->frame >= 0) p->frame = (p->frame+1)%5;
- mp_msg(MSGT_VFILTER, MSGL_V, "frame %d\n", p->frame);
- switch (p->frame) {
- case -1: case 0: case 1: case 2:
- return TC_PROG;
- case 3:
- return TC_IL1;
- case 4:
- return TC_IL2;
- }
- return 0;
-}
-
-static int analyze_aggressive(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old)
-{
- struct metrics m, pm;
-
- if (p->frame >= 0) p->frame = (p->frame+1)%5;
-
- diff_fields(&m, old, new);
-
- status(p->frame, &m);
-
- pm = p->pm;
- p->pm = m;
-
- if (p->frame == 4) {
- /* We need to break at scene changes, but is this a valid test? */
- if ((m.even > p->thres[2]) && (m.odd > p->thres[2]) && (m.temp > p->thres[3])
- && (m.temp > 5*pm.temp) && (m.temp*2 > m.noise)) {
- mp_msg(MSGT_VFILTER, MSGL_V, "scene change breaking telecine!\n");
- p->frame = -1;
- return TC_DROP;
- }
- /* Thres. is to compensate for quantization errors when noise is low */
- if (m.noise - m.temp > -p->thres[4]) {
- if (COMPARABLE(m.even, pm.odd)) {
- //mp_msg(MSGT_VFILTER, MSGL_V, "confirmed field match!\n");
- return TC_IL2;
- } else if ((m.even < p->thres[0]) && (m.odd < p->thres[0]) && VERYCLOSE(m.even, m.odd)
- && VERYCLOSE(m.noise,m.temp) && VERYCLOSE(m.noise,pm.noise)) {
- mp_msg(MSGT_VFILTER, MSGL_V, "interlaced frame appears in duplicate!!!\n");
- p->pm = pm; /* hack :) */
- p->frame = 3;
- return TC_IL1;
- }
- } else {
- mp_msg(MSGT_VFILTER, MSGL_V, "mismatched telecine fields!\n");
- p->frame = -1;
- }
- }
-
- if (2*m.even*m.temp < m.odd*m.noise) {
- mp_msg(MSGT_VFILTER, MSGL_V, "caught telecine sync!\n");
- p->frame = 3;
- return TC_IL1;
- }
-
- if (p->frame < 3) {
- if (m.noise > p->thres[3]) {
- if (m.noise > 2*m.temp) {
- mp_msg(MSGT_VFILTER, MSGL_V, "merging fields out of sequence!\n");
- return TC_IL2;
- }
- if ((m.noise > 2*pm.noise) && (m.even > p->thres[2]) && (m.odd > p->thres[2])) {
- mp_msg(MSGT_VFILTER, MSGL_V, "dropping horrible interlaced frame!\n");
- return TC_DROP;
- }
- }
- }
-
- switch (p->frame) {
- case -1:
- if (4*m.noise > 5*m.temp) {
- mp_msg(MSGT_VFILTER, MSGL_V, "merging fields out of sequence!\n");
- return TC_IL2;
- }
- case 0:
- case 1:
- case 2:
- return TC_PROG;
- case 3:
- if ((m.even > p->thres[1]) && (m.even > m.odd) && (m.temp > m.noise)) {
- mp_msg(MSGT_VFILTER, MSGL_V, "lost telecine tracking!\n");
- p->frame = -1;
- return TC_PROG;
- }
- return TC_IL1;
- case 4:
- return TC_IL2;
- }
- return 0;
-}
-
-static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
-{
- switch (field) {
- case 0:
- my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- break;
- case 1:
- my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
- mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
- mpi->planes[1]+mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
- mpi->planes[2]+mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- break;
- case 2:
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0], mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2], mpi->stride[2]);
- }
- break;
- }
-}
-
-static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi, double pts)
-{
- struct vf_priv_s *p = vf->priv;
- int dropflag;
-
- switch (p->drop) {
- default:
- dropflag = 0;
- break;
- case 1:
- dropflag = (++p->lastdrop >= 5);
- break;
- case 2:
- dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes);
- break;
- }
-
- if (dropflag) {
- mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n",
- p->outframes, p->inframes, (float)p->outframes/p->inframes);
- p->lastdrop = 0;
- vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
- return 0;
- }
-
- p->outframes++;
- return vf_next_put_image(vf, dmpi, vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 0));
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- int ret=0;
- mp_image_t *dmpi;
- struct vf_priv_s *p = vf->priv;
-
- p->inframes++;
-
- if (p->needread) dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE,
- mpi->width, mpi->height);
- /* FIXME: is there a good way to get rid of static type? */
- else dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);
-
- switch (p->analyze(p, mpi, dmpi)) {
- case TC_DROP:
- /* Don't copy anything unless we'll need to read it. */
- if (p->needread) copy_image(dmpi, mpi, 2);
- p->lastdrop = 0;
- vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
- break;
- case TC_PROG:
- /* Copy and display the whole frame. */
- copy_image(dmpi, mpi, 2);
- ret = do_put_image(vf, dmpi, pts);
- break;
- case TC_IL1:
- /* Only copy bottom field unless we need to read. */
- if (p->needread) copy_image(dmpi, mpi, 2);
- else copy_image(dmpi, mpi, 1);
- p->lastdrop = 0;
- vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
- break;
- case TC_IL2:
- /* Copy top field and show frame, then copy bottom if needed. */
- copy_image(dmpi, mpi, 0);
- ret = do_put_image(vf, dmpi, pts);
- if (p->needread) copy_image(dmpi, mpi, 1);
- break;
- }
- return ret;
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - figure out which other formats work */
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static struct {
- char *name;
- int (*func)(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old);
- int needread;
-} anal_funcs[] = {
- { "fixed", analyze_fixed_pattern, 0 },
- { "aggressive", analyze_aggressive, 1 },
- { NULL, NULL, 0 }
-};
-
-#define STARTVARS if (0)
-#define GETVAR(str, name, out, func) \
- else if (!strncmp((str), name "=", sizeof(name))) \
- (out) = (func)((str) + sizeof(name))
-
-static void parse_var(struct vf_priv_s *p, char *var)
-{
- STARTVARS;
- GETVAR(var, "dr", p->drop, atoi);
- GETVAR(var, "t0", p->thres[0], atoi);
- GETVAR(var, "t1", p->thres[1], atoi);
- GETVAR(var, "t2", p->thres[2], atoi);
- GETVAR(var, "t3", p->thres[3], atoi);
- GETVAR(var, "t4", p->thres[4], atoi);
- GETVAR(var, "fr", p->frame, atoi);
- GETVAR(var, "am", p->mode, atoi);
-}
-
-static void parse_args(struct vf_priv_s *p, char *args)
-{
- char *next, *orig;
- for (args=orig=strdup(args); args; args=next) {
- next = strchr(args, ':');
- if (next) *next++ = 0;
- parse_var(p, args);
- }
- free(orig);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- vf->config = config;
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- p->frame = -1;
- p->thres[0] = 440;
- p->thres[1] = 720;
- p->thres[2] = 2500;
- p->thres[3] = 2500;
- p->thres[4] = 800;
- p->drop = 0;
- p->mode = 1;
- if (args) parse_args(p, args);
- p->analyze = anal_funcs[p->mode].func;
- p->needread = anal_funcs[p->mode].needread;
- vf_detc_init_pts_buf(&p->ptsbuf);
- return 1;
-}
-
-const vf_info_t vf_info_detc = {
- "de-telecine filter",
- "detc",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_dint.c b/libmpcodecs/vf_dint.c
deleted file mode 100644
index b449f9292c..0000000000
--- a/libmpcodecs/vf_dint.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "mp_image.h"
-#include "img_format.h"
-#include "vf.h"
-
-struct vf_priv_s {
- float sense; // first parameter
- float level; // second parameter
- unsigned int imgfmt;
- int diff;
- uint32_t max;
-// int dfr;
-// int rdfr;
- int was_dint;
- mp_image_t *pmpi; // previous mpi
-};
-
-#define MAXROWSIZE 1200
-
-static int config (struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- int rowsize;
-
- vf->priv->pmpi = vf_get_image (vf->next, outfmt, MP_IMGTYPE_TEMP,
- 0, width, height);
- if (!(vf->priv->pmpi->flags & MP_IMGFLAG_PLANAR) &&
- outfmt != IMGFMT_RGB32 && outfmt != IMGFMT_BGR32 &&
- outfmt != IMGFMT_RGB24 && outfmt != IMGFMT_BGR24 &&
- outfmt != IMGFMT_RGB16 && outfmt != IMGFMT_BGR16)
- {
- mp_msg (MSGT_VFILTER, MSGL_WARN, "Drop-interlaced filter doesn't support this outfmt :(\n");
- return 0;
- }
- vf->priv->imgfmt = outfmt;
- // recalculate internal values
- rowsize = vf->priv->pmpi->width;
- if (rowsize > MAXROWSIZE) rowsize = MAXROWSIZE;
- vf->priv->max = vf->priv->level * vf->priv->pmpi->height * rowsize / 2;
- if (vf->priv->pmpi->flags & MP_IMGFLAG_PLANAR) // planar YUV
- vf->priv->diff = vf->priv->sense * 256;
- else
- vf->priv->diff = vf->priv->sense * (1 << (vf->priv->pmpi->bpp/3));
- if (vf->priv->diff < 0) vf->priv->diff = 0;
- if (!(vf->priv->pmpi->flags & MP_IMGFLAG_PLANAR) &&
- vf->priv->pmpi->bpp < 24 && vf->priv->diff > 31)
- vf->priv->diff = 31;
- mp_msg (MSGT_VFILTER, MSGL_INFO, "Drop-interlaced: %dx%d diff %d / level %u\n",
- vf->priv->pmpi->width, vf->priv->pmpi->height,
- vf->priv->diff, (unsigned int)vf->priv->max);
-// vf->priv->rdfr = vf->priv->dfr = 0;
- vf->priv->was_dint = 0;
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static int put_image (struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- int8_t rrow0[MAXROWSIZE];
- int8_t rrow1[MAXROWSIZE];
- int8_t rrow2[MAXROWSIZE];
- int8_t *row0 = rrow0, *row1 = rrow1, *row2 = rrow2/*, *row3 = rrow3*/;
- int rowsize = mpi->width;
- uint32_t nok = 0, max = vf->priv->max;
- int diff = vf->priv->diff;
- int i, j;
- register int n1, n2;
- unsigned char *cur0, *prv0;
- register unsigned char *cur, *prv;
-
- if (rowsize > MAXROWSIZE) rowsize = MAXROWSIZE;
- // check if nothing to do
- if (mpi->imgfmt == vf->priv->imgfmt)
- {
- cur0 = mpi->planes[0] + mpi->stride[0];
- prv0 = mpi->planes[0];
- for (j = 1; j < mpi->height && nok <= max; j++)
- {
- cur = cur0;
- prv = prv0;
- // analyse row (row0)
- if (mpi->flags & MP_IMGFLAG_PLANAR) // planar YUV - check luminance
- for (i = 0; i < rowsize; i++)
- {
- if (cur[0] - prv[0] > diff)
- row0[i] = 1;
- else if (cur[0] - prv[0] < -diff)
- row0[i] = -1;
- else
- row0[i] = 0;
- cur++;
- prv++;
- // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0
- // but row3 is 1 so it's interlaced ptr (nok++)
- if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) &&
- (++nok) > max)
- break;
- }
- else if (mpi->bpp < 24) // RGB/BGR 16 - check all colors
- for (i = 0; i < rowsize; i++)
- {
- n1 = cur[0] + (cur[1]<<8);
- n2 = prv[0] + (prv[1]<<8);
- if ((n1&0x1f) - (n2&0x1f) > diff ||
- ((n1>>5)&0x3f) - ((n2>>5)&0x3f) > diff ||
- ((n1>>11)&0x1f) - ((n2>>11)&0x1f) > diff)
- row0[i] = 1;
- else if ((n1&0x1f) - (n2&0x1f) < -diff ||
- ((n1>>5)&0x3f) - ((n2>>5)&0x3f) < -diff ||
- ((n1>>11)&0x1f) - ((n2>>11)&0x1f) < -diff)
- row0[i] = -1;
- else
- row0[i] = 0;
- cur += 2;
- prv += 2;
- // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0
- // but row3 is 1 so it's interlaced ptr (nok++)
- if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) &&
- (++nok) > max)
- break;
- }
- else // RGB/BGR 24/32
- for (i = 0; i < rowsize; i++)
- {
- if (cur[0] - prv[0] > diff ||
- cur[1] - prv[1] > diff ||
- cur[2] - prv[2] > diff)
- row0[i] = 1;
- else if (prv[0] - cur[0] > diff ||
- prv[1] - cur[1] > diff ||
- prv[2] - cur[2] > diff)
- row0[i] = -1;
- else
- row0[i] = 0;
- cur += mpi->bpp/8;
- prv += mpi->bpp/8;
- // check if row0 is 1 but row1 is 0, and row2 is 1 or row2 is 0
- // but row3 is 1 so it's interlaced ptr (nok++)
- if (j > 2 && row0[i] > 0 && (row1[i] < 0 || (!row1[i] && row2[i] < 0)) &&
- (++nok) > max)
- break;
- }
- cur0 += mpi->stride[0];
- prv0 += mpi->stride[0];
- // rotate rows
- cur = row2;
- row2 = row1;
- row1 = row0;
- row0 = cur;
- }
- }
- // check if number of interlaced is above of max
- if (nok > max)
- {
-// vf->priv->dfr++;
- if (vf->priv->was_dint < 1) // can skip at most one frame!
- {
- vf->priv->was_dint++;
-// vf->priv->rdfr++;
-// mp_msg (MSGT_VFILTER, MSGL_INFO, "DI:%d/%d ", vf->priv->rdfr, vf->priv->dfr);
- return 0;
- }
- }
- vf->priv->was_dint = 0;
-// mp_msg (MSGT_VFILTER, MSGL_INFO, "DI:%d/%d ", vf->priv->rdfr, vf->priv->dfr);
- return vf_next_put_image (vf, mpi, pts);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config = config;
- vf->put_image = put_image;
-// vf->default_reqs=VFCAP_ACCEPT_STRIDE;
- vf->priv = malloc (sizeof(struct vf_priv_s));
- vf->priv->sense = 0.1;
- vf->priv->level = 0.15;
- vf->priv->pmpi = NULL;
- if (args)
- sscanf (args, "%f:%f", &vf->priv->sense, &vf->priv->level);
- return 1;
-}
-
-const vf_info_t vf_info_dint = {
- "drop interlaced frames",
- "dint",
- "A.G.",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_dvbscale.c b/libmpcodecs/vf_dvbscale.c
deleted file mode 100644
index 00c54ccbdf..0000000000
--- a/libmpcodecs/vf_dvbscale.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- int aspect;
-};
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- int scaled_y=vf->priv->aspect*d_height/d_width;
-
- d_width=width; // do X-scaling by hardware
- d_height=scaled_y;
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->default_caps=0;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- vf->priv->aspect=768;
- if(args) vf->priv->aspect=atoi(args);
- return 1;
-}
-
-const vf_info_t vf_info_dvbscale = {
- "calc Y scaling for DVB card",
- "dvbscale",
- "A'rpi",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_eq.c b/libmpcodecs/vf_eq.c
deleted file mode 100644
index 5925c86451..0000000000
--- a/libmpcodecs/vf_eq.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/video_out.h"
-
-#include "m_option.h"
-#include "m_struct.h"
-
-static struct vf_priv_s {
- unsigned char *buf;
- int brightness;
- int contrast;
-} const vf_priv_dflt = {
- NULL,
- 0,
- 0
-};
-
-#if HAVE_MMX
-static void process_MMX(unsigned char *dest, int dstride, unsigned char *src, int sstride,
- int w, int h, int brightness, int contrast)
-{
- int i;
- int pel;
- int dstep = dstride-w;
- int sstep = sstride-w;
- short brvec[4];
- short contvec[4];
-
- contrast = ((contrast+100)*256*16)/100;
- brightness = ((brightness+100)*511)/200-128 - contrast/32;
-
- brvec[0] = brvec[1] = brvec[2] = brvec[3] = brightness;
- contvec[0] = contvec[1] = contvec[2] = contvec[3] = contrast;
-
- while (h--) {
- __asm__ volatile (
- "movq (%5), %%mm3 \n\t"
- "movq (%6), %%mm4 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "movl %4, %%eax\n\t"
- ASMALIGN(4)
- "1: \n\t"
- "movq (%0), %%mm1 \n\t"
- "movq (%0), %%mm2 \n\t"
- "punpcklbw %%mm0, %%mm1 \n\t"
- "punpckhbw %%mm0, %%mm2 \n\t"
- "psllw $4, %%mm1 \n\t"
- "psllw $4, %%mm2 \n\t"
- "pmulhw %%mm4, %%mm1 \n\t"
- "pmulhw %%mm4, %%mm2 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "packuswb %%mm2, %%mm1 \n\t"
- "add $8, %0 \n\t"
- "movq %%mm1, (%1) \n\t"
- "add $8, %1 \n\t"
- "decl %%eax \n\t"
- "jnz 1b \n\t"
- : "=r" (src), "=r" (dest)
- : "0" (src), "1" (dest), "r" (w>>3), "r" (brvec), "r" (contvec)
- : "%eax"
- );
-
- for (i = w&7; i; i--)
- {
- pel = ((*src++* contrast)>>12) + brightness;
- if(pel&768) pel = (-pel)>>31;
- *dest++ = pel;
- }
-
- src += sstep;
- dest += dstep;
- }
- __asm__ volatile ( "emms \n\t" ::: "memory" );
-}
-#endif
-
-static void process_C(unsigned char *dest, int dstride, unsigned char *src, int sstride,
- int w, int h, int brightness, int contrast)
-{
- int i;
- int pel;
- int dstep = dstride-w;
- int sstep = sstride-w;
-
- contrast = ((contrast+100)*256*256)/100;
- brightness = ((brightness+100)*511)/200-128 - contrast/512;
-
- while (h--) {
- for (i = w; i; i--)
- {
- pel = ((*src++* contrast)>>16) + brightness;
- if(pel&768) pel = (-pel)>>31;
- *dest++ = pel;
- }
- src += sstep;
- dest += dstep;
- }
-}
-
-static void (*process)(unsigned char *dest, int dstride, unsigned char *src, int sstride,
- int w, int h, int brightness, int contrast);
-
-/* FIXME: add packed yuv version of process */
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
-
- dmpi=vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_EXPORT, 0,
- mpi->w, mpi->h);
-
- dmpi->stride[0] = mpi->stride[0];
- dmpi->planes[1] = mpi->planes[1];
- dmpi->planes[2] = mpi->planes[2];
- dmpi->stride[1] = mpi->stride[1];
- dmpi->stride[2] = mpi->stride[2];
-
- if (!vf->priv->buf) vf->priv->buf = malloc(mpi->stride[0]*mpi->h);
-
- if ((vf->priv->brightness == 0) && (vf->priv->contrast == 0))
- dmpi->planes[0] = mpi->planes[0];
- else {
- dmpi->planes[0] = vf->priv->buf;
- process(dmpi->planes[0], dmpi->stride[0],
- mpi->planes[0], mpi->stride[0],
- mpi->w, mpi->h, vf->priv->brightness,
- vf->priv->contrast);
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static int control(struct vf_instance *vf, int request, void* data)
-{
- vf_equalizer_t *eq;
-
- switch (request) {
- case VFCTRL_SET_EQUALIZER:
- eq = data;
- if (!strcmp(eq->item,"brightness")) {
- vf->priv->brightness = eq->value;
- return CONTROL_TRUE;
- }
- else if (!strcmp(eq->item,"contrast")) {
- vf->priv->contrast = eq->value;
- return CONTROL_TRUE;
- }
- break;
- case VFCTRL_GET_EQUALIZER:
- eq = data;
- if (!strcmp(eq->item,"brightness")) {
- eq->value = vf->priv->brightness;
- return CONTROL_TRUE;
- }
- else if (!strcmp(eq->item,"contrast")) {
- eq->value = vf->priv->contrast;
- return CONTROL_TRUE;
- }
- break;
- }
- return vf_next_control(vf, request, data);
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- switch (fmt) {
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_NV12:
- case IMGFMT_NV21:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv->buf);
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- vf->control=control;
- vf->query_format=query_format;
- vf->put_image=put_image;
- vf->uninit=uninit;
-
- process = process_C;
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) process = process_MMX;
-#endif
-
- return 1;
-}
-
-#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static const m_option_t vf_opts_fields[] = {
- {"brightness", ST_OFF(brightness), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
- {"contrast", ST_OFF(contrast), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
- { NULL, NULL, 0, 0, 0, 0, NULL }
-};
-
-static const m_struct_t vf_opts = {
- "eq",
- sizeof(struct vf_priv_s),
- &vf_priv_dflt,
- vf_opts_fields
-};
-
-const vf_info_t vf_info_eq = {
- "soft video equalizer",
- "eq",
- "Richard Felker",
- "",
- vf_open,
- &vf_opts
-};
diff --git a/libmpcodecs/vf_field.c b/libmpcodecs/vf_field.c
deleted file mode 100644
index f9cb06aded..0000000000
--- a/libmpcodecs/vf_field.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- int field;
-};
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height/2);
-
- // set up mpi as a double-stride image of dmpi:
- vf->dmpi->planes[0]=mpi->planes[0]+mpi->stride[0]*vf->priv->field;
- vf->dmpi->stride[0]=2*mpi->stride[0];
- if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
- vf->dmpi->planes[1]=mpi->planes[1]+
- mpi->stride[1]*vf->priv->field;
- vf->dmpi->stride[1]=2*mpi->stride[1];
- vf->dmpi->planes[2]=mpi->planes[2]+
- mpi->stride[2]*vf->priv->field;
- vf->dmpi->stride[2]=2*mpi->stride[2];
- } else
- vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
-
- return vf_next_put_image(vf,vf->dmpi, pts);
-}
-
-//===========================================================================//
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->uninit=uninit;
- vf->default_reqs=VFCAP_ACCEPT_STRIDE;
- vf->priv=calloc(1, sizeof(struct vf_priv_s));
- if (args) sscanf(args, "%d", &vf->priv->field);
- vf->priv->field &= 1;
- return 1;
-}
-
-const vf_info_t vf_info_field = {
- "extract single field",
- "field",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_fil.c b/libmpcodecs/vf_fil.c
deleted file mode 100644
index fb04f9504b..0000000000
--- a/libmpcodecs/vf_fil.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- int interleave;
- int height;
- int width;
- int stridefactor;
-};
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int pixel_stride= (width+15)&~15; //FIXME this is ust a guess ... especially for non planar its somewhat bad one
-
-#if 0
- if(mpi->flags&MP_IMGFLAG_PLANAR)
- pixel_stride= mpi->stride[0];
- else
- pixel_stride= 8*mpi->stride[0] / mpi->bpp;
-
-#endif
-
- if(vf->priv->interleave){
- vf->priv->height= 2*height;
- vf->priv->width= width - (pixel_stride/2);
- vf->priv->stridefactor=1;
- }else{
- vf->priv->height= height/2;
- vf->priv->width= width + pixel_stride;
- vf->priv->stridefactor=4;
- }
-//printf("hX %d %d %d\n", vf->priv->width,vf->priv->height,vf->priv->stridefactor);
-
- return vf_next_config(vf, vf->priv->width, vf->priv->height,
- (d_width*vf->priv->stridefactor)>>1, 2*d_height/vf->priv->stridefactor, flags, outfmt);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- if(mpi->flags&MP_IMGFLAG_DIRECT){
- // we've used DR, so we're ready...
- return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts);
- }
-
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
- vf->priv->width, vf->priv->height);
-
- // set up mpi as a double-stride image of dmpi:
- vf->dmpi->planes[0]=mpi->planes[0];
- vf->dmpi->stride[0]=(mpi->stride[0]*vf->priv->stridefactor)>>1;
- if(vf->dmpi->flags&MP_IMGFLAG_PLANAR){
- vf->dmpi->planes[1]=mpi->planes[1];
- vf->dmpi->stride[1]=(mpi->stride[1]*vf->priv->stridefactor)>>1;
- vf->dmpi->planes[2]=mpi->planes[2];
- vf->dmpi->stride[2]=(mpi->stride[2]*vf->priv->stridefactor)>>1;
- } else
- vf->dmpi->planes[1]=mpi->planes[1]; // passthru bgr8 palette!!!
-
- return vf_next_put_image(vf,vf->dmpi, pts);
-}
-
-//===========================================================================//
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->uninit=uninit;
- vf->default_reqs=VFCAP_ACCEPT_STRIDE;
- vf->priv=calloc(1, sizeof(struct vf_priv_s));
- vf->priv->interleave= args && (*args == 'i');
- return 1;
-}
-
-const vf_info_t vf_info_fil = {
- "fast (de)interleaver",
- "fil",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c
deleted file mode 100644
index 28eb1e77af..0000000000
--- a/libmpcodecs/vf_filmdint.c
+++ /dev/null
@@ -1,1442 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-#include "options.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "cmmx.h"
-
-#include "libvo/fastmemcpy.h"
-
-#define NUM_STORED 4
-
-enum pu_field_type_t {
- PU_1ST_OF_3,
- PU_2ND_OF_3,
- PU_3RD_OF_3,
- PU_1ST_OF_2,
- PU_2ND_OF_2,
- PU_INTERLACED
-};
-
-struct metrics {
- /* This struct maps to a packed word 64-bit MMX register */
- unsigned short int even;
- unsigned short int odd;
- unsigned short int noise;
- unsigned short int temp;
-} __attribute__ ((aligned (8)));
-
-struct frame_stats {
- struct metrics tiny, low, high, bigger, twox, max;
- struct { unsigned int even, odd, noise, temp; } sad;
- unsigned short interlaced_high;
- unsigned short interlaced_low;
- unsigned short num_blocks;
-};
-
-struct vf_priv_s {
- unsigned long inframes;
- unsigned long outframes;
- enum pu_field_type_t prev_type;
- unsigned swapped, chroma_swapped;
- unsigned luma_only;
- unsigned verbose;
- unsigned fast;
- unsigned long w, h, cw, ch, stride, chroma_stride, nplanes;
- unsigned long sad_thres;
- unsigned long dint_thres;
- unsigned char *memory_allocated;
- unsigned char *planes[2*NUM_STORED][4];
- unsigned char **old_planes;
- unsigned long static_idx;
- unsigned long temp_idx;
- unsigned long crop_x, crop_y, crop_cx, crop_cy;
- unsigned long export_count, merge_count;
- unsigned long num_breaks;
- unsigned long num_copies;
- long in_inc, out_dec, iosync;
- long num_fields;
- long prev_fields;
- long notout;
- long mmx2;
- unsigned small_bytes[2];
- unsigned mmx_temp[2];
- struct frame_stats stats[2];
- struct metrics thres;
- char chflag;
- double diff_time, merge_time, decode_time, vo_time, filter_time;
- struct vf_detc_pts_buf ptsbuf;
-};
-
-#define PPZ { 2000, 2000, 0, 2000 }
-#define PPR { 2000, 2000, 0, 2000 }
-static const struct frame_stats ppzs = {PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,0,0,9999};
-static const struct frame_stats pprs = {PPR,PPR,PPR,PPR,PPR,PPR,PPR,0,0,9999};
-
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef MAX
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-#define PDIFFUB(X,Y,T) "movq " #X "," #T "\n\t" \
- "psubusb " #Y "," #T "\n\t" \
- "psubusb " #X "," #Y "\n\t" \
- "paddusb " #Y "," #T "\n\t"
-
-#define PDIFFUBT(X,Y,T) "movq " #X "," #T "\n\t" \
- "psubusb " #Y "," #T "\n\t" \
- "psubusb " #X "," #Y "\n\t" \
- "paddusb " #T "," #Y "\n\t"
-
-#define PSUMBW(X,T,Z) "movq " #X "," #T "\n\t" \
- "punpcklbw " #Z "," #X "\n\t" \
- "punpckhbw " #Z "," #T "\n\t" \
- "paddw " #T "," #X "\n\t" \
- "movq " #X "," #T "\n\t" \
- "psllq $32, " #T "\n\t" \
- "paddw " #T "," #X "\n\t" \
- "movq " #X "," #T "\n\t" \
- "psllq $16, " #T "\n\t" \
- "paddw " #T "," #X "\n\t" \
- "psrlq $48, " #X "\n\t"
-
-#define PSADBW(X,Y,T,Z) PDIFFUBT(X,Y,T) PSUMBW(Y,T,Z)
-
-#define PMAXUB(X,Y) "psubusb " #X "," #Y "\n\tpaddusb " #X "," #Y "\n\t"
-#define PMAXUW(X,Y) "psubusw " #X "," #Y "\n\tpaddusw " #X "," #Y "\n\t"
-#define PMINUBT(X,Y,T) "movq " #Y "," #T "\n\t" \
- "psubusb " #X "," #T "\n\t" \
- "psubusb " #T "," #Y "\n\t"
-#define PAVGB(X,Y) "pavgusb " #X "," #Y "\n\t"
-
-static inline void
-get_metrics_c(unsigned char *a, unsigned char *b, int as, int bs, int lines,
- struct metrics *m)
-{
- a -= as;
- b -= bs;
- do {
- cmmx_t old_po = *(cmmx_t*)(a );
- cmmx_t po = *(cmmx_t*)(b );
- cmmx_t e = *(cmmx_t*)(b + bs);
- cmmx_t old_o = *(cmmx_t*)(a + 2*as);
- cmmx_t o = *(cmmx_t*)(b + 2*bs);
- cmmx_t ne = *(cmmx_t*)(b + 3*bs);
- cmmx_t old_no = *(cmmx_t*)(a + 4*as);
- cmmx_t no = *(cmmx_t*)(b + 4*bs);
-
- cmmx_t qup_old_odd = p31avgb(old_o, old_po);
- cmmx_t qup_odd = p31avgb( o, po);
- cmmx_t qdown_old_odd = p31avgb(old_o, old_no);
- cmmx_t qdown_odd = p31avgb( o, no);
-
- cmmx_t qup_even = p31avgb(ne, e);
- cmmx_t qdown_even = p31avgb(e, ne);
-
- cmmx_t temp_up_diff = pdiffub(qdown_even, qup_old_odd);
- cmmx_t noise_up_diff = pdiffub(qdown_even, qup_odd);
- cmmx_t temp_down_diff = pdiffub(qup_even, qdown_old_odd);
- cmmx_t noise_down_diff = pdiffub(qup_even, qdown_odd);
-
- cmmx_t odd_diff = pdiffub(o, old_o);
- m->odd += psumbw(odd_diff);
- m->even += psadbw(e, *(cmmx_t*)(a+as));
-
- temp_up_diff = pminub(temp_up_diff, temp_down_diff);
- temp_up_diff = pminub(temp_up_diff, odd_diff);
- m->temp += psumbw(temp_up_diff);
- noise_up_diff = pminub(noise_up_diff, odd_diff);
- noise_up_diff = pminub(noise_up_diff, noise_down_diff);
-
- m->noise += psumbw(noise_up_diff);
- a += 2*as;
- b += 2*bs;
- } while (--lines);
-}
-
-static inline void
-get_metrics_fast_c(unsigned char *a, unsigned char *b, int as, int bs,
- int lines, struct metrics *m)
-{
- a -= as;
- b -= bs;
- do {
- cmmx_t old_po = (*(cmmx_t*)(a ) >> 1) & ~SIGN_BITS;
- cmmx_t po = (*(cmmx_t*)(b ) >> 1) & ~SIGN_BITS;
- cmmx_t old_e = (*(cmmx_t*)(a + as) >> 1) & ~SIGN_BITS;
- cmmx_t e = (*(cmmx_t*)(b + bs) >> 1) & ~SIGN_BITS;
- cmmx_t old_o = (*(cmmx_t*)(a + 2*as) >> 1) & ~SIGN_BITS;
- cmmx_t o = (*(cmmx_t*)(b + 2*bs) >> 1) & ~SIGN_BITS;
- cmmx_t ne = (*(cmmx_t*)(b + 3*bs) >> 1) & ~SIGN_BITS;
- cmmx_t old_no = (*(cmmx_t*)(a + 4*as) >> 1) & ~SIGN_BITS;
- cmmx_t no = (*(cmmx_t*)(b + 4*bs) >> 1) & ~SIGN_BITS;
-
- cmmx_t qup_old_odd = p31avgb_s(old_o, old_po);
- cmmx_t qup_odd = p31avgb_s( o, po);
- cmmx_t qdown_old_odd = p31avgb_s(old_o, old_no);
- cmmx_t qdown_odd = p31avgb_s( o, no);
-
- cmmx_t qup_even = p31avgb_s(ne, e);
- cmmx_t qdown_even = p31avgb_s(e, ne);
-
- cmmx_t temp_up_diff = pdiffub_s(qdown_even, qup_old_odd);
- cmmx_t noise_up_diff = pdiffub_s(qdown_even, qup_odd);
- cmmx_t temp_down_diff = pdiffub_s(qup_even, qdown_old_odd);
- cmmx_t noise_down_diff = pdiffub_s(qup_even, qdown_odd);
-
- cmmx_t odd_diff = pdiffub_s(o, old_o);
- m->odd += psumbw_s(odd_diff) << 1;
- m->even += psadbw_s(e, old_e) << 1;
-
- temp_up_diff = pminub_s(temp_up_diff, temp_down_diff);
- temp_up_diff = pminub_s(temp_up_diff, odd_diff);
- m->temp += psumbw_s(temp_up_diff) << 1;
- noise_up_diff = pminub_s(noise_up_diff, odd_diff);
- noise_up_diff = pminub_s(noise_up_diff, noise_down_diff);
-
- m->noise += psumbw_s(noise_up_diff) << 1;
- a += 2*as;
- b += 2*bs;
- } while (--lines);
-}
-
-static inline void
-get_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs,
- int lines, struct metrics *m)
-{
- a -= as;
- b -= bs;
- do {
- cmmx_t old_po = (*(cmmx_t*)(a )>>1) & ~SIGN_BITS;
- cmmx_t po = (*(cmmx_t*)(b )>>1) & ~SIGN_BITS;
- cmmx_t old_e = (*(cmmx_t*)(a + as)>>1) & ~SIGN_BITS;
- cmmx_t e = (*(cmmx_t*)(b + bs)>>1) & ~SIGN_BITS;
- cmmx_t old_o = (*(cmmx_t*)(a + 2*as)>>1) & ~SIGN_BITS;
- cmmx_t o = (*(cmmx_t*)(b + 2*bs)>>1) & ~SIGN_BITS;
- cmmx_t ne = (*(cmmx_t*)(b + 3*bs)>>1) & ~SIGN_BITS;
-
- cmmx_t down_even = p31avgb_s(e, ne);
- cmmx_t up_odd = p31avgb_s(o, po);
- cmmx_t up_old_odd = p31avgb_s(old_o, old_po);
-
- cmmx_t odd_diff = pdiffub_s(o, old_o);
- cmmx_t temp_diff = pdiffub_s(down_even, up_old_odd);
- cmmx_t noise_diff = pdiffub_s(down_even, up_odd);
-
- m->even += psadbw_s(e, old_e) << 1;
- m->odd += psumbw_s(odd_diff) << 1;
-
- temp_diff = pminub_s(temp_diff, odd_diff);
- noise_diff = pminub_s(noise_diff, odd_diff);
-
- m->noise += psumbw_s(noise_diff) << 1;
- m->temp += psumbw_s(temp_diff) << 1;
- a += 2*as;
- b += 2*bs;
- } while (--lines);
-
-}
-
-static inline void
-get_block_stats(struct metrics *m, struct vf_priv_s *p, struct frame_stats *s)
-{
- unsigned two_e = m->even + MAX(m->even , p->thres.even );
- unsigned two_o = m->odd + MAX(m->odd , p->thres.odd );
- unsigned two_n = m->noise + MAX(m->noise, p->thres.noise);
- unsigned two_t = m->temp + MAX(m->temp , p->thres.temp );
-
- unsigned e_big = m->even >= (m->odd + two_o + 1)/2;
- unsigned o_big = m->odd >= (m->even + two_e + 1)/2;
- unsigned n_big = m->noise >= (m->temp + two_t + 1)/2;
- unsigned t_big = m->temp >= (m->noise + two_n + 1)/2;
-
- unsigned e2x = m->even >= two_o;
- unsigned o2x = m->odd >= two_e;
- unsigned n2x = m->noise >= two_t;
- unsigned t2x = m->temp >= two_n;
-
- unsigned ntiny_e = m->even > p->thres.even ;
- unsigned ntiny_o = m->odd > p->thres.odd ;
- unsigned ntiny_n = m->noise > p->thres.noise;
- unsigned ntiny_t = m->temp > p->thres.temp ;
-
- unsigned nlow_e = m->even > 2*p->thres.even ;
- unsigned nlow_o = m->odd > 2*p->thres.odd ;
- unsigned nlow_n = m->noise > 2*p->thres.noise;
- unsigned nlow_t = m->temp > 2*p->thres.temp ;
-
- unsigned high_e = m->even > 4*p->thres.even ;
- unsigned high_o = m->odd > 4*p->thres.odd ;
- unsigned high_n = m->noise > 4*p->thres.noise;
- unsigned high_t = m->temp > 4*p->thres.temp ;
-
- unsigned low_il = !n_big && !t_big && ntiny_n && ntiny_t;
- unsigned high_il = !n_big && !t_big && nlow_n && nlow_t;
-
- if (low_il | high_il) {
- s->interlaced_low += low_il;
- s->interlaced_high += high_il;
- } else {
- s->tiny.even += ntiny_e;
- s->tiny.odd += ntiny_o;
- s->tiny.noise += ntiny_n;
- s->tiny.temp += ntiny_t;
-
- s->low .even += nlow_e ;
- s->low .odd += nlow_o ;
- s->low .noise += nlow_n ;
- s->low .temp += nlow_t ;
-
- s->high.even += high_e ;
- s->high.odd += high_o ;
- s->high.noise += high_n ;
- s->high.temp += high_t ;
-
- if (m->even >= p->sad_thres) s->sad.even += m->even ;
- if (m->odd >= p->sad_thres) s->sad.odd += m->odd ;
- if (m->noise >= p->sad_thres) s->sad.noise += m->noise;
- if (m->temp >= p->sad_thres) s->sad.temp += m->temp ;
- }
- s->num_blocks++;
- s->max.even = MAX(s->max.even , m->even );
- s->max.odd = MAX(s->max.odd , m->odd );
- s->max.noise = MAX(s->max.noise, m->noise);
- s->max.temp = MAX(s->max.temp , m->temp );
-
- s->bigger.even += e_big ;
- s->bigger.odd += o_big ;
- s->bigger.noise += n_big ;
- s->bigger.temp += t_big ;
-
- s->twox.even += e2x ;
- s->twox.odd += o2x ;
- s->twox.noise += n2x ;
- s->twox.temp += t2x ;
-
-}
-
-static inline struct metrics
-block_metrics_c(unsigned char *a, unsigned char *b, int as, int bs,
- int lines, struct vf_priv_s *p, struct frame_stats *s)
-{
- struct metrics tm;
- tm.even = tm.odd = tm.noise = tm.temp = 0;
- get_metrics_c(a, b, as, bs, lines, &tm);
- if (sizeof(cmmx_t) < 8)
- get_metrics_c(a+4, b+4, as, bs, lines, &tm);
- get_block_stats(&tm, p, s);
- return tm;
-}
-
-static inline struct metrics
-block_metrics_fast_c(unsigned char *a, unsigned char *b, int as, int bs,
- int lines, struct vf_priv_s *p, struct frame_stats *s)
-{
- struct metrics tm;
- tm.even = tm.odd = tm.noise = tm.temp = 0;
- get_metrics_fast_c(a, b, as, bs, lines, &tm);
- if (sizeof(cmmx_t) < 8)
- get_metrics_fast_c(a+4, b+4, as, bs, lines, &tm);
- get_block_stats(&tm, p, s);
- return tm;
-}
-
-static inline struct metrics
-block_metrics_faster_c(unsigned char *a, unsigned char *b, int as, int bs,
- int lines, struct vf_priv_s *p, struct frame_stats *s)
-{
- struct metrics tm;
- tm.even = tm.odd = tm.noise = tm.temp = 0;
- get_metrics_faster_c(a, b, as, bs, lines, &tm);
- if (sizeof(cmmx_t) < 8)
- get_metrics_faster_c(a+4, b+4, as, bs, lines, &tm);
- get_block_stats(&tm, p, s);
- return tm;
-}
-
-#define MEQ(X,Y) ((X).even == (Y).even && (X).odd == (Y).odd && (X).temp == (Y).temp && (X).noise == (Y).noise)
-
-#define BLOCK_METRICS_TEMPLATE() \
- __asm__ volatile("pxor %mm7, %mm7\n\t" /* The result is colleted in mm7 */ \
- "pxor %mm6, %mm6\n\t" /* Temp to stay at 0 */ \
- ); \
- a -= as; \
- b -= bs; \
- do { \
- __asm__ volatile( \
- "movq (%0,%2), %%mm0\n\t" \
- "movq (%1,%3), %%mm1\n\t" /* mm1 = even */ \
- PSADBW(%%mm1, %%mm0, %%mm4, %%mm6) \
- "paddusw %%mm0, %%mm7\n\t" /* even diff */ \
- "movq (%0,%2,2), %%mm0\n\t" /* mm0 = old odd */ \
- "movq (%1,%3,2), %%mm2\n\t" /* mm2 = odd */ \
- "movq (%0), %%mm3\n\t" \
- "psubusb %4, %%mm3\n\t" \
- PAVGB(%%mm0, %%mm3) \
- PAVGB(%%mm0, %%mm3) /* mm3 = qup old odd */ \
- "movq %%mm0, %%mm5\n\t" \
- PSADBW(%%mm2, %%mm0, %%mm4, %%mm6) \
- "psllq $16, %%mm0\n\t" \
- "paddusw %%mm0, %%mm7\n\t" \
- "movq (%1), %%mm4\n\t" \
- "lea (%0,%2,2), %0\n\t" \
- "lea (%1,%3,2), %1\n\t" \
- "psubusb %4, %%mm4\n\t" \
- PAVGB(%%mm2, %%mm4) \
- PAVGB(%%mm2, %%mm4) /* mm4 = qup odd */ \
- PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 =abs(oldodd-odd) */ \
- "movq (%1,%3), %%mm5\n\t" \
- "psubusb %4, %%mm5\n\t" \
- PAVGB(%%mm1, %%mm5) \
- PAVGB(%%mm5, %%mm1) /* mm1 = qdown even */ \
- PAVGB((%1,%3), %%mm5) /* mm5 = qup next even */ \
- PDIFFUBT(%%mm1, %%mm3, %%mm0) /* mm3 = abs(qupoldo-qde) */ \
- PDIFFUBT(%%mm1, %%mm4, %%mm0) /* mm4 = abs(qupodd-qde) */ \
- PMINUBT(%%mm2, %%mm3, %%mm0) /* limit temp to odd diff */ \
- PMINUBT(%%mm2, %%mm4, %%mm0) /* limit noise to odd diff */ \
- "movq (%1,%3,2), %%mm2\n\t" \
- "psubusb %4, %%mm2\n\t" \
- PAVGB((%1), %%mm2) \
- PAVGB((%1), %%mm2) /* mm2 = qdown odd */ \
- "movq (%0,%2,2), %%mm1\n\t" \
- "psubusb %4, %%mm1\n\t" \
- PAVGB((%0), %%mm1) \
- PAVGB((%0), %%mm1) /* mm1 = qdown old odd */ \
- PDIFFUBT(%%mm5, %%mm2, %%mm0) /* mm2 = abs(qdo-qune) */ \
- PDIFFUBT(%%mm5, %%mm1, %%mm0) /* mm1 = abs(qdoo-qune) */ \
- PMINUBT(%%mm4, %%mm2, %%mm0) /* current */ \
- PMINUBT(%%mm3, %%mm1, %%mm0) /* old */ \
- PSUMBW(%%mm2, %%mm0, %%mm6) \
- PSUMBW(%%mm1, %%mm0, %%mm6) \
- "psllq $32, %%mm2\n\t" \
- "psllq $48, %%mm1\n\t" \
- "paddusw %%mm2, %%mm7\n\t" \
- "paddusw %%mm1, %%mm7\n\t" \
- : "=r" (a), "=r" (b) \
- : "r"((x86_reg)as), "r"((x86_reg)bs), "m" (ones), "0"(a), "1"(b), "X"(*a), "X"(*b) \
- ); \
- } while (--lines);
-
-#undef PSUMBW
-#undef PSADBW
-#undef PMAXUB
-#undef PMINUBT
-#undef PAVGB
-
-#define PSUMBW(X,T,Z) "psadbw " #Z "," #X "\n\t"
-#define PSADBW(X,Y,T,Z) "psadbw " #X "," #Y "\n\t"
-#define PMAXUB(X,Y) "pmaxub " #X "," #Y "\n\t"
-#define PMINUBT(X,Y,T) "pminub " #X "," #Y "\n\t"
-#define PAVGB(X,Y) "pavgb " #X "," #Y "\n\t"
-
-static inline struct metrics
-block_metrics_mmx2(unsigned char *a, unsigned char *b, int as, int bs,
- int lines, struct vf_priv_s *p, struct frame_stats *s)
-{
- struct metrics tm;
-#if !HAVE_MMX
- mp_msg(MSGT_VFILTER, MSGL_FATAL, "block_metrics_mmx2: internal error\n");
-#else
- static const unsigned long long ones = 0x0101010101010101ull;
- x86_reg interlaced;
- x86_reg prefetch_line = (((long)a>>3) & 7) + 10;
-#ifdef DEBUG
- struct frame_stats ts = *s;
-#endif
- __asm__ volatile("prefetcht0 (%0,%2)\n\t"
- "prefetcht0 (%1,%3)\n\t" :
- : "r" (a), "r" (b),
- "r" (prefetch_line * as), "r" (prefetch_line * bs));
-
- BLOCK_METRICS_TEMPLATE();
-
- s->num_blocks++;
- __asm__ volatile(
- "movq %3, %%mm0\n\t"
- "movq %%mm7, %%mm1\n\t"
- "psubusw %%mm0, %%mm1\n\t"
- "movq %%mm1, %%mm2\n\t"
- "paddusw %%mm0, %%mm2\n\t"
- "paddusw %%mm7, %%mm2\n\t"
- "pshufw $0xb1, %%mm2, %%mm3\n\t"
- "pavgw %%mm7, %%mm2\n\t"
- "pshufw $0xb1, %%mm2, %%mm2\n\t"
- "psubusw %%mm7, %%mm2\n\t"
- "pcmpeqw %%mm6, %%mm2\n\t" /* 1 if >= 1.5x */
- "psubusw %%mm7, %%mm3\n\t"
- "pcmpeqw %%mm6, %%mm3\n\t" /* 1 if >= 2x */
- "movq %1, %%mm4\n\t"
- "movq %2, %%mm5\n\t"
- "psubw %%mm2, %%mm4\n\t"
- "psubw %%mm3, %%mm5\n\t"
- "movq %%mm4, %1\n\t"
- "movq %%mm5, %2\n\t"
- "pxor %%mm4, %%mm4\n\t"
- "pcmpeqw %%mm1, %%mm4\n\t" /* 1 if <= t */
- "psubusw %%mm0, %%mm1\n\t"
- "pxor %%mm5, %%mm5\n\t"
- "pcmpeqw %%mm1, %%mm5\n\t" /* 1 if <= 2t */
- "psubusw %%mm0, %%mm1\n\t"
- "psubusw %%mm0, %%mm1\n\t"
- "pcmpeqw %%mm6, %%mm1\n\t" /* 1 if <= 4t */
- "pshufw $0xb1, %%mm2, %%mm0\n\t"
- "por %%mm2, %%mm0\n\t" /* 1 if not close */
- "punpckhdq %%mm0, %%mm0\n\t"
- "movq %%mm4, %%mm2\n\t" /* tttt */
- "punpckhdq %%mm5, %%mm2\n\t" /* ttll */
- "por %%mm2, %%mm0\n\t"
- "pcmpeqd %%mm6, %%mm0\n\t" /* close && big */
- "psrlq $16, %%mm0\n\t"
- "psrlw $15, %%mm0\n\t"
- "movd %%mm0, %0\n\t"
- : "=r" (interlaced), "=m" (s->bigger), "=m" (s->twox)
- : "m" (p->thres)
- );
-
- if (interlaced) {
- s->interlaced_high += interlaced >> 16;
- s->interlaced_low += interlaced;
- } else {
- __asm__ volatile(
- "pcmpeqw %%mm0, %%mm0\n\t" /* -1 */
- "psubw %%mm0, %%mm4\n\t"
- "psubw %%mm0, %%mm5\n\t"
- "psubw %%mm0, %%mm1\n\t"
- "paddw %0, %%mm4\n\t"
- "paddw %1, %%mm5\n\t"
- "paddw %2, %%mm1\n\t"
- "movq %%mm4, %0\n\t"
- "movq %%mm5, %1\n\t"
- "movq %%mm1, %2\n\t"
- : "=m" (s->tiny), "=m" (s->low), "=m" (s->high)
- );
-
- __asm__ volatile(
- "pshufw $0, %2, %%mm0\n\t"
- "psubusw %%mm7, %%mm0\n\t"
- "pcmpeqw %%mm6, %%mm0\n\t" /* 0 if below sad_thres */
- "pand %%mm7, %%mm0\n\t"
- "movq %%mm0, %%mm1\n\t"
- "punpcklwd %%mm6, %%mm0\n\t" /* sad even, odd */
- "punpckhwd %%mm6, %%mm1\n\t" /* sad noise, temp */
- "paddd %0, %%mm0\n\t"
- "paddd %1, %%mm1\n\t"
- "movq %%mm0, %0\n\t"
- "movq %%mm1, %1\n\t"
- : "=m" (s->sad.even), "=m" (s->sad.noise)
- : "m" (p->sad_thres)
- );
- }
-
- __asm__ volatile(
- "movq %%mm7, (%1)\n\t"
- PMAXUW((%0), %%mm7)
- "movq %%mm7, (%0)\n\t"
- "emms"
- : : "r" (&s->max), "r" (&tm), "X" (s->max)
- : "memory"
- );
-#ifdef DEBUG
- if (1) {
- struct metrics cm;
- a -= 7*as;
- b -= 7*bs;
- cm = block_metrics_c(a, b, as, bs, 4, p, &ts);
- if (!MEQ(tm, cm))
- mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad metrics\n");
- if (s) {
-# define CHECK(X) if (!MEQ(s->X, ts.X)) \
- mp_msg(MSGT_VFILTER, MSGL_WARN, "Bad " #X "\n");
- CHECK(tiny);
- CHECK(low);
- CHECK(high);
- CHECK(sad);
- CHECK(max);
- }
- }
-#endif
-#endif
- return tm;
-}
-
-static inline int
-dint_copy_line_mmx2(unsigned char *dst, unsigned char *a, long bos,
- long cos, int ds, int ss, int w, int t)
-{
-#if !HAVE_MMX
- mp_msg(MSGT_VFILTER, MSGL_FATAL, "dint_copy_line_mmx2: internal error\n");
- return 0;
-#else
- unsigned long len = (w+7) >> 3;
- int ret;
- __asm__ volatile (
- "pxor %%mm6, %%mm6 \n\t" /* deinterlaced pixel counter */
- "movd %0, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm7 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t" /* mm7 = threshold */
- : /* no output */
- : "rm" (t)
- );
- do {
- __asm__ volatile (
- "movq (%0), %%mm0\n\t"
- "movq (%0,%3,2), %%mm1\n\t"
- "movq %%mm0, (%2)\n\t"
- "pmaxub %%mm1, %%mm0\n\t"
- "pavgb (%0), %%mm1\n\t"
- "psubusb %%mm1, %%mm0\n\t"
- "paddusb %%mm7, %%mm0\n\t" /* mm0 = max-avg+thr */
- "movq (%0,%1), %%mm2\n\t"
- "movq (%0,%5), %%mm3\n\t"
- "movq %%mm2, %%mm4\n\t"
- PDIFFUBT(%%mm1, %%mm2, %%mm5)
- PDIFFUBT(%%mm1, %%mm3, %%mm5)
- "pminub %%mm2, %%mm3\n\t"
- "pcmpeqb %%mm3, %%mm2\n\t" /* b = min */
- "pand %%mm2, %%mm4\n\t"
- "pandn (%0,%5), %%mm2\n\t"
- "por %%mm4, %%mm2\n\t"
- "pminub %%mm0, %%mm3\n\t"
- "pcmpeqb %%mm0, %%mm3\n\t" /* set to 1s if >= threshold */
- "psubb %%mm3, %%mm6\n\t" /* count pixels above thr. */
- "pand %%mm3, %%mm1 \n\t"
- "pandn %%mm2, %%mm3 \n\t"
- "por %%mm3, %%mm1 \n\t" /* avg if >= threshold */
- "movq %%mm1, (%2,%4) \n\t"
- : /* no output */
- : "r" (a), "r" ((x86_reg)bos), "r" ((x86_reg)dst), "r" ((x86_reg)ss), "r" ((x86_reg)ds), "r" ((x86_reg)cos)
- );
- a += 8;
- dst += 8;
- } while (--len);
-
- __asm__ volatile ("pxor %%mm7, %%mm7 \n\t"
- "psadbw %%mm6, %%mm7 \n\t"
- "movd %%mm7, %0 \n\t"
- "emms \n\t"
- : "=r" (ret)
- );
- return ret;
-#endif
-}
-
-static inline int
-dint_copy_line(unsigned char *dst, unsigned char *a, long bos,
- long cos, int ds, int ss, int w, int t)
-{
- unsigned long len = ((unsigned long)w+sizeof(cmmx_t)-1) / sizeof(cmmx_t);
- cmmx_t dint_count = 0;
- cmmx_t thr;
- t |= t << 8;
- thr = t | (t << 16);
- if (sizeof(cmmx_t) > 4)
- thr |= thr << (sizeof(cmmx_t)*4);
- do {
- cmmx_t e = *(cmmx_t*)a;
- cmmx_t ne = *(cmmx_t*)(a+2*ss);
- cmmx_t o = *(cmmx_t*)(a+bos);
- cmmx_t oo = *(cmmx_t*)(a+cos);
- cmmx_t maxe = pmaxub(e, ne);
- cmmx_t avge = pavgb(e, ne);
- cmmx_t max_diff = maxe - avge + thr; /* 0<=max-avg<128, thr<128 */
- cmmx_t diffo = pdiffub(avge, o);
- cmmx_t diffoo = pdiffub(avge, oo);
- cmmx_t diffcmp = pcmpgtub(diffo, diffoo);
- cmmx_t bo = ((oo ^ o) & diffcmp) ^ o;
- cmmx_t diffbo = ((diffoo ^ diffo) & diffcmp) ^ diffo;
- cmmx_t above_thr = ~pcmpgtub(max_diff, diffbo);
- cmmx_t bo_or_avg = ((avge ^ bo) & above_thr) ^ bo;
- dint_count += above_thr & ONE_BYTES;
- *(cmmx_t*)(dst) = e;
- *(cmmx_t*)(dst+ds) = bo_or_avg;
- a += sizeof(cmmx_t);
- dst += sizeof(cmmx_t);
- } while (--len);
- return psumbw(dint_count);
-}
-
-static int
-dint_copy_plane(unsigned char *d, unsigned char *a, unsigned char *b,
- unsigned char *c, unsigned long w, unsigned long h,
- unsigned long ds, unsigned long ss, unsigned long threshold,
- long field, long mmx2)
-{
- unsigned long ret = 0;
- long bos = b - a;
- long cos = c - a;
- if (field) {
- fast_memcpy(d, b, w);
- h--;
- d += ds;
- a += ss;
- }
- bos += ss;
- cos += ss;
- while (h > 2) {
- if (threshold >= 128) {
- fast_memcpy(d, a, w);
- fast_memcpy(d+ds, a+bos, w);
- } else if (mmx2 == 1) {
- ret += dint_copy_line_mmx2(d, a, bos, cos, ds, ss, w, threshold);
- } else
- ret += dint_copy_line(d, a, bos, cos, ds, ss, w, threshold);
- h -= 2;
- d += 2*ds;
- a += 2*ss;
- }
- fast_memcpy(d, a, w);
- if (h == 2)
- fast_memcpy(d+ds, a+bos, w);
- return ret;
-}
-
-static void
-copy_merge_fields(struct vf_priv_s *p, mp_image_t *dmpi,
- unsigned char **old, unsigned char **new, unsigned long show)
-{
- unsigned long threshold = 256;
- unsigned long field = p->swapped;
- unsigned long dint_pixels = 0;
- unsigned char **other = old;
- if (show >= 12 || !(show & 3))
- show >>= 2, other = new, new = old;
- if (show <= 2) { /* Single field: de-interlace */
- threshold = p->dint_thres;
- field ^= show & 1;
- old = new;
- } else if (show == 3)
- old = new;
- else
- field ^= 1;
- dint_pixels +=dint_copy_plane(dmpi->planes[0], old[0], new[0],
- other[0], p->w, p->h, dmpi->stride[0],
- p->stride, threshold, field, p->mmx2);
- if (dmpi->flags & MP_IMGFLAG_PLANAR) {
- if (p->luma_only)
- old = new, other = new;
- else
- threshold = threshold/2 + 1;
- field ^= p->chroma_swapped;
- dint_copy_plane(dmpi->planes[1], old[1], new[1],
- other[1], p->cw, p->ch, dmpi->stride[1],
- p->chroma_stride, threshold, field, p->mmx2);
- dint_copy_plane(dmpi->planes[2], old[2], new[2],
- other[2], p->cw, p->ch, dmpi->stride[2],
- p->chroma_stride, threshold, field, p->mmx2);
- }
- if (dint_pixels > 0 && p->verbose)
- mp_msg(MSGT_VFILTER,MSGL_INFO,"Deinterlaced %lu pixels\n",dint_pixels);
-}
-
-static void diff_planes(struct vf_priv_s *p, struct frame_stats *s,
- unsigned char *of, unsigned char *nf,
- int w, int h, int os, int ns, int swapped)
-{
- int i, y;
- int align = -(long)nf & 7;
- of += align;
- nf += align;
- w -= align;
- if (swapped)
- of -= os, nf -= ns;
- i = (h*3 >> 7) & ~1;
- of += i*os + 8;
- nf += i*ns + 8;
- h -= i;
- w -= 16;
-
- memset(s, 0, sizeof(*s));
-
- for (y = (h-8) >> 3; y; y--) {
- if (p->mmx2 == 1) {
- for (i = 0; i < w; i += 8)
- block_metrics_mmx2(of+i, nf+i, os, ns, 4, p, s);
- } else if (p->fast > 3) {
- for (i = 0; i < w; i += 8)
- block_metrics_faster_c(of+i, nf+i, os, ns, 4, p, s);
- } else if (p->fast > 1) {
- for (i = 0; i < w; i += 8)
- block_metrics_fast_c(of+i, nf+i, os, ns, 4, p, s);
- } else {
- for (i = 0; i < w; i += 8)
- block_metrics_c(of+i, nf+i, os, ns, 4, p, s);
- }
- of += 8*os;
- nf += 8*ns;
- }
-}
-
-#define METRICS(X) (X).even, (X).odd, (X).noise, (X).temp
-
-static void diff_fields(struct vf_priv_s *p, struct frame_stats *s,
- unsigned char **old, unsigned char **new)
-{
- diff_planes(p, s, old[0], new[0], p->w, p->h,
- p->stride, p->stride, p->swapped);
- s->sad.even = (s->sad.even * 16ul) / s->num_blocks;
- s->sad.odd = (s->sad.odd * 16ul) / s->num_blocks;
- s->sad.noise = (s->sad.noise * 16ul) / s->num_blocks;
- s->sad.temp = (s->sad.temp * 16ul) / s->num_blocks;
- if (p->verbose)
- mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu%c M:%d/%d/%d/%d - %d, "
- "t:%d/%d/%d/%d, l:%d/%d/%d/%d, h:%d/%d/%d/%d, bg:%d/%d/%d/%d, "
- "2x:%d/%d/%d/%d, sad:%d/%d/%d/%d, lil:%d, hil:%d, ios:%.1f\n",
- p->inframes, p->chflag, METRICS(s->max), s->num_blocks,
- METRICS(s->tiny), METRICS(s->low), METRICS(s->high),
- METRICS(s->bigger), METRICS(s->twox), METRICS(s->sad),
- s->interlaced_low, s->interlaced_high,
- p->iosync / (double) p->in_inc);
-}
-
-static const char *parse_args(struct vf_priv_s *p, const char *args)
-{
- args--;
- while (args && *++args &&
- (sscanf(args, "io=%lu:%lu", &p->out_dec, &p->in_inc) == 2 ||
- sscanf(args, "diff_thres=%hu", &p->thres.even ) == 1 ||
- sscanf(args, "comb_thres=%hu", &p->thres.noise) == 1 ||
- sscanf(args, "sad_thres=%lu", &p->sad_thres ) == 1 ||
- sscanf(args, "dint_thres=%lu", &p->dint_thres ) == 1 ||
- sscanf(args, "fast=%u", &p->fast ) == 1 ||
- sscanf(args, "mmx2=%lu", &p->mmx2 ) == 1 ||
- sscanf(args, "luma_only=%u", &p->luma_only ) == 1 ||
- sscanf(args, "verbose=%u", &p->verbose ) == 1 ||
- sscanf(args, "crop=%lu:%lu:%lu:%lu", &p->w,
- &p->h, &p->crop_x, &p->crop_y) == 4))
- args = strchr(args, '/');
- return args;
-}
-
-static unsigned long gcd(unsigned long x, unsigned long y)
-{
- unsigned long t;
- if (x > y)
- t = x, x = y, y = t;
-
- while (x) {
- t = y % x;
- y = x;
- x = t;
- }
- return y;
-}
-
-static void init(struct vf_priv_s *p, mp_image_t *mpi)
-{
- unsigned long i;
- unsigned long plane_size, chroma_plane_size;
- unsigned char *plane;
- unsigned long cos, los;
- p->crop_cx = p->crop_x >> mpi->chroma_x_shift;
- p->crop_cy = p->crop_y >> mpi->chroma_y_shift;
- if (mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) {
- p->stride = (mpi->w + 15) & ~15;
- p->chroma_stride = p->stride >> mpi->chroma_x_shift;
- } else {
- p->stride = mpi->width;
- p->chroma_stride = mpi->chroma_width;
- }
- p->cw = p->w >> mpi->chroma_x_shift;
- p->ch = p->h >> mpi->chroma_y_shift;
- p->nplanes = 1;
- p->static_idx = 0;
- p->temp_idx = 0;
- p->old_planes = p->planes[0];
- plane_size = mpi->h * p->stride;
- chroma_plane_size = mpi->flags & MP_IMGFLAG_PLANAR ?
- mpi->chroma_height * p->chroma_stride : 0;
- p->memory_allocated =
- malloc(NUM_STORED * (plane_size+2*chroma_plane_size) +
- 8*p->chroma_stride + 4096);
- /* align to page boundary */
- plane = p->memory_allocated + (-(long)p->memory_allocated & 4095);
- memset(plane, 0, NUM_STORED * plane_size);
- los = p->crop_x + p->crop_y * p->stride;
- cos = p->crop_cx + p->crop_cy * p->chroma_stride;
- for (i = 0; i != NUM_STORED; i++, plane += plane_size) {
- p->planes[i][0] = plane;
- p->planes[NUM_STORED + i][0] = plane + los;
- }
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- p->nplanes = 3;
- memset(plane, 0x80, NUM_STORED * 2 * chroma_plane_size);
- for (i = 0; i != NUM_STORED; i++) {
- p->planes[i][1] = plane;
- p->planes[NUM_STORED + i][1] = plane + cos;
- plane += chroma_plane_size;
- p->planes[i][2] = plane;
- p->planes[NUM_STORED + i][2] = plane + cos;
- plane += chroma_plane_size;
- }
- }
- p->out_dec <<= 2;
- i = gcd(p->in_inc, p->out_dec);
- p->in_inc /= i;
- p->out_dec /= i;
- p->iosync = 0;
- p->num_fields = 3;
-}
-
-static inline double get_time(void)
-{
- struct timeval tv;
- gettimeofday(&tv, 0);
- return tv.tv_sec + tv.tv_usec * 1e-6;
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi)
-{
- struct vf_priv_s *p = vf->priv;
- static unsigned char **planes, planes_idx;
-
- if (mpi->type == MP_IMGTYPE_STATIC) return;
-
- if (!p->planes[0][0]) init(p, mpi);
-
- if (mpi->type == MP_IMGTYPE_TEMP ||
- (mpi->type == MP_IMGTYPE_IPB && !(mpi->flags & MP_IMGFLAG_READABLE)))
- planes_idx = NUM_STORED/2 + (++p->temp_idx % (NUM_STORED/2));
- else
- planes_idx = ++p->static_idx % (NUM_STORED/2);
- planes = p->planes[planes_idx];
- mpi->priv = p->planes[NUM_STORED + planes_idx];
- if (mpi->priv == p->old_planes) {
- unsigned char **old_planes =
- p->planes[NUM_STORED + 2 + (++p->temp_idx & 1)];
- my_memcpy_pic(old_planes[0], p->old_planes[0],
- p->w, p->h, p->stride, p->stride);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(old_planes[1], p->old_planes[1],
- p->cw, p->ch, p->chroma_stride, p->chroma_stride);
- my_memcpy_pic(old_planes[2], p->old_planes[2],
- p->cw, p->ch, p->chroma_stride, p->chroma_stride);
- }
- p->old_planes = old_planes;
- p->num_copies++;
- }
- mpi->planes[0] = planes[0];
- mpi->stride[0] = p->stride;
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- mpi->planes[1] = planes[1];
- mpi->planes[2] = planes[2];
- mpi->stride[1] = mpi->stride[2] = p->chroma_stride;
- }
- mpi->width = p->stride;
-
- mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
-}
-
-static inline long
-cmpe(unsigned long x, unsigned long y, unsigned long err, unsigned long e)
-{
- long diff = x-y;
- long unit = ((x+y+err) >> e);
- long ret = (diff > unit) - (diff < -unit);
- unit >>= 1;
- return ret + (diff > unit) - (diff < -unit);
-}
-
-static unsigned long
-find_breaks(struct vf_priv_s *p, struct frame_stats *s)
-{
- struct frame_stats *ps = &p->stats[(p->inframes-1) & 1];
- long notfilm = 5*p->in_inc - p->out_dec;
- unsigned long n = s->num_blocks >> 8;
- unsigned long sad_comb_cmp = cmpe(s->sad.temp, s->sad.noise, 512, 1);
- unsigned long ret = 8;
-
- if (cmpe(s->sad.temp, s->sad.even, 512, 1) > 0)
- mp_msg(MSGT_VFILTER, MSGL_WARN,
- "@@@@@@@@ Bottom-first field??? @@@@@@@@\n");
- if (s->sad.temp > 1000 && s->sad.noise > 1000)
- return 3;
- if (s->interlaced_high >= 2*n && s->sad.temp > 256 && s->sad.noise > 256)
- return 3;
- if (s->high.noise > s->num_blocks/4 && s->sad.noise > 10000 &&
- s->sad.noise > 2*s->sad.even && s->sad.noise > 2*ps->sad.odd) {
- // Mid-frame scene change
- if (s->tiny.temp + s->interlaced_low < n ||
- s->low.temp + s->interlaced_high < n/4 ||
- s->high.temp + s->interlaced_high < n/8 ||
- s->sad.temp < 160)
- return 1;
- return 3;
- }
- if (s->high.temp > s->num_blocks/4 && s->sad.temp > 10000 &&
- s->sad.temp > 2*ps->sad.odd && s->sad.temp > 2*ps->sad.even) {
- // Start frame scene change
- if (s->tiny.noise + s->interlaced_low < n ||
- s->low.noise + s->interlaced_high < n/4 ||
- s->high.noise + s->interlaced_high < n/8 ||
- s->sad.noise < 160)
- return 2;
- return 3;
- }
- if (sad_comb_cmp == 2)
- return 2;
- if (sad_comb_cmp == -2)
- return 1;
-
- if (s->tiny.odd > 3*MAX(n,s->tiny.even) + s->interlaced_low)
- return 1;
- if (s->tiny.even > 3*MAX(n,s->tiny.odd)+s->interlaced_low &&
- (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4)))
- return 4;
-
- if (s->sad.noise < 64 && s->sad.temp < 64 &&
- s->low.noise <= n/2 && s->high.noise <= n/4 &&
- s->low.temp <= n/2 && s->high.temp <= n/4)
- goto still;
-
- if (s->tiny.temp > 3*MAX(n,s->tiny.noise) + s->interlaced_low)
- return 2;
- if (s->tiny.noise > 3*MAX(n,s->tiny.temp) + s->interlaced_low)
- return 1;
-
- if (s->low.odd > 3*MAX(n/4,s->low.even) + s->interlaced_high)
- return 1;
- if (s->low.even > 3*MAX(n/4,s->low.odd)+s->interlaced_high &&
- s->sad.even > 2*s->sad.odd &&
- (!sad_comb_cmp || (s->low.noise <= n/4 && s->low.temp <= n/4)))
- return 4;
-
- if (s->low.temp > 3*MAX(n/4,s->low.noise) + s->interlaced_high)
- return 2;
- if (s->low.noise > 3*MAX(n/4,s->low.temp) + s->interlaced_high)
- return 1;
-
- if (sad_comb_cmp == 1 && s->sad.noise < 64)
- return 2;
- if (sad_comb_cmp == -1 && s->sad.temp < 64)
- return 1;
-
- if (s->tiny.odd <= n || (s->tiny.noise <= n/2 && s->tiny.temp <= n/2)) {
- if (s->interlaced_low <= n) {
- if (p->num_fields == 1)
- goto still;
- if (s->tiny.even <= n || ps->tiny.noise <= n/2)
- /* Still frame */
- goto still;
- if (s->bigger.even >= 2*MAX(n,s->bigger.odd) + s->interlaced_low)
- return 4;
- if (s->low.even >= 2*n + s->interlaced_low)
- return 4;
- goto still;
- }
- }
- if (s->low.odd <= n/4) {
- if (s->interlaced_high <= n/4) {
- if (p->num_fields == 1)
- goto still;
- if (s->low.even <= n/4)
- /* Still frame */
- goto still;
- if (s->bigger.even >= 2*MAX(n/4,s->bigger.odd)+s->interlaced_high)
- return 4;
- if (s->low.even >= n/2 + s->interlaced_high)
- return 4;
- goto still;
- }
- }
- if (s->bigger.temp > 2*MAX(n,s->bigger.noise) + s->interlaced_low)
- return 2;
- if (s->bigger.noise > 2*MAX(n,s->bigger.temp) + s->interlaced_low)
- return 1;
- if (s->bigger.temp > 2*MAX(n,s->bigger.noise) + s->interlaced_high)
- return 2;
- if (s->bigger.noise > 2*MAX(n,s->bigger.temp) + s->interlaced_high)
- return 1;
- if (s->twox.temp > 2*MAX(n,s->twox.noise) + s->interlaced_high)
- return 2;
- if (s->twox.noise > 2*MAX(n,s->twox.temp) + s->interlaced_high)
- return 1;
- if (s->bigger.even > 2*MAX(n,s->bigger.odd) + s->interlaced_low &&
- s->bigger.temp < n && s->bigger.noise < n)
- return 4;
- if (s->interlaced_low > MIN(2*n, s->tiny.odd))
- return 3;
- ret = 8 + (1 << (s->sad.temp > s->sad.noise));
- still:
- if (p->num_fields == 1 && p->prev_fields == 3 && notfilm >= 0 &&
- (s->tiny.temp <= s->tiny.noise || s->sad.temp < s->sad.noise+16))
- return 1;
- if (p->notout < p->num_fields && p->iosync > 2*p->in_inc && notfilm < 0)
- notfilm = 0;
- if (p->num_fields < 2 ||
- (p->num_fields == 2 && p->prev_fields == 2 && notfilm < 0))
- return ret;
- if (!notfilm && (p->prev_fields&~1) == 2) {
- if (p->prev_fields + p->num_fields == 5) {
- if (s->tiny.noise <= s->tiny.temp ||
- s->low.noise == 0 || s->low.noise < s->low.temp ||
- s->sad.noise < s->sad.temp+16)
- return 2;
- }
- if (p->prev_fields + p->num_fields == 4) {
- if (s->tiny.temp <= s->tiny.noise ||
- s->low.temp == 0 || s->low.temp < s->low.noise ||
- s->sad.temp < s->sad.noise+16)
- return 1;
- }
- }
- if (p->num_fields > 2 &&
- ps->sad.noise > s->sad.noise && ps->sad.noise > s->sad.temp)
- return 4;
- return 2 >> (s->sad.noise > s->sad.temp);
-}
-
-#define ITOC(X) (!(X) ? ' ' : (X) + ((X)>9 ? 'a'-10 : '0'))
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi = NULL;
- struct vf_priv_s *p = vf->priv;
- unsigned char **planes, **old_planes;
- struct frame_stats *s = &p->stats[p->inframes & 1];
- struct frame_stats *ps = &p->stats[(p->inframes-1) & 1];
- int swapped = 0;
- const int flags = mpi->fields;
- int breaks, prev;
- int show_fields = 0;
- int dropped_fields = 0;
- double start_time, diff_time;
- char prev_chflag = p->chflag;
- int keep_rate;
-
- if (!p->planes[0][0]) init(p, mpi);
-
- old_planes = p->old_planes;
-
- if ((mpi->flags & MP_IMGFLAG_DIRECT) && mpi->priv) {
- planes = mpi->priv;
- mpi->priv = 0;
- } else {
- planes = p->planes[2 + (++p->temp_idx & 1)];
- my_memcpy_pic(planes[0],
- mpi->planes[0] + p->crop_x + p->crop_y * mpi->stride[0],
- p->w, p->h, p->stride, mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(planes[1],
- mpi->planes[1] + p->crop_cx + p->crop_cy * mpi->stride[1],
- p->cw, p->ch, p->chroma_stride, mpi->stride[1]);
- my_memcpy_pic(planes[2],
- mpi->planes[2] + p->crop_cx + p->crop_cy * mpi->stride[2],
- p->cw, p->ch, p->chroma_stride, mpi->stride[2]);
- p->num_copies++;
- }
- }
-
- p->old_planes = planes;
- p->chflag = ';';
- if (flags & MP_IMGFIELD_ORDERED) {
- swapped = !(flags & MP_IMGFIELD_TOP_FIRST);
- p->chflag = (flags & MP_IMGFIELD_REPEAT_FIRST ? '|' :
- flags & MP_IMGFIELD_TOP_FIRST ? ':' : '.');
- }
- p->swapped = swapped;
-
- start_time = get_time();
- if (p->chflag == '|') {
- *s = ppzs;
- p->iosync += p->in_inc;
- } else if ((p->fast & 1) && prev_chflag == '|')
- *s = pprs;
- else
- diff_fields(p, s, old_planes, planes);
- diff_time = get_time();
- p->diff_time += diff_time - start_time;
- breaks = p->inframes ? find_breaks(p, s) : 2;
- p->inframes++;
- keep_rate = 4*p->in_inc == p->out_dec;
-
- switch (breaks) {
- case 0:
- case 8:
- case 9:
- case 10:
- if (!keep_rate && p->notout < p->num_fields && p->iosync < 2*p->in_inc)
- break;
- if (p->notout < p->num_fields)
- dropped_fields = -2;
- case 4:
- if (keep_rate || p->iosync >= -2*p->in_inc)
- show_fields = (4<<p->num_fields)-1;
- break;
- case 3:
- if (keep_rate)
- show_fields = 2;
- else if (p->iosync > 0) {
- if (p->notout >= p->num_fields && p->iosync > 2*p->in_inc) {
- show_fields = 4; /* prev odd only */
- if (p->num_fields > 1)
- show_fields |= 8; /* + prev even */
- } else {
- show_fields = 2; /* even only */
- if (p->notout >= p->num_fields)
- dropped_fields += p->num_fields;
- }
- }
- break;
- case 2:
- if (p->iosync <= -3*p->in_inc) {
- if (p->notout >= p->num_fields)
- dropped_fields = p->num_fields;
- break;
- }
- if (p->num_fields == 1) {
- int prevbreak = ps->sad.noise >= 128;
- if (p->iosync < 4*p->in_inc) {
- show_fields = 3;
- dropped_fields = prevbreak;
- } else {
- show_fields = 4 | (!prevbreak << 3);
- if (p->notout < 1 + p->prev_fields)
- dropped_fields = -!prevbreak;
- }
- break;
- }
- default:
- if (keep_rate)
- show_fields = 3 << (breaks & 1);
- else if (p->notout >= p->num_fields &&
- p->iosync >= (breaks == 1 ? -p->in_inc :
- p->in_inc << (p->num_fields == 1))) {
- show_fields = (1 << (2 + p->num_fields)) - (1<<breaks);
- } else {
- if (p->notout >= p->num_fields)
- dropped_fields += p->num_fields + 2 - breaks;
- if (breaks == 1) {
- if (p->iosync >= 4*p->in_inc)
- show_fields = 6;
- } else if (p->iosync > -3*p->in_inc)
- show_fields = 3; /* odd+even */
- }
- break;
- }
-
- show_fields &= 15;
- prev = p->prev_fields;
- if (breaks < 8) {
- if (p->num_fields == 1)
- breaks &= ~4;
- if (breaks)
- p->num_breaks++;
- if (breaks == 3)
- p->prev_fields = p->num_fields = 1;
- else if (breaks) {
- p->prev_fields = p->num_fields + (breaks==1) - (breaks==4);
- p->num_fields = breaks - (breaks == 4) + (p->chflag == '|');
- } else
- p->num_fields += 2;
- } else
- p->num_fields += 2;
-
- p->iosync += 4 * p->in_inc;
- if (p->chflag == '|')
- p->iosync += p->in_inc;
-
- if (show_fields) {
- p->iosync -= p->out_dec;
- p->notout = !(show_fields & 1) + !(show_fields & 3);
- if (((show_fields & 3) == 3 &&
- (s->low.noise + s->interlaced_low < (s->num_blocks>>8) ||
- s->sad.noise < 160)) ||
- ((show_fields & 12) == 12 &&
- (ps->low.noise + ps->interlaced_low < (s->num_blocks>>8) ||
- ps->sad.noise < 160))) {
- p->export_count++;
- dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_EXPORT,
- MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE,
- p->w, p->h);
- if ((show_fields & 3) != 3) planes = old_planes;
- dmpi->planes[0] = planes[0];
- dmpi->stride[0] = p->stride;
- dmpi->width = mpi->width;
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- dmpi->planes[1] = planes[1];
- dmpi->planes[2] = planes[2];
- dmpi->stride[1] = p->chroma_stride;
- dmpi->stride[2] = p->chroma_stride;
- }
- } else {
- p->merge_count++;
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- p->w, p->h);
- copy_merge_fields(p, dmpi, old_planes, planes, show_fields);
- }
- p->outframes++;
- } else
- p->notout += 2;
-
- if (p->verbose)
- mp_msg(MSGT_VFILTER, MSGL_INFO, "%lu %lu: %x %c %c %lu%s%s%c%s\n",
- p->inframes, p->outframes,
- breaks, breaks<8 && breaks>0 ? (int) p->prev_fields+'0' : ' ',
- ITOC(show_fields),
- p->num_breaks, 5*p->in_inc == p->out_dec && breaks<8 &&
- breaks>0 && ((prev&~1)!=2 || prev+p->prev_fields!=5) ?
- " ######## bad telecine ########" : "",
- dropped_fields ? " ======== dropped ":"", ITOC(dropped_fields),
- !show_fields || (show_fields & (show_fields-1)) ?
- "" : " @@@@@@@@@@@@@@@@@");
-
- p->merge_time += get_time() - diff_time;
- pts = vf_detc_adjust_pts(&p->ptsbuf, pts, 0, !show_fields);
- return show_fields ? vf_next_put_image(vf, dmpi, pts) : 0;
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - support more formats */
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- case IMGFMT_411P:
- case IMGFMT_422P:
- case IMGFMT_444P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- struct MPOpts *opts = vf->opts;
- unsigned long cxm = 0;
- unsigned long cym = 0;
- struct vf_priv_s *p = vf->priv;
- vf_detc_init_pts_buf(&p->ptsbuf);
- // rounding:
- if(!IMGFMT_IS_RGB(outfmt) && !IMGFMT_IS_BGR(outfmt)){
- switch(outfmt){
- case IMGFMT_444P:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- break;
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- cym = 3;
- case IMGFMT_411P:
- cxm = 3;
- break;
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- cym = 1;
- default:
- cxm = 1;
- }
- }
- p->chroma_swapped = !!(p->crop_y & (cym+1));
- if (p->w) p->w += p->crop_x & cxm;
- if (p->h) p->h += p->crop_y & cym;
- p->crop_x &= ~cxm;
- p->crop_y &= ~cym;
- if (!p->w || p->w > width ) p->w = width;
- if (!p->h || p->h > height) p->h = height;
- if (p->crop_x + p->w > width ) p->crop_x = 0;
- if (p->crop_y + p->h > height) p->crop_y = 0;
-
- if(!opts->screen_size_x && !opts->screen_size_y){
- d_width = d_width * p->w/width;
- d_height = d_height * p->h/height;
- }
- return vf_next_config(vf, p->w, p->h, d_width, d_height, flags, outfmt);
-}
-
-static void uninit(struct vf_instance *vf)
-{
- struct vf_priv_s *p = vf->priv;
- mp_msg(MSGT_VFILTER, MSGL_INFO, "diff_time: %.3f, merge_time: %.3f, "
- "export: %lu, merge: %lu, copy: %lu\n", p->diff_time, p->merge_time,
- p->export_count, p->merge_count, p->num_copies);
- free(p->memory_allocated);
- free(p);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- vf->get_image = get_image;
- vf->put_image = put_image;
- vf->config = config;
- vf->query_format = query_format;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- p->out_dec = 5;
- p->in_inc = 4;
- p->thres.noise = 128;
- p->thres.even = 128;
- p->sad_thres = 64;
- p->dint_thres = 4;
- p->luma_only = 0;
- p->fast = 3;
- p->mmx2 = gCpuCaps.hasMMX2;
- if (args) {
- const char *args_remain = parse_args(p, args);
- if (args_remain) {
- mp_msg(MSGT_VFILTER, MSGL_FATAL,
- "filmdint: unknown suboption: %s\n", args_remain);
- return 0;
- }
- if (p->out_dec < p->in_inc) {
- mp_msg(MSGT_VFILTER, MSGL_FATAL,
- "filmdint: increasing the frame rate is not supported\n");
- return 0;
- }
- }
- if (p->mmx2 > 2)
- p->mmx2 = 0;
-#if !HAVE_MMX
- p->mmx2 = 0;
-#endif
- p->thres.odd = p->thres.even;
- p->thres.temp = p->thres.noise;
- p->diff_time = 0;
- p->merge_time = 0;
- return 1;
-}
-
-const vf_info_t vf_info_filmdint = {
- "Advanced inverse telecine filer",
- "filmdint",
- "Zoltan Hidvegi",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_fixpts.c b/libmpcodecs/vf_fixpts.c
deleted file mode 100644
index 507c41c660..0000000000
--- a/libmpcodecs/vf_fixpts.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- double current;
- double step;
- int autostart;
- int autostep;
- unsigned have_step:1;
- unsigned print:1;
-};
-
-static int put_image(vf_instance_t *vf, mp_image_t *src, double pts)
-{
- struct vf_priv_s *p = vf->priv;
-
- if (p->print) {
- if (pts == MP_NOPTS_VALUE)
- mp_msg(MSGT_VFILTER, MSGL_INFO, "PTS: undef\n");
- else
- mp_msg(MSGT_VFILTER, MSGL_INFO, "PTS: %f\n", pts);
- }
- if (pts != MP_NOPTS_VALUE && p->autostart != 0) {
- p->current = pts;
- if (p->autostart > 0)
- p->autostart--;
- } else if (pts != MP_NOPTS_VALUE && p->autostep > 0) {
- p->step = pts - p->current;
- p->current = pts;
- p->autostep--;
- p->have_step = 1;
- } else if (p->have_step) {
- p->current += p->step;
- pts = p->current;
- } else {
- pts = MP_NOPTS_VALUE;
- }
- return vf_next_put_image(vf, src, pts);
-}
-
-static void uninit(vf_instance_t *vf)
-{
- free(vf->priv);
-}
-
-static int parse_args(struct vf_priv_s *p, const char *args)
-{
- int pos;
- double num, denom = 1;
- int iarg;
-
- while (*args != 0) {
- pos = 0;
- if (sscanf(args, "print%n", &pos) == 0 && pos > 0) {
- p->print = 1;
- } else if (sscanf(args, "fps=%lf%n/%lf%n", &num, &pos, &denom, &pos) >=
- 1 && pos > 0) {
- p->step = denom / num;
- p->have_step = 1;
- } else if (sscanf(args, "start=%lf%n", &num, &pos) >= 1 && pos > 0) {
- p->current = num;
- } else if (sscanf(args, "autostart=%d%n", &iarg, &pos) == 1 && pos > 0) {
- p->autostart = iarg;
- } else if (sscanf(args, "autofps=%d%n", &iarg, &pos) == 1 && pos > 0) {
- p->autostep = iarg;
- } else {
- mp_msg(MSGT_VFILTER, MSGL_FATAL,
- "fixpts: unknown suboption: %s\n", args);
- return 0;
- }
- args += pos;
- if (*args == ':')
- args++;
- }
- return 1;
-}
-
-static int open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- struct vf_priv_s ptmp = {
- .current = 0,
- .step = 0,
- .autostart = 0,
- .autostep = 0,
- .have_step = 0,
- .print = 0,
- };
-
- if (!parse_args(&ptmp, args == NULL ? "" : args))
- return 0;
-
- vf->put_image = put_image;
- vf->uninit = uninit;
- vf->priv = p = malloc(sizeof(struct vf_priv_s));
- *p = ptmp;
- p->current = -p->step;
-
- return 1;
-}
-
-const vf_info_t vf_info_fixpts = {
- "Fix presentation timestamps",
- "fixpts",
- "Nicolas George",
- "",
- &open,
- NULL
-};
diff --git a/libmpcodecs/vf_framestep.c b/libmpcodecs/vf_framestep.c
deleted file mode 100644
index d6aad9a90a..0000000000
--- a/libmpcodecs/vf_framestep.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * filter to ouput only 1 every n frame, or only the I (key)frame
- *
- * The parameters are:
- *
- * [I] | [i]num
- *
- * if you call the filter with I (uppercase) as the parameter
- * ... -vf framestep=I ...
- * then ONLY the keyframes are outputted.
- * For DVD it means, generally, one every 15 frames (IBBPBBPBBPBBPBB), for avi it means
- * every scene change or every keyint value (see -lavcopts).
- *
- * if you call the filter with the i (lowercase)
- * ... -vf framestep=i ...
- * then a I! followed by a cr is printed when a key frame (eg Intra frame) is
- * found, leaving the current line of mplayer, where you got the time, in
- * seconds, and frame of the key. Use this information to split the AVI.
- *
- * After the i or alone you can put a positive number and only one frame every
- * x (the number you set) is passed on the filter chain, limiting the output
- * of the frame.
- *
- * Example
- * ... -vf framestep=i20 ...
- * Dump one every 20 frames, printing on the console when a I-Frame is encounter.
- *
- * ... -vf framestep=25
- * Dump one every 25 frames.
- *
- * If you call the filter without parameter it does nothing (except using memory
- * and resource of your system,. of course).
- *
- * This filter doesn' t work like the option -sstep seconds.
- *
- * The -sstep seek to the new position, without decoding all frames but,
- * expecially on avi file coded whith mpeg4 (lavc or xvid or divx), the
- * seek is not always too much precise.
- *
- * This filter simply discard the unwanted frames, so you are very precise in
- * counting the frame but sometime you use a lot of CPU for nothing.
- *
- * As usual it depends on what you're doing.
- *
- * copyright (c) 2003 Daniele Forghieri ( guru@digitalfantasy.it )
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-/* Uncomment if you want to print some info on the format */
-// #define DUMP_FORMAT_DATA
-
-/* Private data */
-struct vf_priv_s {
- /* Current frame */
- int frame_cur;
- /* Frame output step, 0 = all */
- int frame_step;
- /* Only I-Frame (2), print on I-Frame (1) */
- int dump_iframe;
-};
-
-/* Filter handler */
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
- struct vf_priv_s *priv;
- int skip;
-
- priv = vf->priv;
-
- /* Print the 'I' if is a intra frame. The \n advance the current line so you got the
- * current file time (in second) and the frame number on the console ;-)
- */
- if (priv->dump_iframe) {
- if (mpi->pict_type == 1) {
- mp_msg(MSGT_VFILTER, MSGL_INFO, "I!\n");
- }
- }
-
- /* decide if frame must be shown */
- if (priv->dump_iframe == 2) {
- /* Only key frame */
- skip = mpi->pict_type == 1 ? 0 : 1;
- }
- else {
- /* Only 1 every frame_step */
- skip = 0;
- if ((priv->frame_step != 0) && ((priv->frame_cur % priv->frame_step) != 0)) {
- skip = 1;
- }
- }
- /* Increment current frame */
- ++priv->frame_cur;
-
- if (skip == 0) {
- /* Get image, export type (we don't modify tghe image) */
- dmpi=vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_EXPORT, 0,
- mpi->w, mpi->h);
- /* Copy only the pointer ( MP_IMGTYPE_EXPORT ! ) */
- dmpi->planes[0] = mpi->planes[0];
- dmpi->planes[1] = mpi->planes[1];
- dmpi->planes[2] = mpi->planes[2];
-
- dmpi->stride[0] = mpi->stride[0];
- dmpi->stride[1] = mpi->stride[1];
- dmpi->stride[2] = mpi->stride[2];
-
- dmpi->width = mpi->width;
- dmpi->height = mpi->height;
-
- /* Chain to next filter / output ... */
- return vf_next_put_image(vf, dmpi, pts);
- }
-
- /* Skip the frame */
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- /* Free private data */
- free(vf->priv);
-}
-
-/* Main entry funct for the filter */
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
-
- vf->put_image = put_image;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- if (p == NULL) {
- return 0;
- }
-
- if (args != NULL) {
-#ifdef DUMP_FORMAT_DATA
- if (*args == 'd') {
- p->dump_iframe = 3;
- }
- else
-#endif
- if (*args == 'I') {
- /* Dump only KEY (ie INTRA) frame */
- p->dump_iframe = 2;
- }
- else {
- if (*args == 'i') {
- /* Print a 'I!' when a i-frame is encounter */
- p->dump_iframe = 1;
- ++args;
- }
-
- if (*args != '\0') {
- p->frame_step = atoi(args);
- if (p->frame_step <= 0) {
- mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[VF_FRAMESTEP] Error parsing argument.\n");
- return 0;
- }
- }
- }
- }
- return 1;
-}
-
-const vf_info_t vf_info_framestep = {
- "Dump one every n / key frames",
- "framestep",
- "Daniele Forghieri",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c
deleted file mode 100644
index 59d731c529..0000000000
--- a/libmpcodecs/vf_fspp.c
+++ /dev/null
@@ -1,2112 +0,0 @@
-/*
- * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
- * Copyright (C) 2005 Nikolaj Poroshin <porosh3@psu.ru>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*
- * This implementation is based on an algorithm described in
- * "Aria Nosratinia Embedded Post-Processing for
- * Enhancement of Compressed Images (1999)"
- * (http://citeseer.nj.nec.com/nosratinia99embedded.html)
- * Futher, with splitting (i)dct into hor/ver passes, one of them can be
- * performed once per block, not pixel. This allows for much better speed.
- */
-
-/*
- Heavily optimized version of SPP filter by Nikolaj
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include <libavutil/intreadwrite.h>
-#include <libavutil/mem.h>
-#include <libavcodec/avcodec.h>
-
-#include "config.h"
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-#include "mangle.h"
-
-typedef short DCTELEM;
-
-//===========================================================================//
-#define BLOCKSZ 12
-
-static const short custom_threshold[64]=
-// values (296) can't be too high
-// -it causes too big quant dependence
-// or maybe overflow(check), which results in some flashing
-{ 71, 296, 295, 237, 71, 40, 38, 19,
- 245, 193, 185, 121, 102, 73, 53, 27,
- 158, 129, 141, 107, 97, 73, 50, 26,
- 102, 116, 109, 98, 82, 66, 45, 23,
- 71, 94, 95, 81, 70, 56, 38, 20,
- 56, 77, 74, 66, 56, 44, 30, 15,
- 38, 53, 50, 45, 38, 30, 21, 11,
- 20, 27, 26, 23, 20, 15, 11, 5
-};
-
-static const uint8_t __attribute__((aligned(32))) dither[8][8]={
- { 0, 48, 12, 60, 3, 51, 15, 63, },
- { 32, 16, 44, 28, 35, 19, 47, 31, },
- { 8, 56, 4, 52, 11, 59, 7, 55, },
- { 40, 24, 36, 20, 43, 27, 39, 23, },
- { 2, 50, 14, 62, 1, 49, 13, 61, },
- { 34, 18, 46, 30, 33, 17, 45, 29, },
- { 10, 58, 6, 54, 9, 57, 5, 53, },
- { 42, 26, 38, 22, 41, 25, 37, 21, },
-};
-
-struct vf_priv_s { //align 16 !
- uint64_t threshold_mtx_noq[8*2];
- uint64_t threshold_mtx[8*2];//used in both C & MMX (& later SSE2) versions
-
- int log2_count;
- int temp_stride;
- int qp;
- int mpeg2;
- int prev_q;
- uint8_t *src;
- int16_t *temp;
- int bframes;
- char *non_b_qp;
-};
-
-
-#if !HAVE_MMX
-
-//This func reads from 1 slice, 1 and clears 0 & 1
-static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)
-{int y, x;
-#define STORE(pos) \
- temp= (src[x + pos] + (d[pos]>>log2_scale))>>(6-log2_scale); \
- src[x + pos]=src[x + pos - 8*src_stride]=0; \
- if(temp & 0x100) temp= ~(temp>>31); \
- dst[x + pos]= temp;
-
- for(y=0; y<height; y++){
- const uint8_t *d= dither[y];
- for(x=0; x<width; x+=8){
- int temp;
- STORE(0);
- STORE(1);
- STORE(2);
- STORE(3);
- STORE(4);
- STORE(5);
- STORE(6);
- STORE(7);
- }
- src+=src_stride;
- dst+=dst_stride;
- }
-}
-
-//This func reads from 2 slices, 0 & 2 and clears 2-nd
-static void store_slice2_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)
-{int y, x;
-#define STORE2(pos) \
- temp= (src[x + pos] + src[x + pos + 16*src_stride] + (d[pos]>>log2_scale))>>(6-log2_scale); \
- src[x + pos + 16*src_stride]=0; \
- if(temp & 0x100) temp= ~(temp>>31); \
- dst[x + pos]= temp;
-
- for(y=0; y<height; y++){
- const uint8_t *d= dither[y];
- for(x=0; x<width; x+=8){
- int temp;
- STORE2(0);
- STORE2(1);
- STORE2(2);
- STORE2(3);
- STORE2(4);
- STORE2(5);
- STORE2(6);
- STORE2(7);
- }
- src+=src_stride;
- dst+=dst_stride;
- }
-}
-
-static void mul_thrmat_c(struct vf_priv_s *p,int q)
-{
- int a;
- for(a=0;a<64;a++)
- ((short*)p->threshold_mtx)[a]=q * ((short*)p->threshold_mtx_noq)[a];//ints faster in C
-}
-
-static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt);
-static void row_idct_c(DCTELEM* workspace,
- int16_t* output_adr, int output_stride, int cnt);
-static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt);
-
-//this is rather ugly, but there is no need for function pointers
-#define store_slice_s store_slice_c
-#define store_slice2_s store_slice2_c
-#define mul_thrmat_s mul_thrmat_c
-#define column_fidct_s column_fidct_c
-#define row_idct_s row_idct_c
-#define row_fdct_s row_fdct_c
-
-#else /* HAVE_MMX */
-
-//This func reads from 1 slice, 1 and clears 0 & 1
-static void store_slice_mmx(uint8_t *dst, int16_t *src, long dst_stride, long src_stride, long width, long height, long log2_scale)
-{
- const uint8_t *od=&dither[0][0];
- const uint8_t *end=&dither[height][0];
- width = (width+7)&~7;
- dst_stride-=width;
- //src_stride=(src_stride-width)*2;
- __asm__ volatile(
- "mov %5, %%"REG_d" \n\t"
- "mov %6, %%"REG_S" \n\t"
- "mov %7, %%"REG_D" \n\t"
- "mov %1, %%"REG_a" \n\t"
- "movd %%"REG_d", %%mm5 \n\t"
- "xor $-1, %%"REG_d" \n\t"
- "mov %%"REG_a", %%"REG_c" \n\t"
- "add $7, %%"REG_d" \n\t"
- "neg %%"REG_a" \n\t"
- "sub %0, %%"REG_c" \n\t"
- "add %%"REG_c", %%"REG_c" \n\t"
- "movd %%"REG_d", %%mm2 \n\t"
- "mov %%"REG_c", %1 \n\t"
- "mov %2, %%"REG_d" \n\t"
- "shl $4, %%"REG_a" \n\t"
-
- "2: \n\t"
- "movq (%%"REG_d"), %%mm3 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "punpckhbw %%mm7, %%mm4 \n\t"
- "mov %0, %%"REG_c" \n\t"
- "psraw %%mm5, %%mm3 \n\t"
- "psraw %%mm5, %%mm4 \n\t"
- "1: \n\t"
- "movq %%mm7, (%%"REG_S",%%"REG_a",) \n\t"
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq 8(%%"REG_S"), %%mm1 \n\t"
-
- "movq %%mm7, 8(%%"REG_S",%%"REG_a",) \n\t"
- "paddw %%mm3, %%mm0 \n\t"
- "paddw %%mm4, %%mm1 \n\t"
-
- "movq %%mm7, (%%"REG_S") \n\t"
- "psraw %%mm2, %%mm0 \n\t"
- "psraw %%mm2, %%mm1 \n\t"
-
- "movq %%mm7, 8(%%"REG_S") \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "add $16, %%"REG_S" \n\t"
-
- "movq %%mm0, (%%"REG_D") \n\t"
- "add $8, %%"REG_D" \n\t"
- "sub $8, %%"REG_c" \n\t"
- "jg 1b \n\t"
- "add %1, %%"REG_S" \n\t"
- "add $8, %%"REG_d" \n\t"
- "add %3, %%"REG_D" \n\t"
- "cmp %4, %%"REG_d" \n\t"
- "jl 2b \n\t"
-
- :
- : "m" (width), "m" (src_stride), "erm" (od), "m" (dst_stride), "erm" (end),
- "m" (log2_scale), "m" (src), "m" (dst) //input
- : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
- );
-}
-
-//This func reads from 2 slices, 0 & 2 and clears 2-nd
-static void store_slice2_mmx(uint8_t *dst, int16_t *src, long dst_stride, long src_stride, long width, long height, long log2_scale)
-{
- const uint8_t *od=&dither[0][0];
- const uint8_t *end=&dither[height][0];
- width = (width+7)&~7;
- dst_stride-=width;
- //src_stride=(src_stride-width)*2;
- __asm__ volatile(
- "mov %5, %%"REG_d" \n\t"
- "mov %6, %%"REG_S" \n\t"
- "mov %7, %%"REG_D" \n\t"
- "mov %1, %%"REG_a" \n\t"
- "movd %%"REG_d", %%mm5 \n\t"
- "xor $-1, %%"REG_d" \n\t"
- "mov %%"REG_a", %%"REG_c" \n\t"
- "add $7, %%"REG_d" \n\t"
- "sub %0, %%"REG_c" \n\t"
- "add %%"REG_c", %%"REG_c" \n\t"
- "movd %%"REG_d", %%mm2 \n\t"
- "mov %%"REG_c", %1 \n\t"
- "mov %2, %%"REG_d" \n\t"
- "shl $5, %%"REG_a" \n\t"
-
- "2: \n\t"
- "movq (%%"REG_d"), %%mm3 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "punpckhbw %%mm7, %%mm4 \n\t"
- "mov %0, %%"REG_c" \n\t"
- "psraw %%mm5, %%mm3 \n\t"
- "psraw %%mm5, %%mm4 \n\t"
- "1: \n\t"
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq 8(%%"REG_S"), %%mm1 \n\t"
- "paddw %%mm3, %%mm0 \n\t"
-
- "paddw (%%"REG_S",%%"REG_a",), %%mm0 \n\t"
- "paddw %%mm4, %%mm1 \n\t"
- "movq 8(%%"REG_S",%%"REG_a",), %%mm6 \n\t"
-
- "movq %%mm7, (%%"REG_S",%%"REG_a",) \n\t"
- "psraw %%mm2, %%mm0 \n\t"
- "paddw %%mm6, %%mm1 \n\t"
-
- "movq %%mm7, 8(%%"REG_S",%%"REG_a",) \n\t"
- "psraw %%mm2, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
-
- "movq %%mm0, (%%"REG_D") \n\t"
- "add $16, %%"REG_S" \n\t"
- "add $8, %%"REG_D" \n\t"
- "sub $8, %%"REG_c" \n\t"
- "jg 1b \n\t"
- "add %1, %%"REG_S" \n\t"
- "add $8, %%"REG_d" \n\t"
- "add %3, %%"REG_D" \n\t"
- "cmp %4, %%"REG_d" \n\t"
- "jl 2b \n\t"
-
- :
- : "m" (width), "m" (src_stride), "erm" (od), "m" (dst_stride), "erm" (end),
- "m" (log2_scale), "m" (src), "m" (dst) //input
- : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_D, "%"REG_S
- );
-}
-
-static void mul_thrmat_mmx(struct vf_priv_s *p, int q)
-{
- uint64_t *adr=&p->threshold_mtx_noq[0];
- __asm__ volatile(
- "movd %0, %%mm7 \n\t"
- "add $8*8*2, %%"REG_D" \n\t"
- "movq 0*8(%%"REG_S"), %%mm0 \n\t"
- "punpcklwd %%mm7, %%mm7 \n\t"
- "movq 1*8(%%"REG_S"), %%mm1 \n\t"
- "punpckldq %%mm7, %%mm7 \n\t"
- "pmullw %%mm7, %%mm0 \n\t"
-
- "movq 2*8(%%"REG_S"), %%mm2 \n\t"
- "pmullw %%mm7, %%mm1 \n\t"
-
- "movq 3*8(%%"REG_S"), %%mm3 \n\t"
- "pmullw %%mm7, %%mm2 \n\t"
-
- "movq %%mm0, 0*8(%%"REG_D") \n\t"
- "movq 4*8(%%"REG_S"), %%mm4 \n\t"
- "pmullw %%mm7, %%mm3 \n\t"
-
- "movq %%mm1, 1*8(%%"REG_D") \n\t"
- "movq 5*8(%%"REG_S"), %%mm5 \n\t"
- "pmullw %%mm7, %%mm4 \n\t"
-
- "movq %%mm2, 2*8(%%"REG_D") \n\t"
- "movq 6*8(%%"REG_S"), %%mm6 \n\t"
- "pmullw %%mm7, %%mm5 \n\t"
-
- "movq %%mm3, 3*8(%%"REG_D") \n\t"
- "movq 7*8+0*8(%%"REG_S"), %%mm0 \n\t"
- "pmullw %%mm7, %%mm6 \n\t"
-
- "movq %%mm4, 4*8(%%"REG_D") \n\t"
- "movq 7*8+1*8(%%"REG_S"), %%mm1 \n\t"
- "pmullw %%mm7, %%mm0 \n\t"
-
- "movq %%mm5, 5*8(%%"REG_D") \n\t"
- "movq 7*8+2*8(%%"REG_S"), %%mm2 \n\t"
- "pmullw %%mm7, %%mm1 \n\t"
-
- "movq %%mm6, 6*8(%%"REG_D") \n\t"
- "movq 7*8+3*8(%%"REG_S"), %%mm3 \n\t"
- "pmullw %%mm7, %%mm2 \n\t"
-
- "movq %%mm0, 7*8+0*8(%%"REG_D") \n\t"
- "movq 7*8+4*8(%%"REG_S"), %%mm4 \n\t"
- "pmullw %%mm7, %%mm3 \n\t"
-
- "movq %%mm1, 7*8+1*8(%%"REG_D") \n\t"
- "movq 7*8+5*8(%%"REG_S"), %%mm5 \n\t"
- "pmullw %%mm7, %%mm4 \n\t"
-
- "movq %%mm2, 7*8+2*8(%%"REG_D") \n\t"
- "movq 7*8+6*8(%%"REG_S"), %%mm6 \n\t"
- "pmullw %%mm7, %%mm5 \n\t"
-
- "movq %%mm3, 7*8+3*8(%%"REG_D") \n\t"
- "movq 14*8+0*8(%%"REG_S"), %%mm0 \n\t"
- "pmullw %%mm7, %%mm6 \n\t"
-
- "movq %%mm4, 7*8+4*8(%%"REG_D") \n\t"
- "movq 14*8+1*8(%%"REG_S"), %%mm1 \n\t"
- "pmullw %%mm7, %%mm0 \n\t"
-
- "movq %%mm5, 7*8+5*8(%%"REG_D") \n\t"
- "pmullw %%mm7, %%mm1 \n\t"
-
- "movq %%mm6, 7*8+6*8(%%"REG_D") \n\t"
- "movq %%mm0, 14*8+0*8(%%"REG_D") \n\t"
- "movq %%mm1, 14*8+1*8(%%"REG_D") \n\t"
-
- : "+g" (q), "+S" (adr), "+D" (adr)
- :
- );
-}
-
-static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt);
-static void row_idct_mmx(DCTELEM* workspace,
- int16_t* output_adr, int output_stride, int cnt);
-static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt);
-
-#define store_slice_s store_slice_mmx
-#define store_slice2_s store_slice2_mmx
-#define mul_thrmat_s mul_thrmat_mmx
-#define column_fidct_s column_fidct_mmx
-#define row_idct_s row_idct_mmx
-#define row_fdct_s row_fdct_mmx
-#endif // HAVE_MMX
-
-static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src,
- int dst_stride, int src_stride,
- int width, int height,
- uint8_t *qp_store, int qp_stride, int is_luma)
-{
- int x, x0, y, es, qy, t;
- const int stride= is_luma ? p->temp_stride : (width+16);//((width+16+15)&(~15))
- const int step=6-p->log2_count;
- const int qps= 3 + is_luma;
- int32_t __attribute__((aligned(32))) block_align[4*8*BLOCKSZ+ 4*8*BLOCKSZ];
- DCTELEM *block= (DCTELEM *)block_align;
- DCTELEM *block3=(DCTELEM *)(block_align+4*8*BLOCKSZ);
-
- memset(block3, 0, 4*8*BLOCKSZ);
-
- //p->src=src-src_stride*8-8;//!
- if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
- for(y=0; y<height; y++){
- int index= 8 + 8*stride + y*stride;
- fast_memcpy(p->src + index, src + y*src_stride, width);//this line can be avoided by using DR & user fr.buffers
- for(x=0; x<8; x++){
- p->src[index - x - 1]= p->src[index + x ];
- p->src[index + width + x ]= p->src[index + width - x - 1];
- }
- }
- for(y=0; y<8; y++){
- fast_memcpy(p->src + ( 7-y)*stride, p->src + ( y+8)*stride, stride);
- fast_memcpy(p->src + (height+8+y)*stride, p->src + (height-y+7)*stride, stride);
- }
- //FIXME (try edge emu)
-
- for(y=8; y<24; y++)
- memset(p->temp+ 8 +y*stride, 0,width*sizeof(int16_t));
-
- for(y=step; y<height+8; y+=step){ //step= 1,2
- qy=y-4;
- if (qy>height-1) qy=height-1;
- if (qy<0) qy=0;
- qy=(qy>>qps)*qp_stride;
- row_fdct_s(block, p->src + y*stride +2-(y&1), stride, 2);
- for(x0=0; x0<width+8-8*(BLOCKSZ-1); x0+=8*(BLOCKSZ-1)){
- row_fdct_s(block+8*8, p->src + y*stride+8+x0 +2-(y&1), stride, 2*(BLOCKSZ-1));
- if(p->qp)
- column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+0*8, block3+0*8, 8*(BLOCKSZ-1)); //yes, this is a HOTSPOT
- else
- for (x=0; x<8*(BLOCKSZ-1); x+=8) {
- t=x+x0-2; //correct t=x+x0-2-(y&1), but its the same
- if (t<0) t=0;//t always < width-2
- t=qp_store[qy+(t>>qps)];
- t=norm_qscale(t, p->mpeg2);
- if (t!=p->prev_q) p->prev_q=t, mul_thrmat_s(p, t);
- column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block+x*8, block3+x*8, 8); //yes, this is a HOTSPOT
- }
- row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, 2*(BLOCKSZ-1));
- memmove(block, block+(BLOCKSZ-1)*64, 8*8*sizeof(DCTELEM)); //cycling
- memmove(block3, block3+(BLOCKSZ-1)*64, 6*8*sizeof(DCTELEM));
- }
- //
- es=width+8-x0; // 8, ...
- if (es>8)
- row_fdct_s(block+8*8, p->src + y*stride+8+x0 +2-(y&1), stride, (es-4)>>2);
- column_fidct_s((int16_t*)(&p->threshold_mtx[0]), block, block3, es&(~1));
- row_idct_s(block3+0*8, p->temp + (y&15)*stride+x0+2-(y&1), stride, es>>2);
- {const int y1=y-8+step;//l5-7 l4-6
- if (!(y1&7) && y1) {
- if (y1&8) store_slice_s(dst + (y1-8)*dst_stride, p->temp+ 8 +8*stride,
- dst_stride, stride, width, 8, 5-p->log2_count);
- else store_slice2_s(dst + (y1-8)*dst_stride, p->temp+ 8 +0*stride,
- dst_stride, stride, width, 8, 5-p->log2_count);
- } }
- }
-
- if (y&7) { // == height & 7
- if (y&8) store_slice_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +8*stride,
- dst_stride, stride, width, y&7, 5-p->log2_count);
- else store_slice2_s(dst + ((y-8)&~7)*dst_stride, p->temp+ 8 +0*stride,
- dst_stride, stride, width, y&7, 5-p->log2_count);
- }
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- int h= (height+16+15)&(~15);
-
- vf->priv->temp_stride= (width+16+15)&(~15);
- vf->priv->temp= (int16_t*)av_mallocz(vf->priv->temp_stride*3*8*sizeof(int16_t));
- //this can also be avoided, see above
- vf->priv->src = (uint8_t*)av_malloc(vf->priv->temp_stride*h*sizeof(uint8_t));
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi)
-{
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags, mpi->width, mpi->height);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
- }else{
- dmpi=vf->dmpi;
- }
-
- vf->priv->mpeg2= mpi->qscale_type;
- if(mpi->pict_type != 3 && mpi->qscale && !vf->priv->qp){
- int w = mpi->qstride;
- int h = (mpi->h + 15) >> 4;
- if (!w) {
- w = (mpi->w + 15) >> 4;
- h = 1;
- }
- if(!vf->priv->non_b_qp)
- vf->priv->non_b_qp= malloc(w*h);
- fast_memcpy(vf->priv->non_b_qp, mpi->qscale, w*h);
- }
- if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){
- char *qp_tab= vf->priv->non_b_qp;
- if(vf->priv->bframes || !qp_tab)
- qp_tab= mpi->qscale;
-
- if(qp_tab || vf->priv->qp){
- filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0],
- mpi->w, mpi->h, qp_tab, mpi->qstride, 1);
- filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1],
- mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0);
- filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2],
- mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0);
- }else{
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]);
- memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]);
- }
- }
-
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
-#endif
-#if HAVE_MMX2
- if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
-#endif
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf)
-{
- if(!vf->priv) return;
-
- av_free(vf->priv->temp);
- vf->priv->temp= NULL;
- av_free(vf->priv->src);
- vf->priv->src= NULL;
- //free(vf->priv->avctx);
- //vf->priv->avctx= NULL;
- free(vf->priv->non_b_qp);
- vf->priv->non_b_qp= NULL;
-
- av_free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- switch(fmt){
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-static int control(struct vf_instance *vf, int request, void* data)
-{
- switch(request){
- case VFCTRL_QUERY_MAX_PP_LEVEL:
- return 5;
- case VFCTRL_SET_PP_LEVEL:
- vf->priv->log2_count= *((unsigned int*)data);
- if (vf->priv->log2_count < 4) vf->priv->log2_count=4;
- return CONTROL_TRUE;
- }
- return vf_next_control(vf,request,data);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- int i=0, bias;
- int custom_threshold_m[64];
- int log2c=-1;
-
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->control= control;
- vf->priv=av_mallocz(sizeof(struct vf_priv_s));//assumes align 16 !
-
- //vf->priv->avctx= avcodec_alloc_context();
- //ff_dsputil_init(&vf->priv->dsp, vf->priv->avctx);
-
- vf->priv->log2_count= 4;
- vf->priv->bframes = 0;
-
- if (args) sscanf(args, "%d:%d:%d:%d", &log2c, &vf->priv->qp, &i, &vf->priv->bframes);
-
- if( log2c >=4 && log2c <=5 )
- vf->priv->log2_count = log2c;
- else if( log2c >= 6 )
- vf->priv->log2_count = 5;
-
- if(vf->priv->qp < 0)
- vf->priv->qp = 0;
-
- if (i < -15) i = -15;
- if (i > 32) i = 32;
-
- bias= (1<<4)+i; //regulable
- vf->priv->prev_q=0;
- //
- for(i=0;i<64;i++) //FIXME: tune custom_threshold[] and remove this !
- custom_threshold_m[i]=(int)(custom_threshold[i]*(bias/71.)+ 0.5);
- for(i=0;i<8;i++){
- vf->priv->threshold_mtx_noq[2*i]=(uint64_t)custom_threshold_m[i*8+2]
- |(((uint64_t)custom_threshold_m[i*8+6])<<16)
- |(((uint64_t)custom_threshold_m[i*8+0])<<32)
- |(((uint64_t)custom_threshold_m[i*8+4])<<48);
- vf->priv->threshold_mtx_noq[2*i+1]=(uint64_t)custom_threshold_m[i*8+5]
- |(((uint64_t)custom_threshold_m[i*8+3])<<16)
- |(((uint64_t)custom_threshold_m[i*8+1])<<32)
- |(((uint64_t)custom_threshold_m[i*8+7])<<48);
- }
-
- if (vf->priv->qp) vf->priv->prev_q=vf->priv->qp, mul_thrmat_s(vf->priv, vf->priv->qp);
-
- return 1;
-}
-
-const vf_info_t vf_info_fspp = {
- "fast simple postprocess",
- "fspp",
- "Michael Niedermayer, Nikolaj Poroshin",
- "",
- vf_open,
- NULL
-};
-
-//====================================================================
-//Specific spp's dct, idct and threshold functions
-//I'd prefer to have them in the separate file.
-
-//#define MANGLE(a) #a
-
-//typedef int16_t DCTELEM; //! only int16_t
-
-#define DCTSIZE 8
-#define DCTSIZE_S "8"
-
-#define FIX(x,s) ((int) ((x) * (1<<s) + 0.5)&0xffff)
-#define C64(x) ((uint64_t)((x)|(x)<<16))<<32 | (uint64_t)(x) | (uint64_t)(x)<<16
-#define FIX64(x,s) C64(FIX(x,s))
-
-#define MULTIPLY16H(x,k) (((x)*(k))>>16)
-#define THRESHOLD(r,x,t) if(((unsigned)((x)+t))>t*2) r=(x);else r=0;
-#define DESCALE(x,n) (((x) + (1 << ((n)-1))) >> n)
-
-#if HAVE_MMX
-
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_382683433)=FIX64(0.382683433, 14);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_541196100)=FIX64(0.541196100, 14);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_707106781)=FIX64(0.707106781, 14);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_306562965)=FIX64(1.306562965, 14);
-
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562_A)=FIX64(1.414213562, 14);
-
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_847759065)=FIX64(1.847759065, 13);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_2_613125930)=FIX64(-2.613125930, 13); //-
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_414213562)=FIX64(1.414213562, 13);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_1_082392200)=FIX64(1.082392200, 13);
-//for t3,t5,t7 == 0 shortcut
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_847759065)=FIX64(0.847759065, 14);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_566454497)=FIX64(0.566454497, 14);
-DECLARE_ASM_CONST(8, uint64_t, MM_FIX_0_198912367)=FIX64(0.198912367, 14);
-
-DECLARE_ASM_CONST(8, uint64_t, MM_DESCALE_RND)=C64(4);
-DECLARE_ASM_CONST(8, uint64_t, MM_2)=C64(2);
-
-#else /* !HAVE_MMX */
-
-typedef int32_t int_simd16_t;
-static const int16_t FIX_0_382683433=FIX(0.382683433, 14);
-static const int16_t FIX_0_541196100=FIX(0.541196100, 14);
-static const int16_t FIX_0_707106781=FIX(0.707106781, 14);
-static const int16_t FIX_1_306562965=FIX(1.306562965, 14);
-static const int16_t FIX_1_414213562_A=FIX(1.414213562, 14);
-static const int16_t FIX_1_847759065=FIX(1.847759065, 13);
-static const int16_t FIX_2_613125930=FIX(-2.613125930, 13); //-
-static const int16_t FIX_1_414213562=FIX(1.414213562, 13);
-static const int16_t FIX_1_082392200=FIX(1.082392200, 13);
-
-#endif
-
-#if !HAVE_MMX
-
-static void column_fidct_c(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt)
-{
- int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int_simd16_t tmp10, tmp11, tmp12, tmp13;
- int_simd16_t z1,z2,z3,z4,z5, z10, z11, z12, z13;
- int_simd16_t d0, d1, d2, d3, d4, d5, d6, d7;
-
- DCTELEM* dataptr;
- DCTELEM* wsptr;
- int16_t *threshold;
- int ctr;
-
- dataptr = data;
- wsptr = output;
-
- for (; cnt > 0; cnt-=2) { //start positions
- threshold=(int16_t*)thr_adr;//threshold_mtx
- for (ctr = DCTSIZE; ctr > 0; ctr--) {
- // Process columns from input, add to output.
- tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
- tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
-
- tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
- tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
-
- tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
- tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
-
- tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
- tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
-
- // Even part of FDCT
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
-
- d0 = tmp10 + tmp11;
- d4 = tmp10 - tmp11;
-
- z1 = MULTIPLY16H((tmp12 + tmp13) <<2, FIX_0_707106781);
- d2 = tmp13 + z1;
- d6 = tmp13 - z1;
-
- // Even part of IDCT
-
- THRESHOLD(tmp0, d0, threshold[0*8]);
- THRESHOLD(tmp1, d2, threshold[2*8]);
- THRESHOLD(tmp2, d4, threshold[4*8]);
- THRESHOLD(tmp3, d6, threshold[6*8]);
- tmp0+=2;
- tmp10 = (tmp0 + tmp2)>>2;
- tmp11 = (tmp0 - tmp2)>>2;
-
- tmp13 = (tmp1 + tmp3)>>2; //+2 ! (psnr decides)
- tmp12 = MULTIPLY16H((tmp1 - tmp3), FIX_1_414213562_A) - tmp13; //<<2
-
- tmp0 = tmp10 + tmp13; //->temps
- tmp3 = tmp10 - tmp13; //->temps
- tmp1 = tmp11 + tmp12; //->temps
- tmp2 = tmp11 - tmp12; //->temps
-
- // Odd part of FDCT
-
- tmp10 = tmp4 + tmp5;
- tmp11 = tmp5 + tmp6;
- tmp12 = tmp6 + tmp7;
-
- z5 = MULTIPLY16H((tmp10 - tmp12)<<2, FIX_0_382683433);
- z2 = MULTIPLY16H(tmp10 <<2, FIX_0_541196100) + z5;
- z4 = MULTIPLY16H(tmp12 <<2, FIX_1_306562965) + z5;
- z3 = MULTIPLY16H(tmp11 <<2, FIX_0_707106781);
-
- z11 = tmp7 + z3;
- z13 = tmp7 - z3;
-
- d5 = z13 + z2;
- d3 = z13 - z2;
- d1 = z11 + z4;
- d7 = z11 - z4;
-
- // Odd part of IDCT
-
- THRESHOLD(tmp4, d1, threshold[1*8]);
- THRESHOLD(tmp5, d3, threshold[3*8]);
- THRESHOLD(tmp6, d5, threshold[5*8]);
- THRESHOLD(tmp7, d7, threshold[7*8]);
-
- //Simd version uses here a shortcut for the tmp5,tmp6,tmp7 == 0
- z13 = tmp6 + tmp5;
- z10 = (tmp6 - tmp5)<<1;
- z11 = tmp4 + tmp7;
- z12 = (tmp4 - tmp7)<<1;
-
- tmp7 = (z11 + z13)>>2; //+2 !
- tmp11 = MULTIPLY16H((z11 - z13)<<1, FIX_1_414213562);
- z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY16H(z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY16H(z10, FIX_2_613125930) + z5; // - !!
-
- tmp6 = tmp12 - tmp7;
- tmp5 = tmp11 - tmp6;
- tmp4 = tmp10 + tmp5;
-
- wsptr[DCTSIZE*0]+= (tmp0 + tmp7);
- wsptr[DCTSIZE*1]+= (tmp1 + tmp6);
- wsptr[DCTSIZE*2]+= (tmp2 + tmp5);
- wsptr[DCTSIZE*3]+= (tmp3 - tmp4);
- wsptr[DCTSIZE*4]+= (tmp3 + tmp4);
- wsptr[DCTSIZE*5]+= (tmp2 - tmp5);
- wsptr[DCTSIZE*6]= (tmp1 - tmp6);
- wsptr[DCTSIZE*7]= (tmp0 - tmp7);
- //
- dataptr++; //next column
- wsptr++;
- threshold++;
- }
- dataptr+=8; //skip each second start pos
- wsptr +=8;
- }
-}
-
-#else /* HAVE_MMX */
-
-static void column_fidct_mmx(int16_t* thr_adr, DCTELEM *data, DCTELEM *output, int cnt)
-{
- uint64_t __attribute__((aligned(8))) temps[4];
- __asm__ volatile(
- ASMALIGN(4)
- "1: \n\t"
- "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t"
- //
- "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t"
- "movq %%mm1, %%mm0 \n\t"
-
- "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0
- "movq %%mm7, %%mm3 \n\t"
-
- "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3
- "movq %%mm1, %%mm5 \n\t"
-
- "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm6 \n\t"
- "psubw %%mm7, %%mm1 \n\t" //t13
-
- "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t"
- "movq %%mm6, %%mm4 \n\t"
-
- "paddw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm6 \n\t" //t1
- "paddw %%mm7, %%mm5 \n\t" //t10
-
- "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2
- "movq %%mm6, %%mm7 \n\t"
-
- "paddw %%mm2, %%mm6 \n\t" //t11
- "psubw %%mm2, %%mm7 \n\t" //t12
-
- "movq %%mm5, %%mm2 \n\t"
- "paddw %%mm6, %%mm5 \n\t" //d0
- // i0 t13 t12 i3 i1 d0 - d4
- "psubw %%mm6, %%mm2 \n\t" //d4
- "paddw %%mm1, %%mm7 \n\t"
-
- "movq 4*16(%%"REG_d"), %%mm6 \n\t"
- "psllw $2, %%mm7 \n\t"
-
- "psubw 0*16(%%"REG_d"), %%mm5 \n\t"
- "psubw %%mm6, %%mm2 \n\t"
-
- "paddusw 0*16(%%"REG_d"), %%mm5 \n\t"
- "paddusw %%mm6, %%mm2 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t"
- //
- "paddw 0*16(%%"REG_d"), %%mm5 \n\t"
- "paddw %%mm6, %%mm2 \n\t"
-
- "psubusw 0*16(%%"REG_d"), %%mm5 \n\t"
- "psubusw %%mm6, %%mm2 \n\t"
-
-//This func is totally compute-bound, operates at huge speed. So, DC shortcut
-// at this place isn't worthwhile due to BTB miss penalty (checked on Pent. 3).
-//However, typical numbers: nondc - 29%%, dc - 46%%, zero - 25%%. All <> 0 case is very rare.
- "paddw "MANGLE(MM_2)", %%mm5 \n\t"
- "movq %%mm2, %%mm6 \n\t"
-
- "paddw %%mm5, %%mm2 \n\t"
- "psubw %%mm6, %%mm5 \n\t"
-
- "movq %%mm1, %%mm6 \n\t"
- "paddw %%mm7, %%mm1 \n\t" //d2
-
- "psubw 2*16(%%"REG_d"), %%mm1 \n\t"
- "psubw %%mm7, %%mm6 \n\t" //d6
-
- "movq 6*16(%%"REG_d"), %%mm7 \n\t"
- "psraw $2, %%mm5 \n\t"
-
- "paddusw 2*16(%%"REG_d"), %%mm1 \n\t"
- "psubw %%mm7, %%mm6 \n\t"
- // t7 d2 /t11 t4 t6 - d6 /t10
-
- "paddw 2*16(%%"REG_d"), %%mm1 \n\t"
- "paddusw %%mm7, %%mm6 \n\t"
-
- "psubusw 2*16(%%"REG_d"), %%mm1 \n\t"
- "paddw %%mm7, %%mm6 \n\t"
-
- "psubw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm3 \n\t"
- "psubusw %%mm7, %%mm6 \n\t"
-
- //movq [edi+"DCTSIZE_S"*2*2], mm1
- //movq [edi+"DCTSIZE_S"*6*2], mm6
- "movq %%mm1, %%mm7 \n\t"
- "psraw $2, %%mm2 \n\t"
-
- "psubw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm4 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
-
- "psubw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm0 \n\t"
- "paddw %%mm7, %%mm6 \n\t" //'t13
-
- "psraw $2, %%mm6 \n\t" //paddw mm6, MM_2 !! ---
- "movq %%mm2, %%mm7 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm1 \n\t"
- "paddw %%mm6, %%mm2 \n\t" //'t0
-
- "movq %%mm2, 0*8+%3 \n\t" //!
- "psubw %%mm6, %%mm7 \n\t" //'t3
-
- "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t"
- "psubw %%mm6, %%mm1 \n\t" //'t12
-
- "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5
- "movq %%mm5, %%mm6 \n\t"
-
- "movq %%mm7, 3*8+%3 \n\t"
- "paddw %%mm2, %%mm3 \n\t" //t10
-
- "paddw %%mm4, %%mm2 \n\t" //t11
- "paddw %%mm0, %%mm4 \n\t" //t12
-
- "movq %%mm3, %%mm7 \n\t"
- "psubw %%mm4, %%mm3 \n\t"
-
- "psllw $2, %%mm3 \n\t"
- "psllw $2, %%mm7 \n\t" //opt for P6
-
- "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t"
- "psllw $2, %%mm4 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm7 \n\t"
- "psllw $2, %%mm2 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm4 \n\t"
- "paddw %%mm1, %%mm5 \n\t" //'t1
-
- "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm2 \n\t"
- "psubw %%mm1, %%mm6 \n\t" //'t2
- // t7 't12 't11 t4 t6 - 't13 't10 ---
-
- "paddw %%mm3, %%mm7 \n\t" //z2
-
- "movq %%mm5, 1*8+%3 \n\t"
- "paddw %%mm3, %%mm4 \n\t" //z4
-
- "movq 3*16(%%"REG_d"), %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
-
- "movq %%mm6, 2*8+%3 \n\t"
- "psubw %%mm2, %%mm1 \n\t" //z13
-
-//===
- "paddw %%mm2, %%mm0 \n\t" //z11
- "movq %%mm1, %%mm5 \n\t"
-
- "movq 5*16(%%"REG_d"), %%mm2 \n\t"
- "psubw %%mm7, %%mm1 \n\t" //d3
-
- "paddw %%mm7, %%mm5 \n\t" //d5
- "psubw %%mm3, %%mm1 \n\t"
-
- "movq 1*16(%%"REG_d"), %%mm7 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
-
- "movq %%mm0, %%mm6 \n\t"
- "paddw %%mm4, %%mm0 \n\t" //d1
-
- "paddusw %%mm3, %%mm1 \n\t"
- "psubw %%mm4, %%mm6 \n\t" //d7
-
- // d1 d3 - - - d5 d7 -
- "movq 7*16(%%"REG_d"), %%mm4 \n\t"
- "psubw %%mm7, %%mm0 \n\t"
-
- "psubw %%mm4, %%mm6 \n\t"
- "paddusw %%mm2, %%mm5 \n\t"
-
- "paddusw %%mm4, %%mm6 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
-
- "paddw %%mm2, %%mm5 \n\t"
- "paddw %%mm4, %%mm6 \n\t"
-
- "psubusw %%mm3, %%mm1 \n\t"
- "psubusw %%mm2, %%mm5 \n\t"
-
- "psubusw %%mm4, %%mm6 \n\t"
- "movq %%mm1, %%mm4 \n\t"
-
- "por %%mm5, %%mm4 \n\t"
- "paddusw %%mm7, %%mm0 \n\t"
-
- "por %%mm6, %%mm4 \n\t"
- "paddw %%mm7, %%mm0 \n\t"
-
- "packssdw %%mm4, %%mm4 \n\t"
- "psubusw %%mm7, %%mm0 \n\t"
-
- "movd %%mm4, %%"REG_a" \n\t"
- "or %%"REG_a", %%"REG_a" \n\t"
- "jnz 2f \n\t"
- //movq [edi+"DCTSIZE_S"*3*2], mm1
- //movq [edi+"DCTSIZE_S"*5*2], mm5
- //movq [edi+"DCTSIZE_S"*1*2], mm0
- //movq [edi+"DCTSIZE_S"*7*2], mm6
- // t4 t5 - - - t6 t7 -
- //--- t4 (mm0) may be <>0; mm1, mm5, mm6 == 0
-//Typical numbers: nondc - 19%%, dc - 26%%, zero - 55%%. zero case alone isn't worthwhile
- "movq 0*8+%3, %%mm4 \n\t"
- "movq %%mm0, %%mm1 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_847759065)", %%mm0 \n\t" //tmp6
- "movq %%mm1, %%mm2 \n\t"
-
- "movq "DCTSIZE_S"*0*2(%%"REG_D"), %%mm5 \n\t"
- "movq %%mm2, %%mm3 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_566454497)", %%mm1 \n\t" //tmp5
- "paddw %%mm4, %%mm5 \n\t"
-
- "movq 1*8+%3, %%mm6 \n\t"
- //paddw mm3, MM_2
- "psraw $2, %%mm3 \n\t" //tmp7
-
- "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4
- "psubw %%mm3, %%mm4 \n\t"
-
- "movq "DCTSIZE_S"*1*2(%%"REG_D"), %%mm7 \n\t"
- "paddw %%mm3, %%mm5 \n\t"
-
- "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D") \n\t"
- "paddw %%mm6, %%mm7 \n\t"
-
- "movq 2*8+%3, %%mm3 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
-
- "movq "DCTSIZE_S"*2*2(%%"REG_D"), %%mm4 \n\t"
- "paddw %%mm0, %%mm7 \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D") \n\t"
- "paddw %%mm3, %%mm4 \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D") \n\t"
- "psubw %%mm1, %%mm3 \n\t"
-
- "movq "DCTSIZE_S"*5*2(%%"REG_D"), %%mm5 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
-
- "movq "DCTSIZE_S"*3*2(%%"REG_D"), %%mm6 \n\t"
- "paddw %%mm3, %%mm5 \n\t"
-
- "movq 3*8+%3, %%mm0 \n\t"
- "add $8, %%"REG_S" \n\t"
-
- "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D") \n\t"
- "paddw %%mm0, %%mm6 \n\t"
-
- "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D") \n\t"
- "psubw %%mm2, %%mm0 \n\t"
-
- "movq "DCTSIZE_S"*4*2(%%"REG_D"), %%mm7 \n\t"
- "paddw %%mm2, %%mm6 \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D") \n\t"
- "paddw %%mm0, %%mm7 \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D") \n\t"
-
- "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D") \n\t"
- "add $8, %%"REG_D" \n\t"
- "jmp 4f \n\t"
-
- "2: \n\t"
- //--- non DC2
- //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1)
- //psraw mm5, 2
- //psraw mm0, 2
- //psraw mm6, 2
- "movq %%mm5, %%mm3 \n\t"
- "psubw %%mm1, %%mm5 \n\t"
-
- "psllw $1, %%mm5 \n\t" //'z10
- "paddw %%mm1, %%mm3 \n\t" //'z13
-
- "movq %%mm0, %%mm2 \n\t"
- "psubw %%mm6, %%mm0 \n\t"
-
- "movq %%mm5, %%mm1 \n\t"
- "psllw $1, %%mm0 \n\t" //'z12
-
- "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm1 \n\t" //-
- "paddw %%mm0, %%mm5 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm5 \n\t" //'z5
- "paddw %%mm6, %%mm2 \n\t" //'z11
-
- "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm0 \n\t"
- "movq %%mm2, %%mm7 \n\t"
-
- //---
- "movq 0*8+%3, %%mm4 \n\t"
- "psubw %%mm3, %%mm2 \n\t"
-
- "psllw $1, %%mm2 \n\t"
- "paddw %%mm3, %%mm7 \n\t" //'t7
-
- "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //'t11
- "movq %%mm4, %%mm6 \n\t"
- //paddw mm7, MM_2
- "psraw $2, %%mm7 \n\t"
-
- "paddw "DCTSIZE_S"*0*2(%%"REG_D"), %%mm4 \n\t"
- "psubw %%mm7, %%mm6 \n\t"
-
- "movq 1*8+%3, %%mm3 \n\t"
- "paddw %%mm7, %%mm4 \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D") \n\t"
- "paddw %%mm5, %%mm1 \n\t" //'t12
-
- "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D") \n\t"
- "psubw %%mm7, %%mm1 \n\t" //'t6
-
- "movq 2*8+%3, %%mm7 \n\t"
- "psubw %%mm5, %%mm0 \n\t" //'t10
-
- "movq 3*8+%3, %%mm6 \n\t"
- "movq %%mm3, %%mm5 \n\t"
-
- "paddw "DCTSIZE_S"*1*2(%%"REG_D"), %%mm3 \n\t"
- "psubw %%mm1, %%mm5 \n\t"
-
- "psubw %%mm1, %%mm2 \n\t" //'t5
- "paddw %%mm1, %%mm3 \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D") \n\t"
- "movq %%mm7, %%mm4 \n\t"
-
- "paddw "DCTSIZE_S"*2*2(%%"REG_D"), %%mm7 \n\t"
- "psubw %%mm2, %%mm4 \n\t"
-
- "paddw "DCTSIZE_S"*5*2(%%"REG_D"), %%mm4 \n\t"
- "paddw %%mm2, %%mm7 \n\t"
-
- "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t"
- "paddw %%mm2, %%mm0 \n\t" //'t4
-
- // 't4 't6 't5 - - - - 't7
- "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t"
- "movq %%mm6, %%mm1 \n\t"
-
- "paddw "DCTSIZE_S"*4*2(%%"REG_D"), %%mm6 \n\t"
- "psubw %%mm0, %%mm1 \n\t"
-
- "paddw "DCTSIZE_S"*3*2(%%"REG_D"), %%mm1 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
-
- "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D") \n\t"
- "add $8, %%"REG_S" \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D") \n\t"
-
- "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D") \n\t"
- "add $8, %%"REG_D" \n\t"
-
- "4: \n\t"
-//=part 2 (the same)===========================================================
- "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm1 \n\t"
- //
- "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm7 \n\t"
- "movq %%mm1, %%mm0 \n\t"
-
- "paddw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm1 \n\t" //t0
- "movq %%mm7, %%mm3 \n\t"
-
- "paddw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm7 \n\t" //t3
- "movq %%mm1, %%mm5 \n\t"
-
- "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm6 \n\t"
- "psubw %%mm7, %%mm1 \n\t" //t13
-
- "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t"
- "movq %%mm6, %%mm4 \n\t"
-
- "paddw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm6 \n\t" //t1
- "paddw %%mm7, %%mm5 \n\t" //t10
-
- "paddw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t2
- "movq %%mm6, %%mm7 \n\t"
-
- "paddw %%mm2, %%mm6 \n\t" //t11
- "psubw %%mm2, %%mm7 \n\t" //t12
-
- "movq %%mm5, %%mm2 \n\t"
- "paddw %%mm6, %%mm5 \n\t" //d0
- // i0 t13 t12 i3 i1 d0 - d4
- "psubw %%mm6, %%mm2 \n\t" //d4
- "paddw %%mm1, %%mm7 \n\t"
-
- "movq 1*8+4*16(%%"REG_d"), %%mm6 \n\t"
- "psllw $2, %%mm7 \n\t"
-
- "psubw 1*8+0*16(%%"REG_d"), %%mm5 \n\t"
- "psubw %%mm6, %%mm2 \n\t"
-
- "paddusw 1*8+0*16(%%"REG_d"), %%mm5 \n\t"
- "paddusw %%mm6, %%mm2 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm7 \n\t"
- //
- "paddw 1*8+0*16(%%"REG_d"), %%mm5 \n\t"
- "paddw %%mm6, %%mm2 \n\t"
-
- "psubusw 1*8+0*16(%%"REG_d"), %%mm5 \n\t"
- "psubusw %%mm6, %%mm2 \n\t"
-
-//This func is totally compute-bound, operates at huge speed. So, DC shortcut
-// at this place isn't worthwhile due to BTB miss penalty (checked on Pent. 3).
-//However, typical numbers: nondc - 29%%, dc - 46%%, zero - 25%%. All <> 0 case is very rare.
- "paddw "MANGLE(MM_2)", %%mm5 \n\t"
- "movq %%mm2, %%mm6 \n\t"
-
- "paddw %%mm5, %%mm2 \n\t"
- "psubw %%mm6, %%mm5 \n\t"
-
- "movq %%mm1, %%mm6 \n\t"
- "paddw %%mm7, %%mm1 \n\t" //d2
-
- "psubw 1*8+2*16(%%"REG_d"), %%mm1 \n\t"
- "psubw %%mm7, %%mm6 \n\t" //d6
-
- "movq 1*8+6*16(%%"REG_d"), %%mm7 \n\t"
- "psraw $2, %%mm5 \n\t"
-
- "paddusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t"
- "psubw %%mm7, %%mm6 \n\t"
- // t7 d2 /t11 t4 t6 - d6 /t10
-
- "paddw 1*8+2*16(%%"REG_d"), %%mm1 \n\t"
- "paddusw %%mm7, %%mm6 \n\t"
-
- "psubusw 1*8+2*16(%%"REG_d"), %%mm1 \n\t"
- "paddw %%mm7, %%mm6 \n\t"
-
- "psubw "DCTSIZE_S"*4*2(%%"REG_S"), %%mm3 \n\t"
- "psubusw %%mm7, %%mm6 \n\t"
-
- //movq [edi+"DCTSIZE_S"*2*2], mm1
- //movq [edi+"DCTSIZE_S"*6*2], mm6
- "movq %%mm1, %%mm7 \n\t"
- "psraw $2, %%mm2 \n\t"
-
- "psubw "DCTSIZE_S"*6*2(%%"REG_S"), %%mm4 \n\t"
- "psubw %%mm6, %%mm1 \n\t"
-
- "psubw "DCTSIZE_S"*7*2(%%"REG_S"), %%mm0 \n\t"
- "paddw %%mm7, %%mm6 \n\t" //'t13
-
- "psraw $2, %%mm6 \n\t" //paddw mm6, MM_2 !! ---
- "movq %%mm2, %%mm7 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm1 \n\t"
- "paddw %%mm6, %%mm2 \n\t" //'t0
-
- "movq %%mm2, 0*8+%3 \n\t" //!
- "psubw %%mm6, %%mm7 \n\t" //'t3
-
- "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t"
- "psubw %%mm6, %%mm1 \n\t" //'t12
-
- "psubw "DCTSIZE_S"*5*2(%%"REG_S"), %%mm2 \n\t" //t5
- "movq %%mm5, %%mm6 \n\t"
-
- "movq %%mm7, 3*8+%3 \n\t"
- "paddw %%mm2, %%mm3 \n\t" //t10
-
- "paddw %%mm4, %%mm2 \n\t" //t11
- "paddw %%mm0, %%mm4 \n\t" //t12
-
- "movq %%mm3, %%mm7 \n\t"
- "psubw %%mm4, %%mm3 \n\t"
-
- "psllw $2, %%mm3 \n\t"
- "psllw $2, %%mm7 \n\t" //opt for P6
-
- "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t"
- "psllw $2, %%mm4 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm7 \n\t"
- "psllw $2, %%mm2 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm4 \n\t"
- "paddw %%mm1, %%mm5 \n\t" //'t1
-
- "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm2 \n\t"
- "psubw %%mm1, %%mm6 \n\t" //'t2
- // t7 't12 't11 t4 t6 - 't13 't10 ---
-
- "paddw %%mm3, %%mm7 \n\t" //z2
-
- "movq %%mm5, 1*8+%3 \n\t"
- "paddw %%mm3, %%mm4 \n\t" //z4
-
- "movq 1*8+3*16(%%"REG_d"), %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
-
- "movq %%mm6, 2*8+%3 \n\t"
- "psubw %%mm2, %%mm1 \n\t" //z13
-
-//===
- "paddw %%mm2, %%mm0 \n\t" //z11
- "movq %%mm1, %%mm5 \n\t"
-
- "movq 1*8+5*16(%%"REG_d"), %%mm2 \n\t"
- "psubw %%mm7, %%mm1 \n\t" //d3
-
- "paddw %%mm7, %%mm5 \n\t" //d5
- "psubw %%mm3, %%mm1 \n\t"
-
- "movq 1*8+1*16(%%"REG_d"), %%mm7 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
-
- "movq %%mm0, %%mm6 \n\t"
- "paddw %%mm4, %%mm0 \n\t" //d1
-
- "paddusw %%mm3, %%mm1 \n\t"
- "psubw %%mm4, %%mm6 \n\t" //d7
-
- // d1 d3 - - - d5 d7 -
- "movq 1*8+7*16(%%"REG_d"), %%mm4 \n\t"
- "psubw %%mm7, %%mm0 \n\t"
-
- "psubw %%mm4, %%mm6 \n\t"
- "paddusw %%mm2, %%mm5 \n\t"
-
- "paddusw %%mm4, %%mm6 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
-
- "paddw %%mm2, %%mm5 \n\t"
- "paddw %%mm4, %%mm6 \n\t"
-
- "psubusw %%mm3, %%mm1 \n\t"
- "psubusw %%mm2, %%mm5 \n\t"
-
- "psubusw %%mm4, %%mm6 \n\t"
- "movq %%mm1, %%mm4 \n\t"
-
- "por %%mm5, %%mm4 \n\t"
- "paddusw %%mm7, %%mm0 \n\t"
-
- "por %%mm6, %%mm4 \n\t"
- "paddw %%mm7, %%mm0 \n\t"
-
- "packssdw %%mm4, %%mm4 \n\t"
- "psubusw %%mm7, %%mm0 \n\t"
-
- "movd %%mm4, %%"REG_a" \n\t"
- "or %%"REG_a", %%"REG_a" \n\t"
- "jnz 3f \n\t"
- //movq [edi+"DCTSIZE_S"*3*2], mm1
- //movq [edi+"DCTSIZE_S"*5*2], mm5
- //movq [edi+"DCTSIZE_S"*1*2], mm0
- //movq [edi+"DCTSIZE_S"*7*2], mm6
- // t4 t5 - - - t6 t7 -
- //--- t4 (mm0) may be <>0; mm1, mm5, mm6 == 0
-//Typical numbers: nondc - 19%%, dc - 26%%, zero - 55%%. zero case alone isn't worthwhile
- "movq 0*8+%3, %%mm4 \n\t"
- "movq %%mm0, %%mm1 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_847759065)", %%mm0 \n\t" //tmp6
- "movq %%mm1, %%mm2 \n\t"
-
- "movq "DCTSIZE_S"*0*2(%%"REG_D"), %%mm5 \n\t"
- "movq %%mm2, %%mm3 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_566454497)", %%mm1 \n\t" //tmp5
- "paddw %%mm4, %%mm5 \n\t"
-
- "movq 1*8+%3, %%mm6 \n\t"
- //paddw mm3, MM_2
- "psraw $2, %%mm3 \n\t" //tmp7
-
- "pmulhw "MANGLE(MM_FIX_0_198912367)", %%mm2 \n\t" //-tmp4
- "psubw %%mm3, %%mm4 \n\t"
-
- "movq "DCTSIZE_S"*1*2(%%"REG_D"), %%mm7 \n\t"
- "paddw %%mm3, %%mm5 \n\t"
-
- "movq %%mm4, "DCTSIZE_S"*7*2(%%"REG_D") \n\t"
- "paddw %%mm6, %%mm7 \n\t"
-
- "movq 2*8+%3, %%mm3 \n\t"
- "psubw %%mm0, %%mm6 \n\t"
-
- "movq "DCTSIZE_S"*2*2(%%"REG_D"), %%mm4 \n\t"
- "paddw %%mm0, %%mm7 \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*0*2(%%"REG_D") \n\t"
- "paddw %%mm3, %%mm4 \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*6*2(%%"REG_D") \n\t"
- "psubw %%mm1, %%mm3 \n\t"
-
- "movq "DCTSIZE_S"*5*2(%%"REG_D"), %%mm5 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
-
- "movq "DCTSIZE_S"*3*2(%%"REG_D"), %%mm6 \n\t"
- "paddw %%mm3, %%mm5 \n\t"
-
- "movq 3*8+%3, %%mm0 \n\t"
- "add $24, %%"REG_S" \n\t"
-
- "movq %%mm7, "DCTSIZE_S"*1*2(%%"REG_D") \n\t"
- "paddw %%mm0, %%mm6 \n\t"
-
- "movq %%mm4, "DCTSIZE_S"*2*2(%%"REG_D") \n\t"
- "psubw %%mm2, %%mm0 \n\t"
-
- "movq "DCTSIZE_S"*4*2(%%"REG_D"), %%mm7 \n\t"
- "paddw %%mm2, %%mm6 \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*5*2(%%"REG_D") \n\t"
- "paddw %%mm0, %%mm7 \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*3*2(%%"REG_D") \n\t"
-
- "movq %%mm7, "DCTSIZE_S"*4*2(%%"REG_D") \n\t"
- "add $24, %%"REG_D" \n\t"
- "sub $2, %%"REG_c" \n\t"
- "jnz 1b \n\t"
- "jmp 5f \n\t"
-
- "3: \n\t"
- //--- non DC2
- //psraw mm1, 2 w/o it -> offset. thr1, thr1, thr1 (actually thr1, thr1, thr1-1)
- //psraw mm5, 2
- //psraw mm0, 2
- //psraw mm6, 2
- "movq %%mm5, %%mm3 \n\t"
- "psubw %%mm1, %%mm5 \n\t"
-
- "psllw $1, %%mm5 \n\t" //'z10
- "paddw %%mm1, %%mm3 \n\t" //'z13
-
- "movq %%mm0, %%mm2 \n\t"
- "psubw %%mm6, %%mm0 \n\t"
-
- "movq %%mm5, %%mm1 \n\t"
- "psllw $1, %%mm0 \n\t" //'z12
-
- "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm1 \n\t" //-
- "paddw %%mm0, %%mm5 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm5 \n\t" //'z5
- "paddw %%mm6, %%mm2 \n\t" //'z11
-
- "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm0 \n\t"
- "movq %%mm2, %%mm7 \n\t"
-
- //---
- "movq 0*8+%3, %%mm4 \n\t"
- "psubw %%mm3, %%mm2 \n\t"
-
- "psllw $1, %%mm2 \n\t"
- "paddw %%mm3, %%mm7 \n\t" //'t7
-
- "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //'t11
- "movq %%mm4, %%mm6 \n\t"
- //paddw mm7, MM_2
- "psraw $2, %%mm7 \n\t"
-
- "paddw "DCTSIZE_S"*0*2(%%"REG_D"), %%mm4 \n\t"
- "psubw %%mm7, %%mm6 \n\t"
-
- "movq 1*8+%3, %%mm3 \n\t"
- "paddw %%mm7, %%mm4 \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*7*2(%%"REG_D") \n\t"
- "paddw %%mm5, %%mm1 \n\t" //'t12
-
- "movq %%mm4, "DCTSIZE_S"*0*2(%%"REG_D") \n\t"
- "psubw %%mm7, %%mm1 \n\t" //'t6
-
- "movq 2*8+%3, %%mm7 \n\t"
- "psubw %%mm5, %%mm0 \n\t" //'t10
-
- "movq 3*8+%3, %%mm6 \n\t"
- "movq %%mm3, %%mm5 \n\t"
-
- "paddw "DCTSIZE_S"*1*2(%%"REG_D"), %%mm3 \n\t"
- "psubw %%mm1, %%mm5 \n\t"
-
- "psubw %%mm1, %%mm2 \n\t" //'t5
- "paddw %%mm1, %%mm3 \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*6*2(%%"REG_D") \n\t"
- "movq %%mm7, %%mm4 \n\t"
-
- "paddw "DCTSIZE_S"*2*2(%%"REG_D"), %%mm7 \n\t"
- "psubw %%mm2, %%mm4 \n\t"
-
- "paddw "DCTSIZE_S"*5*2(%%"REG_D"), %%mm4 \n\t"
- "paddw %%mm2, %%mm7 \n\t"
-
- "movq %%mm3, "DCTSIZE_S"*1*2(%%"REG_D") \n\t"
- "paddw %%mm2, %%mm0 \n\t" //'t4
-
- // 't4 't6 't5 - - - - 't7
- "movq %%mm7, "DCTSIZE_S"*2*2(%%"REG_D") \n\t"
- "movq %%mm6, %%mm1 \n\t"
-
- "paddw "DCTSIZE_S"*4*2(%%"REG_D"), %%mm6 \n\t"
- "psubw %%mm0, %%mm1 \n\t"
-
- "paddw "DCTSIZE_S"*3*2(%%"REG_D"), %%mm1 \n\t"
- "paddw %%mm0, %%mm6 \n\t"
-
- "movq %%mm4, "DCTSIZE_S"*5*2(%%"REG_D") \n\t"
- "add $24, %%"REG_S" \n\t"
-
- "movq %%mm6, "DCTSIZE_S"*4*2(%%"REG_D") \n\t"
-
- "movq %%mm1, "DCTSIZE_S"*3*2(%%"REG_D") \n\t"
- "add $24, %%"REG_D" \n\t"
- "sub $2, %%"REG_c" \n\t"
- "jnz 1b \n\t"
- "5: \n\t"
-
- : "+S"(data), "+D"(output), "+c"(cnt), "=o"(temps)
- : "d"(thr_adr)
- : "%"REG_a
- );
-}
-
-#endif // HAVE_MMX
-
-#if !HAVE_MMX
-
-static void row_idct_c(DCTELEM* workspace,
- int16_t* output_adr, int output_stride, int cnt)
-{
- int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int_simd16_t tmp10, tmp11, tmp12, tmp13;
- int_simd16_t z5, z10, z11, z12, z13;
- int16_t* outptr;
- DCTELEM* wsptr;
-
- cnt*=4;
- wsptr = workspace;
- outptr = output_adr;
- for (; cnt > 0; cnt--) {
- // Even part
- //Simd version reads 4x4 block and transposes it
- tmp10 = ( wsptr[2] + wsptr[3]);
- tmp11 = ( wsptr[2] - wsptr[3]);
-
- tmp13 = ( wsptr[0] + wsptr[1]);
- tmp12 = (MULTIPLY16H( wsptr[0] - wsptr[1], FIX_1_414213562_A)<<2) - tmp13;//this shift order to avoid overflow
-
- tmp0 = tmp10 + tmp13; //->temps
- tmp3 = tmp10 - tmp13; //->temps
- tmp1 = tmp11 + tmp12;
- tmp2 = tmp11 - tmp12;
-
- // Odd part
- //Also transpose, with previous:
- // ---- ---- ||||
- // ---- ---- idct ||||
- // ---- ---- ---> ||||
- // ---- ---- ||||
- z13 = wsptr[4] + wsptr[5];
- z10 = wsptr[4] - wsptr[5];
- z11 = wsptr[6] + wsptr[7];
- z12 = wsptr[6] - wsptr[7];
-
- tmp7 = z11 + z13;
- tmp11 = MULTIPLY16H(z11 - z13, FIX_1_414213562);
-
- z5 = MULTIPLY16H(z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY16H(z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY16H(z10, FIX_2_613125930) + z5; // - FIX_
-
- tmp6 = (tmp12<<3) - tmp7;
- tmp5 = (tmp11<<3) - tmp6;
- tmp4 = (tmp10<<3) + tmp5;
-
- // Final output stage: descale and write column
- outptr[0*output_stride]+= DESCALE(tmp0 + tmp7, 3);
- outptr[1*output_stride]+= DESCALE(tmp1 + tmp6, 3);
- outptr[2*output_stride]+= DESCALE(tmp2 + tmp5, 3);
- outptr[3*output_stride]+= DESCALE(tmp3 - tmp4, 3);
- outptr[4*output_stride]+= DESCALE(tmp3 + tmp4, 3);
- outptr[5*output_stride]+= DESCALE(tmp2 - tmp5, 3);
- outptr[6*output_stride]+= DESCALE(tmp1 - tmp6, 3); //no += ?
- outptr[7*output_stride]+= DESCALE(tmp0 - tmp7, 3); //no += ?
- outptr++;
-
- wsptr += DCTSIZE; // advance pointer to next row
- }
-}
-
-#else /* HAVE_MMX */
-
-static void row_idct_mmx (DCTELEM* workspace,
- int16_t* output_adr, int output_stride, int cnt)
-{
- uint64_t __attribute__((aligned(8))) temps[4];
- __asm__ volatile(
- "lea (%%"REG_a",%%"REG_a",2), %%"REG_d" \n\t"
- "1: \n\t"
- "movq "DCTSIZE_S"*0*2(%%"REG_S"), %%mm0 \n\t"
- //
-
- "movq "DCTSIZE_S"*1*2(%%"REG_S"), %%mm1 \n\t"
- "movq %%mm0, %%mm4 \n\t"
-
- "movq "DCTSIZE_S"*2*2(%%"REG_S"), %%mm2 \n\t"
- "punpcklwd %%mm1, %%mm0 \n\t"
-
- "movq "DCTSIZE_S"*3*2(%%"REG_S"), %%mm3 \n\t"
- "punpckhwd %%mm1, %%mm4 \n\t"
-
- //transpose 4x4
- "movq %%mm2, %%mm7 \n\t"
- "punpcklwd %%mm3, %%mm2 \n\t"
-
- "movq %%mm0, %%mm6 \n\t"
- "punpckldq %%mm2, %%mm0 \n\t" //0
-
- "punpckhdq %%mm2, %%mm6 \n\t" //1
- "movq %%mm0, %%mm5 \n\t"
-
- "punpckhwd %%mm3, %%mm7 \n\t"
- "psubw %%mm6, %%mm0 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_414213562_A)", %%mm0 \n\t"
- "movq %%mm4, %%mm2 \n\t"
-
- "punpckldq %%mm7, %%mm4 \n\t" //2
- "paddw %%mm6, %%mm5 \n\t"
-
- "punpckhdq %%mm7, %%mm2 \n\t" //3
- "movq %%mm4, %%mm1 \n\t"
-
- "psllw $2, %%mm0 \n\t"
- "paddw %%mm2, %%mm4 \n\t" //t10
-
- "movq "DCTSIZE_S"*0*2+"DCTSIZE_S"(%%"REG_S"), %%mm3 \n\t"
- "psubw %%mm2, %%mm1 \n\t" //t11
-
- "movq "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_S"), %%mm2 \n\t"
- "psubw %%mm5, %%mm0 \n\t"
-
- "movq %%mm4, %%mm6 \n\t"
- "paddw %%mm5, %%mm4 \n\t" //t0
-
- "psubw %%mm5, %%mm6 \n\t" //t3
- "movq %%mm1, %%mm7 \n\t"
-
- "movq "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_S"), %%mm5 \n\t"
- "paddw %%mm0, %%mm1 \n\t" //t1
-
- "movq %%mm4, 0*8+%3 \n\t" //t0
- "movq %%mm3, %%mm4 \n\t"
-
- "movq %%mm6, 1*8+%3 \n\t" //t3
- "punpcklwd %%mm2, %%mm3 \n\t"
-
- //transpose 4x4
- "movq "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_S"), %%mm6 \n\t"
- "punpckhwd %%mm2, %%mm4 \n\t"
-
- "movq %%mm5, %%mm2 \n\t"
- "punpcklwd %%mm6, %%mm5 \n\t"
-
- "psubw %%mm0, %%mm7 \n\t" //t2
- "punpckhwd %%mm6, %%mm2 \n\t"
-
- "movq %%mm3, %%mm0 \n\t"
- "punpckldq %%mm5, %%mm3 \n\t" //4
-
- "punpckhdq %%mm5, %%mm0 \n\t" //5
- "movq %%mm4, %%mm5 \n\t"
-
- //
- "movq %%mm3, %%mm6 \n\t"
- "punpckldq %%mm2, %%mm4 \n\t" //6
-
- "psubw %%mm0, %%mm3 \n\t" //z10
- "punpckhdq %%mm2, %%mm5 \n\t" //7
-
- "paddw %%mm0, %%mm6 \n\t" //z13
- "movq %%mm4, %%mm2 \n\t"
-
- "movq %%mm3, %%mm0 \n\t"
- "psubw %%mm5, %%mm4 \n\t" //z12
-
- "pmulhw "MANGLE(MM_FIX_2_613125930)", %%mm0 \n\t" //-
- "paddw %%mm4, %%mm3 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_847759065)", %%mm3 \n\t" //z5
- "paddw %%mm5, %%mm2 \n\t" //z11 >
-
- "pmulhw "MANGLE(MM_FIX_1_082392200)", %%mm4 \n\t"
- "movq %%mm2, %%mm5 \n\t"
-
- "psubw %%mm6, %%mm2 \n\t"
- "paddw %%mm6, %%mm5 \n\t" //t7
-
- "pmulhw "MANGLE(MM_FIX_1_414213562)", %%mm2 \n\t" //t11
- "paddw %%mm3, %%mm0 \n\t" //t12
-
- "psllw $3, %%mm0 \n\t"
- "psubw %%mm3, %%mm4 \n\t" //t10
-
- "movq 0*8+%3, %%mm6 \n\t"
- "movq %%mm1, %%mm3 \n\t"
-
- "psllw $3, %%mm4 \n\t"
- "psubw %%mm5, %%mm0 \n\t" //t6
-
- "psllw $3, %%mm2 \n\t"
- "paddw %%mm0, %%mm1 \n\t" //d1
-
- "psubw %%mm0, %%mm2 \n\t" //t5
- "psubw %%mm0, %%mm3 \n\t" //d6
-
- "paddw %%mm2, %%mm4 \n\t" //t4
- "movq %%mm7, %%mm0 \n\t"
-
- "paddw %%mm2, %%mm7 \n\t" //d2
- "psubw %%mm2, %%mm0 \n\t" //d5
-
- "movq "MANGLE(MM_DESCALE_RND)", %%mm2 \n\t" //4
- "psubw %%mm5, %%mm6 \n\t" //d7
-
- "paddw 0*8+%3, %%mm5 \n\t" //d0
- "paddw %%mm2, %%mm1 \n\t"
-
- "paddw %%mm2, %%mm5 \n\t"
- "psraw $3, %%mm1 \n\t"
-
- "paddw %%mm2, %%mm7 \n\t"
- "psraw $3, %%mm5 \n\t"
-
- "paddw (%%"REG_D"), %%mm5 \n\t"
- "psraw $3, %%mm7 \n\t"
-
- "paddw (%%"REG_D",%%"REG_a",), %%mm1 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
-
- "paddw (%%"REG_D",%%"REG_a",2), %%mm7 \n\t"
- "paddw %%mm2, %%mm3 \n\t"
-
- "movq %%mm5, (%%"REG_D") \n\t"
- "paddw %%mm2, %%mm6 \n\t"
-
- "movq %%mm1, (%%"REG_D",%%"REG_a",) \n\t"
- "psraw $3, %%mm0 \n\t"
-
- "movq %%mm7, (%%"REG_D",%%"REG_a",2) \n\t"
- "add %%"REG_d", %%"REG_D" \n\t" //3*ls
-
- "movq 1*8+%3, %%mm5 \n\t" //t3
- "psraw $3, %%mm3 \n\t"
-
- "paddw (%%"REG_D",%%"REG_a",2), %%mm0 \n\t"
- "psubw %%mm4, %%mm5 \n\t" //d3
-
- "paddw (%%"REG_D",%%"REG_d",), %%mm3 \n\t"
- "psraw $3, %%mm6 \n\t"
-
- "paddw 1*8+%3, %%mm4 \n\t" //d4
- "paddw %%mm2, %%mm5 \n\t"
-
- "paddw (%%"REG_D",%%"REG_a",4), %%mm6 \n\t"
- "paddw %%mm2, %%mm4 \n\t"
-
- "movq %%mm0, (%%"REG_D",%%"REG_a",2) \n\t"
- "psraw $3, %%mm5 \n\t"
-
- "paddw (%%"REG_D"), %%mm5 \n\t"
- "psraw $3, %%mm4 \n\t"
-
- "paddw (%%"REG_D",%%"REG_a",), %%mm4 \n\t"
- "add $"DCTSIZE_S"*2*4, %%"REG_S" \n\t" //4 rows
-
- "movq %%mm3, (%%"REG_D",%%"REG_d",) \n\t"
- "movq %%mm6, (%%"REG_D",%%"REG_a",4) \n\t"
- "movq %%mm5, (%%"REG_D") \n\t"
- "movq %%mm4, (%%"REG_D",%%"REG_a",) \n\t"
-
- "sub %%"REG_d", %%"REG_D" \n\t"
- "add $8, %%"REG_D" \n\t"
- "dec %%"REG_c" \n\t"
- "jnz 1b \n\t"
-
- : "+S"(workspace), "+D"(output_adr), "+c"(cnt), "=o"(temps)
- : "a"(output_stride*sizeof(short))
- : "%"REG_d
- );
-}
-
-#endif // HAVE_MMX
-
-#if !HAVE_MMX
-
-static void row_fdct_c(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt)
-{
- int_simd16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int_simd16_t tmp10, tmp11, tmp12, tmp13;
- int_simd16_t z1, z2, z3, z4, z5, z11, z13;
- DCTELEM *dataptr;
-
- cnt*=4;
- // Pass 1: process rows.
-
- dataptr = data;
- for (; cnt > 0; cnt--) {
- tmp0 = pixels[line_size*0] + pixels[line_size*7];
- tmp7 = pixels[line_size*0] - pixels[line_size*7];
- tmp1 = pixels[line_size*1] + pixels[line_size*6];
- tmp6 = pixels[line_size*1] - pixels[line_size*6];
- tmp2 = pixels[line_size*2] + pixels[line_size*5];
- tmp5 = pixels[line_size*2] - pixels[line_size*5];
- tmp3 = pixels[line_size*3] + pixels[line_size*4];
- tmp4 = pixels[line_size*3] - pixels[line_size*4];
-
- // Even part
-
- tmp10 = tmp0 + tmp3;
- tmp13 = tmp0 - tmp3;
- tmp11 = tmp1 + tmp2;
- tmp12 = tmp1 - tmp2;
- //Even columns are written first, this leads to different order of columns
- //in column_fidct(), but they are processed independently, so all ok.
- //Later in the row_idct() columns readed at the same order.
- dataptr[2] = tmp10 + tmp11;
- dataptr[3] = tmp10 - tmp11;
-
- z1 = MULTIPLY16H((tmp12 + tmp13)<<2, FIX_0_707106781);
- dataptr[0] = tmp13 + z1;
- dataptr[1] = tmp13 - z1;
-
- // Odd part
-
- tmp10 = (tmp4 + tmp5) <<2;
- tmp11 = (tmp5 + tmp6) <<2;
- tmp12 = (tmp6 + tmp7) <<2;
-
- z5 = MULTIPLY16H(tmp10 - tmp12, FIX_0_382683433);
- z2 = MULTIPLY16H(tmp10, FIX_0_541196100) + z5;
- z4 = MULTIPLY16H(tmp12, FIX_1_306562965) + z5;
- z3 = MULTIPLY16H(tmp11, FIX_0_707106781);
-
- z11 = tmp7 + z3;
- z13 = tmp7 - z3;
-
- dataptr[4] = z13 + z2;
- dataptr[5] = z13 - z2;
- dataptr[6] = z11 + z4;
- dataptr[7] = z11 - z4;
-
- pixels++; // advance pointer to next column
- dataptr += DCTSIZE;
- }
-}
-
-#else /* HAVE_MMX */
-
-static void row_fdct_mmx(DCTELEM *data, const uint8_t *pixels, int line_size, int cnt)
-{
- uint64_t __attribute__((aligned(8))) temps[4];
- __asm__ volatile(
- "lea (%%"REG_a",%%"REG_a",2), %%"REG_d" \n\t"
- "6: \n\t"
- "movd (%%"REG_S"), %%mm0 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
-
- "movd (%%"REG_S",%%"REG_a",), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
-
- "movd (%%"REG_S",%%"REG_a",2), %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
-
- "punpcklbw %%mm7, %%mm2 \n\t"
- "add %%"REG_d", %%"REG_S" \n\t"
-
- "movq %%mm0, %%mm5 \n\t"
- //
-
- "movd (%%"REG_S",%%"REG_a",4), %%mm3 \n\t" //7 ;prefetch!
- "movq %%mm1, %%mm6 \n\t"
-
- "movd (%%"REG_S",%%"REG_d",), %%mm4 \n\t" //6
- "punpcklbw %%mm7, %%mm3 \n\t"
-
- "psubw %%mm3, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
-
- "paddw %%mm3, %%mm0 \n\t"
- "psubw %%mm4, %%mm6 \n\t"
-
- "movd (%%"REG_S",%%"REG_a",2), %%mm3 \n\t" //5
- "paddw %%mm4, %%mm1 \n\t"
-
- "movq %%mm5, 0*8+%3 \n\t" //t7
- "punpcklbw %%mm7, %%mm3 \n\t"
-
- "movq %%mm6, 1*8+%3 \n\t" //t6
- "movq %%mm2, %%mm4 \n\t"
-
- "movd (%%"REG_S"), %%mm5 \n\t" //3
- "paddw %%mm3, %%mm2 \n\t"
-
- "movd (%%"REG_S",%%"REG_a",), %%mm6 \n\t" //4
- "punpcklbw %%mm7, %%mm5 \n\t"
-
- "psubw %%mm3, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm6 \n\t"
-
- "movq %%mm5, %%mm3 \n\t"
- "paddw %%mm6, %%mm5 \n\t" //t3
-
- "psubw %%mm6, %%mm3 \n\t" //t4 ; t0 t1 t2 t4 t5 t3 - -
- "movq %%mm0, %%mm6 \n\t"
-
- "movq %%mm1, %%mm7 \n\t"
- "psubw %%mm5, %%mm0 \n\t" //t13
-
- "psubw %%mm2, %%mm1 \n\t"
- "paddw %%mm2, %%mm7 \n\t" //t11
-
- "paddw %%mm0, %%mm1 \n\t"
- "movq %%mm7, %%mm2 \n\t"
-
- "psllw $2, %%mm1 \n\t"
- "paddw %%mm5, %%mm6 \n\t" //t10
-
- "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm1 \n\t"
- "paddw %%mm6, %%mm7 \n\t" //d2
-
- "psubw %%mm2, %%mm6 \n\t" //d3
- "movq %%mm0, %%mm5 \n\t"
-
- //transpose 4x4
- "movq %%mm7, %%mm2 \n\t"
- "punpcklwd %%mm6, %%mm7 \n\t"
-
- "paddw %%mm1, %%mm0 \n\t" //d0
- "punpckhwd %%mm6, %%mm2 \n\t"
-
- "psubw %%mm1, %%mm5 \n\t" //d1
- "movq %%mm0, %%mm6 \n\t"
-
- "movq 1*8+%3, %%mm1 \n\t"
- "punpcklwd %%mm5, %%mm0 \n\t"
-
- "punpckhwd %%mm5, %%mm6 \n\t"
- "movq %%mm0, %%mm5 \n\t"
-
- "punpckldq %%mm7, %%mm0 \n\t" //0
- "paddw %%mm4, %%mm3 \n\t"
-
- "punpckhdq %%mm7, %%mm5 \n\t" //1
- "movq %%mm6, %%mm7 \n\t"
-
- "movq %%mm0, "DCTSIZE_S"*0*2(%%"REG_D") \n\t"
- "punpckldq %%mm2, %%mm6 \n\t" //2
-
- "movq %%mm5, "DCTSIZE_S"*1*2(%%"REG_D") \n\t"
- "punpckhdq %%mm2, %%mm7 \n\t" //3
-
- "movq %%mm6, "DCTSIZE_S"*2*2(%%"REG_D") \n\t"
- "paddw %%mm1, %%mm4 \n\t"
-
- "movq %%mm7, "DCTSIZE_S"*3*2(%%"REG_D") \n\t"
- "psllw $2, %%mm3 \n\t" //t10
-
- "movq 0*8+%3, %%mm2 \n\t"
- "psllw $2, %%mm4 \n\t" //t11
-
- "pmulhw "MANGLE(MM_FIX_0_707106781)", %%mm4 \n\t" //z3
- "paddw %%mm2, %%mm1 \n\t"
-
- "psllw $2, %%mm1 \n\t" //t12
- "movq %%mm3, %%mm0 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_541196100)", %%mm0 \n\t"
- "psubw %%mm1, %%mm3 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_0_382683433)", %%mm3 \n\t" //z5
- "movq %%mm2, %%mm5 \n\t"
-
- "pmulhw "MANGLE(MM_FIX_1_306562965)", %%mm1 \n\t"
- "psubw %%mm4, %%mm2 \n\t" //z13
-
- "paddw %%mm4, %%mm5 \n\t" //z11
- "movq %%mm2, %%mm6 \n\t"
-
- "paddw %%mm3, %%mm0 \n\t" //z2
- "movq %%mm5, %%mm7 \n\t"
-
- "paddw %%mm0, %%mm2 \n\t" //d4
- "psubw %%mm0, %%mm6 \n\t" //d5
-
- "movq %%mm2, %%mm4 \n\t"
- "paddw %%mm3, %%mm1 \n\t" //z4
-
- //transpose 4x4
- "punpcklwd %%mm6, %%mm2 \n\t"
- "paddw %%mm1, %%mm5 \n\t" //d6
-
- "punpckhwd %%mm6, %%mm4 \n\t"
- "psubw %%mm1, %%mm7 \n\t" //d7
-
- "movq %%mm5, %%mm6 \n\t"
- "punpcklwd %%mm7, %%mm5 \n\t"
-
- "punpckhwd %%mm7, %%mm6 \n\t"
- "movq %%mm2, %%mm7 \n\t"
-
- "punpckldq %%mm5, %%mm2 \n\t" //4
- "sub %%"REG_d", %%"REG_S" \n\t"
-
- "punpckhdq %%mm5, %%mm7 \n\t" //5
- "movq %%mm4, %%mm5 \n\t"
-
- "movq %%mm2, "DCTSIZE_S"*0*2+"DCTSIZE_S"(%%"REG_D") \n\t"
- "punpckldq %%mm6, %%mm4 \n\t" //6
-
- "movq %%mm7, "DCTSIZE_S"*1*2+"DCTSIZE_S"(%%"REG_D") \n\t"
- "punpckhdq %%mm6, %%mm5 \n\t" //7
-
- "movq %%mm4, "DCTSIZE_S"*2*2+"DCTSIZE_S"(%%"REG_D") \n\t"
- "add $4, %%"REG_S" \n\t"
-
- "movq %%mm5, "DCTSIZE_S"*3*2+"DCTSIZE_S"(%%"REG_D") \n\t"
- "add $"DCTSIZE_S"*2*4, %%"REG_D" \n\t" //4 rows
- "dec %%"REG_c" \n\t"
- "jnz 6b \n\t"
-
- : "+S"(pixels), "+D"(data), "+c"(cnt), "=o"(temps)
- : "a"(line_size)
- : "%"REG_d);
-}
-
-#endif // HAVE_MMX
diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c
deleted file mode 100644
index 5c2e6c32c7..0000000000
--- a/libmpcodecs/vf_geq.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-
-#include <libavutil/eval.h>
-#include <libavutil/common.h>
-
-#include "config.h"
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- AVExpr * e[3];
- int framenum;
- mp_image_t *mpi;
-};
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static inline double getpix(struct vf_instance *vf, double x, double y, int plane){
- int xi, yi;
- mp_image_t *mpi= vf->priv->mpi;
- int stride= mpi->stride[plane];
- uint8_t *src= mpi->planes[plane];
- xi=x= FFMIN(FFMAX(x, 0), (mpi->w >> (plane ? mpi->chroma_x_shift : 0))-1);
- yi=y= FFMIN(FFMAX(y, 0), (mpi->h >> (plane ? mpi->chroma_y_shift : 0))-1);
-
- x-=xi;
- y-=yi;
-
- return
- (1-y)*((1-x)*src[xi + yi * stride] + x*src[xi + 1 + yi * stride])
- + y *((1-x)*src[xi + (yi+1) * stride] + x*src[xi + 1 + (yi+1) * stride]);
-}
-
-//FIXME cubic interpolate
-//FIXME keep the last few frames
-static double lum(void *vf, double x, double y){
- return getpix(vf, x, y, 0);
-}
-
-static double cb(void *vf, double x, double y){
- return getpix(vf, x, y, 1);
-}
-
-static double cr(void *vf, double x, double y){
- return getpix(vf, x, y, 2);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int x,y, plane;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt, MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->w,mpi->h);
- }
-
- dmpi= vf->dmpi;
- vf->priv->mpi= mpi;
-
- vf_clone_mpi_attributes(dmpi, mpi);
-
- for(plane=0; plane<3; plane++){
- int w= mpi->w >> (plane ? mpi->chroma_x_shift : 0);
- int h= mpi->h >> (plane ? mpi->chroma_y_shift : 0);
- uint8_t *dst = dmpi->planes[plane];
- int dst_stride= dmpi->stride[plane];
- double const_values[]={
- M_PI,
- M_E,
- 0,
- 0,
- w,
- h,
- vf->priv->framenum,
- w/(double)mpi->w,
- h/(double)mpi->h,
- 0
- };
- if (!vf->priv->e[plane]) continue;
- for(y=0; y<h; y++){
- const_values[3]=y;
- for(x=0; x<w; x++){
- const_values[2]=x;
- dst[x + y * dst_stride] = av_expr_eval(vf->priv->e[plane],
- const_values, vf);
- }
- }
- }
-
- vf->priv->framenum++;
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- av_free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int vf_open(vf_instance_t *vf, char *args){
- char eq[3][2000] = { { 0 }, { 0 }, { 0 } };
- int plane, res;
-
- vf->config=config;
- vf->put_image=put_image;
-// vf->get_image=get_image;
- vf->uninit=uninit;
- vf->priv=av_malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if (args) sscanf(args, "%1999[^:]:%1999[^:]:%1999[^:]", eq[0], eq[1], eq[2]);
-
- if (!eq[1][0]) strncpy(eq[1], eq[0], sizeof(eq[0])-1);
- if (!eq[2][0]) strncpy(eq[2], eq[1], sizeof(eq[0])-1);
-
- for(plane=0; plane<3; plane++){
- const char * const const_names[]={
- "PI",
- "E",
- "X",
- "Y",
- "W",
- "H",
- "N",
- "SW",
- "SH",
- NULL
- };
- const char * const func2_names[]={
- "lum",
- "cb",
- "cr",
- "p",
- NULL
- };
- double (*func2[])(void *, double, double)={
- lum,
- cb,
- cr,
- plane==0 ? lum : (plane==1 ? cb : cr),
- NULL
- };
- res = av_expr_parse(&vf->priv->e[plane], eq[plane], const_names, NULL, NULL, func2_names, func2, 0, NULL);
-
- if (res < 0) {
- mp_msg(MSGT_VFILTER, MSGL_ERR, "geq: error loading equation `%s'\n", eq[plane]);
- return 0;
- }
- }
-
- return 1;
-}
-
-const vf_info_t vf_info_geq = {
- "generic equation filter",
- "geq",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_halfpack.c b/libmpcodecs/vf_halfpack.c
deleted file mode 100644
index b67f8237b2..0000000000
--- a/libmpcodecs/vf_halfpack.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "vf_scale.h"
-
-#include "libswscale/swscale.h"
-#include "fmt-conversion.h"
-
-struct vf_priv_s {
- int field;
- struct SwsContext *ctx;
-};
-
-#if HAVE_MMX
-static void halfpack_MMX(unsigned char *dst, unsigned char *src[3],
- int dststride, int srcstride[3],
- int w, int h)
-{
- int j;
- unsigned char *y1, *y2, *u, *v;
- int dstinc, yinc, uinc, vinc;
-
- y1 = src[0];
- y2 = src[0] + srcstride[0];
- u = src[1];
- v = src[2];
-
- dstinc = dststride - 2*w;
- yinc = 2*srcstride[0] - w;
- uinc = srcstride[1] - w/2;
- vinc = srcstride[2] - w/2;
-
- for (h/=2; h; h--) {
- __asm__ (
- "pxor %%mm0, %%mm0 \n\t"
- ASMALIGN(4)
- "1: \n\t"
- "movq (%0), %%mm1 \n\t"
- "movq (%0), %%mm2 \n\t"
- "movq (%1), %%mm3 \n\t"
- "movq (%1), %%mm4 \n\t"
- "punpcklbw %%mm0, %%mm1 \n\t"
- "punpckhbw %%mm0, %%mm2 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t"
- "punpckhbw %%mm0, %%mm4 \n\t"
- "paddw %%mm3, %%mm1 \n\t"
- "paddw %%mm4, %%mm2 \n\t"
- "psrlw $1, %%mm1 \n\t"
- "psrlw $1, %%mm2 \n\t"
-
- "movq (%2), %%mm3 \n\t"
- "movq (%3), %%mm5 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm0, %%mm5 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm5, %%mm6 \n\t"
- "punpcklwd %%mm0, %%mm3 \n\t"
- "punpckhwd %%mm0, %%mm4 \n\t"
- "punpcklwd %%mm0, %%mm5 \n\t"
- "punpckhwd %%mm0, %%mm6 \n\t"
- "pslld $8, %%mm3 \n\t"
- "pslld $8, %%mm4 \n\t"
- "pslld $24, %%mm5 \n\t"
- "pslld $24, %%mm6 \n\t"
-
- "por %%mm3, %%mm1 \n\t"
- "por %%mm4, %%mm2 \n\t"
- "por %%mm5, %%mm1 \n\t"
- "por %%mm6, %%mm2 \n\t"
-
- "add $8, %0 \n\t"
- "add $8, %1 \n\t"
- "add $4, %2 \n\t"
- "add $4, %3 \n\t"
- "movq %%mm1, (%8) \n\t"
- "movq %%mm2, 8(%8) \n\t"
- "add $16, %8 \n\t"
- "decl %9 \n\t"
- "jnz 1b \n\t"
- : "=r" (y1), "=r" (y2), "=r" (u), "=r" (v)
- : "0" (y1), "1" (y2), "2" (u), "3" (v), "r" (dst), "r" (w/8)
- : "memory"
- );
- for (j = (w&7)/2; j; j--) {
- *dst++ = (*y1++ + *y2++)/2;
- *dst++ = *u++;
- *dst++ = (*y1++ + *y2++)/2;
- *dst++ = *v++;
- }
- y1 += yinc;
- y2 += yinc;
- u += uinc;
- v += vinc;
- dst += dstinc;
- }
- __asm__ volatile ( "emms \n\t" ::: "memory" );
-}
-#endif
-
-
-
-static void halfpack_C(unsigned char *dst, unsigned char *src[3],
- int dststride, int srcstride[3],
- int w, int h)
-{
- int i, j;
- unsigned char *y1, *y2, *u, *v;
- int dstinc, yinc, uinc, vinc;
-
- y1 = src[0];
- y2 = src[0] + srcstride[0];
- u = src[1];
- v = src[2];
-
- dstinc = dststride - 2*w;
- yinc = 2*srcstride[0] - w;
- uinc = srcstride[1] - w/2;
- vinc = srcstride[2] - w/2;
-
- for (i = h/2; i; i--) {
- for (j = w/2; j; j--) {
- *dst++ = (*y1++ + *y2++)>>1;
- *dst++ = *u++;
- *dst++ = (*y1++ + *y2++)>>1;
- *dst++ = *v++;
- }
- y1 += yinc;
- y2 += yinc;
- u += uinc;
- v += vinc;
- dst += dstinc;
- }
-}
-
-static void (*halfpack)(unsigned char *dst, unsigned char *src[3],
- int dststride, int srcstride[3], int w, int h);
-
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- const uint8_t *src[MP_MAX_PLANES] = {
- mpi->planes[0] + mpi->stride[0]*vf->priv->field,
- mpi->planes[1], mpi->planes[2], NULL};
- int src_stride[MP_MAX_PLANES] = {mpi->stride[0]*2, mpi->stride[1], mpi->stride[2], 0};
- mp_image_t *dmpi;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next, IMGFMT_YUY2,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w, mpi->h/2);
-
- switch(vf->priv->field) {
- case 0:
- case 1:
- sws_scale(vf->priv->ctx, src, src_stride,
- 0, mpi->h/2, dmpi->planes, dmpi->stride);
- break;
- default:
- halfpack(dmpi->planes[0], mpi->planes, dmpi->stride[0],
- mpi->stride, mpi->w, mpi->h);
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- if (vf->priv->field < 2) {
- sws_freeContext(vf->priv->ctx);
- // get unscaled 422p -> yuy2 conversion
- vf->priv->ctx =
- sws_getContext(width, height / 2, PIX_FMT_YUV422P,
- width, height / 2, PIX_FMT_YUYV422,
- SWS_POINT | SWS_PRINT_INFO,
- NULL, NULL, NULL);
- }
- /* FIXME - also support UYVY output? */
- return vf_next_config(vf, width, height/2, d_width, d_height, flags, IMGFMT_YUY2);
-}
-
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - really any YUV 4:2:0 input format should work */
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf,IMGFMT_YUY2);
- }
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- sws_freeContext(vf->priv->ctx);
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- vf->config=config;
- vf->query_format=query_format;
- vf->put_image=put_image;
- vf->uninit=uninit;
-
- vf->priv = calloc(1, sizeof (struct vf_priv_s));
- vf->priv->field = 2;
- if (args) sscanf(args, "%d", &vf->priv->field);
-
- halfpack = halfpack_C;
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) halfpack = halfpack_MMX;
-#endif
- return 1;
-}
-
-const vf_info_t vf_info_halfpack = {
- "yuv planar 4:2:0 -> packed 4:2:2, half height",
- "halfpack",
- "Richard Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_harddup.c b/libmpcodecs/vf_harddup.c
deleted file mode 100644
index b2b1bd6483..0000000000
--- a/libmpcodecs/vf_harddup.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- mp_image_t *last_mpi;
-};
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
-
- vf->priv->last_mpi = mpi;
-
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
-
- dmpi->planes[0] = mpi->planes[0];
- dmpi->stride[0] = mpi->stride[0];
- if (dmpi->flags&MP_IMGFLAG_PLANAR) {
- dmpi->planes[1] = mpi->planes[1];
- dmpi->stride[1] = mpi->stride[1];
- dmpi->planes[2] = mpi->planes[2];
- dmpi->stride[2] = mpi->stride[2];
- }
-
- return vf_next_put_image(vf, dmpi, pts);
-}
-
-static int control(struct vf_instance *vf, int request, void* data)
-{
- switch (request) {
- case VFCTRL_DUPLICATE_FRAME:
- if (!vf->priv->last_mpi) break;
- // This is a huge hack. We assume nothing
- // has been called earlier in the filter chain
- // since the last put_image. This is reasonable
- // because we're handling a duplicate frame!
- if (put_image(vf, vf->priv->last_mpi, MP_NOPTS_VALUE))
- return CONTROL_TRUE;
- break;
- }
- return vf_next_control(vf, request, data);
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- vf->put_image = put_image;
- vf->control = control;
- vf->uninit = uninit;
- vf->priv = calloc(1, sizeof(struct vf_priv_s));
- return 1;
-}
-
-const vf_info_t vf_info_harddup = {
- "resubmit duplicate frames for encoding",
- "harddup",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_hue.c b/libmpcodecs/vf_hue.c
deleted file mode 100644
index 47fe19ac57..0000000000
--- a/libmpcodecs/vf_hue.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/video_out.h"
-
-#include "m_option.h"
-#include "m_struct.h"
-
-static struct vf_priv_s {
- uint8_t *buf[2];
- float hue;
- float saturation;
-} const vf_priv_dflt = {
- {NULL, NULL},
- 0.0,
- 1.0,
-};
-
-static void process_C(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsrc, int dststride, int srcstride,
- int w, int h, float hue, float sat)
-{
- int i;
- const int s= rint(sin(hue) * (1<<16) * sat);
- const int c= rint(cos(hue) * (1<<16) * sat);
-
- while (h--) {
- for (i = 0; i<w; i++)
- {
- const int u= usrc[i] - 128;
- const int v= vsrc[i] - 128;
- int new_u= (c*u - s*v + (1<<15) + (128<<16))>>16;
- int new_v= (s*u + c*v + (1<<15) + (128<<16))>>16;
- if(new_u & 768) new_u= (-new_u)>>31;
- if(new_v & 768) new_v= (-new_v)>>31;
- udst[i]= new_u;
- vdst[i]= new_v;
- }
- usrc += srcstride;
- vsrc += srcstride;
- udst += dststride;
- vdst += dststride;
- }
-}
-
-static void (*process)(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsrc, int dststride, int srcstride,
- int w, int h, float hue, float sat);
-
-/* FIXME: add packed yuv version of process */
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
-
- dmpi=vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_EXPORT, 0,
- mpi->w, mpi->h);
-
- dmpi->planes[0] = mpi->planes[0];
- dmpi->stride[0] = mpi->stride[0];
- dmpi->stride[1] = mpi->stride[1];
- dmpi->stride[2] = mpi->stride[2];
-
- if (!vf->priv->buf[0]){
- vf->priv->buf[0] = malloc(mpi->stride[1]*mpi->h >> mpi->chroma_y_shift);
- vf->priv->buf[1] = malloc(mpi->stride[2]*mpi->h >> mpi->chroma_y_shift);
- }
-
- if (vf->priv->hue == 0 && vf->priv->saturation == 1){
- dmpi->planes[1] = mpi->planes[1];
- dmpi->planes[2] = mpi->planes[2];
- }else {
- dmpi->planes[1] = vf->priv->buf[0];
- dmpi->planes[2] = vf->priv->buf[1];
- process(dmpi->planes[1], dmpi->planes[2],
- mpi->planes[1], mpi->planes[2],
- dmpi->stride[1],mpi->stride[1],
- mpi->w>> mpi->chroma_x_shift, mpi->h>> mpi->chroma_y_shift,
- vf->priv->hue, vf->priv->saturation);
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static int control(struct vf_instance *vf, int request, void* data)
-{
- vf_equalizer_t *eq;
-
- switch (request) {
- case VFCTRL_SET_EQUALIZER:
- eq = data;
- if (!strcmp(eq->item,"hue")) {
- vf->priv->hue = eq->value * M_PI / 100;
- return CONTROL_TRUE;
- } else if (!strcmp(eq->item,"saturation")) {
- vf->priv->saturation = (eq->value + 100)/100.0;
- return CONTROL_TRUE;
- }
- break;
- case VFCTRL_GET_EQUALIZER:
- eq = data;
- if (!strcmp(eq->item,"hue")) {
- eq->value = rint(vf->priv->hue *100 / M_PI);
- return CONTROL_TRUE;
- }else if (!strcmp(eq->item,"saturation")) {
- eq->value = rint(vf->priv->saturation*100 - 100);
- return CONTROL_TRUE;
- }
- break;
- }
- return vf_next_control(vf, request, data);
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- switch (fmt) {
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv->buf[0]);
- free(vf->priv->buf[1]);
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- vf->control=control;
- vf->query_format=query_format;
- vf->put_image=put_image;
- vf->uninit=uninit;
-
- vf->priv->hue *= M_PI / 180.0;
-
- process = process_C;
- return 1;
-}
-
-#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static const m_option_t vf_opts_fields[] = {
- {"hue", ST_OFF(hue), CONF_TYPE_FLOAT, M_OPT_RANGE,-180.0 ,180.0, NULL},
- {"saturation", ST_OFF(saturation), CONF_TYPE_FLOAT, M_OPT_RANGE,-10.0 ,10.0, NULL},
- { NULL, NULL, 0, 0, 0, 0, NULL }
-};
-
-static const m_struct_t vf_opts = {
- "hue",
- sizeof(struct vf_priv_s),
- &vf_priv_dflt,
- vf_opts_fields
-};
-
-const vf_info_t vf_info_hue = {
- "hue changer",
- "hue",
- "Michael Niedermayer",
- "",
- vf_open,
- &vf_opts
-};
diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c
deleted file mode 100644
index f209197376..0000000000
--- a/libmpcodecs/vf_il.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "mp_msg.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-
-
-//===========================================================================//
-
-typedef struct FilterParam{
- int interleave;
- int swap;
-}FilterParam;
-
-struct vf_priv_s {
- FilterParam lumaParam;
- FilterParam chromaParam;
-};
-
-/***************************************************************************/
-
-static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, int interleave, int swap){
- const int a= swap;
- const int b= 1-a;
- const int m= h>>1;
- int y;
-
- switch(interleave){
- case -1:
- for(y=0; y < m; y++){
- fast_memcpy(dst + dstStride* y , src + srcStride*(y*2 + a), w);
- fast_memcpy(dst + dstStride*(y + m), src + srcStride*(y*2 + b), w);
- }
- break;
- case 0:
- for(y=0; y < m; y++){
- fast_memcpy(dst + dstStride* y*2 , src + srcStride*(y*2 + a), w);
- fast_memcpy(dst + dstStride*(y*2+1), src + srcStride*(y*2 + b), w);
- }
- break;
- case 1:
- for(y=0; y < m; y++){
- fast_memcpy(dst + dstStride*(y*2+a), src + srcStride* y , w);
- fast_memcpy(dst + dstStride*(y*2+b), src + srcStride*(y + m), w);
- }
- break;
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int w;
- FilterParam *luma = &vf->priv->lumaParam;
- FilterParam *chroma= &vf->priv->chromaParam;
-
- mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w,mpi->h);
-
- if(mpi->flags&MP_IMGFLAG_PLANAR)
- w= mpi->w;
- else
- w= mpi->w * mpi->bpp/8;
-
- interleave(dmpi->planes[0], mpi->planes[0],
- w, mpi->h, dmpi->stride[0], mpi->stride[0], luma->interleave, luma->swap);
-
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
-
- interleave(dmpi->planes[1], mpi->planes[1], cw,ch,
- dmpi->stride[1], mpi->stride[1], chroma->interleave, luma->swap);
- interleave(dmpi->planes[2], mpi->planes[2], cw,ch,
- dmpi->stride[2], mpi->stride[2], chroma->interleave, luma->swap);
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static void parse(FilterParam *fp, char* args){
- char *pos;
- char *max= strchr(args, ':');
-
- if(!max) max= args + strlen(args);
-
- pos= strchr(args, 's');
- if(pos && pos<max) fp->swap=1;
- pos= strchr(args, 'i');
- if(pos && pos<max) fp->interleave=1;
- pos= strchr(args, 'd');
- if(pos && pos<max) fp->interleave=-1;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
-
- vf->put_image=put_image;
-// vf->get_image=get_image;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if(args)
- {
- char *arg2= strchr(args,':');
- if(arg2) parse(&vf->priv->chromaParam, arg2+1);
- parse(&vf->priv->lumaParam, args);
- }
-
- return 1;
-}
-
-const vf_info_t vf_info_il = {
- "(de)interleave",
- "il",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_ivtc.c b/libmpcodecs/vf_ivtc.c
deleted file mode 100644
index 966292ff14..0000000000
--- a/libmpcodecs/vf_ivtc.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-
-struct metrics {
- /* difference: total, even lines, odd lines */
- int d, e, o;
- /* noise: temporal, spacial (current), spacial (past) */
- int t, s, p;
-};
-
-struct frameinfo {
- /* peak, relative, mean */
- struct metrics p, r, m;
-};
-
-struct vf_priv_s {
- struct frameinfo fi[2];
- mp_image_t *dmpi;
- int first;
- int drop, lastdrop, dropnext;
- int inframes, outframes;
- struct vf_detc_pts_buf ptsbuf;
-};
-
-enum {
- F_DROP,
- F_MERGE,
- F_NEXT,
- F_SHOW
-};
-
-#if HAVE_MMX && HAVE_EBX_AVAILABLE
-static void block_diffs_MMX(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns)
-{
- int i;
- short out[24]; // output buffer for the partial metrics from the mmx code
-
- __asm__ (
- "movl $4, %%ecx \n\t"
- "pxor %%mm4, %%mm4 \n\t" // 4 even difference sums
- "pxor %%mm5, %%mm5 \n\t" // 4 odd difference sums
- "pxor %%mm7, %%mm7 \n\t" // all zeros
-
- ASMALIGN(4)
- "1: \n\t"
-
- // Even difference
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S"), %%mm2 \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "movq (%%"REG_D"), %%mm1 \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "psubusb %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpckhbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm0, %%mm4 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm2, %%mm4 \n\t"
- "paddw %%mm3, %%mm4 \n\t"
-
- // Odd difference
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S"), %%mm2 \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "movq (%%"REG_D"), %%mm1 \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "psubusb %%mm1, %%mm2 \n\t"
- "psubusb %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm0 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpckhbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm0, %%mm5 \n\t"
- "paddw %%mm1, %%mm5 \n\t"
- "paddw %%mm2, %%mm5 \n\t"
- "paddw %%mm3, %%mm5 \n\t"
-
- "decl %%ecx \n\t"
- "jnz 1b \n\t"
- "movq %%mm4, (%%"REG_d") \n\t"
- "movq %%mm5, 8(%%"REG_d") \n\t"
- :
- : "S" (old), "D" (new), "a" (os), "b" (ns), "d" (out)
- : "memory"
- );
- m->e = out[0]+out[1]+out[2]+out[3];
- m->o = out[4]+out[5]+out[6]+out[7];
- m->d = m->e + m->o;
-
- __asm__ (
- // First loop to measure first four columns
- "movl $4, %%ecx \n\t"
- "pxor %%mm4, %%mm4 \n\t" // Past spacial noise
- "pxor %%mm5, %%mm5 \n\t" // Temporal noise
- "pxor %%mm6, %%mm6 \n\t" // Current spacial noise
-
- ASMALIGN(4)
- "2: \n\t"
-
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "movq (%%"REG_D"), %%mm2 \n\t"
- "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm1, %%mm5 \n\t"
- "paddw %%mm3, %%mm6 \n\t"
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
- "psubw %%mm2, %%mm6 \n\t"
-
- "decl %%ecx \n\t"
- "jnz 2b \n\t"
-
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "pcmpgtw %%mm4, %%mm1 \n\t"
- "pcmpgtw %%mm5, %%mm2 \n\t"
- "pcmpgtw %%mm6, %%mm3 \n\t"
- "pxor %%mm1, %%mm4 \n\t"
- "pxor %%mm2, %%mm5 \n\t"
- "pxor %%mm3, %%mm6 \n\t"
- "psubw %%mm1, %%mm4 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
- "psubw %%mm3, %%mm6 \n\t"
- "movq %%mm4, (%%"REG_d") \n\t"
- "movq %%mm5, 16(%%"REG_d") \n\t"
- "movq %%mm6, 32(%%"REG_d") \n\t"
-
- "mov %%"REG_a", %%"REG_c" \n\t"
- "shl $3, %%"REG_c" \n\t"
- "sub %%"REG_c", %%"REG_S" \n\t"
- "mov %%"REG_b", %%"REG_c" \n\t"
- "shl $3, %%"REG_c" \n\t"
- "sub %%"REG_c", %%"REG_D" \n\t"
-
- // Second loop for the last four columns
- "movl $4, %%ecx \n\t"
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm5, %%mm5 \n\t"
- "pxor %%mm6, %%mm6 \n\t"
-
- ASMALIGN(4)
- "3: \n\t"
-
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "add %%"REG_a", %%"REG_S" \n\t"
- "movq (%%"REG_D"), %%mm2 \n\t"
- "movq (%%"REG_D",%%"REG_b"), %%mm3 \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "add %%"REG_b", %%"REG_D" \n\t"
- "punpckhbw %%mm7, %%mm0 \n\t"
- "punpckhbw %%mm7, %%mm1 \n\t"
- "punpckhbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm1, %%mm5 \n\t"
- "paddw %%mm3, %%mm6 \n\t"
- "psubw %%mm0, %%mm4 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
- "psubw %%mm2, %%mm6 \n\t"
-
- "decl %%ecx \n\t"
- "jnz 3b \n\t"
-
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "pcmpgtw %%mm4, %%mm1 \n\t"
- "pcmpgtw %%mm5, %%mm2 \n\t"
- "pcmpgtw %%mm6, %%mm3 \n\t"
- "pxor %%mm1, %%mm4 \n\t"
- "pxor %%mm2, %%mm5 \n\t"
- "pxor %%mm3, %%mm6 \n\t"
- "psubw %%mm1, %%mm4 \n\t"
- "psubw %%mm2, %%mm5 \n\t"
- "psubw %%mm3, %%mm6 \n\t"
- "movq %%mm4, 8(%%"REG_d") \n\t"
- "movq %%mm5, 24(%%"REG_d") \n\t"
- "movq %%mm6, 40(%%"REG_d") \n\t"
-
- "emms \n\t"
- :
- : "S" (old), "D" (new), "a" ((long)os), "b" ((long)ns), "d" (out)
- : "memory"
- );
- m->p = m->t = m->s = 0;
- for (i=0; i<8; i++) {
- m->p += out[i];
- m->t += out[8+i];
- m->s += out[16+i];
- }
- //printf("e=%d o=%d d=%d p=%d t=%d s=%d\n", m->e, m->o, m->d, m->p, m->t, m->s);
-}
-#endif
-
-//#define MAG(a) ((a)*(a))
-//#define MAG(a) (abs(a))
-#define MAG(a) (((a)^((a)>>31))-((a)>>31))
-
-//#define LOWPASS(s) (((s)[-2] + 4*(s)[-1] + 6*(s)[0] + 4*(s)[1] + (s)[2])>>4)
-//#define LOWPASS(s) (((s)[-1] + 2*(s)[0] + (s)[1])>>2)
-#define LOWPASS(s) ((s)[0])
-
-
-static void block_diffs_C(struct metrics *m, unsigned char *old, unsigned char *new, int os, int ns)
-{
- int x, y, e=0, o=0, s=0, p=0, t=0;
- unsigned char *oldp, *newp;
- m->s = m->p = m->t = 0;
- for (x = 8; x; x--) {
- oldp = old++;
- newp = new++;
- s = p = t = 0;
- for (y = 4; y; y--) {
- e += MAG(newp[0]-oldp[0]);
- o += MAG(newp[ns]-oldp[os]);
- s += newp[ns]-newp[0];
- p += oldp[os]-oldp[0];
- t += oldp[os]-newp[0];
- oldp += os<<1;
- newp += ns<<1;
- }
- m->s += MAG(s);
- m->p += MAG(p);
- m->t += MAG(t);
- }
- m->e = e;
- m->o = o;
- m->d = e+o;
-}
-
-static void (*block_diffs)(struct metrics *, unsigned char *, unsigned char *, int, int);
-
-#define MAXUP(a,b) ((a) = ((a)>(b)) ? (a) : (b))
-
-static void diff_planes(struct frameinfo *fi,
- unsigned char *old, unsigned char *new, int w, int h, int os, int ns)
-{
- int x, y;
- struct metrics l;
- struct metrics *peak=&fi->p, *rel=&fi->r, *mean=&fi->m;
- memset(peak, 0, sizeof(struct metrics));
- memset(rel, 0, sizeof(struct metrics));
- memset(mean, 0, sizeof(struct metrics));
- for (y = 0; y < h-7; y += 8) {
- for (x = 8; x < w-8-7; x += 8) {
- block_diffs(&l, old+x+y*os, new+x+y*ns, os, ns);
- mean->d += l.d;
- mean->e += l.e;
- mean->o += l.o;
- mean->s += l.s;
- mean->p += l.p;
- mean->t += l.t;
- MAXUP(peak->d, l.d);
- MAXUP(peak->e, l.e);
- MAXUP(peak->o, l.o);
- MAXUP(peak->s, l.s);
- MAXUP(peak->p, l.p);
- MAXUP(peak->t, l.t);
- MAXUP(rel->e, l.e-l.o);
- MAXUP(rel->o, l.o-l.e);
- MAXUP(rel->s, l.s-l.t);
- MAXUP(rel->p, l.p-l.t);
- MAXUP(rel->t, l.t-l.p);
- MAXUP(rel->d, l.t-l.s); /* hack */
- }
- }
- x = (w/8-2)*(h/8);
- mean->d /= x;
- mean->e /= x;
- mean->o /= x;
- mean->s /= x;
- mean->p /= x;
- mean->t /= x;
-}
-
-static void diff_fields(struct frameinfo *fi, mp_image_t *old, mp_image_t *new)
-{
- diff_planes(fi, old->planes[0], new->planes[0],
- new->w, new->h, old->stride[0], new->stride[0]);
-}
-
-static void stats(struct frameinfo *f)
-{
- mp_msg(MSGT_VFILTER, MSGL_V, " pd=%d re=%d ro=%d rp=%d rt=%d rs=%d rd=%d pp=%d pt=%d ps=%d\r",
- f->p.d, f->r.e, f->r.o, f->r.p, f->r.t, f->r.s, f->r.d, f->p.p, f->p.t, f->p.s);
-}
-
-static int foo(struct vf_priv_s *p, mp_image_t *new, mp_image_t *cur)
-{
- struct frameinfo *f = p->fi;
-
- f[0] = f[1];
- diff_fields(&f[1], cur, new);
- stats(&f[1]);
-
- // Immediately drop this frame if it's already been used.
- if (p->dropnext) {
- p->dropnext = 0;
- return F_DROP;
- }
-
- // Sometimes a pulldown frame comes all by itself, so both
- // its top and bottom field are duplicates from the adjacent
- // two frames. We can just drop such a frame, but we
- // immediately show the next frame instead to keep the frame
- // drops evenly spaced during normal 3:2 pulldown sequences.
- if ((3*f[1].r.o < f[1].r.e) && (f[1].r.s < f[1].r.d)) {
- p->dropnext = 1;
- return F_NEXT;
- }
-
- // If none of these conditions hold, we will consider the frame
- // progressive and just show it as-is.
- if (!( (3*f[0].r.e < f[0].r.o) ||
- ((2*f[0].r.d < f[0].r.s) && (f[0].r.s > 1200)) ||
- ((2*f[1].r.t < f[1].r.p) && (f[1].r.p > 1200)) ))
- return F_SHOW;
-
- // Otherwise, we have to decide whether to merge or drop.
- // If the noise metric only increases minimally, we're off
- // to a good start...
- if (((2*f[1].r.t < 3*f[1].r.p) && (f[1].r.t < 3600)) ||
- (f[1].r.t < 900) || (f[1].r.d < 900)) {
- // ...and if noise decreases or the duplicate even field
- // is detected, we go ahead with the merge.
- if ((3*f[0].r.e < f[0].r.o) || (2*f[1].r.t < f[1].r.p)) {
- p->dropnext = 1;
- return F_MERGE;
- }
- }
- return F_DROP;
-}
-
-
-
-static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
-{
- switch (field) {
- case 0:
- my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- break;
- case 1:
- my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
- mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
- mpi->planes[1]+mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
- mpi->planes[2]+mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- break;
- case 2:
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0], mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2], mpi->stride[2]);
- }
- break;
- }
-}
-
-static int do_put_image(struct vf_instance *vf, mp_image_t *dmpi, double pts)
-{
- struct vf_priv_s *p = vf->priv;
- int dropflag=0;
-
- if (!p->dropnext) switch (p->drop) {
- case 0:
- dropflag = 0;
- break;
- case 1:
- dropflag = (++p->lastdrop >= 5);
- break;
- case 2:
- dropflag = (++p->lastdrop >= 5) && (4*p->inframes <= 5*p->outframes);
- break;
- }
-
- if (dropflag) {
- //mp_msg(MSGT_VFILTER, MSGL_V, "drop! [%d/%d=%g]\n",
- // p->outframes, p->inframes, (float)p->outframes/p->inframes);
- mp_msg(MSGT_VFILTER, MSGL_V, "!");
- p->lastdrop = 0;
- vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
- return 0;
- }
-
- p->outframes++;
- return vf_next_put_image(vf, dmpi, vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 0));
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- int ret=0;
- struct vf_priv_s *p = vf->priv;
-
- p->inframes++;
-
- if (p->first) { /* hack */
- p->first = 0;
- vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
- return 1;
- }
-
- if (!p->dmpi) p->dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE | MP_IMGFLAG_READABLE,
- mpi->width, mpi->height);
- /* FIXME -- not correct, off by one frame! */
- p->dmpi->qscale = mpi->qscale;
- p->dmpi->qstride = mpi->qstride;
- p->dmpi->qscale_type = mpi->qscale_type;
-
- switch (foo(p, mpi, p->dmpi)) {
- case F_DROP:
- copy_image(p->dmpi, mpi, 2);
- ret = 0;
- p->lastdrop = 0;
- mp_msg(MSGT_VFILTER, MSGL_V, "DROP\n");
- vf_detc_adjust_pts(&p->ptsbuf, pts, 0, 1);
- break;
- case F_MERGE:
- copy_image(p->dmpi, mpi, 0);
- ret = do_put_image(vf, p->dmpi, pts);
- copy_image(p->dmpi, mpi, 1);
- mp_msg(MSGT_VFILTER, MSGL_V, "MERGE\n");
- p->dmpi = NULL;
- break;
- case F_NEXT:
- copy_image(p->dmpi, mpi, 2);
- ret = do_put_image(vf, p->dmpi, pts);
- mp_msg(MSGT_VFILTER, MSGL_V, "NEXT\n");
- p->dmpi = NULL;
- break;
- case F_SHOW:
- ret = do_put_image(vf, p->dmpi, pts);
- copy_image(p->dmpi, mpi, 2);
- mp_msg(MSGT_VFILTER, MSGL_V, "OK\n");
- p->dmpi = NULL;
- break;
- }
- return ret;
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- p->drop = 0;
- p->first = 1;
- if (args) sscanf(args, "%d", &p->drop);
- block_diffs = block_diffs_C;
-#if HAVE_MMX && HAVE_EBX_AVAILABLE
- if(gCpuCaps.hasMMX) block_diffs = block_diffs_MMX;
-#endif
- vf_detc_init_pts_buf(&p->ptsbuf);
- return 1;
-}
-
-const vf_info_t vf_info_ivtc = {
- "inverse telecine, take 2",
- "ivtc",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c
deleted file mode 100644
index c6fb389f3a..0000000000
--- a/libmpcodecs/vf_kerndeint.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Original AVISynth Filter Copyright (C) 2003 Donald A. Graft
- * Adapted to MPlayer by Tobias Diedrich
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "mp_msg.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-
-//===========================================================================//
-
-struct vf_priv_s {
- int frame;
- int map;
- int order;
- int thresh;
- int sharp;
- int twoway;
- int do_deinterlace;
-};
-
-
-/***************************************************************************/
-
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static inline int IsRGB(mp_image_t *mpi)
-{
- return mpi->imgfmt == IMGFMT_RGB;
-}
-
-static inline int IsYUY2(mp_image_t *mpi)
-{
- return mpi->imgfmt == IMGFMT_YUY2;
-}
-
-#define PLANAR_Y 0
-#define PLANAR_U 1
-#define PLANAR_V 2
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
- int W = mpi->w, H = mpi->h;
- const unsigned char *prvp, *prvpp, *prvpn, *prvpnn, *prvppp, *prvp4p, *prvp4n;
- const unsigned char *srcp_saved;
- const unsigned char *srcp, *srcpp, *srcpn, *srcpnn, *srcppp, *srcp3p, *srcp3n, *srcp4p, *srcp4n;
- unsigned char *dstp, *dstp_saved;
- int src_pitch;
- int psrc_pitch;
- int dst_pitch;
- int x, y, z;
- int n = vf->priv->frame++;
- int val, hi, lo, w, h;
- double valf;
- int plane;
- int threshold = vf->priv->thresh;
- int order = vf->priv->order;
- int map = vf->priv->map;
- int sharp = vf->priv->sharp;
- int twoway = vf->priv->twoway;
- mp_image_t *dmpi, *pmpi;
-
- if(!vf->priv->do_deinterlace)
- return vf_next_put_image(vf, mpi, pts);
-
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w,mpi->h);
- pmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w,mpi->h);
- if(!dmpi) return 0;
-
- for (z=0; z<mpi->num_planes; z++) {
- if (z == 0) plane = PLANAR_Y;
- else if (z == 1) plane = PLANAR_U;
- else plane = PLANAR_V;
-
- h = plane == PLANAR_Y ? H : ch;
- w = plane == PLANAR_Y ? W : cw;
-
- srcp = srcp_saved = mpi->planes[z];
- src_pitch = mpi->stride[z];
- psrc_pitch = pmpi->stride[z];
- dstp = dstp_saved = dmpi->planes[z];
- dst_pitch = dmpi->stride[z];
- srcp = srcp_saved + (1-order) * src_pitch;
- dstp = dstp_saved + (1-order) * dst_pitch;
-
- for (y=0; y<h; y+=2) {
- fast_memcpy(dstp, srcp, w);
- srcp += 2*src_pitch;
- dstp += 2*dst_pitch;
- }
-
- // Copy through the lines that will be missed below.
- fast_memcpy(dstp_saved + order*dst_pitch, srcp_saved + (1-order)*src_pitch, w);
- fast_memcpy(dstp_saved + (2+order)*dst_pitch, srcp_saved + (3-order)*src_pitch, w);
- fast_memcpy(dstp_saved + (h-2+order)*dst_pitch, srcp_saved + (h-1-order)*src_pitch, w);
- fast_memcpy(dstp_saved + (h-4+order)*dst_pitch, srcp_saved + (h-3-order)*src_pitch, w);
- /* For the other field choose adaptively between using the previous field
- or the interpolant from the current field. */
-
- prvp = pmpi->planes[z] + 5*psrc_pitch - (1-order)*psrc_pitch;
- prvpp = prvp - psrc_pitch;
- prvppp = prvp - 2*psrc_pitch;
- prvp4p = prvp - 4*psrc_pitch;
- prvpn = prvp + psrc_pitch;
- prvpnn = prvp + 2*psrc_pitch;
- prvp4n = prvp + 4*psrc_pitch;
- srcp = srcp_saved + 5*src_pitch - (1-order)*src_pitch;
- srcpp = srcp - src_pitch;
- srcppp = srcp - 2*src_pitch;
- srcp3p = srcp - 3*src_pitch;
- srcp4p = srcp - 4*src_pitch;
- srcpn = srcp + src_pitch;
- srcpnn = srcp + 2*src_pitch;
- srcp3n = srcp + 3*src_pitch;
- srcp4n = srcp + 4*src_pitch;
- dstp = dstp_saved + 5*dst_pitch - (1-order)*dst_pitch;
- for (y = 5 - (1-order); y <= h - 5 - (1-order); y+=2)
- {
- for (x = 0; x < w; x++)
- {
- if ((threshold == 0) || (n == 0) ||
- (abs((int)prvp[x] - (int)srcp[x]) > threshold) ||
- (abs((int)prvpp[x] - (int)srcpp[x]) > threshold) ||
- (abs((int)prvpn[x] - (int)srcpn[x]) > threshold))
- {
- if (map == 1)
- {
- int g = x & ~3;
- if (IsRGB(mpi) == 1)
- {
- dstp[g++] = 255;
- dstp[g++] = 255;
- dstp[g++] = 255;
- dstp[g] = 255;
- x = g;
- }
- else if (IsYUY2(mpi) == 1)
- {
- dstp[g++] = 235;
- dstp[g++] = 128;
- dstp[g++] = 235;
- dstp[g] = 128;
- x = g;
- }
- else
- {
- if (plane == PLANAR_Y) dstp[x] = 235;
- else dstp[x] = 128;
- }
- }
- else
- {
- if (IsRGB(mpi))
- {
- hi = 255;
- lo = 0;
- }
- else if (IsYUY2(mpi))
- {
- hi = (x & 1) ? 240 : 235;
- lo = 16;
- }
- else
- {
- hi = (plane == PLANAR_Y) ? 235 : 240;
- lo = 16;
- }
-
- if (sharp == 1)
- {
- if (twoway == 1)
- valf = + 0.526*((int)srcpp[x] + (int)srcpn[x])
- + 0.170*((int)srcp[x] + (int)prvp[x])
- - 0.116*((int)srcppp[x] + (int)srcpnn[x] + (int)prvppp[x] + (int)prvpnn[x])
- - 0.026*((int)srcp3p[x] + (int)srcp3n[x])
- + 0.031*((int)srcp4p[x] + (int)srcp4n[x] + (int)prvp4p[x] + (int)prvp4n[x]);
- else
- valf = + 0.526*((int)srcpp[x] + (int)srcpn[x])
- + 0.170*((int)prvp[x])
- - 0.116*((int)prvppp[x] + (int)prvpnn[x])
- - 0.026*((int)srcp3p[x] + (int)srcp3n[x])
- + 0.031*((int)prvp4p[x] + (int)prvp4p[x]);
- if (valf > hi) valf = hi;
- else if (valf < lo) valf = lo;
- dstp[x] = (int) valf;
- }
- else
- {
- if (twoway == 1)
- val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)srcp[x] + (int)prvp[x]) -
- (int)(srcppp[x]) - (int)(srcpnn[x]) -
- (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4;
- else
- val = (8*((int)srcpp[x] + (int)srcpn[x]) + 2*((int)prvp[x]) -
- (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4;
- if (val > hi) val = hi;
- else if (val < lo) val = lo;
- dstp[x] = (int) val;
- }
- }
- }
- else
- {
- dstp[x] = srcp[x];
- }
- }
- prvp += 2*psrc_pitch;
- prvpp += 2*psrc_pitch;
- prvppp += 2*psrc_pitch;
- prvpn += 2*psrc_pitch;
- prvpnn += 2*psrc_pitch;
- prvp4p += 2*psrc_pitch;
- prvp4n += 2*psrc_pitch;
- srcp += 2*src_pitch;
- srcpp += 2*src_pitch;
- srcppp += 2*src_pitch;
- srcp3p += 2*src_pitch;
- srcp4p += 2*src_pitch;
- srcpn += 2*src_pitch;
- srcpnn += 2*src_pitch;
- srcp3n += 2*src_pitch;
- srcp4n += 2*src_pitch;
- dstp += 2*dst_pitch;
- }
-
- srcp = mpi->planes[z];
- dstp = pmpi->planes[z];
- for (y=0; y<h; y++) {
- fast_memcpy(dstp, srcp, w);
- srcp += src_pitch;
- dstp += psrc_pitch;
- }
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt)
- {
- case IMGFMT_YV12:
- case IMGFMT_RGB:
- case IMGFMT_YUY2:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int control(struct vf_instance *vf, int request, void* data){
- switch (request)
- {
- case VFCTRL_GET_DEINTERLACE:
- *(int*)data = vf->priv->do_deinterlace;
- return CONTROL_OK;
- case VFCTRL_SET_DEINTERLACE:
- vf->priv->do_deinterlace = *(int*)data;
- return CONTROL_OK;
- }
- return vf_next_control (vf, request, data);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
-
- vf->control=control;
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- vf->priv->frame = 0;
-
- vf->priv->map = 0;
- vf->priv->order = 0;
- vf->priv->thresh = 10;
- vf->priv->sharp = 0;
- vf->priv->twoway = 0;
- vf->priv->do_deinterlace=1;
-
- if (args)
- {
- sscanf(args, "%d:%d:%d:%d:%d",
- &vf->priv->thresh, &vf->priv->map,
- &vf->priv->order, &vf->priv->sharp,
- &vf->priv->twoway);
- }
- if (vf->priv->order > 1) vf->priv->order = 1;
-
- return 1;
-}
-
-const vf_info_t vf_info_kerndeint = {
- "Kernel Deinterlacer",
- "kerndeint",
- "Donald Graft",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c
deleted file mode 100644
index b2c1dd756d..0000000000
--- a/libmpcodecs/vf_lavc.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libavcodec/avcodec.h"
-
-struct vf_priv_s {
- unsigned char* outbuf;
- int outbuf_size;
- AVCodecContext* context;
- AVFrame* pic;
- AVCodec* codec;
- vo_mpegpes_t pes;
-};
-
-#define lavc_venc_context (*vf->priv->context)
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- if(vf_next_query_format(vf,IMGFMT_MPEGPES)<=0) return 0;
-
- lavc_venc_context.width = width;
- lavc_venc_context.height = height;
-
- if(!lavc_venc_context.time_base.num || !lavc_venc_context.time_base.den){
- // guess FPS:
- switch(height){
- case 240:
- case 480:
- lavc_venc_context.time_base= (AVRational){1001,30000};
- break;
- case 576:
- case 288:
- default:
- lavc_venc_context.time_base= (AVRational){1,25};
- break;
-// lavc_venc_context.frame_rate=vo_fps*FRAME_RATE_BASE; // same as src
- }
- }
-
- free(vf->priv->outbuf);
-
- vf->priv->outbuf_size=10000+width*height; // must be enough!
- vf->priv->outbuf = malloc(vf->priv->outbuf_size);
-
- if (avcodec_open2(&lavc_venc_context, vf->priv->codec, NULL) != 0) {
- mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Could not open codec.\n");
- return 0;
- }
-
- if (lavc_venc_context.codec->encode == NULL) {
- mp_msg(MSGT_VFILTER,MSGL_ERR,"avcodec init failed (ctx->codec->encode == NULL)!\n");
- return 0;
- }
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_MPEGPES);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t* dmpi;
- int out_size;
- AVFrame *pic= vf->priv->pic;
-
- pic->data[0]=mpi->planes[0];
- pic->data[1]=mpi->planes[1];
- pic->data[2]=mpi->planes[2];
- pic->linesize[0]=mpi->stride[0];
- pic->linesize[1]=mpi->stride[1];
- pic->linesize[2]=mpi->stride[2];
-
- out_size = avcodec_encode_video(&lavc_venc_context,
- vf->priv->outbuf, vf->priv->outbuf_size, pic);
-
- if(out_size<=0) return 1;
-
- dmpi=vf_get_image(vf->next,IMGFMT_MPEGPES,
- MP_IMGTYPE_EXPORT, 0,
- mpi->w, mpi->h);
-
- vf->priv->pes.data=vf->priv->outbuf;
- vf->priv->pes.size=out_size;
- vf->priv->pes.id=0x1E0;
- vf->priv->pes.timestamp=-1; // dunno
-
- dmpi->planes[0]=(unsigned char*)&vf->priv->pes;
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- return vf_next_query_format(vf, IMGFMT_MPEGPES) & (~(VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_ACCEPT_STRIDE));
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- int p_quality=0;
- float p_fps=0;
-
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv,0,sizeof(struct vf_priv_s));
-
- vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name("mpeg1video");
- if (!vf->priv->codec) {
- mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n", "mpeg1video");
- return 0;
- }
-
- vf->priv->context=avcodec_alloc_context3(vf->priv->codec);
- vf->priv->pic = avcodec_alloc_frame();
-
- // TODO: parse args ->
- if(args) sscanf(args, "%d:%f", &p_quality, &p_fps);
-
- if(p_quality<32){
- // fixed qscale
- lavc_venc_context.flags = CODEC_FLAG_QSCALE;
- lavc_venc_context.global_quality =
- vf->priv->pic->quality = (int)(FF_QP2LAMBDA * ((p_quality<1) ? 1 : p_quality) + 0.5);
- } else {
- // fixed bitrate (in kbits)
- lavc_venc_context.bit_rate = 1000*p_quality;
- }
- lavc_venc_context.time_base.num = 1000*1001;
- lavc_venc_context.time_base.den = (p_fps<1.0) ? 1000*1001*25 : (p_fps * lavc_venc_context.time_base.num);
- lavc_venc_context.gop_size = 0; // I-only
- lavc_venc_context.pix_fmt= PIX_FMT_YUV420P;
-
- return 1;
-}
-
-const vf_info_t vf_info_lavc = {
- "realtime mpeg1 encoding with libavcodec",
- "lavc",
- "A'rpi",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_lavcdeint.c b/libmpcodecs/vf_lavcdeint.c
deleted file mode 100644
index 3a67c8db59..0000000000
--- a/libmpcodecs/vf_lavcdeint.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libavcodec/avcodec.h"
-
-
-struct vf_priv_s
-{
- int width, height;
- int pix_fmt;
-};
-
-/* Support for avcodec's built-in deinterlacer.
- * Based on vf_lavc.c
- */
-
-//===========================================================================//
-
-
-/* Convert mplayer's IMGFMT_* to avcodec's PIX_FMT_* for the supported
- * IMGFMT's, and return -1 if the deinterlacer doesn't support
- * that format (-1 because 0 is a valid PIX_FMT).
- */
-/* The deinterlacer supports planer 4:2:0, 4:2:2, and 4:4:4 YUV */
-static int
-imgfmt_to_pixfmt (int imgfmt)
-{
- switch(imgfmt)
- {
- /* I hope I got all the supported formats */
-
- /* 4:2:0 */
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- return PIX_FMT_YUV420P;
- break;
-
-#if 0
- /* 4:2:2 */
- case IMGFMT_UYVY:
- case IMGFMT_UYNV:
- case IMGFMT_Y422:
- case IMGFMT_YUY2:
- case IMGFMT_YUNV:
- case IMGFMT_YVYU:
- case IMGFMT_Y42T:
- case IMGFMT_V422:
- case IMGFMT_V655:
- return PIX_FMT_YUV422P;
- break;
-#endif
-
- /* Are there any _planar_ YUV 4:4:4 formats? */
-
- default:
- return -1;
- }
-}
-
-
-static int
-config (struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- struct vf_priv_s *priv = vf->priv;
-
- priv->pix_fmt = imgfmt_to_pixfmt(outfmt);
- if(priv->pix_fmt == -1)
- return 0;
-
- /* The deinterlacer will fail if this is false */
- if ((width & 3) != 0 || (height & 3) != 0)
- return 0;
-
- /* If we get here, the deinterlacer is guaranteed not to fail */
-
- priv->width = width;
- priv->height = height;
-
- return vf_next_config(vf,
- width, height,
- d_width, d_height,
- flags, outfmt);
-}
-
-static int
-put_image (struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- struct vf_priv_s *priv = vf->priv;
- mp_image_t* dmpi;
- AVPicture pic;
- AVPicture lavc_picture;
-
- lavc_picture.data[0] = mpi->planes[0];
- lavc_picture.data[1] = mpi->planes[1];
- lavc_picture.data[2] = mpi->planes[2];
- lavc_picture.linesize[0] = mpi->stride[0];
- lavc_picture.linesize[1] = mpi->stride[1];
- lavc_picture.linesize[2] = mpi->stride[2];
-
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- priv->width, priv->height);
-
- pic.data[0] = dmpi->planes[0];
- pic.data[1] = dmpi->planes[1];
- pic.data[2] = dmpi->planes[2];
- pic.linesize[0] = dmpi->stride[0];
- pic.linesize[1] = dmpi->stride[1];
- pic.linesize[2] = dmpi->stride[2];
-
- if (avpicture_deinterlace(&pic, &lavc_picture,
- priv->pix_fmt, priv->width, priv->height) < 0)
- {
- /* This should not happen -- see config() */
- return 0;
- }
-
- return vf_next_put_image(vf, dmpi, pts);
-}
-
-
-static int
-query_format (struct vf_instance *vf, unsigned int fmt)
-{
- if(imgfmt_to_pixfmt(fmt) == -1)
- return 0;
-
- return vf_next_query_format(vf,fmt);
-}
-
-
-static int
-vf_open(vf_instance_t *vf, char *args)
-{
- /* We don't have any args */
- (void) args;
-
- vf->config = config;
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->priv = malloc(sizeof(struct vf_priv_s));
- memset(vf->priv,0,sizeof(struct vf_priv_s));
-
- return 1;
-}
-
-
-const vf_info_t vf_info_lavcdeint = {
- "libavcodec's deinterlacing filter",
- "lavcdeint",
- "Joe Rabinoff",
- "libavcodec's internal deinterlacer, in case you don't like "
- "the builtin ones (invoked with -pp or -npp)",
- vf_open,
- NULL
-};
-
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c
deleted file mode 100644
index 82635e5dfd..0000000000
--- a/libmpcodecs/vf_mcdeint.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (C) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-
-/*
-Known Issues:
-* The motion estimation is somewhat at the mercy of the input, if the input
- frames are created purely based on spatial interpolation then for example
- a thin black line or another random and not interpolateable pattern
- will cause problems
- Note: completly ignoring the "unavailable" lines during motion estimation
- didnt look any better, so the most obvious solution would be to improve
- tfields or penalize problematic motion vectors ...
-
-* If non iterative ME is used then snow currently ignores the OBMC window
- and as a result sometimes creates artifacts
-
-* only past frames are used, we should ideally use future frames too, something
- like filtering the whole movie in forward and then backward direction seems
- like a interresting idea but the current filter framework is FAR from
- supporting such things
-
-* combining the motion compensated image with the input image also isnt
- as trivial as it seems, simple blindly taking even lines from one and
- odd ones from the other doesnt work at all as ME/MC sometimes simple
- has nothing in the previous frames which matches the current, the current
- algo has been found by trial and error and almost certainly can be
- improved ...
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#define MIN(a,b) ((a) > (b) ? (b) : (a))
-#define MAX(a,b) ((a) < (b) ? (b) : (a))
-#define ABS(a) ((a) > 0 ? (a) : (-(a)))
-
-//===========================================================================//
-
-struct vf_priv_s {
- int mode;
- int qp;
- int parity;
-#if 0
- int temp_stride[3];
- uint8_t *src[3];
- int16_t *temp[3];
-#endif
- int outbuf_size;
- uint8_t *outbuf;
- AVCodecContext *avctx_enc;
- AVFrame *frame;
- AVFrame *frame_dec;
-};
-
-static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, int height){
- int x, y, i;
- int out_size;
-
- for(i=0; i<3; i++){
- p->frame->data[i]= src[i];
- p->frame->linesize[i]= src_stride[i];
- }
-
- p->avctx_enc->me_cmp=
- p->avctx_enc->me_sub_cmp= FF_CMP_SAD /*| (p->parity ? FF_CMP_ODD : FF_CMP_EVEN)*/;
- p->frame->quality= p->qp*FF_QP2LAMBDA;
- out_size = avcodec_encode_video(p->avctx_enc, p->outbuf, p->outbuf_size, p->frame);
- p->frame_dec = p->avctx_enc->coded_frame;
-
- for(i=0; i<3; i++){
- int is_chroma= !!i;
- int w= width >>is_chroma;
- int h= height>>is_chroma;
- int fils= p->frame_dec->linesize[i];
- int srcs= src_stride[i];
-
- for(y=0; y<h; y++){
- if((y ^ p->parity) & 1){
- for(x=0; x<w; x++){
- if((x-2)+(y-1)*w>=0 && (x+2)+(y+1)*w<w*h){ //FIXME either alloc larger images or optimize this
- uint8_t *filp= &p->frame_dec->data[i][x + y*fils];
- uint8_t *srcp= &src[i][x + y*srcs];
- int diff0= filp[-fils] - srcp[-srcs];
- int diff1= filp[+fils] - srcp[+srcs];
- int spatial_score= ABS(srcp[-srcs-1] - srcp[+srcs-1])
- +ABS(srcp[-srcs ] - srcp[+srcs ])
- +ABS(srcp[-srcs+1] - srcp[+srcs+1]) - 1;
- int temp= filp[0];
-
-#define CHECK(j)\
- { int score= ABS(srcp[-srcs-1+j] - srcp[+srcs-1-j])\
- + ABS(srcp[-srcs +j] - srcp[+srcs -j])\
- + ABS(srcp[-srcs+1+j] - srcp[+srcs+1-j]);\
- if(score < spatial_score){\
- spatial_score= score;\
- diff0= filp[-fils+j] - srcp[-srcs+j];\
- diff1= filp[+fils-j] - srcp[+srcs-j];
-
- CHECK(-1) CHECK(-2) }} }}
- CHECK( 1) CHECK( 2) }} }}
-#if 0
- if((diff0 ^ diff1) > 0){
- int mindiff= ABS(diff0) > ABS(diff1) ? diff1 : diff0;
- temp-= mindiff;
- }
-#elif 1
- if(diff0 + diff1 > 0)
- temp-= (diff0 + diff1 - ABS( ABS(diff0) - ABS(diff1) )/2)/2;
- else
- temp-= (diff0 + diff1 + ABS( ABS(diff0) - ABS(diff1) )/2)/2;
-#else
- temp-= (diff0 + diff1)/2;
-#endif
-#if 1
- filp[0]=
- dst[i][x + y*dst_stride[i]]= temp > 255U ? ~(temp>>31) : temp;
-#else
- dst[i][x + y*dst_stride[i]]= filp[0];
- filp[0]= temp > 255U ? ~(temp>>31) : temp;
-#endif
- }else
- dst[i][x + y*dst_stride[i]]= p->frame_dec->data[i][x + y*fils];
- }
- }
- }
- for(y=0; y<h; y++){
- if(!((y ^ p->parity) & 1)){
- for(x=0; x<w; x++){
-#if 1
- p->frame_dec->data[i][x + y*fils]=
- dst[i][x + y*dst_stride[i]]= src[i][x + y*srcs];
-#else
- dst[i][x + y*dst_stride[i]]= p->frame_dec->data[i][x + y*fils];
- p->frame_dec->data[i][x + y*fils]= src[i][x + y*srcs];
-#endif
- }
- }
- }
- }
- p->parity ^= 1;
-
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int i;
- AVCodec *enc= avcodec_find_encoder(CODEC_ID_SNOW);
-
- for(i=0; i<3; i++){
- AVCodecContext *avctx_enc;
-#if 0
- int is_chroma= !!i;
- int w= ((width + 31) & (~31))>>is_chroma;
- int h= ((height + 31) & (~31))>>is_chroma;
-
- vf->priv->temp_stride[i]= w;
- vf->priv->temp[i]= malloc(vf->priv->temp_stride[i]*h*sizeof(int16_t));
- vf->priv->src [i]= malloc(vf->priv->temp_stride[i]*h*sizeof(uint8_t));
-#endif
- avctx_enc=
- vf->priv->avctx_enc= avcodec_alloc_context();
- avctx_enc->width = width;
- avctx_enc->height = height;
- avctx_enc->time_base= (AVRational){1,25}; // meaningless
- avctx_enc->gop_size = 300;
- avctx_enc->max_b_frames= 0;
- avctx_enc->pix_fmt = PIX_FMT_YUV420P;
- avctx_enc->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_LOW_DELAY;
- avctx_enc->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
- avctx_enc->global_quality= 1;
- avctx_enc->flags2= CODEC_FLAG2_MEMC_ONLY;
- avctx_enc->me_cmp=
- avctx_enc->me_sub_cmp= FF_CMP_SAD; //SSE;
- avctx_enc->mb_cmp= FF_CMP_SSE;
-
- switch(vf->priv->mode){
- case 3:
- avctx_enc->refs= 3;
- case 2:
- avctx_enc->me_method= ME_ITER;
- case 1:
- avctx_enc->flags |= CODEC_FLAG_4MV;
- avctx_enc->dia_size=2;
-// avctx_enc->mb_decision = MB_DECISION_RD;
- case 0:
- avctx_enc->flags |= CODEC_FLAG_QPEL;
- }
-
- avcodec_open(avctx_enc, enc);
-
- }
- vf->priv->frame= avcodec_alloc_frame();
-
- vf->priv->outbuf_size= width*height*10;
- vf->priv->outbuf= malloc(vf->priv->outbuf_size);
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi){
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
-return; //caused problems, dunno why
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
- }else{
- dmpi=vf->dmpi;
- }
-
- filter(vf->priv, dmpi->planes, mpi->planes, dmpi->stride, mpi->stride, mpi->w, mpi->h);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
-#if 0
- for(i=0; i<3; i++){
- free(vf->priv->temp[i]);
- vf->priv->temp[i]= NULL;
- free(vf->priv->src[i]);
- vf->priv->src[i]= NULL;
- }
-#endif
- if (vf->priv->avctx_enc) {
- avcodec_close(vf->priv->avctx_enc);
- av_freep(&vf->priv->avctx_enc);
- }
-
- free(vf->priv->outbuf);
- free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
-
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- vf->priv->mode=0;
- vf->priv->parity= -1;
- vf->priv->qp=1;
-
- if (args) sscanf(args, "%d:%d:%d", &vf->priv->mode, &vf->priv->parity, &vf->priv->qp);
-
- return 1;
-}
-
-const vf_info_t vf_info_mcdeint = {
- "motion compensating deinterlacer",
- "mcdeint",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c
deleted file mode 100644
index f7fb02db72..0000000000
--- a/libmpcodecs/vf_ow.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- * @todo try to change to int
- * @todo try lifting based implementation
- * @todo optimize optimize optimize
- * @todo hard tresholding
- * @todo use QP to decide filter strength
- * @todo wavelet normalization / least squares optimal signal vs. noise thresholds
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "mp_msg.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-//===========================================================================//
-static const uint8_t __attribute__((aligned(8))) dither[8][8]={
-{ 0, 48, 12, 60, 3, 51, 15, 63, },
-{ 32, 16, 44, 28, 35, 19, 47, 31, },
-{ 8, 56, 4, 52, 11, 59, 7, 55, },
-{ 40, 24, 36, 20, 43, 27, 39, 23, },
-{ 2, 50, 14, 62, 1, 49, 13, 61, },
-{ 34, 18, 46, 30, 33, 17, 45, 29, },
-{ 10, 58, 6, 54, 9, 57, 5, 53, },
-{ 42, 26, 38, 22, 41, 25, 37, 21, },
-};
-//FIXME the above is duplicated in many filters
-
-struct vf_priv_s {
- float strength[2];
- float delta;
- int mode;
- int depth;
- float *plane[16][4];
- int stride;
-};
-
-#define S 1.41421356237 //sqrt(2)
-
-static const double coeff[2][5]={
- {
- 0.6029490182363579 *S,
- 0.2668641184428723 *S,
- -0.07822326652898785 *S,
- -0.01686411844287495 *S,
- 0.02674875741080976 *S
- },{
- 1.115087052456994 /S,
- -0.5912717631142470 /S,
- -0.05754352622849957 /S,
- 0.09127176311424948 /S
- }
-};
-
-static const double icoeff[2][5]={
- {
- 1.115087052456994 /S,
- 0.5912717631142470 /S,
- -0.05754352622849957 /S,
- -0.09127176311424948 /S
- },{
- 0.6029490182363579 *S,
- -0.2668641184428723 *S,
- -0.07822326652898785 *S,
- 0.01686411844287495 *S,
- 0.02674875741080976 *S
- }
-};
-#undef S
-
-static inline int mirror(int x, int w){
- while((unsigned)x > (unsigned)w){
- x=-x;
- if(x<0) x+= 2*w;
- }
- return x;
-}
-
-static inline void decompose(float *dstL, float *dstH, float *src, int stride, int w){
- int x, i;
- for(x=0; x<w; x++){
- double sumL= src[x*stride] * coeff[0][0];
- double sumH= src[x*stride] * coeff[1][0];
- for(i=1; i<=4; i++){
- double s= (src[mirror(x-i, w-1)*stride] + src[mirror(x+i, w-1)*stride]);
-
- sumL+= coeff[0][i]*s;
- sumH+= coeff[1][i]*s;
- }
- dstL[x*stride]= sumL;
- dstH[x*stride]= sumH;
- }
-}
-
-static inline void compose(float *dst, float *srcL, float *srcH, int stride, int w){
- int x, i;
- for(x=0; x<w; x++){
- double sumL= srcL[x*stride] * icoeff[0][0];
- double sumH= srcH[x*stride] * icoeff[1][0];
- for(i=1; i<=4; i++){
- int x0= mirror(x-i, w-1)*stride;
- int x1= mirror(x+i, w-1)*stride;
-
- sumL+= icoeff[0][i]*(srcL[x0] + srcL[x1]);
- sumH+= icoeff[1][i]*(srcH[x0] + srcH[x1]);
- }
- dst[x*stride]= (sumL + sumH)*0.5;
- }
-}
-
-static inline void decompose2D(float *dstL, float *dstH, float *src, int xstride, int ystride, int step, int w, int h){
- int y, x;
- for(y=0; y<h; y++)
- for(x=0; x<step; x++)
- decompose(dstL + ystride*y + xstride*x, dstH + ystride*y + xstride*x, src + ystride*y + xstride*x, step*xstride, (w-x+step-1)/step);
-}
-
-static inline void compose2D(float *dst, float *srcL, float *srcH, int xstride, int ystride, int step, int w, int h){
- int y, x;
- for(y=0; y<h; y++)
- for(x=0; x<step; x++)
- compose(dst + ystride*y + xstride*x, srcL + ystride*y + xstride*x, srcH + ystride*y + xstride*x, step*xstride, (w-x+step-1)/step);
-}
-
-static void decompose2D2(float *dst[4], float *src, float *temp[2], int stride, int step, int w, int h){
- decompose2D(temp[0], temp[1], src , 1, stride, step , w, h);
- decompose2D( dst[0], dst[1], temp[0], stride, 1, step , h, w);
- decompose2D( dst[2], dst[3], temp[1], stride, 1, step , h, w);
-}
-
-static void compose2D2(float *dst, float *src[4], float *temp[2], int stride, int step, int w, int h){
- compose2D(temp[0], src[0], src[1], stride, 1, step , h, w);
- compose2D(temp[1], src[2], src[3], stride, 1, step , h, w);
- compose2D(dst , temp[0], temp[1], 1, stride, step , w, h);
-}
-
-static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, int is_luma){
- int x,y, i, j;
-// double sum=0;
- double s= p->strength[!is_luma];
- int depth= p->depth;
-
- while(1<<depth > width || 1<<depth > height)
- depth--;
-
- for(y=0; y<height; y++)
- for(x=0; x<width; x++)
- p->plane[0][0][x + y*p->stride]= src[x + y*src_stride];
-
- for(i=0; i<depth; i++){
- decompose2D2(p->plane[i+1], p->plane[i][0], p->plane[0]+1,p->stride, 1<<i, width, height);
- }
- for(i=0; i<depth; i++){
- for(j=1; j<4; j++){
- for(y=0; y<height; y++){
- for(x=0; x<width; x++){
- double v= p->plane[i+1][j][x + y*p->stride];
- if (v> s) v-=s;
- else if(v<-s) v+=s;
- else v =0;
- p->plane[i+1][j][x + y*p->stride]= v;
- }
- }
- }
- }
- for(i=depth-1; i>=0; i--){
- compose2D2(p->plane[i][0], p->plane[i+1], p->plane[0]+1, p->stride, 1<<i, width, height);
- }
-
- for(y=0; y<height; y++)
- for(x=0; x<width; x++){
- i= p->plane[0][0][x + y*p->stride] + dither[x&7][y&7]*(1.0/64) + 1.0/128; //yes the rounding is insane but optimal :)
-// double e= i - src[x + y*src_stride];
-// sum += e*e;
- if((unsigned)i > 255U) i= ~(i>>31);
- dst[x + y*dst_stride]= i;
- }
-
-// printf("%f\n", sum/height/width);
-}
-
-static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){
- int h= (height+15)&(~15);
- int i,j;
-
- vf->priv->stride= (width+15)&(~15);
- for(j=0; j<4; j++){
- for(i=0; i<=vf->priv->depth; i++)
- vf->priv->plane[i][j]= malloc(vf->priv->stride*h*sizeof(vf->priv->plane[0][0][0]));
- }
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi){
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
- }else{
- dmpi=vf->dmpi;
- }
-
- filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, 1);
- filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, 0);
- filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, 0);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- int i,j;
- if(!vf->priv) return;
-
- for(j=0; j<4; j++){
- for(i=0; i<16; i++){
- free(vf->priv->plane[i][j]);
- vf->priv->plane[i][j]= NULL;
- }
- }
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- vf->priv->depth= 8;
- vf->priv->strength[0]= 1.0;
- vf->priv->strength[1]= 1.0;
- vf->priv->delta= 1.0;
-
- if (args) sscanf(args, "%d:%f:%f:%d:%f", &vf->priv->depth,
- &vf->priv->strength[0],
- &vf->priv->strength[1],
- &vf->priv->mode,
- &vf->priv->delta);
-
- return 1;
-}
-
-const vf_info_t vf_info_ow = {
- "overcomplete wavelet denoiser",
- "ow",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_palette.c b/libmpcodecs/vf_palette.c
deleted file mode 100644
index 17670f3eb0..0000000000
--- a/libmpcodecs/vf_palette.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "mpbswap.h"
-
-#include "libswscale/swscale.h"
-
-//===========================================================================//
-
-// commented out 16 and 15 bit output support, because the conversion
-// routines are incorrrect. they assume the palette to be of the same
-// depth as the output, which is incorrect. --Joey
-
-static const unsigned int bgr_list[]={
- IMGFMT_BGR32,
- IMGFMT_BGR24,
-// IMGFMT_BGR16,
-// IMGFMT_BGR15,
- 0
-};
-static const unsigned int rgb_list[]={
- IMGFMT_RGB32,
- IMGFMT_RGB24,
-// IMGFMT_RGB16,
-// IMGFMT_RGB15,
- 0
-};
-
-/**
- * Palette is assumed to contain BGR16, see rgb32to16 to convert the palette.
- */
-static void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
- for (i=0; i<num_pixels; i++)
- ((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
-}
-
-static void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
- for (i=0; i<num_pixels; i++)
- ((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
-}
-
-static unsigned int gray_pal[256];
-
-static unsigned int find_best(struct vf_instance *vf, unsigned int fmt){
- unsigned int best=0;
- int ret;
- const unsigned int* p;
- if(fmt==IMGFMT_BGR8) p=bgr_list;
- else if(fmt==IMGFMT_RGB8) p=rgb_list;
- else return 0;
- while(*p){
- ret=vf->next->query_format(vf->next,*p);
- mp_msg(MSGT_VFILTER,MSGL_DBG2,"[%s] query(%s) -> %d\n",vf->info->name,vo_format_name(*p),ret&3);
- if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo!
- if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion
- ++p;
- }
- return best;
-}
-
-//===========================================================================//
-
-struct vf_priv_s {
- unsigned int fmt;
- int pal_msg;
-};
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- if (!vf->priv->fmt)
- vf->priv->fmt=find_best(vf,outfmt);
- if(!vf->priv->fmt){
- // no matching fmt, so force one...
- if(outfmt==IMGFMT_RGB8) vf->priv->fmt=IMGFMT_RGB32;
- else if(outfmt==IMGFMT_BGR8) vf->priv->fmt=IMGFMT_BGR32;
- else return 0;
- }
- return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- uint8_t *old_palette = mpi->planes[1];
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,vf->priv->fmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w, mpi->h);
-
- if (!mpi->planes[1])
- {
- if(!vf->priv->pal_msg){
- mp_msg(MSGT_VFILTER,MSGL_V,"[%s] no palette given, assuming builtin grayscale one\n",vf->info->name);
- vf->priv->pal_msg=1;
- }
- mpi->planes[1] = (unsigned char*)gray_pal;
- }
-
- if(mpi->w==mpi->stride[0] && dmpi->w*(dmpi->bpp>>3)==dmpi->stride[0]){
- // no stride conversion needed
- switch(IMGFMT_RGB_DEPTH(dmpi->imgfmt)){
- case 15:
- case 16:
- if (IMGFMT_IS_BGR(dmpi->imgfmt))
- palette8tobgr16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
- else
- palette8torgb16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
- break;
- case 24:
- if (IMGFMT_IS_BGR(dmpi->imgfmt))
- sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
- else
- sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
- break;
- case 32:
- if (IMGFMT_IS_BGR(dmpi->imgfmt))
- sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
- else
- sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
- break;
- }
- } else {
- int y;
- for(y=0;y<mpi->h;y++){
- unsigned char* src=mpi->planes[0]+y*mpi->stride[0];
- unsigned char* dst=dmpi->planes[0]+y*dmpi->stride[0];
- switch(IMGFMT_RGB_DEPTH(dmpi->imgfmt)){
- case 15:
- case 16:
- if (IMGFMT_IS_BGR(dmpi->imgfmt))
- palette8tobgr16(src,dst,mpi->w,mpi->planes[1]);
- else
- palette8torgb16(src,dst,mpi->w,mpi->planes[1]);
- break;
- case 24:
- if (IMGFMT_IS_BGR(dmpi->imgfmt))
- sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]);
- else
- sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]);
- break;
- case 32:
- if (IMGFMT_IS_BGR(dmpi->imgfmt))
- sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]);
- else
- sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]);
- break;
- }
- }
- }
- mpi->planes[1] = old_palette;
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- int best=find_best(vf,fmt);
- if(!best) return 0; // no match
- return vf->next->query_format(vf->next,best);
-}
-
-static void uninit(vf_instance_t *vf) {
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- unsigned int i;
- vf->config=config;
- vf->uninit=uninit;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
- for(i=0;i<256;i++) gray_pal[i]=0x01010101*i;
- if (args)
- {
- if (!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else
- if (!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else
- if (!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else
- if (!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else
- if (!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
- if (!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else
- if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else
- if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else
- {
- mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[VF_FORMAT] Unknown format name: '%s'.\n", args);
- return 0;
- }
- }
- return 1;
-}
-
-const vf_info_t vf_info_palette = {
- "8bpp indexed (using palette) -> BGR 15/16/24/32 conversion",
- "palette",
- "A'rpi & Alex",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c
deleted file mode 100644
index df196bb1c9..0000000000
--- a/libmpcodecs/vf_perspective.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include <math.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "libavutil/mem.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#define SUB_PIXEL_BITS 8
-#define SUB_PIXELS (1<<SUB_PIXEL_BITS)
-#define COEFF_BITS 11
-
-//===========================================================================//
-
-struct vf_priv_s {
- double ref[4][2];
- int32_t coeff[1<<SUB_PIXEL_BITS][4];
- int32_t (*pv)[2];
- int pvStride;
- int cubic;
-};
-
-
-/***************************************************************************/
-
-static void initPv(struct vf_priv_s *priv, int W, int H){
- double a,b,c,d,e,f,g,h,D;
- double (*ref)[2]= priv->ref;
- int x,y;
-
- g= ( (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[2][1] - ref[3][1])
- - (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[2][0] - ref[3][0]))*H;
- h= ( (ref[0][1] - ref[1][1] - ref[2][1] + ref[3][1])*(ref[1][0] - ref[3][0])
- - (ref[0][0] - ref[1][0] - ref[2][0] + ref[3][0])*(ref[1][1] - ref[3][1]))*W;
- D= (ref[1][0] - ref[3][0])*(ref[2][1] - ref[3][1])
- - (ref[2][0] - ref[3][0])*(ref[1][1] - ref[3][1]);
-
- a= D*(ref[1][0] - ref[0][0])*H + g*ref[1][0];
- b= D*(ref[2][0] - ref[0][0])*W + h*ref[2][0];
- c= D*ref[0][0]*W*H;
- d= D*(ref[1][1] - ref[0][1])*H + g*ref[1][1];
- e= D*(ref[2][1] - ref[0][1])*W + h*ref[2][1];
- f= D*ref[0][1]*W*H;
-
- for(y=0; y<H; y++){
- for(x=0; x<W; x++){
- int u, v;
-
- u= (int)floor( SUB_PIXELS*(a*x + b*y + c)/(g*x + h*y + D*W*H) + 0.5);
- v= (int)floor( SUB_PIXELS*(d*x + e*y + f)/(g*x + h*y + D*W*H) + 0.5);
-
- priv->pv[x + y*W][0]= u;
- priv->pv[x + y*W][1]= v;
- }
- }
-}
-
-static double getCoeff(double d){
- double A= -0.60;
- double coeff;
-
- d= fabs(d);
-
- // Equation is from VirtualDub
- if(d<1.0)
- coeff = (1.0 - (A+3.0)*d*d + (A+2.0)*d*d*d);
- else if(d<2.0)
- coeff = (-4.0*A + 8.0*A*d - 5.0*A*d*d + A*d*d*d);
- else
- coeff=0.0;
-
- return coeff;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int i, j;
-
- vf->priv->pvStride= width;
- vf->priv->pv= av_malloc(width*height*2*sizeof(int32_t));
- initPv(vf->priv, width, height);
-
- for(i=0; i<SUB_PIXELS; i++){
- double d= i/(double)SUB_PIXELS;
- double temp[4];
- double sum=0;
-
- for(j=0; j<4; j++)
- temp[j]= getCoeff(j - d - 1);
-
- for(j=0; j<4; j++)
- sum+= temp[j];
-
- for(j=0; j<4; j++)
- vf->priv->coeff[i][j]= (int)floor((1<<COEFF_BITS)*temp[j]/sum + 0.5);
- }
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
- av_free(vf->priv->pv);
- vf->priv->pv= NULL;
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-static inline void resampleCubic(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, struct vf_priv_s *privParam, int xShift, int yShift){
- int x, y;
- struct vf_priv_s priv= *privParam;
-
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int u, v, subU, subV, sum, sx, sy;
-
- sx= x << xShift;
- sy= y << yShift;
- u= priv.pv[sx + sy*priv.pvStride][0]>>xShift;
- v= priv.pv[sx + sy*priv.pvStride][1]>>yShift;
- subU= u & (SUB_PIXELS-1);
- subV= v & (SUB_PIXELS-1);
- u >>= SUB_PIXEL_BITS;
- v >>= SUB_PIXEL_BITS;
-
- if(u>0 && v>0 && u<w-2 && v<h-2){
- const int index= u + v*srcStride;
- const int a= priv.coeff[subU][0];
- const int b= priv.coeff[subU][1];
- const int c= priv.coeff[subU][2];
- const int d= priv.coeff[subU][3];
-
- sum=
- priv.coeff[subV][0]*( a*src[index - 1 - srcStride] + b*src[index - 0 - srcStride]
- + c*src[index + 1 - srcStride] + d*src[index + 2 - srcStride])
- +priv.coeff[subV][1]*( a*src[index - 1 ] + b*src[index - 0 ]
- + c*src[index + 1 ] + d*src[index + 2 ])
- +priv.coeff[subV][2]*( a*src[index - 1 + srcStride] + b*src[index - 0 + srcStride]
- + c*src[index + 1 + srcStride] + d*src[index + 2 + srcStride])
- +priv.coeff[subV][3]*( a*src[index - 1+2*srcStride] + b*src[index - 0+2*srcStride]
- + c*src[index + 1+2*srcStride] + d*src[index + 2+2*srcStride]);
- }else{
- int dx, dy;
- sum=0;
-
- for(dy=0; dy<4; dy++){
- int iy= v + dy - 1;
- if (iy< 0) iy=0;
- else if(iy>=h) iy=h-1;
- for(dx=0; dx<4; dx++){
- int ix= u + dx - 1;
- if (ix< 0) ix=0;
- else if(ix>=w) ix=w-1;
-
- sum+= priv.coeff[subU][dx]*priv.coeff[subV][dy]
- *src[ ix + iy*srcStride];
- }
- }
- }
- sum= (sum + (1<<(COEFF_BITS*2-1)) ) >> (COEFF_BITS*2);
- if(sum&~255){
- if(sum<0) sum=0;
- else sum=255;
- }
- dst[ x + y*dstStride]= sum;
- }
- }
-}
-
-static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride,
- struct vf_priv_s *privParam, int xShift, int yShift){
- int x, y;
- struct vf_priv_s priv= *privParam;
-
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int u, v, subU, subV, sum, sx, sy, index, subUI, subVI;
-
- sx= x << xShift;
- sy= y << yShift;
- u= priv.pv[sx + sy*priv.pvStride][0]>>xShift;
- v= priv.pv[sx + sy*priv.pvStride][1]>>yShift;
- subU= u & (SUB_PIXELS-1);
- subV= v & (SUB_PIXELS-1);
- u >>= SUB_PIXEL_BITS;
- v >>= SUB_PIXEL_BITS;
- index= u + v*srcStride;
- subUI= SUB_PIXELS - subU;
- subVI= SUB_PIXELS - subV;
-
- if((unsigned)u < (unsigned)(w - 1)){
- if((unsigned)v < (unsigned)(h - 1)){
- sum= subVI*(subUI*src[index ] + subU*src[index +1])
- +subV *(subUI*src[index+srcStride] + subU*src[index+srcStride+1]);
- sum= (sum + (1<<(SUB_PIXEL_BITS*2-1)) ) >> (SUB_PIXEL_BITS*2);
- }else{
- if(v<0) v= 0;
- else v= h-1;
- index= u + v*srcStride;
- sum= subUI*src[index] + subU*src[index+1];
- sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS;
- }
- }else{
- if((unsigned)v < (unsigned)(h - 1)){
- if(u<0) u= 0;
- else u= w-1;
- index= u + v*srcStride;
- sum= subVI*src[index] + subV*src[index+srcStride];
- sum= (sum + (1<<(SUB_PIXEL_BITS-1)) ) >> SUB_PIXEL_BITS;
- }else{
- if(u<0) u= 0;
- else u= w-1;
- if(v<0) v= 0;
- else v= h-1;
- index= u + v*srcStride;
- sum= src[index];
- }
- }
- if(sum&~255){
- if(sum<0) sum=0;
- else sum=255;
- }
- dst[ x + y*dstStride]= sum;
- }
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
-
- mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w,mpi->h);
-
- assert(mpi->flags&MP_IMGFLAG_PLANAR);
-
- if(vf->priv->cubic){
- resampleCubic(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0],
- vf->priv, 0, 0);
- resampleCubic(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1],
- vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift);
- resampleCubic(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2],
- vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift);
- }else{
- resampleLinear(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0],
- vf->priv, 0, 0);
- resampleLinear(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1],
- vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift);
- resampleLinear(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2],
- vf->priv, mpi->chroma_x_shift, mpi->chroma_y_shift);
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt)
- {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YVU9:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- int e;
-
- vf->config=config;
- vf->put_image=put_image;
-// vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if(args==NULL) return 0;
-
- e=sscanf(args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf:%d",
- &vf->priv->ref[0][0], &vf->priv->ref[0][1],
- &vf->priv->ref[1][0], &vf->priv->ref[1][1],
- &vf->priv->ref[2][0], &vf->priv->ref[2][1],
- &vf->priv->ref[3][0], &vf->priv->ref[3][1],
- &vf->priv->cubic
- );
-
- if(e!=9)
- return 0;
-
- return 1;
-}
-
-const vf_info_t vf_info_perspective = {
- "perspective correcture",
- "perspective",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c
deleted file mode 100644
index 0a30022576..0000000000
--- a/libmpcodecs/vf_pp7.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * Copyright (C) 2005 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "config.h"
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "libavutil/mem.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-
-#define XMIN(a,b) ((a) < (b) ? (a) : (b))
-#define XMAX(a,b) ((a) > (b) ? (a) : (b))
-
-typedef short DCTELEM;
-
-//===========================================================================//
-static const uint8_t __attribute__((aligned(8))) dither[8][8]={
-{ 0, 48, 12, 60, 3, 51, 15, 63, },
-{ 32, 16, 44, 28, 35, 19, 47, 31, },
-{ 8, 56, 4, 52, 11, 59, 7, 55, },
-{ 40, 24, 36, 20, 43, 27, 39, 23, },
-{ 2, 50, 14, 62, 1, 49, 13, 61, },
-{ 34, 18, 46, 30, 33, 17, 45, 29, },
-{ 10, 58, 6, 54, 9, 57, 5, 53, },
-{ 42, 26, 38, 22, 41, 25, 37, 21, },
-};
-
-struct vf_priv_s {
- int qp;
- int mode;
- int mpeg2;
- int temp_stride;
- uint8_t *src;
-};
-#if 0
-static inline void dct7_c(DCTELEM *dst, int s0, int s1, int s2, int s3, int step){
- int s, d;
- int dst2[64];
-//#define S0 (1024/0.37796447300922719759)
-#define C0 ((int)(1024*0.37796447300922719759+0.5)) //sqrt(1/7)
-#define C1 ((int)(1024*0.53452248382484879308/6+0.5)) //sqrt(2/7)/6
-
-#define C2 ((int)(1024*0.45221175985034745004/2+0.5))
-#define C3 ((int)(1024*0.36264567479870879474/2+0.5))
-
-//0.1962505182412941918 0.0149276808419397944-0.2111781990832339584
-#define C4 ((int)(1024*0.1962505182412941918+0.5))
-#define C5 ((int)(1024*0.0149276808419397944+0.5))
-//#define C6 ((int)(1024*0.2111781990832339584+0.5))
-#if 0
- s= s0 + s1 + s2;
- dst[0*step] = ((s + s3)*C0 + 512) >> 10;
- s= (s - 6*s3)*C1 + 512;
- d= (s0-s2)*C4 + (s1-s2)*C5;
- dst[1*step] = (s + 2*d)>>10;
- s -= d;
- d= (s1-s0)*C2 + (s1-s2)*C3;
- dst[2*step] = (s + d)>>10;
- dst[3*step] = (s - d)>>10;
-#elif 1
- s = s3+s3;
- s3= s-s0;
- s0= s+s0;
- s = s2+s1;
- s2= s2-s1;
- dst[0*step]= s0 + s;
- dst[2*step]= s0 - s;
- dst[1*step]= 2*s3 + s2;
- dst[3*step]= s3 - 2*s2;
-#else
- int i,j,n=7;
- for(i=0; i<7; i+=2){
- dst2[i*step/2]= 0;
- for(j=0; j<4; j++)
- dst2[i*step/2] += src[j*step] * cos(i*M_PI/n*(j+0.5)) * sqrt((i?2.0:1.0)/n);
- if(fabs(dst2[i*step/2] - dst[i*step/2]) > 20)
- printf("%d %d %d (%d %d %d %d) -> (%d %d %d %d)\n", i,dst2[i*step/2], dst[i*step/2],src[0*step], src[1*step], src[2*step], src[3*step], dst[0*step], dst[1*step],dst[2*step],dst[3*step]);
- }
-#endif
-}
-#endif
-
-static inline void dctA_c(DCTELEM *dst, uint8_t *src, int stride){
- int i;
-
- for(i=0; i<4; i++){
- int s0= src[0*stride] + src[6*stride];
- int s1= src[1*stride] + src[5*stride];
- int s2= src[2*stride] + src[4*stride];
- int s3= src[3*stride];
- int s= s3+s3;
- s3= s-s0;
- s0= s+s0;
- s = s2+s1;
- s2= s2-s1;
- dst[0]= s0 + s;
- dst[2]= s0 - s;
- dst[1]= 2*s3 + s2;
- dst[3]= s3 - 2*s2;
- src++;
- dst+=4;
- }
-}
-
-static void dctB_c(DCTELEM *dst, DCTELEM *src){
- int i;
-
- for(i=0; i<4; i++){
- int s0= src[0*4] + src[6*4];
- int s1= src[1*4] + src[5*4];
- int s2= src[2*4] + src[4*4];
- int s3= src[3*4];
- int s= s3+s3;
- s3= s-s0;
- s0= s+s0;
- s = s2+s1;
- s2= s2-s1;
- dst[0*4]= s0 + s;
- dst[2*4]= s0 - s;
- dst[1*4]= 2*s3 + s2;
- dst[3*4]= s3 - 2*s2;
- src++;
- dst++;
- }
-}
-
-#if HAVE_MMX
-static void dctB_mmx(DCTELEM *dst, DCTELEM *src){
- __asm__ volatile (
- "movq (%0), %%mm0 \n\t"
- "movq 1*4*2(%0), %%mm1 \n\t"
- "paddw 6*4*2(%0), %%mm0 \n\t"
- "paddw 5*4*2(%0), %%mm1 \n\t"
- "movq 2*4*2(%0), %%mm2 \n\t"
- "movq 3*4*2(%0), %%mm3 \n\t"
- "paddw 4*4*2(%0), %%mm2 \n\t"
- "paddw %%mm3, %%mm3 \n\t" //s
- "movq %%mm3, %%mm4 \n\t" //s
- "psubw %%mm0, %%mm3 \n\t" //s-s0
- "paddw %%mm0, %%mm4 \n\t" //s+s0
- "movq %%mm2, %%mm0 \n\t" //s2
- "psubw %%mm1, %%mm2 \n\t" //s2-s1
- "paddw %%mm1, %%mm0 \n\t" //s2+s1
- "movq %%mm4, %%mm1 \n\t" //s0'
- "psubw %%mm0, %%mm4 \n\t" //s0'-s'
- "paddw %%mm0, %%mm1 \n\t" //s0'+s'
- "movq %%mm3, %%mm0 \n\t" //s3'
- "psubw %%mm2, %%mm3 \n\t"
- "psubw %%mm2, %%mm3 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "movq %%mm1, (%1) \n\t"
- "movq %%mm4, 2*4*2(%1) \n\t"
- "movq %%mm2, 1*4*2(%1) \n\t"
- "movq %%mm3, 3*4*2(%1) \n\t"
- :: "r" (src), "r"(dst)
- );
-}
-#endif
-
-static void (*dctB)(DCTELEM *dst, DCTELEM *src)= dctB_c;
-
-#define N0 4
-#define N1 5
-#define N2 10
-#define SN0 2
-#define SN1 2.2360679775
-#define SN2 3.16227766017
-#define N (1<<16)
-
-static const int factor[16]={
- N/(N0*N0), N/(N0*N1), N/(N0*N0),N/(N0*N2),
- N/(N1*N0), N/(N1*N1), N/(N1*N0),N/(N1*N2),
- N/(N0*N0), N/(N0*N1), N/(N0*N0),N/(N0*N2),
- N/(N2*N0), N/(N2*N1), N/(N2*N0),N/(N2*N2),
-};
-
-static const int thres[16]={
- N/(SN0*SN0), N/(SN0*SN2), N/(SN0*SN0),N/(SN0*SN2),
- N/(SN2*SN0), N/(SN2*SN2), N/(SN2*SN0),N/(SN2*SN2),
- N/(SN0*SN0), N/(SN0*SN2), N/(SN0*SN0),N/(SN0*SN2),
- N/(SN2*SN0), N/(SN2*SN2), N/(SN2*SN0),N/(SN2*SN2),
-};
-
-static int thres2[99][16];
-
-static void init_thres2(void){
- int qp, i;
- int bias= 0; //FIXME
-
- for(qp=0; qp<99; qp++){
- for(i=0; i<16; i++){
- thres2[qp][i]= ((i&1)?SN2:SN0) * ((i&4)?SN2:SN0) * XMAX(1,qp) * (1<<2) - 1 - bias;
- }
- }
-}
-
-static int hardthresh_c(DCTELEM *src, int qp){
- int i;
- int a;
-
- a= src[0] * factor[0];
- for(i=1; i<16; i++){
- unsigned int threshold1= thres2[qp][i];
- unsigned int threshold2= (threshold1<<1);
- int level= src[i];
- if(((unsigned)(level+threshold1))>threshold2){
- a += level * factor[i];
- }
- }
- return (a + (1<<11))>>12;
-}
-
-static int mediumthresh_c(DCTELEM *src, int qp){
- int i;
- int a;
-
- a= src[0] * factor[0];
- for(i=1; i<16; i++){
- unsigned int threshold1= thres2[qp][i];
- unsigned int threshold2= (threshold1<<1);
- int level= src[i];
- if(((unsigned)(level+threshold1))>threshold2){
- if(((unsigned)(level+2*threshold1))>2*threshold2){
- a += level * factor[i];
- }else{
- if(level>0) a+= 2*(level - (int)threshold1)*factor[i];
- else a+= 2*(level + (int)threshold1)*factor[i];
- }
- }
- }
- return (a + (1<<11))>>12;
-}
-
-static int softthresh_c(DCTELEM *src, int qp){
- int i;
- int a;
-
- a= src[0] * factor[0];
- for(i=1; i<16; i++){
- unsigned int threshold1= thres2[qp][i];
- unsigned int threshold2= (threshold1<<1);
- int level= src[i];
- if(((unsigned)(level+threshold1))>threshold2){
- if(level>0) a+= (level - (int)threshold1)*factor[i];
- else a+= (level + (int)threshold1)*factor[i];
- }
- }
- return (a + (1<<11))>>12;
-}
-
-static int (*requantize)(DCTELEM *src, int qp)= hardthresh_c;
-
-static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){
- int x, y;
- const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
- uint8_t *p_src= p->src + 8*stride;
- DCTELEM *block= (DCTELEM *)p->src;
- DCTELEM *temp= (DCTELEM *)(p->src + 32);
-
- if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
- for(y=0; y<height; y++){
- int index= 8 + 8*stride + y*stride;
- fast_memcpy(p_src + index, src + y*src_stride, width);
- for(x=0; x<8; x++){
- p_src[index - x - 1]= p_src[index + x ];
- p_src[index + width + x ]= p_src[index + width - x - 1];
- }
- }
- for(y=0; y<8; y++){
- fast_memcpy(p_src + ( 7-y)*stride, p_src + ( y+8)*stride, stride);
- fast_memcpy(p_src + (height+8+y)*stride, p_src + (height-y+7)*stride, stride);
- }
- //FIXME (try edge emu)
-
- for(y=0; y<height; y++){
- for(x=-8; x<0; x+=4){
- const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset
- uint8_t *src = p_src + index;
- DCTELEM *tp= temp+4*x;
-
- dctA_c(tp+4*8, src, stride);
- }
- for(x=0; x<width; ){
- const int qps= 3 + is_luma;
- int qp;
- int end= XMIN(x+8, width);
-
- if(p->qp)
- qp= p->qp;
- else{
- qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride];
- qp=norm_qscale(qp, p->mpeg2);
- }
- for(; x<end; x++){
- const int index= x + y*stride + (8-3)*(1+stride) + 8; //FIXME silly offset
- uint8_t *src = p_src + index;
- DCTELEM *tp= temp+4*x;
- int v;
-
- if((x&3)==0)
- dctA_c(tp+4*8, src, stride);
-
- dctB(block, tp);
-
- v= requantize(block, qp);
- v= (v + dither[y&7][x&7])>>6;
- if((unsigned)v > 255)
- v= (-v)>>31;
- dst[x + y*dst_stride]= v;
- }
- }
- }
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int h= (height+16+15)&(~15);
-
- vf->priv->temp_stride= (width+16+15)&(~15);
- vf->priv->src = av_malloc(vf->priv->temp_stride*(h+8)*sizeof(uint8_t));
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi){
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- if(mpi->flags&MP_IMGFLAG_DIRECT){
- dmpi=vf->dmpi;
- }else{
- // no DR, so get a new image! hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
- }
-
- vf->priv->mpeg2= mpi->qscale_type;
- if(mpi->qscale || vf->priv->qp){
- filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, mpi->qscale, mpi->qstride, 1);
- filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, mpi->qscale, mpi->qstride, 0);
- filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, mpi->qscale, mpi->qstride, 0);
- }else{
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]);
- memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]);
- }
-
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
-#endif
-#if HAVE_MMX2
- if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
-#endif
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
- av_free(vf->priv->src);
- vf->priv->src= NULL;
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-static int control(struct vf_instance *vf, int request, void* data){
- return vf_next_control(vf,request,data);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->control= control;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if (args) sscanf(args, "%d:%d", &vf->priv->qp, &vf->priv->mode);
-
- if(vf->priv->qp < 0)
- vf->priv->qp = 0;
-
- init_thres2();
-
- switch(vf->priv->mode){
- case 0: requantize= hardthresh_c; break;
- case 1: requantize= softthresh_c; break;
- default:
- case 2: requantize= mediumthresh_c; break;
- }
-
-#if HAVE_MMX
- if(gCpuCaps.hasMMX){
- dctB= dctB_mmx;
- }
-#endif
-#if 0
- if(gCpuCaps.hasMMX){
- switch(vf->priv->mode){
- case 0: requantize= hardthresh_mmx; break;
- case 1: requantize= softthresh_mmx; break;
- }
- }
-#endif
-
- return 1;
-}
-
-const vf_info_t vf_info_pp7 = {
- "postprocess 7",
- "pp7",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c
deleted file mode 100644
index 64e62723d8..0000000000
--- a/libmpcodecs/vf_qp.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-
-#include <libavutil/eval.h>
-#include <libavutil/mem.h>
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-
-
-struct vf_priv_s {
- char eq[200];
- int8_t *qp;
- int8_t lut[257];
- int qp_stride;
-};
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int h= (height+15)>>4;
- int i;
-
- vf->priv->qp_stride= (width+15)>>4;
- vf->priv->qp= av_malloc(vf->priv->qp_stride*h*sizeof(int8_t));
-
- for(i=-129; i<128; i++){
- double const_values[]={
- M_PI,
- M_E,
- i != -129,
- i,
- 0
- };
- const char * const const_names[]={
- "PI",
- "E",
- "known",
- "qp",
- NULL
- };
- double temp_val;
- int res;
-
- res= av_expr_parse_and_eval(&temp_val, vf->priv->eq, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL);
-
- if (res < 0){
- mp_msg(MSGT_VFILTER, MSGL_ERR, "qp: Error evaluating \"%s\" \n", vf->priv->eq);
- return 0;
- }
- vf->priv->lut[i+129]= lrintf(temp_val);
- }
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi){
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags, mpi->w, mpi->h);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int x,y;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->w,mpi->h);
- }
-
- dmpi= vf->dmpi;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]);
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]);
- }
- }
- vf_clone_mpi_attributes(dmpi, mpi);
-
- dmpi->qscale = vf->priv->qp;
- dmpi->qstride= vf->priv->qp_stride;
- if(mpi->qscale){
- for(y=0; y<((dmpi->h+15)>>4); y++){
- for(x=0; x<vf->priv->qp_stride; x++){
- dmpi->qscale[x + dmpi->qstride*y]=
- vf->priv->lut[ 129 + ((int8_t)mpi->qscale[x + mpi->qstride*y]) ];
- }
- }
- }else{
- int qp= vf->priv->lut[0];
- for(y=0; y<((dmpi->h+15)>>4); y++){
- for(x=0; x<vf->priv->qp_stride; x++){
- dmpi->qscale[x + dmpi->qstride*y]= qp;
- }
- }
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
- av_free(vf->priv->qp);
- vf->priv->qp= NULL;
-
- av_free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->uninit=uninit;
- vf->priv=av_malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
-// avcodec_init();
-
- if (args) strncpy(vf->priv->eq, args, 199);
-
- return 1;
-}
-
-const vf_info_t vf_info_qp = {
- "QP changer",
- "qp",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c
deleted file mode 100644
index 1270f5e6c9..0000000000
--- a/libmpcodecs/vf_remove_logo.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * This filter loads a .pgm mask file showing where a logo is and uses
- * a blur transform to remove the logo.
- *
- * Copyright (C) 2005 Robert Edele <yartrebo@earthlink.net>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- * \file vf_remove_logo.c
- *
- * \brief Advanced blur-based logo removing filter.
-
- * Hello and welcome. This code implements a filter to remove annoying TV
- * logos and other annoying images placed onto a video stream. It works by filling
- * in the pixels that comprise the logo with neighboring pixels. The transform is
- * very loosely based on a gaussian blur, but it is different enough to merit its
- * own paragraph later on. It is a major improvement on the old delogo filter as
- * it both uses a better blurring algorithm and uses a bitmap to use an arbitrary
- * and generally much tighter fitting shape than a rectangle.
- *
- * The filter requires 1 argument and has no optional arguments. It requires
- * a filter bitmap, which must be in PGM or PPM format. A sample invocation would
- * be -vf remove_logo=/home/username/logo_bitmaps/xyz.pgm. Pixels with a value of
- * zero are not part of the logo, and non-zero pixels are part of the logo. If you
- * use white (255) for the logo and black (0) for the rest, you will be safe. For
- * making the filter bitmap, I recommend taking a screen capture of a black frame
- * with the logo visible, and then using The GIMP's threshold filter followed by
- * the erode filter once or twice. If needed, little splotches can be fixed
- * manually. Remember that if logo pixels are not covered, the filter quality will
- * be much reduced. Marking too many pixels as part of the logo doesn't hurt as
- * much, but it will increase the amount of blurring needed to cover over the
- * image and will destroy more information than necessary. Additionally, this blur
- * algorithm is O(n) = n^4, where n is the width and height of a hypothetical
- * square logo, so extra pixels will slow things down on a large lo
- *
- * The logo removal algorithm has two key points. The first is that it
- * distinguishes between pixels in the logo and those not in the logo by using the
- * passed-in bitmap. Pixels not in the logo are copied over directly without being
- * modified and they also serve as source pixels for the logo fill-in. Pixels
- * inside the logo have the mask applied.
- *
- * At init-time the bitmap is reprocessed internally, and the distance to the
- * nearest edge of the logo (Manhattan distance), along with a little extra to
- * remove rough edges, is stored in each pixel. This is done using an in-place
- * erosion algorithm, and incrementing each pixel that survives any given erosion.
- * Once every pixel is eroded, the maximum value is recorded, and a set of masks
- * from size 0 to this size are generaged. The masks are circular binary masks,
- * where each pixel within a radius N (where N is the size of the mask) is a 1,
- * and all other pixels are a 0. Although a gaussian mask would be more
- * mathematically accurate, a binary mask works better in practice because we
- * generally do not use the central pixels in the mask (because they are in the
- * logo region), and thus a gaussian mask will cause too little blur and thus a
- * very unstable image.
- *
- * The mask is applied in a special way. Namely, only pixels in the mask that
- * line up to pixels outside the logo are used. The dynamic mask size means that
- * the mask is just big enough so that the edges touch pixels outside the logo, so
- * the blurring is kept to a minimum and at least the first boundary condition is
- * met (that the image function itself is continuous), even if the second boundary
- * condition (that the derivative of the image function is continuous) is not met.
- * A masking algorithm that does preserve the second boundary coundition
- * (perhaps something based on a highly-modified bi-cubic algorithm) should offer
- * even better results on paper, but the noise in a typical TV signal should make
- * anything based on derivatives hopelessly noisy.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <inttypes.h>
-
-#include "osdep/io.h"
-
-#include "config.h"
-#include "mp_msg.h"
-#include "libvo/fastmemcpy.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-//===========================================================================//
-
-/** \brief Returns the larger of the two arguments. **/
-#define max(x,y) ((x)>(y)?(x):(y))
-/** \brief Returns the smaller of the two arguments. **/
-#define min(x,y) ((x)>(y)?(y):(x))
-
-/**
- * \brief Test if a pixel is part of the logo.
- */
-#define test_filter(image, x, y) ((unsigned char) (image->pixel[((y) * image->width) + (x)]))
-
-/**
- * \brief Chooses a slightly larger mask size to improve performance.
- *
- * This function maps the absolute minimum mask size needed to the mask size we'll
- * actually use. f(x) = x (the smallest that will work) will produce the sharpest
- * results, but will be quite jittery. f(x) = 1.25x (what I'm using) is a good
- * tradeoff in my opinion. This will calculate only at init-time, so you can put a
- * long expression here without effecting performance.
- */
-#define apply_mask_fudge_factor(x) (((x) >> 2) + x)
-
-/**
- * \brief Simple implementation of the PGM image format.
- *
- * This struct holds a bare-bones image loaded from a PGM or PPM file. Once
- * loaded and pre-processed, each pixel in this struct will contain how far from
- * the edge of the logo each pixel is, using the manhattan distance (|dx| + |dy|).
- *
- * pixels in char * pixel can be addressed using (y * width) + height.
- */
-typedef struct
-{
- unsigned int width;
- unsigned int height;
-
- unsigned char * pixel;
-
-} pgm_structure;
-
-/**
- * \brief Stores persistant variables.
- *
- * Variables stored here are kept from frame to frame, and separate instances of
- * the filter will get their own separate copies.
- */
-struct vf_priv_s
-{
- unsigned int fmt; /* Not exactly sure of the use for this. It came with the example filter I used as a basis for this, and it looks like a lot of stuff will break if I remove it. */
- int max_mask_size; /* The largest possible mask size that will be needed with the given filter and corresponding half_size_filter. The half_size_filter can have a larger requirment in some rare (but not degenerate) cases. */
- int * * * mask; /* Stores our collection of masks. The first * is for an array of masks, the second for the y axis, and the third for the x axis. */
- pgm_structure * filter; /* Stores the full-size filter image. This is used to tell what pixels are in the logo or not in the luma plane. */
- pgm_structure * half_size_filter; /* Stores a 50% width and 50% height filter image. This is used to tell what pixels are in the logo or not in the chroma planes. */
- /* These 8 variables store the bounding rectangles that the logo resides in. */
- int bounding_rectangle_posx1;
- int bounding_rectangle_posy1;
- int bounding_rectangle_posx2;
- int bounding_rectangle_posy2;
- int bounding_rectangle_half_size_posx1;
- int bounding_rectangle_half_size_posy1;
- int bounding_rectangle_half_size_posx2;
- int bounding_rectangle_half_size_posy2;
-} vf_priv_s;
-
-/**
- * \brief Mallocs memory and checks to make sure it succeeded.
- *
- * \param size How many bytes to allocate.
- *
- * \return A pointer to the freshly allocated memory block, or NULL on failutre.
- *
- * Mallocs memory, and checks to make sure it was successfully allocated. Because
- * of how MPlayer works, it cannot safely halt execution, but at least the user
- * will get an error message before the segfault happens.
- */
-static void * safe_malloc(int size)
-{
- void * answer = malloc(size);
- if (answer == NULL)
- mp_msg(MSGT_VFILTER, MSGL_ERR, "Unable to allocate memory in vf_remove_logo.c\n");
-
- return answer;
-}
-
-/**
- * \brief Calculates the smallest rectangle that will encompass the logo region.
- *
- * \param filter This image contains the logo around which the rectangle will
- * will be fitted.
- *
- * The bounding rectangle is calculated by testing successive lines (from the four
- * sides of the rectangle) until no more can be removed without removing logo
- * pixels. The results are returned by reference to posx1, posy1, posx2, and
- * posy2.
- */
-static void calculate_bounding_rectangle(int * posx1, int * posy1, int * posx2, int * posy2, pgm_structure * filter)
-{
- int x; /* Temporary variables to run */
- int y; /* through each row or column. */
- int start_x;
- int start_y;
- int end_x = filter->width - 1;
- int end_y = filter->height - 1;
- int did_we_find_a_logo_pixel = 0;
-
- /* Let's find the top bound first. */
- for (start_x = 0; start_x < filter->width && !did_we_find_a_logo_pixel; start_x++)
- {
- for (y = 0; y < filter->height; y++)
- {
- did_we_find_a_logo_pixel |= test_filter(filter, start_x, y);
- }
- }
- start_x--;
-
- /* Now the bottom bound. */
- did_we_find_a_logo_pixel = 0;
- for (end_x = filter->width - 1; end_x > start_x && !did_we_find_a_logo_pixel; end_x--)
- {
- for (y = 0; y < filter->height; y++)
- {
- did_we_find_a_logo_pixel |= test_filter(filter, end_x, y);
- }
- }
- end_x++;
-
- /* Left bound. */
- did_we_find_a_logo_pixel = 0;
- for (start_y = 0; start_y < filter->height && !did_we_find_a_logo_pixel; start_y++)
- {
- for (x = 0; x < filter->width; x++)
- {
- did_we_find_a_logo_pixel |= test_filter(filter, x, start_y);
- }
- }
- start_y--;
-
- /* Right bound. */
- did_we_find_a_logo_pixel = 0;
- for (end_y = filter->height - 1; end_y > start_y && !did_we_find_a_logo_pixel; end_y--)
- {
- for (x = 0; x < filter->width; x++)
- {
- did_we_find_a_logo_pixel |= test_filter(filter, x, end_y);
- }
- }
- end_y++;
-
- *posx1 = start_x;
- *posy1 = start_y;
- *posx2 = end_x;
- *posy2 = end_y;
-
- return;
-}
-
-/**
- * \brief Free mask memory.
- *
- * \param vf Data structure which stores our persistant data, and is to be freed.
- *
- * We call this function when our filter is done. It will free the memory
- * allocated to the masks and leave the variables in a safe state.
- */
-static void destroy_masks(vf_instance_t * vf)
-{
- int a, b;
-
- /* Load values from the vf->priv struct for faster dereferencing. */
- int * * * mask = vf->priv->mask;
- int max_mask_size = vf->priv->max_mask_size;
-
- if (mask == NULL)
- return; /* Nothing allocated, so return before we segfault. */
-
- /* Free all allocated memory. */
- for (a = 0; a <= max_mask_size; a++) /* Loop through each mask. */
- {
- for (b = -a; b <= a; b++) /* Loop through each scanline in a mask. */
- {
- free(mask[a][b + a]); /* Free a scanline. */
- }
- free(mask[a]); /* Free a mask. */
- }
- free(mask); /* Free the array of pointers pointing to the masks. */
-
- /* Set the pointer to NULL, so that any duplicate calls to this function will not cause a crash. */
- vf->priv->mask = NULL;
-
- return;
-}
-
-/**
- * \brief Set up our array of masks.
- *
- * \param vf Where our filter stores persistance data, like these masks.
- *
- * This creates an array of progressively larger masks and calculates their
- * values. The values will not change during program execution once this function
- * is done.
- */
-static void initialize_masks(vf_instance_t * vf)
-{
- int a, b, c;
-
- /* Load values from the vf->priv struct for faster dereferencing. */
- int * * * mask = vf->priv->mask;
- int max_mask_size = vf->priv->max_mask_size; /* This tells us how many masks we'll need to generate. */
-
- /* Create a circular mask for each size up to max_mask_size. When the filter is applied, the mask size is
- determined on a pixel by pixel basis, with pixels nearer the edge of the logo getting smaller mask sizes. */
- mask = (int * * *) safe_malloc(sizeof(int * *) * (max_mask_size + 1));
- for (a = 0; a <= max_mask_size; a++)
- {
- mask[a] = (int * *) safe_malloc(sizeof(int *) * ((a * 2) + 1));
- for (b = -a; b <= a; b++)
- {
- mask[a][b + a] = (int *) safe_malloc(sizeof(int) * ((a * 2) + 1));
- for (c = -a; c <= a; c++)
- {
- if ((b * b) + (c * c) <= (a * a)) /* Circular 0/1 mask. */
- mask[a][b + a][c + a] = 1;
- else
- mask[a][b + a][c + a] = 0;
- }
- }
- }
-
- /* Store values back to vf->priv so they aren't lost after the function returns. */
- vf->priv->mask = mask;
-
- return;
-}
-
-/**
- * \brief Pre-processes an image to give distance information.
- *
- * \param vf Data structure that holds persistant information. All it is used for
- in this function is to store the calculated max_mask_size variable.
- * \param mask This image will be converted from a greyscale image into a
- * distance image.
- *
- * This function takes a greyscale image (pgm_structure * mask) and converts it
- * in place into a distance image. A distance image is zero for pixels ourside of
- * the logo and is the manhattan distance (|dx| + |dy|) for pixels inside of the
- * logo. This will overestimate the distance, but that is safe, and is far easier
- * to implement than a proper pythagorean distance since I'm using a modified
- * erosion algorithm to compute the distances.
- */
-static void convert_mask_to_strength_mask(vf_instance_t * vf, pgm_structure * mask)
-{
- int x, y; /* Used by our for loops to go through every single pixel in the picture one at a time. */
- int has_anything_changed = 1; /* Used by the main while() loop to know if anything changed on the last erosion. */
- int current_pass = 0; /* How many times we've gone through the loop. Used in the in-place erosion algorithm
- and to get us max_mask_size later on. */
- int max_mask_size; /* This will record how large a mask the pixel that is the furthest from the edge of the logo
- (and thus the neediest) is. */
- char * current_pixel = mask->pixel; /* This stores the actual pixel data. */
-
- /* First pass, set all non-zero values to 1. After this loop finishes, the data should be considered numeric
- data for the filter, not color data. */
- for (x = 0; x < mask->height * mask->width; x++, current_pixel++)
- if(*current_pixel) *current_pixel = 1;
-
- /* Second pass and future passes. For each pass, if a pixel is itself the same value as the current pass,
- and its four neighbors are too, then it is incremented. If no pixels are incremented by the end of the pass,
- then we go again. Edge pixels are counted as always excluded (this should be true anyway for any sane mask,
- but if it isn't this will ensure that we eventually exit). */
- while (has_anything_changed)
- {
- current_pass++;
- current_pixel = mask->pixel;
-
- has_anything_changed = 0; /* If this doesn't get set by the end of this pass, then we're done. */
-
- for (y = 1; y < mask->height - 1; y++)
- {
- for (x = 1; x < mask->width - 1; x++)
- {
- /* Apply the in-place erosion transform. It is based on the following two premises: 1 - Any pixel that fails 1 erosion
- will fail all future erosions. 2 - Only pixels having survived all erosions up to the present will be >= to
- current_pass. It doesn't matter if it survived the current pass, failed it, or hasn't been tested yet. */
- if (*current_pixel >= current_pass && /* By using >= instead of ==, we allow the algorithm to work in place. */
- *(current_pixel + 1) >= current_pass &&
- *(current_pixel - 1) >= current_pass &&
- *(current_pixel + mask->width) >= current_pass &&
- *(current_pixel - mask->width) >= current_pass)
- {
- (*current_pixel)++; /* Increment the value since it still has not been eroded, as evidenced by the if statement
- that just evaluated to true. */
- has_anything_changed = 1;
- }
- current_pixel++;
- }
- }
- }
-
- /* Apply the fudge factor, which will increase the size of the mask a little to reduce jitter at the cost of more blur. */
- for (y = 1; y < mask->height - 1; y++)
- {
- for (x = 1; x < mask->width - 1; x++)
- {
- mask->pixel[(y * mask->width) + x] = apply_mask_fudge_factor(mask->pixel[(y * mask->width) + x]);
- }
- }
-
- max_mask_size = current_pass + 1; /* As a side-effect, we now know the maximum mask size, which we'll use to generate our masks. */
- max_mask_size = apply_mask_fudge_factor(max_mask_size); /* Apply the fudge factor to this number too, since we must
- ensure that enough masks are generated. */
- vf->priv->max_mask_size = max_mask_size; /* Commit the newly calculated max_mask_size to the vf->priv struct. */
-
- return;
-}
-
-/**
- * \brief Our blurring function.
- *
- * \param vf Stores persistant data. In this function we are interested in the
- * array of masks.
- * \param value_out The properly blurred and delogoed pixel is outputted here.
- * \param logo_mask Tells us which pixels are in the logo and which aren't.
- * \param image The image that is having its logo removed.
- * \param x x-coordinate of the pixel to blur.
- * \param y y-coordinate of the pixel to blur.
- * \param plane 0 = luma, 1 = blue chroma, 2 = red chroma (YUV).
- *
- * This function is the core of the filter. It takes a pixel that is inside the
- * logo and blurs it. It does so by finding the average of all the pixels within
- * the mask and outside of the logo.
- */
-static void get_blur(const vf_instance_t * const vf, unsigned int * const value_out, const pgm_structure * const logo_mask,
- const mp_image_t * const image, const int x, const int y, const int plane)
-{
- int mask_size; /* Mask size tells how large a circle to use. The radius is about (slightly larger than) mask size. */
- /* Get values from vf->priv for faster dereferencing. */
- int * * * mask = vf->priv->mask;
-
- int start_posx, start_posy, end_posx, end_posy;
- int i, j;
- unsigned int accumulator = 0, divisor = 0;
- const unsigned char * mask_read_position; /* What pixel we are reading out of the circular blur mask. */
- const unsigned char * logo_mask_read_position; /* What pixel we are reading out of the filter image. */
-
- /* Prepare our bounding rectangle and clip it if need be. */
- mask_size = test_filter(logo_mask, x, y);
- start_posx = max(0, x - mask_size);
- start_posy = max(0, y - mask_size);
- end_posx = min(image->width - 1, x + mask_size);
- end_posy = min(image->height - 1, y + mask_size);
-
- mask_read_position = image->planes[plane] + (image->stride[plane] * start_posy) + start_posx;
- logo_mask_read_position = logo_mask->pixel + (start_posy * logo_mask->width) + start_posx;
-
- for (j = start_posy; j <= end_posy; j++)
- {
- for (i = start_posx; i <= end_posx; i++)
- {
- if (!(*logo_mask_read_position) && mask[mask_size][i - start_posx][j - start_posy])
- { /* Check to see if this pixel is in the logo or not. Only use the pixel if it is not. */
- accumulator += *mask_read_position;
- divisor++;
- }
-
- mask_read_position++;
- logo_mask_read_position++;
- }
-
- mask_read_position += (image->stride[plane] - ((end_posx + 1) - start_posx));
- logo_mask_read_position += (logo_mask->width - ((end_posx + 1) - start_posx));
- }
-
- if (divisor == 0) /* This means that not a single pixel is outside of the logo, so we have no data. */
- { /* We should put some eye catching value here, to indicate the flaw to the user. */
- *value_out = 255;
- }
- else /* Else we need to normalise the data using the divisor. */
- {
- *value_out = (accumulator + (divisor / 2)) / divisor; /* Divide, taking into account average rounding error. */
- }
-
- return;
-}
-
-/**
- * \brief Free a pgm_structure. Undoes load_pgm(...).
- */
-static void destroy_pgm(pgm_structure * to_be_destroyed)
-{
- if (to_be_destroyed == NULL)
- return; /* Don't do anything if a NULL pointer was passed it. */
-
- /* Internally allocated memory. */
- if (to_be_destroyed->pixel != NULL)
- {
- free(to_be_destroyed->pixel);
- to_be_destroyed->pixel = NULL;
- }
-
- /* Free the actual struct instance. This is done here and not by the calling function. */
- free(to_be_destroyed);
-}
-
-/** \brief Helper function for load_pgm(...) to skip whitespace. */
-static void load_pgm_skip(FILE *f) {
- int c, comment = 0;
- do {
- c = fgetc(f);
- if (c == '#')
- comment = 1;
- if (c == '\n')
- comment = 0;
- } while (c != EOF && (isspace(c) || comment));
- ungetc(c, f);
-}
-
-#define REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE(message) {mp_msg(MSGT_VFILTER, MSGL_ERR, message); return NULL;}
-
-/**
- * \brief Loads a raw pgm or ppm file into a newly created pgm_structure object.
- *
- * \param file_name The name of the file to be loaded. So long as the file is a
- * valid pgm or ppm file, it will load correctly, even if the
- * extension is missing or invalid.
- *
- * \return A pointer to the newly created pgm_structure object. Don't forget to
- * call destroy_pgm(...) when you're done with this. If an error occurs,
- * NULL is returned.
- *
- * Can load either raw pgm (P5) or raw ppm (P6) image files as a binary image.
- * While a pgm file will be loaded normally (greyscale), the only thing that is
- * guaranteed with ppm is that all zero (R = 0, G = 0, B = 0) pixels will remain
- * zero, and non-zero pixels will remain non-zero.
- */
-static pgm_structure * load_pgm(const char * file_name)
-{
- int maximum_greyscale_value;
- FILE * input;
- int pnm_number;
- pgm_structure * new_pgm = (pgm_structure *) safe_malloc (sizeof(pgm_structure));
- char * write_position;
- char * end_position;
- int image_size; /* width * height */
-
- if((input = fopen(file_name, "rb")) == NULL) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Unable to open file. File not found or insufficient permissions.\n");
-
- /* Parse the PGM header. */
- if (fgetc(input) != 'P') REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: File is not a valid PGM or PPM file.\n");
- pnm_number = fgetc(input) - '0';
- if (pnm_number != 5 && pnm_number != 6) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PNM file. Only raw PGM (Portable Gray Map) and raw PPM (Portable Pixel Map) subtypes are allowed.\n");
- load_pgm_skip(input);
- if (fscanf(input, "%i", &(new_pgm->width)) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
- load_pgm_skip(input);
- if (fscanf(input, "%i", &(new_pgm->height)) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
- load_pgm_skip(input);
- if (fscanf(input, "%i", &maximum_greyscale_value) != 1) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove-logo: Invalid PGM/PPM header.\n");
- if (maximum_greyscale_value >= 256) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove_logo: Only 1 byte per pixel (pgm) or 1 byte per color value (ppm) are supported.\n");
- load_pgm_skip(input);
-
- new_pgm->pixel = (unsigned char *) safe_malloc (sizeof(unsigned char) * new_pgm->width * new_pgm->height);
-
- /* Load the pixels. */
- /* Note: I am aware that fgetc(input) isn't the fastest way of doing things, but it is quite compact and the code only runs once when the filter is initialized.*/
- image_size = new_pgm->width * new_pgm->height;
- end_position = new_pgm->pixel + image_size;
- for (write_position = new_pgm->pixel; write_position < end_position; write_position++)
- {
- *write_position = fgetc(input);
- if (pnm_number == 6) /* This tests to see if the file is a PPM file. */
- { /* If it is, then consider the pixel set if any of the three color channels are set. Since we just care about == 0 or != 0, a bitwise or will do the trick. */
- *write_position |= fgetc(input);
- *write_position |= fgetc(input);
- }
- }
-
- return new_pgm;
-}
-
-/**
- * \brief Generates a scaled down image with half width, height, and intensity.
- *
- * \param vf Our struct for persistant data. In this case, it is used to update
- * mask_max_size with the larger of the old or new value.
- * \param input_image The image from which the new half-sized one will be based.
- *
- * \return The newly allocated and shrunken image.
- *
- * This function not only scales down an image, but halves the value in each pixel
- * too. The purpose of this is to produce a chroma filter image out of a luma
- * filter image. The pixel values store the distance to the edge of the logo and
- * halving the dimensions halves the distance. This function rounds up, because
- * a downwards rounding error could cause the filter to fail, but an upwards
- * rounding error will only cause a minor amount of excess blur in the chroma
- * planes.
- */
-static pgm_structure * generate_half_size_image(vf_instance_t * vf, pgm_structure * input_image)
-{
- int x, y;
- pgm_structure * new_pgm = (pgm_structure *) safe_malloc (sizeof(pgm_structure));
- int has_anything_changed = 1;
- int current_pass;
- int max_mask_size;
- char * current_pixel;
-
- new_pgm->width = input_image->width / 2;
- new_pgm->height = input_image->height / 2;
- new_pgm->pixel = (unsigned char *) safe_malloc (sizeof(unsigned char) * new_pgm->width * new_pgm->height);
-
- /* Copy over the image data, using the average of 4 pixels for to calculate each downsampled pixel. */
- for (y = 0; y < new_pgm->height; y++)
- for (x = 0; x < new_pgm->width; x++)
- {
- /* Set the pixel if there exists a non-zero value in the source pixels, else clear it. */
- new_pgm->pixel[(y * new_pgm->width) + x] = input_image->pixel[((y << 1) * input_image->width) + (x << 1)] ||
- input_image->pixel[((y << 1) * input_image->width) + (x << 1) + 1] ||
- input_image->pixel[(((y << 1) + 1) * input_image->width) + (x << 1)] ||
- input_image->pixel[(((y << 1) + 1) * input_image->width) + (x << 1) + 1];
- new_pgm->pixel[(y * new_pgm->width) + x] = min(1, new_pgm->pixel[(y * new_pgm->width) + x]);
- }
-
- /* Now we need to recalculate the numbers for the smaller size. Just using the old_value / 2 can cause subtle
- and fairly rare, but very nasty, bugs. */
-
- current_pixel = new_pgm->pixel;
- /* First pass, set all non-zero values to 1. */
- for (x = 0; x < new_pgm->height * new_pgm->width; x++, current_pixel++)
- if(*current_pixel) *current_pixel = 1;
-
- /* Second pass and future passes. For each pass, if a pixel is itself the same value as the current pass,
- and its four neighbors are too, then it is incremented. If no pixels are incremented by the end of the pass,
- then we go again. Edge pixels are counted as always excluded (this should be true anyway for any sane mask,
- but if it isn't this will ensure that we eventually exit). */
- current_pass = 0;
- while (has_anything_changed)
- {
- current_pass++;
-
- has_anything_changed = 0; /* If this doesn't get set by the end of this pass, then we're done. */
-
- for (y = 1; y < new_pgm->height - 1; y++)
- {
- for (x = 1; x < new_pgm->width - 1; x++)
- {
- if (new_pgm->pixel[(y * new_pgm->width) + x] >= current_pass && /* By using >= instead of ==, we allow the algorithm to work in place. */
- new_pgm->pixel[(y * new_pgm->width) + (x + 1)] >= current_pass &&
- new_pgm->pixel[(y * new_pgm->width) + (x - 1)] >= current_pass &&
- new_pgm->pixel[((y + 1) * new_pgm->width) + x] >= current_pass &&
- new_pgm->pixel[((y - 1) * new_pgm->width) + x] >= current_pass)
- {
- new_pgm->pixel[(y * new_pgm->width) + x]++; /* Increment the value since it still has not been eroded,
- as evidenced by the if statement that just evaluated to true. */
- has_anything_changed = 1;
- }
- }
- }
- }
-
- for (y = 1; y < new_pgm->height - 1; y++)
- {
- for (x = 1; x < new_pgm->width - 1; x++)
- {
- new_pgm->pixel[(y * new_pgm->width) + x] = apply_mask_fudge_factor(new_pgm->pixel[(y * new_pgm->width) + x]);
- }
- }
-
- max_mask_size = current_pass + 1; /* As a side-effect, we now know the maximum mask size, which we'll use to generate our masks. */
- max_mask_size = apply_mask_fudge_factor(max_mask_size);
- /* Commit the newly calculated max_mask_size to the vf->priv struct. */
- vf->priv->max_mask_size = max(max_mask_size, vf->priv->max_mask_size);
-
- return new_pgm;
-}
-
-/**
- * \brief Checks if YV12 is supported by the next filter.
- */
-static unsigned int find_best(struct vf_instance *vf){
- int is_format_okay = vf->next->query_format(vf->next, IMGFMT_YV12);
- if ((is_format_okay & VFCAP_CSP_SUPPORTED_BY_HW) || (is_format_okay & VFCAP_CSP_SUPPORTED))
- return IMGFMT_YV12;
- else
- return 0;
-}
-
-//===========================================================================//
-
-/**
- * \brief Configure the filter and call the next filter's config function.
- */
-static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
-{
- if(!(vf->priv->fmt=find_best(vf)))
- return 0;
- else
- return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
-}
-
-/**
- * \brief Removes the logo from a plane (either luma or chroma).
- *
- * \param vf Not needed by this function, but needed by the blur function.
- * \param source The image to have it's logo removed.
- * \param destination Where the output image will be stored.
- * \param source_stride How far apart (in memory) two consecutive lines are.
- * \param destination Same as source_stride, but for the destination image.
- * \param width Width of the image. This is the same for source and destination.
- * \param height Height of the image. This is the same for source and destination.
- * \param is_image_direct If the image is direct, then source and destination are
- * the same and we can save a lot of time by not copying pixels that
- * haven't changed.
- * \param filter The image that stores the distance to the edge of the logo for
- * each pixel.
- * \param logo_start_x Smallest x-coordinate that contains at least 1 logo pixel.
- * \param logo_start_y Smallest y-coordinate that contains at least 1 logo pixel.
- * \param logo_end_x Largest x-coordinate that contains at least 1 logo pixel.
- * \param logo_end_y Largest y-coordinate that contains at least 1 logo pixel.
- *
- * This function processes an entire plane. Pixels outside of the logo are copied
- * to the output without change, and pixels inside the logo have the de-blurring
- * function applied.
- */
-static void convert_yv12(const vf_instance_t * const vf, const char * const source, const int source_stride,
- const mp_image_t * const source_image, const int width, const int height,
- char * const destination, const int destination_stride, int is_image_direct, pgm_structure * filter,
- const int plane, const int logo_start_x, const int logo_start_y, const int logo_end_x, const int logo_end_y)
-{
- int y;
- int x;
-
- /* These pointers point to where we are getting our pixel data (inside mpi) and where we are storing it (inside dmpi). */
- const unsigned char * source_line;
- unsigned char * destination_line;
-
- if (!is_image_direct)
- memcpy_pic(destination, source, width, height, destination_stride, source_stride);
-
- for (y = logo_start_y; y <= logo_end_y; y++)
- {
- source_line = (const unsigned char *) source + (source_stride * y);
- destination_line = (unsigned char *) destination + (destination_stride * y);
-
- for (x = logo_start_x; x <= logo_end_x; x++)
- {
- unsigned int output;
-
- if (filter->pixel[(y * filter->width) + x]) /* Only process if we are in the logo. */
- {
- get_blur(vf, &output, filter, source_image, x, y, plane);
- destination_line[x] = output;
- }
- else /* Else just copy the data. */
- if (!is_image_direct)
- destination_line[x] = source_line[x];
- }
- }
-}
-
-/**
- * \brief Process a frame.
- *
- * \param mpi The image sent to use by the previous filter.
- * \param dmpi Where we will store the processed output image.
- * \param vf This is how the filter gets access to it's persistant data.
- *
- * \return The return code of the next filter, or 0 on failure/error.
- *
- * This function processes an entire frame. The frame is sent by the previous
- * filter, has the logo removed by the filter, and is then sent to the next
- * filter.
- */
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- dmpi=vf_get_image(vf->next,vf->priv->fmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w, mpi->h);
-
- /* Check to make sure that the filter image and the video stream are the same size. */
- if (vf->priv->filter->width != mpi->w || vf->priv->filter->height != mpi->h)
- {
- mp_msg(MSGT_VFILTER,MSGL_ERR, "Filter image and video stream are not of the same size. (Filter: %d x %d, Stream: %d x %d)\n",
- vf->priv->filter->width, vf->priv->filter->height, mpi->w, mpi->h);
- return 0;
- }
-
- switch(dmpi->imgfmt){
- case IMGFMT_YV12:
- convert_yv12(vf, mpi->planes[0], mpi->stride[0], mpi, mpi->w, mpi->h,
- dmpi->planes[0], dmpi->stride[0],
- mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->filter, 0,
- vf->priv->bounding_rectangle_posx1, vf->priv->bounding_rectangle_posy1,
- vf->priv->bounding_rectangle_posx2, vf->priv->bounding_rectangle_posy2);
- convert_yv12(vf, mpi->planes[1], mpi->stride[1], mpi, mpi->w / 2, mpi->h / 2,
- dmpi->planes[1], dmpi->stride[1],
- mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->half_size_filter, 1,
- vf->priv->bounding_rectangle_half_size_posx1, vf->priv->bounding_rectangle_half_size_posy1,
- vf->priv->bounding_rectangle_half_size_posx2, vf->priv->bounding_rectangle_half_size_posy2);
- convert_yv12(vf, mpi->planes[2], mpi->stride[2], mpi, mpi->w / 2, mpi->h / 2,
- dmpi->planes[2], dmpi->stride[2],
- mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->half_size_filter, 2,
- vf->priv->bounding_rectangle_half_size_posx1, vf->priv->bounding_rectangle_half_size_posy1,
- vf->priv->bounding_rectangle_half_size_posx2, vf->priv->bounding_rectangle_half_size_posy2);
- break;
-
- default:
- mp_msg(MSGT_VFILTER,MSGL_ERR,"Unhandled format: 0x%X\n",dmpi->imgfmt);
- return 0;
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-/**
- * \brief Checks to see if the next filter accepts YV12 images.
- */
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- if (fmt == IMGFMT_YV12)
- return vf->next->query_format(vf->next, IMGFMT_YV12);
- else
- return 0;
-}
-
-/**
- * \brief Frees memory that our filter allocated.
- *
- * This is called at exit-time.
- */
-static void uninit(vf_instance_t *vf)
-{
- /* Destroy our masks and images. */
- destroy_pgm(vf->priv->filter);
- destroy_pgm(vf->priv->half_size_filter);
- destroy_masks(vf);
-
- /* Destroy our private structure that had been used to store those masks and images. */
- free(vf->priv);
-
- return;
-}
-
-/**
- * \brief Initializes our filter.
- *
- * \param args The arguments passed in from the command line go here. This
- * filter expects only a single argument telling it where the PGM
- * or PPM file that describes the logo region is.
- *
- * This sets up our instance variables and parses the arguments to the filter.
- */
-static int vf_open(vf_instance_t *vf, char *args)
-{
- vf->priv = safe_malloc(sizeof(vf_priv_s));
- vf->uninit = uninit;
-
- /* Load our filter image. */
- if (args)
- vf->priv->filter = load_pgm(args);
- else
- {
- mp_msg(MSGT_VFILTER, MSGL_ERR, "[vf]remove_logo usage: remove_logo=/path/to/filter_image_file.pgm\n");
- free(vf->priv);
- return 0;
- }
-
- if (vf->priv->filter == NULL)
- {
- /* Error message was displayed by load_pgm(). */
- free(vf->priv);
- return 0;
- }
-
- /* Create the scaled down filter image for the chroma planes. */
- convert_mask_to_strength_mask(vf, vf->priv->filter);
- vf->priv->half_size_filter = generate_half_size_image(vf, vf->priv->filter);
-
- /* Now that we know how many masks we need (the info is in vf), we can generate the masks. */
- initialize_masks(vf);
-
- /* Calculate our bounding rectangles, which determine in what region the logo resides for faster processing. */
- calculate_bounding_rectangle(&vf->priv->bounding_rectangle_posx1, &vf->priv->bounding_rectangle_posy1,
- &vf->priv->bounding_rectangle_posx2, &vf->priv->bounding_rectangle_posy2,
- vf->priv->filter);
- calculate_bounding_rectangle(&vf->priv->bounding_rectangle_half_size_posx1,
- &vf->priv->bounding_rectangle_half_size_posy1,
- &vf->priv->bounding_rectangle_half_size_posx2,
- &vf->priv->bounding_rectangle_half_size_posy2,
- vf->priv->half_size_filter);
-
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- return 1;
-}
-
-/**
- * \brief Meta data about our filter.
- */
-const vf_info_t vf_info_remove_logo = {
- "Removes a tv logo based on a mask image.",
- "remove-logo",
- "Robert Edele",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_rgbtest.c b/libmpcodecs/vf_rgbtest.c
deleted file mode 100644
index 9179934175..0000000000
--- a/libmpcodecs/vf_rgbtest.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-//===========================================================================//
-
-struct vf_priv_s {
- unsigned int fmt;
- int w, h;
-};
-
-static unsigned int getfmt(unsigned int outfmt){
- switch(outfmt){
- case IMGFMT_RGB12:
- case IMGFMT_RGB15:
- case IMGFMT_RGB16:
- case IMGFMT_RGB24:
- case IMGFMT_RGBA:
- case IMGFMT_ARGB:
- case IMGFMT_BGR12:
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGRA:
- case IMGFMT_ABGR:
- return outfmt;
- }
- return 0;
-}
-
-static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int b, int fmt){
- switch(fmt){
- case IMGFMT_BGR12: ((uint16_t*)(buf + y*stride))[x]=
- ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4);
- break;
- case IMGFMT_RGB12: ((uint16_t*)(buf + y*stride))[x]=
- ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4);
- break;
- case IMGFMT_BGR15: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<10) | ((g>>3)<<5) | (b>>3);
- break;
- case IMGFMT_RGB15: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<10) | ((g>>3)<<5) | (r>>3);
- break;
- case IMGFMT_BGR16: ((uint16_t*)(buf + y*stride))[x]= ((r>>3)<<11) | ((g>>2)<<5) | (b>>3);
- break;
- case IMGFMT_RGB16: ((uint16_t*)(buf + y*stride))[x]= ((b>>3)<<11) | ((g>>2)<<5) | (r>>3);
- break;
- case IMGFMT_RGB24:
- buf[3*x + y*stride + 0]= r;
- buf[3*x + y*stride + 1]= g;
- buf[3*x + y*stride + 2]= b;
- break;
- case IMGFMT_BGR24:
- buf[3*x + y*stride + 0]= b;
- buf[3*x + y*stride + 1]= g;
- buf[3*x + y*stride + 2]= r;
- break;
- case IMGFMT_RGBA:
- buf[4*x + y*stride + 0]= r;
- buf[4*x + y*stride + 1]= g;
- buf[4*x + y*stride + 2]= b;
- break;
- case IMGFMT_BGRA:
- buf[4*x + y*stride + 0]= b;
- buf[4*x + y*stride + 1]= g;
- buf[4*x + y*stride + 2]= r;
- break;
- case IMGFMT_ARGB:
- buf[4*x + y*stride + 1]= r;
- buf[4*x + y*stride + 2]= g;
- buf[4*x + y*stride + 3]= b;
- break;
- case IMGFMT_ABGR:
- buf[4*x + y*stride + 1]= b;
- buf[4*x + y*stride + 2]= g;
- buf[4*x + y*stride + 3]= r;
- break;
- }
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- if (vf->priv->w > 0) { d_width = width = vf->priv->w; }
- if (vf->priv->h > 0) { d_height = height = vf->priv->h; }
- vf->priv->fmt=getfmt(outfmt);
- mp_msg(MSGT_VFILTER,MSGL_V,"rgb test format:%s\n", vo_format_name(outfmt));
- return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int x, y;
- int w = vf->priv->w > 0 ? vf->priv->w : mpi->w;
- int h = vf->priv->h > 0 ? vf->priv->h : mpi->h;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,vf->priv->fmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- w, h);
-
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int c= 256*x/w;
- int r=0,g=0,b=0;
-
- if(3*y<h) r=c;
- else if(3*y<2*h) g=c;
- else b=c;
-
- put_pixel(dmpi->planes[0], x, y, dmpi->stride[0], r, g, b, vf->priv->fmt);
- }
- }
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int outfmt){
- unsigned int fmt=getfmt(outfmt);
- if(!fmt) return 0;
- return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- vf->priv->w = vf->priv->h = 0;
- if (args)
- sscanf(args, "%d:%d", &vf->priv->w, &vf->priv->h);
- return 1;
-}
-
-const vf_info_t vf_info_rgbtest = {
- "rgbtest",
- "rgbtest",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c
deleted file mode 100644
index 649c3ccc43..0000000000
--- a/libmpcodecs/vf_sab.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include <libavutil/mem.h>
-#include <libavutil/common.h>
-#include <libswscale/swscale.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "vf_scale.h"
-
-
-//===========================================================================//
-
-typedef struct FilterParam{
- float radius;
- float preFilterRadius;
- float strength;
- float quality;
- struct SwsContext *preFilterContext;
- uint8_t *preFilterBuf;
- int preFilterStride;
- int distWidth;
- int distStride;
- int *distCoeff;
- int colorDiffCoeff[512];
-}FilterParam;
-
-struct vf_priv_s {
- FilterParam luma;
- FilterParam chroma;
-};
-
-
-/***************************************************************************/
-
-static int allocStuff(FilterParam *f, int width, int height){
- int stride= (width+7)&~7;
- SwsVector *vec;
- SwsFilter swsF;
- int i,x,y;
- f->preFilterBuf= av_malloc(stride*height);
- f->preFilterStride= stride;
-
- vec = sws_getGaussianVec(f->preFilterRadius, f->quality);
- swsF.lumH= swsF.lumV= vec;
- swsF.chrH= swsF.chrV= NULL;
- f->preFilterContext= sws_getContext(
- width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_POINT, &swsF, NULL, NULL);
-
- sws_freeVec(vec);
- vec = sws_getGaussianVec(f->strength, 5.0);
- for(i=0; i<512; i++){
- double d;
- int index= i-256 + vec->length/2;
-
- if(index<0 || index>=vec->length) d= 0.0;
- else d= vec->coeff[index];
-
- f->colorDiffCoeff[i]= (int)(d/vec->coeff[vec->length/2]*(1<<12) + 0.5);
- }
- sws_freeVec(vec);
- vec = sws_getGaussianVec(f->radius, f->quality);
- f->distWidth= vec->length;
- f->distStride= (vec->length+7)&~7;
- f->distCoeff= av_malloc(f->distWidth*f->distStride*sizeof(int32_t));
-
- for(y=0; y<vec->length; y++){
- for(x=0; x<vec->length; x++){
- double d= vec->coeff[x] * vec->coeff[y];
-
- f->distCoeff[x + y*f->distStride]= (int)(d*(1<<10) + 0.5);
-// if(y==vec->length/2)
-// printf("%6d ", f->distCoeff[x + y*f->distStride]);
- }
- }
- sws_freeVec(vec);
-
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- int sw, sh;
-//__asm__ volatile("emms\n\t");
- allocStuff(&vf->priv->luma, width, height);
-
- mp_get_chroma_shift(outfmt, &sw, &sh, NULL);
- allocStuff(&vf->priv->chroma, width>>sw, height>>sh);
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void freeBuffers(FilterParam *f){
- if(f->preFilterContext) sws_freeContext(f->preFilterContext);
- f->preFilterContext=NULL;
-
- av_free(f->preFilterBuf);
- f->preFilterBuf=NULL;
-
- av_free(f->distCoeff);
- f->distCoeff=NULL;
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
- freeBuffers(&vf->priv->luma);
- freeBuffers(&vf->priv->chroma);
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, FilterParam *fp){
- int x, y;
- FilterParam f= *fp;
- const int radius= f.distWidth/2;
- const uint8_t* const srcArray[MP_MAX_PLANES] = {src};
- uint8_t *dstArray[MP_MAX_PLANES]= {f.preFilterBuf};
- int srcStrideArray[MP_MAX_PLANES]= {srcStride};
- int dstStrideArray[MP_MAX_PLANES]= {f.preFilterStride};
-
-// f.preFilterContext->swScale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray);
- sws_scale(f.preFilterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray);
-
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- int sum=0;
- int div=0;
- int dy;
- const int preVal= f.preFilterBuf[x + y*f.preFilterStride];
-#if 0
- const int srcVal= src[x + y*srcStride];
-if((x/32)&1){
- dst[x + y*dstStride]= srcVal;
- if(y%32==0) dst[x + y*dstStride]= 0;
- continue;
-}
-#endif
- if(x >= radius && x < w - radius){
- for(dy=0; dy<radius*2+1; dy++){
- int dx;
- int iy= y+dy - radius;
- if (iy<0) iy= -iy;
- else if(iy>=h) iy= h+h-iy-1;
-
- for(dx=0; dx<radius*2+1; dx++){
- const int ix= x+dx - radius;
- int factor;
-
- factor= f.colorDiffCoeff[256+preVal - f.preFilterBuf[ix + iy*f.preFilterStride] ]
- *f.distCoeff[dx + dy*f.distStride];
- sum+= src[ix + iy*srcStride] *factor;
- div+= factor;
- }
- }
- }else{
- for(dy=0; dy<radius*2+1; dy++){
- int dx;
- int iy= y+dy - radius;
- if (iy<0) iy= -iy;
- else if(iy>=h) iy= h+h-iy-1;
-
- for(dx=0; dx<radius*2+1; dx++){
- int ix= x+dx - radius;
- int factor;
- if (ix<0) ix= -ix;
- else if(ix>=w) ix= w+w-ix-1;
-
- factor= f.colorDiffCoeff[256+preVal - f.preFilterBuf[ix + iy*f.preFilterStride] ]
- *f.distCoeff[dx + dy*f.distStride];
- sum+= src[ix + iy*srcStride] *factor;
- div+= factor;
- }
- }
- }
- dst[x + y*dstStride]= (sum + div/2)/div;
- }
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
-
- mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->w,mpi->h);
-
- assert(mpi->flags&MP_IMGFLAG_PLANAR);
-
- blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma);
- blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma);
- blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt)
- {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YVU9:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- int e;
-
- vf->config=config;
- vf->put_image=put_image;
-// vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if(args==NULL) return 0;
-
- e=sscanf(args, "%f:%f:%f:%f:%f:%f",
- &vf->priv->luma.radius,
- &vf->priv->luma.preFilterRadius,
- &vf->priv->luma.strength,
- &vf->priv->chroma.radius,
- &vf->priv->chroma.preFilterRadius,
- &vf->priv->chroma.strength
- );
-
- vf->priv->luma.quality = vf->priv->chroma.quality= 3.0;
-
- if(e==3){
- vf->priv->chroma.radius= vf->priv->luma.radius;
- vf->priv->chroma.preFilterRadius = vf->priv->luma.preFilterRadius;
- vf->priv->chroma.strength= vf->priv->luma.strength;
- }else if(e!=6)
- return 0;
-
-// if(vf->priv->luma.radius < 0) return 0;
-// if(vf->priv->chroma.radius < 0) return 0;
-
- return 1;
-}
-
-const vf_info_t vf_info_sab = {
- "shape adaptive blur",
- "sab",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c
deleted file mode 100644
index da6f3547bf..0000000000
--- a/libmpcodecs/vf_smartblur.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include <stdbool.h>
-
-#include "mp_msg.h"
-#include "libavutil/avutil.h"
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libswscale/swscale.h"
-#include "vf_scale.h"
-
-//===========================================================================//
-
-typedef struct FilterParam{
- float radius;
- float strength;
- int threshold;
- float quality;
- struct SwsContext *filterContext;
-}FilterParam;
-
-struct vf_priv_s {
- FilterParam luma;
- FilterParam chroma;
-};
-
-
-/***************************************************************************/
-
-static int allocStuff(FilterParam *f, int width, int height){
- SwsVector *vec;
- SwsFilter swsF;
-
- vec = sws_getGaussianVec(f->radius, f->quality);
- sws_scaleVec(vec, f->strength);
- vec->coeff[vec->length/2]+= 1.0 - f->strength;
- swsF.lumH= swsF.lumV= vec;
- swsF.chrH= swsF.chrV= NULL;
- f->filterContext= sws_getContext(
- width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_BICUBIC, &swsF, NULL, NULL);
-
- sws_freeVec(vec);
-
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- int sw, sh;
-
- allocStuff(&vf->priv->luma, width, height);
-
- mp_get_chroma_shift(outfmt, &sw, &sh, NULL);
- allocStuff(&vf->priv->chroma, width>>sw, height>>sh);
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void freeBuffers(FilterParam *f){
- if(f->filterContext) sws_freeContext(f->filterContext);
- f->filterContext=NULL;
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
- freeBuffers(&vf->priv->luma);
- freeBuffers(&vf->priv->chroma);
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int srcStride, FilterParam *fp){
- int x, y;
- FilterParam f= *fp;
- const uint8_t* const srcArray[MP_MAX_PLANES] = {src};
- uint8_t *dstArray[MP_MAX_PLANES]= {dst};
- int srcStrideArray[MP_MAX_PLANES]= {srcStride};
- int dstStrideArray[MP_MAX_PLANES]= {dstStride};
-
- sws_scale(f.filterContext, srcArray, srcStrideArray, 0, h, dstArray, dstStrideArray);
-
- if(f.threshold > 0){
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- const int orig= src[x + y*srcStride];
- const int filtered= dst[x + y*dstStride];
- const int diff= orig - filtered;
-
- if(diff > 0){
- if(diff > 2*f.threshold){
- dst[x + y*dstStride]= orig;
- }else if(diff > f.threshold){
- dst[x + y*dstStride]= filtered + diff - f.threshold;
- }
- }else{
- if(-diff > 2*f.threshold){
- dst[x + y*dstStride]= orig;
- }else if(-diff > f.threshold){
- dst[x + y*dstStride]= filtered + diff + f.threshold;
- }
- }
- }
- }
- }else if(f.threshold < 0){
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- const int orig= src[x + y*srcStride];
- const int filtered= dst[x + y*dstStride];
- const int diff= orig - filtered;
-
- if(diff > 0){
- if(diff > -2*f.threshold){
- }else if(diff > -f.threshold){
- dst[x + y*dstStride]= orig - diff - f.threshold;
- }else
- dst[x + y*dstStride]= orig;
- }else{
- if(diff < 2*f.threshold){
- }else if(diff < f.threshold){
- dst[x + y*dstStride]= orig - diff + f.threshold;
- }else
- dst[x + y*dstStride]= orig;
- }
- }
- }
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int cw= mpi->w >> mpi->chroma_x_shift;
- int ch= mpi->h >> mpi->chroma_y_shift;
- bool threshold = vf->priv->luma.threshold || vf->priv->chroma.threshold;
-
- mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|
- (threshold ? MP_IMGFLAG_READABLE : 0),
- mpi->w,mpi->h);
-
- assert(mpi->flags&MP_IMGFLAG_PLANAR);
-
- blur(dmpi->planes[0], mpi->planes[0], mpi->w,mpi->h, dmpi->stride[0], mpi->stride[0], &vf->priv->luma);
- blur(dmpi->planes[1], mpi->planes[1], cw , ch , dmpi->stride[1], mpi->stride[1], &vf->priv->chroma);
- blur(dmpi->planes[2], mpi->planes[2], cw , ch , dmpi->stride[2], mpi->stride[2], &vf->priv->chroma);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt)
- {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_YVU9:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- int e;
-
- vf->config=config;
- vf->put_image=put_image;
-// vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- if(args==NULL) return 0;
-
- e=sscanf(args, "%f:%f:%d:%f:%f:%d",
- &vf->priv->luma.radius,
- &vf->priv->luma.strength,
- &vf->priv->luma.threshold,
- &vf->priv->chroma.radius,
- &vf->priv->chroma.strength,
- &vf->priv->chroma.threshold
- );
-
- vf->priv->luma.quality = vf->priv->chroma.quality= 3.0;
-
- if(e==3){
- vf->priv->chroma.radius= vf->priv->luma.radius;
- vf->priv->chroma.strength= vf->priv->luma.strength;
- vf->priv->chroma.threshold = vf->priv->luma.threshold;
- }else if(e!=6)
- return 0;
-
- return 1;
-}
-
-const vf_info_t vf_info_smartblur = {
- "smart blur",
- "smartblur",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_softskip.c b/libmpcodecs/vf_softskip.c
deleted file mode 100644
index fe572cb0b0..0000000000
--- a/libmpcodecs/vf_softskip.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- int skipflag;
-};
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
-
- if (vf->priv->skipflag)
- return vf->priv->skipflag = 0;
-
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_EXPORT, 0, mpi->width, mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
-
- dmpi->planes[0] = mpi->planes[0];
- dmpi->stride[0] = mpi->stride[0];
- if (dmpi->flags&MP_IMGFLAG_PLANAR) {
- dmpi->planes[1] = mpi->planes[1];
- dmpi->stride[1] = mpi->stride[1];
- dmpi->planes[2] = mpi->planes[2];
- dmpi->stride[2] = mpi->stride[2];
- }
-
- return vf_next_put_image(vf, dmpi, pts);
-}
-
-static int control(struct vf_instance *vf, int request, void* data)
-{
- switch (request) {
- case VFCTRL_SKIP_NEXT_FRAME:
- vf->priv->skipflag = 1;
- return CONTROL_TRUE;
- }
- return vf_next_control(vf, request, data);
-}
-
-#if 0
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - figure out which other formats work */
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-#endif
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- vf->put_image = put_image;
- vf->control = control;
- vf->uninit = uninit;
- vf->priv = calloc(1, sizeof(struct vf_priv_s));
- return 1;
-}
-
-const vf_info_t vf_info_softskip = {
- "soft (post-filter) frame skipping for encoding",
- "softskip",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
deleted file mode 100644
index e0c1e64449..0000000000
--- a/libmpcodecs/vf_spp.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/*
- * This implementation is based on an algorithm described in
- * "Aria Nosratinia Embedded Post-Processing for
- * Enhancement of Compressed Images (1999)"
- * (http://citeseer.nj.nec.com/nosratinia99embedded.html)
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-
-#include "config.h"
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-
-#define XMIN(a,b) ((a) < (b) ? (a) : (b))
-
-//===========================================================================//
-static const uint8_t __attribute__((aligned(8))) dither[8][8]={
-{ 0, 48, 12, 60, 3, 51, 15, 63, },
-{ 32, 16, 44, 28, 35, 19, 47, 31, },
-{ 8, 56, 4, 52, 11, 59, 7, 55, },
-{ 40, 24, 36, 20, 43, 27, 39, 23, },
-{ 2, 50, 14, 62, 1, 49, 13, 61, },
-{ 34, 18, 46, 30, 33, 17, 45, 29, },
-{ 10, 58, 6, 54, 9, 57, 5, 53, },
-{ 42, 26, 38, 22, 41, 25, 37, 21, },
-};
-
-static const uint8_t offset[127][2]= {
-{0,0},
-{0,0}, {4,4},
-{0,0}, {2,2}, {6,4}, {4,6},
-{0,0}, {5,1}, {2,2}, {7,3}, {4,4}, {1,5}, {6,6}, {3,7},
-
-{0,0}, {4,0}, {1,1}, {5,1}, {3,2}, {7,2}, {2,3}, {6,3},
-{0,4}, {4,4}, {1,5}, {5,5}, {3,6}, {7,6}, {2,7}, {6,7},
-
-{0,0}, {0,2}, {0,4}, {0,6}, {1,1}, {1,3}, {1,5}, {1,7},
-{2,0}, {2,2}, {2,4}, {2,6}, {3,1}, {3,3}, {3,5}, {3,7},
-{4,0}, {4,2}, {4,4}, {4,6}, {5,1}, {5,3}, {5,5}, {5,7},
-{6,0}, {6,2}, {6,4}, {6,6}, {7,1}, {7,3}, {7,5}, {7,7},
-
-{0,0}, {4,4}, {0,4}, {4,0}, {2,2}, {6,6}, {2,6}, {6,2},
-{0,2}, {4,6}, {0,6}, {4,2}, {2,0}, {6,4}, {2,4}, {6,0},
-{1,1}, {5,5}, {1,5}, {5,1}, {3,3}, {7,7}, {3,7}, {7,3},
-{1,3}, {5,7}, {1,7}, {5,3}, {3,1}, {7,5}, {3,5}, {7,1},
-{0,1}, {4,5}, {0,5}, {4,1}, {2,3}, {6,7}, {2,7}, {6,3},
-{0,3}, {4,7}, {0,7}, {4,3}, {2,1}, {6,5}, {2,5}, {6,1},
-{1,0}, {5,4}, {1,4}, {5,0}, {3,2}, {7,6}, {3,6}, {7,2},
-{1,2}, {5,6}, {1,6}, {5,2}, {3,0}, {7,4}, {3,4}, {7,0},
-};
-
-struct vf_priv_s {
- int log2_count;
- int qp;
- int mode;
- int mpeg2;
- int temp_stride;
- uint8_t *src;
- int16_t *temp;
- AVCodecContext *avctx;
- DSPContext dsp;
- char *non_b_qp;
-};
-
-#define SHIFT 22
-
-static void hardthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
- int i;
- int bias= 0; //FIXME
- unsigned int threshold1, threshold2;
-
- threshold1= qp*((1<<4) - bias) - 1;
- threshold2= (threshold1<<1);
-
- memset(dst, 0, 64*sizeof(DCTELEM));
- dst[0]= (src[0] + 4)>>3;
-
- for(i=1; i<64; i++){
- int level= src[i];
- if(((unsigned)(level+threshold1))>threshold2){
- const int j= permutation[i];
- dst[j]= (level + 4)>>3;
- }
- }
-}
-
-static void softthresh_c(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
- int i;
- int bias= 0; //FIXME
- unsigned int threshold1, threshold2;
-
- threshold1= qp*((1<<4) - bias) - 1;
- threshold2= (threshold1<<1);
-
- memset(dst, 0, 64*sizeof(DCTELEM));
- dst[0]= (src[0] + 4)>>3;
-
- for(i=1; i<64; i++){
- int level= src[i];
- if(((unsigned)(level+threshold1))>threshold2){
- const int j= permutation[i];
- if(level>0)
- dst[j]= (level - threshold1 + 4)>>3;
- else
- dst[j]= (level + threshold1 + 4)>>3;
- }
- }
-}
-
-#if HAVE_MMX
-static void hardthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
- int bias= 0; //FIXME
- unsigned int threshold1;
-
- threshold1= qp*((1<<4) - bias) - 1;
-
- __asm__ volatile(
-#define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \
- "movq " #src0 ", %%mm0 \n\t"\
- "movq " #src1 ", %%mm1 \n\t"\
- "movq " #src2 ", %%mm2 \n\t"\
- "movq " #src3 ", %%mm3 \n\t"\
- "psubw %%mm4, %%mm0 \n\t"\
- "psubw %%mm4, %%mm1 \n\t"\
- "psubw %%mm4, %%mm2 \n\t"\
- "psubw %%mm4, %%mm3 \n\t"\
- "paddusw %%mm5, %%mm0 \n\t"\
- "paddusw %%mm5, %%mm1 \n\t"\
- "paddusw %%mm5, %%mm2 \n\t"\
- "paddusw %%mm5, %%mm3 \n\t"\
- "paddw %%mm6, %%mm0 \n\t"\
- "paddw %%mm6, %%mm1 \n\t"\
- "paddw %%mm6, %%mm2 \n\t"\
- "paddw %%mm6, %%mm3 \n\t"\
- "psubusw %%mm6, %%mm0 \n\t"\
- "psubusw %%mm6, %%mm1 \n\t"\
- "psubusw %%mm6, %%mm2 \n\t"\
- "psubusw %%mm6, %%mm3 \n\t"\
- "psraw $3, %%mm0 \n\t"\
- "psraw $3, %%mm1 \n\t"\
- "psraw $3, %%mm2 \n\t"\
- "psraw $3, %%mm3 \n\t"\
-\
- "movq %%mm0, %%mm7 \n\t"\
- "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\
- "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\
- "movq %%mm1, %%mm2 \n\t"\
- "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\
- "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\
- "movq %%mm0, %%mm3 \n\t"\
- "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\
- "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\
- "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\
- "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\
-\
- "movq %%mm0, " #dst0 " \n\t"\
- "movq %%mm7, " #dst1 " \n\t"\
- "movq %%mm3, " #dst2 " \n\t"\
- "movq %%mm1, " #dst3 " \n\t"
-
- "movd %2, %%mm4 \n\t"
- "movd %3, %%mm5 \n\t"
- "movd %4, %%mm6 \n\t"
- "packssdw %%mm4, %%mm4 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- "packssdw %%mm4, %%mm4 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "packssdw %%mm6, %%mm6 \n\t"
- REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0))
- REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0))
- REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0))
- REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0))
- : : "r" (src), "r" (dst), "g" (threshold1+1), "g" (threshold1+5), "g" (threshold1-4) //FIXME maybe more accurate then needed?
- );
- dst[0]= (src[0] + 4)>>3;
-}
-
-static void softthresh_mmx(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation){
- int bias= 0; //FIXME
- unsigned int threshold1;
-
- threshold1= qp*((1<<4) - bias) - 1;
-
- __asm__ volatile(
-#undef REQUANT_CORE
-#define REQUANT_CORE(dst0, dst1, dst2, dst3, src0, src1, src2, src3) \
- "movq " #src0 ", %%mm0 \n\t"\
- "movq " #src1 ", %%mm1 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "pcmpgtw %%mm0, %%mm6 \n\t"\
- "pcmpgtw %%mm1, %%mm7 \n\t"\
- "pxor %%mm6, %%mm0 \n\t"\
- "pxor %%mm7, %%mm1 \n\t"\
- "psubusw %%mm4, %%mm0 \n\t"\
- "psubusw %%mm4, %%mm1 \n\t"\
- "pxor %%mm6, %%mm0 \n\t"\
- "pxor %%mm7, %%mm1 \n\t"\
- "movq " #src2 ", %%mm2 \n\t"\
- "movq " #src3 ", %%mm3 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "pcmpgtw %%mm2, %%mm6 \n\t"\
- "pcmpgtw %%mm3, %%mm7 \n\t"\
- "pxor %%mm6, %%mm2 \n\t"\
- "pxor %%mm7, %%mm3 \n\t"\
- "psubusw %%mm4, %%mm2 \n\t"\
- "psubusw %%mm4, %%mm3 \n\t"\
- "pxor %%mm6, %%mm2 \n\t"\
- "pxor %%mm7, %%mm3 \n\t"\
-\
- "paddsw %%mm5, %%mm0 \n\t"\
- "paddsw %%mm5, %%mm1 \n\t"\
- "paddsw %%mm5, %%mm2 \n\t"\
- "paddsw %%mm5, %%mm3 \n\t"\
- "psraw $3, %%mm0 \n\t"\
- "psraw $3, %%mm1 \n\t"\
- "psraw $3, %%mm2 \n\t"\
- "psraw $3, %%mm3 \n\t"\
-\
- "movq %%mm0, %%mm7 \n\t"\
- "punpcklwd %%mm2, %%mm0 \n\t" /*A*/\
- "punpckhwd %%mm2, %%mm7 \n\t" /*C*/\
- "movq %%mm1, %%mm2 \n\t"\
- "punpcklwd %%mm3, %%mm1 \n\t" /*B*/\
- "punpckhwd %%mm3, %%mm2 \n\t" /*D*/\
- "movq %%mm0, %%mm3 \n\t"\
- "punpcklwd %%mm1, %%mm0 \n\t" /*A*/\
- "punpckhwd %%mm7, %%mm3 \n\t" /*C*/\
- "punpcklwd %%mm2, %%mm7 \n\t" /*B*/\
- "punpckhwd %%mm2, %%mm1 \n\t" /*D*/\
-\
- "movq %%mm0, " #dst0 " \n\t"\
- "movq %%mm7, " #dst1 " \n\t"\
- "movq %%mm3, " #dst2 " \n\t"\
- "movq %%mm1, " #dst3 " \n\t"
-
- "movd %2, %%mm4 \n\t"
- "movd %3, %%mm5 \n\t"
- "packssdw %%mm4, %%mm4 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- "packssdw %%mm4, %%mm4 \n\t"
- "packssdw %%mm5, %%mm5 \n\t"
- REQUANT_CORE( (%1), 8(%1), 16(%1), 24(%1), (%0), 8(%0), 64(%0), 72(%0))
- REQUANT_CORE(32(%1), 40(%1), 48(%1), 56(%1),16(%0),24(%0), 48(%0), 56(%0))
- REQUANT_CORE(64(%1), 72(%1), 80(%1), 88(%1),32(%0),40(%0), 96(%0),104(%0))
- REQUANT_CORE(96(%1),104(%1),112(%1),120(%1),80(%0),88(%0),112(%0),120(%0))
- : : "r" (src), "r" (dst), "g" (threshold1), "rm" (4) //FIXME maybe more accurate then needed?
- );
-
- dst[0]= (src[0] + 4)>>3;
-}
-#endif
-
-static inline void add_block(int16_t *dst, int stride, DCTELEM block[64]){
- int y;
-
- for(y=0; y<8; y++){
- *(uint32_t*)&dst[0 + y*stride]+= *(uint32_t*)&block[0 + y*8];
- *(uint32_t*)&dst[2 + y*stride]+= *(uint32_t*)&block[2 + y*8];
- *(uint32_t*)&dst[4 + y*stride]+= *(uint32_t*)&block[4 + y*8];
- *(uint32_t*)&dst[6 + y*stride]+= *(uint32_t*)&block[6 + y*8];
- }
-}
-
-static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){
- int y, x;
-
-#define STORE(pos) \
- temp= ((src[x + y*src_stride + pos]<<log2_scale) + d[pos])>>6;\
- if(temp & 0x100) temp= ~(temp>>31);\
- dst[x + y*dst_stride + pos]= temp;
-
- for(y=0; y<height; y++){
- const uint8_t *d= dither[y];
- for(x=0; x<width; x+=8){
- int temp;
- STORE(0);
- STORE(1);
- STORE(2);
- STORE(3);
- STORE(4);
- STORE(5);
- STORE(6);
- STORE(7);
- }
- }
-}
-
-#if HAVE_MMX
-static void store_slice_mmx(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){
- int y;
-
- for(y=0; y<height; y++){
- uint8_t *dst1= dst;
- int16_t *src1= src;
- __asm__ volatile(
- "movq (%3), %%mm3 \n\t"
- "movq (%3), %%mm4 \n\t"
- "movd %4, %%mm2 \n\t"
- "pxor %%mm0, %%mm0 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t"
- "punpckhbw %%mm0, %%mm4 \n\t"
- "psraw %%mm2, %%mm3 \n\t"
- "psraw %%mm2, %%mm4 \n\t"
- "movd %5, %%mm2 \n\t"
- "1: \n\t"
- "movq (%0), %%mm0 \n\t"
- "movq 8(%0), %%mm1 \n\t"
- "paddw %%mm3, %%mm0 \n\t"
- "paddw %%mm4, %%mm1 \n\t"
- "psraw %%mm2, %%mm0 \n\t"
- "psraw %%mm2, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%1) \n\t"
- "add $16, %0 \n\t"
- "add $8, %1 \n\t"
- "cmp %2, %1 \n\t"
- " jb 1b \n\t"
- : "+r" (src1), "+r"(dst1)
- : "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(6-log2_scale)
- );
- src += src_stride;
- dst += dst_stride;
- }
-// if(width != mmxw)
-// store_slice_c(dst + mmxw, src + mmxw, dst_stride, src_stride, width - mmxw, log2_scale);
-}
-#endif
-
-static void (*store_slice)(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale)= store_slice_c;
-
-static void (*requantize)(DCTELEM dst[64], DCTELEM src[64], int qp, uint8_t *permutation)= hardthresh_c;
-
-static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, uint8_t *qp_store, int qp_stride, int is_luma){
- int x, y, i;
- const int count= 1<<p->log2_count;
- const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
- uint64_t __attribute__((aligned(16))) block_align[32];
- DCTELEM *block = (DCTELEM *)block_align;
- DCTELEM *block2= (DCTELEM *)(block_align+16);
-
- if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
- for(y=0; y<height; y++){
- int index= 8 + 8*stride + y*stride;
- fast_memcpy(p->src + index, src + y*src_stride, width);
- for(x=0; x<8; x++){
- p->src[index - x - 1]= p->src[index + x ];
- p->src[index + width + x ]= p->src[index + width - x - 1];
- }
- }
- for(y=0; y<8; y++){
- fast_memcpy(p->src + ( 7-y)*stride, p->src + ( y+8)*stride, stride);
- fast_memcpy(p->src + (height+8+y)*stride, p->src + (height-y+7)*stride, stride);
- }
- //FIXME (try edge emu)
-
- for(y=0; y<height+8; y+=8){
- memset(p->temp + (8+y)*stride, 0, 8*stride*sizeof(int16_t));
- for(x=0; x<width+8; x+=8){
- const int qps= 3 + is_luma;
- int qp;
-
- if(p->qp)
- qp= p->qp;
- else{
- qp= qp_store[ (XMIN(x, width-1)>>qps) + (XMIN(y, height-1)>>qps) * qp_stride];
- qp = FFMAX(1, norm_qscale(qp, p->mpeg2));
- }
- for(i=0; i<count; i++){
- const int x1= x + offset[i+count-1][0];
- const int y1= y + offset[i+count-1][1];
- const int index= x1 + y1*stride;
- p->dsp.get_pixels(block, p->src + index, stride);
- p->dsp.fdct(block);
- requantize(block2, block, qp, p->dsp.idct_permutation);
- p->dsp.idct(block2);
- add_block(p->temp + index, stride, block2);
- }
- }
- if(y)
- store_slice(dst + (y-8)*dst_stride, p->temp + 8 + y*stride, dst_stride, stride, width, XMIN(8, height+8-y), 6-p->log2_count);
- }
-#if 0
- for(y=0; y<height; y++){
- for(x=0; x<width; x++){
- if((((x>>6) ^ (y>>6)) & 1) == 0)
- dst[x + y*dst_stride]= p->src[8 + 8*stride + x + y*stride];
- if((x&63) == 0 || (y&63)==0)
- dst[x + y*dst_stride] += 128;
- }
- }
-#endif
- //FIXME reorder for better caching
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int h= (height+16+15)&(~15);
-
- vf->priv->temp_stride= (width+16+15)&(~15);
- vf->priv->temp= malloc(vf->priv->temp_stride*h*sizeof(int16_t));
- vf->priv->src = malloc(vf->priv->temp_stride*h*sizeof(uint8_t));
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi){
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
- }else{
- dmpi=vf->dmpi;
- }
-
- vf->priv->mpeg2= mpi->qscale_type;
- if(mpi->pict_type != 3 && mpi->qscale && !vf->priv->qp){
- int w = mpi->qstride;
- int h = (mpi->h + 15) >> 4;
- if (!w) {
- w = (mpi->w + 15) >> 4;
- h = 1;
- }
- if(!vf->priv->non_b_qp)
- vf->priv->non_b_qp= malloc(w*h);
- fast_memcpy(vf->priv->non_b_qp, mpi->qscale, w*h);
- }
- if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){
- char *qp_tab= vf->priv->non_b_qp;
- if((vf->priv->mode&4) || !qp_tab)
- qp_tab= mpi->qscale;
-
- if(qp_tab || vf->priv->qp){
- filter(vf->priv, dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, qp_tab, mpi->qstride, 1);
- filter(vf->priv, dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0);
- filter(vf->priv, dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, qp_tab, mpi->qstride, 0);
- }else{
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]);
- memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]);
- }
- }
-
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
-#endif
-#if HAVE_MMX2
- if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
-#endif
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- if(!vf->priv) return;
-
- free(vf->priv->temp);
- vf->priv->temp= NULL;
- free(vf->priv->src);
- vf->priv->src= NULL;
- free(vf->priv->avctx);
- vf->priv->avctx= NULL;
- free(vf->priv->non_b_qp);
- vf->priv->non_b_qp= NULL;
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_CLPL:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-static int control(struct vf_instance *vf, int request, void* data){
- switch(request){
- case VFCTRL_QUERY_MAX_PP_LEVEL:
- return 6;
- case VFCTRL_SET_PP_LEVEL:
- vf->priv->log2_count= *((unsigned int*)data);
- return CONTROL_TRUE;
- }
- return vf_next_control(vf,request,data);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
-
- int log2c=-1;
-
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->control= control;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- vf->priv->avctx= avcodec_alloc_context();
- ff_dsputil_init(&vf->priv->dsp, vf->priv->avctx);
-
- vf->priv->log2_count= 3;
-
- if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode);
-
- if( log2c >=0 && log2c <=6 )
- vf->priv->log2_count = log2c;
-
- if(vf->priv->qp < 0)
- vf->priv->qp = 0;
-
- switch(vf->priv->mode&3){
- default:
- case 0: requantize= hardthresh_c; break;
- case 1: requantize= softthresh_c; break;
- }
-
-#if HAVE_MMX
- if(gCpuCaps.hasMMX){
- store_slice= store_slice_mmx;
- switch(vf->priv->mode&3){
- case 0: requantize= hardthresh_mmx; break;
- case 1: requantize= softthresh_mmx; break;
- }
- }
-#endif
-
- return 1;
-}
-
-const vf_info_t vf_info_spp = {
- "simple postprocess",
- "spp",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_telecine.c b/libmpcodecs/vf_telecine.c
deleted file mode 100644
index 4ae96f2434..0000000000
--- a/libmpcodecs/vf_telecine.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-struct vf_priv_s {
- int frame;
- double pts;
- double lastpts;
- mp_image_t *buffered_mpi;
-};
-
-static int continue_buffered_image_fullframe(struct vf_instance *vf)
-{
- mp_image_t *mpi = vf->priv->buffered_mpi;
- mp_image_t *dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);
-
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0], mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2], mpi->stride[2]);
- }
- return vf_next_put_image(vf, dmpi, vf->priv->pts);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
- int ret;
-
- vf->priv->frame = (vf->priv->frame+1)%4;
-
- if (pts != MP_NOPTS_VALUE) {
- if (vf->priv->lastpts == MP_NOPTS_VALUE) {
- vf->priv->pts = pts;
- vf->priv->lastpts = pts;
- } else {
- // we only increase by 80% of input pts at each frame; in the case
- // in which we render two frames, we jump back
- // this turns 23.98fps perfectly into 29.97fps
- vf->priv->pts += 0.8 * (pts - vf->priv->lastpts);
- vf->priv->lastpts = pts;
- }
- }
-
- ret = 0;
- // 0/0 1/1 2/2 2/3 3/0
- switch (vf->priv->frame) {
- case 0:
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);
- my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
- mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
- mpi->planes[1]+mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
- mpi->planes[2]+mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- ret = vf_next_put_image(vf, dmpi, vf->priv->pts);
- vf->priv->pts = pts;
- vf->priv->buffered_mpi = mpi;
- vf_queue_frame(vf, continue_buffered_image_fullframe);
- return ret;
- case 1:
- case 2:
- vf->priv->buffered_mpi = mpi;
- return continue_buffered_image_fullframe(vf);
- case 3:
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE, mpi->width, mpi->height);
- my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
- mpi->planes[0]+mpi->stride[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
- mpi->planes[1]+mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
- mpi->planes[2]+mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- ret = vf_next_put_image(vf, dmpi, vf->priv->pts);
- my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- return ret;
- }
- return 0;
-}
-
-#if 0
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - figure out which other formats work */
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-#endif
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- //vf->config = config;
- vf->put_image = put_image;
- //vf->query_format = query_format;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = calloc(1, sizeof(struct vf_priv_s));
- vf->priv->frame = 1;
- if (args) sscanf(args, "%d", &vf->priv->frame);
- vf->priv->frame--;
- vf->priv->pts = MP_NOPTS_VALUE;
- vf->priv->lastpts = MP_NOPTS_VALUE;
- return 1;
-}
-
-const vf_info_t vf_info_telecine = {
- "telecine filter",
- "telecine",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_test.c b/libmpcodecs/vf_test.c
deleted file mode 100644
index aeb2763200..0000000000
--- a/libmpcodecs/vf_test.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-//===========================================================================//
-
-#include <inttypes.h>
-#include <math.h>
-
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#define ABS(a,b) ((a) > 0 ? (a) : -(a))
-
-#define WIDTH 512
-#define HEIGHT 512
-
-struct vf_priv_s {
- int frame_num;
-};
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- if(vf_next_query_format(vf,IMGFMT_YV12)<=0){
- mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YV12");
- return 0;
- }
-
- //hmm whats the meaning of these ... ;)
- d_width= width= WIDTH;
- d_height= height= HEIGHT;
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12);
-}
-
-static double c[64];
-
-static void initIdct(void)
-{
- int i;
-
- for (i=0; i<8; i++)
- {
- double s= i==0 ? sqrt(0.125) : 0.5;
- int j;
-
- for(j=0; j<8; j++)
- c[i*8+j]= s*cos((3.141592654/8.0)*i*(j+0.5));
- }
-}
-
-
-static void idct(uint8_t *dst, int dstStride, int src[64])
-{
- int i, j, k;
- double tmp[64];
-
- for(i=0; i<8; i++)
- {
- for(j=0; j<8; j++)
- {
- double sum= 0.0;
-
- for(k=0; k<8; k++)
- sum+= c[k*8+j]*src[8*i+k];
-
- tmp[8*i+j]= sum;
- }
- }
-
- for(j=0; j<8; j++)
- {
- for(i=0; i<8; i++)
- {
- int v;
- double sum= 0.0;
-
- for(k=0; k<8; k++)
- sum+= c[k*8+i]*tmp[8*k+j];
-
- v= (int)floor(sum+0.5);
- if(v<0) v=0;
- else if(v>255) v=255;
-
- dst[dstStride*i + j] = v;
- }
- }
-}
-
-static void drawDc(uint8_t *dst, int stride, int color, int w, int h)
-{
- int y;
- for(y=0; y<h; y++)
- {
- int x;
- for(x=0; x<w; x++)
- {
- dst[x + y*stride]= color;
- }
- }
-}
-
-static void drawBasis(uint8_t *dst, int stride, int amp, int freq, int dc)
-{
- int src[64];
-
- memset(src, 0, 64*sizeof(int));
- src[0]= dc;
- if(amp) src[freq]= amp;
- idct(dst, stride, src);
-}
-
-static void drawCbp(uint8_t *dst[3], int stride[3], int cbp, int amp, int dc)
-{
- if(cbp&1) drawBasis(dst[0] , stride[0], amp, 1, dc);
- if(cbp&2) drawBasis(dst[0]+8 , stride[0], amp, 1, dc);
- if(cbp&4) drawBasis(dst[0]+ 8*stride[0], stride[0], amp, 1, dc);
- if(cbp&8) drawBasis(dst[0]+8+8*stride[0], stride[0], amp, 1, dc);
- if(cbp&16)drawBasis(dst[1] , stride[1], amp, 1, dc);
- if(cbp&32)drawBasis(dst[2] , stride[2], amp, 1, dc);
-}
-
-static void dc1Test(uint8_t *dst, int stride, int w, int h, int off)
-{
- const int step= MAX(256/(w*h/256), 1);
- int y;
- int color=off;
- for(y=0; y<h; y+=16)
- {
- int x;
- for(x=0; x<w; x+=16)
- {
- drawDc(dst + x + y*stride, stride, color, 8, 8);
- color+=step;
- }
- }
-}
-
-static void freq1Test(uint8_t *dst, int stride, int off)
-{
- int y;
- int freq=0;
- for(y=0; y<8*16; y+=16)
- {
- int x;
- for(x=0; x<8*16; x+=16)
- {
- drawBasis(dst + x + y*stride, stride, 4*(96+off), freq, 128*8);
- freq++;
- }
- }
-}
-
-static void amp1Test(uint8_t *dst, int stride, int off)
-{
- int y;
- int amp=off;
- for(y=0; y<16*16; y+=16)
- {
- int x;
- for(x=0; x<16*16; x+=16)
- {
- drawBasis(dst + x + y*stride, stride, 4*(amp), 1, 128*8);
- amp++;
- }
- }
-}
-
-static void cbp1Test(uint8_t *dst[3], int stride[3], int off)
-{
- int y;
- int cbp=0;
- for(y=0; y<16*8; y+=16)
- {
- int x;
- for(x=0; x<16*8; x+=16)
- {
- uint8_t *dst1[3];
- dst1[0]= dst[0] + x*2 + y*2*stride[0];
- dst1[1]= dst[1] + x + y*stride[1];
- dst1[2]= dst[2] + x + y*stride[2];
-
- drawCbp(dst1, stride, cbp, (64+off)*4, 128*8);
- cbp++;
- }
- }
-}
-
-static void mv1Test(uint8_t *dst, int stride, int off)
-{
- int y;
- for(y=0; y<16*16; y++)
- {
- int x;
- if(y&16) continue;
- for(x=0; x<16*16; x++)
- {
- dst[x + y*stride]= x + off*8/(y/32+1);
- }
- }
-}
-
-static void ring1Test(uint8_t *dst, int stride, int off)
-{
- int y;
- int color=0;
- for(y=off; y<16*16; y+=16)
- {
- int x;
- for(x=off; x<16*16; x+=16)
- {
- drawDc(dst + x + y*stride, stride, ((x+y)&16) ? color : -color, 16, 16);
-// dst[x + y*stride]= 255 + (off&1);
- color++;
- }
- }
-}
-
-static void ring2Test(uint8_t *dst, int stride, int off)
-{
- int y;
- for(y=0; y<16*16; y++)
- {
- int x;
- for(x=0; x<16*16; x++)
- {
- double d= sqrt((x-8*16)*(x-8*16) + (y-8*16)*(y-8*16));
- double r= d/20 - (int)(d/20);
- if(r<off/30.0)
- {
- dst[x + y*stride]= 255;
- dst[x + y*stride+256]= 0;
- }
- else{
- dst[x + y*stride]= x;
- dst[x + y*stride+256]= x;
- }
- }
- }
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int frame= vf->priv->frame_num;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,IMGFMT_YV12,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- WIDTH, HEIGHT);
-
- // clean
- memset(dmpi->planes[0], 0, dmpi->stride[0]*dmpi->h);
- memset(dmpi->planes[1], 128, dmpi->stride[1]*dmpi->h>>dmpi->chroma_y_shift);
- memset(dmpi->planes[2], 128, dmpi->stride[2]*dmpi->h>>dmpi->chroma_y_shift);
-
- if(frame%30)
- {
- switch(frame/30)
- {
- case 0: dc1Test(dmpi->planes[0], dmpi->stride[0], 256, 256, frame%30); break;
- case 1: dc1Test(dmpi->planes[1], dmpi->stride[1], 256, 256, frame%30); break;
- case 2: freq1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break;
- case 3: freq1Test(dmpi->planes[1], dmpi->stride[1], frame%30); break;
- case 4: amp1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break;
- case 5: amp1Test(dmpi->planes[1], dmpi->stride[1], frame%30); break;
- case 6: cbp1Test(dmpi->planes , dmpi->stride , frame%30); break;
- case 7: mv1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break;
- case 8: ring1Test(dmpi->planes[0], dmpi->stride[0], frame%30); break;
- case 9: ring2Test(dmpi->planes[0], dmpi->stride[0], frame%30); break;
- }
- }
-
- frame++;
- vf->priv->frame_num= frame;
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- vf->priv->frame_num= args ? atoi(args) : 0;
- initIdct();
- return 1;
-}
-
-const vf_info_t vf_info_test = {
- "test pattern generator",
- "test",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c
deleted file mode 100644
index b4fa7a46bf..0000000000
--- a/libmpcodecs/vf_tfields.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "options.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-struct vf_priv_s {
- int mode;
- int parity;
- int buffered_i;
- mp_image_t *buffered_mpi;
- double buffered_pts;
-};
-
-static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w, int h, int field)
-{
- int x, y;
- src += ss;
- dest += ds;
- h--;
- if (field) {
- fast_memcpy(dest - ds, src - ss, w);
- src += ss;
- dest += ds;
- h--;
- }
- for (y=h/2; y > 0; y--) {
- dest[0] = src[0];
- for (x=1; x<w-1; x++) {
- if (((src[x-ss] < src[x]) && (src[x+ss] < src[x])) ||
- ((src[x-ss] > src[x]) && (src[x+ss] > src[x]))) {
- //dest[x] = (src[x+ss] + src[x-ss])>>1;
- dest[x] = ((src[x+ss]<<1) + (src[x-ss]<<1)
- + src[x+ss+1] + src[x-ss+1]
- + src[x+ss-1] + src[x-ss-1])>>3;
- }
- else dest[x] = src[x];
- }
- dest[w-1] = src[w-1];
- dest += ds<<1;
- src += ss<<1;
- }
- if (h & 1)
- fast_memcpy(dest, src, w);
-}
-
-#if HAVE_MMX2
-static void qpel_li_MMX2(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
-{
- int i, j, ssd=ss;
- long crap1, crap2;
- if (up) {
- ssd = -ss;
- fast_memcpy(d, s, w);
- d += ds;
- s += ss;
- }
- for (i=h-1; i; i--) {
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "2: \n\t"
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
- "pavgb %%mm0, %%mm1 \n\t"
- "add $8, %%"REG_S" \n\t"
- "pavgb %%mm0, %%mm1 \n\t"
- "movq %%mm1, (%%"REG_D") \n\t"
- "add $8, %%"REG_D" \n\t"
- "decl %%ecx \n\t"
- "jnz 2b \n\t"
- : "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd)
- );
- for (j=w-(w&7); j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j])>>2;
- d += ds;
- s += ss;
- }
- if (!up) fast_memcpy(d, s, w);
- __asm__ volatile("emms \n\t" : : : "memory");
-}
-#endif
-
-#if HAVE_MMX
-static void qpel_li_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
-{
- int i, j, ssd=ss;
- int crap1, crap2;
- if (up) {
- ssd = -ss;
- fast_memcpy(d, s, w);
- d += ds;
- s += ss;
- }
- for (i=h-1; i; i--) {
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- "3: \n\t"
- "movq (%%"REG_S"), %%mm0 \n\t"
- "movq (%%"REG_S"), %%mm1 \n\t"
- "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t"
- "movq (%%"REG_S",%%"REG_a"), %%mm3 \n\t"
- "add $8, %%"REG_S" \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpckhbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpckhbw %%mm7, %%mm3 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "paddw %%mm1, %%mm3 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "paddw %%mm1, %%mm3 \n\t"
- "paddw %%mm0, %%mm2 \n\t"
- "paddw %%mm1, %%mm3 \n\t"
- "psrlw $2, %%mm2 \n\t"
- "psrlw $2, %%mm3 \n\t"
- "packsswb %%mm3, %%mm2 \n\t"
- "movq %%mm2, (%%"REG_D") \n\t"
- "add $8, %%"REG_D" \n\t"
- "decl %%ecx \n\t"
- "jnz 3b \n\t"
- : "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd)
- );
- for (j=w-(w&7); j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j])>>2;
- d += ds;
- s += ss;
- }
- if (!up) fast_memcpy(d, s, w);
- __asm__ volatile("emms \n\t" : : : "memory");
-}
-
-#if HAVE_EBX_AVAILABLE
-static void qpel_4tap_MMX(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
-{
- int i, j, ssd=ss;
- static const short filter[] = {
- 29, 29, 29, 29, 110, 110, 110, 110,
- 9, 9, 9, 9, 3, 3, 3, 3,
- 64, 64, 64, 64 };
- int crap1, crap2;
- if (up) {
- ssd = -ss;
- fast_memcpy(d, s, w);
- d += ds; s += ss;
- }
- for (j=0; j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j])>>2;
- d += ds; s += ss;
- for (i=h-3; i; i--) {
- __asm__ volatile(
- "pxor %%mm0, %%mm0 \n\t"
- "movq (%%"REG_d"), %%mm4 \n\t"
- "movq 8(%%"REG_d"), %%mm5 \n\t"
- "movq 16(%%"REG_d"), %%mm6 \n\t"
- "movq 24(%%"REG_d"), %%mm7 \n\t"
- "4: \n\t"
-
- "movq (%%"REG_S",%%"REG_a"), %%mm1 \n\t"
- "movq (%%"REG_S"), %%mm2 \n\t"
- "movq (%%"REG_S",%%"REG_b"), %%mm3 \n\t"
- "punpcklbw %%mm0, %%mm1 \n\t"
- "punpcklbw %%mm0, %%mm2 \n\t"
- "pmullw %%mm4, %%mm1 \n\t"
- "punpcklbw %%mm0, %%mm3 \n\t"
- "pmullw %%mm5, %%mm2 \n\t"
- "paddusw %%mm2, %%mm1 \n\t"
- "pmullw %%mm6, %%mm3 \n\t"
- "movq (%%"REG_S",%%"REG_a",2), %%mm2 \n\t"
- "psubusw %%mm3, %%mm1 \n\t"
- "punpcklbw %%mm0, %%mm2 \n\t"
- "pmullw %%mm7, %%mm2 \n\t"
- "psubusw %%mm2, %%mm1 \n\t"
- "psrlw $7, %%mm1 \n\t"
-
- "movq (%%"REG_S",%%"REG_a"), %%mm2 \n\t"
- "movq (%%"REG_S"), %%mm3 \n\t"
- "punpckhbw %%mm0, %%mm2 \n\t"
- "punpckhbw %%mm0, %%mm3 \n\t"
- "pmullw %%mm4, %%mm2 \n\t"
- "pmullw %%mm5, %%mm3 \n\t"
- "paddusw %%mm3, %%mm2 \n\t"
- "movq (%%"REG_S",%%"REG_b"), %%mm3 \n\t"
- "punpckhbw %%mm0, %%mm3 \n\t"
- "pmullw %%mm6, %%mm3 \n\t"
- "psubusw %%mm3, %%mm2 \n\t"
- "movq (%%"REG_S",%%"REG_a",2), %%mm3 \n\t"
- "punpckhbw %%mm0, %%mm3 \n\t"
- "add $8, %%"REG_S" \n\t"
- "pmullw %%mm7, %%mm3 \n\t"
- "psubusw %%mm3, %%mm2 \n\t"
- "psrlw $7, %%mm2 \n\t"
-
- "packuswb %%mm2, %%mm1 \n\t"
- "movq %%mm1, (%%"REG_D") \n\t"
- "add $8, %%"REG_D" \n\t"
- "decl %%ecx \n\t"
- "jnz 4b \n\t"
- : "=S"(crap1), "=D"(crap2)
- : "c"(w>>3), "S"(s), "D"(d), "a"((long)ssd), "b"((long)-ssd), "d"(filter)
- );
- for (j=w-(w&7); j<w; j++)
- d[j] = (-9*s[j-ssd] + 111*s[j] + 29*s[j+ssd] - 3*s[j+ssd+ssd])>>7;
- d += ds;
- s += ss;
- }
- for (j=0; j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j])>>2;
- d += ds; s += ss;
- if (!up) fast_memcpy(d, s, w);
- __asm__ volatile("emms \n\t" : : : "memory");
-}
-#endif /* HAVE_EBX_AVAILABLE */
-#endif
-
-static inline int clamp(int a)
-{
- // If a<512, this is equivalent to:
- // return (a<0) ? 0 : ( (a>255) ? 255 : a);
- return (~(a>>31)) & (a | ((a<<23)>>31));
-}
-
-static void qpel_li_C(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
-{
- int i, j, ssd=ss;
- if (up) {
- ssd = -ss;
- fast_memcpy(d, s, w);
- d += ds;
- s += ss;
- }
- for (i=h-1; i; i--) {
- for (j=0; j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j])>>2;
- d += ds;
- s += ss;
- }
- if (!up) fast_memcpy(d, s, w);
-}
-
-static void qpel_4tap_C(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up)
-{
- int i, j, ssd=ss;
- if (up) {
- ssd = -ss;
- fast_memcpy(d, s, w);
- d += ds; s += ss;
- }
- for (j=0; j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j] + 2)>>2;
- d += ds; s += ss;
- for (i=h-3; i; i--) {
- for (j=0; j<w; j++)
- d[j] = clamp((-9*s[j-ssd] + 111*s[j] + 29*s[j+ssd] - 3*s[j+ssd+ssd] + 64)>>7);
- d += ds; s += ss;
- }
- for (j=0; j<w; j++)
- d[j] = (s[j+ssd] + 3*s[j] + 2)>>2;
- d += ds; s += ss;
- if (!up) fast_memcpy(d, s, w);
-}
-
-static void (*qpel_li)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up);
-static void (*qpel_4tap)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up);
-
-static int continue_buffered_image(struct vf_instance *vf);
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- vf->priv->buffered_mpi = mpi;
- vf->priv->buffered_pts = pts;
- vf->priv->buffered_i = 0;
- return continue_buffered_image(vf);
-}
-
-static int continue_buffered_image(struct vf_instance *vf)
-{
- int i=vf->priv->buffered_i;
- double pts = vf->priv->buffered_pts;
- mp_image_t *mpi = vf->priv->buffered_mpi;
- int ret=0;
- mp_image_t *dmpi;
- void (*qpel)(unsigned char *, unsigned char *, int, int, int, int, int) = NULL;
- int bpp=1;
- int tff;
-
- if (i == 0)
- vf_queue_frame(vf, continue_buffered_image);
- pts += i * .02; // XXX not right
-
- if (!(mpi->flags & MP_IMGFLAG_PLANAR)) bpp = mpi->bpp/8;
- if (vf->priv->parity < 0) {
- if (mpi->fields & MP_IMGFIELD_ORDERED)
- tff = mpi->fields & MP_IMGFIELD_TOP_FIRST;
- else
- tff = 1;
- }
- else tff = (vf->priv->parity&1)^1;
-
- switch (vf->priv->mode) {
- case 0:
- for (; i<2; i++) {
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height/2);
- dmpi->planes[0] = mpi->planes[0] + (i^!tff)*mpi->stride[0];
- dmpi->stride[0] = 2*mpi->stride[0];
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- dmpi->planes[1] = mpi->planes[1] + (i^!tff)*mpi->stride[1];
- dmpi->planes[2] = mpi->planes[2] + (i^!tff)*mpi->stride[2];
- dmpi->stride[1] = 2*mpi->stride[1];
- dmpi->stride[2] = 2*mpi->stride[2];
- }
- ret |= vf_next_put_image(vf, dmpi, pts);
- break;
- }
- break;
- case 1:
- for (; i<2; i++) {
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height);
- my_memcpy_pic(dmpi->planes[0] + (i^!tff)*dmpi->stride[0],
- mpi->planes[0] + (i^!tff)*mpi->stride[0],
- mpi->w*bpp, mpi->h/2, dmpi->stride[0]*2, mpi->stride[0]*2);
- deint(dmpi->planes[0], dmpi->stride[0], mpi->planes[0], mpi->stride[0], mpi->w, mpi->h, (i^!tff));
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1] + (i^!tff)*dmpi->stride[1],
- mpi->planes[1] + (i^!tff)*mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2] + (i^!tff)*dmpi->stride[2],
- mpi->planes[2] + (i^!tff)*mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- deint(dmpi->planes[1], dmpi->stride[1], mpi->planes[1], mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height, (i^!tff));
- deint(dmpi->planes[2], dmpi->stride[2], mpi->planes[2], mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height, (i^!tff));
- }
- ret |= vf_next_put_image(vf, dmpi, pts);
- break;
- }
- break;
- case 2:
- qpel = qpel_li;
- case 3:
- // TODO: add 3tap filter
- if (!qpel)
- qpel = qpel_4tap;
- case 4:
- if (!qpel)
- qpel = qpel_4tap;
-
- for (; i<2; i++) {
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height/2);
- qpel(dmpi->planes[0], mpi->planes[0] + (i^!tff)*mpi->stride[0],
- mpi->w*bpp, mpi->h/2, dmpi->stride[0], mpi->stride[0]*2, (i^!tff));
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- qpel(dmpi->planes[1],
- mpi->planes[1] + (i^!tff)*mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1], mpi->stride[1]*2, (i^!tff));
- qpel(dmpi->planes[2],
- mpi->planes[2] + (i^!tff)*mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2], mpi->stride[2]*2, (i^!tff));
- }
- ret |= vf_next_put_image(vf, dmpi, pts);
- break;
- }
- break;
- }
- vf->priv->buffered_i = 1;
- return ret;
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - figure out which formats exactly work */
- switch (fmt) {
- default:
- if (vf->priv->mode == 1)
- return 0;
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- switch (vf->priv->mode) {
- case 0:
- case 2:
- case 3:
- case 4:
- return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt);
- case 1:
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
- }
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- vf->config = config;
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- vf->priv->mode = 4;
- vf->priv->parity = -1;
- if (args) sscanf(args, "%d:%d", &vf->priv->mode, &vf->priv->parity);
- qpel_li = qpel_li_C;
- qpel_4tap = qpel_4tap_C;
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) qpel_li = qpel_li_MMX;
-#if HAVE_EBX_AVAILABLE
- if(gCpuCaps.hasMMX) qpel_4tap = qpel_4tap_MMX;
-#endif
-#endif
-#if HAVE_MMX2
- if(gCpuCaps.hasMMX2) qpel_li = qpel_li_MMX2;
-#endif
- return 1;
-}
-
-const vf_info_t vf_info_tfields = {
- "temporal field separation",
- "tfields",
- "Rich Felker",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_tile.c b/libmpcodecs/vf_tile.c
deleted file mode 100644
index 0b5dac1559..0000000000
--- a/libmpcodecs/vf_tile.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * filter to tile a serie of image in a single, bigger, image
- *
- * The parameters are:
- *
- * xtile: number of tile on the x axis (5)
- * ytile: number of tile on the y axis (5)
- * xytile: when write the image, it can be different then xtile * ytile
- * (for example you can write 8 * 7 tile, writing the file every
- * 50 frame, to have one image every 2 seconds @ 25 fps ).
- * start: pixel at the start (x/y), default 2
- * delta: pixel between 2 tile, (x/y), default 4
- *
- * For example a valid command line is:
- * ... -vf tile=10:5:-1:4:8 ...
- * that make images of 10 * 5 tiles, with 4 pixel at the beginning and
- * 8 pixel between tiles.
- *
- * The default command is:
- * ... -vf tile=5:5:25:2:4
- *
- * If you omit a parameter or put a value less then 0, the default is used.
- * ... -vf tile=10:5::-1:10
- *
- * You can also stop when you're ok
- * ... -vf tile=10:5
- * (and this is probably the option you will use more often ...)
- *
- * Probably is good to put the scale filter before the tile :-)
- *
- * copyright (c) 2003 Daniele Forghieri ( guru@digitalfantasy.it )
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-// strtoi memcpy_pic
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-/* private data */
-struct vf_priv_s {
- /* configuration data */
- /* Number on hor/ver tiles */
- int xtile;
- int ytile;
- /* When write the whole frame (default = xtile * ytile) */
- int xytile;
- /* pixel at start / end (default = 4) */
- int start;
- /* pixel between image (default = 2) */
- int delta;
-// /* Background color, in destination format */
-// int bkgSet;
-
- /* Work data */
- int frame_cur;
- double start_pts;
-};
-
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- struct vf_priv_s *priv;
- int xw;
- int yh;
-
- /* Calculate new destination size */
- priv = vf->priv;
- xw = priv->start * 2 +
- priv->xtile * width +
- (priv->xtile - 1) * priv->delta;
- yh = priv->start * 2 +
- priv->ytile * height +
- (priv->ytile - 1) * priv->delta;
-
- mp_msg(MSGT_VFILTER,MSGL_V,"vf_tile:config size set to %d * %d\n", xw, yh);
-
- return vf_next_config(vf, xw, yh, xw, yh, flags, outfmt);
-}
-
-/* Filter handler */
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- mp_image_t *dmpi;
- struct vf_priv_s *priv;
- int t;
- int xw;
- int yh;
- int xi;
- int yi;
- int by;
- int dw;
-
- /* Calculate new size */
- priv = vf->priv;
- xw = priv->start * 2 +
- priv->xtile * mpi->w +
- (priv->xtile - 1) * priv->delta;
- yh = priv->start * 2 +
- priv->ytile * mpi->h+
- (priv->ytile - 1) * priv->delta;
-
- /* Get the big image! */
- dmpi=vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE,
- xw, yh);
-
- /* bytes x pixel & bytes x line */
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- by = 1;
- dw = mpi->w;
- }
- else {
- by = (mpi->bpp + 7) / 8;
- dw = mpi->w * by;
- }
- /* Index position */
- t = priv->frame_cur % priv->xytile;
-// if ((t == 0) && (bkg != 0)) {
-// /* First frame, delete the background */
-//
-// }
- if (t == 0)
- priv->start_pts = pts;
-
- /* Position of image */
- xi = priv->start + (mpi->w + priv->delta) * (t % priv->xtile);
- yi = priv->start + (mpi->h + priv->delta) * (t / priv->xtile);
-
- /* Copy first (or only) plane */
- memcpy_pic( dmpi->planes[0] + xi * by + yi * dmpi->stride[0],
- mpi->planes[0],
- dw,
- mpi->h,
- dmpi->stride[0],
- mpi->stride[0]);
-
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- /* Copy the other 2 planes */
- memcpy_pic( dmpi->planes[1] + (xi >> mpi->chroma_x_shift) + (yi >> mpi->chroma_y_shift) * dmpi->stride[1],
- mpi->planes[1],
- mpi->chroma_width,
- mpi->chroma_height,
- dmpi->stride[1],
- mpi->stride[1]);
- memcpy_pic( dmpi->planes[2] + (xi >> mpi->chroma_x_shift) + (yi >> mpi->chroma_y_shift) * dmpi->stride[2],
- mpi->planes[2],
- mpi->chroma_width,
- mpi->chroma_height,
- dmpi->stride[2],
- mpi->stride[2]);
- }
-
- /* Increment current frame */
- ++priv->frame_cur;
-
- if (t == priv->xytile - 1) {
- /* Display the composition */
- dmpi->width = xw;
- dmpi->height = yh;
- return vf_next_put_image(vf, dmpi, priv->start_pts);
- }
- else {
- /* Skip the frame */
- return 0;
- }
-}
-
-static void uninit(struct vf_instance *vf)
-{
- /* free local data */
- free(vf->priv);
-}
-
-/* rgb/bgr 12->32 supported & some Yxxx */
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- switch (fmt) {
- /* rgb 12...32 bit */
- case IMGFMT_RGB12:
- case IMGFMT_RGB15:
- case IMGFMT_RGB16:
- case IMGFMT_RGB24:
- case IMGFMT_RGB32:
- /* bgr 12...32 bit */
- case IMGFMT_BGR12:
- case IMGFMT_BGR15:
- case IMGFMT_BGR16:
- case IMGFMT_BGR24:
- case IMGFMT_BGR32:
- /* Various Yxxx Formats */
- case IMGFMT_444P:
- case IMGFMT_422P:
- case IMGFMT_411P:
- case IMGFMT_YUY2:
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_YVU9:
- case IMGFMT_IF09:
- case IMGFMT_IYUV:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-/* Get an integer from the string pointed by s, adjusting s.
- * If the value is less then 0 def_val is used.
- * Return 0 for ok
- *
- * Look below ( in vf_open(...) ) for a use ...
- */
-static int parse_int(char **s, int *rt, int def_val)
-{
-
- int t = 0;
-
- if (**s) {
- /* Get value (dec, hex or octal) */
- t = strtol( *s, s, 0 );
-
- /* Use default */
- if (t < 0) {
- t = def_val;
- }
-
- if (**s == ':') {
- /* Point to next character (problably a digit) */
- ++(*s);
- }
- else if (**s != '\0') {
- /* Error, we got some wrong char */
- return 1;
- }
- }
- else {
- t = def_val;
- }
-
- *rt = t;
- return 0;
-
-}
-
-/* Main entry funct for the filter */
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- int er;
-
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->config = config;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- /* Private data */
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- if (p == NULL) {
- return 0;
- }
-
- if (args == NULL) {
- /* Use the default */
- args = "";
- }
- /* Parse all the arguments */
- er = parse_int( &args, &p->xtile, 5 );
- er |= parse_int( &args, &p->ytile, 5 );
- er |= parse_int( &args, &p->xytile, 0 );
- er |= parse_int( &args, &p->start, 2 );
- er |= parse_int( &args, &p->delta, 4 );
-// er |= parse_int( &args, &p->bkgSet, 0 );
-
- if (er) {
- mp_tmsg(MSGT_VFILTER, MSGL_ERR, "[VF_FRAMESTEP] Error parsing argument.\n");
- return 0;
- }
- /* Load some default */
- if ((p->xytile <= 0) || (p->xytile > p->xtile * p->ytile)) {
- p->xytile = p->xtile * p->ytile;
- }
-
- /* Say what happen: use mp_msg(...)? */
- if ( mp_msg_test(MSGT_VFILTER,MSGL_V) ) {
- printf("vf_tile: tiling %d * %d, output every %d frames\n",
- p->xtile,
- p->ytile,
- p->xytile);
- printf("vf_tile: start pixel %d, delta pixel %d\n",
- p->start,
- p->delta);
-// printf("vf_tile: background 0x%x\n",
-// p->bkgSet);
- }
- return 1;
-}
-
-const vf_info_t vf_info_tile = {
- "Make a single image tiling x/y images",
- "tile",
- "Daniele Forghieri",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_tinterlace.c b/libmpcodecs/vf_tinterlace.c
deleted file mode 100644
index 2583d431e9..0000000000
--- a/libmpcodecs/vf_tinterlace.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2003 Michael Zucchi <notzed@ximian.com>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-struct vf_priv_s {
- int mode;
- int frame;
- mp_image_t *dmpi;
-};
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
-{
- int ret = 0;
- mp_image_t *dmpi;
-
- switch (vf->priv->mode) {
- case 0:
- dmpi = vf->priv->dmpi;
- if (dmpi == NULL) {
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE,
- mpi->width, mpi->height*2);
-
- vf->priv->dmpi = dmpi;
-
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0]*2, mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1]*2, mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2]*2, mpi->stride[2]);
- }
- } else {
- vf->priv->dmpi = NULL;
-
- memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0]*2, mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1]*2, mpi->stride[1]);
- memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2]*2, mpi->stride[2]);
- }
- ret = vf_next_put_image(vf, dmpi, pts);
- }
- break;
- case 1:
- if (vf->priv->frame & 1)
- ret = vf_next_put_image(vf, mpi, pts);
- break;
- case 2:
- if ((vf->priv->frame & 1) == 0)
- ret = vf_next_put_image(vf, mpi, pts);
- break;
- case 3:
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height*2);
- /* fixme, just clear alternate lines */
- vf_mpi_clear(dmpi, 0, 0, dmpi->w, dmpi->h);
- if ((vf->priv->frame & 1) == 0) {
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0]*2, mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1]*2, mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2]*2, mpi->stride[2]);
- }
- } else {
- memcpy_pic(dmpi->planes[0]+dmpi->stride[0], mpi->planes[0], mpi->w, mpi->h,
- dmpi->stride[0]*2, mpi->stride[0]);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- memcpy_pic(dmpi->planes[1]+dmpi->stride[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[1]*2, mpi->stride[1]);
- memcpy_pic(dmpi->planes[2]+dmpi->stride[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height,
- dmpi->stride[2]*2, mpi->stride[2]);
- }
- }
- ret = vf_next_put_image(vf, dmpi, pts);
- break;
- case 4:
- // Interleave even lines (only) from Frame 'i' with odd
- // lines (only) from Frame 'i+1', halving the Frame
- // rate and preserving image height.
-
- dmpi = vf->priv->dmpi;
-
- // @@ Need help: Should I set dmpi->fields to indicate
- // that the (new) frame will be interlaced!? E.g. ...
- // dmpi->fields |= MP_IMGFIELD_INTERLACED;
- // dmpi->fields |= MP_IMGFIELD_TOP_FIRST;
- // etc.
-
- if (dmpi == NULL) {
- dmpi = vf_get_image(vf->next, mpi->imgfmt,
- MP_IMGTYPE_STATIC, MP_IMGFLAG_ACCEPT_STRIDE |
- MP_IMGFLAG_PRESERVE,
- mpi->width, mpi->height);
-
- vf->priv->dmpi = dmpi;
-
- my_memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1], mpi->planes[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2], mpi->planes[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- } else {
- vf->priv->dmpi = NULL;
-
- my_memcpy_pic(dmpi->planes[0]+dmpi->stride[0],
- mpi->planes[0]+mpi->stride[0],
- mpi->w, mpi->h/2,
- dmpi->stride[0]*2, mpi->stride[0]*2);
- if (mpi->flags & MP_IMGFLAG_PLANAR) {
- my_memcpy_pic(dmpi->planes[1]+dmpi->stride[1],
- mpi->planes[1]+mpi->stride[1],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[1]*2, mpi->stride[1]*2);
- my_memcpy_pic(dmpi->planes[2]+dmpi->stride[2],
- mpi->planes[2]+mpi->stride[2],
- mpi->chroma_width, mpi->chroma_height/2,
- dmpi->stride[2]*2, mpi->stride[2]*2);
- }
- ret = vf_next_put_image(vf, dmpi, pts);
- }
- break;
- }
-
- vf->priv->frame++;
-
- return ret;
-}
-
-static int query_format(struct vf_instance *vf, unsigned int fmt)
-{
- /* FIXME - figure out which other formats work */
- switch (fmt) {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- return vf_next_query_format(vf, fmt);
- }
- return 0;
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt)
-{
- switch (vf->priv->mode) {
- case 0:
- case 3:
- return vf_next_config(vf,width,height*2,d_width,d_height*2,flags,outfmt);
- case 1: /* odd frames */
- case 2: /* even frames */
- case 4: /* alternate frame (height-preserving) interlacing */
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
- }
- return 0;
-}
-
-static void uninit(struct vf_instance *vf)
-{
- free(vf->priv);
-}
-
-static int vf_open(vf_instance_t *vf, char *args)
-{
- struct vf_priv_s *p;
- vf->config = config;
- vf->put_image = put_image;
- vf->query_format = query_format;
- vf->uninit = uninit;
- vf->default_reqs = VFCAP_ACCEPT_STRIDE;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- vf->priv->mode = 0;
- if (args)
- sscanf(args, "%d", &vf->priv->mode);
- vf->priv->frame = 0;
- return 1;
-}
-
-const vf_info_t vf_info_tinterlace = {
- "temporal field interlacing",
- "tinterlace",
- "Michael Zucchi",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
deleted file mode 100644
index 8f6dfd25ee..0000000000
--- a/libmpcodecs/vf_uspp.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * Copyright (C) 2005 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <math.h>
-#include <assert.h>
-
-#include <libavcodec/avcodec.h>
-#include <libavutil/mem.h>
-
-#include "config.h"
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-#include "libvo/fastmemcpy.h"
-
-#define XMIN(a,b) ((a) < (b) ? (a) : (b))
-
-#define BLOCK 16
-
-//===========================================================================//
-static const uint8_t __attribute__((aligned(8))) dither[8][8]={
-{ 0*4, 48*4, 12*4, 60*4, 3*4, 51*4, 15*4, 63*4, },
-{ 32*4, 16*4, 44*4, 28*4, 35*4, 19*4, 47*4, 31*4, },
-{ 8*4, 56*4, 4*4, 52*4, 11*4, 59*4, 7*4, 55*4, },
-{ 40*4, 24*4, 36*4, 20*4, 43*4, 27*4, 39*4, 23*4, },
-{ 2*4, 50*4, 14*4, 62*4, 1*4, 49*4, 13*4, 61*4, },
-{ 34*4, 18*4, 46*4, 30*4, 33*4, 17*4, 45*4, 29*4, },
-{ 10*4, 58*4, 6*4, 54*4, 9*4, 57*4, 5*4, 53*4, },
-{ 42*4, 26*4, 38*4, 22*4, 41*4, 25*4, 37*4, 21*4, },
-};
-
-static const uint8_t offset[511][2]= {
-{ 0, 0},
-{ 0, 0}, { 8, 8},
-{ 0, 0}, { 4, 4}, {12, 8}, { 8,12},
-{ 0, 0}, {10, 2}, { 4, 4}, {14, 6}, { 8, 8}, { 2,10}, {12,12}, { 6,14},
-
-{ 0, 0}, {10, 2}, { 4, 4}, {14, 6}, { 8, 8}, { 2,10}, {12,12}, { 6,14},
-{ 5, 1}, {15, 3}, { 9, 5}, { 3, 7}, {13, 9}, { 7,11}, { 1,13}, {11,15},
-
-{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9},
-{ 2, 2}, {10, 2}, { 2,10}, {10,10}, { 7, 3}, {15, 3}, { 7,11}, {15,11},
-{ 4, 4}, {12, 4}, { 4,12}, {12,12}, { 1, 5}, { 9, 5}, { 1,13}, { 9,13},
-{ 6, 6}, {14, 6}, { 6,14}, {14,14}, { 3, 7}, {11, 7}, { 3,15}, {11,15},
-
-{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 4, 0}, {12, 0}, { 4, 8}, {12, 8},
-{ 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9},
-{ 3, 2}, {11, 2}, { 3,10}, {11,10}, { 7, 2}, {15, 2}, { 7,10}, {15,10},
-{ 2, 3}, {10, 3}, { 2,11}, {10,11}, { 6, 3}, {14, 3}, { 6,11}, {14,11},
-{ 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 4, 4}, {12, 4}, { 4,12}, {12,12},
-{ 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 5, 5}, {13, 5}, { 5,13}, {13,13},
-{ 3, 6}, {11, 6}, { 3,14}, {11,14}, { 7, 6}, {15, 6}, { 7,14}, {15,14},
-{ 2, 7}, {10, 7}, { 2,15}, {10,15}, { 6, 7}, {14, 7}, { 6,15}, {14,15},
-
-{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 0, 2}, { 8, 2}, { 0,10}, { 8,10},
-{ 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 0, 6}, { 8, 6}, { 0,14}, { 8,14},
-{ 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 1, 3}, { 9, 3}, { 1,11}, { 9,11},
-{ 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 1, 7}, { 9, 7}, { 1,15}, { 9,15},
-{ 2, 0}, {10, 0}, { 2, 8}, {10, 8}, { 2, 2}, {10, 2}, { 2,10}, {10,10},
-{ 2, 4}, {10, 4}, { 2,12}, {10,12}, { 2, 6}, {10, 6}, { 2,14}, {10,14},
-{ 3, 1}, {11, 1}, { 3, 9}, {11, 9}, { 3, 3}, {11, 3}, { 3,11}, {11,11},
-{ 3, 5}, {11, 5}, { 3,13}, {11,13}, { 3, 7}, {11, 7}, { 3,15}, {11,15},
-{ 4, 0}, {12, 0}, { 4, 8}, {12, 8}, { 4, 2}, {12, 2}, { 4,10}, {12,10},
-{ 4, 4}, {12, 4}, { 4,12}, {12,12}, { 4, 6}, {12, 6}, { 4,14}, {12,14},
-{ 5, 1}, {13, 1}, { 5, 9}, {13, 9}, { 5, 3}, {13, 3}, { 5,11}, {13,11},
-{ 5, 5}, {13, 5}, { 5,13}, {13,13}, { 5, 7}, {13, 7}, { 5,15}, {13,15},
-{ 6, 0}, {14, 0}, { 6, 8}, {14, 8}, { 6, 2}, {14, 2}, { 6,10}, {14,10},
-{ 6, 4}, {14, 4}, { 6,12}, {14,12}, { 6, 6}, {14, 6}, { 6,14}, {14,14},
-{ 7, 1}, {15, 1}, { 7, 9}, {15, 9}, { 7, 3}, {15, 3}, { 7,11}, {15,11},
-{ 7, 5}, {15, 5}, { 7,13}, {15,13}, { 7, 7}, {15, 7}, { 7,15}, {15,15},
-
-{ 0, 0}, { 8, 0}, { 0, 8}, { 8, 8}, { 4, 4}, {12, 4}, { 4,12}, {12,12}, { 0, 4}, { 8, 4}, { 0,12}, { 8,12}, { 4, 0}, {12, 0}, { 4, 8}, {12, 8}, { 2, 2}, {10, 2}, { 2,10}, {10,10}, { 6, 6}, {14, 6}, { 6,14}, {14,14}, { 2, 6}, {10, 6}, { 2,14}, {10,14}, { 6, 2}, {14, 2}, { 6,10}, {14,10}, { 0, 2}, { 8, 2}, { 0,10}, { 8,10}, { 4, 6}, {12, 6}, { 4,14}, {12,14}, { 0, 6}, { 8, 6}, { 0,14}, { 8,14}, { 4, 2}, {12, 2}, { 4,10}, {12,10}, { 2, 0}, {10, 0}, { 2, 8}, {10, 8}, { 6, 4}, {14, 4}, { 6,12}, {14,12}, { 2, 4}, {10, 4}, { 2,12}, {10,12}, { 6, 0}, {14, 0}, { 6, 8}, {14, 8}, { 1, 1}, { 9, 1}, { 1, 9}, { 9, 9}, { 5, 5}, {13, 5}, { 5,13}, {13,13}, { 1, 5}, { 9, 5}, { 1,13}, { 9,13}, { 5, 1}, {13, 1}, { 5, 9}, {13, 9}, { 3, 3}, {11, 3}, { 3,11}, {11,11}, { 7, 7}, {15, 7}, { 7,15}, {15,15}, { 3, 7}, {11, 7}, { 3,15}, {11,15}, { 7, 3}, {15, 3}, { 7,11}, {15,11}, { 1, 3}, { 9, 3}, { 1,11}, { 9,11}, { 5, 7}, {13, 7}, { 5,15}, {13,15}, { 1, 7}, { 9, 7}, { 1,15}, { 9,15}, { 5, 3}, {13, 3}, { 5,11}, {13,11}, { 3, 1}, {11, 1}, { 3, 9}, {11, 9}, { 7, 5}, {15, 5}, { 7,13}, {15,13}, { 3, 5}, {11, 5}, { 3,13}, {11,13}, { 7, 1}, {15, 1}, { 7, 9}, {15, 9}, { 0, 1}, { 8, 1}, { 0, 9}, { 8, 9}, { 4, 5}, {12, 5}, { 4,13}, {12,13}, { 0, 5}, { 8, 5}, { 0,13}, { 8,13}, { 4, 1}, {12, 1}, { 4, 9}, {12, 9}, { 2, 3}, {10, 3}, { 2,11}, {10,11}, { 6, 7}, {14, 7}, { 6,15}, {14,15}, { 2, 7}, {10, 7}, { 2,15}, {10,15}, { 6, 3}, {14, 3}, { 6,11}, {14,11}, { 0, 3}, { 8, 3}, { 0,11}, { 8,11}, { 4, 7}, {12, 7}, { 4,15}, {12,15}, { 0, 7}, { 8, 7}, { 0,15}, { 8,15}, { 4, 3}, {12, 3}, { 4,11}, {12,11}, { 2, 1}, {10, 1}, { 2, 9}, {10, 9}, { 6, 5}, {14, 5}, { 6,13}, {14,13}, { 2, 5}, {10, 5}, { 2,13}, {10,13}, { 6, 1}, {14, 1}, { 6, 9}, {14, 9}, { 1, 0}, { 9, 0}, { 1, 8}, { 9, 8}, { 5, 4}, {13, 4}, { 5,12}, {13,12}, { 1, 4}, { 9, 4}, { 1,12}, { 9,12}, { 5, 0}, {13, 0}, { 5, 8}, {13, 8}, { 3, 2}, {11, 2}, { 3,10}, {11,10}, { 7, 6}, {15, 6}, { 7,14}, {15,14}, { 3, 6}, {11, 6}, { 3,14}, {11,14}, { 7, 2}, {15, 2}, { 7,10}, {15,10}, { 1, 2}, { 9, 2}, { 1,10}, { 9,10}, { 5, 6}, {13, 6}, { 5,14}, {13,14}, { 1, 6}, { 9, 6}, { 1,14}, { 9,14}, { 5, 2}, {13, 2}, { 5,10}, {13,10}, { 3, 0}, {11, 0}, { 3, 8}, {11, 8}, { 7, 4}, {15, 4}, { 7,12}, {15,12}, { 3, 4}, {11, 4}, { 3,12}, {11,12}, { 7, 0}, {15, 0}, { 7, 8}, {15, 8},
-};
-
-struct vf_priv_s {
- int log2_count;
- int qp;
- int mode;
- int mpeg2;
- int temp_stride[3];
- uint8_t *src[3];
- int16_t *temp[3];
- int outbuf_size;
- uint8_t *outbuf;
- AVCodecContext *avctx_enc[BLOCK*BLOCK];
- AVFrame *frame;
- AVFrame *frame_dec;
-};
-
-static void store_slice_c(uint8_t *dst, int16_t *src, int dst_stride, int src_stride, int width, int height, int log2_scale){
- int y, x;
-
-#define STORE(pos) \
- temp= ((src[x + y*src_stride + pos]<<log2_scale) + d[pos])>>8;\
- if(temp & 0x100) temp= ~(temp>>31);\
- dst[x + y*dst_stride + pos]= temp;
-
- for(y=0; y<height; y++){
- const uint8_t *d= dither[y&7];
- for(x=0; x<width; x+=8){
- int temp;
- STORE(0);
- STORE(1);
- STORE(2);
- STORE(3);
- STORE(4);
- STORE(5);
- STORE(6);
- STORE(7);
- }
- }
-}
-
-static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, int height, uint8_t *qp_store, int qp_stride){
- int x, y, i, j;
- const int count= 1<<p->log2_count;
-
- for(i=0; i<3; i++){
- int is_chroma= !!i;
- int w= width >>is_chroma;
- int h= height>>is_chroma;
- int stride= p->temp_stride[i];
- int block= BLOCK>>is_chroma;
-
- if (!src[i] || !dst[i])
- continue; // HACK avoid crash for Y8 colourspace
- for(y=0; y<h; y++){
- int index= block + block*stride + y*stride;
- fast_memcpy(p->src[i] + index, src[i] + y*src_stride[i], w);
- for(x=0; x<block; x++){
- p->src[i][index - x - 1]= p->src[i][index + x ];
- p->src[i][index + w + x ]= p->src[i][index + w - x - 1];
- }
- }
- for(y=0; y<block; y++){
- fast_memcpy(p->src[i] + ( block-1-y)*stride, p->src[i] + ( y+block )*stride, stride);
- fast_memcpy(p->src[i] + (h+block +y)*stride, p->src[i] + (h-y+block-1)*stride, stride);
- }
-
- p->frame->linesize[i]= stride;
- memset(p->temp[i], 0, (h+2*block)*stride*sizeof(int16_t));
- }
-
- if(p->qp)
- p->frame->quality= p->qp * FF_QP2LAMBDA;
- else
- p->frame->quality= norm_qscale(qp_store[0], p->mpeg2) * FF_QP2LAMBDA;
-// init per MB qscale stuff FIXME
-
- for(i=0; i<count; i++){
- const int x1= offset[i+count-1][0];
- const int y1= offset[i+count-1][1];
- int offset;
- p->frame->data[0]= p->src[0] + x1 + y1 * p->frame->linesize[0];
- p->frame->data[1]= p->src[1] + x1/2 + y1/2 * p->frame->linesize[1];
- p->frame->data[2]= p->src[2] + x1/2 + y1/2 * p->frame->linesize[2];
-
- avcodec_encode_video(p->avctx_enc[i], p->outbuf, p->outbuf_size, p->frame);
- p->frame_dec = p->avctx_enc[i]->coded_frame;
-
- offset= (BLOCK-x1) + (BLOCK-y1)*p->frame_dec->linesize[0];
- //FIXME optimize
- for(y=0; y<height; y++){
- for(x=0; x<width; x++){
- p->temp[0][ x + y*p->temp_stride[0] ] += p->frame_dec->data[0][ x + y*p->frame_dec->linesize[0] + offset ];
- }
- }
- offset= (BLOCK/2-x1/2) + (BLOCK/2-y1/2)*p->frame_dec->linesize[1];
- for(y=0; y<height/2; y++){
- for(x=0; x<width/2; x++){
- p->temp[1][ x + y*p->temp_stride[1] ] += p->frame_dec->data[1][ x + y*p->frame_dec->linesize[1] + offset ];
- p->temp[2][ x + y*p->temp_stride[2] ] += p->frame_dec->data[2][ x + y*p->frame_dec->linesize[2] + offset ];
- }
- }
- }
-
- for(j=0; j<3; j++){
- int is_chroma= !!j;
- if (!dst[j])
- continue; // HACK avoid crash for Y8 colourspace
- store_slice_c(dst[j], p->temp[j], dst_stride[j], p->temp_stride[j], width>>is_chroma, height>>is_chroma, 8-p->log2_count);
- }
-}
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- int i;
- AVCodec *enc= avcodec_find_encoder(CODEC_ID_SNOW);
-
- for(i=0; i<3; i++){
- int is_chroma= !!i;
- int w= ((width + 4*BLOCK-1) & (~(2*BLOCK-1)))>>is_chroma;
- int h= ((height + 4*BLOCK-1) & (~(2*BLOCK-1)))>>is_chroma;
-
- vf->priv->temp_stride[i]= w;
- vf->priv->temp[i]= malloc(vf->priv->temp_stride[i]*h*sizeof(int16_t));
- vf->priv->src [i]= malloc(vf->priv->temp_stride[i]*h*sizeof(uint8_t));
- }
- for(i=0; i< (1<<vf->priv->log2_count); i++){
- AVCodecContext *avctx_enc;
-
- avctx_enc = vf->priv->avctx_enc[i] = avcodec_alloc_context3(enc);
- avctx_enc->width = width + BLOCK;
- avctx_enc->height = height + BLOCK;
- avctx_enc->time_base= (AVRational){1,25}; // meaningless
- avctx_enc->gop_size = 300;
- avctx_enc->max_b_frames= 0;
- avctx_enc->pix_fmt = PIX_FMT_YUV420P;
- avctx_enc->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_LOW_DELAY;
- avctx_enc->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
- avctx_enc->global_quality= 123;
- int res = avcodec_open2(avctx_enc, enc, NULL);
- assert(res >= 0);
- }
- vf->priv->frame= avcodec_alloc_frame();
- vf->priv->frame_dec= avcodec_alloc_frame();
-
- vf->priv->outbuf_size= (width + BLOCK)*(height + BLOCK)*10;
- vf->priv->outbuf= malloc(vf->priv->outbuf_size);
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
-}
-
-static void get_image(struct vf_instance *vf, mp_image_t *mpi){
- if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
- // ok, we can do pp in-place (or pp disabled):
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- mpi->type, mpi->flags | MP_IMGFLAG_READABLE, mpi->width, mpi->height);
- mpi->planes[0]=vf->dmpi->planes[0];
- mpi->stride[0]=vf->dmpi->stride[0];
- mpi->width=vf->dmpi->width;
- if(mpi->flags&MP_IMGFLAG_PLANAR){
- mpi->planes[1]=vf->dmpi->planes[1];
- mpi->planes[2]=vf->dmpi->planes[2];
- mpi->stride[1]=vf->dmpi->stride[1];
- mpi->stride[2]=vf->dmpi->stride[2];
- }
- mpi->flags|=MP_IMGFLAG_DIRECT;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
-
- if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
- // no DR, so get a new image! hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP,
- MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_PREFER_ALIGNED_STRIDE,
- mpi->width,mpi->height);
- vf_clone_mpi_attributes(dmpi, mpi);
- }else{
- dmpi=vf->dmpi;
- }
-
- vf->priv->mpeg2= mpi->qscale_type;
- if(vf->priv->log2_count || !(mpi->flags&MP_IMGFLAG_DIRECT)){
- if(mpi->qscale || vf->priv->qp){
- filter(vf->priv, dmpi->planes, mpi->planes, dmpi->stride, mpi->stride, mpi->w, mpi->h, mpi->qscale, mpi->qstride);
- }else{
- memcpy_pic(dmpi->planes[0], mpi->planes[0], mpi->w, mpi->h, dmpi->stride[0], mpi->stride[0]);
- memcpy_pic(dmpi->planes[1], mpi->planes[1], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[1], mpi->stride[1]);
- memcpy_pic(dmpi->planes[2], mpi->planes[2], mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, dmpi->stride[2], mpi->stride[2]);
- }
- }
-
-#if HAVE_MMX
- if(gCpuCaps.hasMMX) __asm__ volatile ("emms\n\t");
-#endif
-#if HAVE_MMX2
- if(gCpuCaps.hasMMX2) __asm__ volatile ("sfence\n\t");
-#endif
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-static void uninit(struct vf_instance *vf){
- int i;
- if(!vf->priv) return;
-
- for(i=0; i<3; i++){
- free(vf->priv->temp[i]);
- vf->priv->temp[i]= NULL;
- free(vf->priv->src[i]);
- vf->priv->src[i]= NULL;
- }
- for(i=0; i<BLOCK*BLOCK; i++){
- av_freep(&vf->priv->avctx_enc[i]);
- }
-
- free(vf->priv);
- vf->priv=NULL;
-}
-
-//===========================================================================//
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_Y800:
- case IMGFMT_Y8:
- return vf_next_query_format(vf,fmt);
- }
- return 0;
-}
-
-static int control(struct vf_instance *vf, int request, void* data){
- switch(request){
- case VFCTRL_QUERY_MAX_PP_LEVEL:
- return 8;
- case VFCTRL_SET_PP_LEVEL:
- vf->priv->log2_count= *((unsigned int*)data);
- //FIXME we have to realloc a few things here
- return CONTROL_TRUE;
- }
- return vf_next_control(vf,request,data);
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
-
- int log2c=-1;
-
- vf->config=config;
- vf->put_image=put_image;
- vf->get_image=get_image;
- vf->query_format=query_format;
- vf->uninit=uninit;
- vf->control= control;
- vf->priv=malloc(sizeof(struct vf_priv_s));
- memset(vf->priv, 0, sizeof(struct vf_priv_s));
-
- vf->priv->log2_count= 4;
-
- if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode);
-
- if( log2c >=0 && log2c <=8 )
- vf->priv->log2_count = log2c;
-
- if(vf->priv->qp < 0)
- vf->priv->qp = 0;
-
-// #if HAVE_MMX
-// if(gCpuCaps.hasMMX){
-// store_slice= store_slice_mmx;
-// }
-// #endif
-
- return 1;
-}
-
-const vf_info_t vf_info_uspp = {
- "ultra simple/slow postprocess",
- "uspp",
- "Michael Niedermayer",
- "",
- vf_open,
- NULL
-};
diff --git a/libmpcodecs/vf_yuvcsp.c b/libmpcodecs/vf_yuvcsp.c
deleted file mode 100644
index 792fcaceb4..0000000000
--- a/libmpcodecs/vf_yuvcsp.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-struct vf_priv_s {
- int csp;
-};
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
- return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
-}
-
-static inline int clamp_y(int x){
- return (x > 235) ? 235 : (x < 16) ? 16 : x;
-}
-
-static inline int clamp_c(int x){
- return (x > 240) ? 240 : (x < 16) ? 16 : x;
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- int i,j;
- uint8_t *y_in, *cb_in, *cr_in;
- uint8_t *y_out, *cb_out, *cr_out;
-
- vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
- MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
- mpi->width, mpi->height);
-
- y_in = mpi->planes[0];
- cb_in = mpi->planes[1];
- cr_in = mpi->planes[2];
-
- y_out = vf->dmpi->planes[0];
- cb_out = vf->dmpi->planes[1];
- cr_out = vf->dmpi->planes[2];
-
- for (i = 0; i < mpi->height; i++)
- for (j = 0; j < mpi->width; j++)
- y_out[i*vf->dmpi->stride[0]+j] = clamp_y(y_in[i*mpi->stride[0]+j]);
-
- for (i = 0; i < mpi->chroma_height; i++)
- for (j = 0; j < mpi->chroma_width; j++)
- {
- cb_out[i*vf->dmpi->stride[1]+j] = clamp_c(cb_in[i*mpi->stride[1]+j]);
- cr_out[i*vf->dmpi->stride[2]+j] = clamp_c(cr_in[i*mpi->stride[2]+j]);
- }
-
- return vf_next_put_image(vf,vf->dmpi, pts);
-}
-
-//===========================================================================//
-
-/*
-static void uninit(struct vf_instance *vf){
- free(vf->priv);
-}
-*/
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- switch(fmt){
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- return 1;
- }
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
-// vf->uninit=uninit;
- vf->query_format=query_format;
-// vf->priv=calloc(1, sizeof(struct vf_priv_s));
-// if (args)
-// vf->priv->csp = atoi(args);
- return 1;
-}
-
-const vf_info_t vf_info_yuvcsp = {
- "yuv colorspace converter",
- "yuvcsp",
- "Alex Beregszaszi",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vf_yvu9.c b/libmpcodecs/vf_yvu9.c
deleted file mode 100644
index 1e4e7be561..0000000000
--- a/libmpcodecs/vf_yvu9.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "mp_msg.h"
-
-#include "img_format.h"
-#include "mp_image.h"
-#include "vf.h"
-
-#include "libvo/fastmemcpy.h"
-
-//===========================================================================//
-
-static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
-
- if(vf_next_query_format(vf,IMGFMT_YV12)<=0){
- mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YVU9");
- return 0;
- }
-
- return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12);
-}
-
-static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- mp_image_t *dmpi;
- int y,w,h;
-
- // hope we'll get DR buffer:
- dmpi=vf_get_image(vf->next,IMGFMT_YV12,
- MP_IMGTYPE_TEMP, 0/*MP_IMGFLAG_ACCEPT_STRIDE*/,
- mpi->w, mpi->h);
-
- for(y=0;y<mpi->h;y++)
- fast_memcpy(dmpi->planes[0]+dmpi->stride[0]*y,
- mpi->planes[0]+mpi->stride[0]*y,
- mpi->w);
-
- w=mpi->w/4; h=mpi->h/2;
- for(y=0;y<h;y++){
- unsigned char* s=mpi->planes[1]+mpi->stride[1]*(y>>1);
- unsigned char* d=dmpi->planes[1]+dmpi->stride[1]*y;
- int x;
- for(x=0;x<w;x++) d[2*x]=d[2*x+1]=s[x];
- }
- for(y=0;y<h;y++){
- unsigned char* s=mpi->planes[2]+mpi->stride[2]*(y>>1);
- unsigned char* d=dmpi->planes[2]+dmpi->stride[2]*y;
- int x;
- for(x=0;x<w;x++) d[2*x]=d[2*x+1]=s[x];
- }
-
- vf_clone_mpi_attributes(dmpi, mpi);
-
- return vf_next_put_image(vf,dmpi, pts);
-}
-
-//===========================================================================//
-
-static int query_format(struct vf_instance *vf, unsigned int fmt){
- if (fmt == IMGFMT_YVU9 || fmt == IMGFMT_IF09)
- return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
- return 0;
-}
-
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->put_image=put_image;
- vf->query_format=query_format;
- return 1;
-}
-
-const vf_info_t vf_info_yvu9 = {
- "fast YVU9->YV12 conversion",
- "yvu9",
- "alex",
- "",
- vf_open,
- NULL
-};
-
-//===========================================================================//
diff --git a/libmpcodecs/vqf.h b/libmpcodecs/vqf.h
deleted file mode 100644
index 139b578da7..0000000000
--- a/libmpcodecs/vqf.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/* (c)Copyright 1996-2000 NTT Cyber Space Laboratories */
-/* Released on 2000.05.22 by N. Iwakami */
-/* Modified on 2000.05.25 by N. Iwakami */
-/* Released on 2000.09.06 by N. Iwakami */
-
-// Modified for MPlayer on 2004.12.29
-
-#ifndef MPLAYER_VQF_H
-#define MPLAYER_VQF_H
-
-#include <stdio.h>
-
-#ifdef _MSC_VER
-# ifdef DLL_MODULE
-# define DllPort __declspec( dllexport )
-# else
-# define DllPort __declspec( dllimport )
-# endif
-#else
-# define DllPort
-#endif
-
-#ifdef __cplusplus
-extern "C" { // only need to import/export C interface if used by C++ source code
-#endif
-
-/************************/
-/*** General settings ***/
-/************************/
-/* Initialization error code */
-enum INIT_ERROR_CODE {
- TVQ_NO_ERROR = 0, // no error
- TVQ_ERROR, // general
- TVQ_ERROR_VERSION, // wrong version
- TVQ_ERROR_CHANNEL, // channel setting error
- TVQ_ERROR_MODE, // wrong coding mode
- TVQ_ERROR_PARAM, // inner parameter setting error
- TVQ_ERROR_N_CAN, // wrong number of VQ pre-selection candidates, used only in encoder
-};
-
-/* version ID */
-#define TVQ_UNKNOWN_VERSION -1
-#define V2 0
-#define V2PP 1
-
-#define N_VERSIONS 2
-
-/* window types */
-enum WINDOW_TYPE {
- ONLY_LONG_WINDOW = 0,
- LONG_SHORT_WINDOW,
- ONLY_SHORT_WINDOW,
- SHORT_LONG_WINDOW,
- SHORT_MEDIUM_WINDOW,
- MEDIUM_LONG_WINDOW,
- LONG_MEDIUM_WINDOW,
- MEDIUM_SHORT_WINDOW,
- ONLY_MEDIUM_WINDOW,
-};
-
-/* block types */
-enum BLOCK_TYPE {
- BLK_SHORT = 0,
- BLK_MEDIUM,
- BLK_LONG,
- BLK_PPC,
-};
-#define N_BTYPE 3 // number of block types
-#define N_INTR_TYPE 4 // number of interleave types, enum BLOCK_TYPE is commonly used for detecting interleave types.
-
-/* maximum number of channels */
-#define N_CH_MAX 2
-
-/* type definition of code information interface */
-typedef struct {
- /* block type */
- int w_type;
- int btype;
-
- /* FBC info */
- int *segment_sw[ N_CH_MAX ];
- int *band_sw[ N_CH_MAX ];
- int *fg_intensity[ N_CH_MAX ];
-
- /* VQ info */
- int *wvq;
-
- /* BSE info */
- int *fw;
- int *fw_alf;
-
- /* gain info */
- int *pow;
-
- /* LSP info */
- int *lsp[ N_CH_MAX ];
-
- /* PPC info */
- int pit[ N_CH_MAX ];
- int *pls;
- int pgain[ N_CH_MAX ];
-
- /* EBC info */
- int *bc[ N_CH_MAX ];
-
- void *manager;
-} INDEX;
-
-/***********************************************/
-/*** Definitions about program configuration ***/
-/***********************************************/
-/* type definition of tvqConfInfoSubBlock */
-typedef struct {
- int sf_sz; // subframe size
- int nsf; // number of subframes
- int ndiv; // number of division of weighted interleave vector quantization
- int ncrb; // number of Bark-scale subbands
- int fw_ndiv; // number of division of BSE VQ
- int fw_nbit; // number of bits for BSE VQ
- int nsubg; // number of sub-blocks for gain coding
- int ppc_enable; // PPC switch
- int ebc_enable; // EBC switch
- int ebc_crb_base; // EBC base band
- int ebc_bits; // EBC bits
- int fbc_enable; // FBC switch
- int fbc_n_segment; // FBC number of segments
- int fbc_nband; // FBC number of subbands
- int *fbc_crb_tbl; // FBC subband table
-} tvqConfInfoSubBlock;
-
-/* type definition of tvqConfInfo */
-typedef struct {
- /* frame configuration */
- int N_CH;
- /* window type coding */
- int BITS_WTYPE;
- /* LSP coding */
- int LSP_BIT0;
- int LSP_BIT1;
- int LSP_BIT2;
- int LSP_SPLIT;
- /* Bark-scale envelope coding */
- int FW_ARSW_BITS;
- /* gain coding */
- int GAIN_BITS;
- int SUB_GAIN_BITS;
- /* pitch excitation */
- int N_DIV_P;
- int BASF_BIT;
- int PGAIN_BIT;
-
- /* block type dependent parameters */
- tvqConfInfoSubBlock cfg[N_BTYPE];
-
-} tvqConfInfo;
-
-
-/*************************************************/
-/*** Definitions about TwinVQ bitstream header ***/
-/*************************************************/
-//#include "declib_src/tvq_hdr.h"
-//#ifndef BUFSIZ
-//#define BUFSIZ 1024
-//#endif
-
-#define KEYWORD_BYTES 4
-#define VERSION_BYTES 8
-#define ELEM_BYTES sizeof(unsigned long)
-
-
-/*
- */
-typedef struct {
- char ID[KEYWORD_BYTES+VERSION_BYTES+1];
- int size;
- /* Common Chunk */
- int channelMode; /* channel mode (mono:0/stereo:1) */
- int bitRate; /* bit rate (kbit/s) */
- int samplingRate; /* sampling rate (44.1 kHz -> 44) */
- int securityLevel; /* security level (always 0) */
- /* Text Chunk */
- char Name[BUFSIZ];
- char Comt[BUFSIZ];
- char Auth[BUFSIZ];
- char Cpyr[BUFSIZ];
- char File[BUFSIZ];
- char Extr[BUFSIZ]; // add by OKAMOTO 99.12.21
- /* Data size chunk*/
- int Dsiz;
-} headerInfo;
-
-// TwinVQ decoder initialization/termination functions
-//DllPort int TvqInitialize( headerInfo *setupInfo, INDEX *index, int dispErrorMessageBox );
-//DllPort void TvqTerminate( INDEX *index );
-//DllPort void TvqGetVectorInfo(int *bits0[], int *bits1[]);
-//DllPort void TvqResetFrameCounter(void);
-
-// TwinVQ decoder function
-//DllPort void TvqDecodeFrame(INDEX *indexp, float out[]);
-//DllPort int TvqWtypeToBtype( int w_type, int *btype );
-//DllPort void TvqUpdateVectorInfo(int varbits, int *ndiv, int bits0[], int bits1[]);
-//DllPort void TvqSetFrameCounter( int position );
-
-// TwinVQ query functions
-//DllPort int TvqCheckVersion(char *versionID);
-//DllPort void TvqGetSetupInfo(headerInfo *setupInfo); // setup information
-//DllPort void TvqGetConfInfo(tvqConfInfo *cf); // configuration information
-//DllPort int TvqGetFrameSize(void); // frame size
-//DllPort int TvqGetNumChannels(void); // number of channels
-//DllPort int TvqGetBitRate(void); // total bitrate
-//DllPort float TvqGetSamplingRate(void); // sampling rate
-//DllPort int TvqGetNumFixedBitsPerFrame(void); // number of fixed bits per frame
-//DllPort int TvqGetNumFrames(void); // number of decoded frame
-//DllPort int TvqGetModuleVersion( char* versionString );
-
-#ifdef V2PLUS_SUPPORT
-// TwinVQ FB coding tool control
-DllPort void TvqFbCountUsedBits(int nbit); // count number of used bits
-DllPort float TvqGetFbCurrentBitrate(void); // query average bitrate for the tool
-DllPort int TvqGetFbTotalBits(void); // query total number of used bits
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* MPLAYER_VQF_H */
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index f1e41f5f6e..c93d67180e 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -470,7 +470,7 @@ static void parse_trackencodings(struct demuxer *demuxer,
else if (e.comp_algo == 0) {
mp_tmsg(MSGT_DEMUX, MSGL_WARN,
"[mkv] Track %u was compressed with zlib "
- "but mplayer has not been compiled\n"
+ "but mpv has not been compiled\n"
"[mkv] with support for zlib compression. "
"Skipping track.\n",
track->tnum);
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 4bffc1521f..3031dc5967 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -38,8 +38,8 @@
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
-#include <assert.h>
#include <math.h>
+#include <assert.h>
#include "talloc.h"
#include "gl_common.h"
#include "csputils.h"
@@ -241,6 +241,48 @@ int glFindFormat(uint32_t fmt, int have_texture_rg, int *bpp, GLint *gl_texfmt,
return supported;
}
+struct feature {
+ int id;
+ const char *name;
+};
+
+static const struct feature features[] = {
+ {MPGL_CAP_GL, "Basic OpenGL"},
+ {MPGL_CAP_GL_LEGACY, "Legacy OpenGL"},
+ {MPGL_CAP_GL2, "OpenGL 2.0"},
+ {MPGL_CAP_GL21, "OpenGL 2.1"},
+ {MPGL_CAP_GL3, "OpenGL 3.0"},
+ {MPGL_CAP_FB, "Framebuffers"},
+ {MPGL_CAP_VAO, "VAOs"},
+ {MPGL_CAP_SRGB_TEX, "sRGB textures"},
+ {MPGL_CAP_SRGB_FB, "sRGB framebuffers"},
+ {MPGL_CAP_FLOAT_TEX, "Float textures"},
+ {MPGL_CAP_TEX_RG, "RG textures"},
+ {MPGL_CAP_NO_SW, "NO_SW"},
+ {0},
+};
+
+static void list_features(int set, int msgl, bool invert)
+{
+ for (const struct feature *f = &features[0]; f->id; f++) {
+ if (invert == !(f->id & set))
+ mp_msg(MSGT_VO, msgl, " [%s]", f->name);
+ }
+ mp_msg(MSGT_VO, msgl, "\n");
+}
+
+// This guesses if the current GL context is a suspected software renderer.
+static bool is_software_gl(GL *gl)
+{
+ const char *renderer = gl->GetString(GL_RENDERER);
+ const char *vendor = gl->GetString(GL_VENDOR);
+ return !(renderer && vendor) ||
+ strcmp(renderer, "Software Rasterizer") == 0 ||
+ strstr(renderer, "llvmpipe") ||
+ strcmp(vendor, "Microsoft Corporation") == 0 ||
+ strcmp(renderer, "Mesa X11") == 0;
+}
+
#ifdef HAVE_LIBDL
#include <dlfcn.h>
#endif
@@ -262,235 +304,421 @@ static void *getdladdr(const char *s)
return ret;
}
-typedef struct {
- ptrdiff_t offset; // offset to the function pointer in struct GL
- const char *extstr;
- const char *funcnames[7];
+#define FN_OFFS(name) offsetof(GL, name)
+
+// Define the function with a "hard" reference to the function as fallback.
+// (This requires linking with a compatible OpenGL library.)
+#define DEF_FN_HARD(name) {FN_OFFS(name), {"gl" # name}, gl ## name}
+
+#define DEF_FN(name) {FN_OFFS(name), {"gl" # name}}
+#define DEF_FN_NAMES(name, ...) {FN_OFFS(name), {__VA_ARGS__}}
+
+struct gl_function {
+ ptrdiff_t offset;
+ char *funcnames[7];
void *fallback;
- bool is_gl3;
-} extfunc_desc_t;
-
-#define DEF_FUNC_DESC(name) \
- {offsetof(GL, name), NULL, {"gl" # name}, gl ## name}
-#define DEF_EXT_FUNCS(...) __VA_ARGS__
-#define DEF_EXT_DESC(name, ext, funcnames) \
- {offsetof(GL, name), ext, {DEF_EXT_FUNCS funcnames}}
-// These are mostly handled the same, but needed because at least the MESA
-// headers don't define any function prototypes for these.
-#define DEF_GL3_DESC(name) \
- {offsetof(GL, name), NULL, {"gl" # name}, NULL, .is_gl3 = true}
-
-static const extfunc_desc_t extfuncs[] = {
- // these aren't extension functions but we query them anyway to allow
- // different "backends" with one binary
- DEF_FUNC_DESC(Viewport),
- DEF_FUNC_DESC(Clear),
- DEF_FUNC_DESC(GenTextures),
- DEF_FUNC_DESC(DeleteTextures),
- DEF_FUNC_DESC(TexEnvi),
- DEF_FUNC_DESC(ClearColor),
- DEF_FUNC_DESC(Enable),
- DEF_FUNC_DESC(Disable),
- DEF_FUNC_DESC(DrawBuffer),
- DEF_FUNC_DESC(DepthMask),
- DEF_FUNC_DESC(BlendFunc),
- DEF_FUNC_DESC(Flush),
- DEF_FUNC_DESC(Finish),
- DEF_FUNC_DESC(PixelStorei),
- DEF_FUNC_DESC(TexImage1D),
- DEF_FUNC_DESC(TexImage2D),
- DEF_FUNC_DESC(TexSubImage2D),
- DEF_FUNC_DESC(GetTexImage),
- DEF_FUNC_DESC(TexParameteri),
- DEF_FUNC_DESC(TexParameterf),
- DEF_FUNC_DESC(TexParameterfv),
- DEF_FUNC_DESC(GetIntegerv),
- DEF_FUNC_DESC(GetBooleanv),
- DEF_FUNC_DESC(ColorMask),
- DEF_FUNC_DESC(ReadPixels),
- DEF_FUNC_DESC(ReadBuffer),
- DEF_FUNC_DESC(DrawArrays),
- DEF_FUNC_DESC(GetString),
- DEF_FUNC_DESC(GetError),
-
- // legacy GL functions (1.x - 2.x)
- DEF_FUNC_DESC(Begin),
- DEF_FUNC_DESC(End),
- DEF_FUNC_DESC(MatrixMode),
- DEF_FUNC_DESC(LoadIdentity),
- DEF_FUNC_DESC(Translated),
- DEF_FUNC_DESC(Scaled),
- DEF_FUNC_DESC(Ortho),
- DEF_FUNC_DESC(PushMatrix),
- DEF_FUNC_DESC(PopMatrix),
- DEF_FUNC_DESC(GenLists),
- DEF_FUNC_DESC(DeleteLists),
- DEF_FUNC_DESC(NewList),
- DEF_FUNC_DESC(EndList),
- DEF_FUNC_DESC(CallList),
- DEF_FUNC_DESC(CallLists),
- DEF_FUNC_DESC(Color4ub),
- DEF_FUNC_DESC(Color4f),
- DEF_FUNC_DESC(TexCoord2f),
- DEF_FUNC_DESC(TexCoord2fv),
- DEF_FUNC_DESC(Vertex2f),
- DEF_FUNC_DESC(VertexPointer),
- DEF_FUNC_DESC(ColorPointer),
- DEF_FUNC_DESC(TexCoordPointer),
- DEF_FUNC_DESC(EnableClientState),
- DEF_FUNC_DESC(DisableClientState),
-
- // OpenGL extension functions
- DEF_EXT_DESC(GenBuffers, NULL,
- ("glGenBuffers", "glGenBuffersARB")),
- DEF_EXT_DESC(DeleteBuffers, NULL,
- ("glDeleteBuffers", "glDeleteBuffersARB")),
- DEF_EXT_DESC(BindBuffer, NULL,
- ("glBindBuffer", "glBindBufferARB")),
- DEF_EXT_DESC(MapBuffer, NULL,
- ("glMapBuffer", "glMapBufferARB")),
- DEF_EXT_DESC(UnmapBuffer, NULL,
- ("glUnmapBuffer", "glUnmapBufferARB")),
- DEF_EXT_DESC(BufferData, NULL,
- ("glBufferData", "glBufferDataARB")),
- DEF_EXT_DESC(ActiveTexture, NULL,
- ("glActiveTexture", "glActiveTextureARB")),
- DEF_EXT_DESC(BindTexture, NULL,
- ("glBindTexture", "glBindTextureARB", "glBindTextureEXT")),
- DEF_EXT_DESC(MultiTexCoord2f, NULL,
- ("glMultiTexCoord2f", "glMultiTexCoord2fARB")),
- DEF_EXT_DESC(GenPrograms, "_program",
- ("glGenProgramsARB")),
- DEF_EXT_DESC(DeletePrograms, "_program",
- ("glDeleteProgramsARB")),
- DEF_EXT_DESC(BindProgram, "_program",
- ("glBindProgramARB")),
- DEF_EXT_DESC(ProgramString, "_program",
- ("glProgramStringARB")),
- DEF_EXT_DESC(GetProgramivARB, "_program",
- ("glGetProgramivARB")),
- DEF_EXT_DESC(ProgramEnvParameter4f, "_program",
- ("glProgramEnvParameter4fARB")),
- DEF_EXT_DESC(SwapInterval, "_swap_control",
- ("glXSwapIntervalSGI", "glXSwapInterval", "wglSwapIntervalSGI",
- "wglSwapInterval", "wglSwapIntervalEXT")),
- DEF_EXT_DESC(TexImage3D, NULL,
- ("glTexImage3D")),
-
- // ancient ATI extensions
- DEF_EXT_DESC(BeginFragmentShader, "ATI_fragment_shader",
- ("glBeginFragmentShaderATI")),
- DEF_EXT_DESC(EndFragmentShader, "ATI_fragment_shader",
- ("glEndFragmentShaderATI")),
- DEF_EXT_DESC(SampleMap, "ATI_fragment_shader",
- ("glSampleMapATI")),
- DEF_EXT_DESC(ColorFragmentOp2, "ATI_fragment_shader",
- ("glColorFragmentOp2ATI")),
- DEF_EXT_DESC(ColorFragmentOp3, "ATI_fragment_shader",
- ("glColorFragmentOp3ATI")),
- DEF_EXT_DESC(SetFragmentShaderConstant, "ATI_fragment_shader",
- ("glSetFragmentShaderConstantATI")),
-
- // GL 3, possibly in GL 2.x as well in form of extensions
- DEF_GL3_DESC(GenBuffers),
- DEF_GL3_DESC(DeleteBuffers),
- DEF_GL3_DESC(BindBuffer),
- DEF_GL3_DESC(MapBuffer),
- DEF_GL3_DESC(UnmapBuffer),
- DEF_GL3_DESC(BufferData),
- DEF_GL3_DESC(ActiveTexture),
- DEF_GL3_DESC(BindTexture),
- DEF_GL3_DESC(GenVertexArrays),
- DEF_GL3_DESC(BindVertexArray),
- DEF_GL3_DESC(GetAttribLocation),
- DEF_GL3_DESC(EnableVertexAttribArray),
- DEF_GL3_DESC(DisableVertexAttribArray),
- DEF_GL3_DESC(VertexAttribPointer),
- DEF_GL3_DESC(DeleteVertexArrays),
- DEF_GL3_DESC(UseProgram),
- DEF_GL3_DESC(GetUniformLocation),
- DEF_GL3_DESC(CompileShader),
- DEF_GL3_DESC(CreateProgram),
- DEF_GL3_DESC(CreateShader),
- DEF_GL3_DESC(ShaderSource),
- DEF_GL3_DESC(LinkProgram),
- DEF_GL3_DESC(AttachShader),
- DEF_GL3_DESC(DeleteShader),
- DEF_GL3_DESC(DeleteProgram),
- DEF_GL3_DESC(GetShaderInfoLog),
- DEF_GL3_DESC(GetShaderiv),
- DEF_GL3_DESC(GetProgramInfoLog),
- DEF_GL3_DESC(GetProgramiv),
- DEF_GL3_DESC(GetStringi),
- DEF_GL3_DESC(BindAttribLocation),
- DEF_GL3_DESC(BindFramebuffer),
- DEF_GL3_DESC(GenFramebuffers),
- DEF_GL3_DESC(DeleteFramebuffers),
- DEF_GL3_DESC(CheckFramebufferStatus),
- DEF_GL3_DESC(FramebufferTexture2D),
- DEF_GL3_DESC(Uniform1f),
- DEF_GL3_DESC(Uniform3f),
- DEF_GL3_DESC(Uniform4f),
- DEF_GL3_DESC(Uniform1i),
- DEF_GL3_DESC(UniformMatrix3fv),
- DEF_GL3_DESC(UniformMatrix4x3fv),
-
- {-1}
};
+struct gl_functions {
+ const char *extension; // introduced with this extension in any version
+ int provides; // bitfield of MPGL_CAP_* constants
+ int ver_core; // introduced as required function
+ int ver_removed; // removed as required function (no replacement)
+ bool partial_ok; // loading only some functions is ok
+ struct gl_function *functions;
+};
+
+#define MAX_FN_COUNT 50 // max functions per gl_functions section
+
+struct gl_functions gl_functions[] = {
+ // GL functions which are always available anywhere at least since 1.1
+ {
+ .ver_core = MPGL_VER(1, 1),
+ .provides = MPGL_CAP_GL,
+ .functions = (struct gl_function[]) {
+ DEF_FN_HARD(Viewport),
+ DEF_FN_HARD(Clear),
+ DEF_FN_HARD(GenTextures),
+ DEF_FN_HARD(DeleteTextures),
+ DEF_FN_HARD(TexEnvi),
+ DEF_FN_HARD(ClearColor),
+ DEF_FN_HARD(Enable),
+ DEF_FN_HARD(Disable),
+ DEF_FN_HARD(DrawBuffer),
+ DEF_FN_HARD(DepthMask),
+ DEF_FN_HARD(BlendFunc),
+ DEF_FN_HARD(Flush),
+ DEF_FN_HARD(Finish),
+ DEF_FN_HARD(PixelStorei),
+ DEF_FN_HARD(TexImage1D),
+ DEF_FN_HARD(TexImage2D),
+ DEF_FN_HARD(TexSubImage2D),
+ DEF_FN_HARD(GetTexImage),
+ DEF_FN_HARD(TexParameteri),
+ DEF_FN_HARD(TexParameterf),
+ DEF_FN_HARD(TexParameterfv),
+ DEF_FN_HARD(GetIntegerv),
+ DEF_FN_HARD(GetBooleanv),
+ DEF_FN_HARD(ColorMask),
+ DEF_FN_HARD(ReadPixels),
+ DEF_FN_HARD(ReadBuffer),
+ DEF_FN_HARD(DrawArrays),
+ DEF_FN_HARD(GetString),
+ DEF_FN_HARD(GetError),
+ {0}
+ },
+ },
+ // GL 2.0-3.x functions
+ {
+ .ver_core = MPGL_VER(2, 0),
+ .provides = MPGL_CAP_GL2,
+ .functions = (struct gl_function[]) {
+ DEF_FN(GenBuffers),
+ DEF_FN(DeleteBuffers),
+ DEF_FN(BindBuffer),
+ DEF_FN(MapBuffer),
+ DEF_FN(UnmapBuffer),
+ DEF_FN(BufferData),
+ DEF_FN(ActiveTexture),
+ DEF_FN(BindTexture),
+ DEF_FN(GetAttribLocation),
+ DEF_FN(EnableVertexAttribArray),
+ DEF_FN(DisableVertexAttribArray),
+ DEF_FN(VertexAttribPointer),
+ DEF_FN(UseProgram),
+ DEF_FN(GetUniformLocation),
+ DEF_FN(CompileShader),
+ DEF_FN(CreateProgram),
+ DEF_FN(CreateShader),
+ DEF_FN(ShaderSource),
+ DEF_FN(LinkProgram),
+ DEF_FN(AttachShader),
+ DEF_FN(DeleteShader),
+ DEF_FN(DeleteProgram),
+ DEF_FN(GetShaderInfoLog),
+ DEF_FN(GetShaderiv),
+ DEF_FN(GetProgramInfoLog),
+ DEF_FN(GetProgramiv),
+ DEF_FN(BindAttribLocation),
+ DEF_FN(Uniform1f),
+ DEF_FN(Uniform2f),
+ DEF_FN(Uniform3f),
+ DEF_FN(Uniform1i),
+ DEF_FN(UniformMatrix3fv),
+ DEF_FN(TexImage3D),
+ {0},
+ },
+ },
+ // GL 2.1-3.x functions (also: GLSL 120 shaders)
+ {
+ .ver_core = MPGL_VER(2, 1),
+ .provides = MPGL_CAP_GL21,
+ .functions = (struct gl_function[]) {
+ DEF_FN(UniformMatrix4x3fv),
+ {0}
+ },
+ },
+ // GL 3.x core only functions.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .provides = MPGL_CAP_GL3 | MPGL_CAP_SRGB_TEX | MPGL_CAP_SRGB_FB,
+ .functions = (struct gl_function[]) {
+ DEF_FN(GetStringi),
+ {0}
+ },
+ },
+ // Framebuffers, extension in GL 2.x, core in GL 3.x core.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .extension = "GL_ARB_framebuffer_object",
+ .provides = MPGL_CAP_FB,
+ .functions = (struct gl_function[]) {
+ DEF_FN(BindFramebuffer),
+ DEF_FN(GenFramebuffers),
+ DEF_FN(DeleteFramebuffers),
+ DEF_FN(CheckFramebufferStatus),
+ DEF_FN(FramebufferTexture2D),
+ {0}
+ },
+ },
+ // Framebuffers, alternative extension name.
+ {
+ .ver_removed = MPGL_VER(3, 0), // don't touch these fn names in 3.x
+ .extension = "GL_EXT_framebuffer_object",
+ .provides = MPGL_CAP_FB,
+ .functions = (struct gl_function[]) {
+ DEF_FN_NAMES(BindFramebuffer, "glBindFramebufferEXT"),
+ DEF_FN_NAMES(GenFramebuffers, "glGenFramebuffersEXT"),
+ DEF_FN_NAMES(DeleteFramebuffers, "glDeleteFramebuffersEXT"),
+ DEF_FN_NAMES(CheckFramebufferStatus, "glCheckFramebufferStatusEXT"),
+ DEF_FN_NAMES(FramebufferTexture2D, "glFramebufferTexture2DEXT"),
+ {0}
+ },
+ },
+ // VAOs, extension in GL 2.x, core in GL 3.x core.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .extension = "GL_ARB_vertex_array_object",
+ .provides = MPGL_CAP_VAO,
+ .functions = (struct gl_function[]) {
+ DEF_FN(GenVertexArrays),
+ DEF_FN(BindVertexArray),
+ DEF_FN(DeleteVertexArrays),
+ {0}
+ }
+ },
+ // sRGB textures, extension in GL 2.x, core in GL 3.x core.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .extension = "GL_EXT_texture_sRGB",
+ .provides = MPGL_CAP_SRGB_TEX,
+ .functions = (struct gl_function[]) {{0}},
+ },
+ // sRGB framebuffers, extension in GL 2.x, core in GL 3.x core.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .extension = "GL_EXT_framebuffer_sRGB",
+ .provides = MPGL_CAP_SRGB_FB,
+ .functions = (struct gl_function[]) {{0}},
+ },
+ // Float textures, extension in GL 2.x, core in GL 3.x core.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .extension = "GL_ARB_texture_float",
+ .provides = MPGL_CAP_FLOAT_TEX,
+ .functions = (struct gl_function[]) {{0}},
+ },
+ // GL_RED / GL_RG textures, extension in GL 2.x, core in GL 3.x core.
+ {
+ .ver_core = MPGL_VER(3, 0),
+ .extension = "GL_ARB_texture_rg",
+ .provides = MPGL_CAP_TEX_RG,
+ .functions = (struct gl_function[]) {{0}},
+ },
+ // Swap control, always an OS specific extension
+ {
+ .extension = "_swap_control",
+ .functions = (struct gl_function[]) {
+ DEF_FN_NAMES(SwapInterval, "glXSwapIntervalSGI", "glXSwapInterval",
+ "wglSwapIntervalSGI", "wglSwapInterval",
+ "wglSwapIntervalEXT"),
+ {0}
+ },
+ },
+ // GL legacy functions in GL 1.x - 2.x, removed from GL 3.x
+ {
+ .ver_core = MPGL_VER(1, 1),
+ .ver_removed = MPGL_VER(3, 0),
+ .provides = MPGL_CAP_GL_LEGACY,
+ .functions = (struct gl_function[]) {
+ DEF_FN_HARD(Begin),
+ DEF_FN_HARD(End),
+ DEF_FN_HARD(MatrixMode),
+ DEF_FN_HARD(LoadIdentity),
+ DEF_FN_HARD(Translated),
+ DEF_FN_HARD(Scaled),
+ DEF_FN_HARD(Ortho),
+ DEF_FN_HARD(PushMatrix),
+ DEF_FN_HARD(PopMatrix),
+ DEF_FN_HARD(GenLists),
+ DEF_FN_HARD(DeleteLists),
+ DEF_FN_HARD(NewList),
+ DEF_FN_HARD(EndList),
+ DEF_FN_HARD(CallList),
+ DEF_FN_HARD(CallLists),
+ DEF_FN_HARD(Color4ub),
+ DEF_FN_HARD(Color4f),
+ DEF_FN_HARD(TexCoord2f),
+ DEF_FN_HARD(TexCoord2fv),
+ DEF_FN_HARD(Vertex2f),
+ DEF_FN_HARD(VertexPointer),
+ DEF_FN_HARD(ColorPointer),
+ DEF_FN_HARD(TexCoordPointer),
+ DEF_FN_HARD(EnableClientState),
+ DEF_FN_HARD(DisableClientState),
+ {0}
+ },
+ },
+ // Loading of old extensions, which are later added to GL 2.0.
+ // NOTE: actually we should be checking the extension strings: the OpenGL
+ // library could provide an entry point, but not implement it.
+ // But the previous code didn't do that, and nobody ever complained.
+ {
+ .ver_removed = MPGL_VER(2, 1),
+ .partial_ok = true,
+ .functions = (struct gl_function[]) {
+ DEF_FN_NAMES(GenBuffers, "glGenBuffers", "glGenBuffersARB"),
+ DEF_FN_NAMES(DeleteBuffers, "glDeleteBuffers", "glDeleteBuffersARB"),
+ DEF_FN_NAMES(BindBuffer, "glBindBuffer", "glBindBufferARB"),
+ DEF_FN_NAMES(MapBuffer, "glMapBuffer", "glMapBufferARB"),
+ DEF_FN_NAMES(UnmapBuffer, "glUnmapBuffer", "glUnmapBufferARB"),
+ DEF_FN_NAMES(BufferData, "glBufferData", "glBufferDataARB"),
+ DEF_FN_NAMES(ActiveTexture, "glActiveTexture", "glActiveTextureARB"),
+ DEF_FN_NAMES(BindTexture, "glBindTexture", "glBindTextureARB", "glBindTextureEXT"),
+ DEF_FN_NAMES(MultiTexCoord2f, "glMultiTexCoord2f", "glMultiTexCoord2fARB"),
+ DEF_FN_NAMES(TexImage3D, "glTexImage3D"),
+ {0}
+ },
+ },
+ // Ancient ARB shaders.
+ {
+ .extension = "_program",
+ .ver_removed = MPGL_VER(3, 0),
+ .functions = (struct gl_function[]) {
+ DEF_FN_NAMES(GenPrograms, "glGenProgramsARB"),
+ DEF_FN_NAMES(DeletePrograms, "glDeleteProgramsARB"),
+ DEF_FN_NAMES(BindProgram, "glBindProgramARB"),
+ DEF_FN_NAMES(ProgramString, "glProgramStringARB"),
+ DEF_FN_NAMES(GetProgramivARB, "glGetProgramivARB"),
+ DEF_FN_NAMES(ProgramEnvParameter4f, "glProgramEnvParameter4fARB"),
+ {0}
+ },
+ },
+ // Ancient ATI extensions.
+ {
+ .extension = "ATI_fragment_shader",
+ .ver_removed = MPGL_VER(3, 0),
+ .functions = (struct gl_function[]) {
+ DEF_FN_NAMES(BeginFragmentShader, "glBeginFragmentShaderATI"),
+ DEF_FN_NAMES(EndFragmentShader, "glEndFragmentShaderATI"),
+ DEF_FN_NAMES(SampleMap, "glSampleMapATI"),
+ DEF_FN_NAMES(ColorFragmentOp2, "glColorFragmentOp2ATI"),
+ DEF_FN_NAMES(ColorFragmentOp3, "glColorFragmentOp3ATI"),
+ DEF_FN_NAMES(SetFragmentShaderConstant, "glSetFragmentShaderConstantATI"),
+ {0}
+ },
+ },
+};
+
+#undef FN_OFFS
+#undef DEF_FN_HARD
+#undef DEF_FN
+#undef DEF_FN_NAMES
+
+
/**
* \brief find the function pointers of some useful OpenGL extensions
* \param getProcAddress function to resolve function names, may be NULL
* \param ext2 an extra extension string
*/
static void getFunctions(GL *gl, void *(*getProcAddress)(const GLubyte *),
- const char *ext2, bool is_gl3)
+ const char *ext2, bool gl3)
{
- const extfunc_desc_t *dsc;
- char *allexts = talloc_strdup(NULL, ext2 ? ext2 : "");
-
- *gl = (GL) {0};
+ talloc_free_children(gl);
+ *gl = (GL) {
+ .extensions = talloc_strdup(gl, ext2 ? ext2 : ""),
+ };
if (!getProcAddress)
getProcAddress = (void *)getdladdr;
- if (is_gl3) {
+ GLint major = 0, minor = 0;
+ if (gl3) {
gl->GetStringi = getProcAddress("glGetStringi");
gl->GetIntegerv = getProcAddress("glGetIntegerv");
if (!(gl->GetStringi && gl->GetIntegerv))
return;
+ gl->GetIntegerv(GL_MAJOR_VERSION, &major);
+ gl->GetIntegerv(GL_MINOR_VERSION, &minor);
+
GLint exts;
gl->GetIntegerv(GL_NUM_EXTENSIONS, &exts);
for (int n = 0; n < exts; n++) {
- allexts = talloc_asprintf_append(allexts, " %s",
- gl->GetStringi(GL_EXTENSIONS, n));
+ gl->extensions
+ = talloc_asprintf_append(gl->extensions, " %s",
+ gl->GetStringi(GL_EXTENSIONS, n));
}
} else {
gl->GetString = getProcAddress("glGetString");
if (!gl->GetString)
gl->GetString = glGetString;
+
const char *ext = (char*)gl->GetString(GL_EXTENSIONS);
- allexts = talloc_asprintf_append(allexts, " %s", ext);
+ gl->extensions = talloc_asprintf_append(gl->extensions, " %s", ext);
+
+ const char *version = gl->GetString(GL_VERSION);
+ sscanf(version, "%d.%d", &major, &minor);
}
+ gl->version = MPGL_VER(major, minor);
+
+ mp_msg(MSGT_VO, MSGL_V, "[gl] Detected OpenGL %d.%d.\n", major, minor);
+ mp_msg(MSGT_VO, MSGL_DBG2, "[gl] Combined OpenGL extensions string:\n%s\n",
+ gl->extensions);
- mp_msg(MSGT_VO, MSGL_DBG2, "OpenGL extensions string:\n%s\n", allexts);
- for (dsc = extfuncs; dsc->offset >= 0; dsc++) {
- void *ptr = NULL;
- if (!dsc->extstr || strstr(allexts, dsc->extstr)) {
- for (int i = 0; !ptr && dsc->funcnames[i]; i++)
- ptr = getProcAddress((const GLubyte *)dsc->funcnames[i]);
+ for (int n = 0; n < sizeof(gl_functions) / sizeof(gl_functions[0]); n++) {
+ struct gl_functions *section = &gl_functions[n];
+
+ // With gl3=false, we could have a legacy context, where functionality
+ // is never removed. (E.g. the context could be at version >= 3.0, but
+ // legacy functions like glBegin still exist and work.)
+ if (gl3 && section->ver_removed && gl->version >= section->ver_removed)
+ continue;
+
+ bool must_exist = section->ver_core && gl->version >= section->ver_core
+ && !section->partial_ok;
+
+ if (!must_exist && section->extension &&
+ !strstr(gl->extensions, section->extension))
+ continue;
+
+ void *loaded[MAX_FN_COUNT] = {0};
+ bool all_loaded = true;
+
+ for (int i = 0; section->functions[i].funcnames[0]; i++) {
+ struct gl_function *fn = &section->functions[i];
+ void *ptr = NULL;
+ for (int x = 0; fn->funcnames[x]; x++) {
+ ptr = getProcAddress((const GLubyte *)fn->funcnames[x]);
+ if (ptr)
+ break;
+ }
+ if (!ptr)
+ ptr = fn->fallback;
+ if (!ptr) {
+ all_loaded = false;
+ if (must_exist) {
+ // Either we or the driver are not conforming to OpenGL.
+ mp_msg(MSGT_VO, MSGL_ERR, "[gl] Required function '%s' not "
+ "found.\n", fn->funcnames[0]);
+ talloc_free_children(gl);
+ *gl = (GL) {0};
+ return;
+ }
+ }
+ assert(i < MAX_FN_COUNT);
+ loaded[i] = ptr;
+ }
+
+ if (all_loaded || section->partial_ok) {
+ gl->mpgl_caps |= section->provides;
+ for (int i = 0; section->functions[i].funcnames[0]; i++) {
+ struct gl_function *fn = &section->functions[i];
+ void **funcptr = (void**)(((char*)gl) + fn->offset);
+ if (loaded[i])
+ *funcptr = loaded[i];
+ }
}
- if (!ptr)
- ptr = dsc->fallback;
- if (!ptr && !dsc->extstr && (!dsc->is_gl3 || is_gl3))
- mp_msg(MSGT_VO, MSGL_WARN, "[gl] OpenGL function not found: %s\n",
- dsc->funcnames[0]);
- void **funcptr = (void**)(((char*)gl) + dsc->offset);
- *funcptr = ptr;
- }
- talloc_free(allexts);
+ }
+
+ gl->glsl_version = 0;
+ if (gl->version >= MPGL_VER(2, 0))
+ gl->glsl_version = 110;
+ if (gl->version >= MPGL_VER(2, 1))
+ gl->glsl_version = 120;
+ if (gl->version >= MPGL_VER(3, 0))
+ gl->glsl_version = 130;
+ // Specifically needed for OSX (normally we request 3.0 contexts only, but
+ // OSX always creates 3.2 contexts when requesting a core context).
+ if (gl->version >= MPGL_VER(3, 2))
+ gl->glsl_version = 150;
+
+ if (!is_software_gl(gl))
+ gl->mpgl_caps |= MPGL_CAP_NO_SW;
+
+ mp_msg(MSGT_VO, MSGL_V, "[gl] Detected OpenGL features:");
+ list_features(gl->mpgl_caps, MSGL_V, false);
}
/**
@@ -1739,35 +1967,38 @@ void glDrawTex(GL *gl, GLfloat x, GLfloat y, GLfloat w, GLfloat h,
#ifdef CONFIG_GL_COCOA
#include "cocoa_common.h"
-static int create_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags)
+
+static bool create_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags, bool gl3)
{
- if (vo_cocoa_create_window(ctx->vo, d_width, d_height, flags, 0) == 0) {
- return SET_WINDOW_OK;
- } else {
- return SET_WINDOW_FAILED;
+ int rv = vo_cocoa_create_window(ctx->vo, d_width, d_height, flags, gl3);
+ if (rv != 0)
+ return false;
+
+ getFunctions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, gl3);
+
+ if (gl3) {
+ ctx->depth_r = vo_cocoa_cgl_color_size();
+ ctx->depth_g = vo_cocoa_cgl_color_size();
+ ctx->depth_b = vo_cocoa_cgl_color_size();
}
+
+ if (!ctx->gl->SwapInterval)
+ ctx->gl->SwapInterval = vo_cocoa_swap_interval;
+
+ return true;
}
-static int create_window_cocoa_gl3(struct MPGLContext *ctx, int gl_flags,
- int gl_version, uint32_t d_width,
- uint32_t d_height, uint32_t flags)
+static bool create_window_cocoa_old(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
{
- int rv = vo_cocoa_create_window(ctx->vo, d_width, d_height, flags, 1);
- getFunctions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, true);
- ctx->depth_r = vo_cocoa_cgl_color_size();
- ctx->depth_g = vo_cocoa_cgl_color_size();
- ctx->depth_b = vo_cocoa_cgl_color_size();
- return rv;
+ return create_window_cocoa(ctx, d_width, d_height, flags, false);
}
-static int setGlWindow_cocoa(MPGLContext *ctx)
+static bool create_window_cocoa_gl3(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
{
- vo_cocoa_change_attributes(ctx->vo);
- getFunctions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, false);
- if (!ctx->gl->SwapInterval)
- ctx->gl->SwapInterval = vo_cocoa_swap_interval;
- return SET_WINDOW_OK;
+ return create_window_cocoa(ctx, d_width, d_height, flags, true);
}
static void releaseGlContext_cocoa(MPGLContext *ctx)
@@ -1800,24 +2031,9 @@ static void cocoa_fullscreen(struct vo *vo)
#include "w32_common.h"
struct w32_context {
- int vinfo;
HGLRC context;
};
-static int create_window_w32(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags)
-{
- if (!vo_w32_config(ctx->vo, d_width, d_height, flags))
- return -1;
- return 0;
-}
-
-/**
- * \brief little helper since wglGetProcAddress definition does not fit our
- * getProcAddress
- * \param procName name of function to look up
- * \return function pointer returned by wglGetProcAddress
- */
static void *w32gpa(const GLubyte *procName)
{
HMODULE oglmod;
@@ -1828,17 +2044,59 @@ static void *w32gpa(const GLubyte *procName)
return GetProcAddress(oglmod, procName);
}
-static int create_window_w32_gl3(struct MPGLContext *ctx, int gl_flags,
- int gl_version, uint32_t d_width,
- uint32_t d_height, uint32_t flags) {
+static bool create_window_w32_old(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
+{
+ GL *gl = ctx->gl;
+
+ if (!vo_w32_config(ctx->vo, d_width, d_height, flags))
+ return false;
+
+ struct w32_context *w32_ctx = ctx->priv;
+ HGLRC *context = &w32_ctx->context;
+
+ if (*context) {
+ gl->Finish(); // supposedly to prevent flickering
+ return true;
+ }
+
+ HWND win = ctx->vo->w32->window;
+ HDC windc = vo_w32_get_dc(ctx->vo, win);
+ bool res = false;
+
+ HGLRC new_context = wglCreateContext(windc);
+ if (!new_context) {
+ mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GL context!\n");
+ goto out;
+ }
+
+ if (!wglMakeCurrent(windc, new_context)) {
+ mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GL context!\n");
+ wglDeleteContext(new_context);
+ goto out;
+ }
+
+ *context = new_context;
+
+ getFunctions(ctx->gl, w32gpa, NULL, false);
+ res = true;
+
+out:
+ vo_w32_release_dc(ctx->vo, win, windc);
+ return res;
+}
+
+static bool create_window_w32_gl3(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
+{
if (!vo_w32_config(ctx->vo, d_width, d_height, flags))
- return -1;
+ return false;
struct w32_context *w32_ctx = ctx->priv;
HGLRC *context = &w32_ctx->context;
if (*context) // reuse existing context
- return 0; // not reusing it breaks gl3!
+ return true; // not reusing it breaks gl3!
HWND win = ctx->vo->w32->window;
HDC windc = vo_w32_get_dc(ctx->vo, win);
@@ -1847,7 +2105,7 @@ static int create_window_w32_gl3(struct MPGLContext *ctx, int gl_flags,
new_context = wglCreateContext(windc);
if (!new_context) {
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GL context!\n");
- return -1;
+ return false;
}
// set context
@@ -1873,6 +2131,7 @@ static int create_window_w32_gl3(struct MPGLContext *ctx, int gl_flags,
if (!wglCreateContextAttribsARB)
goto unsupported;
+ int gl_version = ctx->requested_gl_version;
int attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, MPGL_VER_GET_MAJOR(gl_version),
WGL_CONTEXT_MINOR_VERSION_ARB, MPGL_VER_GET_MINOR(gl_version),
@@ -1902,7 +2161,7 @@ static int create_window_w32_gl3(struct MPGLContext *ctx, int gl_flags,
if (!wglMakeCurrent(windc, *context)) {
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GL3 context!\n");
wglDeleteContext(*context);
- return -1;
+ return false;
}
/* update function pointers */
@@ -1916,86 +2175,20 @@ static int create_window_w32_gl3(struct MPGLContext *ctx, int gl_flags,
ctx->depth_b = pfd.cBlueBits;
}
- return 0;
+ return true;
unsupported:
mp_msg(MSGT_VO, MSGL_ERR, "[gl] The current OpenGL implementation does"
" not support OpenGL 3.x \n");
out:
wglDeleteContext(new_context);
- return -1;
-}
-
-static int setGlWindow_w32(MPGLContext *ctx)
-{
- HWND win = ctx->vo->w32->window;
- struct w32_context *w32_ctx = ctx->priv;
- int *vinfo = &w32_ctx->vinfo;
- HGLRC *context = &w32_ctx->context;
- int new_vinfo;
- HDC windc = vo_w32_get_dc(ctx->vo, win);
- HGLRC new_context = 0;
- int keep_context = 0;
- int res = SET_WINDOW_FAILED;
- GL *gl = ctx->gl;
-
- // should only be needed when keeping context, but not doing glFinish
- // can cause flickering even when we do not keep it.
- if (*context)
- gl->Finish();
- new_vinfo = GetPixelFormat(windc);
- if (*context && *vinfo && new_vinfo && *vinfo == new_vinfo) {
- // we can keep the wglContext
- new_context = *context;
- keep_context = 1;
- } else {
- // create a context
- new_context = wglCreateContext(windc);
- if (!new_context) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GL context!\n");
- goto out;
- }
- }
-
- // set context
- if (!wglMakeCurrent(windc, new_context)) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GL context!\n");
- if (!keep_context)
- wglDeleteContext(new_context);
- goto out;
- }
-
- // set new values
- {
- RECT rect;
- GetClientRect(win, &rect);
- ctx->vo->dwidth = rect.right;
- ctx->vo->dheight = rect.bottom;
- }
- if (!keep_context) {
- if (*context)
- wglDeleteContext(*context);
- *context = new_context;
- *vinfo = new_vinfo;
-
- getFunctions(ctx->gl, w32gpa, NULL, false);
-
- // and inform that reinit is neccessary
- res = SET_WINDOW_REINIT;
- } else
- res = SET_WINDOW_OK;
-
-out:
- vo_w32_release_dc(ctx->vo, win, windc);
- return res;
+ return false;
}
static void releaseGlContext_w32(MPGLContext *ctx)
{
struct w32_context *w32_ctx = ctx->priv;
- int *vinfo = &w32_ctx->vinfo;
HGLRC *context = &w32_ctx->context;
- *vinfo = 0;
if (*context) {
wglMakeCurrent(0, 0);
wglDeleteContext(*context);
@@ -2019,155 +2212,10 @@ static void swapGlBuffers_w32(MPGLContext *ctx)
struct glx_context {
XVisualInfo *vinfo;
GLXContext context;
+ GLXFBConfig fbc;
};
-static int create_window_x11(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags)
-{
- struct vo *vo = ctx->vo;
-
- static int default_glx_attribs[] = {
- GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER, None
- };
- static int stereo_glx_attribs[] = {
- GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
- GLX_DOUBLEBUFFER, GLX_STEREO, None
- };
- XVisualInfo *vinfo = NULL;
- if (flags & VOFLAG_STEREO) {
- vinfo = glXChooseVisual(vo->x11->display, vo->x11->screen,
- stereo_glx_attribs);
- if (!vinfo)
- mp_msg(MSGT_VO, MSGL_ERR, "[gl] Could not find a stereo visual,"
- " 3D will probably not work!\n");
- }
- if (!vinfo)
- vinfo = glXChooseVisual(vo->x11->display, vo->x11->screen,
- default_glx_attribs);
- if (!vinfo) {
- mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
- return -1;
- }
- mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n",
- (int)vinfo->visualid);
-
- Colormap colormap = XCreateColormap(vo->x11->display, vo->x11->rootwin,
- vinfo->visual, AllocNone);
- vo_x11_create_vo_window(vo, vinfo, vo->dx, vo->dy, d_width, d_height,
- flags, colormap, "gl");
-
- return 0;
-}
-
-/**
- * \brief Returns the XVisualInfo associated with Window win.
- * \param win Window whose XVisualInfo is returne.
- * \return XVisualInfo of the window. Caller must use XFree to free it.
- */
-static XVisualInfo *getWindowVisualInfo(MPGLContext *ctx, Window win)
-{
- XWindowAttributes xw_attr;
- XVisualInfo vinfo_template;
- int tmp;
- XGetWindowAttributes(ctx->vo->x11->display, win, &xw_attr);
- vinfo_template.visualid = XVisualIDFromVisual(xw_attr.visual);
- return XGetVisualInfo(ctx->vo->x11->display, VisualIDMask, &vinfo_template, &tmp);
-}
-
-/**
- * \brief Changes the window in which video is displayed.
- * If possible only transfers the context to the new window, otherwise
- * creates a new one, which must be initialized by the caller.
- * \param vinfo Currently used visual.
- * \param context Currently used context.
- * \param win window that should be used for drawing.
- * \return one of SET_WINDOW_FAILED, SET_WINDOW_OK or SET_WINDOW_REINIT.
- * In case of SET_WINDOW_REINIT the context could not be transfered
- * and the caller must initialize it correctly.
- * \ingroup glcontext
- */
-static int setGlWindow_x11(MPGLContext *ctx)
-{
- struct glx_context *glx_context = ctx->priv;
- XVisualInfo **vinfo = &glx_context->vinfo;
- GLXContext *context = &glx_context->context;
- Display *display = ctx->vo->x11->display;
- Window win = ctx->vo->x11->window;
- XVisualInfo *new_vinfo;
- GLXContext new_context = NULL;
- int keep_context = 0;
- GL *gl = ctx->gl;
-
- // should only be needed when keeping context, but not doing glFinish
- // can cause flickering even when we do not keep it.
- if (*context)
- gl->Finish();
- new_vinfo = getWindowVisualInfo(ctx, win);
- if (*context && *vinfo && new_vinfo &&
- (*vinfo)->visualid == new_vinfo->visualid) {
- // we can keep the GLXContext
- new_context = *context;
- XFree(new_vinfo);
- new_vinfo = *vinfo;
- keep_context = 1;
- } else {
- // create a context
- new_context = glXCreateContext(display, new_vinfo, NULL, True);
- if (!new_context) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GLX context!\n");
- XFree(new_vinfo);
- return SET_WINDOW_FAILED;
- }
- }
-
- // set context
- if (!glXMakeCurrent(display, ctx->vo->x11->window, new_context)) {
- mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GLX context!\n");
- if (!keep_context) {
- glXDestroyContext(display, new_context);
- XFree(new_vinfo);
- }
- return SET_WINDOW_FAILED;
- }
-
- // set new values
- ctx->vo->x11->window = win;
- vo_x11_update_geometry(ctx->vo, 1);
- if (!keep_context) {
- void *(*getProcAddress)(const GLubyte *);
- if (*context)
- glXDestroyContext(display, *context);
- *context = new_context;
- if (*vinfo)
- XFree(*vinfo);
- *vinfo = new_vinfo;
- getProcAddress = getdladdr("glXGetProcAddress");
- if (!getProcAddress)
- getProcAddress = getdladdr("glXGetProcAddressARB");
-
- const char *glxstr = "";
- const char *(*glXExtStr)(Display *, int)
- = getdladdr("glXQueryExtensionsString");
- if (glXExtStr)
- glxstr = glXExtStr(display, ctx->vo->x11->screen);
-
- getFunctions(gl, getProcAddress, glxstr, false);
- if (!gl->GenPrograms && gl->GetString &&
- getProcAddress &&
- strstr(gl->GetString(GL_EXTENSIONS), "GL_ARB_vertex_program")) {
- mp_msg(MSGT_VO, MSGL_WARN,
- "Broken glXGetProcAddress detected, trying workaround\n");
- getFunctions(gl, NULL, glxstr, false);
- }
-
- // and inform that reinit is neccessary
- return SET_WINDOW_REINIT;
- }
- return SET_WINDOW_OK;
-}
-
-// The GL3 initialization code roughly follows/copies from:
+// The GL3/FBC initialization code roughly follows/copies from:
// http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)
// but also uses some of the old code.
@@ -2187,12 +2235,8 @@ static GLXFBConfig select_fb_config(struct vo *vo, const int *attribs)
return fbconfig;
}
-typedef GLXContext (*glXCreateContextAttribsARBProc)
- (Display*, GLXFBConfig, GLXContext, Bool, const int*);
-
-static int create_window_x11_gl3(struct MPGLContext *ctx, int gl_flags,
- int gl_version, uint32_t d_width,
- uint32_t d_height, uint32_t flags)
+static bool create_glx_window(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
{
struct vo *vo = ctx->vo;
struct glx_context *glx_ctx = ctx->priv;
@@ -2205,7 +2249,7 @@ static int create_window_x11_gl3(struct MPGLContext *ctx, int gl_flags,
vo_x11_create_vo_window(vo, glx_ctx->vinfo, vo->dx, vo->dy, d_width,
d_height, flags, colormap, "gl");
XFreeColormap(vo->x11->display, colormap);
- return SET_WINDOW_OK;
+ return true;
}
int glx_major, glx_minor;
@@ -2215,7 +2259,7 @@ static int create_window_x11_gl3(struct MPGLContext *ctx, int gl_flags,
(MPGL_VER(glx_major, glx_minor) < MPGL_VER(1, 3)))
{
mp_msg(MSGT_VO, MSGL_ERR, "[gl] GLX version older than 1.3.\n");
- return SET_WINDOW_FAILED;
+ return false;
}
const int glx_attribs_stereo_value_idx = 1; // index of GLX_STEREO + 1
@@ -2242,22 +2286,100 @@ static int create_window_x11_gl3(struct MPGLContext *ctx, int gl_flags,
fbc = select_fb_config(vo, glx_attribs);
if (!fbc) {
mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
- return SET_WINDOW_FAILED;
+ return false;
}
+ glx_ctx->fbc = fbc;
+ glx_ctx->vinfo = glXGetVisualFromFBConfig(vo->x11->display, fbc);
+
+ mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n",
+ (int)glx_ctx->vinfo->visualid);
+
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_RED_SIZE, &ctx->depth_r);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_GREEN_SIZE, &ctx->depth_g);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_BLUE_SIZE, &ctx->depth_b);
- XVisualInfo *vinfo = glXGetVisualFromFBConfig(vo->x11->display, fbc);
- mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n",
- (int)vinfo->visualid);
Colormap colormap = XCreateColormap(vo->x11->display, vo->x11->rootwin,
- vinfo->visual, AllocNone);
- vo_x11_create_vo_window(vo, vinfo, vo->dx, vo->dy, d_width, d_height,
- flags, colormap, "gl");
+ glx_ctx->vinfo->visual, AllocNone);
+ vo_x11_create_vo_window(vo, glx_ctx->vinfo, vo->dx, vo->dy, d_width,
+ d_height, flags, colormap, "gl");
XFreeColormap(vo->x11->display, colormap);
+ return true;
+}
+
+static bool create_window_x11_old(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
+{
+ struct glx_context *glx_ctx = ctx->priv;
+ Display *display = ctx->vo->x11->display;
+ struct vo *vo = ctx->vo;
+ GL *gl = ctx->gl;
+
+ if (!create_glx_window(ctx, d_width, d_height, flags))
+ return false;
+
+ if (glx_ctx->context)
+ return true;
+
+ GLXContext new_context = glXCreateContext(display, glx_ctx->vinfo, NULL,
+ True);
+ if (!new_context) {
+ mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GLX context!\n");
+ return false;
+ }
+
+ if (!glXMakeCurrent(display, ctx->vo->x11->window, new_context)) {
+ mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GLX context!\n");
+ glXDestroyContext(display, new_context);
+ return false;
+ }
+
+ void *(*getProcAddress)(const GLubyte *);
+ getProcAddress = getdladdr("glXGetProcAddress");
+ if (!getProcAddress)
+ getProcAddress = getdladdr("glXGetProcAddressARB");
+
+ const char *glxstr = "";
+ const char *(*glXExtStr)(Display *, int)
+ = getdladdr("glXQueryExtensionsString");
+ if (glXExtStr)
+ glxstr = glXExtStr(display, ctx->vo->x11->screen);
+
+ getFunctions(gl, getProcAddress, glxstr, false);
+ if (!gl->GenPrograms && gl->GetString &&
+ gl->version < MPGL_VER(3, 0) &&
+ getProcAddress &&
+ strstr(gl->GetString(GL_EXTENSIONS), "GL_ARB_vertex_program"))
+ {
+ mp_msg(MSGT_VO, MSGL_WARN,
+ "Broken glXGetProcAddress detected, trying workaround\n");
+ getFunctions(gl, NULL, glxstr, false);
+ }
+
+ glx_ctx->context = new_context;
+
+ if (!glXIsDirect(vo->x11->display, new_context))
+ ctx->gl->mpgl_caps &= ~MPGL_CAP_NO_SW;
+
+ return true;
+}
+
+typedef GLXContext (*glXCreateContextAttribsARBProc)
+ (Display*, GLXFBConfig, GLXContext, Bool, const int*);
+
+static bool create_window_x11_gl3(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
+{
+ struct glx_context *glx_ctx = ctx->priv;
+ struct vo *vo = ctx->vo;
+
+ if (!create_glx_window(ctx, d_width, d_height, flags))
+ return false;
+
+ if (glx_ctx->context)
+ return true;
+
glXCreateContextAttribsARBProc glXCreateContextAttribsARB =
(glXCreateContextAttribsARBProc)
glXGetProcAddressARB((const GLubyte *)"glXCreateContextAttribsARB");
@@ -2270,40 +2392,41 @@ static int create_window_x11_gl3(struct MPGLContext *ctx, int gl_flags,
bool have_ctx_ext = glxstr && !!strstr(glxstr, "GLX_ARB_create_context");
if (!(have_ctx_ext && glXCreateContextAttribsARB)) {
- XFree(vinfo);
- return SET_WINDOW_FAILED;
+ return false;
}
+ int gl_version = ctx->requested_gl_version;
int context_attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, MPGL_VER_GET_MAJOR(gl_version),
GLX_CONTEXT_MINOR_VERSION_ARB, MPGL_VER_GET_MINOR(gl_version),
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
- | (gl_flags & MPGLFLAG_DEBUG ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
+ | (flags & VOFLAG_GL_DEBUG ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
None
};
- GLXContext context = glXCreateContextAttribsARB(vo->x11->display, fbc, 0,
- True, context_attribs);
+ GLXContext context = glXCreateContextAttribsARB(vo->x11->display,
+ glx_ctx->fbc, 0, True,
+ context_attribs);
if (!context) {
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not create GLX context!\n");
- XFree(vinfo);
- return SET_WINDOW_FAILED;
+ return false;
}
// set context
if (!glXMakeCurrent(vo->x11->display, vo->x11->window, context)) {
mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Could not set GLX context!\n");
glXDestroyContext(vo->x11->display, context);
- XFree(vinfo);
- return SET_WINDOW_FAILED;
+ return false;
}
- glx_ctx->vinfo = vinfo;
glx_ctx->context = context;
getFunctions(ctx->gl, (void *)glXGetProcAddress, glxstr, true);
- return SET_WINDOW_REINIT;
+ if (!glXIsDirect(vo->x11->display, context))
+ ctx->gl->mpgl_caps &= ~MPGL_CAP_NO_SW;
+
+ return true;
}
/**
@@ -2321,7 +2444,8 @@ static void releaseGlContext_x11(MPGLContext *ctx)
XFree(*vinfo);
*vinfo = NULL;
if (*context) {
- gl->Finish();
+ if (gl->Finish)
+ gl->Finish();
glXMakeCurrent(display, None, NULL);
glXDestroyContext(display, *context);
}
@@ -2363,45 +2487,46 @@ int mpgl_find_backend(const char *name)
return -1;
}
-MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
+MPGLContext *mpgl_init(enum MPGLType type, struct vo *vo)
{
MPGLContext *ctx;
if (type == GLTYPE_AUTO) {
- ctx = init_mpglcontext(GLTYPE_COCOA, vo);
+ ctx = mpgl_init(GLTYPE_COCOA, vo);
if (ctx)
return ctx;
- ctx = init_mpglcontext(GLTYPE_W32, vo);
+ ctx = mpgl_init(GLTYPE_W32, vo);
if (ctx)
return ctx;
- return init_mpglcontext(GLTYPE_X11, vo);
+ return mpgl_init(GLTYPE_X11, vo);
}
ctx = talloc_zero(NULL, MPGLContext);
- ctx->gl = talloc_zero(ctx, GL);
- ctx->type = type;
- ctx->vo = vo;
+ *ctx = (MPGLContext) {
+ .gl = talloc_zero(ctx, GL),
+ .type = type,
+ .vo = vo,
+ .requested_gl_version = MPGL_VER(3, 0),
+ .vo_init_ok = true,
+ };
switch (ctx->type) {
#ifdef CONFIG_GL_COCOA
case GLTYPE_COCOA:
- ctx->create_window = create_window_cocoa;
+ ctx->create_window_old = create_window_cocoa_old;
ctx->create_window_gl3 = create_window_cocoa_gl3;
- ctx->setGlWindow = setGlWindow_cocoa;
ctx->releaseGlContext = releaseGlContext_cocoa;
ctx->swapGlBuffers = swapGlBuffers_cocoa;
ctx->check_events = cocoa_check_events;
ctx->update_xinerama_info = cocoa_update_xinerama_info;
ctx->fullscreen = cocoa_fullscreen;
ctx->ontop = vo_cocoa_ontop;
+ ctx->vo_init = vo_cocoa_init;
ctx->vo_uninit = vo_cocoa_uninit;
- if (vo_cocoa_init(vo))
- return ctx;
break;
#endif
#ifdef CONFIG_GL_WIN32
case GLTYPE_W32:
ctx->priv = talloc_zero(ctx, struct w32_context);
- ctx->create_window = create_window_w32;
+ ctx->create_window_old = create_window_w32_old;
ctx->create_window_gl3 = create_window_w32_gl3;
- ctx->setGlWindow = setGlWindow_w32;
ctx->releaseGlContext = releaseGlContext_w32;
ctx->swapGlBuffers = swapGlBuffers_w32;
ctx->update_xinerama_info = w32_update_xinerama_info;
@@ -2409,16 +2534,14 @@ MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
ctx->check_events = vo_w32_check_events;
ctx->fullscreen = vo_w32_fullscreen;
ctx->ontop = vo_w32_ontop;
+ ctx->vo_init = vo_w32_init;
ctx->vo_uninit = vo_w32_uninit;
- if (vo_w32_init(vo))
- return ctx;
break;
#endif
#ifdef CONFIG_GL_X11
case GLTYPE_X11:
ctx->priv = talloc_zero(ctx, struct glx_context);
- ctx->create_window = create_window_x11;
- ctx->setGlWindow = setGlWindow_x11;
+ ctx->create_window_old = create_window_x11_old;
ctx->create_window_gl3 = create_window_x11_gl3;
ctx->releaseGlContext = releaseGlContext_x11;
ctx->swapGlBuffers = swapGlBuffers_x11;
@@ -2427,40 +2550,85 @@ MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo)
ctx->check_events = vo_x11_check_events;
ctx->fullscreen = vo_x11_fullscreen;
ctx->ontop = vo_x11_ontop;
+ ctx->vo_init = vo_init;
ctx->vo_uninit = vo_x11_uninit;
- if (vo_init(vo))
- return ctx;
break;
#endif
}
+ if (ctx->vo_init && ctx->vo_init(vo))
+ return ctx;
talloc_free(ctx);
return NULL;
}
-int create_mpglcontext(struct MPGLContext *ctx, int gl_flags, int gl_version,
- uint32_t d_width, uint32_t d_height, uint32_t flags)
+bool mpgl_destroy_window(struct MPGLContext *ctx)
{
- if (gl_version < MPGL_VER(3, 0)) {
- if (ctx->create_window(ctx, d_width, d_height, flags) < 0)
- return SET_WINDOW_FAILED;
- return ctx->setGlWindow(ctx);
- } else {
- if (!ctx->create_window_gl3) {
- mp_msg(MSGT_VO, MSGL_ERR, "[gl] OpenGL 3.x context creation not "
- "implemented.\n");
- return SET_WINDOW_FAILED;
+ ctx->releaseGlContext(ctx);
+ *ctx->gl = (GL) {0};
+ // This is a caveat. At least on X11, this will recreate the X display
+ // connection. Also, if vo_init() fails, unspecified things will happen.
+ ctx->vo_uninit(ctx->vo);
+ ctx->vo_init_ok = ctx->vo_init(ctx->vo);
+ return ctx->vo_init_ok;
+}
+
+static bool create_window(struct MPGLContext *ctx, int gl_caps,
+ bool (*create)(struct MPGLContext *, uint32_t,
+ uint32_t, uint32_t),
+ uint32_t d_width, uint32_t d_height, uint32_t flags)
+{
+ if (!create || !ctx->vo_init_ok)
+ return false;
+ if (create(ctx, d_width, d_height, flags)) {
+ int missing = (ctx->gl->mpgl_caps & gl_caps) ^ gl_caps;
+ if (!missing) {
+ ctx->selected_create_window = create;
+ return true;
+ }
+ mp_msg(MSGT_VO, MSGL_WARN, "[gl] Missing OpenGL features:");
+ list_features(missing, MSGL_WARN, false);
+ if (missing & MPGL_CAP_NO_SW) {
+ mp_msg(MSGT_VO, MSGL_WARN, "[gl] Rejecting suspected software "
+ "OpenGL renderer.\n");
}
- return ctx->create_window_gl3(ctx, gl_flags, gl_version, d_width,
- d_height, flags);
}
+ // If we tried to create a GL 3 context, and we're going to create a legacy
+ // context after this, the window should be recreated at least on X11.
+ mpgl_destroy_window(ctx);
+ return false;
}
-void uninit_mpglcontext(MPGLContext *ctx)
+bool mpgl_create_window(struct MPGLContext *ctx, int gl_caps, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
+{
+ assert(ctx->vo_init_ok);
+ if (ctx->selected_create_window)
+ return ctx->selected_create_window(ctx, d_width, d_height, flags);
+
+ bool allow_gl3 = !(gl_caps & MPGL_CAP_GL_LEGACY);
+ bool allow_legacy = !(gl_caps & MPGL_CAP_GL3);
+ gl_caps |= MPGL_CAP_GL;
+
+ if (allow_gl3 && create_window(ctx, gl_caps, ctx->create_window_gl3,
+ d_width, d_height, flags))
+ return true;
+
+ if (allow_legacy && create_window(ctx, gl_caps, ctx->create_window_old,
+ d_width, d_height, flags))
+ return true;
+
+ mp_msg(MSGT_VO, MSGL_ERR, "[gl] OpenGL context creation failed!\n");
+ return false;
+}
+
+void mpgl_uninit(MPGLContext *ctx)
{
if (!ctx)
return;
- ctx->releaseGlContext(ctx);
- ctx->vo_uninit(ctx->vo);
+ if (ctx->vo_init_ok) {
+ ctx->releaseGlContext(ctx);
+ ctx->vo_uninit(ctx->vo);
+ }
talloc_free(ctx);
}
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index fa4b6dbf25..fd80b69126 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -34,8 +34,11 @@
#include "csputils.h"
#if defined(CONFIG_GL_COCOA) && !defined(CONFIG_GL_X11)
-#include <OpenGL/gl.h>
+#ifdef GL_VERSION_3_0
#include <OpenGL/gl3.h>
+#else
+#include <OpenGL/gl.h>
+#endif
#include <OpenGL/glext.h>
#else
#include <GL/gl.h>
@@ -155,16 +158,6 @@ void glEnable3DLeft(GL *gl, int type);
void glEnable3DRight(GL *gl, int type);
void glDisable3D(GL *gl, int type);
-/** \addtogroup glcontext
- * \{ */
-//! could not set new window, will continue drawing into the old one.
-#define SET_WINDOW_FAILED -1
-//! new window is set, could even transfer the OpenGL context.
-#define SET_WINDOW_OK 0
-//! new window is set, but the OpenGL context needs to be reinitialized.
-#define SET_WINDOW_REINIT 1
-/** \} */
-
enum MPGLType {
GLTYPE_AUTO,
GLTYPE_COCOA,
@@ -173,49 +166,82 @@ enum MPGLType {
};
enum {
- MPGLFLAG_DEBUG = 1,
+ MPGL_CAP_GL = (1 << 0), // GL was successfully loaded
+ MPGL_CAP_GL_LEGACY = (1 << 1), // GL 1.1 (but not 3.x)
+ MPGL_CAP_GL2 = (1 << 2), // GL 2.0 (3.x core subset)
+ MPGL_CAP_GL21 = (1 << 3), // GL 2.1 (3.x core subset)
+ MPGL_CAP_GL3 = (1 << 4), // GL 3.x core
+ MPGL_CAP_FB = (1 << 5),
+ MPGL_CAP_VAO = (1 << 6),
+ MPGL_CAP_SRGB_TEX = (1 << 7),
+ MPGL_CAP_SRGB_FB = (1 << 8),
+ MPGL_CAP_FLOAT_TEX = (1 << 9),
+ MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
+ MPGL_CAP_NO_SW = (1 << 30), // used to block sw. renderers
};
#define MPGL_VER(major, minor) (((major) << 16) | (minor))
#define MPGL_VER_GET_MAJOR(ver) ((ver) >> 16)
#define MPGL_VER_GET_MINOR(ver) ((ver) & ((1 << 16) - 1))
+#define MPGL_VER_P(ver) MPGL_VER_GET_MAJOR(ver), MPGL_VER_GET_MINOR(ver)
+
typedef struct MPGLContext {
GL *gl;
enum MPGLType type;
struct vo *vo;
- void *priv;
+
// Bit size of each component in the created framebuffer. 0 if unknown.
int depth_r, depth_g, depth_b;
- int (*create_window)(struct MPGLContext *ctx, uint32_t d_width,
- uint32_t d_height, uint32_t flags);
- int (*setGlWindow)(struct MPGLContext *);
- void (*releaseGlContext)(struct MPGLContext *);
+
+ // GL version requested from create_window_gl3 backend.
+ // (Might be different from the actual version in gl->version.)
+ int requested_gl_version;
+
void (*swapGlBuffers)(struct MPGLContext *);
int (*check_events)(struct vo *vo);
void (*fullscreen)(struct vo *vo);
+ int (*vo_init)(struct vo *vo);
void (*vo_uninit)(struct vo *vo);
- // only available if GL3 context creation is supported
- // gl_flags: bitfield of MPGLFLAG_* constants
- // gl_version: requested OpenGL version number (use MPGL_VER())
- // return value is one of the SET_WINDOW_* constants
- int (*create_window_gl3)(struct MPGLContext *ctx, int gl_flags,
- int gl_version, uint32_t d_width,
- uint32_t d_height, uint32_t flags);
+ void (*releaseGlContext)(struct MPGLContext *);
+
+ // Creates GL 1.x/2.x legacy context.
+ bool (*create_window_old)(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags);
+
+ // Creates GL 3.x core context.
+ bool (*create_window_gl3)(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags);
+
// optional
void (*ontop)(struct vo *vo);
void (*border)(struct vo *vo);
void (*update_xinerama_info)(struct vo *vo);
+
+ // For free use by the backend.
+ void *priv;
+ // Internal to gl_common.c.
+ bool (*selected_create_window)(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags);
+ bool vo_init_ok;
} MPGLContext;
int mpgl_find_backend(const char *name);
-MPGLContext *init_mpglcontext(enum MPGLType type, struct vo *vo);
-void uninit_mpglcontext(MPGLContext *ctx);
+MPGLContext *mpgl_init(enum MPGLType type, struct vo *vo);
+void mpgl_uninit(MPGLContext *ctx);
+
+// Create a VO window and create a GL context on it.
+// (Calls create_window_gl3 or create_window+setGlWindow.)
+// gl_caps: bitfield of MPGL_CAP_* (required GL version and feature set)
+// flags: passed to the backend's create window function
+// Returns success.
+bool mpgl_create_window(struct MPGLContext *ctx, int gl_caps, uint32_t d_width,
+ uint32_t d_height, uint32_t flags);
-// calls create_window_gl3 or create_window+setGlWindow
-int create_mpglcontext(struct MPGLContext *ctx, int gl_flags, int gl_version,
- uint32_t d_width, uint32_t d_height, uint32_t flags);
+// Destroy the window, without resetting GL3 vs. GL2 context choice.
+// If this fails (false), mpgl_uninit(ctx) must be called.
+bool mpgl_destroy_window(struct MPGLContext *ctx);
// print a multi line string with line numbers (e.g. for shader sources)
// mod, lev: module and log level, as in mp_msg()
@@ -223,6 +249,11 @@ void mp_log_source(int mod, int lev, const char *src);
//function pointers loaded from the OpenGL library
struct GL {
+ int version; // MPGL_VER() mangled
+ int glsl_version; // e.g. 130 for GLSL 1.30
+ char *extensions; // Equivalent to GL_EXTENSIONS
+ int mpgl_caps; // Bitfield of MPGL_CAP_* constants
+
void (GLAPIENTRY *Begin)(GLenum);
void (GLAPIENTRY *End)(void);
void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
@@ -283,8 +314,6 @@ struct GL {
void (GLAPIENTRY *DisableClientState)(GLenum);
GLenum (GLAPIENTRY *GetError)(void);
-
- // OpenGL extension functions
void (GLAPIENTRY *GenBuffers)(GLsizei, GLuint *);
void (GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
void (GLAPIENTRY *BindBuffer)(GLenum, GLuint);
@@ -306,7 +335,6 @@ struct GL {
GLsizei, GLint, GLenum, GLenum,
const GLvoid *);
- // ancient ATI extensions
void (GLAPIENTRY *BeginFragmentShader)(void);
void (GLAPIENTRY *EndFragmentShader)(void);
void (GLAPIENTRY *SampleMap)(GLuint, GLuint, GLenum);
@@ -317,8 +345,6 @@ struct GL {
GLuint, GLuint, GLuint);
void (GLAPIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *);
-
- // GL 3, possibly in GL 2.x as well in form of extensions
void (GLAPIENTRY *GenVertexArrays)(GLsizei, GLuint *);
void (GLAPIENTRY *BindVertexArray)(GLuint);
GLint (GLAPIENTRY *GetAttribLocation)(GLuint, const GLchar *);
@@ -352,6 +378,7 @@ struct GL {
GLint);
void (GLAPIENTRY *Uniform1f)(GLint, GLfloat);
+ void (GLAPIENTRY *Uniform2f)(GLint, GLfloat, GLfloat);
void (GLAPIENTRY *Uniform3f)(GLint, GLfloat, GLfloat, GLfloat);
void (GLAPIENTRY *Uniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
void (GLAPIENTRY *Uniform1i)(GLint, GLint);
diff --git a/libvo/gl_header_fixes.h b/libvo/gl_header_fixes.h
index c6f260b289..ebdbbb35b4 100644
--- a/libvo/gl_header_fixes.h
+++ b/libvo/gl_header_fixes.h
@@ -229,3 +229,17 @@
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#endif
+
+// Define just enough constants to make the OpenGL 3 code compile against
+// older SDKs. Values are taken straight from OpenGL/gl3.h
+#if defined __APPLE__ && !(defined GL_VERSION_3_0)
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+
+#ifndef GL_ARB_framebuffer_sRGB
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
+#endif
+#endif
diff --git a/libvo/video_out.c b/libvo/video_out.c
index f743d5b8bf..18a8482c18 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -30,6 +30,7 @@
#include "config.h"
#include "options.h"
#include "talloc.h"
+#include "bstr.h"
#include "video_out.h"
#include "aspect.h"
#include "geometry.h"
@@ -72,9 +73,9 @@ int vo_colorkey = 0x0000ff00; // default colorkey is green
extern struct vo_driver video_out_x11;
extern struct vo_driver video_out_vdpau;
extern struct vo_driver video_out_xv;
-extern struct vo_driver video_out_gl_nosw;
-extern struct vo_driver video_out_gl;
-extern struct vo_driver video_out_gl3;
+extern struct vo_driver video_out_opengl;
+extern struct vo_driver video_out_opengl_hq;
+extern struct vo_driver video_out_opengl_old;
extern struct vo_driver video_out_null;
extern struct vo_driver video_out_image;
extern struct vo_driver video_out_lavc;
@@ -90,7 +91,8 @@ const struct vo_driver *video_out_drivers[] =
&video_out_direct3d,
#endif
#ifdef CONFIG_GL_COCOA
- &video_out_gl,
+ &video_out_opengl,
+ &video_out_opengl_old,
#endif
#ifdef CONFIG_COREVIDEO
&video_out_corevideo,
@@ -102,9 +104,9 @@ const struct vo_driver *video_out_drivers[] =
&video_out_xv,
#endif
#ifdef CONFIG_GL
- &video_out_gl3,
#if !defined CONFIG_GL_COCOA
- &video_out_gl,
+ &video_out_opengl,
+ &video_out_opengl_old,
#endif
#endif
#ifdef CONFIG_X11
@@ -119,10 +121,8 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_ENCODING
&video_out_lavc,
#endif
-#ifdef CONFIG_X11
#ifdef CONFIG_GL
- &video_out_gl_nosw,
-#endif
+ &video_out_opengl_hq,
#endif
NULL
};
@@ -284,6 +284,20 @@ void list_video_out(void)
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
}
+static void replace_legacy_vo_name(bstr *name)
+{
+ bstr new = *name;
+ if (bstr_equals0(*name, "gl"))
+ new = bstr0("opengl");
+ if (bstr_equals0(*name, "gl3"))
+ new = bstr0("opengl-hq");
+ if (!bstr_equals(*name, new)) {
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "VO driver '%.*s' has been replaced "
+ "with '%.*s'!\n", BSTR_P(*name), BSTR_P(new));
+ }
+ *name = new;
+}
+
struct vo *init_best_video_out(struct MPOpts *opts,
struct mp_fifo *key_fifo,
struct input_ctx *input_ctx,
@@ -303,32 +317,27 @@ struct vo *init_best_video_out(struct MPOpts *opts,
// first try the preferred drivers, with their optional subdevice param:
if (vo_list && vo_list[0])
while (vo_list[0][0]) {
- char *name = strdup(vo_list[0]);
- char *vo_subdevice = strchr(name,':');
- if (!strcmp(name, "pgm"))
- mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "The pgm video output driver has been replaced by -vo pnm:pgmyuv.\n");
- if (!strcmp(name, "md5"))
- mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "The md5 video output driver has been replaced by -vo md5sum.\n");
- if (vo_subdevice) {
- vo_subdevice[0] = 0;
- ++vo_subdevice;
+ char *arg = vo_list[0];
+ bstr name = bstr0(arg);
+ char *params = strchr(arg, ':');
+ if (params) {
+ name = bstr_splice(name, 0, params - arg);
+ params++;
}
+ replace_legacy_vo_name(&name);
for (i = 0; video_out_drivers[i]; i++) {
const struct vo_driver *video_driver = video_out_drivers[i];
const vo_info_t *info = video_driver->info;
- if (!strcmp(info->short_name, name)) {
+ if (bstr_equals0(name, info->short_name)) {
// name matches, try it
*vo = initial_values;
vo->driver = video_driver;
- if (!vo_preinit(vo, vo_subdevice)) {
- free(name);
+ if (!vo_preinit(vo, params))
return vo; // success!
- }
talloc_free_children(vo);
}
}
// continue...
- free(name);
++vo_list;
if (!(vo_list[0])) {
talloc_free(vo);
@@ -499,5 +508,5 @@ void vo_mouse_movement(struct vo *vo, int posx, int posy)
if (!enable_mouse_movements)
return;
snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", posx, posy);
- mp_input_queue_cmd(vo->input_ctx, mp_input_parse_cmd(cmd_str));
+ mp_input_queue_cmd(vo->input_ctx, mp_input_parse_cmd(bstr0(cmd_str), ""));
}
diff --git a/libvo/video_out.h b/libvo/video_out.h
index e94c8186c5..5bd84ab4af 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -127,6 +127,7 @@ typedef struct {
#define VOFLAG_FLIPPING 0x08
#define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
#define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
+#define VOFLAG_GL_DEBUG 0x40 // Hint to request debug OpenGL context
typedef struct vo_info_s
{
diff --git a/libvo/vo_caca.c b/libvo/vo_caca.c
index c2bc53138d..2d998bf91d 100644
--- a/libvo/vo_caca.c
+++ b/libvo/vo_caca.c
@@ -351,7 +351,7 @@ static int preinit(struct vo *vo, const char *arg)
return ENOSYS;
}
- caca_set_display_title(display, "MPlayer");
+ caca_set_display_title(display, "mpv");
return 0;
}
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index e5c74f6cc8..6775762787 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -146,9 +146,8 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
p->image_width = width;
p->image_height = height;
- if (p->mpglctx->create_window(p->mpglctx, d_width, d_height, flags) < 0)
- return -1;
- if (p->mpglctx->setGlWindow(p->mpglctx) == SET_WINDOW_FAILED)
+ int mpgl_caps = MPGL_CAP_GL_LEGACY;
+ if (!mpgl_create_window(p->mpglctx, mpgl_caps, d_width, d_height, flags))
return -1;
init_gl(vo, vo->dwidth, vo->dheight);
@@ -277,7 +276,7 @@ static void uninit(struct vo *vo)
struct priv *p = vo->priv;
if (p->osd)
mpgl_osd_destroy(p->osd);
- uninit_mpglcontext(p->mpglctx);
+ mpgl_uninit(p->mpglctx);
release_cv_entities(vo);
}
@@ -287,7 +286,7 @@ static int preinit(struct vo *vo, const char *arg)
struct priv *p = vo->priv;
*p = (struct priv) {
- .mpglctx = init_mpglcontext(GLTYPE_COCOA, vo),
+ .mpglctx = mpgl_init(GLTYPE_COCOA, vo),
.colorspace = MP_CSP_DETAILS_DEFAULTS,
.quad = talloc_ptrtype(p, p->quad),
};
diff --git a/libvo/vo_lavc.c b/libvo/vo_lavc.c
index 4a1af15eb0..5b467f1f6a 100644
--- a/libvo/vo_lavc.c
+++ b/libvo/vo_lavc.c
@@ -47,6 +47,7 @@ struct priv {
double lastpts;
int64_t lastipts;
int64_t lastframeipts;
+ double expected_next_pts;
mp_image_t *lastimg;
int lastdisplaycount;
@@ -347,6 +348,11 @@ static void draw_image(struct vo *vo, mp_image_t *mpi, double pts)
mp_msg(MSGT_ENCODE, MSGL_WARN, "vo-lavc: NOTE: skipped initial video frame (probably because audio is not there yet)\n");
return;
}
+ if (pts == MP_NOPTS_VALUE) {
+ if (mpi)
+ mp_msg(MSGT_ENCODE, MSGL_WARN, "vo-lavc: frame without pts, please report; synthesizing pts instead\n");
+ pts = vc->expected_next_pts;
+ }
avc = vc->stream->codec;
@@ -390,65 +396,53 @@ static void draw_image(struct vo *vo, mp_image_t *mpi, double pts)
double timeunit = (double)vc->worst_time_base.num / vc->worst_time_base.den;
- // fix the discontinuity pts offset
- if (ectx->discontinuity_pts_offset == MP_NOPTS_VALUE) {
+ double outpts;
+ if (ectx->options->rawts)
+ outpts = pts;
+ else if (ectx->options->copyts) {
+ // fix the discontinuity pts offset
nextpts = pts;
- ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
- }
-
- // set next allowed output pts value
- nextpts = pts + ectx->discontinuity_pts_offset + timeunit;
- if (nextpts > ectx->next_in_pts)
- ectx->next_in_pts = nextpts;
-
- // vc->lastipts is MP_NOPTS_VALUE, or the start time of vc->lastframe
- if (mpi) {
- if (pts == MP_NOPTS_VALUE) {
- // NOTE: this even applies to ectx->options->copyts!
- if (vc->lastipts == MP_NOPTS_VALUE)
- frameipts = 0;
- else
- frameipts = vc->lastipts + 1;
-
- mp_msg(MSGT_ENCODE, MSGL_INFO, "vo-lavc: pts was missing, using %d - "
- "consider using -ofps or -vf fixpts\n", (int) frameipts);
-
- if (ectx->last_video_in_pts != MP_NOPTS_VALUE)
- ectx->last_video_in_pts += timeunit;
+ if (ectx->discontinuity_pts_offset == MP_NOPTS_VALUE) {
+ ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
+ }
+ else if (fabs(nextpts + ectx->discontinuity_pts_offset - ectx->next_in_pts) > 30) {
+ mp_msg(MSGT_ENCODE, MSGL_WARN,
+ "vo-lavc: detected an unexpected discontinuity (pts jumped by "
+ "%f seconds)\n",
+ nextpts + ectx->discontinuity_pts_offset - ectx->next_in_pts);
+ ectx->discontinuity_pts_offset = ectx->next_in_pts - nextpts;
+ }
- // calculate backwards to set vc->lastpts matchingly
- vc->lastpts = frameipts * timeunit - encode_lavc_getoffset(ectx, vc->stream);
- } else {
- double outpts;
- if (ectx->options->rawts)
- outpts = pts;
- else if (ectx->options->copyts)
- outpts = pts + ectx->discontinuity_pts_offset;
- else {
- double duration = 0;
- if (ectx->last_video_in_pts != MP_NOPTS_VALUE)
- duration = pts - ectx->last_video_in_pts;
- if (duration < 0)
- duration = timeunit; // XXX warn about discontinuity?
- outpts = vc->lastpts + duration;
- if (ectx->audio_pts_offset != MP_NOPTS_VALUE) {
- double adj = outpts - pts - ectx->audio_pts_offset;
- adj = FFMIN(adj, duration * 0.1);
- adj = FFMAX(adj, -duration * 0.1);
- outpts -= adj;
- }
- }
- vc->lastpts = outpts;
- ectx->last_video_in_pts = pts;
- frameipts = floor((outpts + encode_lavc_getoffset(ectx, vc->stream))
- / timeunit + 0.5);
+ outpts = pts + ectx->discontinuity_pts_offset;
+ }
+ else {
+ // adjust pts by knowledge of audio pts vs audio playback time
+ double duration = 0;
+ if (ectx->last_video_in_pts != MP_NOPTS_VALUE)
+ duration = pts - ectx->last_video_in_pts;
+ if (duration < 0)
+ duration = timeunit; // XXX warn about discontinuity?
+ outpts = vc->lastpts + duration;
+ if (ectx->audio_pts_offset != MP_NOPTS_VALUE) {
+ double adj = outpts - pts - ectx->audio_pts_offset;
+ adj = FFMIN(adj, duration * 0.1);
+ adj = FFMAX(adj, -duration * 0.1);
+ outpts -= adj;
}
- } else {
- if (vc->lastipts == MP_NOPTS_VALUE)
- frameipts = 0;
- else
- frameipts = vc->lastipts + 1;
- vc->lastpts = frameipts * timeunit - encode_lavc_getoffset(ectx, vc->stream);
+ }
+ vc->lastpts = outpts;
+ ectx->last_video_in_pts = pts;
+ frameipts = floor((outpts + encode_lavc_getoffset(ectx, vc->stream))
+ / timeunit + 0.5);
+
+ // calculate expected pts of next video frame
+ vc->expected_next_pts = pts + timeunit;
+
+ if (!ectx->options->rawts && ectx->options->copyts) {
+ // set next allowed output pts value
+ nextpts = vc->expected_next_pts + ectx->discontinuity_pts_offset;
+ if (nextpts > ectx->next_in_pts)
+ ectx->next_in_pts = nextpts;
}
// never-drop mode
diff --git a/libvo/vo_gl3.c b/libvo/vo_opengl.c
index f5df6a1ae4..cbf1b46f8b 100644
--- a/libvo/vo_gl3.c
+++ b/libvo/vo_opengl.c
@@ -55,9 +55,9 @@
#include "aspect.h"
#include "fastmemcpy.h"
-static const char vo_gl3_shaders[] =
-// Generated from libvo/vo_gl3_shaders.glsl
-#include "libvo/vo_gl3_shaders.h"
+static const char vo_opengl_shaders[] =
+// Generated from libvo/vo_opengl_shaders.glsl
+#include "libvo/vo_opengl_shaders.h"
;
// Pixel width of 1D lookup textures.
@@ -146,7 +146,6 @@ struct gl_priv {
struct vo *vo;
MPGLContext *glctx;
GL *gl;
- const char *shader_version;
int use_indirect;
int use_gamma;
@@ -158,7 +157,7 @@ struct gl_priv {
int use_pbo;
int use_glFinish;
int use_gl_debug;
- int use_gl2;
+ int allow_sw;
int dither_depth;
int swap_interval;
@@ -184,6 +183,7 @@ struct gl_priv {
GLuint dither_texture;
float dither_quantization;
float dither_multiply;
+ int dither_size;
uint32_t image_width;
uint32_t image_height;
@@ -225,6 +225,8 @@ struct gl_priv {
int border_x, border_y; // OSD borders
int vp_x, vp_y, vp_w, vp_h; // GL viewport
+ int frames_rendered;
+
void *scratch;
};
@@ -272,7 +274,7 @@ static void default_tex_params(struct GL *gl, GLenum target, GLint filter)
static void debug_check_gl(struct gl_priv *p, const char *msg)
{
- if (p->use_gl_debug)
+ if (p->use_gl_debug || p->frames_rendered < 5)
glCheckError(p->gl, msg);
}
@@ -302,9 +304,13 @@ static void draw_triangles(struct gl_priv *p, struct vertex *vb, int vert_count)
GL_DYNAMIC_DRAW);
gl->BindBuffer(GL_ARRAY_BUFFER, 0);
- gl->BindVertexArray(p->vao);
+ if (gl->BindVertexArray)
+ gl->BindVertexArray(p->vao);
+
gl->DrawArrays(GL_TRIANGLES, 0, vert_count);
- gl->BindVertexArray(0);
+
+ if (gl->BindVertexArray)
+ gl->BindVertexArray(0);
debug_check_gl(p, "after rendering");
}
@@ -348,10 +354,12 @@ static void write_quad(struct vertex *va,
#undef COLOR_INIT
}
-static void fbotex_init(struct gl_priv *p, struct fbotex *fbo, int w, int h)
+static bool fbotex_init(struct gl_priv *p, struct fbotex *fbo, int w, int h)
{
GL *gl = p->gl;
+ bool res = true;
+ assert(gl->mpgl_caps & MPGL_CAP_FB);
assert(!fbo->fbo);
assert(!fbo->texture);
@@ -372,25 +380,28 @@ static void fbotex_init(struct gl_priv *p, struct fbotex *fbo, int w, int h)
gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, fbo->texture, 0);
- if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER)
- != GL_FRAMEBUFFER_COMPLETE)
- {
+ if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
mp_msg(MSGT_VO, MSGL_ERR, "[gl] Error: framebuffer completeness "
"check failed!\n");
+ res = false;
}
gl->BindFramebuffer(GL_FRAMEBUFFER, 0);
debug_check_gl(p, "after creating framebuffer & associated texture");
+
+ return res;
}
static void fbotex_uninit(struct gl_priv *p, struct fbotex *fbo)
{
GL *gl = p->gl;
- gl->DeleteFramebuffers(1, &fbo->fbo);
- gl->DeleteTextures(1, &fbo->texture);
- *fbo = (struct fbotex) {0};
+ if (gl->mpgl_caps & MPGL_CAP_FB) {
+ gl->DeleteFramebuffers(1, &fbo->fbo);
+ gl->DeleteTextures(1, &fbo->texture);
+ *fbo = (struct fbotex) {0};
+ }
}
static void matrix_ortho2d(float m[3][3], float x0, float x1,
@@ -441,9 +452,20 @@ static void update_uniforms(struct gl_priv *p, GLuint program)
1.0 / cparams.ggamma,
1.0 / cparams.bgamma);
- gl->Uniform1i(gl->GetUniformLocation(program, "texture1"), 0);
- gl->Uniform1i(gl->GetUniformLocation(program, "texture2"), 1);
- gl->Uniform1i(gl->GetUniformLocation(program, "texture3"), 2);
+ for (int n = 0; n < p->plane_count; n++) {
+ char textures_n[32];
+ char textures_size_n[32];
+ snprintf(textures_n, sizeof(textures_n), "textures[%d]", n);
+ snprintf(textures_size_n, sizeof(textures_size_n), "textures_size[%d]", n);
+
+ gl->Uniform1i(gl->GetUniformLocation(program, textures_n), n);
+ gl->Uniform2f(gl->GetUniformLocation(program, textures_size_n),
+ p->texture_width >> p->planes[n].shift_x,
+ p->texture_height >> p->planes[n].shift_y);
+ }
+
+ gl->Uniform2f(gl->GetUniformLocation(program, "dither_size"),
+ p->dither_size, p->dither_size);
gl->Uniform1i(gl->GetUniformLocation(program, "lut_3d"), TEXUNIT_3DLUT);
@@ -613,12 +635,12 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
// The direction/pass assignment is rather arbitrary, but fixed in
// other parts of the code (like FBO setup).
const char *direction = pass == 0 ? "0, 1" : "1, 0";
- *shader = talloc_asprintf_append(*shader, "#define %s(p0, p1) "
- "sample_convolution_sep%d(vec2(%s), %s, p0, p1)\n",
+ *shader = talloc_asprintf_append(*shader, "#define %s(p0, p1, p2) "
+ "sample_convolution_sep%d(vec2(%s), %s, p0, p1, p2)\n",
target, size, direction, scaler->lut_name);
} else {
- *shader = talloc_asprintf_append(*shader, "#define %s(p0, p1) "
- "sample_convolution%d(%s, p0, p1)\n",
+ *shader = talloc_asprintf_append(*shader, "#define %s(p0, p1, p2) "
+ "sample_convolution%d(%s, p0, p1, p2)\n",
target, size, scaler->lut_name);
}
}
@@ -641,12 +663,12 @@ static void compile_shaders(struct gl_priv *p)
void *tmp = talloc_new(NULL);
- struct bstr src = bstr0(vo_gl3_shaders);
+ struct bstr src = bstr0(vo_opengl_shaders);
char *vertex_shader = get_section(tmp, src, "vertex_all");
char *shader_prelude = get_section(tmp, src, "prelude");
char *s_video = get_section(tmp, src, "frag_video");
- char *header = talloc_asprintf(tmp, "#version %s\n%s", p->shader_version,
+ char *header = talloc_asprintf(tmp, "#version %d\n%s", gl->glsl_version,
shader_prelude);
char *header_osd = talloc_strdup(tmp, header);
@@ -888,6 +910,8 @@ static void init_dither(struct gl_priv *p)
unsigned char dither[256];
make_dither_matrix(dither, size);
+ p->dither_size = size;
+
gl->ActiveTexture(GL_TEXTURE0 + TEXUNIT_DITHER);
gl->GenTextures(1, &p->dither_texture);
gl->BindTexture(GL_TEXTURE_2D, p->dither_texture);
@@ -936,10 +960,10 @@ static void uninit_rendering(struct gl_priv *p)
delete_shaders(p);
for (int n = 0; n < 2; n++) {
- gl->DeleteTextures(1, &p->scalers->gl_lut);
- p->scalers->gl_lut = 0;
- p->scalers->lut_name = NULL;
- p->scalers->kernel = NULL;
+ gl->DeleteTextures(1, &p->scalers[n].gl_lut);
+ p->scalers[n].gl_lut = 0;
+ p->scalers[n].lut_name = NULL;
+ p->scalers[n].kernel = NULL;
}
gl->DeleteTextures(1, &p->dither_texture);
@@ -1097,7 +1121,9 @@ static void do_render(struct gl_priv *p)
float final_texw = p->image_width * source->tex_w / (float)source->vp_w;
float final_texh = p->image_height * source->tex_h / (float)source->vp_h;
- if (p->use_srgb && !p->use_lut_3d)
+ bool use_srgb_fb = p->use_srgb && !p->use_lut_3d;
+
+ if (use_srgb_fb)
gl->Enable(GL_FRAMEBUFFER_SRGB);
if (p->stereo_mode) {
@@ -1138,7 +1164,8 @@ static void do_render(struct gl_priv *p)
draw_triangles(p, vb, VERTICES_PER_QUAD);
}
- gl->Disable(GL_FRAMEBUFFER_SRGB);
+ if (use_srgb_fb)
+ gl->Disable(GL_FRAMEBUFFER_SRGB);
gl->UseProgram(0);
@@ -1228,6 +1255,8 @@ static void flip_page(struct vo *vo)
{
gl->Clear(GL_COLOR_BUFFER_BIT);
}
+
+ p->frames_rendered++;
}
static int draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h,
@@ -1439,6 +1468,70 @@ static void draw_eosd(struct gl_priv *p, struct sub_bitmaps *imgs)
debug_check_gl(p, "after drawing osd");
}
+// Disable features that are not supported with the current OpenGL version.
+static void check_gl_features(struct gl_priv *p)
+{
+ GL *gl = p->gl;
+ bool have_float_tex = gl->mpgl_caps & MPGL_CAP_FLOAT_TEX;
+ bool have_fbo = gl->mpgl_caps & MPGL_CAP_FB;
+ bool have_srgb = (gl->mpgl_caps & MPGL_CAP_SRGB_TEX) &&
+ (gl->mpgl_caps & MPGL_CAP_SRGB_FB);
+
+ char *disabled[10];
+ int n_disabled = 0;
+
+ if (have_fbo) {
+ struct fbotex fbo = {0};
+ have_fbo = fbotex_init(p, &fbo, 16, 16);
+ fbotex_uninit(p, &fbo);
+ }
+
+ // Disable these only if the user didn't disable scale-sep on the command
+ // line, so convolution filter can still be forced to be run.
+ // Normally, we want to disable them by default if FBOs are unavailable,
+ // because they will be slow (not critically slow, but still slower).
+ // Without FP textures, we must always disable them.
+ if (!have_float_tex || (!have_fbo && p->use_scale_sep)) {
+ for (int n = 0; n < 2; n++) {
+ struct scaler *scaler = &p->scalers[n];
+ if (mp_find_filter_kernel(scaler->name)) {
+ scaler->name = "bilinear";
+ disabled[n_disabled++]
+ = have_float_tex ? "scaler (FBO)" : "scaler (float tex.)";
+ }
+ }
+ }
+
+ if (!have_srgb && p->use_srgb) {
+ p->use_srgb = false;
+ disabled[n_disabled++] = "sRGB";
+ }
+ if (!have_fbo && p->use_lut_3d) {
+ p->use_lut_3d = false;
+ disabled[n_disabled++] = "color management (FBO)";
+ }
+ if (!have_srgb && p->use_lut_3d) {
+ p->use_lut_3d = false;
+ disabled[n_disabled++] = "color management (sRGB)";
+ }
+
+ if (!have_fbo) {
+ p->use_scale_sep = false;
+ p->use_indirect = false;
+ }
+
+ if (n_disabled) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[gl] Some OpenGL extensions not detected, "
+ "disabling: ");
+ for (int n = 0; n < n_disabled; n++) {
+ if (n)
+ mp_msg(MSGT_VO, MSGL_ERR, ", ");
+ mp_msg(MSGT_VO, MSGL_ERR, "%s", disabled[n]);
+ }
+ mp_msg(MSGT_VO, MSGL_ERR, ".\n");
+ }
+}
+
static void setup_vertex_array(GL *gl)
{
size_t stride = sizeof(struct vertex);
@@ -1472,15 +1565,7 @@ static int init_gl(struct gl_priv *p)
mp_msg(MSGT_VO, MSGL_V, "[gl] Display depth: R=%d, G=%d, B=%d\n",
p->glctx->depth_r, p->glctx->depth_g, p->glctx->depth_b);
- GLint major, minor;
- gl->GetIntegerv(GL_MAJOR_VERSION, &major);
- gl->GetIntegerv(GL_MINOR_VERSION, &minor);
-
- p->shader_version = "130";
-
- // Hack for OSX: it only creates 3.2 contexts.
- if (MPGL_VER(major, minor) >= MPGL_VER(3, 2))
- p->shader_version = "150";
+ check_gl_features(p);
gl->Disable(GL_DITHER);
gl->Disable(GL_BLEND);
@@ -1490,13 +1575,18 @@ static int init_gl(struct gl_priv *p)
gl->DrawBuffer(GL_BACK);
gl->GenBuffers(1, &p->vertex_buffer);
- gl->GenVertexArrays(1, &p->vao);
-
gl->BindBuffer(GL_ARRAY_BUFFER, p->vertex_buffer);
- gl->BindVertexArray(p->vao);
- setup_vertex_array(gl);
+
+ if (gl->BindVertexArray) {
+ gl->GenVertexArrays(1, &p->vao);
+ gl->BindVertexArray(p->vao);
+ setup_vertex_array(gl);
+ gl->BindVertexArray(0);
+ } else {
+ setup_vertex_array(gl);
+ }
+
gl->BindBuffer(GL_ARRAY_BUFFER, 0);
- gl->BindVertexArray(0);
gl->ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl->Clear(GL_COLOR_BUFFER_BIT);
@@ -1516,7 +1606,8 @@ static void uninit_gl(struct gl_priv *p)
uninit_video(p);
- gl->DeleteVertexArrays(1, &p->vao);
+ if (gl->DeleteVertexArrays)
+ gl->DeleteVertexArrays(1, &p->vao);
p->vao = 0;
gl->DeleteBuffers(1, &p->vertex_buffer);
p->vertex_buffer = 0;
@@ -1607,26 +1698,19 @@ static int query_format(uint32_t format)
return caps;
}
-static bool config_window(struct gl_priv *p, uint32_t d_width,
+static bool create_window(struct gl_priv *p, uint32_t d_width,
uint32_t d_height, uint32_t flags)
{
if (p->stereo_mode == GL_3D_QUADBUFFER)
flags |= VOFLAG_STEREO;
- int mpgl_version = MPGL_VER(3, 0);
- int mpgl_flags = p->use_gl_debug ? MPGLFLAG_DEBUG : 0;
-
- if (p->use_gl2)
- mpgl_version = MPGL_VER(2, 1);
-
- if (create_mpglcontext(p->glctx, mpgl_flags, mpgl_version, d_width,
- d_height, flags) == SET_WINDOW_FAILED)
- return false;
-
- if (!p->vertex_buffer)
- init_gl(p);
+ if (p->use_gl_debug)
+ flags |= VOFLAG_GL_DEBUG;
- return true;
+ int mpgl_caps = MPGL_CAP_GL21 | MPGL_CAP_TEX_RG;
+ if (!p->allow_sw)
+ mpgl_caps |= MPGL_CAP_NO_SW;
+ return mpgl_create_window(p->glctx, mpgl_caps, d_width, d_height, flags);
}
static int config(struct vo *vo, uint32_t width, uint32_t height,
@@ -1635,9 +1719,12 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
{
struct gl_priv *p = vo->priv;
- if (!config_window(p, d_width, d_height, flags))
+ if (!create_window(p, d_width, d_height, flags))
return -1;
+ if (!p->vertex_buffer)
+ init_gl(p);
+
p->vo_flipped = !!(flags & VOFLAG_FLIPPING);
if (p->image_format != format || p->image_width != width
@@ -1768,6 +1855,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
char *arg = data;
if (!reparse_cmdline(p, arg))
return false;
+ check_gl_features(p);
reinit_rendering(p);
resize(p);
vo->want_redraw = true;
@@ -1782,7 +1870,7 @@ static void uninit(struct vo *vo)
struct gl_priv *p = vo->priv;
uninit_gl(p);
- uninit_mpglcontext(p->glctx);
+ mpgl_uninit(p->glctx);
p->glctx = NULL;
p->gl = NULL;
}
@@ -1807,7 +1895,7 @@ static struct bstr load_file(struct gl_priv *p, void *talloc_ctx,
return res;
}
-#define LUT3D_CACHE_HEADER "mplayer2 3dlut cache 1.0\n"
+#define LUT3D_CACHE_HEADER "mpv 3dlut cache 1.0\n"
static bool load_icc(struct gl_priv *p, const char *icc_file,
const char *icc_cache, int icc_intent,
@@ -1955,6 +2043,7 @@ const struct fbo_format fbo_formats[] = {
{"rgb", GL_RGB},
{"rgba", GL_RGBA},
{"rgb8", GL_RGB8},
+ {"rgb10", GL_RGB10},
{"rgb16", GL_RGB16},
{"rgb16f", GL_RGB16F},
{"rgb32f", GL_RGB32F},
@@ -2074,6 +2163,8 @@ static bool reparse_cmdline(struct gl_priv *p, char *arg)
p->use_scale_sep = opt->use_scale_sep;
p->dither_depth = opt->dither_depth;
+ check_gl_features(p);
+
return true;
}
@@ -2082,18 +2173,21 @@ static int preinit(struct vo *vo, const char *arg)
struct gl_priv *p = talloc_zero(vo, struct gl_priv);
vo->priv = p;
+ bool hq = strcmp(vo->driver->info->short_name, "opengl-hq") == 0;
+
*p = (struct gl_priv) {
.vo = vo,
.colorspace = MP_CSP_DETAILS_DEFAULTS,
.use_npot = 1,
- .use_pbo = 0,
+ .use_pbo = hq,
.swap_interval = vo_vsync,
.osd_color = 0xffffff,
- .fbo_format = GL_RGB16,
+ .dither_depth = hq ? 0 : -1,
+ .fbo_format = hq ? GL_RGB16 : GL_RGB,
.use_scale_sep = 1,
- .use_fancy_downscaling = 1,
+ .use_fancy_downscaling = hq,
.scalers = {
- { .index = 0, .name = "lanczos2" },
+ { .index = 0, .name = hq ? "lanczos2" : "bilinear" },
{ .index = 1, .name = "bilinear" },
},
.scaler_params = {NAN, NAN},
@@ -2126,11 +2220,11 @@ static int preinit(struct vo *vo, const char *arg)
{"lparam2", OPT_ARG_FLOAT, &p->scaler_params[1]},
{"fancy-downscaling", OPT_ARG_BOOL, &p->use_fancy_downscaling},
{"debug", OPT_ARG_BOOL, &p->use_gl_debug},
- {"force-gl2", OPT_ARG_BOOL, &p->use_gl2},
{"indirect", OPT_ARG_BOOL, &p->use_indirect},
{"scale-sep", OPT_ARG_BOOL, &p->use_scale_sep},
{"fbo-format", OPT_ARG_MSTRZ, &fbo_format, fbo_format_valid},
{"backend", OPT_ARG_MSTRZ, &backend_arg, backend_valid},
+ {"sw", OPT_ARG_BOOL, &p->allow_sw},
{"icc-profile", OPT_ARG_MSTRZ, &icc_profile},
{"icc-cache", OPT_ARG_MSTRZ, &icc_cache},
{"icc-intent", OPT_ARG_INT, &icc_intent},
@@ -2177,23 +2271,20 @@ static int preinit(struct vo *vo, const char *arg)
p->orig_cmdline = talloc(p, struct gl_priv);
*p->orig_cmdline = *p;
- p->glctx = init_mpglcontext(backend, vo);
+ p->glctx = mpgl_init(backend, vo);
if (!p->glctx)
goto err_out;
p->gl = p->glctx->gl;
- if (true) {
- if (!config_window(p, 320, 200, VOFLAG_HIDDEN))
- goto err_out;
- // We created a window to test whether the GL context could be
- // created and so on. Destroy that window to make sure all state
- // associated with it is lost.
- uninit(vo);
- p->glctx = init_mpglcontext(backend, vo);
- if (!p->glctx)
- goto err_out;
- p->gl = p->glctx->gl;
- }
+ if (!create_window(p, 320, 200, VOFLAG_HIDDEN))
+ goto err_out;
+ check_gl_features(p);
+ // We created a window to test whether the GL context could be
+ // created and so on. Destroy that window to make sure all state
+ // associated with it is lost.
+ uninit_gl(p);
+ if (!mpgl_destroy_window(p->glctx))
+ goto err_out;
return 0;
@@ -2202,11 +2293,29 @@ err_out:
return -1;
}
-const struct vo_driver video_out_gl3 = {
+const struct vo_driver video_out_opengl = {
+ .is_new = true,
+ .info = &(const vo_info_t) {
+ "Extended OpenGL Renderer",
+ "opengl",
+ "Based on vo_gl.c by Reimar Doeffinger",
+ ""
+ },
+ .preinit = preinit,
+ .config = config,
+ .control = control,
+ .draw_slice = draw_slice,
+ .draw_osd = draw_osd_with_eosd,
+ .flip_page = flip_page,
+ .check_events = check_events,
+ .uninit = uninit,
+};
+
+const struct vo_driver video_out_opengl_hq = {
.is_new = true,
.info = &(const vo_info_t) {
- "OpenGL 3.x",
- "gl3",
+ "Extended OpenGL Renderer (high quality rendering preset)",
+ "opengl-hq",
"Based on vo_gl.c by Reimar Doeffinger",
""
},
@@ -2221,8 +2330,8 @@ const struct vo_driver video_out_gl3 = {
};
static const char help_text[] =
-"\n--vo=gl3 command line help:\n"
-"Example: mplayer --vo=gl3:scale-sep:lscale=lanczos2\n"
+"\n--vo=opengl command line help:\n"
+"Example: mpv --vo=opengl:scale-sep:lscale=lanczos2\n"
"\nOptions:\n"
" lscale=<filter>\n"
" Set the scaling filter. Possible choices:\n"
@@ -2230,10 +2339,10 @@ static const char help_text[] =
" bicubic_fast: bicubic filter (without lookup texture).\n"
" sharpen3: unsharp masking (sharpening) with radius=3.\n"
" sharpen5: unsharp masking (sharpening) with radius=5.\n"
-" lanczos2: Lanczos with radius=2 (default, recommended).\n"
+" lanczos2: Lanczos with radius=2 (recommended).\n"
" lanczos3: Lanczos with radius=3 (not recommended).\n"
" mitchell: Mitchell-Netravali.\n"
-" Default: lanczos2\n"
+" Default: bilinear\n"
" lparam1=<value> / lparam2=<value>\n"
" Set parameters for configurable filters. Affects chroma scaler\n"
" as well.\n"
@@ -2253,19 +2362,18 @@ static const char help_text[] =
" Enable gamma-correct scaling by working in linear light. This\n"
" makes use of sRGB textures and framebuffers.\n"
" This option forces the options 'indirect' and 'gamma'.\n"
-" NOTE: for BT.709 colorspaces, a gamma of 2.35 is assumed. For\n"
-" other YUV colorspaces, 2.2 is assumed. RGB input is always\n"
+" NOTE: For YUV colorspaces, gamma 2.2 is assumed. RGB input is always\n"
" assumed to be in sRGB.\n"
" pbo\n"
" Enable use of PBOs. This is faster, but can sometimes lead to\n"
" sparodic and temporary image corruption.\n"
" dither-depth=<n>\n"
" Positive non-zero values select the target bit depth.\n"
-" -1: Disable any dithering done by mplayer.\n"
+" -1: Disable any dithering done by mpv.\n"
" 0: Automatic selection. If output bit depth can't be detected,\n"
" 8 bits per component are assumed.\n"
" 8: Dither to 8 bit output.\n"
-" Default: 0.\n"
+" Default: -1.\n"
" Note that dithering will always be disabled if the bit depth\n"
" of the video is lower or qual to the detected dither-depth.\n"
" If color management is enabled, input depth is assumed to be\n"
@@ -2289,10 +2397,9 @@ static const char help_text[] =
" Note that with some scaling filters, upscaling is always done in\n"
" RGB. If chroma is not subsampled, this option is ignored, and the\n"
" luma scaler is used instead. Setting this option is often useless.\n"
-" no-fancy-downscaling\n"
-" When using convolution based filters, don't extend the filter\n"
-" size when downscaling. Trades downscaling performance for\n"
-" reduced quality.\n"
+" fancy-downscaling\n"
+" When using convolution based filters, extend the filter size\n"
+" when downscaling. Trades quality for reduced downscaling performance.\n"
" no-npot\n"
" Force use of power-of-2 texture sizes. For debugging only.\n"
" Borders will look discolored due to filtering.\n"
@@ -2313,13 +2420,10 @@ static const char help_text[] =
" This mechanism is disabled on RGB input.\n"
" fbo-format=<fmt>\n"
" Selects the internal format of any FBO textures used.\n"
-" fmt can be one of: rgb, rgba, rgb8, rgb16, rgb16f, rgb32f\n"
-" Default: rgb16.\n"
+" fmt can be one of: rgb, rgba, rgb8, rgb10, rgb16, rgb16f, rgb32f\n"
+" Default: rgb.\n"
" gamma\n"
" Always enable gamma control. (Disables delayed enabling.)\n"
-" force-gl2\n"
-" Create a legacy GL context. This will randomly malfunction\n"
-" if the proper extensions are not supported.\n"
"Color management:\n"
" icc-profile=<file>\n"
" Load an ICC profile and use it to transform linear RGB to\n"
@@ -2328,7 +2432,7 @@ static const char help_text[] =
" Store and load the 3D LUT created from the ICC profile in\n"
" this file. This can be used to speed up loading, since\n"
" LittleCMS2 can take a while to create the 3D LUT.\n"
-" Note that this file will be at most about 100 MB big.\n"
+" Note that this file will be up to ~100 MB big.\n"
" icc-intent=<value>\n"
" 0: perceptual\n"
" 1: relative colorimetric\n"
@@ -2338,4 +2442,5 @@ static const char help_text[] =
" Size of the 3D LUT generated from the ICC profile in each\n"
" dimension. Default is 128x256x64.\n"
" Sizes must be a power of two, and 256 at most.\n"
+"Note: all defaults mentioned are for 'opengl', not 'opengl-hq'.\n"
"\n";
diff --git a/libvo/vo_gl.c b/libvo/vo_opengl_old.c
index d41adad6bc..6dfe90c17d 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_opengl_old.c
@@ -52,6 +52,8 @@ struct gl_priv {
MPGLContext *glctx;
GL *gl;
+ int allow_sw;
+
int use_osd;
int scaled_osd;
struct mpgl_osd *osd;
@@ -255,6 +257,9 @@ static void uninitGl(struct vo *vo)
struct gl_priv *p = vo->priv;
GL *gl = p->gl;
+ if (!gl)
+ return;
+
int i = 0;
if (gl->DeletePrograms && p->fragprog)
gl->DeletePrograms(1, &p->fragprog);
@@ -278,16 +283,6 @@ static void uninitGl(struct vo *vo)
p->err_shown = 0;
}
-static int isSoftwareGl(struct vo *vo)
-{
- struct gl_priv *p = vo->priv;
- const char *renderer = p->gl->GetString(GL_RENDERER);
- const char *vendor = p->gl->GetString(GL_VENDOR);
- return !renderer || strcmp(renderer, "Software Rasterizer") == 0 ||
- strstr(renderer, "llvmpipe") ||
- strcmp(vendor, "Microsoft Corporation") == 0;
-}
-
static void autodetectGlExtensions(struct vo *vo)
{
struct gl_priv *p = vo->priv;
@@ -458,15 +453,18 @@ static int initGl(struct vo *vo, uint32_t d_width, uint32_t d_height)
return 1;
}
-static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
- uint32_t flags)
+static bool create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
+ uint32_t flags)
{
struct gl_priv *p = vo->priv;
if (p->stereo_mode == GL_3D_QUADBUFFER)
flags |= VOFLAG_STEREO;
- return p->glctx->create_window(p->glctx, d_width, d_height, flags);
+ int mpgl_caps = MPGL_CAP_GL_LEGACY;
+ if (!p->allow_sw)
+ mpgl_caps |= MPGL_CAP_NO_SW;
+ return mpgl_create_window(p->glctx, mpgl_caps, d_width, d_height, flags);
}
static int config(struct vo *vo, uint32_t width, uint32_t height,
@@ -488,13 +486,12 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
p->vo_flipped = !!(flags & VOFLAG_FLIPPING);
- if (create_window(vo, d_width, d_height, flags) < 0)
- return -1;
-
if (vo->config_count)
uninitGl(vo);
- if (p->glctx->setGlWindow(p->glctx) == SET_WINDOW_FAILED)
+
+ if (!create_window(vo, d_width, d_height, flags))
return -1;
+
initGl(vo, vo->dwidth, vo->dheight);
return 0;
@@ -870,13 +867,12 @@ static void uninit(struct vo *vo)
{
struct gl_priv *p = vo->priv;
- if (p->glctx)
- uninitGl(vo);
+ uninitGl(vo);
free(p->custom_prog);
p->custom_prog = NULL;
free(p->custom_tex);
p->custom_tex = NULL;
- uninit_mpglcontext(p->glctx);
+ mpgl_uninit(p->glctx);
p->glctx = NULL;
p->gl = NULL;
}
@@ -907,7 +903,6 @@ static int preinit(struct vo *vo, const char *arg)
.osd_color = 0xffffff,
};
- int allow_sw = 0;
char *backend_arg = NULL;
//essentially unused; for legacy warnings only
@@ -938,7 +933,7 @@ static int preinit(struct vo *vo, const char *arg)
{"mipmapgen", OPT_ARG_BOOL, &p->mipmap_gen, NULL},
{"osdcolor", OPT_ARG_INT, &p->osd_color, NULL},
{"stereo", OPT_ARG_INT, &p->stereo_mode, NULL},
- {"sw", OPT_ARG_BOOL, &allow_sw, NULL},
+ {"sw", OPT_ARG_BOOL, &p->allow_sw, NULL},
{"backend", OPT_ARG_MSTRZ,&backend_arg, backend_valid},
// Removed options.
// They are only parsed to notify the user about the replacements.
@@ -950,8 +945,8 @@ static int preinit(struct vo *vo, const char *arg)
if (subopt_parse(arg, subopts) != 0) {
mp_msg(MSGT_VO, MSGL_FATAL,
- "\n-vo gl command line help:\n"
- "Example: mplayer -vo gl:slice-height=4\n"
+ "\n-vo opengl_old command line help:\n"
+ "Example: mpv -vo opengl_old:slice-height=4\n"
"\nOptions:\n"
" nomanyfmts\n"
" Disable extended color formats for OpenGL 1.2 and later\n"
@@ -1045,27 +1040,21 @@ static int preinit(struct vo *vo, const char *arg)
int backend = backend_arg ? mpgl_find_backend(backend_arg) : GLTYPE_AUTO;
free(backend_arg);
- p->glctx = init_mpglcontext(backend, vo);
+ p->glctx = mpgl_init(backend, vo);
if (!p->glctx)
goto err_out;
p->gl = p->glctx->gl;
- if (p->use_yuv == -1 || !allow_sw) {
- if (create_window(vo, 320, 200, VOFLAG_HIDDEN) < 0)
- goto err_out;
- if (p->glctx->setGlWindow(p->glctx) == SET_WINDOW_FAILED)
- goto err_out;
- if (!allow_sw && isSoftwareGl(vo))
+ if (p->use_yuv == -1) {
+ if (!create_window(vo, 320, 200, VOFLAG_HIDDEN))
goto err_out;
autodetectGlExtensions(vo);
// We created a window to test whether the GL context supports hardware
// acceleration and so on. Destroy that window to make sure all state
// associated with it is lost.
- uninit(vo);
- p->glctx = init_mpglcontext(backend, vo);
- if (!p->glctx)
+ uninitGl(vo);
+ if (!mpgl_destroy_window(p->glctx))
goto err_out;
- p->gl = p->glctx->gl;
}
if (p->many_fmts)
mp_msg(MSGT_VO, MSGL_INFO, "[gl] using extended formats. "
@@ -1177,33 +1166,11 @@ static int control(struct vo *vo, uint32_t request, void *data)
return VO_NOTIMPL;
}
-const struct vo_driver video_out_gl = {
+const struct vo_driver video_out_opengl_old = {
.is_new = true,
.info = &(const vo_info_t) {
"OpenGL",
- "gl",
- "Reimar Doeffinger <Reimar.Doeffinger@gmx.de>",
- ""
- },
- .preinit = preinit,
- .config = config,
- .control = control,
- .draw_slice = draw_slice,
- .draw_osd = draw_osd_with_eosd,
- .flip_page = flip_page,
- .check_events = check_events,
- .uninit = uninit,
-};
-
-// "-vo gl" used to accept software renderers by default. This is not the case
-// anymore: you have to use "-vo gl:sw" to get this. This means gl and gl_nosw
-// are exactly the same thing now. Keep gl_nosw to not break user configs.
-const struct vo_driver video_out_gl_nosw =
-{
- .is_new = true,
- .info = &(const vo_info_t) {
- "OpenGL no software rendering",
- "gl_nosw",
+ "opengl-old",
"Reimar Doeffinger <Reimar.Doeffinger@gmx.de>",
""
},
diff --git a/libvo/vo_gl3_shaders.glsl b/libvo/vo_opengl_shaders.glsl
index 04d886f9c0..01e1433f7f 100644
--- a/libvo/vo_gl3_shaders.glsl
+++ b/libvo/vo_opengl_shaders.glsl
@@ -22,7 +22,29 @@
// inserted at the beginning of all shaders
#!section prelude
+
+// GLSL 1.20 compatibility layer
+// texture() should be assumed to always map to texture2D()
+#if __VERSION__ >= 130
+# define texture1D texture
+# define texture3D texture
+# define DECLARE_FRAGPARMS \
+ out vec4 out_color;
+#else
+# define texture texture2D
+# define DECLARE_FRAGPARMS
+# define out_color gl_FragColor
+# define in varying
+#endif
+
#!section vertex_all
+
+#if __VERSION__ < 130
+# undef in
+# define in attribute
+# define out varying
+#endif
+
uniform mat3 transform;
uniform sampler3D lut_3d;
@@ -40,36 +62,35 @@ void main() {
gl_Position = vec4(position, 1);
color = vertex_color;
#ifdef USE_3DLUT
- color = vec4(texture(lut_3d, color.rgb).rgb, color.a);
+ color = vec4(texture3D(lut_3d, color.rgb).rgb, color.a);
#endif
texcoord = vertex_texcoord;
}
#!section frag_osd_libass
-uniform sampler2D texture1;
+uniform sampler2D textures[3];
in vec2 texcoord;
in vec4 color;
-out vec4 out_color;
+DECLARE_FRAGPARMS
void main() {
- out_color = vec4(color.rgb, color.a * texture(texture1, texcoord).r);
+ out_color = vec4(color.rgb, color.a * texture(textures[0], texcoord).r);
}
#!section frag_osd_rgba
-uniform sampler2D texture1;
+uniform sampler2D textures[3];
in vec2 texcoord;
-out vec4 out_color;
+DECLARE_FRAGPARMS
void main() {
- out_color = texture(texture1, texcoord);
+ out_color = texture(textures[0], texcoord);
}
#!section frag_video
-uniform sampler2D texture1;
-uniform sampler2D texture2;
-uniform sampler2D texture3;
+uniform sampler2D textures[3];
+uniform vec2 textures_size[3];
uniform sampler1D lut_c_1d;
uniform sampler1D lut_l_1d;
uniform sampler2D lut_c_2d;
@@ -82,11 +103,12 @@ uniform float conv_gamma;
uniform float dither_quantization;
uniform float dither_multiply;
uniform float filter_param1;
+uniform vec2 dither_size;
in vec2 texcoord;
-out vec4 out_color;
+DECLARE_FRAGPARMS
-vec4 sample_bilinear(sampler2D tex, vec2 texcoord) {
+vec4 sample_bilinear(sampler2D tex, vec2 texsize, vec2 texcoord) {
return texture(tex, texcoord);
}
@@ -107,8 +129,7 @@ vec4 calcweights(float s) {
return t;
}
-vec4 sample_bicubic_fast(sampler2D tex, vec2 texcoord) {
- vec2 texsize = textureSize(tex, 0);
+vec4 sample_bicubic_fast(sampler2D tex, vec2 texsize, vec2 texcoord) {
vec2 pt = 1 / texsize;
vec2 fcoord = fract(texcoord * texsize + vec2(0.5, 0.5));
vec4 parmx = calcweights(fcoord.x);
@@ -129,12 +150,12 @@ vec4 sample_bicubic_fast(sampler2D tex, vec2 texcoord) {
}
float[2] weights2(sampler1D lookup, float f) {
- vec4 c = texture(lookup, f);
+ vec4 c = texture1D(lookup, f);
return float[2](c.r, c.g);
}
float[4] weights4(sampler1D lookup, float f) {
- vec4 c = texture(lookup, f);
+ vec4 c = texture1D(lookup, f);
return float[4](c.r, c.g, c.b, c.a);
}
@@ -168,13 +189,13 @@ float[16] weights16(sampler2D lookup, float f) {
c3.r, c3.g, c3.b, c3.a, c4.r, c4.g, c4.b, c4.a);
}
-#define CONVOLUTION_SEP_N(NAME, N) \
- vec4 NAME(sampler2D tex, vec2 texcoord, vec2 pt, float weights[N]) { \
- vec4 res = vec4(0); \
- for (int n = 0; n < N; n++) { \
- res += weights[n] * texture(tex, texcoord + pt * n); \
- } \
- return res; \
+#define CONVOLUTION_SEP_N(NAME, N) \
+ vec4 NAME(sampler2D tex, vec2 texcoord, vec2 pt, float weights[N]) { \
+ vec4 res = vec4(0); \
+ for (int n = 0; n < N; n++) { \
+ res += weights[n] * texture(tex, texcoord + pt * n); \
+ } \
+ return res; \
}
CONVOLUTION_SEP_N(convolution_sep2, 2)
@@ -187,8 +208,8 @@ CONVOLUTION_SEP_N(convolution_sep16, 16)
// The dir parameter is (0, 1) or (1, 0), and we expect the shader compiler to
// remove all the redundant multiplications and additions.
#define SAMPLE_CONVOLUTION_SEP_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC)\
- vec4 NAME(vec2 dir, SAMPLERT lookup, sampler2D tex, vec2 texcoord) { \
- vec2 texsize = textureSize(tex, 0); \
+ vec4 NAME(vec2 dir, SAMPLERT lookup, sampler2D tex, vec2 texsize, \
+ vec2 texcoord) { \
vec2 pt = (1 / texsize) * dir; \
float fcoord = dot(fract(texcoord * texsize - 0.5), dir); \
vec2 base = texcoord - fcoord * pt; \
@@ -225,8 +246,7 @@ CONVOLUTION_N(convolution12, 12)
CONVOLUTION_N(convolution16, 16)
#define SAMPLE_CONVOLUTION_N(NAME, N, SAMPLERT, CONV_FUNC, WEIGHTS_FUNC) \
- vec4 NAME(SAMPLERT lookup, sampler2D tex, vec2 texcoord) { \
- vec2 texsize = textureSize(tex, 0); \
+ vec4 NAME(SAMPLERT lookup, sampler2D tex, vec2 texsize, vec2 texcoord) {\
vec2 pt = 1 / texsize; \
vec2 fcoord = fract(texcoord * texsize - 0.5); \
vec2 base = texcoord - fcoord * pt; \
@@ -244,8 +264,7 @@ SAMPLE_CONVOLUTION_N(sample_convolution16, 16, sampler2D, convolution16, weights
// Unsharp masking
-vec4 sample_sharpen3(sampler2D tex, vec2 texcoord) {
- vec2 texsize = textureSize(tex, 0);
+vec4 sample_sharpen3(sampler2D tex, vec2 texsize, vec2 texcoord) {
vec2 pt = 1 / texsize;
vec2 st = pt * 0.5;
vec4 p = texture(tex, texcoord);
@@ -256,8 +275,7 @@ vec4 sample_sharpen3(sampler2D tex, vec2 texcoord) {
return p + (p - 0.25 * sum) * filter_param1;
}
-vec4 sample_sharpen5(sampler2D tex, vec2 texcoord) {
- vec2 texsize = textureSize(tex, 0);
+vec4 sample_sharpen5(sampler2D tex, vec2 texsize, vec2 texcoord) {
vec2 pt = 1 / texsize;
vec2 st1 = pt * 1.2;
vec4 p = texture(tex, texcoord);
@@ -276,11 +294,11 @@ vec4 sample_sharpen5(sampler2D tex, vec2 texcoord) {
void main() {
#ifdef USE_PLANAR
- vec3 color = vec3(SAMPLE_L(texture1, texcoord).r,
- SAMPLE_C(texture2, texcoord).r,
- SAMPLE_C(texture3, texcoord).r);
+ vec3 color = vec3(SAMPLE_L(textures[0], textures_size[0], texcoord).r,
+ SAMPLE_C(textures[1], textures_size[1], texcoord).r,
+ SAMPLE_C(textures[2], textures_size[2], texcoord).r);
#else
- vec3 color = SAMPLE_L(texture1, texcoord).rgb;
+ vec3 color = SAMPLE_L(textures[0], textures_size[0], texcoord).rgb;
#endif
#ifdef USE_GBRP
color.gbr = color;
@@ -305,11 +323,11 @@ void main() {
color = pow(color, inv_gamma);
#endif
#ifdef USE_3DLUT
- color = texture(lut_3d, color).rgb;
+ color = texture3D(lut_3d, color).rgb;
#endif
#ifdef USE_DITHER
- float dither = texture(dither, gl_FragCoord.xy / textureSize(dither, 0)).r;
- color = floor(color * dither_multiply + dither ) / dither_quantization;
+ float dither_value = texture(dither, gl_FragCoord.xy / dither_size).r;
+ color = floor(color * dither_multiply + dither_value ) / dither_quantization;
#endif
out_color = vec4(color, 1);
}
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 65581dac35..42ddde890a 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -689,13 +689,13 @@ static int preinit(struct vo *vo, const char *arg)
mp_tmsg(MSGT_VO, MSGL_ERR,
"[VO_XV] Could not find free Xvideo port - maybe another process is already\n"\
"[VO_XV] using it. Close all video applications, and try again. If that does\n"\
- "[VO_XV] not help, see 'mplayer -vo help' for other (non-xv) video out drivers.\n");
+ "[VO_XV] not help, see 'mpv -vo help' for other (non-xv) video out drivers.\n");
else
mp_tmsg(MSGT_VO, MSGL_ERR,
"[VO_XV] It seems there is no Xvideo support for your video card available.\n"\
"[VO_XV] Run 'xvinfo' to verify its Xv support and read\n"\
"[VO_XV] DOCS/HTML/en/video.html#xv!\n"\
- "[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.\n"\
+ "[VO_XV] See 'mpv -vo help' for other (non-xv) video out drivers.\n"\
"[VO_XV] Try -vo x11.\n");
goto error;
}
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index ebe17bd154..6136730fbd 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -35,7 +35,7 @@
#define WIN_ID_TO_HWND(x) ((HWND)(uint32_t)(x))
-static const wchar_t classname[] = L"mplayer2";
+static const wchar_t classname[] = L"mpv";
static const struct mp_keymap vk_map[] = {
// special keys
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 39c876ce3e..06ffcaef54 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -718,7 +718,7 @@ void vo_x11_classhint(struct vo *vo, Window window, const char *name)
pid_t pid = getpid();
wmClass.res_name = opts->vo_winname ? opts->vo_winname : (char *)name;
- wmClass.res_class = "mplayer2";
+ wmClass.res_class = "mpv";
XSetClassHint(x11->display, window, &wmClass);
XChangeProperty(x11->display, window, x11->XA_NET_WM_PID, XA_CARDINAL,
32, PropModeReplace, (unsigned char *) &pid, 1);
@@ -1633,7 +1633,7 @@ void vo_x11_selectinput_witherr(Display * display, Window w,
if (selectinput_err)
{
mp_msg(MSGT_VO, MSGL_ERR,
- "X11 error: MPlayer discards mouse control (reconfiguring)\n");
+ "X11 error: mpv discards mouse control (reconfiguring)\n");
XSelectInput(display, w,
event_mask &
(~
@@ -2163,20 +2163,20 @@ static void vo_xv_print_ck_info(struct vo_x11_state *x11)
if ( x11->xv_ck_info.method == CK_METHOD_AUTOPAINT )
{
mp_msg( MSGT_VO, MSGL_V,
- "Ignoring colorkey from MPlayer (0x%06lx).\n",
+ "Ignoring colorkey from mpv (0x%06lx).\n",
x11->xv_colorkey );
}
else
{
mp_msg( MSGT_VO, MSGL_V,
- "Using colorkey from MPlayer (0x%06lx)."
+ "Using colorkey from mpv (0x%06lx)."
" Use -colorkey to change.\n",
x11->xv_colorkey );
}
break;
case CK_SRC_SET:
mp_msg( MSGT_VO, MSGL_V,
- "Setting and using colorkey from MPlayer (0x%06lx)."
+ "Setting and using colorkey from mpv (0x%06lx)."
" Use -colorkey to change.\n",
x11->xv_colorkey );
break;
diff --git a/m_config.c b/m_config.c
index c8cf250807..9ed09da751 100644
--- a/m_config.c
+++ b/m_config.c
@@ -365,8 +365,8 @@ int m_config_register_options(struct m_config *config,
return 1;
}
-static struct m_config_option *m_config_get_co(const struct m_config *config,
- struct bstr name)
+struct m_config_option *m_config_get_co(const struct m_config *config,
+ struct bstr name)
{
struct m_config_option *co;
diff --git a/m_config.h b/m_config.h
index 6bb1f4ff35..9098a23c97 100644
--- a/m_config.h
+++ b/m_config.h
@@ -152,6 +152,9 @@ int m_config_parse_suboptions(struct m_config *config, char *name,
const struct m_option *m_config_get_option(const struct m_config *config,
struct bstr name);
+struct m_config_option *m_config_get_co(const struct m_config *config,
+ struct bstr name);
+
/* Print a list of all registered options.
* \param config The config object.
*/
diff --git a/m_option.c b/m_option.c
index 1fef1fd86e..d48d4016b8 100644
--- a/m_option.c
+++ b/m_option.c
@@ -26,15 +26,18 @@
#include <math.h>
#include <stdio.h>
#include <stdarg.h>
+#include <limits.h>
#include <inttypes.h>
#include <unistd.h>
#include <assert.h>
+#include <libavutil/common.h>
+#include <libavutil/avstring.h>
+
#include "talloc.h"
#include "m_option.h"
#include "mp_msg.h"
#include "stream/url.h"
-#include "libavutil/avstring.h"
char *m_option_strerror(int code)
{
@@ -87,6 +90,14 @@ static void copy_opt(const m_option_t *opt, void *dst, const void *src)
#define VAL(x) (*(int *)(x))
+static int clamp_flag(const m_option_t *opt, void *val)
+{
+ if (VAL(val) == opt->min || VAL(val) == opt->max)
+ return 0;
+ VAL(val) = opt->min;
+ return M_OPT_OUT_OF_RANGE;
+}
+
static int parse_flag(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -120,6 +131,15 @@ static char *print_flag(const m_option_t *opt, const void *val)
return talloc_strdup(NULL, "yes");
}
+static void add_flag(const m_option_t *opt, void *val, double add, bool wrap)
+{
+ if (fabs(add) < 0.5)
+ return;
+ bool state = VAL(val) != opt->min;
+ state = wrap ? !state : add > 0;
+ VAL(val) = state ? opt->max : opt->min;
+}
+
const m_option_type_t m_option_type_flag = {
// need yes or no in config files
.name = "Flag",
@@ -128,10 +148,30 @@ const m_option_type_t m_option_type_flag = {
.parse = parse_flag,
.print = print_flag,
.copy = copy_opt,
+ .add = add_flag,
+ .clamp = clamp_flag,
};
// Integer
+#undef VAL
+
+static int clamp_longlong(const m_option_t *opt, void *val)
+{
+ long long v = *(long long *)val;
+ int r = 0;
+ if ((opt->flags & M_OPT_MAX) && (v > opt->max)) {
+ v = opt->max;
+ r = M_OPT_OUT_OF_RANGE;
+ }
+ if ((opt->flags & M_OPT_MIN) && (v < opt->min)) {
+ v = opt->min;
+ r = M_OPT_OUT_OF_RANGE;
+ }
+ *(long long *)val = v;
+ return r;
+}
+
static int parse_longlong(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -169,6 +209,22 @@ static int parse_longlong(const m_option_t *opt, struct bstr name,
return 1;
}
+static int clamp_int(const m_option_t *opt, void *val)
+{
+ long long tmp = *(int *)val;
+ int r = clamp_longlong(opt, &tmp);
+ *(int *)val = tmp;
+ return r;
+}
+
+static int clamp_int64(const m_option_t *opt, void *val)
+{
+ long long tmp = *(int64_t *)val;
+ int r = clamp_longlong(opt, &tmp);
+ *(int64_t *)val = tmp;
+ return r;
+}
+
static int parse_int(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -189,12 +245,39 @@ static int parse_int64(const m_option_t *opt, struct bstr name,
return r;
}
-
static char *print_int(const m_option_t *opt, const void *val)
{
if (opt->type->size == sizeof(int64_t))
return talloc_asprintf(NULL, "%"PRId64, *(const int64_t *)val);
- return talloc_asprintf(NULL, "%d", VAL(val));
+ return talloc_asprintf(NULL, "%d", *(const int *)val);
+}
+
+static void add_int64(const m_option_t *opt, void *val, double add, bool wrap)
+{
+ int64_t v = *(int64_t *)val;
+
+ v = v + add;
+
+ bool is64 = opt->type->size == sizeof(int64_t);
+ int64_t nmin = is64 ? INT64_MIN : INT_MIN;
+ int64_t nmax = is64 ? INT64_MAX : INT_MAX;
+
+ int64_t min = (opt->flags & M_OPT_MIN) ? opt->min : nmin;
+ int64_t max = (opt->flags & M_OPT_MAX) ? opt->max : nmax;
+
+ if (v < min)
+ v = wrap ? max : min;
+ if (v > max)
+ v = wrap ? min : max;
+
+ *(int64_t *)val = v;
+}
+
+static void add_int(const m_option_t *opt, void *val, double add, bool wrap)
+{
+ int64_t tmp = *(int *)val;
+ add_int64(opt, &tmp, add, wrap);
+ *(int *)val = tmp;
}
const m_option_type_t m_option_type_int = {
@@ -203,6 +286,8 @@ const m_option_type_t m_option_type_int = {
.parse = parse_int,
.print = print_int,
.copy = copy_opt,
+ .add = add_int,
+ .clamp = clamp_int,
};
const m_option_type_t m_option_type_int64 = {
@@ -211,6 +296,8 @@ const m_option_type_t m_option_type_int64 = {
.parse = parse_int64,
.print = print_int,
.copy = copy_opt,
+ .add = add_int64,
+ .clamp = clamp_int64,
};
static int parse_intpair(const struct m_option *opt, struct bstr name,
@@ -256,6 +343,21 @@ const struct m_option_type m_option_type_intpair = {
.copy = copy_opt,
};
+static int clamp_choice(const m_option_t *opt, void *val)
+{
+ int v = *(int *)val;
+ if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) {
+ if (v >= opt->min && v <= opt->max)
+ return 0;
+ }
+ ;
+ for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++) {
+ if (alt->value == v)
+ return 0;
+ }
+ return M_OPT_INVALID;
+}
+
static int parse_choice(const struct m_option *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -303,12 +405,75 @@ static char *print_choice(const m_option_t *opt, const void *val)
abort();
}
+static void choice_get_min_max(const struct m_option *opt, int *min, int *max)
+{
+ assert(opt->type == &m_option_type_choice);
+ *min = INT_MAX;
+ *max = INT_MIN;
+ for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++) {
+ *min = FFMIN(*min, alt->value);
+ *max = FFMAX(*max, alt->value);
+ }
+ if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) {
+ *min = FFMIN(*min, opt->min);
+ *max = FFMAX(*max, opt->max);
+ }
+}
+
+static void check_choice(int dir, int val, bool *found, int *best, int choice)
+{
+ if ((dir == -1 && (!(*found) || choice > (*best)) && choice < val) ||
+ (dir == +1 && (!(*found) || choice < (*best)) && choice > val))
+ {
+ *found = true;
+ *best = choice;
+ }
+}
+
+static void add_choice(const m_option_t *opt, void *val, double add, bool wrap)
+{
+ assert(opt->type == &m_option_type_choice);
+ int dir = add > 0 ? +1 : -1;
+ bool found = false;
+ int ival = *(int *)val;
+ int best = 0; // init. value unused
+
+ if (fabs(add) < 0.5)
+ return;
+
+ if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) {
+ int newval = ival + add;
+ if (ival >= opt->min && ival <= opt->max &&
+ newval >= opt->min && newval <= opt->max)
+ {
+ found = true;
+ best = newval;
+ } else {
+ check_choice(dir, ival, &found, &best, opt->min);
+ check_choice(dir, ival, &found, &best, opt->max);
+ }
+ }
+
+ for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++)
+ check_choice(dir, ival, &found, &best, alt->value);
+
+ if (!found) {
+ int min, max;
+ choice_get_min_max(opt, &min, &max);
+ best = (dir == -1) ^ wrap ? min : max;
+ }
+
+ *(int *)val = best;
+}
+
const struct m_option_type m_option_type_choice = {
.name = "String", // same as arbitrary strings in option list for now
.size = sizeof(int),
.parse = parse_choice,
.print = print_choice,
.copy = copy_opt,
+ .add = add_choice,
+ .clamp = clamp_choice,
};
// Float
@@ -316,6 +481,22 @@ const struct m_option_type m_option_type_choice = {
#undef VAL
#define VAL(x) (*(double *)(x))
+static int clamp_double(const m_option_t *opt, void *val)
+{
+ double v = VAL(val);
+ int r = 0;
+ if ((opt->flags & M_OPT_MAX) && (v > opt->max)) {
+ v = opt->max;
+ r = M_OPT_OUT_OF_RANGE;
+ }
+ if ((opt->flags & M_OPT_MIN) && (v < opt->min)) {
+ v = opt->min;
+ r = M_OPT_OUT_OF_RANGE;
+ }
+ VAL(val) = v;
+ return r;
+}
+
static int parse_double(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -374,22 +555,53 @@ static int parse_double(const m_option_t *opt, struct bstr name,
static char *print_double(const m_option_t *opt, const void *val)
{
- opt = NULL;
return talloc_asprintf(NULL, "%f", VAL(val));
}
+static char *print_double_f2(const m_option_t *opt, const void *val)
+{
+ return talloc_asprintf(NULL, "%.2f", VAL(val));
+}
+
+static void add_double(const m_option_t *opt, void *val, double add, bool wrap)
+{
+ double v = VAL(val);
+
+ v = v + add;
+
+ double min = (opt->flags & M_OPT_MIN) ? opt->min : -INFINITY;
+ double max = (opt->flags & M_OPT_MAX) ? opt->max : +INFINITY;
+
+ if (v < min)
+ v = wrap ? max : min;
+ if (v > max)
+ v = wrap ? min : max;
+
+ VAL(val) = v;
+}
+
const m_option_type_t m_option_type_double = {
// double precision float or ratio (numerator[:/]denominator)
.name = "Double",
.size = sizeof(double),
.parse = parse_double,
.print = print_double,
+ .pretty_print = print_double_f2,
.copy = copy_opt,
+ .clamp = clamp_double,
};
#undef VAL
#define VAL(x) (*(float *)(x))
+static int clamp_float(const m_option_t *opt, void *val)
+{
+ double tmp = VAL(val);
+ int r = clamp_double(opt, &tmp);
+ VAL(val) = tmp;
+ return r;
+}
+
static int parse_float(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -402,53 +614,49 @@ static int parse_float(const m_option_t *opt, struct bstr name,
static char *print_float(const m_option_t *opt, const void *val)
{
- opt = NULL;
return talloc_asprintf(NULL, "%f", VAL(val));
}
-const m_option_type_t m_option_type_float = {
- // floating point number or ratio (numerator[:/]denominator)
- .name = "Float",
- .size = sizeof(float),
- .parse = parse_float,
- .print = print_float,
- .copy = copy_opt,
-};
-
-///////////// Position
-#undef VAL
-#define VAL(x) (*(off_t *)(x))
-
-static int parse_position(const m_option_t *opt, struct bstr name,
- struct bstr param, void *dst)
+static char *print_float_f2(const m_option_t *opt, const void *val)
{
- long long tmp;
- int r = parse_longlong(opt, name, param, &tmp);
- if (r >= 0 && dst)
- *(off_t *)dst = tmp;
- return r;
+ return talloc_asprintf(NULL, "%.2f", VAL(val));
}
-static char *print_position(const m_option_t *opt, const void *val)
+static void add_float(const m_option_t *opt, void *val, double add, bool wrap)
{
- return talloc_asprintf(NULL, "%"PRId64, (int64_t)VAL(val));
+ double tmp = VAL(val);
+ add_double(opt, &tmp, add, wrap);
+ VAL(val) = tmp;
}
-const m_option_type_t m_option_type_position = {
- // Integer (off_t)
- .name = "Position",
- .size = sizeof(off_t),
- .parse = parse_position,
- .print = print_position,
+const m_option_type_t m_option_type_float = {
+ // floating point number or ratio (numerator[:/]denominator)
+ .name = "Float",
+ .size = sizeof(float),
+ .parse = parse_float,
+ .print = print_float,
+ .pretty_print = print_float_f2,
.copy = copy_opt,
+ .add = add_float,
+ .clamp = clamp_float,
};
-
///////////// String
#undef VAL
#define VAL(x) (*(char **)(x))
+static int clamp_str(const m_option_t *opt, void *val)
+{
+ char *v = VAL(val);
+ int len = v ? strlen(v) : 0;
+ if ((opt->flags & M_OPT_MIN) && (len < opt->min))
+ return M_OPT_OUT_OF_RANGE;
+ if ((opt->flags & M_OPT_MAX) && (len > opt->max))
+ return M_OPT_OUT_OF_RANGE;
+ return 0;
+}
+
static int parse_str(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
{
@@ -507,6 +715,7 @@ const m_option_type_t m_option_type_string = {
.print = print_str,
.copy = copy_str,
.free = free_str,
+ .clamp = clamp_str,
};
//////////// String list
@@ -1024,12 +1233,20 @@ static int parse_time(const m_option_t *opt, struct bstr name,
return 1;
}
+static char *pretty_print_time(const m_option_t *opt, const void *val)
+{
+ return mp_format_time(*(double *)val, false);
+}
+
const m_option_type_t m_option_type_time = {
.name = "Time",
.size = sizeof(double),
.parse = parse_time,
.print = print_double,
+ .pretty_print = pretty_print_time,
.copy = copy_opt,
+ .add = add_double,
+ .clamp = clamp_double,
};
diff --git a/m_option.h b/m_option.h
index 2bd9054ac2..94d832eb6d 100644
--- a/m_option.h
+++ b/m_option.h
@@ -43,7 +43,6 @@ extern const m_option_type_t m_option_type_float;
extern const m_option_type_t m_option_type_double;
extern const m_option_type_t m_option_type_string;
extern const m_option_type_t m_option_type_string_list;
-extern const m_option_type_t m_option_type_position;
extern const m_option_type_t m_option_type_time;
extern const m_option_type_t m_option_type_time_size;
extern const m_option_type_t m_option_type_choice;
@@ -167,7 +166,6 @@ struct m_sub_options {
#define CONF_TYPE_PRINT_FUNC (&m_option_type_print_func)
#define CONF_TYPE_SUBCONFIG (&m_option_type_subconfig)
#define CONF_TYPE_STRING_LIST (&m_option_type_string_list)
-#define CONF_TYPE_POSITION (&m_option_type_position)
#define CONF_TYPE_IMGFMT (&m_option_type_imgfmt)
#define CONF_TYPE_AFMT (&m_option_type_afmt)
#define CONF_TYPE_SPAN (&m_option_type_span)
@@ -230,6 +228,11 @@ struct m_option_type {
*/
char *(*print)(const m_option_t *opt, const void *val);
+ // Print the value in a human readable form. Unlike print(), it doesn't
+ // necessarily return the exact value, and is generally not parseable with
+ // parse().
+ char *(*pretty_print)(const m_option_t *opt, const void *val);
+
// Copy data between two locations. Deep copy if the data has pointers.
/** \param opt The option to copy.
* \param dst Pointer to the destination memory.
@@ -243,6 +246,18 @@ struct m_option_type {
* set to NULL.
*/
void (*free)(void *dst);
+
+ // Add the value add to the value in val. For types that are not numeric,
+ // add gives merely the direction. The wrap parameter determines whether
+ // the value is clipped, or wraps around to the opposite max/min.
+ void (*add)(const m_option_t *opt, void *val, double add, bool wrap);
+
+ // Clamp the value in val to the option's valid value range.
+ // Return values:
+ // M_OPT_OUT_OF_RANGE: val was invalid, and modified (clamped) to be valid
+ // M_OPT_INVALID: val was invalid, and can't be made valid
+ // 0: val was already valid and is unchanged
+ int (*clamp)(const m_option_t *opt, void *val);
};
// Option description
@@ -408,12 +423,6 @@ char *m_option_strerror(int code);
*/
const m_option_t *m_option_list_find(const m_option_t *list, const char *name);
-static inline void *m_option_get_ptr(const struct m_option *opt,
- void *optstruct)
-{
- return opt->new ? (char *) optstruct + opt->offset : opt->p;
-}
-
// Helper to parse options, see \ref m_option_type::parse.
static inline int m_option_parse(const m_option_t *opt, struct bstr name,
struct bstr param, void *dst)
@@ -430,6 +439,15 @@ static inline char *m_option_print(const m_option_t *opt, const void *val_ptr)
return NULL;
}
+static inline char *m_option_pretty_print(const m_option_t *opt,
+ const void *val_ptr)
+{
+ if (opt->type->pretty_print)
+ return opt->type->pretty_print(opt, val_ptr);
+ else
+ return m_option_print(opt, val_ptr);
+}
+
// Helper around \ref m_option_type::copy.
static inline void m_option_copy(const m_option_t *opt, void *dst,
const void *src)
@@ -483,12 +501,13 @@ static inline void m_option_free(const m_option_t *opt, void *dst)
#define OPT_SETTINGSLIST(optname, varname, flags, objlist) OPT_GENERAL(optname, varname, flags, .type = &m_option_type_obj_settings_list, .priv = objlist)
#define OPT_AUDIOFORMAT(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_afmt)
#define OPT_HELPER_REMOVEPAREN(...) __VA_ARGS__
+#define M_CHOICES(choices) .priv = (void *)&(const struct m_opt_choice_alternatives[]){OPT_HELPER_REMOVEPAREN choices, {NULL}}
#define OPT_CHOICE(...) OPT_CHOICE_(__VA_ARGS__, .type = &m_option_type_choice)
-#define OPT_CHOICE_(optname, varname, flags, choices, ...) OPT_GENERAL(optname, varname, flags, .priv = (void *)&(const struct m_opt_choice_alternatives[]){OPT_HELPER_REMOVEPAREN choices, {NULL}}, __VA_ARGS__)
+#define OPT_CHOICE_(optname, varname, flags, choices, ...) OPT_GENERAL(optname, varname, flags, M_CHOICES(choices), __VA_ARGS__)
// Union of choices and an int range. The choice values can be included in the
// int range, or be completely separate - both works.
#define OPT_CHOICE_OR_INT(...) OPT_CHOICE_OR_INT_(__VA_ARGS__, .type = &m_option_type_choice)
-#define OPT_CHOICE_OR_INT_(optname, varname, flags, minval, maxval, choices, ...) OPT_GENERAL(optname, varname, (flags) | CONF_RANGE, .min = minval, .max = maxval, .priv = (void *)&(const struct m_opt_choice_alternatives[]){OPT_HELPER_REMOVEPAREN choices, {NULL}}, __VA_ARGS__)
+#define OPT_CHOICE_OR_INT_(optname, varname, flags, minval, maxval, choices, ...) OPT_GENERAL(optname, varname, (flags) | CONF_RANGE, .min = minval, .max = maxval, M_CHOICES(choices), __VA_ARGS__)
#define OPT_TIME(...) OPT_GENERAL(__VA_ARGS__, .type = &m_option_type_time)
#define OPT_TRACKCHOICE(name, var) OPT_CHOICE_OR_INT(name, var, 0, 0, 8190, ({"no", -2}, {"auto", -1}))
diff --git a/m_property.c b/m_property.c
index ac68d86163..f97bb366a4 100644
--- a/m_property.c
+++ b/m_property.c
@@ -25,7 +25,9 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
-#include <unistd.h>
+#include <assert.h>
+
+#include <libavutil/common.h>
#include "talloc.h"
#include "m_option.h"
@@ -33,173 +35,254 @@
#include "mp_msg.h"
#include "mpcommon.h"
+const struct m_option_type m_option_type_dummy = {
+ .name = "Unknown",
+};
+
+struct legacy_prop {
+ const char *old, *new;
+};
+static const struct legacy_prop legacy_props[] = {
+ {"switch_video", "video"},
+ {"switch_audio", "audio"},
+ {"switch_program", "program"},
+ {"framedropping", "framedrop"},
+ {"osdlevel", "osd-level"},
+ {0}
+};
+
+static bool translate_legacy_property(const char *name, char *buffer,
+ size_t buffer_size)
+{
+ if (strlen(name) + 1 > buffer_size)
+ return false;
+
+ const char *old_name = name;
+
+ for (int n = 0; legacy_props[n].new; n++) {
+ if (strcmp(name, legacy_props[n].old) == 0) {
+ name = legacy_props[n].new;
+ break;
+ }
+ }
+
+ snprintf(buffer, buffer_size, "%s", name);
+
+ // Old names used "_" instead of "-"
+ for (int n = 0; buffer[n]; n++) {
+ if (buffer[n] == '_')
+ buffer[n] = '-';
+ }
+
+ if (strcmp(old_name, buffer) != 0) {
+ mp_msg(MSGT_CPLAYER, MSGL_V, "Warning: property '%s' is deprecated, "
+ "replaced with '%s'. Fix your input.conf!\n", old_name, buffer);
+ }
+
+ return true;
+}
+
static int do_action(const m_option_t *prop_list, const char *name,
int action, void *arg, void *ctx)
{
const char *sep;
const m_option_t *prop;
- m_property_action_t ka;
- int r;
if ((sep = strchr(name, '/')) && sep[1]) {
int len = sep - name;
char base[len + 1];
memcpy(base, name, len);
base[len] = 0;
prop = m_option_list_find(prop_list, base);
- ka.key = sep + 1;
- ka.action = action;
- ka.arg = arg;
+ struct m_property_action_arg ka = {
+ .key = sep + 1,
+ .action = action,
+ .arg = arg,
+ };
action = M_PROPERTY_KEY_ACTION;
arg = &ka;
} else
prop = m_option_list_find(prop_list, name);
if (!prop)
return M_PROPERTY_UNKNOWN;
- r = ((m_property_ctrl_f)prop->p)(prop, action, arg, ctx);
- if (action == M_PROPERTY_GET_TYPE && r < 0) {
- if (!arg)
- return M_PROPERTY_ERROR;
- *(const m_option_t **)arg = prop;
+ int (*control)(const m_option_t*, int, void*, void*) = prop->p;
+ int r = control(prop, action, arg, ctx);
+ if (action == M_PROPERTY_GET_TYPE && r < 0 &&
+ prop->type != &m_option_type_dummy)
+ {
+ *(struct m_option *)arg = *prop;
return M_PROPERTY_OK;
}
return r;
}
-int m_property_do(const m_option_t *prop_list, const char *name,
+int m_property_do(const m_option_t *prop_list, const char *in_name,
int action, void *arg, void *ctx)
{
- const m_option_t *opt;
union m_option_value val = {0};
int r;
+ char name[64];
+ if (!translate_legacy_property(in_name, name, sizeof(name)))
+ return M_PROPERTY_UNKNOWN;
+
+ struct m_option opt = {0};
+ r = do_action(prop_list, name, M_PROPERTY_GET_TYPE, &opt, ctx);
+ if (r <= 0)
+ return r;
+ assert(opt.type);
+
switch (action) {
- case M_PROPERTY_PRINT:
+ case M_PROPERTY_PRINT: {
if ((r = do_action(prop_list, name, M_PROPERTY_PRINT, arg, ctx)) >= 0)
return r;
- // fallback on the default print for this type
- case M_PROPERTY_TO_STRING:
- if ((r = do_action(prop_list, name, M_PROPERTY_TO_STRING, arg, ctx)) !=
- M_PROPERTY_NOT_IMPLEMENTED)
- return r;
- // fallback on the options API. Get the type, value and print.
- if ((r =
- do_action(prop_list, name, M_PROPERTY_GET_TYPE, &opt, ctx)) <= 0)
+ // Fallback to m_option
+ if ((r = do_action(prop_list, name, M_PROPERTY_GET, &val, ctx)) <= 0)
return r;
+ char *str = m_option_pretty_print(&opt, &val);
+ m_option_free(&opt, &val);
+ *(char **)arg = str;
+ return str != NULL;
+ }
+ case M_PROPERTY_GET_STRING: {
if ((r = do_action(prop_list, name, M_PROPERTY_GET, &val, ctx)) <= 0)
return r;
- if (!arg)
- return M_PROPERTY_ERROR;
- char *str = m_option_print(opt, &val);
+ char *str = m_option_print(&opt, &val);
+ m_option_free(&opt, &val);
*(char **)arg = str;
return str != NULL;
- case M_PROPERTY_PARSE:
- // try the property own parsing func
- if ((r = do_action(prop_list, name, M_PROPERTY_PARSE, arg, ctx)) !=
+ }
+ case M_PROPERTY_SET_STRING: {
+ // (reject 0 return value: success, but empty string with flag)
+ if (m_option_parse(&opt, bstr0(name), bstr0(arg), &val) <= 0)
+ return M_PROPERTY_ERROR;
+ r = do_action(prop_list, name, M_PROPERTY_SET, &val, ctx);
+ m_option_free(&opt, &val);
+ return r;
+ }
+ case M_PROPERTY_SWITCH: {
+ struct m_property_switch_arg *sarg = arg;
+ if ((r = do_action(prop_list, name, M_PROPERTY_SWITCH, arg, ctx)) !=
M_PROPERTY_NOT_IMPLEMENTED)
return r;
- // fallback on the options API, get the type and parse.
- if ((r =
- do_action(prop_list, name, M_PROPERTY_GET_TYPE, &opt, ctx)) <= 0)
- return r;
- if (!arg)
- return M_PROPERTY_ERROR;
- if ((r = m_option_parse(opt, bstr0(opt->name), bstr0(arg), &val)) <= 0)
+ // Fallback to m_option
+ if (!opt.type->add)
+ return M_PROPERTY_NOT_IMPLEMENTED;
+ if ((r = do_action(prop_list, name, M_PROPERTY_GET, &val, ctx)) <= 0)
return r;
+ opt.type->add(&opt, &val, sarg->inc, sarg->wrap);
r = do_action(prop_list, name, M_PROPERTY_SET, &val, ctx);
- m_option_free(opt, &val);
+ m_option_free(&opt, &val);
return r;
}
- return do_action(prop_list, name, action, arg, ctx);
+ case M_PROPERTY_SET: {
+ if (!opt.type->clamp) {
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, "Property '%s' without clamp().\n",
+ name);
+ } else {
+ m_option_copy(&opt, &val, arg);
+ r = opt.type->clamp(&opt, arg);
+ m_option_free(&opt, &val);
+ if (r != 0) {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR,
+ "Property '%s': invalid value.\n", name);
+ return M_PROPERTY_ERROR;
+ }
+ }
+ return do_action(prop_list, name, M_PROPERTY_SET, arg, ctx);
+ }
+ default:
+ return do_action(prop_list, name, action, arg, ctx);
+ }
}
-char *m_properties_expand_string(const m_option_t *prop_list, char *str,
+static int m_property_do_bstr(const m_option_t *prop_list, bstr name,
+ int action, void *arg, void *ctx)
+{
+ char name0[64];
+ if (name.len >= sizeof(name0))
+ return M_PROPERTY_UNKNOWN;
+ snprintf(name0, sizeof(name0), "%.*s", BSTR_P(name));
+ return m_property_do(prop_list, name0, action, arg, ctx);
+}
+
+static void append_str(char **s, int *len, bstr append)
+{
+ MP_TARRAY_GROW(NULL, *s, *len + append.len);
+ memcpy(*s + *len, append.start, append.len);
+ *len = *len + append.len;
+}
+
+char *m_properties_expand_string(const m_option_t *prop_list, char *str0,
void *ctx)
{
- int l, fr = 0, pos = 0, size = strlen(str) + 512;
- char *p = NULL, *e, *ret = malloc(size), num_val;
- int skip = 0, lvl = 0, skip_lvl = 0;
-
- while (str[0]) {
- if (str[0] == '\\') {
- int sl = 1;
- switch (str[1]) {
- case 'e':
- p = "\x1b", l = 1; break;
- case 'n':
- p = "\n", l = 1; break;
- case 'r':
- p = "\r", l = 1; break;
- case 't':
- p = "\t", l = 1; break;
- case 'x':
- if (str[2]) {
- char num[3] = { str[2], str[3], 0 };
- char *end = num;
- num_val = strtol(num, &end, 16);
- sl = end - num + 1;
- l = 1;
- p = &num_val;
- } else
- l = 0;
- break;
- default:
- p = str + 1, l = 1;
- }
- str += 1 + sl;
- } else if (lvl > 0 && str[0] == ')') {
- if (skip && lvl <= skip_lvl)
- skip = 0;
- lvl--, str++, l = 0;
- } else if (str[0] == '$' && str[1] == '{'
- && (e = strchr(str + 2, '}'))) {
- str += 2;
- int method = M_PROPERTY_PRINT;
- if (str[0] == '=') {
- str += 1;
- method = M_PROPERTY_TO_STRING;
- }
- int pl = e - str;
- char pname[pl + 1];
- memcpy(pname, str, pl);
- pname[pl] = 0;
- if (m_property_do(prop_list, pname, method, &p, ctx) >= 0 && p)
- l = strlen(p), fr = 1;
- else
- l = 0;
- str = e + 1;
- } else if (str[0] == '?' && str[1] == '('
- && (e = strchr(str + 2, ':'))) {
- lvl++;
+ char *ret = NULL;
+ int ret_len = 0;
+ bool skip = false;
+ int level = 0, skip_level = 0;
+ bstr str = bstr0(str0);
+
+ while (str.len) {
+ if (level > 0 && bstr_eatstart0(&str, "}")) {
+ if (skip && level <= skip_level)
+ skip = false;
+ level--;
+ } else if (bstr_startswith0(str, "${") && bstr_find0(str, "}") >= 0) {
+ str = bstr_cut(str, 2);
+ level++;
+
+ // Assume ":" and "}" can't be part of the property name
+ // => if ":" comes before "}", it must be for the fallback
+ int term_pos = bstrcspn(str, ":}");
+ bstr name = bstr_splice(str, 0, term_pos < 0 ? str.len : term_pos);
+ str = bstr_cut(str, term_pos);
+ bool have_fallback = bstr_eatstart0(&str, ":");
+
if (!skip) {
- int is_not = str[2] == '!';
- int pl = e - str - (is_not ? 3 : 2);
- char pname[pl + 1];
- memcpy(pname, str + (is_not ? 3 : 2), pl);
- pname[pl] = 0;
- if (m_property_do(prop_list, pname, M_PROPERTY_GET, NULL, ctx) < 0) {
- if (!is_not)
- skip = 1, skip_lvl = lvl;
- } else if (is_not)
- skip = 1, skip_lvl = lvl;
+ bool cond_yes = bstr_eatstart0(&name, "?");
+ bool cond_no = !cond_yes && bstr_eatstart0(&name, "!");
+ bool raw = bstr_eatstart0(&name, "=");
+ int method = (raw || cond_yes || cond_no)
+ ? M_PROPERTY_GET_STRING : M_PROPERTY_PRINT;
+
+ char *s = NULL;
+ int r = m_property_do_bstr(prop_list, name, method, &s, ctx);
+ if (cond_yes || cond_no) {
+ skip = (!!s != cond_yes);
+ } else {
+ skip = !!s;
+ char *append = s;
+ if (!s && !have_fallback && !raw) {
+ append = r == M_PROPERTY_UNAVAILABLE
+ ? "(unavailable)" : "(error)";
+ }
+ append_str(&ret, &ret_len, bstr0(append));
+ }
+ talloc_free(s);
+ if (skip)
+ skip_level = level;
}
- str = e + 1, l = 0;
- } else
- p = str, l = 1, str++;
+ } else if (level == 0 && bstr_eatstart0(&str, "$>")) {
+ append_str(&ret, &ret_len, str);
+ break;
+ } else {
+ char c;
- if (skip || l <= 0)
- continue;
+ // Other combinations, e.g. "$x", are added verbatim
+ if (bstr_eatstart0(&str, "$$")) {
+ c = '$';
+ } else if (bstr_eatstart0(&str, "$}")) {
+ c = '}';
+ } else {
+ c = str.start[0];
+ str = bstr_cut(str, 1);
+ }
- if (pos + l + 1 > size) {
- size = pos + l + 512;
- ret = realloc(ret, size);
+ if (!skip)
+ MP_TARRAY_APPEND(NULL, ret, ret_len, c);
}
- memcpy(ret + pos, p, l);
- pos += l;
- if (fr)
- talloc_free(p), fr = 0;
}
- ret[pos] = 0;
+ MP_TARRAY_APPEND(NULL, ret, ret_len, '\0');
return ret;
}
@@ -231,193 +314,52 @@ void m_properties_print_help_list(const m_option_t *list)
mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "\nTotal: %d properties\n", count);
}
-// Some generic property implementations
-
int m_property_int_ro(const m_option_t *prop, int action,
void *arg, int var)
{
- switch (action) {
- case M_PROPERTY_GET:
- if (!arg)
- return 0;
+ if (action == M_PROPERTY_GET) {
*(int *)arg = var;
- return 1;
+ return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
-int m_property_int_range(const m_option_t *prop, int action,
- void *arg, int *var)
-{
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return 0;
- M_PROPERTY_CLAMP(prop, *(int *)arg);
- *var = *(int *)arg;
- return 1;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- *var += (arg ? *(int *)arg : 1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- M_PROPERTY_CLAMP(prop, *var);
- return 1;
- }
- return m_property_int_ro(prop, action, arg, *var);
-}
-
-int m_property_choice(const m_option_t *prop, int action,
- void *arg, int *var)
-{
- switch (action) {
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- *var += action == M_PROPERTY_STEP_UP ? 1 : prop->max;
- *var %= (int)prop->max + 1;
- return 1;
- }
- return m_property_int_range(prop, action, arg, var);
-}
-
-int m_property_flag_ro(const m_option_t *prop, int action,
- void *arg, int var)
+int m_property_int64_ro(const struct m_option* prop, int action, void* arg,
+ int64_t var)
{
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return 0;
- *(char **)arg = talloc_strdup(NULL, (var > prop->min) ?
- mp_gtext("enabled") : mp_gtext("disabled"));
- return 1;
- }
- return m_property_int_ro(prop, action, arg, var);
-}
-
-int m_property_flag(const m_option_t *prop, int action,
- void *arg, int *var)
-{
- switch (action) {
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- *var = *var == prop->min ? prop->max : prop->min;
- return 1;
- case M_PROPERTY_PRINT:
- return m_property_flag_ro(prop, action, arg, *var);
+ if (action == M_PROPERTY_GET) {
+ *(int64_t *)arg = var;
+ return M_PROPERTY_OK;
}
- return m_property_int_range(prop, action, arg, var);
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
int m_property_float_ro(const m_option_t *prop, int action,
void *arg, float var)
{
- switch (action) {
- case M_PROPERTY_GET:
- if (!arg)
- return 0;
+ if (action == M_PROPERTY_GET) {
*(float *)arg = var;
- return 1;
- case M_PROPERTY_PRINT:
- if (!arg)
- return 0;
- *(char **)arg = talloc_asprintf(NULL, "%.2f", var);
- return 1;
+ return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
-int m_property_float_range(const m_option_t *prop, int action,
- void *arg, float *var)
-{
- switch (action) {
- case M_PROPERTY_SET:
- if (!arg)
- return 0;
- M_PROPERTY_CLAMP(prop, *(float *)arg);
- *var = *(float *)arg;
- return 1;
- case M_PROPERTY_STEP_UP:
- case M_PROPERTY_STEP_DOWN:
- *var += (arg ? *(float *)arg : 0.1) *
- (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- M_PROPERTY_CLAMP(prop, *var);
- return 1;
- }
- return m_property_float_ro(prop, action, arg, *var);
-}
-
-int m_property_delay(const m_option_t *prop, int action,
- void *arg, float *var)
-{
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return 0;
- *(char **)arg = talloc_asprintf(NULL, "%d ms", ROUND((*var) * 1000));
- return 1;
- default:
- return m_property_float_range(prop, action, arg, var);
- }
-}
-
int m_property_double_ro(const m_option_t *prop, int action,
void *arg, double var)
{
- switch (action) {
- case M_PROPERTY_GET:
- if (!arg)
- return 0;
+ if (action == M_PROPERTY_GET) {
*(double *)arg = var;
- return 1;
- case M_PROPERTY_PRINT:
- if (!arg)
- return 0;
- *(char **)arg = talloc_asprintf(NULL, "%.2f", var);
- return 1;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-int m_property_time_ro(const m_option_t *prop, int action,
- void *arg, double var)
-{
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
- else {
- *(char **)arg = mp_format_time(var, false);
- return M_PROPERTY_OK;
- }
- }
- return m_property_double_ro(prop, action, arg, var);
-}
-
-int m_property_string_ro(const m_option_t *prop, int action, void *arg,
- char *str)
-{
- switch (action) {
- case M_PROPERTY_GET:
- if (!arg)
- return 0;
- *(char **)arg = str;
- return 1;
- case M_PROPERTY_PRINT:
- if (!arg)
- return 0;
- *(char **)arg = talloc_strdup(NULL, str);
- return 1;
+ return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
-int m_property_bitrate(const m_option_t *prop, int action, void *arg, int rate)
+int m_property_strdup_ro(const struct m_option* prop, int action, void* arg,
+ const char *var)
{
- switch (action) {
- case M_PROPERTY_PRINT:
- if (!arg)
- return M_PROPERTY_ERROR;
- *(char **)arg = talloc_asprintf(NULL, "%d kbps", rate * 8 / 1000);
+ if (action == M_PROPERTY_GET) {
+ *(char **)arg = talloc_strdup(NULL, var);
return M_PROPERTY_OK;
}
- return m_property_int_ro(prop, action, arg, rate);
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
diff --git a/m_property.h b/m_property.h
index 0a94b26335..b471b94ecd 100644
--- a/m_property.h
+++ b/m_property.h
@@ -19,209 +19,124 @@
#ifndef MPLAYER_M_PROPERTY_H
#define MPLAYER_M_PROPERTY_H
-#include "m_option.h"
-
-/// \defgroup Properties
-///
-/// Properties provide an interface to query and set the state of various
-/// things in MPlayer. The API is based on the \ref Options API like the
-/// \ref Config, but instead of using variables, properties use an ioctl like
-/// function. The function is used to perform various actions like get and set
-/// (see \ref PropertyActions).
-///@{
-
-/// \file
-
-/// \defgroup PropertyActions Property actions
-/// \ingroup Properties
-///@{
-
-/// Get the current value.
-/** \param arg Pointer to a variable of the right type.
- */
-#define M_PROPERTY_GET 0
-
-/// Get a string representing the current value.
-/** Set the variable to a newly allocated string or NULL.
- * \param arg Pointer to a char* variable.
- */
-#define M_PROPERTY_PRINT 1
-
-/// Set a new value.
-/** The variable is updated to the value actually set.
- * \param arg Pointer to a variable of the right type.
- */
-#define M_PROPERTY_SET 2
-
-/// Set a new value from a string.
-/** \param arg String containing the value.
- */
-#define M_PROPERTY_PARSE 3
-
-/// Increment the current value.
-/** The sign of the argument is also taken into account if applicable.
- * \param arg Pointer to a variable of the right type or NULL.
- */
-#define M_PROPERTY_STEP_UP 4
-
-/// Decrement the current value.
-/** The sign of the argument is also taken into account if applicable.
- * \param arg Pointer to a variable of the right type or NULL.
- */
-#define M_PROPERTY_STEP_DOWN 5
-
-/// Get a string containg a parsable representation.
-/** Set the variable to a newly allocated string or NULL.
- * \param arg Pointer to a char* variable.
- */
-#define M_PROPERTY_TO_STRING 6
-
-/// Pass down an action to a sub-property.
-#define M_PROPERTY_KEY_ACTION 7
-
-/// Get a m_option describing the property.
-#define M_PROPERTY_GET_TYPE 8
-
-///@}
-
-/// \defgroup PropertyActionsArg Property actions argument type
-/// \ingroup Properties
-/// \brief Types used as action argument.
-///@{
-
-/// Argument for \ref M_PROPERTY_KEY_ACTION
-typedef struct {
+#include <stdbool.h>
+#include <stdint.h>
+
+struct m_option;
+
+extern const struct m_option_type m_option_type_dummy;
+
+enum mp_property_action {
+ // Get the property type. This defines the fundamental data type read from
+ // or written to the property.
+ // If unimplemented, the m_option entry that defines the property is used.
+ // arg: m_option*
+ M_PROPERTY_GET_TYPE,
+
+ // Get the current value.
+ // arg: pointer to a variable of the type according to the property type
+ M_PROPERTY_GET,
+
+ // Set a new value. The property wrapper will make sure that only valid
+ // values are set (e.g. according to the property type's min/max range).
+ // If unimplemented, the property is read-only.
+ // arg: pointer to a variable of the type according to the property type
+ M_PROPERTY_SET,
+
+ // Get human readable string representing the current value.
+ // If unimplemented, the property wrapper uses the property type as
+ // fallback.
+ // arg: char**
+ M_PROPERTY_PRINT,
+
+ // Switch the property up/down by a given value.
+ // If unimplemented, the property wrapper uses the property type as
+ // fallback.
+ // arg: struct m_property_switch_arg*
+ M_PROPERTY_SWITCH,
+
+ // Get a string containing a parsable representation.
+ // Can't be overridden by property implementations.
+ // arg: char**
+ M_PROPERTY_GET_STRING,
+
+ // Set a new value from a string. The property wrapper parses this using the
+ // parse function provided by the property type.
+ // Can't be overridden by property implementations.
+ // arg: char*
+ M_PROPERTY_SET_STRING,
+
+ // Pass down an action to a sub-property.
+ // arg: struct m_property_action_arg*
+ M_PROPERTY_KEY_ACTION,
+};
+
+// Argument for M_PROPERTY_SWITCH
+struct m_property_switch_arg {
+ double inc; // value to add to property, or cycle direction
+ bool wrap; // whether value should wrap around on over/underflow
+};
+
+// Argument for M_PROPERTY_KEY_ACTION
+struct m_property_action_arg {
const char* key;
int action;
void* arg;
-} m_property_action_t;
-
-///@}
-
-/// \defgroup PropertyActionsReturn Property actions return code
-/// \ingroup Properties
-/// \brief Return values for the control function.
-///@{
-
-/// Returned on success.
-#define M_PROPERTY_OK 1
+};
-/// Returned on error.
-#define M_PROPERTY_ERROR 0
+enum mp_property_return {
+ // Returned on success.
+ M_PROPERTY_OK = 1,
-/// \brief Returned when the property can't be used, for example something about
-/// the subs while playing audio only
-#define M_PROPERTY_UNAVAILABLE -1
+ // Returned on error.
+ M_PROPERTY_ERROR = 0,
-/// Returned if the requested action is not implemented.
-#define M_PROPERTY_NOT_IMPLEMENTED -2
+ // Returned when the property can't be used, for example video related
+ // properties while playing audio only.
+ M_PROPERTY_UNAVAILABLE = -1,
-/// Returned when asking for a property that doesn't exist.
-#define M_PROPERTY_UNKNOWN -3
+ // Returned if the requested action is not implemented.
+ M_PROPERTY_NOT_IMPLEMENTED = -2,
-/// Returned when the action can't be done (like setting the volume when edl mute).
-#define M_PROPERTY_DISABLED -4
+ // Returned when asking for a property that doesn't exist.
+ M_PROPERTY_UNKNOWN = -3,
+};
-///@}
-
-/// \ingroup Properties
-/// \brief Property action callback.
-typedef int(*m_property_ctrl_f)(const m_option_t* prop,int action,void* arg,void *ctx);
-
-/// Do an action on a property.
-/** \param prop_list The list of properties.
- * \param prop The path of the property.
- * \param action See \ref PropertyActions.
- * \param arg Argument, usually a pointer to the data type used by the property.
- * \return See \ref PropertyActionsReturn.
- */
-int m_property_do(const m_option_t* prop_list, const char* prop,
+// Access a property.
+// action: one of m_property_action
+// ctx: opaque value passed through to property implementation
+// returns: one of mp_property_return
+int m_property_do(const struct m_option* prop_list, const char* property_name,
int action, void* arg, void *ctx);
-/// Print a list of properties.
-void m_properties_print_help_list(const m_option_t* list);
-
-/// Expand a property string.
-/** This function allows to print strings containing property values.
- * ${NAME} is expanded to the value of property NAME or an empty
- * string in case of error. $(NAME:STR) expand STR only if the property
- * NAME is available.
- *
- * \param prop_list An array of \ref m_option describing the available
- * properties.
- * \param str The string to expand.
- * \return The newly allocated expanded string.
- */
-char* m_properties_expand_string(const m_option_t* prop_list,char* str, void *ctx);
-
-// Helpers to use MPlayer's properties
-
-/// Do an action with an MPlayer property.
-int mp_property_do(const char* name,int action, void* val, void *ctx);
-
-/// Get the value of a property as a string suitable for display in an UI.
-char* mp_property_print(const char *name, void* ctx);
-
-/// \defgroup PropertyImplHelper Property implementation helpers
-/// \ingroup Properties
-/// \brief Helper functions for common property types.
-///@{
-
-/// Clamp a value according to \ref m_option::min and \ref m_option::max.
-#define M_PROPERTY_CLAMP(prop,val) do { \
- if(((prop)->flags & M_OPT_MIN) && (val) < (prop)->min) \
- (val) = (prop)->min; \
- else if(((prop)->flags & M_OPT_MAX) && (val) > (prop)->max) \
- (val) = (prop)->max; \
- } while(0)
-
-/// Implement get.
-int m_property_int_ro(const m_option_t* prop,int action,
- void* arg,int var);
-
-/// Implement set, get and step up/down.
-int m_property_int_range(const m_option_t* prop,int action,
- void* arg,int* var);
-
-/// Same as m_property_int_range but cycle.
-int m_property_choice(const m_option_t* prop,int action,
- void* arg,int* var);
-
-int m_property_flag_ro(const m_option_t* prop,int action,
- void* arg,int var);
-
-/// Switch betwen min and max.
-int m_property_flag(const m_option_t* prop,int action,
- void* arg,int* var);
-
-/// Implement get, print.
-int m_property_float_ro(const m_option_t* prop,int action,
- void* arg,float var);
-
-/// Implement set, get and step up/down
-int m_property_float_range(const m_option_t* prop,int action,
- void* arg,float* var);
-
-/// float with a print function which print the time in ms
-int m_property_delay(const m_option_t* prop,int action,
- void* arg,float* var);
-
-/// Implement get, print
-int m_property_double_ro(const m_option_t* prop,int action,
- void* arg,double var);
-
-/// Implement print
-int m_property_time_ro(const m_option_t* prop,int action,
- void* arg,double var);
-
-/// get/print the string
-int m_property_string_ro(const m_option_t* prop,int action,void* arg, char* str);
-
-/// get/print a bitrate
-int m_property_bitrate(const m_option_t* prop,int action,void* arg,int rate);
-
-///@}
-
-///@}
+// Print a list of properties.
+void m_properties_print_help_list(const struct m_option* list);
+
+// Expand a property string.
+// This function allows to print strings containing property values.
+// ${NAME} is expanded to the value of property NAME.
+// If NAME starts with '=', use the raw value of the property.
+// ${NAME:STR} expands to the property, or STR if the property is not
+// available.
+// ${?NAME:STR} expands to STR if the property is available.
+// ${!NAME:STR} expands to STR if the property is not available.
+// General syntax: "${" ["?" | "!"] ["="] NAME ":" STR "}"
+// STR is recursively expanded using the same rules.
+// "$$" can be used to escape "$", and "$}" to escape "}".
+// "$>" disables parsing of "$" for the rest of the string.
+char* m_properties_expand_string(const struct m_option* prop_list, char *str,
+ void *ctx);
+
+// Trivial helpers for implementing properties.
+int m_property_int_ro(const struct m_option* prop, int action, void* arg,
+ int var);
+int m_property_int64_ro(const struct m_option* prop, int action, void* arg,
+ int64_t var);
+int m_property_float_ro(const struct m_option* prop, int action, void* arg,
+ float var);
+int m_property_double_ro(const struct m_option* prop, int action, void* arg,
+ double var);
+int m_property_strdup_ro(const struct m_option* prop, int action, void* arg,
+ const char *var);
#endif /* MPLAYER_M_PROPERTY_H */
diff --git a/metadata.h b/metadata.h
deleted file mode 100644
index 06c3822d81..0000000000
--- a/metadata.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * set of helper routines for stream metadata and properties retrieval
- *
- * Copyright (C) 2006 Benjamin Zores
- *
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_METADATA_H
-#define MPLAYER_METADATA_H
-
-typedef enum metadata_s metadata_t;
-enum metadata_s {
- /* common info */
- META_NAME = 0,
-
- /* video stream properties */
- META_VIDEO_CODEC,
- META_VIDEO_BITRATE,
- META_VIDEO_RESOLUTION,
-
- /* audio stream properties */
- META_AUDIO_CODEC,
- META_AUDIO_BITRATE,
- META_AUDIO_SAMPLES,
-
- /* ID3 tags and other stream infos */
- META_INFO_TITLE,
- META_INFO_ARTIST,
- META_INFO_ALBUM,
- META_INFO_YEAR,
- META_INFO_COMMENT,
- META_INFO_TRACK,
- META_INFO_GENRE
-};
-
-struct MPContext;
-
-char *get_metadata(struct MPContext *mpctx, metadata_t type);
-
-#endif /* MPLAYER_METADATA_H */
diff --git a/mixer.c b/mixer.c
index 8b52145d62..425e0fcd37 100644
--- a/mixer.c
+++ b/mixer.c
@@ -271,6 +271,9 @@ void mixer_reinit(struct mixer *mixer, struct ao *ao)
*/
void mixer_uninit(struct mixer *mixer)
{
+ if (!mixer->ao)
+ return;
+
checkvolume(mixer);
if (mixer->muted_by_us) {
/* Current audio output API combines playing the remaining buffered
diff --git a/mp_core.h b/mp_core.h
index c786663182..99ce12b033 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -77,6 +77,13 @@ struct chapter {
char *name;
};
+enum mp_osd_seek_info {
+ OSD_SEEK_INFO_BAR = 1,
+ OSD_SEEK_INFO_TEXT = 2,
+ OSD_SEEK_INFO_CHAPTER_TEXT = 4,
+ OSD_SEEK_INFO_EDITION = 8,
+};
+
struct track {
enum stream_type type;
// The type specific ID, also called aid (audio), sid (subs), vid (video).
@@ -127,12 +134,13 @@ typedef struct MPContext {
char *terminal_osd_text;
subtitle subs; // subtitle list used when reading subtitles from demuxer
- bool add_osd_seek_info;
+ int add_osd_seek_info; // bitfield of enum mp_osd_seek_info
unsigned int osd_visible;
int osd_function;
struct playlist *playlist;
char *filename; // currently playing file
+ struct mp_resolve_result *resolve_result;
enum stop_play_reason stop_play;
unsigned int initialized_flags; // which subsystems have been initialized
diff --git a/mp_msg.c b/mp_msg.c
index 0a4a786979..627ee04187 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -80,19 +80,19 @@ void mp_msg_init(void){
stdoutAttrs = cinfo.wAttributes;
#endif
int i;
- char *env = getenv("MPLAYER_VERBOSE");
+ char *env = getenv("MPV_VERBOSE");
if (env)
verbose = atoi(env);
for(i=0;i<MSGT_MAX;i++) mp_msg_levels[i] = -2;
mp_msg_cancolor = isatty(fileno(stdout));
mp_msg_levels[MSGT_IDENTIFY] = -1; // no -identify output by default
#ifdef CONFIG_TRANSLATION
- textdomain("mplayer");
- char *localedir = getenv("MPLAYER_LOCALEDIR");
+ textdomain("mpv");
+ char *localedir = getenv("MPV_LOCALEDIR");
if (localedir == NULL && strlen(MPLAYER_LOCALEDIR))
localedir = MPLAYER_LOCALEDIR;
- bindtextdomain("mplayer", localedir);
- bind_textdomain_codeset("mplayer", "UTF-8");
+ bindtextdomain("mpv", localedir);
+ bind_textdomain_codeset("mpv", "UTF-8");
#endif
}
diff --git a/mp_osd.h b/mp_osd.h
index 0e9476a4f8..444b54736c 100644
--- a/mp_osd.h
+++ b/mp_osd.h
@@ -19,7 +19,6 @@
#ifndef MPLAYER_MP_OSD_H
#define MPLAYER_MP_OSD_H
-#define OSD_MSG_TV_CHANNEL 0
#define OSD_MSG_TEXT 1
#define OSD_MSG_SUB_DELAY 2
#define OSD_MSG_SPEED 3
@@ -27,12 +26,14 @@
#define OSD_MSG_BAR 5
#define OSD_MSG_PAUSE 6
#define OSD_MSG_RADIO_CHANNEL 7
+#define OSD_MSG_TV_CHANNEL 8
/// Base id for messages generated from the commmand to property bridge.
#define OSD_MSG_PROPERTY 0x100
#define OSD_MSG_SUB_BASE 0x1000
#define MAX_OSD_LEVEL 3
#define MAX_TERM_OSD_LEVEL 1
+#define OSD_LEVEL_INVISIBLE 4
struct MPContext;
@@ -40,6 +41,5 @@ void set_osd_bar(struct MPContext *mpctx, int type,const char* name,double min,d
void set_osd_msg(struct MPContext *mpctx, int id, int level, int time, const char* fmt, ...);
void set_osd_tmsg(struct MPContext *mpctx, int id, int level, int time, const char* fmt, ...);
void rm_osd_msg(struct MPContext *mpctx, int id);
-void mp_show_osd_progression(struct MPContext *mpctx);
#endif /* MPLAYER_MP_OSD_H */
diff --git a/mpcommon.h b/mpcommon.h
index 472a2e1943..674d9b1554 100644
--- a/mpcommon.h
+++ b/mpcommon.h
@@ -41,7 +41,7 @@
do { \
size_t nextidx_ = (nextidx); \
size_t nelems_ = MP_TALLOC_ELEMS(p); \
- if (nextidx_ <= nelems_) \
+ if (nextidx_ >= nelems_) \
p = talloc_realloc_size((ctx), p, \
(nextidx_ + 1) * sizeof((p)[0]) * 2);\
} while (0)
diff --git a/mplayer.c b/mplayer.c
index ebf911cb54..08ba04a0f5 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -161,7 +161,7 @@ static int max_framesize = 0;
#include "defaultopts.h"
static const char help_text[] = _(
-"Usage: mplayer [options] [url|path/]filename\n"
+"Usage: mpv [options] [url|path/]filename\n"
"\n"
"Basic options: (complete list in the man page)\n"
" --ss=<position> seek to given (seconds or hh:mm:ss) position\n"
@@ -186,7 +186,7 @@ static const char av_desync_help_text[] = _(
" If you have PulseAudio, try --ao=alsa .\n"
"- Slow video output.\n"
" Try a different -vo driver (-vo help for a list) or try -framedrop!\n"
-"- Playing a video file with --vo=gl/gl3 with higher FPS than your monitor.\n"
+"- Playing a video file with --vo=opengl with higher FPS than the monitor.\n"
" This is due to vsync limiting the framerate. Try --no-vsync, or a\n"
" different VO.\n"
"- Playing from a slow network source.\n"
@@ -204,8 +204,8 @@ static const char av_desync_help_text[] = _(
static int drop_frame_cnt; // total number of dropped frames
// seek:
-static off_t seek_to_byte;
-static off_t step_sec;
+static int64_t seek_to_byte;
+static double step_sec;
static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 };
@@ -230,7 +230,6 @@ static int ignore_start = 0;
double force_fps = 0;
static int force_srate = 0;
-int frame_dropping = 0; // option 0=no drop 1= drop vo 2= drop decode
static int play_n_frames = -1;
static int play_n_frames_mf = -1;
@@ -247,8 +246,6 @@ int use_filedir_conf;
#include "mpcommon.h"
#include "command.h"
-#include "metadata.h"
-
static void reset_subtitles(struct MPContext *mpctx);
static void reinit_subs(struct MPContext *mpctx);
@@ -260,129 +257,6 @@ static float get_relative_time(struct MPContext *mpctx)
return delta * 0.000001;
}
-static int is_valid_metadata_type(struct MPContext *mpctx, metadata_t type)
-{
- switch (type) {
- /* check for valid video stream */
- case META_VIDEO_CODEC:
- case META_VIDEO_BITRATE:
- case META_VIDEO_RESOLUTION:
- if (!mpctx->sh_video)
- return 0;
- break;
-
- /* check for valid audio stream */
- case META_AUDIO_CODEC:
- case META_AUDIO_BITRATE:
- case META_AUDIO_SAMPLES:
- if (!mpctx->sh_audio)
- return 0;
- break;
-
- /* check for valid demuxer */
- case META_INFO_TITLE:
- case META_INFO_ARTIST:
- case META_INFO_ALBUM:
- case META_INFO_YEAR:
- case META_INFO_COMMENT:
- case META_INFO_TRACK:
- case META_INFO_GENRE:
- if (!mpctx->master_demuxer)
- return 0;
- break;
-
- default:
- break;
- }
-
- return 1;
-}
-
-static char *get_demuxer_info(struct MPContext *mpctx, char *tag)
-{
- char **info = mpctx->master_demuxer->info;
- int n;
-
- if (!info || !tag)
- return talloc_strdup(NULL, "");
-
- for (n = 0; info[2 * n] != NULL; n++)
- if (!strcasecmp(info[2 * n], tag))
- break;
-
- return talloc_strdup(NULL, info[2 * n + 1] ? info[2 * n + 1] : "");
-}
-
-char *get_metadata(struct MPContext *mpctx, metadata_t type)
-{
- sh_audio_t * const sh_audio = mpctx->sh_audio;
- sh_video_t * const sh_video = mpctx->sh_video;
-
- if (!is_valid_metadata_type(mpctx, type))
- return NULL;
-
- switch (type) {
- case META_NAME:
- return talloc_strdup(NULL, mp_basename(mpctx->filename));
- case META_VIDEO_CODEC:
- if (sh_video->format == 0x10000001)
- return talloc_strdup(NULL, "mpeg1");
- else if (sh_video->format == 0x10000002)
- return talloc_strdup(NULL, "mpeg2");
- else if (sh_video->format == 0x10000004)
- return talloc_strdup(NULL, "mpeg4");
- else if (sh_video->format == 0x10000005)
- return talloc_strdup(NULL, "h264");
- else if (sh_video->format >= 0x20202020)
- return talloc_asprintf(NULL, "%.4s", (char *) &sh_video->format);
- else
- return talloc_asprintf(NULL, "0x%08X", sh_video->format);
- case META_VIDEO_BITRATE:
- return talloc_asprintf(NULL, "%d kbps",
- (int) (sh_video->i_bps * 8 / 1024));
- case META_VIDEO_RESOLUTION:
- return talloc_asprintf(NULL, "%d x %d", sh_video->disp_w,
- sh_video->disp_h);
- case META_AUDIO_CODEC:
- if (sh_audio->codec && sh_audio->codec->name)
- return talloc_strdup(NULL, sh_audio->codec->name);
- return talloc_strdup(NULL, "");
- case META_AUDIO_BITRATE:
- return talloc_asprintf(NULL, "%d kbps",
- (int) (sh_audio->i_bps * 8 / 1000));
- case META_AUDIO_SAMPLES:
- return talloc_asprintf(NULL, "%d Hz, %d ch.", sh_audio->samplerate,
- sh_audio->channels);
-
- /* check for valid demuxer */
- case META_INFO_TITLE:
- return get_demuxer_info(mpctx, "Title");
-
- case META_INFO_ARTIST:
- return get_demuxer_info(mpctx, "Artist");
-
- case META_INFO_ALBUM:
- return get_demuxer_info(mpctx, "Album");
-
- case META_INFO_YEAR:
- return get_demuxer_info(mpctx, "Year");
-
- case META_INFO_COMMENT:
- return get_demuxer_info(mpctx, "Comment");
-
- case META_INFO_TRACK:
- return get_demuxer_info(mpctx, "Track");
-
- case META_INFO_GENRE:
- return get_demuxer_info(mpctx, "Genre");
-
- default:
- break;
- }
-
- return talloc_strdup(NULL, "");
-}
-
static void print_stream(struct MPContext *mpctx, struct track *t, int id)
{
struct sh_stream *s = t->stream;
@@ -692,10 +566,10 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
if (mask & INITIALIZED_AO) {
mpctx->initialized_flags &= ~INITIALIZED_AO;
- if (mpctx->ao) {
+ if (mpctx->mixer.ao)
mixer_uninit(&mpctx->mixer);
+ if (mpctx->ao)
ao_uninit(mpctx->ao, mpctx->stop_play != AT_END_OF_FILE);
- }
mpctx->ao = NULL;
mpctx->mixer.ao = NULL;
}
@@ -772,7 +646,7 @@ static bool parse_cfgfiles(struct MPContext *mpctx, m_config_t *conf)
char *conffile;
int conffile_fd;
if (!(opts->noconfig & 2) &&
- m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mplayer.conf") < 0)
+ m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mpv.conf") < 0)
return false;
if ((conffile = get_path("")) == NULL)
mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Cannot find HOME directory.\n");
@@ -891,7 +765,7 @@ static void load_per_file_config(m_config_t *conf, const char * const file)
if (use_filedir_conf) {
char dircfg[MP_PATH_MAX];
strcpy(dircfg, cfg);
- strcpy(dircfg + (name - cfg), "mplayer.conf");
+ strcpy(dircfg + (name - cfg), "mpv.conf");
try_load_config(conf, dircfg);
if (try_load_config(conf, cfg))
@@ -1124,7 +998,7 @@ void init_vo_spudec(struct MPContext *mpctx)
if (vo_spudec != NULL) {
mpctx->initialized_flags |= INITIALIZED_SPUDEC;
- mp_property_do("sub_forced_only", M_PROPERTY_SET, &forced_subs_only,
+ mp_property_do("sub-forced-only", M_PROPERTY_SET, &forced_subs_only,
mpctx);
}
}
@@ -1164,6 +1038,30 @@ static void sadd_percentage(char *buf, int len, int percent) {
saddf(buf, len, " (%d%%)", percent);
}
+static int get_term_width(void)
+{
+ get_screen_size();
+ int width = screen_width > 0 ? screen_width : 80;
+#if defined(__MINGW32__) || defined(__CYGWIN__)
+ /* Windows command line is broken (MinGW's rxvt works, but we
+ * should not depend on that). */
+ width--;
+#endif
+ return width;
+}
+
+static void write_status_line(struct MPContext *mpctx, const char *line)
+{
+ if (erase_to_end_of_line) {
+ mp_msg(MSGT_STATUSLINE, MSGL_STATUS,
+ "%s%s\r", line, erase_to_end_of_line);
+ } else {
+ int pos = strlen(line);
+ int width = get_term_width() - pos;
+ mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "%s%*s\r", line, width, "");
+ }
+}
+
static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
{
struct MPOpts *opts = &mpctx->opts;
@@ -1187,19 +1085,16 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
if (opts->quiet)
return;
- int width;
- char *line;
- get_screen_size();
- if (screen_width > 0)
- width = screen_width;
- else
- width = 80;
-#if defined(__MINGW32__) || defined(__CYGWIN__)
- /* Windows command line is broken (MinGW's rxvt works, but we
- * should not depend on that). */
- width--;
-#endif
- line = malloc(width + 1); // one additional char for the terminating null
+ if (opts->status_msg) {
+ char *r = mp_property_expand_string(mpctx, opts->status_msg);
+ write_status_line(mpctx, r);
+ talloc_free(r);
+ return;
+ }
+
+ // one additional char for the terminating null
+ int width = get_term_width() + 1;
+ char *line = malloc(width);
line[0] = '\0';
// Playback status
@@ -1278,15 +1173,7 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
#endif
// end
- if (erase_to_end_of_line) {
- mp_msg(MSGT_STATUSLINE, MSGL_STATUS,
- "%s%s\r", line, erase_to_end_of_line);
- } else {
- int pos = strlen(line);
- memset(&line[pos], ' ', width - pos);
- line[width] = 0;
- mp_msg(MSGT_STATUSLINE, MSGL_STATUS, "%s\r", line);
- }
+ write_status_line(mpctx, line);
free(line);
}
@@ -1361,6 +1248,8 @@ static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int id, int level,
static void set_osd_msg_va(struct MPContext *mpctx, int id, int level, int time,
const char *fmt, va_list ap)
{
+ if (level == OSD_LEVEL_INVISIBLE)
+ return;
mp_osd_msg_t *msg = add_osd_msg(mpctx, id, level, time);
msg->msg = talloc_vasprintf(msg, fmt, ap);
}
@@ -1545,6 +1434,35 @@ static void sadd_osd_status(char *buffer, int len, struct MPContext *mpctx,
}
}
+// OSD messages initated by seeking commands are added lazily with this
+// function, because multiple successive seek commands can be coalesced.
+static void add_seek_osd_messages(struct MPContext *mpctx)
+{
+ if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_BAR)
+ set_osd_bar(mpctx, 0, "Position", 0, 100, get_percent_pos(mpctx));
+ if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_TEXT) {
+ mp_osd_msg_t *msg = add_osd_msg(mpctx, OSD_MSG_TEXT, 1,
+ mpctx->opts.osd_duration);
+ msg->show_position = true;
+ }
+ if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CHAPTER_TEXT) {
+ char *chapter = chapter_display_name(mpctx, get_current_chapter(mpctx));
+ set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts.osd_duration,
+ "Chapter: %s", chapter);
+ talloc_free(chapter);
+ }
+ assert(mpctx->master_demuxer);
+ if ((mpctx->add_osd_seek_info & OSD_SEEK_INFO_EDITION)
+ && mpctx->master_demuxer)
+ {
+ set_osd_tmsg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts.osd_duration,
+ "Playing edition %d of %d.",
+ mpctx->master_demuxer->edition + 1,
+ mpctx->master_demuxer->num_editions);
+ }
+ mpctx->add_osd_seek_info = 0;
+}
+
/**
* \brief Update the OSD message line.
*
@@ -1559,10 +1477,7 @@ static void update_osd_msg(struct MPContext *mpctx)
struct MPOpts *opts = &mpctx->opts;
struct osd_state *osd = mpctx->osd;
- if (mpctx->add_osd_seek_info) {
- set_osd_bar(mpctx, 0, "Position", 0, 100, get_percent_pos(mpctx));
- mpctx->add_osd_seek_info = false;
- }
+ add_seek_osd_messages(mpctx);
// Look if we have a msg
mp_osd_msg_t *msg = get_osd_msg(mpctx);
@@ -1603,15 +1518,6 @@ static void update_osd_msg(struct MPContext *mpctx)
}
}
-void mp_show_osd_progression(struct MPContext *mpctx)
-{
- mp_osd_msg_t *msg = add_osd_msg(mpctx, OSD_MSG_TEXT, 1,
- mpctx->opts.osd_duration);
- msg->show_position = true;
-
- set_osd_bar(mpctx, 0, "Position", 0, 100, get_percent_pos(mpctx));
-}
-
void reinit_audio_chain(struct MPContext *mpctx)
{
struct MPOpts *opts = &mpctx->opts;
@@ -1920,7 +1826,7 @@ static int check_framedrop(struct MPContext *mpctx, double frame_time)
&& !mpctx->restart_playback) {
++drop_frame_cnt;
++dropped_frames;
- return frame_dropping;
+ return mpctx->opts.frame_dropping;
} else
dropped_frames = 0;
}
@@ -2296,10 +2202,9 @@ static void vo_update_window_title(struct MPContext *mpctx)
{
if (!mpctx->video_out)
return;
- char *title = property_expand_string(mpctx, mpctx->opts.vo_wintitle);
+ char *title = mp_property_expand_string(mpctx, mpctx->opts.vo_wintitle);
talloc_free(mpctx->video_out->window_title);
- mpctx->video_out->window_title = talloc_strdup(mpctx->video_out, title);
- free(title);
+ mpctx->video_out->window_title = talloc_steal(mpctx, title);
}
int reinit_video_chain(struct MPContext *mpctx)
@@ -3602,7 +3507,7 @@ static void open_vobsubs_from_options(struct MPContext *mpctx)
mpctx->initialized_flags |= INITIALIZED_VOBSUB;
// TODO: let frontend do the selection
vobsub_set_from_lang(vo_vobsub, mpctx->opts.sub_lang);
- mp_property_do("sub_forced_only", M_PROPERTY_SET, &forced_subs_only,
+ mp_property_do("sub-forced-only", M_PROPERTY_SET, &forced_subs_only,
mpctx);
for (int i = 0; i < vobsub_get_indexes_count(vo_vobsub); i++) {
@@ -3760,6 +3665,16 @@ static void add_subtitle_fonts_from_sources(struct MPContext *mpctx)
#endif
}
+static struct mp_resolve_result *resolve_url(const char *filename,
+ struct MPOpts *opts)
+{
+#ifdef CONFIG_LIBQUVI
+ return mp_resolve_quvi(filename, opts);
+#else
+ return NULL;
+#endif
+}
+
// Waiting for the slave master to send us a new file to play.
static void idle_loop(struct MPContext *mpctx)
{
@@ -3783,8 +3698,9 @@ static void play_current_file(struct MPContext *mpctx)
struct MPOpts *opts = &mpctx->opts;
mpctx->stop_play = 0;
-
mpctx->filename = NULL;
+ mpctx->file_format = DEMUXER_TYPE_UNKNOWN;
+
if (mpctx->playlist->current)
mpctx->filename = mpctx->playlist->current->filename;
@@ -3795,6 +3711,8 @@ static void play_current_file(struct MPContext *mpctx)
encode_lavc_discontinuity(mpctx->encode_lavc_ctx);
#endif
+ mpctx->add_osd_seek_info &= OSD_SEEK_INFO_EDITION;
+
m_config_enter_file_local(mpctx->mconfig);
load_per_protocol_config(mpctx->mconfig, mpctx->filename);
@@ -3825,7 +3743,8 @@ static void play_current_file(struct MPContext *mpctx)
}
#ifdef CONFIG_ASS
- ass_set_style_overrides(mpctx->ass_library, opts->ass_force_style_list);
+ if (opts->ass_style_override)
+ ass_set_style_overrides(mpctx->ass_library, opts->ass_force_style_list);
#endif
if (mpctx->video_out && mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_RESUME, NULL);
@@ -3850,7 +3769,11 @@ static void play_current_file(struct MPContext *mpctx)
assert(mpctx->sh_video == NULL);
assert(mpctx->sh_sub == NULL);
- mpctx->stream = open_stream(mpctx->filename, opts, &mpctx->file_format);
+ char *stream_filename = mpctx->filename;
+ mpctx->resolve_result = resolve_url(stream_filename, opts);
+ if (mpctx->resolve_result)
+ stream_filename = mpctx->resolve_result->url;
+ mpctx->stream = open_stream(stream_filename, opts, &mpctx->file_format);
if (!mpctx->stream) { // error...
libmpdemux_was_interrupted(mpctx);
goto terminate_playback;
@@ -3860,7 +3783,7 @@ static void play_current_file(struct MPContext *mpctx)
if (mpctx->file_format == DEMUXER_TYPE_PLAYLIST) {
mp_msg(MSGT_CPLAYER, MSGL_ERR, "\nThis looks like a playlist, but "
"playlist support will not be used automatically.\n"
- "MPlayer's playlist code is unsafe and should only be used with "
+ "mpv's playlist code is unsafe and should only be used with "
"trusted sources.\nPlayback will probably fail.\n\n");
#if 0
// Handle playlist
@@ -3958,6 +3881,13 @@ goto_enable_cache:
preselect_demux_streams(mpctx);
+#ifdef CONFIG_ENCODING
+ if (mpctx->encode_lavc_ctx && mpctx->current_track[STREAM_VIDEO])
+ encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_VIDEO);
+ if (mpctx->encode_lavc_ctx && mpctx->current_track[STREAM_AUDIO])
+ encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_AUDIO);
+#endif
+
reinit_video_chain(mpctx);
reinit_audio_chain(mpctx);
reinit_subs(mpctx);
@@ -3985,17 +3915,10 @@ goto_enable_cache:
goto terminate_playback;
}
-#ifdef CONFIG_ENCODING
- if (mpctx->encode_lavc_ctx && mpctx->sh_video)
- encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_VIDEO);
- if (mpctx->encode_lavc_ctx && mpctx->sh_audio)
- encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_AUDIO);
-#endif
-
if (opts->playing_msg) {
- char *msg = property_expand_string(mpctx, opts->playing_msg);
+ char *msg = mp_property_expand_string(mpctx, opts->playing_msg);
mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s", msg);
- free(msg);
+ talloc_free(msg);
}
// Disable the term OSD in verbose mode
@@ -4076,7 +3999,7 @@ goto_enable_cache:
if (end_at.type == END_AT_SIZE) {
mp_tmsg(MSGT_CPLAYER, MSGL_WARN,
- "Option -endpos in MPlayer does not yet support size units.\n");
+ "Option -endpos in mpv does not yet support size units.\n");
end_at.type = END_AT_NONE;
}
@@ -4121,6 +4044,9 @@ terminate_playback: // don't jump here after ao/vo/getch initialization!
uninit_player(mpctx, uninitialize_parts);
mpctx->filename = NULL;
+ mpctx->file_format = DEMUXER_TYPE_UNKNOWN;
+ talloc_free(mpctx->resolve_result);
+ mpctx->resolve_result = NULL;
vo_sub = NULL;
#ifdef CONFIG_ASS
@@ -4173,7 +4099,7 @@ static void play_files(struct MPContext *mpctx)
static void print_version(int always)
{
mp_msg(MSGT_CPLAYER, always ? MSGL_INFO : MSGL_V,
- "%s (C) 2000-2012\n", mplayer_version);
+ "%s (C) 2000-2012 mpv/MPlayer/mplayer2 projects\n", mplayer_version);
}
static bool handle_help_options(struct MPContext *mpctx)
@@ -4272,7 +4198,7 @@ static void detach_ptw32(void)
static void osdep_preinit(int *p_argc, char ***p_argv)
{
- char *enable_talloc = getenv("MPLAYER_LEAK_REPORT");
+ char *enable_talloc = getenv("MPV_LEAK_REPORT");
if (*p_argc > 1 && (strcmp((*p_argv)[1], "-leak-report") == 0
|| strcmp((*p_argv)[1], "--leak-report") == 0))
enable_talloc = "1";
diff --git a/mplayer.h b/mplayer.h
index d1618bf929..1e99308656 100644
--- a/mplayer.h
+++ b/mplayer.h
@@ -31,15 +31,19 @@ extern float audio_delay;
extern double force_fps;
-extern int frame_dropping;
-
-extern int auto_quality;
-
extern int vobsub_id;
struct MPContext;
+struct MPOpts;
struct subtitle;
void set_osd_subtitle(struct MPContext *mpctx, struct subtitle *subs);
+struct mp_resolve_result {
+ char *url;
+ char *title;
+};
+
+struct mp_resolve_result *mp_resolve_quvi(const char *url, struct MPOpts *opts);
+
#endif /* MPLAYER_MPLAYER_H */
diff --git a/options.h b/options.h
index 6438f0e97b..d2404bb85a 100644
--- a/options.h
+++ b/options.h
@@ -41,7 +41,6 @@ typedef struct MPOpts {
int osd_duration;
int osd_fractions;
char *vobsub_name;
- int auto_quality;
int untimed;
int loop_times;
int ordered_chapters;
@@ -61,9 +60,11 @@ typedef struct MPOpts {
float hr_seek_demuxer_offset;
int autosync;
int softsleep;
+ int frame_dropping;
int term_osd;
char *term_osd_esc;
char *playing_msg;
+ char *status_msg;
int player_idle_mode;
int consolecontrols;
int doubleclick_time;
@@ -115,6 +116,7 @@ typedef struct MPOpts {
char *ass_color;
char *ass_border_color;
char *ass_styles_file;
+ int ass_style_override;
int ass_hinting;
struct lavc_param {
int workaround_bugs;
@@ -158,6 +160,7 @@ typedef struct MPOpts {
int use_lircc;
int use_ar; // apple remote
int default_bindings;
+ int test;
} input;
struct encode_output_conf {
@@ -176,6 +179,8 @@ typedef struct MPOpts {
int rawts;
int autofps;
int neverdrop;
+ int video_first;
+ int audio_first;
} encode_output;
} MPOpts;
diff --git a/osdep/cocoa_events.m b/osdep/cocoa_events.m
index ba09c13cad..e6d941d19b 100644
--- a/osdep/cocoa_events.m
+++ b/osdep/cocoa_events.m
@@ -106,7 +106,7 @@ void cocoa_events_init(struct input_ctx *ictx,
*p = (struct priv){
.is_runloop_polling = NO,
.read_all_fd_events = read_all_fd_events,
- .select_queue = dispatch_queue_create("org.mplayer2.select_queue",
+ .select_queue = dispatch_queue_create("org.mpv.select_queue",
NULL),
};
}
diff --git a/osdep/io.h b/osdep/io.h
index 4383d61143..b69643f0e1 100644
--- a/osdep/io.h
+++ b/osdep/io.h
@@ -28,6 +28,10 @@ wchar_t *mp_from_utf8(void *talloc_ctx, const char *s);
char *mp_to_utf8(void *talloc_ctx, const wchar_t *s);
#endif
+#ifdef __CYGWIN__
+#include <io.h>
+#endif
+
#ifdef __MINGW32__
#include <stdio.h>
diff --git a/osdep/macosx_finder_args.m b/osdep/macosx_finder_args.m
index 56d314c100..a3eae773fd 100644
--- a/osdep/macosx_finder_args.m
+++ b/osdep/macosx_finder_args.m
@@ -81,7 +81,7 @@ bool macosx_finder_args(m_config_t *config, struct playlist *pl_files,
int argc, char **argv)
{
if (argc==1 && psn_matches_current_process(argv[0])) {
- macosx_redirect_output_to_logfile("mplayer2");
+ macosx_redirect_output_to_logfile("mpv");
m_config_set_option0(config, "quiet", NULL);
macosx_wait_fileopen_events();
}
diff --git a/osdep/mplayer.exe.manifest b/osdep/mplayer.exe.manifest
index 7a0102dc3f..c924377c4b 100644
--- a/osdep/mplayer.exe.manifest
+++ b/osdep/mplayer.exe.manifest
@@ -3,10 +3,10 @@
<assemblyIdentity
version="0.0.9.0"
processorArchitecture="*"
- name="MPlayer - The Movie Player"
+ name="mpv - The Movie Player"
type="win32"
/>
- <description>MPlayer - The Movie Player</description>
+ <description>mpv - The Movie Player</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
diff --git a/osdep/mplayer.rc b/osdep/mplayer.rc
index fe70aa871f..ec04346f9d 100644
--- a/osdep/mplayer.rc
+++ b/osdep/mplayer.rc
@@ -31,14 +31,14 @@ FILETYPE VFT_APP
{
BLOCK "000004b0" // LANG_NEUTRAL,UNICODE_CP
{
- VALUE "Comments","mplayer2 is distributed under the terms of the GNU General Public License Version 3. Source code is available at http://www.mplayer2.org\000"
+ VALUE "Comments","mpv is distributed under the terms of the GNU General Public License Version 3.\000"
VALUE "CompanyName", "\000"
- VALUE "FileDescription", "mplayer2 - Movie Player\000"
+ VALUE "FileDescription", "mpv - Movie Player\000"
VALUE "FileVersion",VERSION
- VALUE "LegalCopyright", " (C) 2000-2012 MPlayer Team\000"
+ VALUE "LegalCopyright", " (C) 2000-2012 MPlayer Team and others\000"
//VALUE "LegalTrademarks"," \000";
- VALUE "OriginalFilename", "mplayer.exe\000"
- VALUE "ProductName", "mplayer2 - The Movie Player\000"
+ VALUE "OriginalFilename", "mpv.exe\000"
+ VALUE "ProductName", "mpv - The Movie Player\000"
VALUE "ProductVersion",VERSION
//VALUE "SpecialBuild","\000"
}
@@ -52,4 +52,4 @@ FILETYPE VFT_APP
IDI_ICON1 ICON DISCARDABLE "etc/mplayer.ico"
// for some reason RT_MANIFEST does not work
-1 24 "mplayer.exe.manifest"
+1 24 "mpv.exe.manifest"
diff --git a/path.c b/path.c
index e8e7ebd4c9..6002189225 100644
--- a/path.c
+++ b/path.c
@@ -52,9 +52,9 @@ char *get_path(const char *filename){
char *homedir;
char *buff;
#ifdef __MINGW32__
- static char *config_dir = "/mplayer";
+ static char *config_dir = "/mpv";
#else
- static char *config_dir = "/.mplayer";
+ static char *config_dir = "/.mpv";
#endif
#if defined(__MINGW32__) || defined(__CYGWIN__)
char exedir[260];
@@ -69,7 +69,7 @@ char *get_path(const char *filename){
char *bdl_url_path = NULL;
#endif
- if ((homedir = getenv("MPLAYER_HOME")) != NULL)
+ if ((homedir = getenv("MPV_HOME")) != NULL)
config_dir = "";
else if ((homedir = getenv("HOME")) == NULL)
#if defined(__MINGW32__) || defined(__CYGWIN__)
diff --git a/stream/open.c b/quvi.c
index 91e9ae2956..7be5f39bea 100644
--- a/stream/open.c
+++ b/quvi.c
@@ -1,60 +1,33 @@
/*
- * This file is part of MPlayer.
+ * This file is part of mpv.
*
- * MPlayer is free software; you can redistribute it and/or modify
+ * mpv is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * MPlayer is distributed in the hope that it will be useful,
+ * mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * with mpv; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
+#include <quvi/quvi.h>
-#include "config.h"
-#include "mp_msg.h"
#include "talloc.h"
-
-#ifdef __FreeBSD__
-#include <sys/cdrio.h>
-#endif
-
-#include "m_option.h"
+#include "mp_msg.h"
#include "options.h"
-#include "stream.h"
-#include "libmpdemux/demuxer.h"
-
-
-/// We keep these 2 for the gui atm, but they will be removed.
-int vcd_track=0;
-char* cdrom_device=NULL;
-char* dvd_device=NULL;
-int dvd_title=0;
+#include "mplayer.h"
-#ifdef CONFIG_LIBQUVI
-
-#include <quvi/quvi.h>
-
-static const char *resolve_quvi(const char *url, struct MPOpts *opts)
+struct mp_resolve_result *mp_resolve_quvi(const char *url, struct MPOpts *opts)
{
- char *media_title, *media_url;
- quvi_media_t m;
QUVIcode rc;
- quvi_t q;
+ quvi_t q;
rc = quvi_init(&q);
if (rc != QUVI_OK)
return NULL;
@@ -79,6 +52,7 @@ static const char *resolve_quvi(const char *url, struct MPOpts *opts)
quvi_setopt(q, QUVIOPT_FORMAT, opts->quvi_format
? opts->quvi_format : "best");
+ quvi_media_t m;
rc = quvi_parse(q, (char *)url, &m);
if (rc != QUVI_OK) {
mp_msg(MSGT_OPEN, MSGL_ERR, "[quvi] %s\n", quvi_strerror(q, rc));
@@ -86,47 +60,24 @@ static const char *resolve_quvi(const char *url, struct MPOpts *opts)
return NULL;
}
- quvi_getprop(m, QUVIPROP_PAGETITLE, &media_title);
- quvi_getprop(m, QUVIPROP_MEDIAURL, &media_url);
+ struct mp_resolve_result *result
+ = talloc_zero(NULL, struct mp_resolve_result);
- mp_msg(MSGT_OPEN, MSGL_INFO, "[quvi] Site media title: '%s'\n",
- media_title);
- media_url = talloc_strdup(NULL, media_url);
+ char *val;
- quvi_parse_close(&m);
- quvi_close(&q);
+ if (quvi_getprop(m, QUVIPROP_MEDIAURL, &val) == QUVI_OK)
+ result->url = talloc_strdup(result, val);
- return media_url;
-}
-#endif
-
-// Open a new stream (stdin/file/vcd/url)
-
-stream_t* open_stream(const char *filename, struct MPOpts *options,
- int *file_format)
-{
- if (!file_format)
- file_format = &(int){DEMUXER_TYPE_UNKNOWN};
- // Check if playlist or unknown
- if (*file_format != DEMUXER_TYPE_PLAYLIST){
- *file_format=DEMUXER_TYPE_UNKNOWN;
- }
+ if (quvi_getprop(m, QUVIPROP_PAGETITLE, &val) == QUVI_OK)
+ result->title = talloc_strdup(result, val);
-if(!filename) {
- mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
- return NULL;
-}
-
- const char *resolved = NULL;
-
-#ifdef CONFIG_LIBQUVI
- resolved = resolve_quvi(filename, options);
-#endif
+ quvi_parse_close(&m);
+ quvi_close(&q);
- if (resolved)
- filename = resolved;
+ if (!result->url) {
+ talloc_free(result);
+ result = NULL;
+ }
- stream_t *res = open_stream_full(filename,STREAM_READ,options,file_format);
- talloc_free((void *)resolved);
- return res;
+ return result;
}
diff --git a/rpm/mplayer-codecs.spec b/rpm/mplayer-codecs.spec
deleted file mode 100644
index 486882cd83..0000000000
--- a/rpm/mplayer-codecs.spec
+++ /dev/null
@@ -1,318 +0,0 @@
-%define _codecsdir %{_libdir}/codecs
-
-# don't try to strip or compress anything
-%define __spec_install_post %{nil}
-%define debug_package %{nil}
-
-%define i386_ver 20100303
-%define ppc_ver 20061022
-%define alpha_ver 20061028
-%define x86_64_ver 20071007
-
-%define ver %{expand:%{%{_target_cpu}_ver}}
-
-Summary: MPlayer essential binary codecs package
-Name: mplayer-codecs
-Version: %{ver}
-Release: 1
-URL: http://www.mplayerhq.hu/MPlayer/releases/codecs/
-Group: Applications/Multimedia
-Source0: http://www.mplayerhq.hu/MPlayer/releases/codecs/all-%{i386_ver}.tar.bz2
-Source1: http://www.mplayerhq.hu/MPlayer/releases/codecs/all-alpha-%{alpha_ver}.tar.bz2
-Source2: http://www.mplayerhq.hu/MPlayer/releases/codecs/all-ppc-%{ppc_ver}.tar.bz2
-Source3: http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-%{x86_64_ver}.tar.bz2
-License: Unknown
-ExclusiveArch: i386 ppc alpha x86_64
-%ifarch i386
-Provides: w32codec = %{version}-%{release}
-%endif
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
-
-%description
-All-in-one essential end-user package. Contains binary codecs that have
-no native open-source decoder currently.
-
-%package extra
-Group: Applications/Multimedia
-Summary: MPlayer optional binary codecs package
-
-%description extra
-MPlayer optional codecs package. Contains additional binary codecs
-supported by MPlayer.
-
-%prep
-%ifarch i386
-%setup -q -c %{name}-%{version}
-%endif
-%ifarch alpha
-%setup -q -c %{name}-%{version} -T -a 1
-%endif
-%ifarch ppc
-%setup -q -c %{name}-%{version} -T -a 2
-%endif
-%ifarch x86_64
-%setup -q -c %{name}-%{version} -T -a 3
-%endif
-
-%build
-# nothing to build
-
-%install
-rm -rf $RPM_BUILD_ROOT
-
-install -d $RPM_BUILD_ROOT%{_codecsdir}
-%ifarch i386
-install -p all-%{version}/* $RPM_BUILD_ROOT%{_codecsdir}/
-%endif
-%ifarch alpha
-install -p all-alpha-%{alpha_ver}/* $RPM_BUILD_ROOT%{_codecsdir}/
-%endif
-%ifarch ppc
-install -p all-ppc-%{ppc_ver}/* $RPM_BUILD_ROOT%{_codecsdir}/
-%endif
-%ifarch x86_64
-install -p essential-amd64-%{x86_64_ver}/* $RPM_BUILD_ROOT%{_codecsdir}/
-%endif
-rm -f $RPM_BUILD_ROOT%{_codecsdir}/README
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(0644,root,root,0755)
-%ifarch i386
-%doc all-%{i386_ver}/README
-%{_codecsdir}/acelpdec.ax
-%{_codecsdir}/alf2cd.acm
-%{_codecsdir}/aslcodec_dshow.dll
-%{_codecsdir}/atrac3.acm
-%{_codecsdir}/atrc.so.6.0
-%{_codecsdir}/AvidQTAVUICodec.qtx
-%{_codecsdir}/BeHereiVideo.qtx
-%{_codecsdir}/CLRVIDDC.DLL
-%{_codecsdir}/clrviddd.dll
-%{_codecsdir}/cook.so
-%{_codecsdir}/CtWbJpg.DLL
-%{_codecsdir}/DECVW_32.DLL
-%{_codecsdir}/drvc.so
-%{_codecsdir}/dspr.so.6.0
-%{_codecsdir}/frapsvid.dll
-%{_codecsdir}/iac25_32.ax
-%{_codecsdir}/icmw_32.dll
-%{_codecsdir}/imc32.acm
-%{_codecsdir}/ir41_32.dll
-%{_codecsdir}/ir50_32.dll
-%{_codecsdir}/ivvideo.dll
-%{_codecsdir}/jp2avi.dll
-%{_codecsdir}/LCMW2.dll
-%{_codecsdir}/LCODCCMW2E.dll
-%{_codecsdir}/lhacm.acm
-%{_codecsdir}/lsvxdec.dll
-%{_codecsdir}/m3jp2k32.dll
-%{_codecsdir}/mi-sc4.acm
-%{_codecsdir}/msh261.drv
-%{_codecsdir}/msms001.vwp
-%{_codecsdir}/msscds32.ax
-%{_codecsdir}/nsrt2432.acm
-%{_codecsdir}/qpeg32.dll
-%{_codecsdir}/qtmlClient.dll
-%{_codecsdir}/QuickTimeEssentials.qtx
-%{_codecsdir}/QuickTimeInternetExtras.qtx
-%{_codecsdir}/QuickTime.qts
-%{_codecsdir}/rt32dcmp.dll
-%{_codecsdir}/sipr.so.6.0
-%{_codecsdir}/tm20dec.ax
-%{_codecsdir}/tokf.so.6.0
-%{_codecsdir}/tokr.so.6.0
-%{_codecsdir}/tsd32.dll
-%{_codecsdir}/tssoft32.acm
-%{_codecsdir}/tvqdec.dll
-%{_codecsdir}/VDODEC32.dll
-%{_codecsdir}/vdowave.drv
-%{_codecsdir}/vid_3ivX.xa
-%{_codecsdir}/ViVD2.dll
-%{_codecsdir}/vivog723.acm
-%{_codecsdir}/vmnc.dll
-%{_codecsdir}/voxmsdec.ax
-%{_codecsdir}/vp4vfw.dll
-%{_codecsdir}/vp5vfw.dll
-%{_codecsdir}/vp6vfw.dll
-%{_codecsdir}/vp7vfw.dll
-%{_codecsdir}/vssh264core.dll
-%{_codecsdir}/vssh264dec.dll
-%{_codecsdir}/vssh264.dll
-%{_codecsdir}/vsshdsd.dll
-%{_codecsdir}/vsslight.dll
-%{_codecsdir}/vsswlt.dll
-%{_codecsdir}/wma9dmod.dll
-%{_codecsdir}/wmadmod.dll
-%{_codecsdir}/wmsdmod.dll
-%{_codecsdir}/wmspdmod.dll
-%{_codecsdir}/wmv9dmod.dll
-%{_codecsdir}/wmvadvd.dll
-%{_codecsdir}/wmvdmod.dll
-%{_codecsdir}/wnvwinx.dll
-%{_codecsdir}/wvc1dmod.dll
-%{_codecsdir}/xanlib.dll
-%endif
-%ifarch alpha
-%doc all-alpha-%{alpha_ver}/README
-%endif
-%ifarch alpha ppc
-%{_codecsdir}/28_8.so.6.0
-%{_codecsdir}/atrc.so.6.0
-%{_codecsdir}/cook.so.6.0
-%{_codecsdir}/ddnt.so.6.0
-%{_codecsdir}/dnet.so.6.0
-%{_codecsdir}/drv2.so.6.0
-%{_codecsdir}/dspr.so.6.0
-%{_codecsdir}/sipr.so.6.0
-%{_codecsdir}/tokr.so.6.0
-%endif
-%ifarch ppc
-%doc all-ppc-%{ppc_ver}/README
-%{_codecsdir}/vid_iv41.xa
-%{_codecsdir}/vid_iv50.xa
-%endif
-%ifarch x86_64
-%doc essential-amd64-%{x86_64_ver}/README
-%{_codecsdir}/cook.so
-%{_codecsdir}/drvc.so
-%{_codecsdir}/sipr.so
-%endif
-
-%files extra
-%ifarch i386
-%defattr(0644,root,root,0755)
-%{_codecsdir}/ACDV.dll
-%{_codecsdir}/ADV601.dll
-%{_codecsdir}/aoxdxipl.ax
-%{_codecsdir}/aslcodec_vfw.dll
-%{_codecsdir}/asusasv2.dll
-%{_codecsdir}/asusasvd.dll
-%{_codecsdir}/ativcr2.dll
-%{_codecsdir}/avimszh.dll
-%{_codecsdir}/avizlib.dll
-%{_codecsdir}/blox.dll
-%{_codecsdir}/BTVVC32.DRV
-%{_codecsdir}/bw10.dll
-%{_codecsdir}/camfc.dll
-%{_codecsdir}/cinedec.ax
-%{_codecsdir}/cinevfw.dll
-%{_codecsdir}/CineWave.qtx
-%{_codecsdir}/cook.so.6.0
-%{_codecsdir}/ctadp32.acm
-%{_codecsdir}/ddnt.so.6.0
-%{_codecsdir}/decvdo.dll
-%{_codecsdir}/divx.dll
-%{_codecsdir}/divx_c32.ax
-%{_codecsdir}/divxa32.acm
-%{_codecsdir}/divxc32.dll
-%{_codecsdir}/divxdec.ax
-%{_codecsdir}/dnet.so.6.0
-%{_codecsdir}/drv2.so.6.0
-%{_codecsdir}/drv3.so.6.0
-%{_codecsdir}/drv4.so.6.0
-%{_codecsdir}/DVACM.acm
-%{_codecsdir}/fmcodec.DLL
-%{_codecsdir}/G2M.dll
-%{_codecsdir}/GeoCodec.dll
-%{_codecsdir}/GXAMP4.dll
-%{_codecsdir}/huffyuv.dll
-%{_codecsdir}/i263_32.drv
-%{_codecsdir}/iccvid.dll
-%{_codecsdir}/imaadp32.acm
-%{_codecsdir}/ir32_32.dll
-%{_codecsdir}/kdvyuv8.dll
-%{_codecsdir}/KGV1-VFW.dll
-%{_codecsdir}/LCodcCMP.dll
-%{_codecsdir}/l3codeca.acm
-%{_codecsdir}/l3codecx.ax
-%{_codecsdir}/m3jpeg32.dll
-%{_codecsdir}/m3jpegdec.ax
-%{_codecsdir}/mcdvd_32.dll
-%{_codecsdir}/mcmjpg32.dll
-%{_codecsdir}/MLZCodec.dll
-%{_codecsdir}/mpg4c32.dll
-%{_codecsdir}/mpg4ds32.ax
-%{_codecsdir}/msadp32.acm
-%{_codecsdir}/msg711.acm
-%{_codecsdir}/msgsm32.acm
-%{_codecsdir}/msnaudio.acm
-%{_codecsdir}/msrle32.dll
-%{_codecsdir}/msvidc32.dll
-%{_codecsdir}/MVCodec.dll
-%{_codecsdir}/mvoice.vwp
-%{_codecsdir}/mvoiced.vwp
-%{_codecsdir}/Nsgsm32.acm
-%{_codecsdir}/Nstsp32.acm
-%{_codecsdir}/nsvideo.dll
-%{_codecsdir}/NuB2.dll
-%{_codecsdir}/nuvision.ax
-%{_codecsdir}/pclepim1.dll
-%{_codecsdir}/qdv.dll
-%{_codecsdir}/scg726.acm
-%{_codecsdir}/SCLS.DLL
-%{_codecsdir}/scrvid.dll
-%{_codecsdir}/Sif1Dec.ax
-%{_codecsdir}/Sif1_vfw.dll
-%{_codecsdir}/smcelp32.acm
-%{_codecsdir}/SN4Codec.dll
-%{_codecsdir}/sp4x_32.dll
-%{_codecsdir}/sp5x_32.dll
-%{_codecsdir}/tm2Xdec.ax
-%{_codecsdir}/tm2x.dll
-%{_codecsdir}/TRICDC32.DRV
-%{_codecsdir}/tsccvid.dll
-%{_codecsdir}/ubv263d+.ax
-%{_codecsdir}/ubvmp4d.dll
-%{_codecsdir}/ultimo.dll
-%{_codecsdir}/vdo32_30.drv
-%{_codecsdir}/vdowave2.acm
-%{_codecsdir}/vdowave.acm
-%{_codecsdir}/VFCodec.dll
-%{_codecsdir}/vgpix32d.dll
-%{_codecsdir}/vid_cvid.xa
-%{_codecsdir}/vid_cyuv.xa
-%{_codecsdir}/vid_h261.xa
-%{_codecsdir}/vid_h263.xa
-%{_codecsdir}/vid_iv32.xa
-%{_codecsdir}/vid_iv41.xa
-%{_codecsdir}/vid_iv50.xa
-%{_codecsdir}/voxmvdec.ax
-%{_codecsdir}/vp31vfw.dll
-%{_codecsdir}/WavCWAIP.dll
-%{_codecsdir}/wavelet.dll
-%{_codecsdir}/WAVLOR.DLL
-%{_codecsdir}/WCMV.dll
-%{_codecsdir}/wmv8ds32.ax
-%{_codecsdir}/wmvds32.ax
-%{_codecsdir}/wnvplay1.dll
-%{_codecsdir}/wtvc.DLL
-%{_codecsdir}/wv32vfw.dll
-%{_codecsdir}/xfcodec.dll
-%{_codecsdir}/ylc.vcm
-%{_codecsdir}/Zlib.dll
-%{_codecsdir}/zmbv.dll
-%{_codecsdir}/ZyGoAudioS.qtx
-%endif
-%ifarch alpha ppc
-%{_codecsdir}/14_4.so.6.0
-%{_codecsdir}/drv3.so.6.0
-%endif
-%ifarch ppc
-%{_codecsdir}/vid_cvid.xa
-%{_codecsdir}/vid_iv32.xa
-%endif
-
-%changelog
-* Fri Aug 20 2010 Dominik Mierzejewski <rpm@greysector.net> 20100303-1
-- updated i386 pack
-
-* Mon Feb 11 2008 Dominik Mierzejewski <rpm@greysector.net> 20071007-1
-- updated i386 pack
-
-* Sat Oct 06 2007 Dominik Mierzejewski <rpm@greysector.net> 20060622-1
-- specfile cleanups
-- added backwards compatibility Provides:
-- dropped old history
diff --git a/rpm/mplayer.spec b/rpm/mplayer.spec
deleted file mode 100644
index 2db141cd20..0000000000
--- a/rpm/mplayer.spec
+++ /dev/null
@@ -1,298 +0,0 @@
-%define date %(date --iso)
-%define svnbuild %(date +%Y%m%d)
-%define codecsdir %{_libdir}/codecs
-
-Name: mplayer
-Version: 1.0
-Release: 0.%{svnbuild}svn%{?dist}
-Summary: Movie player playing most video formats and DVDs
-
-Group: Applications/Multimedia
-License: GPL
-URL: http://www.mplayerhq.hu/
-Source0: http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2
-Source1: http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildRequires: SDL-devel
-BuildRequires: aalib-devel
-BuildRequires: alsa-lib-devel
-BuildRequires: cdparanoia-devel
-BuildRequires: desktop-file-utils
-BuildRequires: em8300-devel
-BuildRequires: enca-devel
-BuildRequires: faad2-devel
-BuildRequires: fontconfig-devel
-BuildRequires: freetype-devel >= 2.0.9
-BuildRequires: fribidi-devel
-BuildRequires: giflib-devel
-BuildRequires: gtk2-devel
-BuildRequires: ladspa-devel
-BuildRequires: lame-devel
-BuildRequires: libGL-devel
-BuildRequires: libXinerama-devel
-BuildRequires: libXv-devel
-BuildRequires: libXxf86dga-devel
-BuildRequires: libXxf86vm-devel
-BuildRequires: libcaca-devel
-BuildRequires: libdca-devel
-BuildRequires: libdv-devel
-BuildRequires: libdvdnav-devel
-BuildRequires: libjpeg-devel
-BuildRequires: libmpcdec-devel
-BuildRequires: libtheora-devel
-BuildRequires: libvorbis-devel
-BuildRequires: lirc-devel
-BuildRequires: live-devel
-BuildRequires: lzo-devel >= 2
-BuildRequires: speex-devel >= 1.1
-BuildRequires: xvidcore-devel >= 0.9.2
-%{?_with_arts:BuildRequires: arts-devel}
-%{?_with_amr:BuildRequires: amrnb-devel amrwb-devel}
-%{?_with_directfb:BuildRequires: directfb-devel}
-%{?_with_esound:BuildRequires: esound-devel}
-%{?_with_jack:BuildRequires: jack-audio-connection-kit-devel}
-%{?_with_libmad:BuildRequires: libmad-devel}
-%{?_with_openal:BuildRequires: openal-devel}
-%{?_with_samba:BuildRequires: samba-common}
-%{?_with_svgalib:BuildRequires: svgalib-devel}
-%{?_with_xmms:BuildRequires: xmms-devel}
-# for XML docs, SVN only
-BuildRequires: docbook-dtds
-BuildRequires: docbook-style-xsl
-BuildRequires: libxml2
-BuildRequires: libxslt
-
-%description
-MPlayer is a movie player that plays most MPEG, VOB, AVI, OGG/OGM,
-VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM,
-RoQ, and PVA files. You can also use it to watch VCDs, SVCDs, DVDs,
-3ivx, RealMedia, and DivX movies.
-It supports a wide range of output drivers including X11, XVideo, DGA,
-OpenGL, SVGAlib, fbdev, AAlib, DirectFB etc. There are also nice
-antialiased shaded subtitles and OSD.
-Non-default rpmbuild options:
---with samba: Enable Samba (smb://) support
---with xmms: Enable XMMS input plugin support
---with amr: Enable AMR support
---with libmad: Enable libmad support
---with openal: Enable OpenAL support
---with jack: Enable JACK support
---with arts: Enable aRts support
---with esound: Enable EsounD support
---with directfb:Enable DirectFB support
---with svgalib: Enable SVGAlib support
-
-%package gui
-Summary: GUI for MPlayer
-Group: Applications/Multimedia
-Requires: mplayer = %{version}-%{release}
-
-%description gui
-This package contains a GUI for MPlayer and a default skin for it.
-
-%package doc
-Summary: MPlayer documentation in various languages
-Group: Documentation
-
-%description doc
-MPlayer documentation in various languages.
-
-
-%prep
-%setup -q -n mplayer-export-%{date}
-
-doconv() {
- iconv -f $1 -t $2 -o DOCS/man/$3/mplayer.1.utf8 DOCS/man/$3/mplayer.1 && \
- mv DOCS/man/$3/mplayer.1.utf8 DOCS/man/$3/mplayer.1
-}
-for lang in de es fr it ; do doconv iso-8859-1 utf-8 $lang ; done
-for lang in hu pl ; do doconv iso-8859-2 utf-8 $lang ; done
-for lang in ru ; do doconv koi8-r utf-8 $lang ; done
-
-mv DOCS/man/zh DOCS/man/zh_CN
-
-%build
-./configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --datadir=%{_datadir}/mplayer \
- --mandir=%{_mandir} \
- --confdir=%{_sysconfdir}/mplayer \
- --libdir=%{_libdir} \
- --codecsdir=%{codecsdir} \
- \
- --enable-gui \
- --disable-termcap \
- --disable-bitmap-font \
- --enable-lirc \
- --enable-joystick \
- %{!?_with_samba:--disable-smb} \
- --disable-dvdread-internal \
- --disable-libdvdcss-internal \
- \
- %{!?_with_amr:--disable-libamr_nb --disable-libamr_wb} \
- %{!?_with_libmad:--disable-mad} \
- %{?_with_xmms:--enable-xmms} \
- \
- --disable-svga \
- --%{?_with_directfb:enable}%{!?_with_directfb:disable}-directfb \
- %{!?_with_svgalib:--disable-svga} \
- \
- %{!?_with_arts:--disable-arts} \
- %{!?_with_esound:--disable-esd} \
- %{!?_with_jack:--disable-jack} \
- %{!?_with_openal:--disable-openal} \
- \
- --language=all \
- \
- %{?_with_xmms:--with-xmmslibdir=%{_libdir}} \
-
-
-%{__make}
-
-mv -f mplayer gmplayer
-%{__make} distclean
-
-./configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --datadir=%{_datadir}/mplayer \
- --mandir=%{_mandir} \
- --confdir=%{_sysconfdir}/mplayer \
- --libdir=%{_libdir} \
- --codecsdir=%{codecsdir} \
- \
- --disable-termcap \
- --disable-bitmap-font \
- --enable-lirc \
- --enable-joystick \
- %{!?_with_samba:--disable-smb} \
- --disable-dvdread-internal \
- --disable-libdvdcss-internal \
- \
- %{!?_with_amr:--disable-libamr_nb --disable-libamr_wb} \
- %{!?_with_libmad:--disable-mad} \
- %{?_with_xmms:--enable-xmms} \
- \
- --disable-svga \
- --%{?_with_directfb:enable}%{!?_with_directfb:disable}-directfb \
- %{!?_with_svgalib:--disable-svga} \
- \
- %{!?_with_arts:--disable-arts} \
- %{!?_with_esound:--disable-esd} \
- %{!?_with_jack:--disable-jack} \
- %{!?_with_openal:--disable-openal} \
- \
- --language=all \
- \
- %{?_with_xmms:--with-xmmslibdir=%{_libdir}} \
-
-
-%{__make}
-
-# build HTML documentation from XML files
-pushd DOCS/xml
-%{__make} html-chunked
-popd
-
-%install
-rm -rf $RPM_BUILD_ROOT doc
-
-make install DESTDIR=$RPM_BUILD_ROOT STRIPBINARIES=no
-install -pm 755 TOOLS/midentify.sh $RPM_BUILD_ROOT%{_bindir}/
-
-# Clean up documentation
-mkdir doc
-cp -pR DOCS/* doc/
-rm -r doc/man doc/xml doc/README
-mv doc/HTML/* doc/
-rm -rf doc/HTML
-
-# Default config files
-install -Dpm 644 etc/example.conf \
- $RPM_BUILD_ROOT%{_sysconfdir}/mplayer/mplayer.conf
-# use Nimbus Sans L font for OSD (via fontconfig)
-echo "fontconfig=yes" >>$RPM_BUILD_ROOT%{_sysconfdir}/mplayer/mplayer.conf
-echo "font=\"Sans\"" >>$RPM_BUILD_ROOT%{_sysconfdir}/mplayer/mplayer.conf
-
-# GUI mplayer
-install -pm 755 g%{name} $RPM_BUILD_ROOT%{_bindir}/
-
-# Default skin
-install -dm 755 $RPM_BUILD_ROOT%{_datadir}/mplayer/skins
-tar xjC $RPM_BUILD_ROOT%{_datadir}/mplayer/skins --exclude=.svn -f %{SOURCE1}
-ln -s Blue $RPM_BUILD_ROOT%{_datadir}/mplayer/skins/default
-
-# Icons
-install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps
-install -pm 644 etc/mplayer.xpm \
- $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps
-
-# Desktop file
-desktop-file-install \
- --dir $RPM_BUILD_ROOT%{_datadir}/applications \
- etc/%{name}.desktop
-
-# Codec dir
-install -dm 755 $RPM_BUILD_ROOT%{codecsdir}
-
-
-%post gui
-gtk-update-icon-cache -qf %{_datadir}/icons/hicolor &>/dev/null || :
-update-desktop-database &>/dev/null || :
-
-
-%postun gui
-gtk-update-icon-cache -qf %{_datadir}/icons/hicolor &>/dev/null || :
-update-desktop-database &>/dev/null || :
-
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
-%files
-%defattr(-, root, root, -)
-%doc AUTHORS Changelog LICENSE README
-%dir %{_sysconfdir}/mplayer
-%config(noreplace) %{_sysconfdir}/mplayer/mplayer.conf
-%config(noreplace) %{_sysconfdir}/mplayer/input.conf
-%{_bindir}/midentify.sh
-%{_bindir}/mplayer
-%dir %{codecsdir}/
-%dir %{_datadir}/mplayer/
-%{_mandir}/man1/mplayer.1*
-%lang(cs) %{_mandir}/cs/man1/mplayer.1*
-%lang(de) %{_mandir}/de/man1/mplayer.1*
-%lang(es) %{_mandir}/es/man1/mplayer.1*
-%lang(fr) %{_mandir}/fr/man1/mplayer.1*
-%lang(hu) %{_mandir}/hu/man1/mplayer.1*
-%lang(it) %{_mandir}/it/man1/mplayer.1*
-%lang(pl) %{_mandir}/pl/man1/mplayer.1*
-%lang(ru) %{_mandir}/ru/man1/mplayer.1*
-%lang(zh_CN) %{_mandir}/zh_CN/man1/mplayer.1*
-
-%files gui
-%defattr(-, root, root, -)
-%{_bindir}/gmplayer
-%{_datadir}/applications/*mplayer.desktop
-%{_datadir}/icons/hicolor/32x32/apps/mplayer.xpm
-%{_datadir}/mplayer/skins/
-
-%files doc
-%defattr(-, root, root, -)
-%doc doc/en/ doc/tech/
-%lang(cs) %doc doc/cs/
-%lang(de) %doc doc/de/
-%lang(es) %doc doc/es/
-%lang(fr) %doc doc/fr/
-%lang(hu) %doc doc/hu/
-%lang(pl) %doc doc/pl/
-%lang(ru) %doc doc/ru/
-%lang(zh_CN) %doc doc/zh_CN/
-
-
-%changelog
-* Sat Oct 06 2007 Dominik Mierzejewski <rpm at greysector.net>
-- adapted livna specfile for inclusion in SVN
diff --git a/screenshot.c b/screenshot.c
index 79356ed9a2..1f2b0694fc 100644
--- a/screenshot.c
+++ b/screenshot.c
@@ -27,10 +27,9 @@
#include "talloc.h"
#include "screenshot.h"
#include "mp_core.h"
-#include "m_property.h"
+#include "command.h"
#include "bstr.h"
#include "mp_msg.h"
-#include "metadata.h"
#include "path.h"
#include "libmpcodecs/mp_image.h"
#include "libmpcodecs/dec_video.h"
@@ -67,19 +66,6 @@ static char *stripext(void *talloc_ctx, const char *s)
return talloc_asprintf(talloc_ctx, "%.*s", end - s, s);
}
-static char *do_format_property(struct MPContext *mpctx, struct bstr s) {
- struct bstr prop_name = s;
- int fallbackpos = bstrchr(s, ':');
- if (fallbackpos >= 0)
- prop_name = bstr_splice(prop_name, 0, fallbackpos);
- char *pn = bstrdup0(NULL, prop_name);
- char *res = mp_property_print(pn, mpctx);
- talloc_free(pn);
- if (!res && fallbackpos >= 0)
- res = bstrdup0(NULL, bstr_cut(s, fallbackpos + 1));
- return res;
-}
-
#ifdef _WIN32
#define ILLEGAL_FILENAME_CHARS "?\"/\\<>*|:"
#else
@@ -154,14 +140,13 @@ static char *create_fname(struct MPContext *mpctx, char *template,
}
case 'f':
case 'F': {
- char *video_file = get_metadata(mpctx, META_NAME);
+ char *video_file = mp_basename(mpctx->filename);
if (video_file) {
char *name = video_file;
if (fmt == 'F')
name = stripext(res, video_file);
append_filename(&res, name);
}
- talloc_free(video_file);
break;
}
case 'p':
@@ -188,11 +173,13 @@ static char *create_fname(struct MPContext *mpctx, char *template,
if (!end)
goto error_exit;
struct bstr prop = bstr_splice(bstr0(template), 0, end - template);
- template = end + 1;
- char *s = do_format_property(mpctx, prop);
+ char *tmp = talloc_asprintf(NULL, "${%.*s}", BSTR_P(prop));
+ char *s = mp_property_expand_string(mpctx, tmp);
+ talloc_free(tmp);
if (s)
append_filename(&res, s);
talloc_free(s);
+ template = end + 1;
break;
}
case '%':
diff --git a/stream/stream.c b/stream/stream.c
index d7500cc790..837378fcae 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -53,6 +53,12 @@
#include "cache2.h"
+/// We keep these 2 for the gui atm, but they will be removed.
+int vcd_track=0;
+char* cdrom_device=NULL;
+char* dvd_device=NULL;
+int dvd_title=0;
+
struct input_ctx;
static int (*stream_check_interrupt_cb)(struct input_ctx *ctx, int time);
static struct input_ctx *stream_check_interrupt_ctx;
@@ -199,6 +205,14 @@ stream_t *open_stream_full(const char *filename, int mode,
stream_t* s;
char *redirected_url = NULL;
+ assert(filename);
+
+ int dummy;
+ if (!file_format)
+ file_format = &dummy;
+
+ *file_format = DEMUXER_TYPE_UNKNOWN;
+
for(i = 0 ; auto_open_streams[i] ; i++) {
sinfo = auto_open_streams[i];
if(!sinfo->protocols) {
@@ -235,15 +249,15 @@ stream_t *open_stream_full(const char *filename, int mode,
return NULL;
}
-stream_t *open_output_stream(const char *filename, struct MPOpts *options)
+stream_t* open_stream(const char *filename, struct MPOpts *options,
+ int *file_format)
{
- int file_format; //unused
- if(!filename) {
- mp_msg(MSGT_OPEN,MSGL_ERR,"open_output_stream(), NULL filename, report this bug\n");
- return NULL;
- }
+ return open_stream_full(filename,STREAM_READ,options,file_format);
+}
- return open_stream_full(filename,STREAM_WRITE,options,&file_format);
+stream_t *open_output_stream(const char *filename, struct MPOpts *options)
+{
+ return open_stream_full(filename,STREAM_WRITE,options,NULL);
}
//=================== STREAMER =========================
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 5332311856..05492ce490 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -1021,7 +1021,7 @@ fail:
m_struct_free(&stream_opts, opts);
return STREAM_UNSUPPORTED;
}
- mp_tmsg(MSGT_DVD,MSGL_ERR,"MPlayer was compiled without DVD support, exiting.\n");
+ mp_tmsg(MSGT_DVD,MSGL_ERR,"mpv was compiled without DVD support, exiting.\n");
m_struct_free(&stream_opts,opts);
return STREAM_UNSUPPORTED;
}
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index ba93c4c842..65b34d0a18 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -47,7 +47,7 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts)
track->PlayResY = 288;
track->WrapStyle = 0;
- if (opts->ass_styles_file)
+ if (opts->ass_styles_file && opts->ass_style_override)
ass_read_styles(track, opts->ass_styles_file, sub_cp);
if (track->n_styles == 0) {
@@ -95,7 +95,9 @@ ASS_Track *mp_ass_default_track(ASS_Library *library, struct MPOpts *opts)
style->ScaleY = 1.;
}
- ass_process_force_style(track);
+ if (opts->ass_style_override)
+ ass_process_force_style(track);
+
return track;
}
@@ -228,14 +230,29 @@ ASS_Track *mp_ass_read_stream(ASS_Library *library, const char *fname,
void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
struct mp_eosd_res *dim)
{
- int hinting;
ass_set_frame_size(priv, dim->w, dim->h);
ass_set_margins(priv, dim->mt, dim->mb, dim->ml, dim->mr);
- ass_set_use_margins(priv, opts->ass_use_margins);
- ass_set_font_scale(priv, opts->ass_font_scale);
- hinting = opts->ass_hinting & 3; // +4 was for no hinting if scaled
- ass_set_hinting(priv, hinting);
- ass_set_line_spacing(priv, opts->ass_line_spacing);
+
+ int set_use_margins = 0;
+ int set_sub_pos = 0;
+ float set_line_spacing = 0;
+ float set_font_scale = 1;
+ int set_hinting = 0;
+ if (opts->ass_style_override) {
+ set_use_margins = opts->ass_use_margins;
+ set_sub_pos = 100 - sub_pos;
+ set_line_spacing = opts->ass_line_spacing;
+ set_font_scale = opts->ass_font_scale;
+ set_hinting = opts->ass_hinting & 3; // +4 was for no hinting if scaled
+ }
+
+ ass_set_use_margins(priv, set_use_margins);
+#if LIBASS_VERSION >= 0x01010000
+ ass_set_line_position(priv, set_sub_pos);
+#endif
+ ass_set_font_scale(priv, set_font_scale);
+ ass_set_hinting(priv, set_hinting);
+ ass_set_line_spacing(priv, set_line_spacing);
}
void mp_ass_configure_fonts(ASS_Renderer *priv)
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index f3296c6091..d77c0d1af2 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -136,14 +136,6 @@ static char *mangle_ass(const char *in)
{
char *res = talloc_strdup(NULL, "");
while (*in) {
- if (in[0] == '\\' && strchr("nNh{}", in[1])) {
- // Undo escaping, e.g. \{ -> \\{
- // Note that e.g. \\j still must be emitted as \\j
- // (libass only understands the escapes listed in the strchr args)
- res = talloc_asprintf_append_buffer(res, "\\\\%c", in[1]);
- in += 2;
- continue;
- }
// As used by osd_get_function_sym().
if (in[0] == '\xFF') {
res = talloc_strdup_append_buffer(res, ASS_USE_OSD_FONT);
@@ -155,6 +147,9 @@ static char *mangle_ass(const char *in)
if (*in == '{')
res = talloc_strdup_append_buffer(res, "\\");
res = talloc_strndup_append_buffer(res, in, 1);
+ // Break ASS escapes with U+2060 WORD JOINER
+ if (*in == '\\')
+ append_utf8_buffer(res, 0x2060);
in++;
}
return res;
@@ -245,8 +240,10 @@ static void update_sub(struct osd_state *osd, struct osd_object *obj)
ASS_Style *style = obj->osd_track->styles + obj->osd_track->default_style;
- style->MarginV = obj->osd_track->PlayResY * ((100 - sub_pos)/110.0);
update_font_style(obj->osd_track, style, text_font_scale_factor);
+#if LIBASS_VERSION >= 0x01010000
+ ass_set_line_position(osd->osd_render, 100 - sub_pos);
+#endif
char *text = talloc_strdup(NULL, "");
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 44c91c6fdc..a5e23d74da 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -138,7 +138,9 @@ static void get_bitmaps(struct sh_sub *sh, struct osd_state *osd,
return;
double scale = params->normal_scale;
- if (ctx->vsfilter_aspect && opts->ass_vsfilter_aspect_compat)
+ bool use_vs_aspect = opts->ass_style_override
+ ? opts->ass_vsfilter_aspect_compat : 1;
+ if (ctx->vsfilter_aspect && use_vs_aspect)
scale = params->vsfilter_scale;
ASS_Renderer *renderer = osd->ass_renderer;
mp_ass_configure(renderer, opts, &params->dim);
diff --git a/talloc.c b/talloc.c
index 87842c5acd..9b73fc19f0 100644
--- a/talloc.c
+++ b/talloc.c
@@ -1421,7 +1421,7 @@ char *talloc_strdup_append_buffer(char *s, const char *a)
char *talloc_strndup_append(char *s, const char *a, size_t n)
{
if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
+ return talloc_strndup(NULL, a, n);
}
if (unlikely(!a)) {
@@ -1440,7 +1440,7 @@ char *talloc_strndup_append_buffer(char *s, const char *a, size_t n)
size_t slen;
if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
+ return talloc_strndup(NULL, a, n);
}
if (unlikely(!a)) {
diff --git a/version.c b/version.c
index e3e6c4ac81..f06f0afc30 100644
--- a/version.c
+++ b/version.c
@@ -18,4 +18,4 @@
#include "version.h"
-const char *mplayer_version = "mplayer " VERSION;
+const char *mplayer_version = "mpv " VERSION;