Commit Graph

33498 Commits

Author SHA1 Message Date
wm4 74df1d8e05 Remove compile time/runtime CPU detection, and drop some platforms
mplayer had three ways of enabling CPU specific assembler routines:
a) Enable them at compile time; crash if the CPU can't handle it.
b) Enable them at compile time, but let the configure script detect
   your CPU. Your binary will only crash if you try to run it on a
   different system that has less features than yours.
   This was the default, I think.
c) Runtime detection.

The implementation of b) and c) suck. a) is not really feasible (it
sucks for users). Remove all code related to this, and use libav's CPU
detection instead. Now the configure script will always enable CPU
specific features, and disable them at runtime if libav reports them
not as available.

One implication is that now the compiler is always expected to handle
SSE (etc.) inline assembly at runtime, unless it's explicitly disabled.

Only checks for x86 CPU specific features are kept, the rest is either
unused or barely used.

Get rid of all the dump -mpcu, -march etc. flags. Trust the compiler
to select decent settings.

Get rid of support for the following operating systems:
- BSD/OS (some ancient BSD fork)
- QNX (don't care)
- BeOS (dead, Haiku support is still welcome)
- AIX (don't care)
- HP-UX (don't care)
- OS/2 (dead, actual support has been removed a while ago)

Remove the configure code for detecting the endianness. Instead, use
the standard header <endian.h>, which can be used if _GNU_SOURCE or
_BSD_SOURCE is defined. (Maybe these changes should have been in a
separate commit.)

Since this is a quite violent code removal orgy, and I'm testing only
on x86 32 bit Linux, expect regressions.
2012-07-30 01:37:28 +02:00
wm4 a4bab723b3 fastmemcpy.h: remove code duplication
Remove the mem2agpcpy_pic function, which is obviously duplicated from
the other function in this file.

Untested, as this is only used by the directx and directfb2 VOs.
2012-07-30 01:36:35 +02:00
wm4 273a6623e7 libvo: remove custom assembler memcpy implementations (aka fastmemcpy)
aclib[_template].c contained inline assembler versions of memcpy using
MMX/SSE/3dnow etc. instructions. It's possible that this gave quite a
speed a decade ago, but it's unlikely to have any use on modern
systems. Also, libc implementations already have their own
optimizations for the native memcpy function.

I did not verify my assumptions eith benchmarks, so I could be wrong.

Also note that some platforms have extremely crappy libc
implementations, and it's well possible that these might suffer from a
major performance loss (hello Windows). Unfortunately, I do not care.
2012-07-30 01:33:40 +02:00
wm4 94b7db20bc configure: remove pointless checks for yasm etc.
mplayer doesn't use yasm, as or ranlib. They were only needed to
build with internal libav, which is gone.

Also, get rid of nm. nm was used to find out how external symbols are
mangled. Replace this by a platform check in mangle.h. As far as I
know, sane systems don't mangle symbols. Windows prefixes them with
an underscore ("_symbol"). I don't know about OSX.
2012-07-29 00:22:13 +02:00
wm4 46b218ca34 Change version string
Change the "main" name from "mplayer2" to "mplayer". Note that upstream
mplayer2 uses "MPlayer2", and mplayer uses "MPlayer", so it's
unambiguous.

The version.sh script used to put the latest tag into the version
script. The intention was to add a new tag on each release, but this
hasn't been done in over a year, making the tag absolutely pointless.
Remove it. Now "git-SHORTHASH" is used.

Remove the string "MPlayer & mplayer2 teams" after the copyright date,
because that sounded silly.
2012-07-29 00:04:17 +02:00
wm4 806461c5b6 ad_faad: include neaacdec.h instead of faad.h
The faad.h header printed a warning that this header is outdated.
The header neaacdec.h is probably the proper header, so use that.
2012-07-28 23:51:38 +02:00
wm4 08caadb9c0 bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstr
Replace all uses of bstr() with bstr0().
Also remove the ridiculous C++ workaround.
2012-07-28 23:47:42 +02:00
wm4 ca0979a5db configure: disable win32 emulation by default
The win32 emulation code can be used to load Windows binary codecs.
Unfortunately, this code is extremely whacky and unmaintained. It
consists of an ancient copy of wine, that was hacked to death and
back. It does super-whacky stuff like patching the loaded codecs at
fixed memory offsets to make them work.

Not removing yet, because it still has some limited use, and some of
the code is needed to load codecs when running natively on Windows.
(Actually, I only care because mplayer can get video input from the
webcam of that-one-latop under Windows, which I find far too neat to
just kill all the code.)
2012-07-28 23:36:08 +02:00
wm4 71e51d948c osd: osd_font.h -> osd_font.pfb
osd_font.pfb is an actual font file extracted from osd_font.h.
file2string.py is used to turn it back into a header during the
build process.
2012-07-28 23:36:08 +02:00
wm4 1ee740cceb TOOLS/fil2string.py: fix for use with binary files
The script was written to be able to deal with binary files, but it had
a bug corrupting some data: e.g. a byte sequence 0x1 0x37 was printed as
"\17" (0x1 = escaped as "\1", and 0x37 = kept as literal "7"), which
would be interpreted as single character 0xF.

Always pad octal literals to length 3, which makes the escape sequences
unambiguous.
2012-07-28 23:36:08 +02:00
wm4 85a3a0d5bc osd: remove freetype font rendering code
The previous commit made libass the default OSD renderer. This commit
removes the disabled freetype renderer completely. The commits were
done separately to make rolling back easier, because using libass for
OSD rendering is a risky choice.

Also remove freetype/fontconfig/fribidi code. This is all done by
libass now.

If mplayer is compiled without libass, no OSD is displayed.
2012-07-28 23:36:08 +02:00
wm4 74e7a1e937 osd: use libass for OSD rendering
The OSD will now be rendered with libass. The old rendering code, which
used freetype/fontconfig and did text layout manually, is disabled. To
re-enable the old code, use the --disable-libass-osd configure switch.

Some switches do nothing with the new code enabled, such as -subalign,
-sub-bg-alpha, -sub-bg-color, and many more. (The reason is mostly that
the code for rendering unstyled subtitles with libass doesn't make any
attempts to support them. Some of them could be supported in theory.)

Teletext rendering is not implemented in the new OSD rendering code. I
don't have any teletext sources for testing, and since teletext is
being phased out world-wide, the need for this is questionable.

Note that rendering is extremely inefficient, mostly because the libass
output is blended with the extremely strange mplayer OSD format. This
could be improved at a later point.

Remove most OSD rendering from vo_aa.c, because that was extremely
hacky, can't be made work with osd_libass, and didn't work anyway in
my tests.

Internally, some cleanup is done. Subtitle and OSD related variable
declarations were literally all over the place. Move them to sub.h and
sub.c, which were hoarding most of these declarations already. Make the
player core in mplayer.c free of concerns like bitmap font loading.

The old OSD rendering code has been moved to osd_ft.c. The font_load.c
and font_load_ft.c are only needed and compiled if the old OSD
rendering code is configured.
2012-07-28 23:36:07 +02:00
wm4 7a06095dc3 Add support for playing video from streaming sites with libquvi
This enables playing URLs from libquvi supported streaming sites
directly, e.g. "mplayer http://www.youtube.com/watch?v=...."

Anything opened with mplayer is checked with libquvi. If it looks like
a URL of a supported streaming site, libquvi is used to extract the
media URL, which is then passed to the lower level mplayer code
instead of the HTML URL. Hopefully the libquvi URL checker works well
enough that it doesn't cause any problems with normal URLs, files, or
whatever else mplayer's stream layer accepts.

Add the --libquvi-format option. the option value is directly passed to
libquvi as requested format. The only values that seem to work for any
streaming site seem to be "best" (best quality) and "default" (lowest
quality). The mplayer option defaults to "best" (overriding libquvi's
default).

Outstanding issues:
- Does libquvi checking every opened file really not cause problems?
  Should there be a runtime option to disable libquvi use?
  (Probably not an issue.)
- Should we check/set the supported protocol? By default libquvi has
  support for all protocols enabled. In the worst case, it might return
  an URL using a protocol not supported by mplayer, even though it
  could extract URLs with other protocols too.
  (Probably not an issue.)
- Somehow export metadata (like media title) to the mplayer frontend?
2012-07-28 22:05:34 +02:00
wm4 42c3a30008 commands: add show_tracks_osd command to display audio and subtitle tracks on OSD
The command lists the audio and subtitle tracks in the current file on the
OSD. It also marks the currently active streams.
Video streams are not shown, as files with more than one video stream are
exceedingly rare.
2012-07-28 20:57:44 +02:00
wm4 af7a29424c commands: add show_chapters_osd command to display chapters on OSD
The command lists the chapters in the current file on the OSD. It also
marks the current chapter.

This is actually a cheap replacement for the chapter select libmenu
functionality.
2012-07-28 20:57:40 +02:00
wm4 ac771d288d osd: enable line breaking for OSD text
OSD text wider than the window will be broken to fit the width. The line
breaking algorithm is naive and intended as temporary, until the OSD
render code is possibly replaced by "something better".

Newline characters are also considered.
2012-07-28 20:57:37 +02:00
wm4 2b5fd80253 core: change format of time properties to match the OSD time format
Time property values converted to strings via M_PROPERTY_PRINT resulted in
a string different to what the OSD displays (if the OSD level is >= 2).

Change it to match the OSD.
2012-07-28 20:56:53 +02:00
wm4 16145ff43f libvo, libao: remove useless video and audio output drivers
Some of these have only limited use, and some of these have no use at
all. Remove them. They make maintainance harder and nobody needs them.
It's possible that many of the removed drivers were very useful a dozen
of years ago, but now it's 2012.

Note that some of these could be added back, in case they were more
useful than I thought. But right now, they are just a burden.

Reason for removal for each module:
    vo_3dfx, vo_dfbmga, vo_dxr3, vo_ivtv, vo_mga, vo_s3fb,
    vo_tdfxfb, vo_xmga, vo_tdfx_vid:
        All of these are for very specific and outdated hardware. Some
        of them require non-standard kernel drivers or do direct HW
        access.
    vo_dga: the most crappy and ancient way to get fast output on X.
    vo_aa: there's vo_caca for the same purpose.
    vo_ggi: this never lived, and is entirely useless.
    vo_mpegpes: for DVB cards, I can't test this and it's crappy.
    vo_fbdev, vo_fbdev2: there's vo_directfb2
    vo_bl: what is this even? But it's neither important, nor alive.
    vo_svga, vo_vesa: you want to use this? You can't be serious.
    vo_wii: I can't test this, and who the hell uses this?
    vo_xvr100: some Sun thing.
    vo_xover: only useful in connection with xvr100.
    ao_nas: still alive, but I doubt it has any meaning today.
    ao_sun: Sun.
    ao_win32: use ao_dsound or ao_portaudio instead.
    ao_ivtv: removed along vo_ivtv.

Also get rid of anything SDL related. SDL 1.x is total crap for video
output, and will be replaced with SDL 2.x soon (perhaps), so if you
want to use SDL, write output drivers for SDL 2.x.

Additionally, I accidentally damaged Sun support, which made me
completely remove Sun/Solaris support. Nobody cares about this anyway.

Some left overs from previous commits removing modules were cleaned up.
2012-07-28 20:44:59 +02:00
wm4 f03eed6469 Makefile: remove unused rule for mplayer-nomain.o 2012-07-28 20:44:59 +02:00
wm4 cee35cd725 Makefile: move dependency rules for autogenerated files
Explicit dependency rules are needed when a source file depends on an
autogenerated file. Move these rules to the same place in the Makefile
as the rules for creating the generated files.

Also, change the rules to declare the direct dependency, not a
transitive one (e.g. codecs.conf.h is needed by codec-cfg.c, not
codec-cfg.o). In practice, this shouldn't change anything, but it's
cleaner.
2012-07-28 20:44:59 +02:00
wm4 b319ae9190 Remove QTX tests
Whatever.
2012-07-28 20:44:59 +02:00
wm4 6c12e80789 Makefile: clean up
There were some targets left for stuff removed in previous commits.
2012-07-28 20:44:59 +02:00
wm4 5368c46453 Rename DOCS/tech/ to DOCS/OUTATED-tech/
While DOCS/tech/ contains lots of documentation about mplayer's
internals, most of it seems outdated, and hasn't been touched in many
years. On the other hand, there still might be useful things in there,
but it's hard to tell which parts.

Instead of deleting all it, rename the directory to "warn" potential
developers that the documentation is completely outdated.
2012-07-28 20:44:59 +02:00
wm4 f606bb6d97 Remove DOCS/xml
This contained _some_ documentation, but it was all old, crappy,
barely maintained. Even if it was maintained, uau hasn't merged
back changes for years.
2012-07-28 20:44:58 +02:00
wm4 6dc1249625 TOOLS: remove useless crap
Most of the scripts in TOOLS seem entirely useless. Remove them.
There were about 3 types of scripts:
- apparent developer tools (like file format dumpers, benchmarks)
  => I doubt any mplayer developer still alive even uses these
- helpers for encoding or ripping stuff
  => mencoder is gone, at least from this version of mplayer
- helpers meant for users (launching mplayer in weird ways, etc.)
  => just no, it will cause you more pain than gain
So no, there is nothing useful.

Under the scripts not deleted, these are needed for building mplayer:
  file2string.py
  matroska.py
  vdpau_functions.py
These might have _some_ use (but still questionable):
  binary_codecs.sh
  checktree.sh
2012-07-28 20:44:58 +02:00
wm4 7d4576cf79 Remove TOOLS/realcodecs
I have no idea what these are about, but it's probably useless outdated
crap. According to TOOLS/README, they are wrappers around
some Real binary codecs. They were added in 2003, and never touched
again (except for cosmetic changes).
2012-07-28 20:44:25 +02:00
wm4 cf9587fc04 Remove ancient kernel device drivers
These were device driver kernel modules for certain prehistoric graphic
cards. The source code indicates these are written against early
2.4 kernels.
2012-07-28 20:44:25 +02:00
wm4 f53dcf163d build: remove bin_to_header.py and use TOOLS/file2string.py instead
TOOLS/file2string.py was recently added upstream, so bin_to_header.py
is not needed anymore. Also fix vo_gl3.c, since file2string.py works
slightly different from my script.
2012-07-28 20:44:07 +02:00
wm4 51e198c2a1 Merge remote-tracking branch 'origin/master'
Conflicts:
	.gitignore
	bstr.c
	cfg-mplayer.h
	defaultopts.c
	libvo/video_out.c

The conflict in bstr.c is due to uau adding a bstr_getline function in
commit 2ba8b91a97. This function already existed in this branch.
While uau's function is obviously derived from mine, it's incompatible.
His function preserves line breaks, while mine strips them. Add a
bstr_strip_linebreaks function, fix all other uses of bstr_getline, and
pick uau's implementation.

In .gitignore, change vo_gl3_shaders.h to use an absolute path
additional to resolving the merge conflict.
2012-07-28 17:24:05 +02:00
Stefano Pigozzi 7dfaaa9510 vo_sharedbuffer: remove from autoprobe list
This video output is headless and only intended to work with GUIs
explicitly asking for it. This makes it useless to have it in the
autoprobe list.
2012-07-27 16:53:57 +03:00
Stefano Pigozzi 02add991fb vo_corevideo, vo_sharedbuffer: put private state in vo->priv
These VOs were already using a struct for all private data but the
struct variable itself was static. Change them to store the address in
vo->priv. Also change them to use the new automatic private data
allocation and option parsing mechanism.
2012-07-27 16:52:22 +03:00
Uoti Urpala 99141377c8 demux_rawdv.c: fix change missing from recent 8079f4ff82
Like vd_vfw.c fixed earlier, demux_rawdv.c was also missing a change
needed for the "flags"->"keyframe" demux packet field rename. This
broke compilation with libdv enabled.

Hopefully there aren't more cases. It's hard to reliably check for
references in files that aren't compiled in the local tree if they use
different base variable names, as the "flags" name itself is used for
many unrelated things.
2012-07-27 04:12:03 +03:00
Uoti Urpala 31458a51b5 vo_vdpau: disable refresh-aware frame timing when composited
Under a compositing window manager the current VDPAU implementation
behaves differently than without it. Frame flip timing info becomes
incorrect (I guess it only reflects when the frame was sent to the
compositor, not when it was actually shown), and there is no
limitation to at most one frame switch per refresh like without
compositing. Detect whether a compositing window manager is active and
disable refresh-aware frame timing and dropping in this case,
similarly to what fps=-1 would do. This behavior can be controlled
with the new suboption "composite-detect".

Disabling the refresh-aware logic makes timing somewhat less accurate.
Because the video switch rate limit isn't there, the lack of frame
dropping on player side does not impose a hard limit on video FPS, but
does reduce performance somewhat as redundant frames are drawn in
memory.

The existence of a compositing window manager does not guarantee that
the current window is actually composited, so the current check is not
foolproof. In particular, some WMs have support for a "unredirect
fullscreen windows" option. Support for such things could be improved.
2012-07-27 03:40:38 +03:00
Uoti Urpala adfa7bdfb2 options: support "no-foo" syntax for flag suboptions
Allow using "no-foo" as an alternative to "foo=no" for flag
suboptions, similarly to what top-level flag options already support.
This means things like "--lavdopts=no-fast" or
"--vo=vdpau:no-chroma-deint" are now supported.
2012-07-27 03:34:17 +03:00
Uoti Urpala 4d71fb7098 demux_lavf: use lavf for RealMedia (.rm) files by default
RealMedia was listed as a format for which the internal demuxer
(demux_real) was preferred over lavf. The original reason for this
(lavf failing to give any timing information for some video frames)
has been fixed in libavformat since. Make demux_lavf the preferred
demuxer for RealMedia.

The libavformat demuxer does still have issues. COOK audio initially
misbehaves after a seek (inconsistent timestamps, audio remaining from
the before-seek position). However, the internal demuxer seemed to be
_consistently_ out of sync with a test file. I haven't done thorough
testing, but the internal demuxer does not seem less buggy.
2012-07-26 18:32:09 +03:00
Uoti Urpala b7fb2daff4 vd_vfw.c: fix part missing from previous commit
vd_vfw.c was missing a change to rename field used from 'flags' to
'keyframe'. This broke compilation with 32-bit Windows codec support
enabled.
2012-07-26 17:46:44 +03:00
Uoti Urpala 8079f4ff82 demux, vd_ffmpeg: fix demux keyframe flag, set AV_PKT_FLAG_KEY
There was some confusion about the "flags" field in demuxer packets.
Demuxers set it to either 1 or 0x10 to indicate a keyframe (and the
field was not used to indicate anything else). This didn't cause
visible problems because nothing read the value. Replace the "flags"
field with a boolean "keyframe" field. Set AV_PKT_FLAG_KEY based on
this field in packets fed to libavcodec video decoders (looks like PNG
and ZeroCodec are the only ones which depend on values from demuxer;
previously this was hardcoded to true for PNG).

Make demux_mf set the keyframe field in every packet. This matters for
PNG files now that the demuxer flag is forwarded to libavcodec.

Fix logic setting the field in demux_mkv. It had probably not been
updated when adding SimpleBlock support. This probably makes no
difference for any current practical use.
2012-07-25 01:10:30 +03:00
Uoti Urpala 5f3c3f8c32 video, audio: use lavc decoders without codecs.conf entries
Add support for using libavcodec decoders that do not have entries in
codecs.conf. This is currently only used with demux_lavf, and the
codec selection is based on codec_id returned by libavformat. Also
modify codec-related terminal output somewhat to make it use
information from libavcodec and avoid excessively long default output.

The new any-lavc-codec support is implemented with codecs.conf entries
that invoke vd_ffmpeg/ad_ffmpeg without directly specifying any
libavcodec codec name. In this mode, the decoders now instead select
the libavcodec codec based on codec_id previously set by demux_lavf
(if any). These new "generic" codecs.conf entries specify "status
buggy", so that they're tried after any specific entries with
higher-priority status.

Add new directive "anyinput" to codecs.conf syntax. This means the
entry will always match regardless of fourcc. This is used for the
above new codecs.conf entries (so the driver always gets to decide
whether to accept the input, and will fail init() if it can't find a
suitable codec in libavcodec). Remove parsing support for the obsolete
codecs.conf directive "cpuflags". This directive has not had any
effect and has not been used in default codecs.conf since many years
ago.

Shorten codec-related terminal output. When using libavcodec decoders,
show the libavcodec long_name field rather than codecs.conf "info"
field as the name of the codec. Stop showing the codecs.conf entry
name and "vfm/afm" name by default, as these are rarely needed;
they're now in verbose output only. Show "VIDEO:" line at VO
initialization rather than at demuxer open. This didn't really belong
in demuxer code; the new location may show more accurate values (known
after decoder has been opened) and works right if video track is
changed after initial demuxer open.

The vd.c changes (primarily done for terminal output changes) remove
round-to-even behavior from code setting dimensions based on aspect
ratio. I hope nothing depended on this; at least the even values were
not consistently guaranteed anyway, as the rounding code did not run
if the video file did not specify a nonzero aspect value.
2012-07-24 09:01:47 +03:00
Uoti Urpala 65b24e46a1 core: fix attempt to get audio pts without audio
written_audio_pts() can be called even if no audio track is active (at
least through get_current_time() when there's no known video PTS).
This triggered a crash due to NULL dereference. Add a check to return
MP_NOPTS_VALUE if no audio track exists.

Also remove a questionable update_osd_msg() call from per-file
initialization code. The call was at a point where an audio track
might be selected but not properly initialized, possibly also causing
a crash if update_osd_msg() queries current position. I don't see any
reason why the call would have been needed; it should get called
anyway before OSD contents are actually used for the new file.
2012-07-17 23:28:19 +03:00
Uoti Urpala 2e8119be9a docs: delete outdated translated manpages/docs
Delete all manpages and XML documentation in languages other than
English. The XML documentation was badly out of date. The content of
translated manpages was somewhat out of date, and manpage formatting
will change to use reStructuredText instead of raw troff format. If
updated translations are created for some languages later, I think
it's better to maintain those outside the main repository.
2012-07-16 22:10:28 +03:00
Uoti Urpala d9c1577c4e Makefile: delete .d files in "clean" target too
Previously, .d files were only deleted by "distclean" target. I see no
reason why they should be kept by "clean". Delete them in that target
too.
2012-07-16 21:08:42 +03:00
Uoti Urpala 0a1fc392b4 vo_vdpau: fix possible crash after preemption
Preemption recovery code could change the vc->vdp pointer when
recreating the VDPAU device. However, some other code cached the value
of vc->vdp in local variables over calls to handle_preemption(), and
could then crash when using the stale value later. Make the device
creation code keep the same vc->vdp instead of freeing and
reallocating it, so that the old pointer value is never invalidated
now.
2012-07-16 21:08:42 +03:00
Uoti Urpala 2ba8b91a97 build, codec-cfg.c: simplify builtin codecs.conf handling
The player can read codec mapping (codecs.conf) from an external file
or use embedded defaults. Before, the defaults were stored in the
player binary in the form of final already-parsed data structures.
Simplify things by storing the text of the codecs.conf file instead,
and parse that at runtime the same way an external file would be
parsed.

To create the previous parsed form, the build system first compiled a
separate binary named "codec-cfg", which parsed etc/codecs.conf and
then wrote the results as a C data structure that could be compiled
into the program. The new simple conversion of codecs.conf into a C
string is handled by the new script TOOLS/file2string.py.

After removing the codec-cfg binary, HOST_CC is no longer used for
anything. Remove the --host-cc configure option and associated logic.

Also remove the codec2html and codec-cfg-test functionality. Building
those was already broken and nobody cared.

There was a broken 3-character-long "fourcc" entry in etc/codecs.conf.
This happened to be accepted before but triggered a parse error after
the changes. Remove the broken entry and make the parsing functions
explicitly test for this error.
2012-07-16 21:08:42 +03:00
Uoti Urpala 39a45c7a17 build: use python3 to generate some files previously in git
Some files used during build are generated with Python scripts in
TOOLS/. Before, the generated files were included in the git tree.
Start creating them at build time. This introduces a build-dependency
on python3.

The files in question are:
libvo/vdpau_template.c
libmpdemux/ebml_types.h
libmpdemux/ebml_defs.c
2012-07-16 21:08:42 +03:00
Uoti Urpala 86571435ba options: fix specifying string options without parameter
Specifying a string option with no parameter, as in "--dumpfile" with
no '=', erroneously set the corresponding variable to NULL. Fix this
to give an error about missing parameter instead.

Suboption parsing explicitly treated empty option values as if the
option had been specified with no value (no '='). Thus it was not
possible to specify empty strings as values. I think this behavior was
originally added only because of other limitations in the old
implementation. Remove it, so that suboptions now behave the same as
top-level ones in this regard.

Document the NULL-distinguishing property of bstrdup0() that the code
depends on, and also make bstrdup() behave consistently.
2012-07-16 21:08:42 +03:00
Uoti Urpala 9426c5f92a VO: implement shared option handling, use for vdpau
Add infrastructure that allows VOs to specify the suboptions they
take, and get the values directly parsed into their private struct.
The option functionality available with the new system is the same as
for top-level player options. Convert vo_vdpau to use the new system
instead of the old subopt_helper.
2012-07-16 21:08:42 +03:00
Uoti Urpala 48f0692ab9 options: make option struct the talloc parent of options
Allocate dynamically-allocated option values as talloc children of the
option struct. This will allow implementing per-object (VO etc)
options so that simply freeing the object will free associated options
too.

This doesn't change quite every allocation in m_option.c, but the
exceptions are legacy types which will not matter for new per-object
options.
2012-07-16 21:08:42 +03:00
Uoti Urpala dc2a4863af options: support parsing values into substructs
Add an alternate mode for option parser objects (struct m_config)
which is not inherently tied to any particular instance of an option
value struct. Instead, this type or parsers can be used to initialize
defaults in or parse values into a struct given as a parameter. They
do not have the save slot functionality used for main player
configuration. The new functionality will be used to replace the
separate subopt_helper.c parsing code that is currently used to parse
per-object suboptions in VOs etc.

Previously, option default values were handled by initializing them in
external code before creating a parser. This initialization was done
with constants even for dynamically-allocated types like strings.
Because trying to free a pointer to a constant would cause a crash
when trying to replace the default with another value, parser
initialization code then replaced all the original defaults with
dynamically-allocated copies. This replace-with-copy behavior is no
longer supported for new-style options; instead the option definition
itself may contain a default value (new OPTDEF macros), and the new
function m_config_initialize() is used to set all options to their
default values. Convert the existing initialized dynamically allocated
options in main config (the string options --dumpfile, --term-osd-esc,
--input=conf) to use this. Other non-dynamic ones could be later
converted to use this style of initialization too.

There's currently no public call to free all dynamically allocated
options in a given option struct because I intend to use talloc
functionality for that (make them children of the struct and free with
it).
2012-07-16 21:08:42 +03:00
wm4 2793e7eb70 Merge remote-tracking branch 'origin/master' 2012-05-20 11:42:44 +02:00
Uoti Urpala f63dbaddb6 font_load_ft.c: fix possible crash with recent Fontconfig
Calling FcFontMatch with last argument NULL triggers an assertion
failure in latest libfontconfig (2.9.0). Change the code to use a
dummy address, like another nearby call to FcFontMatch already did.

Whether the code triggering the assertion failure was run depended on
font settings and/or available system fonts (the code looks like you'd
have to get a non-scalable font first). Thus it didn't usually happen
even with problematic libfontconfig version.
2012-05-17 17:38:00 +03:00