summaryrefslogtreecommitdiffstats
path: root/stream
Commit message (Collapse)AuthorAgeFilesLines
* stream_lavf: check seekable flag correctlywm42016-09-271-1/+1
| | | | | | AVIOContext.seekable is actually a bitfield. Currently, it has only AVIO_SEEKABLE_NORMAL defined, but it might be extended with a hint for non-byte seekability. Thus we should check it correctly.
* stream_lavf: fix determining seekabilitywm42016-09-261-3/+23
| | | | | | | | | | | | | | | | | | | | demux_lavf.c forces seek to being determined as supported if STREAM_CTRL_HAS_AVSEEK is returned as success. But it always succeeds with current FFmpeg versions. (Seems like Libav commit cae448cf broke this in early 2016.) Now we can't determine via private API whether the underlying protocol supports read_seek anymore. The affected protocols (mostly rtmp) also set seekable=0, meaning they signal they're not seekable, even though read_seek would work. (My guess is that this can't be fixed because even though seekable is in theory a combination of elaborate flags [of which only 1 is defined, AVIO_SEEKABLE_NORMAL], a seekable!=0 always means it's byte-seekable in some way.) So the FFmpeg API is being garbage _again_, and all what we can do is determining this via protocol name and a whitelist. Should fix the behavior reported in #1701.
* stream/stream_lavf: user-agent option is deprecatedRiCON2016-09-181-1/+1
| | | | | | There was both user-agent and user_agent options, the former is deprecated in FFmpeg/FFmpeg@27714b462 master. Libav uses both forms. This avoids constant `[ffmpeg] http: the user-agent option is deprecated, please use user_agent option` warnings using ytdl_hook.
* stream_cb: don't add "*://" to protocol listwm42016-09-102-5/+1
| | | | | | | | | --list-protocol was printing a *:// entry, which looked strange at best. The "*" protocol was used to always match everything, so stream_cb.c could hook in custom protocols with a prefix chosen by the API user. Change it instead so that an empty protocol list means "match all", which also gets rid of the special-cased "*" entry.
* stream, demux, config: remove some dead/unneeded option-related codewm42016-09-092-92/+0
| | | | | | | | | | This has all been made unnecessary recently. The change not to copy the global option struct in particular can be made because now nothing accesses the global options anymore in the demux and stream layers. Some code that was accidentally added/changed in commit 5e30e7a0 is also removed, because it was simply committed accidentally, and was never used.
* stream_cdda: remove weird option parsing stuffwm42016-09-091-29/+12
| | | | | | | | | | Mostly untested. This is not compatible. It removes the URL fields for track range and cdrom speed (what did this even do). The device is not not to be prefixed with an additional "/" if it's put into the URL. I can't be bothered to keep these things compatible, just rip your damn CDs instead.
* tv: remove weird option parsing stuffwm42016-09-091-17/+0
| | | | Mostly untested.
* stream_dvb: remove weird option parsing stuffwm42016-09-091-24/+24
| | | | Mostly untested.
* stream_dvd, stream_dvdnav: remove weird option parsing stuffwm42016-09-084-66/+93
| | | | | | Same deal as with stream_bluray. Untested because I don't give a fuck about your shitty DVDs.
* stream_bluray: fix a minor memory leakwm42016-09-081-2/+3
|
* stream_bluray: remove weird option parsing stuffwm42016-09-081-51/+45
| | | | | | | Instead, parse manually. This is to get rid of the option API usages, which seem unnecessary and shoehorned. (Just look at the URL pseudo parsing and the dumb url_options map. They were pretty much artifacts from refactoring old mplayer code.)
* osdep: rename atomics.h to atomic.hwm42016-09-071-1/+1
| | | | | The standard header is stdatomic.h, so the extra "s" freaks me out every time I look at it.
* demux: do not access global optionswm42016-09-063-27/+65
| | | | | | | | | | | | | | | | | Don't access MPOpts directly, and always use the new m_config.h functions for accessing them in a thread-safe way. The goal is eventually removing the mpv_global.opts field, and the demuxer/stream-layer specific hack that copies MPOpts to deal with thread-safety issues. This moves around a lot of options. For one, we often change the physical storage location of options to make them more localized, but these changes are not user-visible (or should not be). For shared options on the other hand it's better to do messy direct access, which is worrying as in that somehow renaming an option or changing its type would break code reading them manually, without causing a compilation error.
* stream_cb: remove broken castwm42016-08-311-1/+1
| | | | | | | seek_fn is supposed to return the new file offset, or a negative error code. Our code doesn't use the offset, and only wants to know if any errors happened. The int cast is completely broken and might treat a successful seek as failed depending on whether the sign bit will be set.
* cache: don't use a backbuffer if the cache is as large as the filewm42016-08-261-10/+14
| | | | | | | | | | | | It's just wasted memory. One corner case is when a file grows during playback, but this is rare and usually happens on-disk only. The cache size was generally limited before this change already, so no reason to care. As an unrelated change, move the cache size info to the resize_cache() function. There's really no reason not to do this, and it's slightly more informative if the user changes the cache size at runtime.
* stream_memory: disable stream cachewm42016-08-261-0/+1
| | | | Obviously makes no sense and just wastes resources.
* stream/stream_bluray: display list of available titles on verboseRicardo Constantino2016-08-111-0/+6
| | | | Based on similar code on FFmpeg and libbluray's list_titles example.
* stream: fix double-free if cache init failswm42016-08-081-1/+3
| | | | | | | | | | | | If the normal stream cache init fails, and a file cache was initialized before, we free the file cache as well. But since the file cache is chained to the real stream, the real stream will also be freed. This has to be prevented by clearing the pointer to the original stream in the uncached_stream field. This could in particular be triggered by using --cache-initial=1000 and aborting playback during loading. (Without that option, stream cache init failure is far less likely.)
* client API: add stream_cb API for user-defined stream implementationsAman Gupta2016-08-073-0/+128
| | | | | | Based on #2630. Some heavy changes by committer. Signed-off-by: wm4 <wm4@nowhere>
* tvi_v4l2: fix style in the uninit functionBen Boeckel2016-08-051-4/+6
|
* tvi_v4l2: explicitly brace the codeBen Boeckel2016-08-051-1/+4
| | | | | It's fine either way, but this code is weirdly formatted. Make it more explicit.
* libarchive: sanitize non-UTF8 archive entrieswm42016-07-181-2/+2
| | | | | | | | | Some client API users simply don't like such filenames. For their sake, don't return them, but return a dummy filename instead. (Returning a latin1-ized version would work too, but is slightly more work.) Also remove the "\n" from the replacement dummy filename. This was accidental.
* libarchive: unify entry iteration between stream/demux layerswm42016-07-182-26/+51
| | | | No really good reason to duplicate this.
* cache: minor simplificationwm42016-07-111-7/+10
| | | | | Every cache_wakeup_and_wait() caller has to deal with asynchronous stream abort, so why not make it somehow part of the function.
* cache: fix previous commitwm42016-07-111-1/+11
| | | | | | | | | | | The cache reader thread actually unlocks the mutex protecting the underlying stream while reading from it. That's why other code goes out of its way to run certain stream operations on the cache thread. Do the same. We could have this simpler by creating a mechanism that would "park" the cache thread and make it wait for the lock (while we have it) in order to gain exclusive access. This could be done in the future.
* cache: propagate seek failureswm42016-07-111-7/+17
| | | | | | | | | | | Eagerly execute seeks to the underlying stream in the cache seek entrypoint itself. While asynchronous execution is a goal of the cache, it doesn't matter too much for seeks. They always were executed within the lock, so the reader was blocked anyway. It's not necessary to ensure async. execution here either, because seeks are relatively rare, and the demuxer can just stay blocked for a while. Fixes: mpv http://samples.mplayerhq.hu/V-codecs/DIV5/ayaneshk-test.avi
* Fix misspellingsstepshal2016-06-261-1/+1
|
* build: silence -Wunused-resultNiklas Haas2016-06-071-1/+1
| | | | | | | | For clang, it's enough to just put (void) around usages we are intentionally ignoring the result of. Since GCC does not seem to want to respect this decision, we are forced to disable the warning globally.
* stream: separate posix/win32 cancellation codewm42016-05-201-27/+55
| | | | | | | | | This code evolved into an ifdef mess as support for cancellation on Windows was added. Make the Windows-specific code completely separate. It looks cleaner, and it also means that some of the posix code is not uselessly enabled on Windows. The latter made msvcrt.dll output warnings because it does not like -1 passed as FD to read/write. (The same would be harmless on POSIX.)
* cache: simplify speed calculationswm42016-05-121-19/+7
| | | | | | | | | | Remove the attempted cleverness; keep it dumb. This strictly calculates the average speed over an at least 1 second window (longer if I/O blocks it). Since this doesn't reset the speed anymore when reading stops by going idle, the results might actually be more accurate now.
* stream_cdda: enable cache by defaultwm42016-05-101-0/+2
| | | | Requested.
* stream_memory: add hex:// protocolwm42016-04-201-2/+35
| | | | Completely useless, expect for some special purposes.
* cache: disable useless "Cache is not responding" warningwm42016-04-031-1/+1
| | | | | | | | | | | | | | | Tuning it in a way to be actually useful is too much effort. As alternative, there's the "buffering" detection, which operates on a much higher level. The only disadvantage is that it's harder to guess for the user whether this is a network problem, or if e.g. libavformat is probing too much data when opening a stream. Maybe the cache-speed property is helpful here. For now, do not remove the associated code, but just silence the warning. Fixes #3019.
* build: make DVB test stricterwm42016-04-021-0/+2
| | | | | | | | | | | | | | | | | | | I got a report that the build on a recent aarch64 Linux kernel failed. DVB support was detected, but errored on compilation: In file included from ../stream/stream_dvb.c:57:0: ../stream/dvbin.h:72:5: error: unknown type name 'fe_bandwidth_t' fe_bandwidth_t bw; Make the test stricter, which should take care of this. (I couldn't find out what exactly triggered the failure, nor could I attempt to reproduce it.) The change in stream/dvbin.h is to make sure that this isn't caused by incorrect header inclusion. It now includes the same files as the configure test.
* cache: fix incorrect EOF conditionwm42016-03-291-1/+2
| | | | | | Don't assume EOF if we didn't try to read anything in the first place. Fixes regressions in particular with low cache sizes, which triggered the other code paths more often.
* cache: use a single STREAM_CTRL for various cache infowm42016-03-292-23/+23
| | | | | | | | Instead of having a separate for each, which also requires separate additional caching in the demuxer. (The demuxer adds an indirection, since STREAM_CTRLs are not thread-safe.) Since this includes the cache speed, this should fix #3003.
* command: add cache-speed propertywm42016-03-202-14/+48
| | | | | | | Should reflect I/O speed. This could go into the terminal status line. But I'm not sure how to put it there, since it already uses too much space, so it's not there yet.
* cache: remove unused STREAM_CTRL_RESUME_CACHEwm42016-03-032-5/+0
| | | | Went way with DVD/BD menu support.
* demux: remove relative seekingwm42016-02-281-33/+4
| | | | | | | | | | | | | | | | | | | Ever since a change in mplayer2 or so, relative seeks were translated to absolute seeks before sending them to the demuxer in most cases. The only exception in current mpv is DVD seeking. Remove the SEEK_ABSOLUTE flag; it's not the implied default. SEEK_FACTOR is kept, because it's sometimes slightly useful for seeking in things like transport streams. (And maybe mkv files without duration set?) DVD seeking is terrible because DVD and libdvdnav are terrible, but mostly because libdvdnav is terrible. libdvdnav does not expose seeking with seek tables. (Although I know xbmc/kodi use an undocumented API that is not declared in the headers by dladdr()ing it - I think the function is dvdnav_jump_to_sector_by_time().) With the current mpv policy if not giving a shit about DVD, just revert our half-working seek hacks and always use dvdnav_time_search(). Relative seeking might get stuck sometimes; in this case --hr-seek=always is recommended.
* stream_dvb: fix minor resource leakswm42016-02-121-0/+3
| | | | | | Fixes CID 1350062 and 1350061. Just for the sake of shutting up Coverity.
* stream_dvb: remove dead codewm42016-02-121-5/+0
| | | | Fixes CID 1350063.
* dvb: fix segmentation fault in case no valid configuration is found.Oliver Freyermuth2016-01-241-2/+3
| | | | This was introduced in c55b242 .
* dvb: remove trailing whitespacewm42016-01-222-18/+18
|
* dvb: fix compilation with older Linux headerswm42016-01-221-1/+2
| | | | | | | At least DTV_ENUM_DELSYS is not available in older versions. It's hard to tell when this identifier was introduced, but it appears it was probably API version 5.5.
* stream_dvb: add verbose output in non-DVBv5 querying.Oliver Freyermuth2016-01-211-1/+3
| | | | | May help in future debugging in case of old kernels with modern / obscure devices.
* stream_dvb: use DVBv5 API also for DVB-C tuning.Oliver Freyermuth2016-01-211-8/+39
| | | | | | | | | | | Using the new API is a necessity for multiple-delivery-system devices, since the old API does not offer a way to switch the delivery system of the card. This should in principle also be done for DVB-T / ATSC, especially since most DVB-T devices also support DVB-C, but I can not test such an implementation due to lack of hardware (currently) so it seems better to leave the existing, tested code-path in place for now.
* stream_dvb: improve messages on delivery-type detection.Oliver Freyermuth2016-01-211-10/+14
| | | | | | | | No need use use all capital letters, and don't warn if DVB-S2 is supported in addition since we handle that in DVB-S case already. Also, print the delivery system number for still unhandled delivery systems to simplify debugging.
* stream_dvb: don't requery tuner type, rely on initial query.Oliver Freyermuth2016-01-211-11/+9
| | | | | | | | | Saves one unnecessary additional ioctl per tuning by just reusing existing information. Should also fix the case of multiple supported delivery types since we now rely on the initial query from the chosen configuration after channel list parsing instead of requerying the device.
* stream_dvb: support frontends with multiple delivery systems.Oliver Freyermuth2016-01-213-59/+122
| | | | | | | | | Most common case would be DVB-C / DVB-T combination cards. Cards with multiple delivery systems are only supported starting from DVBv5 API (Kernel 2.6.38). In this case, we loop over all delivery systems and just treat them as different cards would be treated: They all get their own TUNER-type, channel-list parsing etc.
* Relicense some non-MPlayer source files to LGPL 2.1 or laterwm42016-01-193-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This covers source files which were added in mplayer2 and mpv times only, and where all code is covered by LGPL relicensing agreements. There are probably more files to which this applies, but I'm being conservative here. A file named ao_sdl.c exists in MPlayer too, but the mpv one is a complete rewrite, and was added some time after the original ao_sdl.c was removed. The same applies to vo_sdl.c, for which the SDL2 API is radically different in addition (MPlayer supports SDL 1.2 only). common.c contains only code written by me. But common.h is a strange case: although it originally was named mp_common.h and exists in MPlayer too, by now it contains only definitions written by uau and me. The exceptions are the CONTROL_ defines - thus not changing the license of common.h yet. codec_tags.c contained once large tables generated from MPlayer's codecs.conf, but all of these tables were removed. From demux_playlist.c I'm removing a code fragment from someone who was not asked; this probably could be done later (see commit 15dccc37). misc.c is a bit complicated to reason about (it was split off mplayer.c and thus contains random functions out of this file), but actually all functions have been added post-MPlayer. Except get_relative_time(), which was written by uau, but looks similar to 3 different versions of something similar in each of the Unix/win32/OSX timer source files. I'm not sure what that means in regards to copyright, so I've just moved it into another still-GPL source file for now. screenshot.c once had some minor parts of MPlayer's vf_screenshot.c, but they're all gone.
* cache: add mechanism for disabling readaheadwm42016-01-182-1/+17
| | | | Will be used in a following commit.
* player, stream_dvb: implement dvb-channel-name property.Oliver Freyermuth2016-01-143-1/+37
| | | | | | | | | On read, it returns the name of the current DVB program, on write, it triggers a channel-switch to the program if it is found in the channel list of the currently active card. Compared to the dvb-channel property which already exists and is a pair of integers (card + channel number) this has the limitation of not switching the card, but is probably of much more common use.
* stream_dvb: global protection mutex and usage bit for global_dvb_state.Oliver Freyermuth2016-01-142-1/+21
| | | | | | | | | | | | | The mutex is used in dvbin_open and dvbin_close only since these are the only entry / exit points to the stream. When opening, it is first checked (mutexed) whether the state already exists and is in use, then a STREAM_ERROR is returned, since there may be only one stream_dvb active at a time. State-creation itself is also protected by mutex. In dvbin_close, the usage-bit is set to false (mutexed) in case of channel switch. In case of stream-teardown, the state is destructed (also protected by mutex).
* stream_dvb: implement GET_METADATA and return program name.Oliver Freyermuth2016-01-141-2/+13
| | | | Now title will be the current channel name also after channel switch.
* stream_dvb: persist state-information across channel-switches.Oliver Freyermuth2016-01-142-35/+71
| | | | | | | | | The state-structure is kept in a static pointer and reused on recreation of the stream. To not leak the state and the FDs within upon mpv shutdown, the state-structure is still destructed gracefully in dvbin_close(), unless a channel switch has been initiated directly before. This fixes channel-switching for DVB which was broken since a609877.
* dvb: rename dvb_config_t to dvb_state_t, keep config and state there.Oliver Freyermuth2016-01-143-117/+128
| | | | | | | | | The state-struct now contains everything which can be kept after initial initialization. This includes the channel-lists, configuration, device-fds and also information like current channel and current card. The dvb_priv_t is kept containing the mp-options, a pointer to the state and to the logger. After this restructuring, the state-struct contains all information which can be persisted across channel switching.
* stream: stream_read_complete() reads from current pos, not 0wm42016-01-121-1/+1
| | | | (Well, I hope no caller really relied on this anyway.)
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-116-6/+6
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* cache: remove useless return valuewm42016-01-111-5/+2
| | | | It was unused, and also returned the wrong value in some cases.
* dvb: cleanup dvb_params struct, remove some unneeded fdsOliver Freyermuth2016-01-073-11/+8
| | | | | | | One was just used as an alias, the other one (sec_fd) was not used at all. Signed-off-by: wm4 <wm4@nowhere>
* win32: fix fd://James Ross-Gowan2016-01-071-3/+4
| | | | | | | | Windows definitely supports Unix-style fd inheritance. This mostly worked when launched from mpv.exe, though mpv should change the file mode to O_BINARY. When launched from mpv.com, the wrapper must pass the list of handles (stored in the undocumented lpReserved2 and cbReserved2 fields) to the mpv process.
* stre