Commit Graph

32543 Commits

Author SHA1 Message Date
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 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
Uoti Urpala de3be1d9ca core: seek: use accurate seek mode with audio-only files
Allow more accurate absolute-only seeks even if there is no video.
2010-12-14 22:33:55 +02:00
Uoti Urpala ff706ee86d core: avoid using sh_video->pts as "current pts"
Add a new field "video_pts" to mpctx. It records the time of the last
frame flipped visible on VO. Change various code which used
sh_video->pts to use either the new field or get_current_time(mpctx).
2010-12-14 22:33:12 +02:00
Uoti Urpala 4f610adfc2 libvo: register X11 connection fd in input event system
Register the X11 connection fd in the input system so that
mp_input_get_cmd() can immediately wake up and handle keyboard or
other X events. The callback calls vo_check_events() and tells the
input system to handle any input possibly recorded during that. Before
this was done for vo_xv only; this commit generalizes it to all VOs
that call vo_x11_create_vo_window() - those are hopefully ones that
will handle all X events in check_events().

The callback is only kept registered while the vo is properly
configured. At other times calling check_events() would not clear
pending input and so could lead to a busy loop.
2010-12-14 22:33:12 +02:00
Uoti Urpala 2ba074e613 core: timing: add special handling of long frame intervals
Add separate handling for the case where the time to flip the next
frame on the VO is more than 50 ms away. In that case don't update OSD
contents yet, but wait for possible changes until 50 ms before the
frame. Sleep until that time in mp_input_get_cmd(), so the sleep is
done in select() and input events can be responded to immediately.
Also raise the limit on audio out delay used to limit sleep.
2010-12-14 22:33:11 +02:00
Uoti Urpala 188fbb6622 core: move central play loop to a separate function 2010-12-13 21:12:49 +02:00
Uoti Urpala 387326e54b vo_vdpau: remove wrong mp_image usage_count change (no visible effect)
The wrong variable was used as a function argument, and as a result
the code modified the usage_count field of non-refcounted mp_image
types. This error did not have any effect on visible behavior as no
code cares about the field value in the affected case.
2010-12-13 18:50:22 +02:00
Uoti Urpala cc2d748b73 audio: FLAC: support new libavcodec parser, use lavf to demux
Parse FLAC data with new libavcodec parser if needed. Use libavformat
demuxer for raw FLAC files by default.
2010-12-09 02:50:17 +02:00
Uoti Urpala 102b240e96 ao_pcm: change message to mention "-novideo" instead of "-vc null"
-novideo is the right way to disable video, and should also work in
more cases now that lavf is used as the default demuxer for more formats
(like AVI; internal AVI demuxer fails with -novideo).

Also change the man page description of -novideo a bit to make it
sound less negative about the chances of the option working.
2010-12-08 07:36:32 +02:00
Uoti Urpala 7001c2d994 core: ordered chapters: add heuristic for merging inaccurate chapters
Some Matroska files have inaccurate ordered chapter endpoints, and so
parts where one chapter should end and the next begin at the same
timestamp were not merged. This resulted in an unnecessary seek over a
minimal distance. Add a heuristic to merge parts with a minimal gap or
overlap between them.

Based on patch by Hector Martin <hector@marcansoft.com>.
2010-11-26 16:58:10 +02:00
Uoti Urpala 90d8bbb225 ad_liba52: fix -a52drc handling
Custom values other than 0 were ignored. Fix.
2010-11-23 00:44:37 +02:00
Uoti Urpala 9d53790ed2 core: make initial audio sync more robust against bad demuxers
ogg/ogm demuxers can give first audio packets without timestamp after
a seek. Due to some backwards compatibility code this results in the
sync code getting audio timestamp 0. In this case a lot of audio was
dropped unnecessarily when seeking to a position later in the file, as
the code saw audio starting from 0, video from something larger.

Make the code more robust in two ways. First, add a special case to
not try syncing if we get audio timestamp <= 0 (hopefully there aren't
many files where we'd really get audio starting from 0 and video from
a later timestamp). Second, when throwing audio away, make the code
recalculate from scratch the amount of bytes that still need to be
thrown away after every decode call. This limits the amount of damage
initial too-small timestamps can do, as the code will see the better
timestamps after a while.
2010-11-21 19:47:00 +02:00
Uoti Urpala 37dbe7f5d0 demux_mkv, ad_ffmpeg: use Matroska OutputSamplingFrequency if available
Use the value of the OutputSamplingFrequency element instead of the
SamplingFrequency element as the "container samplerate". In most cases
this only removes a warning, as those typically differ for SBR AAC
files and there was already a special case detecting this in
ad_ffmpeg.

The implementation adds a new "container_out_samplerate" field to the
sh_audio struct. Reusing the existing "samplerate" field and the
equivalent inside the 'wf' struct and just setting those to the new
value instead would probably work (at least I'm not aware of any codec
that would need the original SamplingFrequency for initialization).
However using a separate field also avoids some ugliness: the 'wf'
struct may not exist (though most demuxers create it), and the
'samplerate' field is overwritten to reflect the final value decided
by codec when decoding is first initialized.
2010-11-21 14:52:08 +02:00
Uoti Urpala 5a3edf4c07 TOOLS/matroska.py: recognize 3 more elements
Add definitions for DisplayUnit, OutputSamplingFrequency and
FileDescription in matroska.py. Regenerate the C template files to
allow using all current definitions in code.
2010-11-21 14:20:38 +02:00
Uoti Urpala dcaad783b0 demux_lavf: fix check for files lavf doesn't recognize
Commit 91ea30c585 ("demux_lavf: use lavf for all formats except those
listed") broke handling of files whose type libavformat couldn't
recognize at all. Fix the demux_lavf probe function to correctly
return failure in that case.
2010-11-17 21:47:56 +02:00
Uoti Urpala b82f82fe08 demux: fix initial subtitle track selection
Commit 3c2cfee488 ("demux: improve -alang / -slang track choosing
logic") had a copy/paste error which left the subtitle code using
audio variables and broke initial subtitle track selection. Fix.

I actually realized soon after creating the original commit that I'd
forgotten to change the variables and went back to fix it, but then
somehow thought that it was already OK and didn't change it...
2010-11-16 10:49:23 +02:00
Uoti Urpala 9c1bafb93a options: fix autoloaded profile handling of flag options
When loading automatically enabled profiles (like "[extension.avi]")
flag options were handled as on the command line; for example "fs=no"
was interpreted like "-fs" on command line, ignoring the "no" part.
Fix the parsing to treat them the same as other config file entries.
2010-11-15 23:41:59 +02:00
Uoti Urpala 721803c631 demux_mkv: seek: fix bogus audio packet from earlier position
Due to a bug created back in 2006 when SimpleBlock support was added,
demux_mkv demuxed one audio packet from the initial file position
after a seek, then skipped the following ones until a video keyframe
was found. This wasn't very noticeable earlier, but it had bad effects
after the recently added -initial-audio-sync code as the extra packet
with an earlier timestamp confused timing calculations and resulted in
desync after seeking. Fix.
2010-11-15 18:18:21 +02:00
Uoti Urpala 0478f1a29f demux_mkv: fix minor seek problem
Commit fc66c94360 ("demux_mkv: seek: with no track-specific index
entries use any") used uint64_t for a variable that should have been
int64_t. Fix. The practical effects of this error were minor; mainly
it made the player unnecessarily read the file contents between the
previous index entry and the correct one when seeking.
2010-11-15 17:54:09 +02:00
cboesch fe3c4810e1 cleanup: remove NULL checks before free() all over the code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 13:11:20 +02:00
reimar b492561241 demux_avi: remove pointless checks
If audio_block_size is 0 that is a bug (and will result in a division by 0
in one case that does not check this), thus remove all checks for it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32623 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:52:33 +02:00
reimar 74377fbfbf demux_avi: modify to avoid -aid problem in svn
[ Note: the questionable changes in svn that triggered this problem
were never included in git, and so this commit is not strictly
necessary here. It's included to reduce the differences between git
and svn demux_avi versions. ]

Fix possible division by 0 if -aid is used for AVI files.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32622 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:40:33 +02:00
reimar c96f83c235 stream/url.c: Unescape username/password when parsing URLs
This makes MPlayer handle it the same way as curl, and it also is the
only method that works with http_proxy://...http://user:password@...

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32621 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:35:56 +02:00
reimar 111757c3f4 vo_gl: create stereo-capable window when using Quadbuffer 3D
Select a stereo pixel format for window when Quadbuffer OpenGL was
selected as 3D mode.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32620 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:32:00 +02:00
reimar 94f543d114 libvo/w32_common.c: Move setting of pixel format from init to config
This allows it to depend on flags etc.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32619 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:31:10 +02:00
reimar 0792847d4a cache: read up to 64 KiB at once from stream_file
Make the file protocol read up to 64 KiB at once when the cache is used,
assuming that files will generally be readable with high bandwidth.
This should improve performance when playing e.g. from high-latency
network shares.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32616 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:24:11 +02:00
cehoyos b2c09ad9a4 mp3lib/dct64_sse.c: fix compilation with clang
Use fist(p)s instead of fist(p), fixes compilation with clang.

Patch by İsmail Dönmez, ismail namtrac org

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32613 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
reimar 00b2a5d7b2 libvo/w32_common.c: minor cleanup
Some indentation fixes.

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

Simplify: Use early return instead of large if block.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32612 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
reimar ba0fef3f06 sub_cc: modify parsing to fix problem with one sample
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32609 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
reimar 41e04522af sub_cc: Allow selecting the Close Captioning channel
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32607 b3059339-0415-0410-9bf9-f77b7e298cf2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32608 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
diego aae78f0509 cosmetics: Fix Bluray vs. Blu-ray typo
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32606 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
diego e3c6f09752 codecs.conf: Prefer FFmpeg AAC decoder over libfaad2
FFmpeg's AAC decoder is much faster than libfaad2. The only known
exception is libfaad2 compiled in fixed-point mode on systems with
slow FPUs. Now that LATM support in FFmpeg is complete, FFmpeg's AAC
decoder has a similar feature set as libfaad2. This leaves no reason
not to use FFmpeg by default.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32605 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
compn 13902c2967 DOCS/tech/codecs.conf.txt: document how to add ffmpeg codecs
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32604 b3059339-0415-0410-9bf9-f77b7e298cf2

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32615 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:42 +02:00
cboesch cd66de0b8a stream/network.c: Replace hardcoded str size with sizeof
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32603 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:09:47 +02:00
reimar cbb7ef057c sub_cc.c: minor cleanup
Avoid unnecessary ().

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

Use calloc instead of malloc+memset.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32600 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:09:19 +02:00
Uoti Urpala fdea095e34 demux_lavf: mark AVI timestamps non-pts to avoid messages
Playing AVI files containing B-frames with demux_lavf printed two
"decreasing pts" info messages at the start of the file. We know the
timestamps from AVI won't be valid pts, so add a demuxer field to
convey that information to the timing code and make that not even try
to use the timestamps as valid pts.
2010-11-14 11:59:55 +02:00
Clément Bœsch 7eb48343d4 options: more mplayer.c options moved to option struct
Following options were moved: autoq, benchmark, [no]term-osd,
term-osd-esc, playing-msg, [no]idle, [no]consolecontrols,
list-properties.
2010-11-14 00:14:56 +02:00
Clément Bœsch 9a9a7feafe options: move various mplayer.c options to option struct
Following options were moved: [no]quiet, [no]autosync, softsleep,
[no]rtc, rtc-device.
2010-11-13 23:06:33 +02:00
Anton Khirnov 91ea30c585 demux_lavf: use lavf for all formats except those listed
lavf demuxers are mostly better and receive more maintenance,
therefore it makes sense to prefer them in most cases. Change the
"preferred" logic from listing all formats for which lavf is preferred
to listing exceptions for which it isn't. Currently there are 3
exceptions: Matroska, FLAC and RealMedia (.rm).
2010-11-13 22:02:26 +02:00
Uoti Urpala a4ce95de81 core: do initial A-V sync by modifying audio stream
Add code to enforce matching pts with video when (re)starting the
audio stream, by either cutting away the first samples or inserting
silence at the beginning. New option -noinitial-audio-sync can be used
to disable this and return to old behavior.
2010-11-13 19:46:02 +02:00
Uoti Urpala 642ce15ef7 core: give pts as parameter to demuxer_get_current_chapter()
demuxer_get_current_chapter() accessed sh_video/sh_audio pts fields to
determine playback position. demux layer shouldn't access those and
the values used weren't quite correct anyway. Give the playback
position as a parameter to the demux layer function instead. Also
change the top-level get_current_chapter() to use get_current_time()
in the timeline case where it didn't refer to demux layer.
2010-11-13 16:48:31 +02:00
Uoti Urpala 1a336d6616 demux_nsv: don't write to sh_video->pts 2010-11-13 15:34:02 +02:00
Uoti Urpala b6b3f5ed09 .gitignore: add /tags, /TAGS
Ignore index files from ctags/etags. Remove obsolete entries for
ffmpeg and mencoder.
2010-11-13 10:52:19 +02:00
Uoti Urpala 3d999246e4 audio: add -gapless-audio option
If the option is enabled and all audio has been buffered to the AO,
then the player will move to the next file without waiting for the
buffered audio to drain, while leaving the AO initialized. If the
playback of the next file starts quickly enough (before the AO buffer
empties) then it should continue writing audio to the same AO with no
gap in between.
2010-11-12 18:29:09 +02:00