1
mirror of https://github.com/mpv-player/mpv synced 2024-10-22 08:51:57 +02:00
Commit Graph

1431 Commits

Author SHA1 Message Date
Uoti Urpala
8e77ab12b8 -identify output: use ordered chapters length for ID_LENGTH
Print the overall timeline length as ID_LENGTH instead of the length
of the main file. This may help external GUIs handle ordered chapters
somewhat better.
2009-12-13 00:51:11 +02:00
Uoti Urpala
9afcdab694 options: Move ass_enabled to options struct 2009-12-02 17:37:39 +02:00
Uoti Urpala
6da77386e9 core: Fix timeline state at start of playback
A timeline starting in the middle of a source file resulted in initial
playback state not being set up properly. Fix this by forcing an
absolute seek to initialize timeline state before playback starts.
2009-12-02 13:47:48 +02:00
Uoti Urpala
4ef079f279 mplayer.c: Remove unneeded blit_frame arguments
The video updating functions no longer need to separately track
whether a frame is available for flipping. That information is
now available in video_out->frame_loaded, and all the separate
tracking did was present opportunities for things to go out of sync.
2009-12-02 13:01:36 +02:00
Uoti Urpala
de11a44bba core: Fix ordered chapter timeline building memory corruption
Two arrays were allocated one element too small, causing writes beyond
the allocated area. The bug was triggered when playing a Matroska file
with ordered chapters where each chapter came from a different source
and none of the sources was the original file.

Noticed by Daniel Dawson <ddawson@icehouse.net>
2009-12-02 12:38:13 +02:00
Uoti Urpala
ed333bb31d Merge svn changes up to r29971 2009-11-29 06:11:02 +02:00
reimar
731e9490b2 Readjust the global number of subs when switching dvdnav track to take
into account any change in the number of DVD subtitles available.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29964 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-24 06:59:21 +00:00
Uoti Urpala
d3a1fa98f4 core: Fix rare corner cases in video frame generation
Check that frames added by filters reach the screen and are not just
buffered by the VO, and give filters a chance to output added frames
if previous frame at EOF was buffered by VO. It's unlikely that anyone
ever noticed practical problems caused by these issues.
2009-11-23 04:38:32 +02:00
Uoti Urpala
e43926d6d1 core: Handle VO-added frames even with correct-pts disabled
At least show the extra frames even if correct-pts mode is disabled.
They cannot be timed properly though; the most practical way to fix
that is to just move to correct-pts mode instead.
2009-11-23 04:31:15 +02:00
Uoti Urpala
5995bc175a Merge svn changes up to r29962 2009-11-23 01:56:21 +02:00
Uoti Urpala
4c552b2e42 core: Do OSD/subtitle updates at a more accurate point
OSD contents such as video position and non-libass subtitles were
updated just before feeding a video frame through filters. The updates
were done at that point mainly for the benefit of vf_expand OSD
rendering functionality, which draws the OSD contents when the frame
passes through that filter. However this gave the wrong results for
VO-drawn OSD if the filter chain or VO had any delay or timestamp
manipulation: the OSD contents should reflect the most recent contents
that were _output_ after any filtering, not the last frame that was
fed _into_ the filtering machinery. This issue became more important
after vo_vdpau started buffering frames by default.

Move the OSD updates to be done just before the OSD is drawn, using
the most accurate available information. This fixes the common case
but worsens vf_expand OSD behavior (adding extra latency). A special
case could be added to fall back to the previous behavior when
vf_expand OSD is being used; however I don't consider that a high
priority at the moment especially when other problems with vf_expand
OSD would still remain.

This has little effect on libass-rendered subtitles either way,
because both vf_ass and VO libass rendering use timestamps from the
filter chain and do not rely on separate position updates.
2009-11-22 14:15:12 +02:00
Uoti Urpala
74b7dcc5f4 core: Add support for decoder reordering of pts values
Add a mode where libavcodec's reordered_opaque feature is used to
associate container packet timestamps with decoded frames. This should
improve behavior at least for MPEG files with interlaced h264; the
previous code does not cope well with the libavformat demuxer
producing two field packets with separate timestamps but the
libavcodec h264 decoder only producing a single output frame for those
two packets (so half the timestamps have no associated output frame).

The current libavformat mpeg demuxer seems to finally work with
interlaced h264 files and produce valid timestamps which are useful
with a mode like this.

By default MPlayer now selects between this new mode and the old one
automatically based on the number of timestamp problems they cause; by
default the new mode is used if both seem to work. The new option
-pts-association-mode can be used to force a particular mode. If
correct-pts mode is disabled this has no effect on timing.

Also remove the "EXPERIMENTAL" marker from the manpage description of
-correct-pts.
2009-11-21 20:53:10 +02:00
reimar
98ab90d2ca Remove useless check for valid fd with -dumpstream, the code does not
necessarily need it.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29927 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-17 18:28:43 +00:00
Uoti Urpala
34279a8ce3 cosmetics: remove some unused variables 2009-11-17 06:56:29 +02:00
Uoti Urpala
a1af75d83e mplayer.c: Fix compilation with dvdnav enabled
I had forgotten to check dvdnav-specific code after last merge of svn
changes.
2009-11-16 15:10:35 +02:00
Uoti Urpala
287b62163e Merge svn changes up to r29912 2009-11-16 07:01:46 +02:00
Uoti Urpala
507f4fe6c7 Merge branch 'vdpau' 2009-11-16 04:18:13 +02:00
Uoti Urpala
201bef7ee1 Implement vsync-aware frame timing for VDPAU
Main things added are custom frame dropping for VDPAU to work around
the display FPS limit, frame timing adjustment to avoid jitter when
video frame times keep falling near vsyncs, and use of VDPAU's timing
feature to keep one future frame queued in advance.

NVIDIA's VDPAU implementation refuses to change the displayed frame
more than once per vsync. This set a limit on how much video could be
sped up, and caused problems for nearly all videos on low-FPS video
projectors (playing 24 FPS video on a 24 FPS projector would not work
reliably as MPlayer may need to slightly speed up the video for AV
sync). This commit adds a framedrop mechanism that drops some frames
so that no more than one is sent for display per vsync. The code
tries to select the dropped frames smartly, selecting the best one to
show for each vsync. Because of the timing features needed the drop
functionality currently does not work if the correct-pts option is
disabled.

The code also adjusts frame timing slightly to avoid jitter. If you
for example play 24 FPS video content on a 72 FPS display then
normally a frame would be shown for 3 vsyncs, but if the frame times
happen to fall near vsyncs and change between just before and just
after then there could be frames alternating between 2 and 4
vsyncs. The code changes frame timing by up to one quarter vsync
interval to avoid this.

The above functionality depends on having reliable vsync timing
information available. The display refresh rate is not directly
provided by the VDPAU API. The current code uses information from the
XF86VidMode extension if available; I'm not sure how common cases
where that is inaccurate are. The refresh rate can be specified
manually if necessary.

After the changes in this commit MPlayer now always tries to keep one
frame queued for future display using VDPAU's internal timing
mechanism (however no more than 50 ms to the future). This should make
video playback somewhat more robust against timing inaccuracies caused
by system load.
2009-11-15 12:45:58 +02:00
reimar
fd35beaf0a Check that mpctx->audio_out is not NULL when trying to uninit it.
Make audio uninit consistent with e.g. the demuxer uninit code and
also avoids a possible crash.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29908 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-13 13:21:59 +00:00
ptt
ab4bdb64e1 Added -name, -title and -use-filename-title options and implementation in X11 vos
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29904 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-12 09:21:53 +00:00
reimar
a63f28b99a Whitespace cosmetics: fix pause_loop indentation/remove inconsistently used tabs.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29899 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-11 11:35:28 +00:00
reimar
376aa9416f Do not call resume on unpausing if we have already reached eof while
being paused (e.g. because of a "pausing_keep_force pt_step 1").


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29898 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-11 11:31:36 +00:00
reimar
254b4855b1 Remember which subtitle was auto-selected for dvdnav due to -slang
and if it is unchanged re-apply -slang on stream reset.
This makes -slang work when used with menu navigation or in general
when the subtitle is not available for parts of the playback or the
subtitle stream ID changes during playback.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29897 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-11 11:22:12 +00:00
reimar
d1e5bdf365 Factor out code that decides which subtitle to play.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29896 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-11 11:19:50 +00:00
reimar
36a0a35598 Use switch_program property from mplayer.c to set ts_prog.
This seems to leave the ts demuxer unaffected, but fixes -tsprog with
the lavf demuxer.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29846 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-07 11:12:56 +00:00
reimar
b963af59f1 Whitespace cosmetics: reindent reinit_audio_chain function
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29843 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 16:16:22 +00:00
reimar
89c9b3b769 Remove some useless comments/commented-out code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29842 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 16:11:58 +00:00
reimar
477057dbb5 Split assignment from error value check to avoid overcomplicated if () condition.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29841 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 16:10:19 +00:00
reimar
e83addcbfa Reuse the init_error exit path also for init_best_audio_codec errors.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29840 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 16:08:00 +00:00
reimar
bf80f35958 Simplify: use &= instead of a = b & a;
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29839 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 16:06:33 +00:00
reimar
9edfe2046e Remove some unnecessary else blocks
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29838 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 16:04:39 +00:00
reimar
f4926132f8 Use an early return instead of a {} block over the whole function in reinit_audio_chain
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29837 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 15:59:42 +00:00
reimar
fefbdf991b Disable audio when initializing the filter chain fails (can happen e.g. when the hwmpa
decoder is used but the hardware does not support hardware MPEG audio).
Otherwise this will lead to a crash later on when the decode code tries to access
the audio filter chain.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29836 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-06 15:56:30 +00:00
reimar
7566e72f77 Change dvdnav_reset_stream to not disable subtitles, since that breaks
selecting the subtitle via -slang or -sid.
It is quite possible that removing it will cause other issues, though
I could not see any with the DVDs I had available for testing.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29827 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-05 20:59:46 +00:00
Uoti Urpala
8bbb79c03a av_log callback handling overhaul
Move av_log callback handling from vd_ffmpeg.c to a new file
av_log.c and install the callback immediately when starting the
program. Main functionality improvements of the new code:

 - The old version only installed the callback when opening an FFmpeg
   video decoder. If nothing had triggered that then av_log() messages
   from other sources (libavformat, audio decoding, swscale usage)
   bypassed MPlayer's output system completely. Now the callback is
   always installed.

 - Current av_log message severity levels are handled correctly. The
   old code used MSGL_ERR for some messages that should be MSGL_V.

 - Message type is now set for libavformat contexts
   (MSGT_DEMUXER / MSGT_MUXER).

 - The old code did "mp_msg_test(type, mp_level)" before actually
   determining the type, so that it always used MSGT_FIXME. This led
   to some messages being incorrectly dropped in case the user
   had specified module-specific verbosity levels. The old check in
   question was originally motivated by performance problems when
   there were a lot of callbacks; however it's not clear whether the
   part about it skipping the type determination was intentional (most
   of the performance problems must have come from the way the
   original code used snprintf) and in my tests current FFmpeg
   libraries have not generated unreasonable amounts of callbacks
   anyway.
2009-10-31 23:59:16 +02:00
Uoti Urpala
7fd3eb0f74 Merge svn changes up to r29752
As part of merging subtitle-in-terminal changes make
update_subtitles() only clear existing subtitles if called with the
reset argument, and not try to set new ones. Later calls should set
the needed new subtitles, and this change avoids some problems with
trying to set subtitles when mp_property_sub() in command.c gets
called from initialization code before full initialization.
2009-10-06 04:48:00 +03:00
reimar
6fa7e2d867 Make -nosub work to disable subtitles even if -slang and dvd streams are used.
This still needs some additional checking that subtitle selection via dvdnav works.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29732 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-29 06:44:10 +00:00
reimar
e3625bd232 Add a -nosub option that allows disabling auto-selected subtitles as e.g. the
mkv demuxer supports.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29730 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-28 11:32:27 +00:00
reimar
f43cc7c3cc Enable loading of external subtitles also for audio-only files.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29728 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-28 11:26:19 +00:00
reimar
95d60aa019 Use a_pos to update subtitle for audio-only files instead of mpctx->sh_audio->pts
which e.g. for mp3 in AVI never has a useful value.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29727 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-28 11:24:13 +00:00
reimar
4b182ff652 Add support for displaying subtitles on the command-line when playing
audio-only files.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29712 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-23 21:48:48 +00:00
reimar
bf16f6f4f3 Make update_subtitles work without sh_video for text subtitles.
This fixes a crash with e.g. auto-enabled subtitles and -novideo due to
command.c calling update_subtitles even without video and is a step
toward subtitle support for audio-only files.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29710 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-23 21:21:58 +00:00
Uoti Urpala
3f215c9f8e Merge branch 'vdpau' into build
* vdpau: (22 commits)
  VO: Prefer vo_vdpau over vo_xv again
  vo_vdpau: Fix X event handling bugs
  vo_vdpau: Fix memory corruption bug with MP_IMGTYPE_NUMBERED
  core/VO: Allow VO drivers to add/modify frames
  video_out.h: Cosmetics
  VO interface: Remove obsolete draw_frame() from new interface
  vo_vdpau: Support recovering from VDPAU display preemption
  vo_vdpau: Support updating OSD while paused
  vo_vdpau.c: Reindent control() switch statement
  vo_vdpau: Allocate one large surface for EOSD content
  vo_vdpau.c: cosmetics
  vo_vdpau: reindent after GUI code removal
  vo_vpdau: Clean up uninit logic
  vo_vdpau: Make CHECK_ST macro safer
  vo_vdpau: Move all remaining static/global variables to context
  vo_vdpau: Move things to context struct
  vo_vdpau: Make info struct const
  vo_vdpau: Replace global function table with context variable
  vo_vdpau: Move VDPAU interface pointers into one struct
  vo_vdpau: Add template file for VDPAU functions
  ...
2009-09-19 00:28:17 +03:00
Uoti Urpala
350fc4f5a2 core/VO: Allow VO drivers to add/modify frames
Add interfaces to allow VO drivers to add or remove frames from the
video stream and to alter timestamps. Currently this functionality
only works with in correct-pts mode. Use the new functionality in
vo_vdpau to properly support frame-adding deinterlace modes.

Frames added by the VDPAU deinterlacing code are now properly timed.
Before every second frame was always shown immediately (probably next
monitor refresh) after the previous one, even if you were watching
things in slow motion, and framestepping didn't stop at them at all.
When seeking the deinterlace algorithm is no longer fed a mix of
frames from old and new positions.

As a side effect of the changes a problem with resize events was also
fixed. Resizing calls video_to_output_surface() to render the frame at
the new resolution, but before this function also changed the list of
history frames, so resizing could give an image different from the
original one, and also corrupt next frames due to them seeing the
wrong history. Now the function has no such side effects. There are
more resize-related problems though that will be fixed in a later
commit.

The deint_mpi[] list of reserved frames is increased from 2 to 3
entries for reasons related to the above. Having 2 entries is enough
when you initially get a new frame in draw_image() because then you'll
have those two entries plus the new one for a total of 3 (the code
relied on the oldest mpi implicitly staying reserved for the duration
of the call even after usage count was decreased). However if you want
to be able to reproduce the rendering outside draw_image(), relying on
the explicitly reserved list only, then it needs to store 3 entries.
2009-09-18 17:12:53 +03:00
Uoti Urpala
e1ecc43152 Merge svn changes up to r29684 2009-09-16 22:28:12 +03:00
reimar
4dae2a980c Merge two Windows-specific #if sections to simplify the condition.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29684 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-16 18:09:48 +00:00
reimar
1782e34b55 Hack: set DEP/NX on Windows via SetProcessDEPPolicy.
This should really be done via the NXCOMPAT PE flag, but looks like
binutils will not get support for it any time soon and not having this
security feature enabled is just ridiculous.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29683 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-16 18:07:19 +00:00
Uoti Urpala
0e1b7765be Merge svn changes up to r29644 2009-09-04 19:49:35 +03:00
reimar
9600686eb5 10l, fix misplaced check in r29613, for loop detection we must compare
current file name against full name to be added, not current file name
against new base path.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29637 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-02 19:55:24 +00:00
reimar
76cb85c056 Limit amount of data allocated on stack, strlen(filename) is not a good idea for
file name strings that might come from arbitrary playlists, use PATH_MAX instead.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29636 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-02 19:49:10 +00:00