Commit Graph

32727 Commits

Author SHA1 Message Date
Uoti Urpala 6d65f6889a vf_vo: fix EOSD change detection bug
vf_vo had code setting its prev_visibility variable correctly, then a
line that overrode the value just set with an incorrect one. Remove
the wrong extra line. As a result of the bug the "contents changed"
indicator wasn't forced to true when switching from a subtitle track
to "no track" and then back. A visible effect was at least that a
currently visible static subtitle disappeared when doing that switch
back and forth.
2011-01-18 16:54:52 +02:00
Uoti Urpala 7bb10e7ce2 sd_ass: remove subreader use, support plaintext markup
Originally, when rendering plaintext subs with libass, the subtitles
were first converted to the "struct subtitle" form with sub_add_text()
and then from that to libass events. Change sd_ass to convert the
subtitles directly to libass events without using the old sub
machinery. The new conversion at least fixes some timing issues. Also
use the markup support added in the previous commit, so that
HTML-style markup is also supported in "plaintext" subs rendered with
libass.
2011-01-18 15:33:36 +02:00
Uoti Urpala 4284cf9ef0 subtitles: style support for common SubRip tags and MicroDVD
SubRip subtitles have no "official" spec for any styling support, but
various tags are in common use; previous code filtered out text
between <> to remove HTML-style tags. Add support for those tags and
for MicroDVD subtitle styling. The style display is implemented by
converting the subtitles to the ASS subtitle format and displaying
them with libass, so libass needs to be enabled.

Original patch by Clément Bœsch <ubitux@gmail.com>.
2011-01-18 15:17:28 +02:00
Uoti Urpala d5eaf6a820 core: ordered chapters: fix bad subtitle parameter
mp_property_do() takes the value to set a property to through a
pointer. The calling code used '&mpctx->global_sub_pos' as the
pointer; however that variable could be changed during the
mp_property_do() call. Use a pointer to a copy of the original value
instead.

I think this only caused problems if you switched subtitle tracks from
a real one to "disabled" and then switched to a timeline part from
another source.
2011-01-18 14:58:09 +02:00
Uoti Urpala b86c9e5922 subs/demux: don't try to enable sub track when creating it
demuxer.c new_sh_sub_sid() tried to immediately select the created sub
track for playback if its id matched the "-sid" option value. This was
buggy, as more initialization is needed to properly enable subtitles.
Normally the correct track to play is selected after the demuxer has
been created. It's possible that some DVD use case or such depended on
the removed code to make -sid work with a subtitle track that's not
found at start and only added later (vobsubs probably would start
playing without separate initialization); if so then that needs to be
fixed later in a different way.
2011-01-18 14:58:09 +02:00
Uoti Urpala 8e7dae173d subtitles/demux: store duration instead of endpts in demux packets 2011-01-18 14:58:09 +02:00
Uoti Urpala e990fb2ffe subtitles: add framework for subtitle decoders
Add a framework for subtitle decoder modules that work more like
audio/video decoders do, and change libass rendering of demuxed
subtitles to use the new framework.

The old subtitle code is messy, with details specific to handling
particular subtitle types spread over high-level code. This should
make it easier to clean things up and fix some bugs/limitations.
2011-01-18 14:58:09 +02:00
Uoti Urpala 37b756bb70 cleanup: mp_msg.h: simplify mp_dbg definition
There's no need to define the mp_dbg macro differently for the
__GNUC__ and general case.
2011-01-18 00:21:14 +02:00
Uoti Urpala a4f687e1f0 cleanup: mplayer.c: use VFCAP_ names instead of numeric values 2011-01-17 16:31:45 +02:00
Uoti Urpala 757e43c3f8 demux: add sanity checks to packet allocation functions
Change new_demux_packet() and resize_demux_packet() length parameter
type from int to size_t and add a check to abort() if the size is over
1 GB. This should make integer overflow problems leading to memory
corruption in demuxers less likely; and aborting should be no worse
than insane memory consumption. Also make the functions abort() if the
actual allocation fails instead of trying to continue with a
zero-sized buffer.
2011-01-17 16:16:39 +02:00
Uoti Urpala e342a81d6f cleanup: move demux packet functions from demuxer.h to demuxer.c
There's no reason why the demux packet functions would need to be
inlined, so move them from the header to the .c file.
2011-01-17 15:47:57 +02:00
Uoti Urpala 8636eb77c5 options: add special -leak-report option
Add a special option "-leak-report" that enables talloc leak
reporting.  It only works if it's given as the first argument.

The code abuses the CONF_TYPE_PRINT option type to make main option
parsing ignore the option. The parser incorrectly consumed the
following commandline argument as a "parameter" for options of this
type when they had the flag to not exit after printing the message.
Fix this. It makes no difference for any previously existing option I
think.
2011-01-15 22:36:27 +02:00
Uoti Urpala ac79632ded subtitles: remove code trying to handle text subs with libavcodec
The avsub implementation tries to fall back to MPlayer's other text
subtitle decoding if libavcodec returns text as the 'decoded'
subtitle. The code implementing this is buggy, and as far as I can see
it should not be triggered normally (libavcodec decoding is only
used for xvid, pgs and dvb subtitles, and for those libavcodec should
return bitmaps). Remove the buggy code (don't try to support
non-bitmap results) and simplify things a bit.
2011-01-15 18:45:43 +02:00
Uoti Urpala e9022ec470 cleanup: move MP_NOPTS_VALUE definition to mpcommon.h 2011-01-15 18:45:43 +02:00
Uoti Urpala adedee4285 subtitles: move global ass_track to struct osd_state 2011-01-15 18:45:43 +02:00
Uoti Urpala 43b1de1dd7 core: move most mpcommon.c contents to mplayer.c
The contents of mpcommon.c were quite arbitrary; the most common
reason to place some functions in this file had been "MEncoder happens
to need similar code as MPlayer and we want to share some parts, but
we have no clue whatsoever how to organize things in a sensible way,
so we'll just dump those parts we want to share in mpcommon.c". As a
result of containing an essentially random subset of top-level player
functionality the mpcommon.h header required access to central structs
and was unsuitable for inclusion in lower-level code, but was
nonetheless included there for the mplayer_version symbol.

Move almost all contents from mpcommon.c to mplayer.c. mplayer.c is
already big and should perhaps be split further, but keeping a few
random functions in mpcommon.c would not be an improvement.
2011-01-15 18:45:43 +02:00
Uoti Urpala a1692437d0 core: move global "subdata" and "vo_sub_last" to mpctx 2011-01-11 17:55:05 +02:00
Uoti Urpala f95674fb6c subtitles: remove sub_last_pts hack
This code was probably added because of bad pts handling in old timing
code, and should not be needed any more.
2011-01-11 17:38:15 +02:00
Uoti Urpala b26fbeddd8 options: move -noconfig to option struct, simplify 2011-01-11 17:28:10 +02:00
Clément Bœsch 0b59e33b4e manpage: Remove forgotten "MPlayer only" notes 2011-01-09 17:00:19 +02:00
Clément Bœsch 6acc1bf4f0 manpage: Remove "MPlayer only" notes 2011-01-06 18:11:10 +02:00
Uoti Urpala 30445e2fa4 vo_vdpau: allow "deint=-N" to specify mode without enabling deint
Allow negative values of the "deint" parameter and make them select
the same deinterlacing mode as the corresponding positive value, but
without enabling deinterlace on startup. This is useful for
configuration files. Also tweak the overall manpage description of
vo_vdpau a bit to make it sound less as if the VO would be for
hardware acceleration only.
2011-01-04 23:51:31 +02:00
Uoti Urpala 30c5994382 core: add timing workaround for PulseAudio misbehavior
PulseAudio could keep reporting high delay values after a reset of
playing audio. This broke playback after seeking in some cases. Add a
workaround that should make things more robust against such
misbehavior.
2011-01-01 05:37:28 +02:00
Clément Bœsch d76ad5f227 manpage: Remove MEncoder references 2010-12-25 15:36:44 +02:00
Uoti Urpala 798a308d97 core: fix audio-only + framestep weird behavior
Trying to do a framestep while playing an audio-only file would play
the file until the end, then start the next file in paused state. Make
framestep state enter pause again immediately if there is no video.
Also reset framestep state when switching files.
2010-12-20 19:38:54 +02:00
Uoti Urpala 0afb326035 Merge branch 'hr-seek'
* hr-seek:
  input: add default keybindings Shift+[arrow] for small exact seeks
  input: support bindings with modifier keys for X input
  core: audio: make ogg missing audio timing workaround more complex
  core: add support for precise non-keyframe-limited seeks
  core: add struct for queued seek info
  commands: add generic option -> property wrapper
  options: add "choice" option type, use for -pts-association-mode
  core: remove looping in update_video(), modify command handling a bit
  core: seek: use accurate seek mode with audio-only files
  core: avoid using sh_video->pts as "current pts"
  libvo: register X11 connection fd in input event system
  core: timing: add special handling of long frame intervals
  core: move central play loop to a separate function

Conflicts:
	DOCS/tech/slave.txt
2010-12-20 19:17:43 +02:00
Uoti Urpala 5bb2f9787f input: add default keybindings Shift+[arrow] for small exact seeks 2010-12-20 19:02:24 +02:00
Uoti Urpala 67fd58d6f0 input: support bindings with modifier keys for X input
Add support for binding commands to modifier+key combinations like
"Shift+Left" or "Ctrl+Alt+x", and support reading such combinations
from the output window of X VOs.

The recognized modifier names are Shift, Ctrl, Alt and Meta. Any
combination of those and then a non-modifier key name, separated by
'+', is accepted as a key name in input.conf. For non-special keys
that produce characters shift is ignored as a modifier. For example
"A" is handled as a key without modifiers even if you use shift to
write the capital letter; 'a' vs 'A' already distinguishes the
combinations with a normal keymap, and having separate 'a', 'Shift+A'
and 'A' (written with caps lock for example) would bring more
confusion than benefit.

Currently reading the modifier+key combinations is only supported in
the output window of those VOs that use x11_common.c event
handling. It's not possible to input the key combinations in other VOs
or in a terminal window.
2010-12-20 19:02:24 +02:00
Uoti Urpala b4564c2d4f core: audio: make ogg missing audio timing workaround more complex
After the addition of exact seeking the code to work around missing
audio timestamps with ogg/ogm needs improvement. Now it's normal to
need adjustment at stream start time 0 (seeking to a position after
start of video but before second keyframe) with any video format, and
for exact seeks with ogg it's now more important not to skip the
sync. Make the check to detect the problem case more precise to avoid
affecting most other formats, and try to decode a second of audio
(hoping to get timestamps for those packets) before giving up.
2010-12-20 19:02:24 +02:00
Uoti Urpala f0649f13d6 core: add support for precise non-keyframe-limited seeks
Add support for seeking to an arbitrary non-keyframe position by
decoding video starting from the previous keyframe. Whether to use
this functionality when seeking is controlled by the new option
-hr-seek and a new third argument to the "seek" command. The default
is to use it for absolute seeks (like chapter seeks) but not for
relative ones. Because there's currently no support for cutting
encoded audio some desync is expected if encoded audio passthrough is
used. Currently precise seeks always go to the first frame with
timestamp equal to or greater than the target position; there's no
support for "matching or earlier" backwards seeks at frame level.
2010-12-20 19:02:16 +02:00
Uoti Urpala 23f598e0ee core: add struct for queued seek info
To prepare for the addition of exact seek support, add a struct for
queued seek state and a helper function to update its state. It would
have been cumbersome to update additional state (showing whether the
seek is forced to be exact or non-exact) manually at every point that
handles seeks.
2010-12-20 19:02:14 +02:00
Uoti Urpala 4a26b4c024 cosmetics: remove unused code, small formatting tweaks 2010-12-20 06:42:04 +02:00
Uoti Urpala 835d3deea2 commands: clean up get_metadata() and related code
Code in get_metadata() allocated too small a buffer for the text it
wrote (noticed by Clément Bœsch). Make the code cleaner and more
robust by changing it to use talloc_asprintf(). Also make it always
return non-NULL and remove checks on caller side.
2010-12-20 06:34:11 +02:00
Uoti Urpala 2bc2399797 vd_ffmpeg: set thread count to number of cores on machine by default
Make "-lavdopts threads=0" mean an autodetected number of threads, and
make that the default value of the option. Also increase the upper
limit of the option from 8 to 16. Add new file osdep/numcores.c which
tries to determine the number of cores available on the machine.

numcores.c is based (heavily modified) on public domain numcpus.c by
Philip Willoughby <pgw99@doc.ic.ac.uk>, downloaded from
http://csgsoft.doc.ic.ac.uk/numcpus/
2010-12-20 05:53:28 +02:00
Uoti Urpala 1cf4802c1d demux_mkv: remove old code for -nocorrect-pts support
There should be no reason for anyone to use demux_mkv in
-nocorrect-pts mode any more, so delete the code used for that.
2010-12-20 03:14:43 +02:00
Uoti Urpala 042ab4feb5 demux_mkv: fix seeks to before the first index entry
Make seeks backward from a time before the first index entry go to the
first entry instead of failing completely. This change doesn't affect
behavior for most files, because seeks are clamped to 0 from below and
normally files have the first index entry at 0.
2010-12-20 02:26:10 +02:00
Uoti Urpala 74ac4d10a4 DOCS/tech/slave.txt: update some obsolete information
Update obsolete information based on old pause behavior. Remove
mention of old GUI-specific commands.
2010-12-18 12:38:45 +02:00
Uoti Urpala b9a3579ec9 commands: add generic option -> property wrapper
Add mp_property_generic_option(), a property function that can be used
for generic option-based properties that do not require any action
beyond manipulating the value of the option variable. Currently it
directly implements GET and SET, plus STEP_UP for "choice" options
only. Use it to add a property for -pts-association-mode (not
particularly useful in normal use, but serves as a test).
2010-12-18 11:59:09 +02:00
Uoti Urpala 7e366113f7 options: add "choice" option type, use for -pts-association-mode
Add a "choice" option type. Options of this type take a string as
input and set an int option variable to the value corresponding to the
string. The string->int mapping is option-specific and is given in the
option definition. Strings not found in the mapping are rejected as
invalid option values.

Change the option -pts-association-mode to use this new option type
and accept values "auto, decoder, sort" instead of "0, 1, 2". The
change in accepted values shouldn't cause problems as this option is
not appropriate to use in normal user config files.
2010-12-18 10:14:25 +02:00
Uoti Urpala 00c2bafb0a core: remove looping in update_video(), modify command handling a bit
Let higher-level code call update_video() again instead of looping
inside it until there's a frame ready to show. Change the conditions
for running user commands somewhat. Overall effect shouldn't be that
big. Now other commands can be executed after a seek before a video
frame is decoded; in this case the seek target time may be used as the
"current position".
2010-12-16 20:04:34 +02:00
reimar 14059eca7a demux_asf: Add a missing free to ASF demuxer close
Fixes bug #1238.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32711 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:24:25 +02:00
reimar 937b086606 playtreeparser.c: Add playlist parser for .nsc files
Tested to properly decode .nsc files, but not properly tested since
no publically available stream could be found.

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

Remove pointless NULL checks before free.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32715 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:53 +02:00
compn 597dc5a388 example.conf: add some profile information and user-agent examples
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32709 b3059339-0415-0410-9bf9-f77b7e298cf2

add realplayer user-agent

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

add winamp useragent example

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32713 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 21367beef1 demux_mov: fix possible hang on invalid input
len < 8 is also invalid for 64-bit codec chunk size.
Previous code could cause hang.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32708 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 7e24b8edb4 aviheader.c: avoid using uninitialized data in an error case
Avoid using uninitialized data if index read does not return enough data.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32707 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 05fa96c6dc ad_faad: fix crash when used on an empty audio stream
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32706 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar c11757c5af ad_speex: improve timestamp handling
Improve speex codec pts handling, make audio timestamps work reasonably
even with the native demuxer as long as seeking is not done.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32704 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar fbd28ae939 demux_mov: fix some memory allocation handling
Always free before overwriting a pointer with a newly allocated one,
always use calloc instead of realloc when the previous data is not
needed.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32703 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar eb5765e96a stream.h: check against huge negative values in stream_seek()
Add validity check for stream_seek argument to avoid a integer
overflow for huge negative values that would break the internal state
of the stream buffer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32702 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 7ed3291a4f demux_gif: Fix memleaks on error
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32701 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00