Commit Graph

405 Commits

Author SHA1 Message Date
wm4 3382a6f6e4 video: add a new method to configure filters and VOs
The filter chain and the video ouputs have config() functions. They are
strictly limited to transfering the video size and format. Other
parameters (like color levels) have to be transferred separately.

Improve upon this by introducing a separate set of reconfig() functions,
which use mp_image_params to carry format parameters. This struct
contains all image format related parameters from config(), plus
additional parameters such as colorspace.

Change vf_rotate to use it, as well as vo_opengl. vf_rotate is just
an example/test case, but vo_opengl will need it later.

The intention is also to get rid of VOCTRL_SET_YUV_COLORSPACE. This
information is now handed to the VOs via reconfig(). The getter,
VOCTRL_GET_YUV_COLORSPACE, will still be needed though.
2013-06-28 20:34:46 +02:00
wm4 823e0c511b mp_image: copy palette only if allocated
Normally, we assume that IMGFMT_PAL8 always has a palette allocated
in plane 1. But there may be corner cases in ffmpeg where it doesn't
(namely pseudo-pal stuff).
2013-06-28 20:30:37 +02:00
wm4 9e80fe1c15 vf_rotate: fix params >= 4 2013-06-28 20:29:42 +02:00
wm4 0435ab7131 options: remove -lavdopts debug suboption
This can be set as avopt instead.
2013-06-28 14:42:06 +02:00
Stefano Pigozzi 6669366280 cocoa_common: schedule a redraw frame after a non live resize
A redraw forces recalculation of panscan and other stuff not accounted for in
the resize_redraw codepath. This is actually a hack but works really well in
my tests.

Thanks @wm4 and @Cpuroast for the idea.

Fixes #86
[ci skip]
2013-06-25 22:13:48 +02:00
wm4 403a266d46 Merge branch 'sub_mess2'
...the return.
2013-06-25 00:43:04 +02:00
wm4 4f5e12136d stream: remove padding parameter from stream_read_complete()
Seems like a completely unnecessary complication. Instead, always add a
1 byte padding (could be extended if a caller needs it), and clear it.

Also add some documentation. There was some, but it was outdated and
incomplete.
2013-06-23 22:33:59 +02:00
Stefano Pigozzi 0407869ae3 OSX: fix compilation with 10.7 SDK
Recent work in the OS X parts of the code started using clang's support for
Obj-C's support for Literals and Subscripting. These particular language
features remove a lot of boilerplate code and allow to interact with
collections as consicely as one would do in scripting languages like Ruby or
Python.

Even if these are compiler features, Subscripting needs some runtime support.
This is provided with libarclite (coming with the compiler), but we need to
add the proper method definitions since the 10.7 SDK headers do not include
them. That is because 10.7 shipped before this language features.

This will cause some warnings when compiling with the 10.7 SDK because the
commit also redefines BOOL to make autoboxing/unboxing of BOOL literals to
work.

If you need to test this for whatever reason on 10.8, just pass in the correct
SDK to configure's extra cflags:

  ./configure --extra-cflags='-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk'

Fixes #117
2013-06-19 21:24:26 +02:00
wm4 656f9e1ba7 vo_lavc: remove unused variable 2013-06-18 12:22:25 +02:00
wm4 171d1ef7fe osdep: remove shmem wrapper
This is unused now that the cache is always threaded.
2013-06-18 02:19:15 +02:00
Rudolf Polzer 66f09d7384 vo_lavc: do NOT fill pict_type from the mp_image
Doing this makes the encoder force the same pict type as original, which
is often not even possible. Rather let the codec decide!

As there is no documented value to mean "decoder shall pick", I rather
save/restore the default value filled by libavcodec.
2013-06-17 17:33:50 +02:00
Rudolf Polzer 1d75d01392 vo_lavc: use mp_image_copy_fields_to_av_frame 2013-06-17 08:56:55 +02:00
Rudolf Polzer fee0b99047 fix compile, sorry 2013-06-16 17:26:28 +02:00
Rudolf Polzer dcd36c79c7 encode_lavc strings: use new option syntax 2013-06-16 17:14:47 +02:00
Rudolf Polzer 7ae4242820 vf_dlopen filters: add an "ildetect" filter that detects interlacing
The filter analyzes each frame for combing, and decides at the end
whether the content is likely interlaced, telecined or progressive.
2013-06-16 17:11:25 +02:00
Stefano Pigozzi de63e1d15e cocoa_common: implement VOCTRL_UPDATE_WINDOW_TITLE
Unfortunately this backend creates the window lazily and a call to
`cocoa_set_window_title` is needed inside config.
2013-06-16 11:00:20 +02:00
Alexander Preisinger 3866106be5 wayland: use VOCTRL_UPDATE_WINDOW_TTILE 2013-06-16 09:34:31 +02:00
wm4 a07b99540c vo: fix build on Libav 2013-06-15 19:23:53 +02:00
wm4 168a595bfe video/out: introduce VOCTRL_UPDATE_WINDOW_TITLE
Instead of implicitly changing the window title on config(), do it as
part of the new VOCTRL.

At first I wanted to make all VOs use the VOCTRL argument directly, but
on a second thought it appears vo_get_window_title() is much more useful
for some (namely, if the window is created lazily on first config()).

Not all VOs are changed. Wayland and OSX have to follow.
2013-06-15 19:07:21 +02:00
wm4 70f97efa72 vo: define VO_TRUE/FALSE to C99 constants
This make the intention more apparent, and some VOs are actually using
true instead of VO_TRUE in some places. Hopefully this changes makes it
less confusing (instead of more).

The C99 constants true/false are defined to 1/0 as well, so this commit
doesn't actually change anything.
2013-06-15 18:59:52 +02:00
wm4 73b9b0b830 w32_common: remove some unneeded code
vo_w32_init() can be called only once on a VO.
2013-06-15 18:57:38 +02:00
wm4 63ff79556f w32_common: fix non-sense
Seriously...
2013-06-15 18:54:01 +02:00
wm4 b04ce54711 vo_xv: always request redraw on resize
Fixes using panscan controls with OSD off and video paused.
2013-06-15 18:36:16 +02:00
wm4 0e2fb5d8e8 vo: redo video display rectangle calculations
This code calculates the source/display video rectangle for scaling with
most VOs. It's responsible for clipping the display rectangle against
the screen and adjusting the source rectangle accordingly.

Until now, it assumed that the video was centered on the screen. Change
this so that any rectangle is possible. Basically, the clipping is
extended to two sides (e.g. left and right), instead of handling both at
the same time.

The rounding behavior slightly changes. It seems to be slightly better
than before. On the other hand, the video is not strictly centered
anymore (due to different rounding on either side). When using panscan
controls, the video can "jitter" by 1 or 2 pixels around the center as
the panscan value is changed.
2013-06-15 18:35:09 +02:00
wm4 60631acd29 gl_video: rearrange some code
I think this is slightly nicer. Shouldn't change anything functionally.
2013-06-15 18:34:43 +02:00
wm4 18b6ff0d4e gl_video: fix scaling when image is cropped, or with no-npot
When the displayed image is cropped in Y direction (like using panscan
controls when playing 4:3 video on a 16:9 monitor), and separated
scaling is used, the texture size for the FBO holding the intermediate
result was calculated incorrectly. This could lead to artifacts, which
were quite apparent with extreme scale factors.

Actually, the size of that texture is OK, but the texture shouldn't be
used to hold the complete scaled image. Instead, it should be used for
the visible part of the image only. Because separate scaling works by
scaling in Y direction first, it's still fine to scale the image on the
full image width on the first pass. This helps avoiding artifacts on
the left/right border of the image when scaling in X direction, as the
scaler will try to fetch pixels from beyond the border. (The left border
is still kind of fine, but the right border will fetch garbage, unless
the texture is strictly sized, or explicit clamping is added to the
shader. Too much trouble, so using the full image width is simpler.)

Also fix some issues with no-npot mode, which enables use of power-of-2
textures. Maybe this mode isn't really useful anymore (modern hardware
is faster with smaller non-power-of-2 textures), but keep it for now.
2013-06-15 18:34:43 +02:00
wm4 abbb45ce13 gl_video: typo in comment 2013-06-15 18:34:43 +02:00
Martin Herkt 9b5a98676d image_writer: Add PNG filter option (default "mixed")
The use of filters prior to PNG compression can greatly improve
compression ratio, with "mixed" (ImageMagick calls it "adaptive")
typically achieving the best results.
2013-06-15 15:48:52 +02:00
Stefano Pigozzi 3c12148668 cocoa_common: remove play/pause VOCTRL functions
Make VOCTRL_RESTORE_SCREENSAVER / VOCTRL_KILL_SCREENSAVER use the power
management functions directly.
2013-06-14 07:34:47 +02:00
wm4 118a2a359f w32: enable screensaver when paused
This is quite similar to the previous commit.

Untested. I'm not sure if this is how it's supposed to work. At least
--no-stop-screensaver should work in any case.
2013-06-14 00:39:31 +02:00
wm4 f1d3ba0e33 x11: enable screensaver when paused, rename/change --stop-xscreensaver
Use the recently introduced screensaver VOCTRLs to control the
screensaver in the X11 backend. This means the behavior when paused
changes: the old code always kept the screensaver disabled, but now the
screensaver is reenabled on pausing.

Rename the --stop-xscreensaver option to --stop-screensaver and make it
more generic. Now it affects all backends that respond to the
screensaver VOCTRLs.
2013-06-14 00:37:39 +02:00
wm4 648c3d790a core: introduce separate VOCTRLs for screensaver stop/resume
This is slightly better because VOCTRL_RESUME/VOCTRL_PAUSE are usually
needed by VOs to know whether video is actually being played (for
whatever reason), and they wouldn't be passed to the backend's VOCTRL
handler, like vo_x11_control().

Also try to make sure that these flags (both pause state and screensaver
state) are set consistently in some corner cases. For example, it seems
enabling video in the middle of playing a file while the player is
paused would not set the paused flag.

If codec initialization fails, destroy the VO instead of keeping it
around to make sure the state is consistent.

Framestepping is implemented by unpausing the player for the duration of
a frame. Remove the special handling of VOCTRL_PAUSE/RESUME in these
cases. It was most likely needed because these VOCTRLs used to be
important for screen redrawing (blatant guess), which is now handled
completely differently. The only potentially bad side-effect is that the
screensaver will be disabled/reenabled for the duration of one frame.
2013-06-14 00:37:39 +02:00
wm4 aadf0abbf2 gl_video: remove redundant condition 2013-06-13 00:58:58 +02:00
wm4 d16516f553 vo_lavc: silence warning when writing y4m
Apparently a ffmpeg issue. Hide the warning because it's annoying.
Workaround suggested by divVerent.
2013-06-13 00:54:40 +02:00
Stefano Pigozzi 4ffaf4868e cocoa_common: fix ontop switching when fullscreen
`enterFullScreenMode:withOptions:` creates another window so set the level on
both the windowed window and current window.

Also remove NSFullScreenModeWindowLevel as it seems to be superfluous.
2013-06-11 21:20:46 +02:00
Stefano Pigozzi fbca1b179a cocoa_common: fix window level when going fullscreen
This is a regression introduced by 0057aa4769. Fix it so that the fullscreen
window uses the correct window level.

[ci skip]

Fixes #106
2013-06-10 20:42:39 +02:00
Rudolf Polzer fc438061e8 encoding: fix -oneverdrop logic when -omaxfps is used
Not that anyone should ever do this...
2013-06-09 16:37:13 +02:00
Rudolf Polzer 3600bf348f encoding -omaxfps: rewrite logic
Now it properly hits the "0 times displayed" case when frames get
skipped; this means the candidate frame for the case the next frame is
"long" is set properly.
2013-06-09 16:31:09 +02:00
Rudolf Polzer 19d80e28e1 encoding -omaxfps: do not shift pts when pts are repeated entirely
This is just to make sure. I have no test case for this, but the logic
seems saner that way.
2013-06-09 15:50:53 +02:00
Rudolf Polzer 0cbc75c083 Option -omaxfps: limit fps when encoding
Lower-fps content is left alone (NOT aligned to this fps); higher fps
content is decimated to this frame rate.
2013-06-09 15:37:28 +02:00
wm4 92ae48db0f Merge branch 'sub_mess'
This branch heavily refactors the subtitle code (both loading and
rendering), and adds support for a few new formats through FFmpeg.

We don't remove any of the old code yet. There are still some subtleties
related to subreader.c to be resolved: code page detection & conversion,
timing post-processing, UTF-16 subtitle support, support for the -subfps
option. Also, SRT reading and loading ASS via libass should be turned
into proper demuxers. (SRT is needed because Libav's is gravely broken,
and we want ASS loading via libass to cover full libass format support.
Both should be demuxers which are probed _before_ libavformat, so that
all subtitles can be loaded through the demuxer infrastructure, and
libavformat subtitles don't need to be treated in a special way.)
2013-06-04 00:29:44 +02:00
wm4 9f4261de65 core: add common function to initialize AVPacket
Audio and video had their own (very similar) functions to initialize an
AVPacket (ffmpeg's packet struct) from a demux_packet (mplayer's packet
struct). Add a common function for these.

Also use this function for sd_lavc_conv. This is actually a functional
change, as some libavfilter subtitle demuxers add weird out-of-band
stuff as side-data.
2013-06-03 22:40:07 +02:00
Stefano Pigozzi f0d2120347 osx: cocoa_common: use default wakeup period
Now that Cocoa's input handling is done on a separate thread from the playloop
it is ridicolously simple to have longer asynchronous sleeps when paused.
2013-06-03 22:31:13 +02:00
Stefano Pigozzi f13f0db33a osx: create macosx_events to deal with keyDown events
On OSX with Cocoa enabled keyDown events are now handled with
addLocalMonitorForEventsMatchingMask:handler:. This allows to respond to
events even when there is no VO initialized but the GUI is focused.
2013-06-03 22:31:13 +02:00
Stefano Pigozzi 63e2a21c64 osx_common: remove outdated ifdeffery
It was definining keycodes not defined in OS X < 10.5.
2013-06-03 22:31:13 +02:00
wm4 66be276f69 gl_video: reduce output with -v, skip useless header parts
Originally, the header wasn't supposed to contain random compatibility
stuff, but now all that is printed with -v. Add a hack to skip it and
to reduce the noise.
2013-06-03 00:05:07 +02:00
wm4 87c549ffae gl_video: explicitly clamp colormatrix output
This could lead to quite visible artifacts when using an appropriate ICC
and float FBOs. The float FBOs allow storing out of range values, and my
guess is that the rest of the precessing chain elevated these out of
range values, resulting in artifacts.
2013-06-03 00:00:14 +02:00
Stefano Pigozzi 57571b5da3 cocoa_common: autohide dock/menubar on fs only if on same screen
Autohide the menubar and/or dock only if they are present in the screen the
player is going to go fullscreen into. I thought the GUI would handle this for
me when I switched 0057aa476 but lack of hardware to test made me embarass
myself yet again.

I reimplemented this feature with nicer code and behaviour. The code checks
separately wether to hide menubar and dock separatly, while the old code used
a single check possibly hiding stuff without need.

Added the key checks as a some category additions to NSScreen for readability.
2013-06-01 22:52:21 +02:00
Stefano Pigozzi f4dcb93be1 cocoa_common: don't autohide mouse on mousedown
Previews code allowed to click the same spot for a long time and the cursor
would autohide. No more!
2013-06-01 17:58:08 +02:00
Stefano Pigozzi db7835f5d7 cocoa_common: avoid window creation with VOFLAG_HIDDEN
This takes an approach similar to the wayland OpenGL backend. VOFLAG_HIDDEN
flag semantics doesn't mean "hide the window" but is simply ever used only to
do detection of available OpenGL extensions. On OSX it's possibile to
accomplish this task just by creating the OpenGL context without attaching
it to a drawable.
2013-06-01 12:12:17 +02:00