Commit Graph

35364 Commits

Author SHA1 Message Date
Stefano Pigozzi 953b3b3699 ao_jack: use mp_ring 2013-06-16 18:20:39 +02:00
Stefano Pigozzi c5ee7740c4 ao_portaudio: use mp_ring 2013-06-16 18:20:39 +02:00
Stefano Pigozzi bff03a181f core: add a spsc ringbuffer implementation
Currently every single AO was implementing it's own ringbuffer, many times
with slightly different semantics. This is an attempt to fix the problem.

I stole some good ideas from ao_portaudio's ringbuffer and went from there.
The main difference is this one stores wpos and rpos which are absolute
positions in an "infinite" buffer. To find the actual position for writing /
reading just apply modulo size.

The producer only modifies wpos while the consumer only modifies rpos. This
makes it pretty easy to reason about and make the operations thread safe by
using barriers (thread safety is guaranteed only in the Single-Producer/Single-
Consumer case).

Also adapted ao_coreaudio to use this ringbuffer.
2013-06-16 18:20:39 +02:00
Stefano Pigozzi b537467fd3 ao_coreaudio: fix output with spdif
The mute condition was inverted...
2013-06-16 18:20:39 +02:00
Stefano Pigozzi a66041a332 ao_coreaudio: split ringbuffer in it's own file
This is hopefully the start of something good. ca_ringbuffer_read and
ca_ringbuffer_write can probably cleaned up from all the NULL checks once
ao_coreaudio.c gets simplyfied.

Conflicts:
	audio/out/ao_coreaudio.c
2013-06-16 18:20:39 +02:00
Stefano Pigozzi 6807906177 ao_coreaudio: move to new libao API
This is just a first pass and the bare minimum to make it compile and work.
SPDIF is untested for lack of hardware.
2013-06-16 18:20:38 +02:00
Stefano Pigozzi 74eb98279a ao_coreaudio: uncrustify
uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace \
  audio/out/ao_coreaudio.c
2013-06-16 18:20:38 +02:00
Rudolf Polzer fee0b99047 fix compile, sorry 2013-06-16 17:26:28 +02:00
Rudolf Polzer c6cbbd292a vf_dlopen ildetect: fix numdecidedadjacentframes counter 2013-06-16 17:22:37 +02:00
Rudolf Polzer fb04351f76 vf_dlopen ildetect: make the wrapper shell script more robust 2013-06-16 17:18:45 +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
John Hawthorn f2cd4a0e75 mplayer: update window title if its properties change
This allows having properties like time-pos in the window title update
properly. There is a danger of this causing significant CPU usage,
depending on the properties used and the window manager.
2013-06-16 06:17:44 +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 98e50d5477 demux_lavf: show metadata for OGG audio files
Whether this is a hack or not, I don't even know anymore.
2013-06-15 18:36:17 +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 60a0c450eb command: use more standard time format for clock property
%k is not very standard. The manpage notes them as conforming to
"Olson's timezone package", and it's not standard C89, C99 or POSIX.
mingw doesn't provide it, and even some of the smaller Linux libcs
don't have support.

Use %H instead. This gives slightly different results, but I think
this is ok. Difference in behavior between these summarized:

  %k: "single digits are preceded by a blank"
  %H: "range 00 to 23"
2013-06-14 00:46:28 +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
Rudolf Polzer 297aad1f3b support "-" as file name when encoding
This workaround sucks. avio just does not support "-" - and ffmpeg's
command line binaries work around it. FOUR TIMES. DIFFERENTLY.

WHY DOESN'T AVIO DO THIS RIGHT TO BEGIN WITH?
2013-06-13 18:40:36 +02:00
wm4 a9bbe0a576 options: remove --stereo
Whatever this was supposed to be originally, it doesn't have much value
anymore. It just forced ad_mpg123 to upmix mono to stereo by default
(the audio chain can do that). As an option, it was mostly useless and
misleading, so get rid of it.
2013-06-13 00:59:27 +02:00
wm4 aadf0abbf2 gl_video: remove redundant condition 2013-06-13 00:58:58 +02:00
wm4 c7742e24f6 mplayer: save sub-visibility property 2013-06-13 00:58:08 +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
wm4 4a5d1f2d44 mplayer: try to handle PTS forward jumps
Raw MPEG streams can contain PTS discontinuities. While the playback
core  has obvious code for handling PTS going backward, PTS going
forward was as far as I can see not handled.

This can be an issue with DVD playback. This wasn't caught earlier,
because DVD playback was just recently switched to demux_lavf, which
implies -no-correct-pts mode. This mode doesn't use PTS in the same way
as the normal playback mode, and as such was too primitive to be
affected by this issue.

Use the following heuristic to handle PTS forward jumps: if the PTS
difference between two frames is higher than 10 seconds, consider it a
reset. (Also, use MSGL_WARN for the PTS discontinuity warnings.)

In this particular case, the MPEG stream was going from pts=304510857
to pts=8589959849 according to ffprobe (raw timestamps), which seems a
bit strange.

Note that this heuristic breaks if the source video has unusually high
frame times. For example Rooster_Teeth_Podcast_191.m4a, an audio file
with a slide show encoded as MJPEG video track.
2013-06-13 00:54:20 +02:00
wm4 6c3a4ba9f9 manpage: adjust y4m output example
The additional flags are needed to get the muxer to write the source
video frame rate (instead of a fallback) for 100% equivalence to the
replaced MPlayer/mplayer2 y4m writer.
2013-06-13 00:49:27 +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
wm4 d2d9ba326a ao_oss: fix compilation on BSD
This was overlooked with commit 32a898f, because OSS4 volume control is
typically not available on Linux. BSD does have this feature, so the
broken code broke compilation there.
2013-06-11 12:24:11 +02:00
wm4 ff832dd149 options: fix compilation on Windows
Closes github issue #107. (Hopefully.)
2013-06-11 12:24:11 +02:00
wm4 6c3a1f68ff command: fix empty metadata case
show_text "${metadata}" crashed if no metadata was set.
2013-06-11 12:24:11 +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
wm4 27b633671f stream: remove pointless check 2013-06-09 22:06:03 +02:00
wm4 a10fee0d52 stream: remove unused function 2013-06-09 22:06:03 +02:00
wm4 f7c912dff2 stream: move VCD specific stuff to stream_vcd
I don't even know what VCDs are. A prehistoric version of the DVD or so.
2013-06-09 22:06:03 +02:00
wm4 7b16d4b3b2 stream_cdda, stream_vcd: check read buffer size
These assumed that the buffer provided with fill_buffer() was at least
sector sized, instead of checking the size parameter.

This is just a cleanup, since every caller made sure to align everything
on sector sizes, if a stream has the sector size set.
2013-06-09 22:06:03 +02:00
wm4 780d62f19e stream_dvd: remove some deadly insane code
Of course all of stream_dvd.c (as well as libdvdread) is completely
insane, but at least this hack for ancient broken compilers on really
obscure platforms should be safe to remove.
2013-06-09 22:06:02 +02:00
wm4 15f5b18e58 stream: misleading statement 2013-06-09 22:06:02 +02:00