summaryrefslogtreecommitdiffstats
path: root/stream
Commit message (Collapse)AuthorAgeFilesLines
* cache: limit readahead size to half the cache size at the beginningwm42015-05-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | Normally, the cache keeps 50% of the buffer for seeking backwards. Until now, the cache just used the full buffer size at the beginning of a file, because the 50% normally reserved for the backbuffer are unused. This caused a problem: when streaming from http, the player would first read about 150MB (default cache size), then stop until 75MB of the cache has been played. (Until the 75MB position, the cache is fully used, so nothing new can be read. After that, part of the backbuffer starts getting unreserved, and can be used for readahead.) This long read pause can cause the server to terminate the connection. Reconnecting may be possible, but if youtube-dl is used, the media URL may have become invalid. Fix this by limiting readahead to 50% even if unnecessary. The only exception is when the whole file would fit in the cache. In this case, it won't matter if we can't reconnect, because the cache covers everything anyway, and hopefully the cache will stay valid. Likely fixes #2000.
* vo_opengl: add support for custom shadersNiklas Haas2015-05-272-0/+16
|
* command: add protocol-list propertywm42015-05-232-6/+22
| | | | Fixes #1972.
* Remove trailing whitespacesMichael Vetter2015-05-151-4/+4
|
* threads: use utility+POSIX functions instead of weird wrapperswm42015-05-111-3/+6
| | | | | | | 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.)
* path: make mp_path_join accept normal C stringswm42015-05-092-4/+4
| | | | | Instead of bstr. Most callers of this function do not need bstr. The bstr version of this function is now mp_path_join_bstr().
* stream: don't print reconnection message if no stream supportwm42015-04-291-3/+5
| | | | | | | 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.
* cache: exit early on cancellationwm42015-04-211-0/+3
| | | | | | | 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.
* cache: another minor simplificationwm42015-04-211-11/+5
| | | | | | | | 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.
* cache: simplify the check for printing the "cache stuck" messagewm42015-04-211-16/+6
| | | | | | | | | | | | 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.
* command: disc-mouse-on-button propertyxylosper2015-04-213-6/+12
| | | | | This property indicates whether mouse cursor is located on button or not for disc naviation.
* stream_file: minor simplificationwm42015-04-171-11/+8
| | | | | Now all this platform-specific code doesn't depend on stream or stream_file internals anymore.
* player: allow playing directorieswm42015-04-172-4/+5
| | | | | | | | | | | 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.
* Update license headersMarcin Kurczewski2015-04-1331-159/+127
| | | | Signed-off-by: wm4 <wm4@nowhere>
* stream_rar: update commentwm42015-03-291-4/+2
| | | | The stream filter non-sense was removed, which makes it much easier.
* stream_lavf: workaround broken rtmp "timeout" optionwm42015-03-191-4/+7
| | | | | | | | | | 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.
* options: introduce --cache=yes choicewm42015-03-121-0/+2
| | | | | | 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.
* stream: use relaxed atomic loads for checking playback abortswm42015-03-091-1/+1
| | | | | | | 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.)
* stream/smb: mark as network stream for --cache=autoKevin Mitchell2015-03-091-0/+1
| | | | | | | 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.
* options: add M_OPT_FILE to new options that are missing itPhilip Sequeira2015-03-071-1/+1
| | | | Fixes shell completion.
* cache: assume file size from EOF positionwm42015-03-041-2/+8
| | | | | | 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.
* stream_cdda: add option to enable cdtext, and disable it by defaultwm42015-03-031-3/+5
| | | | Fixes #1615.
* stream_cdda: fix parameter passingwm42015-03-031-2/+0
| | | | | All cdda options (except --cdrom-drive) were ignored, because the priv struct (with the options set) was just replaced. Oops.
* player: refine rar:// playlist-safety handlingwm42015-03-023-6/+2
| | | | | | | | | | | | 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.
* stream_dvb: Always define NO_STREAM_ID_FILTER if missing.Oliver Freyermuth2015-02-281-1/+1
| | | | | | | 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 .
* stream: remove stream filter conceptwm42015-02-274-42/+15
| | | | Unused since the previous commit. (Apparently it was a stupid idea.)
* stream_rar: treat rar files as playlistswm42015-02-272-77/+8
| | | | | | | | | | | | 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
* cache: use MPCLAMP() macrowm42015-02-251-9/+2
|
* cache: limit to file sizewm42015-02-251-1/+8
| | | | | Saves some memory. Should be especially helpful if many small files are loaded, like when mass-loading subtitle files and the cache is enabled.
* stream_file: open pipes non-blockingwm42015-02-201-4/+33
| | | | | Now the player can actually be quit if a pipe was opened, but nobody is writing to it.
* cache: silence "EOF reached" messagewm42015-02-181-1/+1
| | | | | | | | | | | | | 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.
* dvb_tune: fix invalid syntaxwm42015-02-111-1/+1
| | | | Oops.
* stream: get rid of remaining uses of the end_pos fieldwm42015-02-067-26/+25
| | | | | | | | 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!).
* stream: minor cleanupswm42015-02-064-88/+64
| | | | | | | | | | | | | | | | 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.
* stream: slightly improve reconnect behaviorwm42015-02-062-18/+29
| | | | | Wait for a longer time between reconnects. Introdeuce and use mp_cancel_wait(), so that quitting is still immediate.
* stream_lavf: fix build with Libavwm42015-02-061-2/+5
| | | | | | The API function used is FFmpeg-only. Sigh...
* options: add --network-timeoutwm42015-02-061-0/+3
| | | | | | Not quite sure if this actually works as intended. Fixes #1566.
* stream_cdda: fix bugs in chapter time retrievalwm42015-02-041-2/+2
| | | | | | | | | | | | | | | | | | 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.
* command: add dummy get implementation for tv-channel propertywm42015-02-021-0/+1
| | | | | A small cosmetic change with the effect that pressing 'k' shows "unavailable" instead of "error" (even if no TV code is active).
* stream: reject overly long URLswm42015-01-211-0/+4
|
* stream_lavf: escape disallowed characters in http URLswm42015-01-212-5/+24
| | | | | | | | | | | | | | | | | 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.
* dvd: try to improve seekingwm42015-01-191-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* stream_dvb: silence bogus compiler warningwm42015-01-191-1/+1
| | | | | | 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.
* cache: cache-position needs to be int64_tOliver Freyermuth2015-01-131-1/+1
| | | | | | Both max_filepos and offset are int64_t, so pos can overflow, e.g. causing endless loops in stream implementation.
* stream_dvb: Add MP_ERR if polling worked, but read fails.Oliver Freyermuth2015-01-131-0/+4
| | | | Read can still fail, e.g. if the buffer is invalid.
* stream_pvr: uncrustifywm42015-01-061-1306/+1188
| | | | Mostly automatic, with some manual changes.
* dvb: uncrustifywm42015-01-063-1272/+1261
| | | | Mostly automatic, some manual changes.
* stream_dvb: Enable streaming mode, activates cache.Oliver Freyermuth2015-01-061-0/+1
| | | | | | | | | 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.
* stream_dvb: Do not add special PIDs if we anyways record the full TP.Oliver Freyermuth2015-01-061-23/+22
| | | | | | This just exchanges two blocks of code: If we record the full transponder, no need to explicitly add some PIDs to the filter list.
* stream_dvb: Add possibility to dump a full transponder.Oliver Freyermuth2015-01-062-4/+11
| | | | | | | | | | | | 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.
* stream_dvb: Record PIDs with human-readable content, bump max demuxer count.Oliver Freyermuth2015-01-062-1/+15
| | | | | | | | | | | 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.
* stream_dvb: Also demux PMT if possible, reactivate TPID parsing.Oliver Freyermuth2015-01-064-12/+113
| | | | | | | | | | | | If VDR-channel-config is used, we know the service_id. Using that, PMT can be extracted from PAT (code for that inspired by szap-s2 again). For this, we need to demux PAT with a special filter-setup, and once PMT was found it can be added to the PID-list. PMT is only resolved the first time one tunes to a channel, then stored in the channel-list in memory. With PMT available, ffmpeg can safely decode the teletext-pids.
* stream_dvb: Extend token-list for pid-parsing, magically allows to parse ↵Oliver Freyermuth2015-01-061-3/+33
| | | | | | | | | | | VDR-style PID-lists. I also added a comment explaining the potentially occuring structures for future reference. For tokenization, a custom strtok_r implementation is used, inspired by strtok_r as implemented in musl and ffmpeg, hopefully slightly more readable (av_strtok_r is not available in libav, and strtok_r is not available everywhere).
* stream_dvb: Move out PID-parsing, disable TPID parsing.Oliver Freyermuth2015-01-061-26/+38
| | | | | | | Move PID-string parsing into a separate function, reduces code-duplication. Drop TPID-parsing again since teletext-stream seems not really correctly identified (ffmpeg guessed mp3 in my test...). Parsing now done using strtok + sscanf instead of sscanfs with fixed numbers of expected fields - gives more correct checking of PID-overflow, will allow VDR-style PID-field parsing.
* stream_dvb: Add TPID (teletext-pid) parsing from VDR-style channel-lists.Oliver Freyermuth2015-01-061-23/+28
| | | | | The PID-parsing is not really nicely done and also does not yet handle the special VDR-style syntax. A later commit will move the parsing to a separate function handling that which also checks that the maximum PID-count is not exceeded.
* stream_dvb: Handle VDR-config location-field as DISEQc-field.Oliver Freyermuth2015-01-061-6/+26
| | | | | | | In mplayer-style channels-config, we had a LNB-field used for that. In old VDR times, the location-field was also containing DISEQc information, now it does that only indirectly (location => LNB => vdr knows from lnb-config). We only accept it as this if the field is fully numeric.
* dvb: Extend understanding of VDR channel config: stream_id, inversion.Oliver Freyermuth2015-01-064-9/+33
| | | | | | | Now also "stream ID" (for DVB-S2) and "inversion" are understood. The parameter-string can also provide information on FEC, rolloff etc. For DVB-S, "auto" which mpv uses by default should be fine, I can also confirm it works. For non-DVB-S cards, it might be useful to also parse this information in case of a vdr-channel list. As I have no such hardware and thus would have to do it blindly, I added a FIXME. Mostly complete vdr-channels.conf format documentation is at http://www.vdr-wiki.de/wiki/index.php/Channels.conf (german only).
* stream_dvb: Very basic vdr-type channels.conf support.Oliver Freyermuth2015-01-061-24/+80
| | | | | | | | | | | Still incomplete. Initialize is_dvb_s2 boolean in channel-struct. We first check whether the channels.conf-line at hand is sscanf'able with a vdr-style pattern. If yes, we assume it is a vdr-channel-config (we check whether sscanf consumed the full line). The vdr-style config also contains a parameter-string which contains information about polarization + delivery type (e.g. DVB-S2). With this change, S2-tuning works with a VDR-channel list. Missing (later commits): - vdr-parameter-string also contains other information, e.g. invert-flag, needs to be parsed. - Diseqc-lnb-number is not present in VDR-config (I believe it is handled via the location-parameter + lnb-config there). For backwards compatibility, the location-parameter can be the lnb-number - we should test whether it is an int and assume this in this case. - VID, AID and TID-lists are extremely ugly in their syntax for VDR. At the moment, only the first number is parsed (and TID fully ignored), needs to be fixed.
* dvb: Extend dvb_channel struct, needs to know whether channel is S2.Oliver Freyermuth2015-01-063-11/+19
| | | | | | It contains now also a boolean which tells whether this is an DVB-S2 channel (not initialized yet - tbd in next commit). We could also pass through the type of the delivery system (would be more flexible), but the delivery-system-enum is only available with S2API, so this is more backwards-compatible. If someone has DVB-T2 / DVB-C2 hardware and extends the code to deal with it, this should be changed.
* dvb_tune: (DVB-S) Initial S2API support.Oliver Freyermuth2015-01-061-13/+79
| | | | | | | | | | | Also allows demuxers to buffer, and we explicitly discard stale QPSK events. Inspiration taken from the szap-s2 implementation. S2API is only used if available and for DVB-S cards - it might also be useful to have that for DVB-T2 / DVB-C2 tuning later, but I do not have the HW / no DVB-T2 broadcasting station nearby to test functionality. This should do no functional changes, only usage of the different API. The S2API is more extensible and a requirement for all the HD-deliveries (e.g. DVB-S2) and since 2.6.28 is the successor of the old API. Tuning to DVB-S2 channels actually already "works" like this if the delivery is hardcoded in - for a fully working implementation, the channels.conf.sat would need an additional field indicating the delivery type (VDR-type channels.conf have that). Th