Commit Graph

1754 Commits

Author SHA1 Message Date
Niklas Haas 4d6b9550fe
vo_opengl: add support for custom shaders 2015-05-27 11:09:41 +02:00
wm4 8054c034b8 command: add protocol-list property
Fixes #1972.
2015-05-23 15:26:55 +02:00
Michael Vetter 9251fa125f Remove trailing whitespaces 2015-05-15 11:02:44 +02:00
wm4 92b9d75d72 threads: use utility+POSIX functions instead of weird wrappers
There is not much of a reason to have these wrappers around. Use POSIX
standard functions directly, and use a separate utility function to take
care of the timespec calculations. (Course POSIX for using this weird
format for time values.)
2015-05-11 23:44:36 +02:00
wm4 04c02796bd path: make mp_path_join accept normal C strings
Instead of bstr. Most callers of this function do not need bstr. The
bstr version of this function is now mp_path_join_bstr().
2015-05-09 15:26:47 +02:00
wm4 38114b6a36 stream: don't print reconnection message if no stream support
This code does not know whether the stream supports reconnecting until
STREAM_CTRL_RECONNECT is called. So the message should be printed after
it. To avoid that reconnects that succeed on the first try go unnoticed,
print a warning on success.
2015-04-29 19:54:46 +02:00
wm4 bcf3904a0d cache: exit early on cancellation
An approximate measure to make it exit possibly slightly earlier.
Relatively speaking, some time will pass between cancellation and
the cache actually being requested to exit, so it's good if the
cache returns EOF immediately.
2015-04-21 22:39:06 +02:00
wm4 1299fbec05 cache: another minor simplification
The caller can check for cache interruption instead. There's no need to
define special return values and such. It would be rather hard to make
waiting for the condition and stream cancellation atomic too (and
pointless, since the underlying stream will also be "cancelled" and exit
early), so nothing about cancellation being a separate call will change.
2015-04-21 22:34:32 +02:00
wm4 3990fe74f6 cache: simplify the check for printing the "cache stuck" message
This put some effort into distinguishing between two messages to print -
all worthless. Even more so, this kept printing the message, which
doesn't feel overly useful either. (The message will be printed
repeatedly anyway if network recovers for a while and then gets stuck
again.)

All in all, the demuxer cache triggering the buffering state does a
better job here. But don't remove it completely, since knowing that the
network did nothing for a relatively short time is still useful.
2015-04-21 22:25:49 +02:00
xylosper c64e4e48d9 command: disc-mouse-on-button property
This property indicates whether mouse cursor is located on button
or not for disc naviation.
2015-04-21 00:54:29 +09:00
wm4 b0bd0a6e6b stream_file: minor simplification
Now all this platform-specific code doesn't depend on stream or
stream_file internals anymore.
2015-04-17 23:04:11 +02:00
wm4 1d36955f70 player: allow playing directories
If a directory is encountered, replace it with its contents in the
internal playlist.

This is messed into demux_playlist.c, because why not. STREAMTYPE_DIR
could be avoided by unconditonally trying opendir() in demux_playlist.c,
but it seems nicer not to do weird things like calling it on real files.

This does not work on Windows, because msvcrt is retarded.
2015-04-17 23:02:14 +02:00
Marcin Kurczewski f43017bfe9 Update license headers
Signed-off-by: wm4 <wm4@nowhere>
2015-04-13 12:10:01 +02:00
wm4 f82ddf1d0b stream_rar: update comment
The stream filter non-sense was removed, which makes it much easier.
2015-03-29 13:37:14 +02:00
wm4 aaa42f82dc stream_lavf: workaround broken rtmp "timeout" option
The libavformat rtmp protocol's "timeout" option has two problems:
1) Unlike all other protocols, it's in seconds and not microseconds
2) It enables "listen" mode, which breaks playback

Make the --network-timeout do nothing in the rtmp case.

Fixes #1704.
2015-03-19 16:41:48 +01:00
wm4 9b77666783 options: introduce --cache=yes choice
I think this is what I alwass missed ever since I found the MPlayer
cache options: a way to enable the cache on local files with the default
settings, whatever they are.
2015-03-12 23:51:41 +01:00
wm4 b9307b7175 stream: use relaxed atomic loads for checking playback aborts
Seems appropriate, and will probably avoid performance surprises with
scary architectures which don't have trivial implementations for atomic
loads. (Consider that demux_mkv calls this very often now, and
libavformat demuxers and streams did this for a while now.)
2015-03-09 22:36:17 +01:00
Kevin Mitchell 3efbc1a9a3 stream/smb: mark as network stream for --cache=auto
This causes the cache to be enabled with --cache=auto. It was not done
previously because the small cache size 320k actually led to worse
performance. However, with the current default cache size of 25000kb,
caching notably improves performance.
2015-03-09 03:38:01 -07:00
Philip Sequeira 6172e843cd options: add M_OPT_FILE to new options that are missing it
Fixes shell completion.
2015-03-07 22:19:38 +01:00
wm4 3cd394995f cache: assume file size from EOF position
If we're caching a stream with unknown size, and we reach EOF, then
consider the EOF position the file size. Typically makes sense when
reading from a pipe or a http connection that did not send a size.
2015-03-04 17:28:42 +01:00
wm4 9746e71efc stream_cdda: add option to enable cdtext, and disable it by default
Fixes #1615.
2015-03-03 15:29:07 +01:00
wm4 1ba24d2585 stream_cdda: fix parameter passing
All cdda options (except --cdrom-drive) were ignored, because the priv
struct (with the options set) was just replaced. Oops.
2015-03-03 15:28:26 +01:00
wm4 a4b6bf8c41 player: refine rar:// playlist-safety handling
It was possible to make the player play local files by putting rar://
links into remote playlists, and some other potentially unsafe things.

Redo the handling of it. Now the rar-redirector (the thing in
demux_playlist.c) sets disable_safety, which makes the player open any
playlist entries returned. This is fine, because it redirects to the
same file anyway (just with different selection/interpretation of the
contents). On the other hand, rar:// itself is now considered fully
unsafe, which means that it is ignored if found in normal playlists.
2015-03-02 19:09:36 +01:00
Oliver Freyermuth 40c9e79068 stream_dvb: Always define NO_STREAM_ID_FILTER if missing.
It is also used for initialization in channel-list setup.
Should fix compilation on FreeBSD, and is more correct
since it is used unconditionally.
Reverts 6445648 .
2015-02-28 18:27:21 +01:00
wm4 fbf76da913 stream: remove stream filter concept
Unused since the previous commit. (Apparently it was a stupid idea.)
2015-02-27 19:51:14 +01:00
wm4 5824eb7107 stream_rar: treat rar files as playlists
Refactors an older hack, which for some reason used a more complicated
way. This generates the playlist representing the contents of the rar
file in demux_playlist.c. The pseudo-demuxer could easily be separate
from the the playlist parsers (and in fact there's almost no shared
code), but I don't think this obscure feature deserves a separate file.

Sample files created with:

    rar a -v20000k -m0 files.rar file1.mkv file1.mkv
2015-02-27 19:44:39 +01:00
wm4 e85bcc1223 cache: use MPCLAMP() macro 2015-02-25 22:23:31 +01:00
wm4 899f0cd51e cache: limit to file size
Saves some memory. Should be especially helpful if many small files are
loaded, like when mass-loading subtitle files and the cache is enabled.
2015-02-25 22:23:25 +01:00
wm4 3c9344a1a9 stream_file: open pipes non-blocking
Now the player can actually be quit if a pipe was opened, but nobody is
writing to it.
2015-02-20 20:01:01 +01:00
wm4 3f5b5b758d cache: silence "EOF reached" message
This message will be printed relatively often once EOF is reached. In
some cases this is rather annoying, for example when playing HLS. (With
HLS, the stream is just a playlist file, while libavformat opens actual
media files without mpv's knowledge, so the cache is completely useless
and hits EOF instantly.)

That it retries reading is apparently a good thing: at least local files
can grow, and even after the player got the EOF, playback _could_ be
resumed by basically polling and detecting that there is more data. So
I'm not changing this behavior yet.
2015-02-18 21:13:11 +01:00
wm4 cf881396b5 dvb_tune: fix invalid syntax
Oops.
2015-02-11 11:36:14 +01:00
wm4 5de29b860b stream: get rid of remaining uses of the end_pos field
Most things stopped using this field for better support of growing
files. Go through the trouble to repalce the remaining uses, so it can
be removed.

Also move the "streaming" field; saves 4 bytes (wow!).
2015-02-06 21:43:52 +01:00
wm4 347cf97231 stream: minor cleanups
Fix return types and return values to make them more consistent. Some
reformatting and making code more concise.

In stream_reconnect(), avoid the additional mp_cancel_test() call by
moving the "connection lost" message below the mp_cancel_wait() call,
which effectively leads to the same behavior when the stream was already
canceled. (The goal is not to show the message in this case.)

Merge stream_seek_long() into stream_seek(). It was the only caller.

Always clear the eof flag on seeks.

Reduce access to stream internals in cache.c and stream_lavf.c.
2015-02-06 21:43:52 +01:00
wm4 45e214d7ae stream: slightly improve reconnect behavior
Wait for a longer time between reconnects. Introdeuce and use
mp_cancel_wait(), so that quitting is still immediate.
2015-02-06 19:19:15 +01:00
wm4 e14d09c8a6 stream_lavf: fix build with Libav
The API function used is FFmpeg-only.

Sigh...
2015-02-06 18:02:37 +01:00
wm4 f3ae845fd2 options: add --network-timeout
Not quite sure if this actually works as intended.

Fixes #1566.
2015-02-06 17:01:35 +01:00
wm4 5bce4664be stream_cdda: fix bugs in chapter time retrieval
Looks like a bunch of off-by-one errors.

The track number was mistakenly offset by 1 - this shifted all chapters
by one, and make the first chapter start on the second track (so the
"chapter" property returned -1 in the first track since it was before
the first chapter).

Also, the calculation of the sector destination was messed up. This
comes from commit 32d818f0, where I apparently attempted to calculate
the position to one byte before the section, but unfortunately math
doesn't work this way and it was nonsense. Just drop this idea; while it
may help with seeking (probably...), it also returns slightly different
times. The user shall use hr-seeks if accurate seeking is required.

Hopefully fixes #1560.
2015-02-04 15:17:49 +01:00
wm4 9d8b00f1d6 command: add dummy get implementation for tv-channel property
A small cosmetic change with the effect that pressing 'k' shows
"unavailable" instead of "error" (even if no  TV code is active).
2015-02-02 18:07:37 +01:00
wm4 303924c343 stream: reject overly long URLs 2015-01-21 12:11:37 +01:00
wm4 d558accaa6 stream_lavf: escape disallowed characters in http URLs
In my opinion, libavformat should be doing this. But a patch handling a
very safe case rejected, so I suppose we have to do it manually. (This
patch was only escaping spaces, which can never work because they break
the basic syntax of the HTTP protocol.)

This commit attempts to do 2 things:
- Try to guess whether libavformat will use the URL for http. This is
  not always trivial, because some protocols will recursively pass part
  of the user URL to http in some way.
- Try to fix invalid URLs. We fix only the simplest case: only
  characters that are never valid are escaped. This excludes invalid
  escape codes, which happen with freestanding '%' characters.

Fixes #1495.
2015-01-21 12:10:49 +01:00
wm4 7a7d8d50e2 dvd: try to improve seeking
libdvdnav is garbage. Seeking by time is incredibly inexact, which is in
part due to the fact that it does not use the DVD seek tables. Instead,
it assumes CBR for certain ranges within the DVD, which makes especially
small seeks unreliable.

I have no good fix for this, other than hacking libdvdnav (I'd rather
prefer to remove mpv DVD support completely than doing this). So here's
a shitty hack that tries to workaround these problems. A basic
observation is that seeking in VLC seems to work quite well; however it
seems to be based on seeking by blocks (unless there is a subtle "trick"
I didn't see in the source code). mpv usually seeks by timestamps, so
this is not an option for us. However, we can pretend we are doing this
in the DVD layer.

The previous commit added a way to pass through relative seeks. This
commit uses the relative seek. STREAM_CTRL_SEEK_TO_TIME is backwards
compatible (there's still dvdread and bluray), so most code is about
extracing the relative seek information and turning it into a block
seek.

(Another way would have been using SEEK_FACTOR stuff, but that would
probably make for a less reliable way to handle this situation.)

Additionally, if a hr-seek is done, add an offset by 10 seconds. As long
as the error done by libdvdnav is not worse, this should help with hr-
seeks - although it makes them much slower.
2015-01-19 21:30:05 +01:00
wm4 616cfb90c1 stream_dvb: silence bogus compiler warning
This complains within dvb_strtok_r() that savePtr is uninitialized.
There doesn't seem to be any code path where this can happen though, so
it's probably a false positive. Silence it anyway.
2015-01-19 17:58:37 +01:00
Oliver Freyermuth 794804725d cache: cache-position needs to be int64_t
Both max_filepos and offset are int64_t,
so pos can overflow, e.g. causing endless loops
in stream implementation.
2015-01-13 02:39:16 +01:00
Oliver Freyermuth 3d1b9ba4bd stream_dvb: Add MP_ERR if polling worked, but read fails.
Read can still fail, e.g. if the buffer is invalid.
2015-01-13 02:37:12 +01:00
wm4 12910da66a stream_pvr: uncrustify
Mostly automatic, with some manual changes.
2015-01-06 20:27:36 +01:00
wm4 c915b0b0ec dvb: uncrustify
Mostly automatic, some manual changes.
2015-01-06 20:19:49 +01:00
Oliver Freyermuth ec92ab294e stream_dvb: Enable streaming mode, activates cache.
This causes more constant reading from the DVB device,
and seems not to hurt the stream-controls.
As the device cache seems to fill up when not
reading from it for several seconds, reading
into the cache fixes desync-issues after
the initial analyzeduration of the demuxer.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth 672b5df411 stream_dvb: Do not add special PIDs if we anyways record the full TP.
This just exchanges two blocks of code: If we record
the full transponder, no need to explicitly add some PIDs to the
filter list.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth ca32a15a22 stream_dvb: Add possibility to dump a full transponder.
Was already possible before by injecting the magic PID
8192 into channels.conf, the flag makes this much more
useable and we also have it documented.
Useful not only for debugging, but also for incomplete
channels.conf (mplayer format...), multi-channel
recording, or channels which do dynamic PID switchng.

full-transponder is also useful for channels which switch PIDs on-the-fly.
ffmpeg can handle this, but it needs the full stream with all PIDs.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth 7f84da4902 stream_dvb: Record PIDs with human-readable content, bump max demuxer count.
There is the STD which contains service-names
(ffmpeg can understand it),
and the EIT which contains the EPG
(ffmpeg does not parse it, but e.g. VLC does).

As we now have more PIDs in general, increase the maximum
number of demuxers we can open. ffmpeg has an internal
limit of 64 PIDs, we are still far from that.
2015-01-06 19:52:27 +01:00