Commit Graph

36158 Commits

Author SHA1 Message Date
wm4 2d369a39dd mplayer: try to resume playback only if a resume file actually exists
Well, this was dumb. The resume message was printed for every file,
whether a resume config file existed or not.
2013-09-05 18:00:30 +02:00
Martin Herkt 5de277e423 mpvcore/input: Fix build without pthreads 2013-09-05 13:04:40 +02:00
Stefano Pigozzi 00a08af9f6 macosx_events: fix modifiers handling with media keys
This was caused by a typo. Regression from add7c2955d.

Fixes #213
2013-09-05 07:38:37 +02:00
wm4 88503a12c2 mplayer: print informative message when resuming playback
In particular, this informs the user how to disable this.
2013-09-04 18:16:47 +02:00
wm4 62ab8441a6 mplayer: make --save-position-on-quit save only on quit
When enabling --save-position-on-quit, playback position stored not only
on quit, but in any case playback of a file was stopped. This includes
going to the next file with playlist navigation commands.

After some discussion on IRC, it turned out that nobody thought this was
good behavior. Disable it, and really make it save only on quit.

Maybe the option is useless now, as the user could remap the CLOSE_WIN
key binding. On the other hand, CLOSE_WIN sounds and _is_ a bit obscure.
2013-09-04 18:12:11 +02:00
wm4 b8d498da15 mplayer: always write playback resume info, even at start/end of file
Before this commit, the player didn't write resume info if the playback
position was within the first or last percent of the file.

This was sometimes annoying, and with playlist resume can lead to
unintuitive behavior. (It wouldn't resume the playlist if the currently
played file was at 0-1% or 99-100%, even if you were in the middle of a
playlist.)

Moreover, the "percent > 99" check is a bit bogus anyway, because 100
(in integer) is rarely reached.

Drop the check, and make sure using --save-position-on-quit won't write
resume info when reaching EOF. The latter check is needed to make sure
playback of the file starts at beginning when playing it again after
EOF.
2013-09-04 17:08:52 +02:00
wm4 191ac00af2 path: better check for mp_is_url()
The previous check just searched for a "://" substring. This was quite
bad, because "://" can be a valid part of a path. Later, I added
special handling for filenames starting with "." and "/", so that you
could reliably pass arbitrary filenames to mpv, no matter how messed
up they were.

Even though it doesn't really matter in practise anymore, this is still
crap, so add a more reliable check instead.
2013-09-04 16:28:02 +02:00
wm4 3bb217d5e9 mplayer: allow resuming from playlist
This includes the case of passing multiple files to command line
(internally this is the same as loading a playlist).

Resuming works by finding the first playlist entry that can be resumed.

Alternative implementations would be possible, such as hashing the
playlist contents. But this implementation is simpler, and doesn't have
the disadvantage that changes to the playlist (like appending entries)
will throw away the resume point.

This makes loading large playlists a bit slower, because it has to look
into ~/.mpv/watch_later/ for every entry. Loading a 15000 entries
playlist now increases from 150ms to 400ms. Considering you rarely load
playlists this big with mpv (because it's impractical considering the
terminal and non-GUI nature of the player), this is probably ok.
2013-09-04 16:15:09 +02:00
wm4 b0f8e03f17 command: unescape URLs for ${filename} and ${media-title}
Undo URL percent encoding if the filename appears to be an URL. This
will fix display of the actual filename in some cases.

We don't put any effort into checking whether the URL is really percent
encoded, because we don't really know how the protocol handler is going
to interpret the URL. For stream_lavf, we probably can't know. Still,
from the perspective of this commit, it seems to make sense to assume
they are percent encoded.
2013-09-04 16:15:09 +02:00
wm4 efc5ac17bf path: add a common mp_is_url() function
Remove the duplicated code.
2013-09-04 16:15:08 +02:00
wm4 dbff29c81d x11_common: don't allocate more than needed for icon
icon_size is the number of array items of type long, not bytes. Change
the type of icon_size to int, because size_t makes you think of byte
quantities too quickly.

As an unrelated change, change the (char *) cast to (unsigned char *),
because it matches the common XChangeProperty idiom better.
2013-09-04 13:37:38 +02:00
wm4 266ce242c3 tv: attempt to support mjpeg streams
MPlayer handles this correctly, because MPlayer still has the FourCC
codec dispatch (codecs.conf). We need to handle this case specially,
because the libavformat rawvideo decoder will of course not eat mjpeg.

mjpeg is the only supported format, though. (Even MPlayer needs to
convert between V4L2 formats and MPlayer FourCCs, and mjpeg is the only
non-raw format.)
2013-09-04 00:46:23 +02:00
wm4 ed3187b41a mplayer: handle --reset-on-next-file=""
The option list contains an empty string member with this option value,
so ignore that. I'm not sure whether the option list should maybe be
empty in this case, but it could be the wrong thing in case of other
options.
2013-09-04 00:43:14 +02:00
wm4 7af15f2d6e mplayer: don't let playback resume force options that are file local
This happens by default with pausing: if a file was paused when doing
quit_watch_later, then resume and unpause, then the file played after
that would start in paused mode. This is because the pause option is
backed up at thr wrong place, so it backs up the state from resuming,
instead of whatever it was set to before that.
2013-09-04 00:31:14 +02:00
Alexander Preisinger 353686e636 configure: build with wayland 1.2.0
For the time being there will be a check if someone uses wayland from git,
because I really really like to have the others formats too.
2013-09-03 20:12:44 +02:00
Alexander Preisinger 13f3b55881 configure: improve wayland check 2013-09-03 19:31:10 +02:00
Stefano Pigozzi d57e1aa599 macosx_events: send a `release all` after key up events
This prevents keys to become stuck due to changing keyboard modifiers during
the key down. Not the prettiest approach but event `x11_common` does it like
this.

Fixes #210
2013-09-02 21:13:56 +02:00
Stefano Pigozzi add7c2955d macosx_events: remove duplication
refactoring: extract method `handleMPKey:withMask:`
2013-09-02 21:11:05 +02:00
Stefano Pigozzi 39a69aeb89 cocoa_common: remove unlocking from fullscreen function
This was added in the past to prevent a deadlock, but is not needed
anymore.
2013-09-02 08:35:21 +02:00
Stefano Pigozzi 694654e383 cocoa_common: avoid the opengl view to leak it's state
Just because everything is in a single file it doesn't excuse us to have high
coupling between C and ObjC code.
2013-09-02 08:21:03 +02:00
Stefano Pigozzi 04caddb7c8 cocoa: enqueue events only if input context is present 2013-09-01 23:51:36 +02:00
wm4 a5183a761c x11: add window icon
The png file added to etc/ are taken from the link mentioned in commit
303096b, except that they have been converted to 16 bit, sRGB (with
color profile info dropped, if there was one), and transparent pixels
reset for better compression.

The file x11_icon.bin is generated by gen-x11-icon.sh. I'm adding it to
the git repo directly, because the script requires ImageMagick, and we
don't want to make building even more complicated.

The way how this is done is basically a compromise between effort
required in x11_common.c and in gen-x11-icon.sh. Ideally, x11_icon.bin
would be directly in the format as required by _NET_WM_ICON, but trying
to write the binary width/height values from shell would probably be a
nightmare, so here we go.

The zlib code in x11_common.c is lifted from demux_mkv.c, with some
modifications (like accepting a gzip header, because I don't know how to
make gzip write raw compressed data).
2013-09-01 23:27:33 +02:00
Stefano Pigozzi 71335183ec mplayer: fix race condition on uninit with Cocoa
NULL out Cocoa's reference to mplayer's input context before deallocating it
2013-09-01 23:03:51 +02:00
Stefano Pigozzi 3e1115569e input: unlock playloop thread during select
This allows other threads to use mp_input_put_key without blocking if the
playloop is doing the 500ms select call (i.e.: during pause).
Makes Cocoa GUI responsive again (regression since 2d363c3).
2013-09-01 22:48:09 +02:00
Stefano Pigozzi 134c3e148c osx: use MP_KEY_* instead of MK_* for media keys
In 213ad5d6c I added `MK_*` key bindings overlooking the fact that mpv already
has `MP_KEY_*` for media keys.
2013-09-01 20:57:40 +02:00
wm4 6a55fa6793 input: allow window dragging even if mouse is in a mouse area
If the input section is enabled with MP_INPUT_ALLOW_VO_DRAGGING, then
the  VO will be allowed to drag the window with mouse button down +
mouse move even if the mouse is inside the section's mouse area.
2013-09-01 20:17:51 +02:00
wm4 0c7978cf9c input: deal with spurious X11 LeaveNotify events
If the mpv window is unfocus, clicking on the OSC should focus the
window (done by the window manager) and allow interaction with the OSC.
But somehow X sends a spurious LeaveNotify event, immediately followed
by an EnterNotify event. This happens at least with IceWM. The result is
that the OSC will disappear (due to receiving MOUSE_LEAVE). The OSC will
stay invisible, because EnterNotify isn't handled, and there's nothing
that could make the OSC appear again.

Solve this by handling EnterNotify. We cause a redundant MOUSE_MOVE
event to be sent, which triggers the code to make the OSC visible. We
have to remove the code from input.c, which ignores redundant mouse move
events.

Since the code ignoring redundant mouse move events is still needed on
Windows, move that code to w32_common.c. The need for this is documented
in the code, also see commit 03fd2fe. (The original idea was to save
some code by having this code in the core, but now it turns out that
this didn't quite work out.)
2013-09-01 20:17:51 +02:00
wm4 11d2f723d5 input: print more debug infos, raise loglevel 2013-09-01 20:17:51 +02:00
wm4 42fa7cbbf9 input: stay in current input section if mouse button is down
Normally, moving the mouse outside of the mouse area of an input section
will send mouse events somewhere else (because input section mouse areas
are similar to windows/widgets in real GUI toolkits). This was done even
if a mouse button was held down. This is quite different from how GUI
toolkits behave.

Change the code so that if a mouse button is down, the mouse area of the
current input section can't be left. Releasing the mouse button (while
the mouse pointer is outside of the mouse area) will actually leave the
mouse area.

As a side-effect, this commit also tests more often whether the current
mouse input section is valid. This is needed to make releasing a mouse
button trigger the mouse input section change.
2013-09-01 20:17:51 +02:00
wm4 61ba810752 input: add some more X11 multimedia/internet keys
These keys can be found on various "multimedia" and "internet" keyboard.
X defines many keycodes, so I'm not adding all, just what I found on my
own keyboard.

Other key codes can be added on request.
2013-09-01 20:17:51 +02:00
wm4 e366c1a9c6 keycodes: cosmetics: align indentation 2013-09-01 20:17:51 +02:00
wm4 570826448a audio: fix playback of Musepack SV8 files
This is basically a libavcodec API oddity: it can happen that
avcodec_decode_audio4() returns 0 (meaning 0 bytes were consumed). It
requires you to feed the complete packet again to decode the full
packet, and to successfully decode the following packets.

We ignored this case with the argument that there's the danger of an
endless decode loop (because nothing of that packet is apparently
decoded, so it would retry forever), but change it in order to decode
mpc8 files correctly.

Also add some comments to explain the mess.
2013-09-01 20:17:50 +02:00
wm4 ead525e17a input: comment all default bindings in input.conf
I suspect most users will just copy etc/input.conf when they want to
remap some default bindings. But usually this means the user even copies
bindings he doesn't care about, and it's better if the user maps only
the bindings in his input.conf the user intends to remap.

Comment all bindings in etc/input.conf. Since this file also defines the
builtin defaults and is baked into the mpv binary, we have to do
something to get them anyway, even though they are commented. Do this by
having input.c "uncomment" the bindings in the baked in input.conf. (Of
course this is done only for the builtin config, not configs loaded from
disk.)
2013-09-01 20:17:50 +02:00
Stefano Pigozzi 3ad7b9419e travis: don't generate docs for ffmpeg/libav
Fixes some breakage with ffmpeg-git
2013-09-01 19:52:17 +02:00
Stefano Pigozzi 2d363c39b9 input: lock for accessing struct input_ctx
The previous code was locking only the input queue. That was too weak since it
didn't protect the input_ctx data structure. So remove the locking on the queue
and lock all the public functions that interact with the input_ctx.

The private functions and public functions that do not act on the input_ctx
(there are quite some functions doing mp_cmd manipulations for instance) are
not locked.

Some changes by wm4. Use a recursive mutex, and restructure some code to be
less annoying with locks, such as converting code to single return, or
making use of the recursive mutex.
2013-09-01 18:02:45 +02:00
Stefano Pigozzi ddd873902a cocoa_common: enable click-through on the video view
Generate a mouse down event on the first click so that one can interact
with the OSC directly as opposed to wasting the first click in order to focus
the window.
2013-09-01 16:10:57 +02:00
Stefano Pigozzi c686e270a1 cocoa_common: track mouse move events when not focused
This is really only important with the OSC and makes the tracking code behave
more consistently with the X11 one.
2013-09-01 16:10:37 +02:00
Stefano Pigozzi 303096bcb2 change application icon
I would like to thank Chris Ward (@tenzerothree, http://tenzerothree.com/) for
working on the art for these icons and bringing some eye candy to the project.

The PSDs made by Chris are available on our Dropbox [1], along with the exports
I made to create OSX and Windows icons. The PSDs are almost completly vector
and all the resolutions look really similar, except the 16px favicon which was
handcrafted to look better and more recognizeable on the smaller pixel budget.

For Mac OS X the icons were created using iconutils on the PNGs iconsets
exported from the PSDs. These even support retina resolutions (except 512@2x).

For Windows the .ico file was created with imagemagick. The included images
are 16px, 24px, 32px, 48px 64px, 256px. These are the resolutions listed on
MSDN for supporting Windows XP [2] and Windows versions based on Aero [3].
Only 32bit PNGs were used since it is 2013.

For Linux nothing changed yet, even though @wm4 talked about using the PNGs
directly there. This will probably be dealt with in a later commit.

  [1]: https://www.dropbox.com/sh/yelfoj9tbft7o06/A8vOT6JKaG
  [2]: http://msdn.microsoft.com/en-us/library/ms997636.aspx
  [3]: http://msdn.microsoft.com/en-us/library/aa511280.aspx
2013-09-01 12:24:53 +02:00
wm4 4d62b90f88 video: add unscaled mode with --video-unscaled 2013-09-01 03:46:28 +02:00
wm4 f5144077ac configure: fix some descriptions in the help output 2013-09-01 03:03:25 +02:00
Stefano Pigozzi 462e6f281a cocoa: let the core handle key repeats
Report key down and key up modifiers to the core so that it can issue it's
own key repeats (instead of relying on Cocoa's ones).
2013-08-30 19:49:30 +02:00
wm4 c89b162462 input: fix --no-input-default-bindings
The option did nothing. This was probably broken with 5b38a52.
2013-08-29 19:07:20 +02:00
wm4 fd2ead5080 gl_video: don't crash if no FBOs are available
This probably has been broken since bbc865a: a test was added that uses
a FBO, but it's always run, even if FBOs were not detected. On the other
hand, fbotex_init() just runs into an assert. Fix the test that
triggered this condition, and make fbotex_init() "nicer" by just failing
if FBOs are not available.
2013-08-28 23:08:28 +02:00
wm4 33c03c4d0a demux_playlist: port ini reference playlist parser
Port it from playlist_parser.c to demux_playlist.c. Also, change the m3u
parser to drop whitespace from the trailing part of the line (will make
it work properly with windows line endings).

(I hoped that this would make MMS URIs with http instead of mmsh
prefixes work, but it doesn't. Instead, it leads to a playlist loop. So
solving this issue would require a change in ffmpeg, probably.)
2013-08-28 23:08:10 +02:00
wm4 792844f873 stream: read at least a full buffer with stream_peek()
Until now, stream_peek() read only the bare minimum it had to read from
the stream. But this could cause problems, such as being very
inefficient when peeking a lot, or conflicting with ability to seek
back. (The latter issue can be caused by peeking a few bytes, and then
doing a stream_read() with a size that is 1 byte longer: this would read
the peeked data, then call stream_fill_buffer(), which throws away the
previously peeked bytes - so you can't seek back anymore. This is
mitigated by a hack in demux_open(): it peeks a full buffer, to avoid
that peeking/reading during demuxer probing [or before that, in a stream
filter] can cause the buffer to be dropped.)
2013-08-28 23:08:08 +02:00
Alexander Preisinger c181ae87ce configure: fix build with stable wayland releases 2013-08-28 21:48:21 +02:00
Alexander Preisinger 65321f081d wayland/shm: rework format handling
Use a linked list for all supported formats and make the format table const.
2013-08-26 20:34:06 +02:00
Alexander Preisinger 56644b8abc wayland: fix memory leaks 2013-08-26 20:34:06 +02:00
Stefano Pigozzi d3c4ba3ab8 cocoa_common: autohide dock when autohiding menubar
A cocoa bug doesn't allow to do otherwise. Will open a radar later.
2013-08-26 20:01:20 +02:00
Stefano Pigozzi 75791f4dd9 configure: fix VDA autodetection based on FFmpeg support
The original condition was too weak, requiring only the header. The header is
installed is FFmpeg regardless of the presence of VDA on the system, so just
perform a check on the `ff_vda_create_decoder` function.
2013-08-26 20:00:41 +02:00