summaryrefslogtreecommitdiffstats
path: root/stream/cache2.c
Commit message (Collapse)AuthorAgeFilesLines
* core: automatically pause on low cachewm42012-12-031-1/+8
| | | | | | | | | | | | | | | When the cache fill status goes below a certain threshold, automatically pause the player. When the cache is filled again, unpause again. This is intended to help with streaming from http. It's better to pause a while, rather than exposing extremely crappy behavior when packet reads during decoding block the entire player. In theory, we should try to increase the cache if underruns happen too often. Unfortunately, changing the cache implementation would be very hard, because it's insane code (forks, uses shared memory and "volatile" etc.). So for now, this just reduces the frequency of the stuttering if the network is absolutely too slow to play the stream in realtime.
* cache: simplify furtherwm42012-12-031-11/+9
| | | | | | | | | | | | This commit is separate from the previous one to separate our own changes from changes merged from mplayer2 (as far as that was possible). Make it easier for stream implementations to request being cached. Set a default cache size in stream.c, and remove them from various stream implementations. Only MS streaming support sets a meaningful cache size. Make querying cache size saner. This reduces the amount of #ifdefs needed.
* cache: refactor how cache enabling is doneUoti Urpala2012-12-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Code enabling the cache by default for network streams did that by modifying the value of the "cache" option. This wasn't sane, as multiple streams may be created and all share the same options. Change the code to not modify options but store data in the stream instance instead. Conflicts: core/mplayer.c demux/demux.c stream/cache2.c stream/network.c stream/network.h stream/pnm.c stream/stream.c stream/stream_rtp.c Merged from mplayer2 commit e26070. Note that this doesn't solve any actual bug, as the playlist crashing bug has been fixed before. Since the global cache size option value is not overwritten anymore, the option doesn't need to be restored on end of playback (M_OPT_LOCAL).
* stream: change STREAM_CTRL_GET_SIZE argument type to uint64_treimar2012-11-201-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | Update endpos each time libavformat asks for it. Fixes playback of still downloading files to not stop before we really reached the end. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35107 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpdemux/demux_lavf.c Change STREAM_CTRL_GET_SIZE argument type from off_t to uint64_t. Also fix the incorrect type of the uint64_res variable. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35360 b3059339-0415-0410-9bf9-f77b7e298cf2 Conflicts: libmpdemux/demux_lavf.c libmpdemux/muxer_lavf.c Note: also merges the "forgotten" cache support from r35107.
* Rename directories, move files (step 2 of 2)wm42012-11-121-2/+2
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* stream: add STREAM_CTRL_GET_CURRENT_TITLEib2012-10-301-0/+3
| | | | | | | | Add new stream control command STREAM_CTRL_GET_CURRENT_TITLE for DVDs. This provides the current title (aka track) number of a DVD. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35263 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: enable STREAM_CTRL_GET_NUM_TITLESib2012-10-301-0/+3
| | | | | | | | Allow STREAM_CTRL_GET_NUM_TITLES with cache enabled. This is missing in r34474. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35258 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: fix long hangsreimar2012-10-301-1/+1
| | | | | | | | | | Avoid sleeping 0 ms, this can cause sleep to be not called at all. This will then cause long hangs e.g. when sleeping on single-CPU/core computers. Should fix bug #2084. Patch suggested by Visenri [visenri yahoo es] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35119 b3059339-0415-0410-9bf9-f77b7e298cf2
* core, timeline: cache external ordered chapter files tooStefano Pigozzi2012-09-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Previously, Matroska source files other than the initially opened one were always accessed without caching. Enable cache for extra files too. A separate cache process/thread is started for each file, which is less than optimal but probably better than no caching if the user explicitly enabled cache. This commit only implements caching for Matroska ordered chapters (not for EDL timeline). To build the timeline we need to demux the files in the current directory to look for segments with matching uuid. This first demux is done with no cache since we don't need to read a lot of the stream. If the file is recognized as one of the needed sources it's reopened with cache enabled. Also move the stream_cache_size global variable to the options struct. Conflicts: cfg-mplayer.h mplayer.c stream/stream.h timeline/tl_matroska.c
* Adjust ffmpeg/libav #includes to work with recent upstream changesUoti Urpala2012-08-211-3/+4
| | | | | | | | The <libavutil/avutil.h> stopped including <libavutil/common.h> recursively in recent ffmpeg/libav git revisions. As a result, some files no longer got needed definitions, causing a build failure. Modify #include lines in various files to fix build with the latest versions of ffmpeg/libav headers.
* Remove support for LIVE555 RTSP streamingwm42012-08-201-4/+0
| | | | | | | | | | | | The main excuse for removing this is that LIVE555 deprecated the API the mplayer implementation was using. The old API still seems to be somewhat supported, but must be explicitly enabled at LIVE555 compilation, so mplayer won't always work on any user installation. The implementation was also very messy, in C++, and FFmpeg support is available as alternative. Remove it completely.
* commands, dvd, dvdnav, bluray: cleanup sub/audio track language displaymplayer-svn2012-08-031-0/+9
| | | | | | | | | | | | | | | | | | | | | Code cleanup: Use a stream_control instead of global functions to get the language associate with a audio or subtitle stream from the streaming layer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34736 b3059339-0415-0410-9bf9-f77b7e298cf2 Support showing the stream language with br:// playback. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34737 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix DVDs showing the subtitle language as "unknown" for a long time. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34777 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar Note: heavily modified by wm4 for this fork of mplayer.
* cache2: allow cache sizes up to 4 TBmplayer-svn2012-08-031-27/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove variable that is only assigned but never used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34791 b3059339-0415-0410-9bf9-f77b7e298cf2 Allow using a cache size of up to 4 TB. Obviously anything close to 4 GB will always fail on 32 bit systems. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34792 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace off_t by int64_t in cache code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34793 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove casts that are no longer necessary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34794 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix header file after r34793. Patch by Stephen Sheldon, sfsheldo gmail com. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34802 b3059339-0415-0410-9bf9-f77b7e298cf2 Put #include <inttypes.h> into the header file where it should be. Reported by Stephen Sheldon, sfsheldo gmail com. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34798 b3059339-0415-0410-9bf9-f77b7e298cf2 Correct r34798. The header only needs stdint.h while the C file needs inttypes.h. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34799 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
* cache2: flush cache and sync stream position/eof after seeking STREAM_CTRLsmplayer-svn2012-08-031-10/+33
| | | | | | | | | | | | | | | | | | | | This avoid some strange differences in behaviour between -cache and -nocache. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34461 b3059339-0415-0410-9bf9-f77b7e298cf2 cache2: fix seeking with e.g. flv files This is a regression that was introduced in r34461. Found and bisected by Anssi Hannula [anssi.hannula iki fi]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34575 b3059339-0415-0410-9bf9-f77b7e298cf2 cache2: print an error when streams behave in a way that the cache cannot handle git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34576 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
* cache2: make cache process exit when main process diesmplayer-svn2012-08-031-0/+13
| | | | | | | | Make cache process detect when the main process disappeared and make it exit on its own in that case. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34371 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
* cache2: make warnings easier to understandmplayer-svn2012-08-031-2/+2
| | | | | | | | | | | | Mark two warnings that usually only indicate a performance issue as such. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33955 b3059339-0415-0410-9bf9-f77b7e298cf2 Another attempt to make message easier to understand. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33956 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
* mplayer: rip out --capture supportwm42012-08-021-2/+0
| | | | | | | While this was an interesting idea, it wasn't actually useful. Basically it dumped the raw data (as requested by the demuxer) into a file. The result is only useful if the file format was raw or maybe some MPEG packet stream, but not with most modern file formats.
* build: remove OS/2 supportUoti Urpala2012-04-061-7/+1
|
* cleanup: Silence compilation warnings on MinGW-w64wm42012-03-011-0/+2
| | | | | | | | | | | | | | | | | | | Some of the code, especially the dshow and windows codec loader parts, are extremely hacky and likely full of bugs. The goal is merely getting rid of warnings that could obscure more important warnings and actual bugs, instead of fixing actual problems. This reduces the number of warnings from over 500 to almost the same as when compiling on Linux. Note that many problems stem from using the ancient wine-derived windows headers. There are some differences to the "proper" windows header. Changing the code to compile with the proper headers would be too much trouble, and it still has to work on Unix. Some of the changes might actually break compilation on legacy MinGW, but we don't support that anymore. Always use MinGW-w64, even when compiling to 32 bit. Fixes some warnings in the win32 loader code on Linux too.
* cache: don't modify argument when stream control failsreimar2011-07-061-2/+3
| | | | | | | | | | | | | | | When handling STREAM_CTRL calls for the cached stream, do not modify the return parameter if the underlying stream returns an error for the operation. Avoids issues with some places that don't check the return value of stream_control. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33802 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove condition that is now always true. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33803 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: allow STREAM_CTRL_GET_CURRENT_TIME with cachereimar2011-07-061-3/+12
| | | | | | | | | | | | | Change code to allow STREAM_CTRL_GET_CURRENT_TIME with cache enabled. Due to that time being from what is currently read into the cache it is unfortunately somewhat inaccurate and unsmooth, however for streams that do have stream timestamps it is till a lot better than going by the demuxer alone. In particular it fixes bug #1081, when starting a DVD with -chapter following seeks would be relative to the start of the DVD instead of the current position. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33605 b3059339-0415-0410-9bf9-f77b7e298cf2
* cosmetics: cache2.c: Fix commentreimar2011-07-061-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33600 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache2.c: Avoid warnings about discarding volatilereimar2011-06-291-4/+10
| | | | | | | | | In practice this should not really make a difference, but the code is not significantly worse and it is more correct. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33435 b3059339-0415-0410-9bf9-f77b7e298cf2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33447 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: call stream read with at least sector size spacereimar2011-05-011-2/+18
| | | | | | | | | | | | Ensure we always pass a buffer of at least sector size to the read function. This is never an issue with streams that have actual sectors, as the reads will always return a multiple of sector size and the cache is always used in blocks of sector size. However the rtp protocol misuses this so it can just assume it always has a sufficiently large buffer available and thus fails without this extra hack. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33120 b3059339-0415-0410-9bf9-f77b7e298cf2
* terminal output: show cache fill changes in "PAUSED" messagereimar2011-02-151-3/+8
| | | | | | | | | | | Convert cache_fill_status into a function so we always get the latest state, not whatever it was after the last read. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32818 b3059339-0415-0410-9bf9-f77b7e298cf2 Update PAUSED status line with cache fill status if it changed. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32819 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: suggest increasing cache size in the "not filling!" messagereimar2011-01-311-1/+1
| | | | | | | Change "cache not filling" warning to include a hint to increase the cache size. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32815 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: read up to 64 KiB at once from stream_filereimar2010-11-141-1/+5
| | | | | | | | | Make the file protocol read up to 64 KiB at once when the cache is used, assuming that files will generally be readable with high bandwidth. This should improve performance when playing e.g. from high-latency network shares. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32616 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache, stream: avoid extra memcpy when using cachereimar2010-11-071-2/+2
| | | | | | | | | | Add a stream_read_internal() function that reads directly into a given buffer instead of the stream's internal one. Use this to read directly into cache memory, avoiding a memcpy(). This requires also adding a stream_seek_internal() as the normal seek function reads into the stream's buffer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32559 b3059339-0415-0410-9bf9-f77b7e298cf2
* cosmetics: cache2.c: Remove some irrelevant commented-out codereimar2010-11-071-8/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32555 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add a simple capture feature (-capture)Uoti Urpala2010-11-021-0/+2
| | | | | | | | | | | | | | | | | If a specified key is pressed during playback, the current stream is captured to a file, similar to what -dumpstream achieves. original patch by Pásztor Szilárd, don tricon hu Taken from the following svn commits, but with several fixes and modifications (one obvious user-visible difference is that the default key binding is 'C', not 'c'): git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32524 b3059339-0415-0410-9bf9-f77b7e298cf2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32529 b3059339-0415-0410-9bf9-f77b7e298cf2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32530 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: Remove unused cache_stats functiondiego2010-11-021-10/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32121 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: add sanity-check for sector sizereimar2010-11-021-1/+7
| | | | | | | Add sanity-check for sector size to avoid strange crashes if it is too large. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31914 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: Don't mess up current position if time-based seek failsreimar2010-11-021-1/+2
| | | | | | | | Avoid STREAM_CTRL_SEEK_TO_TIME messing up the current position for stream types which do not support it. Fixes seeking in local flv files. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31907 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: Use sigaction() instead of signal()reimar2010-11-021-3/+6
| | | | | | | | | | | Signal() has an unavoidable race-condition on "broken by backwards-compatibility" systems like Solaris. (Upon receiving a signal, the handler is reset to SIG_DFL, thus a second signal will kill the process. The problem could also be reduced by re-installing the handler inside the handler, but there's still a race-condition and the risk of the handler being called inside the handler). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31738 b3059339-0415-0410-9bf9-f77b7e298cf2
* cache: Respect -cache-seek-min also for on-disk filesreimar2010-11-021-3/+5
| | | | | | | Should reduce issues with mp4/mov (playing those may involve a lot of seeking inside the file). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31371 b3059339-0415-0410-9bf9-f77b7e298cf2
* Merge svn changes up to r31256Uoti Urpala2010-05-301-4/+31
|\
| * Fix typo in message.reimar2010-05-281-1/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31256 b3059339-0415-0410-9bf9-f77b7e298cf2
| * 100l, stream_check_for_interrupt argument is not in usec,reimar2010-05-281-3/+3
| | | | | | | | | | | | | | so we would end up sleeping for 10s instead of 10ms. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31254 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Improve handling of cache process/thread hanging/being killed.reimar2010-05-281-3/+23
| | | | | | | | | | | | | | In particular allow a single STRG+C to quit MPlayer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31251 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Fix cache process accidentally being killed by SIGUSR1.reimar2010-05-281-0/+7
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31250 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r31244Uoti Urpala2010-05-301-6/+6
|\|
| * Fix a bunch of typos in the stream cache code.diego2010-05-271-6/+6
| | | | | | | | | | | | | | patch by Giorgio Vazzana, mywing81 gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31242 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r31226Uoti Urpala2010-05-301-3/+11
|\|
| * Retry reading even if we hit eof before.reimar2010-05-261-2/+2
| | | | | | | | | | | | | | This allows playing growing files even with a large cache. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31226 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Re-enable wakeup-on-signal for cache process.reimar2010-05-261-5/+10
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31224 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Disable waking the cache process up via a signal, itreimar2010-05-261-1/+4
| | | | | | | | | | | | | | currently causes read errors due to not handling EINTR. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31223 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r31211Uoti Urpala2010-05-301-45/+78
|\| | | | | | | | | The merged cache2.c changes are known to have problems. Will merge further fixes to them before merging this to the master branch.
| * Slightly reduce number of #ifsreimar2010-05-231-22/+20
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31204 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Use an extra define to simplify ifdefsreimar2010-05-231-14/+20
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31203 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Try reducing the #ifdef mess for the different cache variants.reimar2010-05-231-15/+13
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31202 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Extract the cache main loop into a separate function.reimar2010-05-231-14/+19
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31201 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Optimize cache behaviour for the many-consecutive-seeks case.reimar2010-05-231-1/+13
| | | | | | | | </