Commit Graph

33295 Commits

Author SHA1 Message Date
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
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
Stefano Pigozzi 95438e54b8 configure: OSX: fix check for compiler-specific cflags
The configure script adds some compiler-specific flags for GCC on OSX.
This was done under a check for compiler binary name not being clang.
Move the test to after $cc_vendor has been determined and check
against that instead.

The previous test worked for clang if you explicitly specified
--cc=clang, but not if the default system "cc" command was used and
mapped to clang. Recent versions of Xcode changed the default compiler
(cc) to clang. This caused a lot of spam from clang, which complained
about the unknown flags when compiling with no explicit --cc option.
2012-05-17 17:22:55 +03:00
Stefano Pigozzi de1e483397 configure: don't enable GL/X11 without X11
The OpenGL autodetection checked for all backends regardless of which
features had been enabled previously. Stop checking for X11 backend if
X11 support is disabled, and stop checking for w32 backend if we are
not on Windows.

This makes the changes in commit 3862d469ae ("configure: OSX: check
for X11 header conflict with corevideo") work as intended. That commit
disabled X11 when a header conflict was detected, but the GL X11
backend could still be autodetected despite that and trigger a
compilation failure.
2012-05-17 17:21:57 +03:00
Uoti Urpala f9beb08a61 core: fix EOF handling with untimed audio outputs
When using an audio output without a native playback rate (such as
ao_pcm), the code plays audio further when the current write position
is behind video. After support for continuing audio after the end of
video was added, this could cause a deadlock: audio was not played
further, but neither was EOF triggered. Fix the code to properly
handle playback of remaining audio after video ends in the untimed
audio case (audio-only case was not affected, only the case where a
video stream exists but ends before the audio stream).
2012-05-14 13:38:16 +03:00
Uoti Urpala 1e90a8657d options: simplify option parsing/setting machinery
Each option type had three separate operations to copy option values
between memory locations: copy between general memory locations
("copy"), copy from general memory to active configuration of the
program ("set"), and in the other direction ("save"). No normal option
depends on this distinction any more. Change everything to define and
use a single "copy" operation only. Change the special options
"include" and "profile", which depended on hacky option types, to be
special-cased directly in option parsing instead. Remove the now
unused option types m_option_type_func and m_option_type_func_param.
2012-05-08 20:19:32 +03:00
Uoti Urpala 9fbfac25da options: change -v parsing
Handle -v flags as a special case in command line preparsing stage,
and change the option entry into a dummy one. Specifying "v" in config
file no longer works (and the dummy entry shows an error in this
case); "msglevel" can still be used for that purpose. Because the flag
is now interpreted at an earlier parsing stage, it now affects the
printing of some early messages that were only affected by the
MPLAYER_VERBOSE environment variable before.

The main motivation for this change is to get rid of the last
CONF_TYPE_FUNC option.
2012-05-07 23:51:58 +03:00
Uoti Urpala c02d0ee703 options: change --input=keylist, cmdlist implementation
Change the --input=keylist and --input=cmdlist suboptions to use the
"print function" option type. This changes their semantics somewhat,
and now some other output can appear after the printed lists (before,
they called "exit(0)" directly). I'm not aware of any program parsing
the output which could be affected.
2012-05-07 23:21:23 +03:00
Thomas Orgis 9bf03e8b65 ad_mpg123: update libmpg123 API use
Improve ad_mpg123, including use of the more efficient framewise
decoding with mpg123 version 1.14 or later (older versions are still
supported).
2012-05-07 01:10:25 +03:00
Uoti Urpala 10d4795ed9 configure: use pkg-config for vdpau, libmpg123, libbluray 2012-05-06 19:09:38 +03:00
Uoti Urpala e5f8ab3bca ao_arts, ao_esd: remove these AOs
Delete ao_arts and ao_esd. Both have been deprecated upstream.
2012-05-06 18:29:48 +03:00
Uoti Urpala 3076dd8199 build: remove IRIX support 2012-05-06 18:22:34 +03:00
wm4 cd21ce3779 ao_portaudio: add new PortAudio audio output driver
This AO has potential to be useful on platforms other than Linux. On
Windows in particular, PortAudio can make use of newer/better audio
APIs like WASAPI, instead of DirectSound.

As an implementation choice, the PortAudio callback API was used. The
blocking API might be a better match for mplayer's requirements, but
caused severe problems on Linux/ALSA (possibly PortAudio bugs).
2012-05-06 17:57:44 +03:00
Uoti Urpala bb90802717 ao_pulse: fix specifying host/sink after 4fed8ad197
Commit 4fed8ad197 ("ao_pulse: convert to new AO API") failed to change
the variable name used on one line in suboption handling. This caused
a crash due to NULL dereference if you tried to specify any suboptions
for the AO (as in "--ao=pulse:foo"). Fix.
2012-05-03 23:45:57 +03:00
Martin Herkt f64a4e9931 win32: get_path(): fix undefined behavior
MSWindows-specific code in get_path() declared a stack array
(exedir[]) in an inner scope, then kept a reference to the array
beyond the end of the that scope. Fix. This caused visible breakage
with GCC 4.7.
2012-04-28 21:47:53 +03:00
wm4 66e0426907 stream_cdda: print CDTEXT if available
The per-CD info will be printed on playback start, per-track info when
a track is played. (This is not a technical restriction, and just goes
along with the existing code.)

The following fields are not included in output, because these are
supposedly binary: CDTEXT_DISCID, CDTEXT_GENRE, CDTEXT_SIZE_INFO,
CDTEXT_TOC_INFO, CDTEXT_TOC_INFO2.
2012-04-28 03:25:04 +03:00
wm4 35d932edf2 configure, stream_cdda: remove libcdparanoia support
libcdparanoia is barely developed anymore, while libcdio is still quite
active.
2012-04-28 03:06:17 +03:00
wm4 be374dc653 cosmetics: stream_cdda.c: reformat 2012-04-28 03:05:09 +03:00
reimar 61c2365dd8 stream_cdda: various fixes
Fix cdda speed default value, range and use more robust condition.

Based on patch by Ingo Brückl [ib wupperonline de].

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34458 b3059339-0415-0410-9bf9-f77b7e298cf2

Do not call paranoia_overlapset with 0, it actually causes cdparanoia to just hang.
Instead use it to set/unset PARANOIA_MODE_OVERLAP.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34459 b3059339-0415-0410-9bf9-f77b7e298cf2

Fail if trying to seek beyond the last chapter, not just if it is beyond the end of the disc.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34460 b3059339-0415-0410-9bf9-f77b7e298cf2

cdda: set position to an actual EOF position when we set EOF.

This avoids some inconsistency like the stream indicating EOF but
a read still returning more data.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34462 b3059339-0415-0410-9bf9-f77b7e298cf2

Allow PARANOIA_MODE_FULL with skipping.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34467 b3059339-0415-0410-9bf9-f77b7e298cf2

Don't call paranoia_modeset() for PARANOIA_MODE_DISABLE.

cdparanoia destroys start sector information after such a call.

Since it is pointless without setting a mode anyway, don't do it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34468 b3059339-0415-0410-9bf9-f77b7e298cf2

Add comment to a condition that is just a hack around a cdparanoia bug.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34472 b3059339-0415-0410-9bf9-f77b7e298cf2

Add checks for errors in stream_cdda's get_track_by_sector().

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34495 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix seeking beyond EOF in stream_cdda to work with cache.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34577 b3059339-0415-0410-9bf9-f77b7e298cf2
2012-04-28 03:05:04 +03:00
Stefano Pigozzi 4251af8d5d cocoa_common: fix problems with alt-tab window changes
Fix alt tabbing to another window in the same workspace. The player
window stayed on top because of a missing call to orderBack:.

Fix alt tabbing to the player window from a different workspace. The
window didn't get activated. Turns out that you must call
makeKeyAndOrderFront: before setLevel: or setPresentationOptions: or
the window will not properly ask for focus.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 3862d469ae configure: OSX: check for X11 header conflict with corevideo
Check that headers from ApplicationServices and X11 do not conflict
before enabling X11 support on OSX. Both headers would be included in
vo_corevideo.m (through QuartzCore/QuartzCore.h and gl_common.h). The
conflict exists on versions of Mac OSX prior to 10.7, where
ApplicationServices includes the deprecated QuickDraw framework,
resulting in a clash on the Cursor type definition.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 9489e29c47 Makefile: fix OSX compilation with --disable-corevideo
cocoa_common.m (enabled under COCOA) depends on osx_common.c, but the
latter was erroneously only enabled under COREVIDEO.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi d3da92aea4 cocoa_common, gl_common: add OSX specific getProcAddress
Run dlopen on the OpenGL dynamic library instead of on the binary.
This should prevent crashes due to function conflicts when X11/lGL is
linked.

Remove mutual exclusion of the X11 and Cocoa backends.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 86790494d3 OSX, input: implement wakeup in response to Cocoa events
Add code to wake up the select() call in input.c when an OSX event is
available and a Cocoa OpenGL backend is initialized.

Fixes the slow response to input or other events in Cocoa-based VOs
during long select() sleeps (e.g., when mplayer2 is paused) introduced
by commit 7040968.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 9646208cc6 vo_sharedbuffer: add this video output
This OSX video output is replaces the previous shared_buffer mode of
vo_corevideo. It manages a shared buffer and a Cocoa distributed
object to communicate with GUIs.

Splitting this code into a separate VO allows to get rid of harmful
code coupling, performance inefficiencies (useless image memory
copies) and ugly code (big if-else conditionals).
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 768e06b0ac vo_corevideo: restructure this video output
Restructure this video output to be similar to vo_gl, even if simpler
and less feature complete (for example it's still missing EOSD
support). Ideally, it should act as a decent fallback in the case
where something breaks in the OSX support of vo_gl.

Here's a summary of what changed:

 * Remove the shared buffer code since it wasn't using any function
   from the CoreVideo API. Moreover, its presence in vo_corevideo was
   forcing the non-GUI related code to perform more image copies than
   necessary. Equivalent shared-buffer functionality will be added in
   a separate new VO in the next commit (this means OSX GUIs will need
   to specify a different VO).

 * Clean up the code to conform a bit more to the mplayer2
   conventions. Enforce 80 column wrapping, use a private struct for
   file variables, use the new libvo api.

 * Add OSD rendering using OpenGL instead of writing directly on the
   video image data.

 * Simplify the logic for the rendering function when dealing with
   panscan.

 * Add VOCTRL_REDRAW_FRAME support.

 * Add colormatrix support by using the built-in API provided by
   CoreVideo.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi d12b9b611a vo_corevideo: use cocoa_common to display the window
Change vo_corevideo to use cocoa_common to create and manage the
window. This doesn't affect external OSX GUIs, since they don't use
vo_corevideo window management, but only read the image data from the
shared buffer.
2012-04-26 21:03:10 +03:00
Stefano Pigozzi 237f44db44 vo_corevideo: use soft tabs (4 spaces) 2012-04-26 21:03:10 +03:00
Uoti Urpala 9ba3e1ddb2 win32: core: wake up more often to poll for input
MSWindows does not have properly working support for detecting events
on file descriptors. As a result the current mplayer2 code does not
support waking up when new input events occur. Make the central
playloop wake up more often to poll for events; otherwise response
would be a lot laggier than on better operating systems during pause
or other cases where the process would not otherwise wake up.
2012-04-26 21:03:02 +03:00
Uoti Urpala ab6c760b3b core: change initial sync with --delay, video stream switch
Make A/V sync at the start of playback with nonzero --delay behave the
same way as it does when seeking to the beginning later, meaning video
plays from the start and audio is truncated or padded with silence to
match timing. This was already the default behavior in case the
streams in the file started at different times, but not if the
mismatch was due to --delay. Trigger similar audio synchronization
when switching to a new video stream. Previously, switching a video
stream on after playing for some time in audio-only mode was buggy and
caused initial desync equal to the duration of prior audio-only
playback.
2012-04-23 22:41:02 +03:00
Uoti Urpala b255b5ad32 core: uninitialize VO and AO when no track plays
Uninitialize video and audio outputs when switching to a file without
a corresponding track (audio-only file / file with no sound), or when
entering --idle mode. Switching track choice to "off" during playback
already did this.

It could be useful to have a mode where the video window stays open
even when no video plays, but implementing that properly would require
more than just leaving the window on screen like the code did before
this commit.
2012-04-23 22:40:57 +03:00
Uoti Urpala e48c6f446c configure: --enable-debug: don't change other compiler flags
The --enable-debug and --enable-profile options set their own compiler
flags, completely different from normal flag selection. These flags
sucked; especially '-W' (an obsolete alias for '-Wextra') generated a
huge number of irrelevant warnings. Change configure to only add "-g"
or similar to the flags that would be used otherwise.
2012-04-19 17:05:50 +03:00
Uoti Urpala deffd15a05 ad_ffmpeg: switch to avcodec_decode_audio4()
Switch libavcodec audio decoding from avcodec_decode_audio3() to
avcodec_decode_audio4(). Instead of decoding directly to the output
buffer, the data is now copied from the libavcodec output packet,
adding an extra memory copy (optimizing this would require some
interface changes).

After libavcodec added avcodec_decode_audio4() earlier, it dropped
support for splitting large audio packets into output chunks of size
AVCODEC_MAX_AUDIO_FRAME_SIZE or less. This caused a regression with
the previous API: audio files with huge packets could fail to decode,
as libavcodec refused to write into the AVCODEC_MAX_AUDIO_FRAME_SIZE
buffer provided by mplayer2. This occurrend mainly with some lossless
audio formats. This commit restores support for those files; there are
now no fixed limits on packet size.
2012-04-19 01:42:30 +03:00
Uoti Urpala b9fefc87c0 stream_ffmpeg: fix broken line from 30afc64532
Commit 30afc64532 ("stream_ffmpeg: switch to libavformat avio
API") somehow contained a nonsense line which broke the control()
function. Fix. Also add avformat_network_init() to central libav
initialization code to avoid warnings.
2012-04-18 01:27:55 +03:00
Uoti Urpala 81eb911763 subassconvert: make subrip attribute parsing more robust
Add general code to separate the HTML-like attribute=value syntax used
in srt font tags into attribute and value parts. This simplifies some
of the parsing code, makes detection of malformed input more robust,
and allows warning about unrecognized attributes.
2012-04-17 02:43:15 +03:00
wm4 f0ce95607f subassconvert: handle unquoted attributes in subrip font tags
Previously, mplayer didn't convert tags like <font color=#00FF00>. But
such subtitles exist in the wild, and should be handled.
2012-04-17 01:27:22 +03:00
Uoti Urpala aadf1002f8 screenshot: fix dependency on sizeof(AVFrame)
The AVFrame data structure may be extended at the end in new
binary-compatible libavcodec versions. Therefore applications should
not depend on the size of the structure. But screenshot.c declared an
"AVFrame pic;" on stack. Change the code to allocate an AVFrame with
avcodec_alloc_frame() instead. The frame is now stored in struct
screenshot_ctx (rather than reallocated each time).
2012-04-15 17:48:12 +03:00
Uoti Urpala b711624ef3 subs: only use "subfont.ttf" as libass fallback if it exists
Libass was set to use the file "subfont.ttf" in the user configuration
directory as a default/fallback font. This triggered "Error opening
font" errors from libass if it tried to use the fallback font for some
glyph and the user had not copied/linked any font there (and there is
generally little reason to do that nowadays when using fontconfig).
Check whether the path exists and only set it in ass_set_fonts() if it
does.
2012-04-14 03:51:19 +03:00
Uoti Urpala 4680beb6dc demux_lavf: try harder to make up a frame rate
Frame rate information is mostly irrelevant for playback, but it's
needed at least to convert frame numbers used in some subtitle formats
(like MicroDVD) into timestamps. Libavformat stopped making up a frame
rate if no "reliable" information is available (commit 7929e22bd
"lavf: don't guess r_frame_rate from either stream or codec timebase",
1.5 months ago). This caused a regression with AVI files and MicroDVD
subtitles. Add a heuristic similar to what libavformat used to have,
to make up FPS values which should work at least for the AVI+MicroDVD
use case.
2012-04-14 03:27:53 +03:00
Uoti Urpala 74ad0b4284 stream_pvr: fix field size / snprintf size mismatch
struct station_elem_s had a field "name[8]", but the rest of the code
used PVR_STATION_NAME_SIZE as field size in snprintf and some other
calls accessing the field. Change the field size to
PVR_STATION_NAME_SIZE so it matches the accesses.
2012-04-11 03:56:30 +03:00
wm4 086d0381f0 ao_coreaudio: fix partial volume control
If digital pass-through is used, this supported setting the volume
(just mute, actually), but not getting the volume. This will probably
lead to a stuck mute state in the mplayer frontend. Make the code
respond to volume queries even if digital pass-through is used.
2012-04-11 03:56:30 +03:00