Commit Graph

131 Commits

Author SHA1 Message Date
Uoti Urpala 4aff125b35 VO: Keep aspect by adding black bars in window mode too if necessary
By default (without -nokeepaspect) MPlayer tries to maintain video
aspect ratio by using window manager hints to keep output window
aspect when resizing. Before this commit it would however scale the
video to completely fill the window even if the window manager did not
respect those hints. Change the behavior to add black bars like in
fullscreen mode instead in this case.
2009-11-20 23:15:11 +02:00
Uoti Urpala 287b62163e Merge svn changes up to r29912 2009-11-16 07:01:46 +02:00
Uoti Urpala 98ee8dd159 Add yuv_colorspace property, implemented in vo_vdpau and vo_xv
Add a property to select YUV colorspace. Currently implemented only in
vo_vdpau and vo_xv. Allows switching between BT.601, BT.709 and
SMPTE-240M (vdpau only).

The xv support uses the "XV_ITURBT_709" attribute. At least my NVIDIA
card supports that; I don't know whether other xv implementations do.

Bind the colorspace switch to the 'c' key by default. 'c' is currently
used by vo_sdl for some fullscreen mode change thing, but at the moment
that does not conflict and if it will in the future then vo_sdl can
change.

VDPAU part based on a patch from Lauri Mylläri <lauri.myllari@gmail.com>
2009-11-15 17:03:41 +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
Uoti Urpala b87ce8bc96 vo_vdpau: Modify frame buffering code
Clean up code related to frame buffering and generate pts information
also for the next frame in the output queue. The timing information
will be used in a following framedrop patch.

This commit adds one frame of buffering delay in vo_vdpau and
increases the number of buffered vdpau video surfaces from 3 to 4. The
delay increase makes it more important to fix remaining code in
MPlayer that doesn't deal well with filter/VO delay; OTOH it should
help any decoding/filtering parallelism in the underlying VDPAU
implementation as now filtering a frame for display can happen while
the next one is being decoded.
2009-11-15 12:45:47 +02: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
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 6847e5e297 video_out.h: Cosmetics
Reindent structs that used 8-space indent, change type of is_new to
bool, remove unnecessary <stdarg.h> include.
2009-09-17 18:15:25 +03:00
Uoti Urpala 74619f275e VO interface: Remove obsolete draw_frame() from new interface 2009-09-17 18:15:20 +03:00
Uoti Urpala 0e1b7765be Merge svn changes up to r29644 2009-09-04 19:49:35 +03:00
reimar 6765091bfa Add infrastructure and test code to enable aspect scaling and panscan in windowed mode.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29566 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-08-27 18:36:51 +00:00
Anton Khirnov 87366694d8 Remove the internal GUI
The GUI is badly designed and too closely coupled to the internal
details of other code. The GUI code is in bad shape and unmaintained
for years. There is no indication that anyone would maintain it in the
future either. Even if someone did volunteer to implement a better
integrated GUI having the current code in the tree probably wouldn't
help much. So get rid of it.
2009-07-07 21:49:42 +03:00
Uoti Urpala e0172b96e3 Merge svn changes up to r28862 2009-03-07 01:04:41 +02:00
reimar 8864662b13 Make WinID a 64 bit integer, this should avoid issues with valid Window
handles on windows being interpreted as "no wid set".


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28795 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-03-02 11:24:20 +00:00
Uoti Urpala 186e5a998c Merge svn changes up to r28641
Convert vo_x11_border (used in vo_gl/gl2 though the vo_gl_border
macro) to use a wrapper macro in old-style VOs which do not provide a
VO object argument. Before this function had an explicit global_vo
argument in vo_gl/gl2. New vo_vdpau uses it too so use the same
mechanism as most other functions.
2009-02-18 01:45:36 +02:00
reimar 01ef7e4579 Extend calc_src_dst_rects to also calculate the border values needed for
correctly placed dvdnav highlights, and fix direct3d and vdpau accordingly.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28633 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-17 11:59:49 +00:00
cehoyos 4a8a46fafd Fix compilation after last commit.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28627 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-17 10:13:08 +00:00
Uoti Urpala 738f66b1bc Merge svn changes up to r28549 2009-02-13 03:52:51 +02:00
reimar 694c3dc03f Add a calc_src_dst_rects that calculates from window size, panscan etc.
which part of the video source must be scaled onto which part of the window.
Direct3D and (future) VDPAU need this, for XvMC it makes it easier to add
cropping support and Xv is changed to keep the diff to XvMC small.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28546 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-12 17:40:53 +00:00
Uoti Urpala 1e86963828 Merge svn changes up to r28537 2009-02-12 04:17:55 +02:00
diego befc528297 Add standard license headers, unify header formatting.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28481 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-08 03:27:30 +00:00
Uoti Urpala 02bc48b67d Merge branch 'pause' 2009-01-15 00:29:51 +02:00
Uoti Urpala fccb0a7e45 Merge svn changes up to r28176
Conflicts:
	libvo/video_out.c
	libvo/x11_common.c
2008-12-22 00:46:02 +02:00
reimar d1065dffe1 Add and use a special lookup function to do table-based translation to MPlayer keycodes.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28172 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-20 11:52:11 +00:00
Uoti Urpala 02efad79a2 Update OSD while paused
When OSD contents change while paused, try to change the OSD drawn in
the currently visible frame. If such OSD updates are not supported
then advance by one frame and draw the OSD normally. Add some support
for OSD redrawing to vo xv.

The new xv code makes a copy of the original frame contents before
drawing the OSD if MPlayer is already paused when the frame is drawn.
If such a copy of the current frame exists then the frame contents can
be restored and a different OSD drawn on top of the same frame.
2008-12-09 04:31:07 +02:00
Uoti Urpala 8c144171bb Merge svn changes up to r28087
Conflicts:
	command.c
	libao2/ao_ivtv.c
	libao2/ao_v4l2.c
	libmpcodecs/dec_video.h
	libvo/aspect.h
	libvo/sub.c
	libvo/sub.h
	libvo/vo_directx.c
	libvo/vo_macosx.m
	libvo/vo_quartz.c
	mp_core.h
	mplayer.c
	mplayer.h
	osdep/getch2.h
	osdep/timer.h
2008-12-04 01:55:52 +02:00
diego 0864f92e7a Get rid of pointless 'extern' keywords.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28085 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-03 23:01:03 +00:00
Uoti Urpala 835511ac39 Merge svn changes up to r28038 2008-11-25 21:12:01 +02:00
diego 9051c1348d Remove unnecessary #ifdef around a struct and a bunch of extern declarations.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28031 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-11-24 17:35:08 +00:00
Uoti Urpala 6cce822505 Merge svn changes up to r27399
Conflicts:

	libmpcodecs/vd.c
	libmpcodecs/ve_raw.c
	libvo/video_out.c
	libvo/x11_common.c
	mplayer.c
2008-08-02 22:04:35 +03:00
diego e588ab056d Change a bunch of video-output-specific preprocessor directives from a HAVE_
prefix to a CONFIG_ prefix.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27397 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-08-02 17:38:11 +00:00
Uoti Urpala a232f564d3 Create a context struct for OSD state
This commit creates the struct and passes it to some functions that
needs to access OSD state but does not yet move much data from globals
to it.

vf_expand accesses the OSD state for rendering purposes outside of the
normal OSD draw time. The way this currently works is suboptimal, but
I did not attempt to clean it up now. To keep things working the same
way vf_expand needs to know the address of the state object to be able
to access the data even in the functions that should normally not need
it. For that purpose this commit adds a VFCTRL to tell vf_expand the
address of the object.
2008-06-24 01:53:58 +03:00
Uoti Urpala c172b5355f libvo: Move aspect.c static variables to vo struct
This moves non-option variables. aspect.c still defines option globals.
2008-05-01 11:02:26 +03:00
Uoti Urpala bfcb3a7a81 input: Move key filedescriptor list to context struct
The context variable is now passed to VOs too as it's now needed to
add a callback on the X filedescriptor.
2008-04-30 14:46:17 +03:00
Uoti Urpala 77ec83e351 Add a context for mp_fifo
Store data in an allocated context and take it as an argument instead
of using static variables.
2008-04-29 15:36:51 +03:00
Uoti Urpala 4db72f6a80 Move vo_gamma_* to options struct 2008-04-26 01:19:29 +03:00
Uoti Urpala bb679dd40a Remove global vo_flags
Move the information to struct sh_video field.
2008-04-25 07:15:07 +03:00
Uoti Urpala 78172918ff Move vo_screenwidth,vo_screenheight to options struct 2008-04-23 13:46:40 +03:00
Uoti Urpala 432e8ff4a5 Move vo_depthonscreen to x11 struct 2008-04-23 13:46:40 +03:00
Uoti Urpala ce76dfdd4a Move vo_dbpp to options struct 2008-04-23 13:46:40 +03:00
Uoti Urpala eaab1ce896 Move vo_dx,vo_dy,vo_dwidth,vo_dheight to vo struct 2008-04-23 13:46:40 +03:00
Uoti Urpala 7521aac665 Move global vo_config_count to vo struct
Remove the global and Add a corresponding field to the vo struct, plus
another which tells whether the LAST config call was successful.The
latter value which tells whether the VO should be properly configured
at the moment seems a better match for the semantics actually needed
in most places where the old value was used. The 'count' field with
the old semantics is not currently used by anything, but I'm leaving
it there for vo drivers which would need those semantics if converted
to use the struct.

Existing uses of the global outside old vo drivers are either converted
to use the struct field or moved inside the vo_xyz() calls (instead of
"if (vo_config_count) vo_flip_page(..." just call vo_flip_page which
will now do nothing if not configured). The removal of the check in
mpcommon.c/update_subtitles() is less trivial than the others, but I
think it shouldn't cause problems.
2008-04-23 13:46:39 +03:00
Uoti Urpala acf319b3ed Create a struct for X11 state
Will be used for common data between X11 VOs. The main reasons for
making it a separate struct rather than extra fields in the main VO
struct are that some field definitions need X headers and that the code
keeps basic X state such as the display connection over opening and
closing of individual VOs.
2008-04-23 13:41:07 +03:00
Uoti Urpala bfe569b76e Move vo_ontop to options struct
Add a 'struct vo *vo' argument to the x11_common.c functions that
access the variable so it's available as vo->opts->vo_ontop. To keep
VOs using the old API working create a global vo variable that is set
to the currently used old vo. "vo_ontop" will be #defined to
"global_vo->opts->vo_ontop", and x11_common.h will add defines like
the following when it is included by old VOs:
 #define vo_x11_ontop() vo_x11_ontop(global_vo)
so that they will call the function according to the new declaration.
2008-04-23 13:41:06 +03:00
Uoti Urpala 8ec90e5e4f Add option pointer to vo struct 2008-04-23 13:41:06 +03:00
Uoti Urpala 2bcfe1e077 Add new video driver API
Create new video driver API that has a per-instance context structure
and does not rely on keeping status in global or static variables.
Existing drivers are not yet converted to this API; instead there is a
wrapper which translates calls to them.

In the new API, an old API call vo_functions->xyz(args) is generally
replaced by vo_xyz(vo_instance, args).

The changes to keep the vesa, dxr2 and xover drivers compiling have
not been tested.
2008-04-23 13:41:04 +03:00
Uoti Urpala de56d2d9f5 Remove variable arguments from vo control() functions
No voctrl uses them any more, and using them would not be a good idea
because it makes forwarding arguments to other functions harder.
2008-04-23 13:41:03 +03:00
Uoti Urpala dbe080ec9f Change VOCTRL_[GET|SET]_EQUALIZER argument passing
These were the only voctrl types with more than one argument. The
second argument was passed using variable arguments. Change them to
use a single argument (address of a struct containing both old
arguments). This makes forwarding the arguments to other functions
easier and allows simplifying code.
2008-04-23 13:41:03 +03:00
diego 8efb2fa21c Add MPLAYER_ prefix to multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26061 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-22 09:09:46 +00:00