summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvb.c
Commit message (Collapse)AuthorAgeFilesLines
* stream_dvb: Remove implicit fallthroughs and consistify debug messages.Oliver Freyermuth2019-12-281-4/+12
| | | | | | The code is more explicit now and less confusing, and debug messages for the channel parsing for the several delivery systems are now more similar.
* stream, demux: redo origin policy thingwm42019-12-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv has a very weak and very annoying policy that determines whether a playlist should be used or not. For example, if you play a remote playlist, you usually don't want it to be able to read local filesystem entries. (Although for a media player the impact is small I guess.) It's weak and annoying as in that it does not prevent certain cases which could be interpreted as bad in some cases, such as allowing playlists on the local filesystem to reference remote URLs. It probably barely makes sense, but we just want to exclude some other "definitely not a good idea" things, all while playlists generally just work, so whatever. The policy is: - from the command line anything is played - local playlists can reference anything except "unsafe" streams ("unsafe" means special stream inputs like libavfilter graphs) - remote playlists can reference only remote URLs - things like "memory://" and archives are "transparent" to this This commit does... something. It replaces the weird stream flags with a slightly clearer "origin" value, which is now consequently passed down and used everywhere. It fixes some deviations from the described policy. I wanted to force archives to reference only content within them, but this would probably have been more complicated (or required different abstractions), and I'm too lazy to figure it out, so archives are now "transparent" (playlists within archives behave the same outside). There may be a lot of bugs in this. This is unfortunately a very noisy commit because: - every stream open call now needs to pass the origin - so does every demuxer open call (=> params param. gets mandatory) - most stream were changed to provide the "origin" value - the origin value needed to be passed along in a lot of places - I was too lazy to split the commit Fixes: #7274
* command: shuffle some crap aroundwm42019-11-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | This is preparation to get rid of the option-to-property bridge (mp_on_set_option). This is a pretty insane thing that redirects accesses to options to properties. It was needed in the ever ongoing transition from something to... something else. A good example for the need of this bridge is applying profiles at runtime. This obviously goes through the config parser, but should also make all changes effective, for which traditionally the property layer is used. There isn't much left that needs this bridge. This commit changes a bunch of options (which also have a property implementation) to use option change notifications instead. Many of the properties are still left, but perform unrelated functions like OSD formatting. This should be mostly compatible. There may be some subtle behavior changes. For example, "hwdec" and "record-file" do not check for changes anymore before applying them, so writing the current value to them suddenly does something, while it was ignored before. DVB changes untested, but should work.
* stream: change buffer argument types from char* to void*wm42019-11-071-2/+2
| | | | | | | This is slightly better, although not much, and ultimately doesn't matter. The public API in stream_cb.h also uses char*, but can't change that.
* stream_dvb: Remove now replaced stream-control code for good.Oliver Freyermuth2019-10-021-84/+0
|
* stream_dvb: Allow actual zapping of channels again.Oliver Freyermuth2019-10-021-0/+7
| | | | | | | | | | | | | | | This is realized by dvbin-channel-switch-offset, which is a numeric offset on the channel initially tuned to. Since the channel list is kept in the stream alone depending on detected hardware and chosen card, and no available backchannel to the player, there's no direct property which could be switched. Using input.conf like: H cycle dvbin-channel-switch-offset up K cycle dvbin-channel-switch-offset down Q set dvbin-prog "ZDF HD" allow fast and reliable channel switching again.
* stream_dvb: Add dvb_update_config to poll config parameters.Oliver Freyermuth2019-10-021-0/+32
| | | | | | | | If any parameters have been updated, reinitiate streaming_start. Throttle checks since we poll from streaming_read. This also requires the player to re-initialize, since all video and audio streams and even the transport format may change. This is added in the next commit.
* stream_dvb: Move stream->is_on initialization to state preparation.Oliver Freyermuth2019-10-021-1/+1
| | | | | | Notably, this allows to call dvb_streaming_start more than once, simplifying e.g. channel switching. Also, get rid of unused timeout variable.
* stream_dvb: Factor out logic to determine program and card.Oliver Freyermuth2019-10-021-47/+71
| | | | | | | | This is now treated in dvb_parse_path consistently instead of logic scattered over various functions. This is a requirement to sensibly re-evaluate config after options have been changed, since we have two ways to configure the stream (decorated URI and config parameters).
* stream_dvb: Use separated out options struct.Oliver Freyermuth2019-10-021-21/+24
| | | | | This also allows the use of m_config_cache_alloc which allows to watch config updates.
* stream_dvb: remove unused variablewm42019-09-211-1/+0
| | | | | | (At first I left this intentionally, because the temporarily disabled stream ctrl code used it, but there's actually no reason to annoy everyone with the warning.)
* stream: remove some more optical disc leftoverswm42019-09-131-1/+0
|
* Remove classic Linux analog TV support, and DVB runtime controlswm42019-09-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Linux analog TV support (via tv://) was excessively complex, and whenever I attempted to use it (cameras or loopback devices), it didn't work well, or would have required some major work to update it. It's very much stuck in the analog past (my favorite are the frequency tables in frequencies.c for analog TV channels which don't exist anymore). Especially cameras and such work fine with libavdevice and better than tv://, for example: mpv av://v4l2:/dev/video0 (adding --profile=low-latency --untimed even makes it mostly realtime) Adding a new input layer that targets such "modern" uses would be acceptable, if anyone is interested in it. The old TV code is just too focused on actual analog TV. DVB is rather obscure, but has an active maintainer, so don't remove it. However, the demux/stream ctrl layer must go, so remove controls for channel switching. Most of these could be reimplemented by using the normal method for option runtime changes.
* stream_dvb: Increase timeout of streaming read.Oliver Freyermuth2019-09-021-1/+1
| | | | It seems some DVB-T2 cards take longer to push out data.
* stream_dvb: Adapt to VDR channel config format.Oliver Freyermuth2019-09-021-3/+8
| | | | | | | While they accept the frequency field with MHz for DVB-S, for DVB-C and DVB-T, it may be in Hz, kHz or MHz. The official rule is to multiply whatever is in the channels.conf by 1000 until a value > 1000000 is reached to get correct units for tuning.
* Merge branch 'master' into pr6360Jan Ekström2019-03-111-2/+2
|\ | | | | | | | | | | Manual changes done: * Merged the interface-changes under the already master'd changes. * Moved the hwdec-related option changes to video/decode/vd_lavc.c.
| * stream_dvb: Correct range for dvbin-card option.Oliver Freyermuth2018-12-121-2/+2
| | | | | | | | | | | | Adapt documentation accordingly and also, fix an off-by-one check in the code. closes #6371
* | demux, stream: rip out the classic stream cachewm42018-08-311-1/+0
| | | | | | | | | | | | The demuxer cache is the only cache now. Might need another change to combat seeking failures in mp4 etc. The only bad thing is the loss of cache-speed, which was sort of nice to have.
* | command: whitelist some blocking accesses for certain demuxers/streamswm42018-05-241-0/+1
|/ | | | | | | | | | | | | | | | | | | | | The properties/commands touched in this commit are all for obscure special inputs (BD/DVD/DVB/TV), and they all block on the demuxer/stream layer. For network streams, this blocking is very unwelcome. They will affect playback and probably introduce pauses and frame drops. The player can even freeze fully, and the logic that tries to make playback abortable even if frozen complicates the player. Since the mentioned accesses are not needed for network streams, but they will block on network streams even though they're going to fail, add a flag that coarsely enables/disables these accesses. Essentially it establishes a whitelist of demuxers/streams which support them. In theory you could to access BD/DVD images over network (or add such support, I don't think it's a thing in mpv). In these cases these controls still can block and could even "freeze" the player completely. Writing to the "program" and "cache-size" properties still can block even for network streams. Just don't use them if you don't want freezes.
* dvb: Add multiple frontends support: MAX_FRONTENDS now 8.rim2017-12-161-73/+77
|
* Add checks for HAVE_GPL to various GPL-only source fileswm42017-10-101-0/+4
| | | | | | | | This should actually cover all of them, if you take into account that some unchanged GPL source files include header files with such checks. Also this was done already for the libaf derived code. This is only for "safety" and to avoid misunderstandings.
* dvb: Skip channel if ATSC device does not support cable / terr.Oliver Freyermuth2017-10-091-1/+3
| | | | | | | This matches what is done for the other multi-delivery-system cards. Signed-off-by: Oliver Freyermuth <o.freyermuth@googlemail.com>
* dvb: Implement parsing of modulation for VDR-style channels config.Oliver Freyermuth2017-10-091-0/+50
| | | | | | This is required for ATSC cable / terrestrial support. Signed-off-by: Oliver Freyermuth <o.freyermuth@googlemail.com>
* dvb: Fixes for ATSC tuning.Oliver Freyermuth2017-10-091-0/+16
| | | | | | | | | ATSC is a mix of terrestrial and cable, and depending on modulation is actually using DVBC_ANNEX_B. Thus, we need to override the delivery system depending on the modulation, channel by channel. Signed-off-by: Oliver Freyermuth <o.freyermuth@googlemail.com>
* stream_dvb: Multiply frequency and sample rate by 1000 for VDR.Oliver Freyermuth2017-10-091-4/+3
| | | | | | | These values are kept with a different unit in VDR style config for all delivery systems, not only for DVB-S / DVB-S2. Signed-off-by: Oliver Freyermuth <o.freyermuth@googlemail.com>
* dvb: add support for DVB-T2ivan-832017-03-061-350/+401
| | | | | | | | | | | | | | | | | | | | | | | | Probably does much more: + add support DVB-T2 * DVB params set to AUTO by default * MAX_CARDS: 4 -> 16 * DMX_SET_BUFFER_SIZE: 64kb -> 256kb + add DTV_CLEAR call before tune + add logic from https://github.com/olifre/mpv/commits/dvb-mixed-api-scan * rename type to delsys * single playlist per adapter * card -> adapter * fix channels order in playlist * update internal api * auto fallback to old DVB API on tune * fix DELSYS_SUPP_MASK value * remove tone - unused * add channel mem zeroize in config parser + add code from libdvbv5 for detect delivery systems * SYS_DVBC_ANNEX_AC replaced to SYS_DVBC_ANNEX_A + SYS_DVBC_ANNEX_C Signed-off-by: wm4 <wm4@nowhere>
* Revert "dvb: add support for DVB-T2"wm42017-02-141-392/+344
| | | | | | | | This reverts commit df91e492fd3365cf7db9c6ba4a721f8fcce0521c. Multiple issues such as weird code with undefined behavior (like (like conf_file*). The PR wasn't properly reviewed anyway (my error), so this commit should be reviewed and then merged again.
* dvb: add support for DVB-T2ivan-832017-02-131-344/+392
| | | | | | | | | | | | | | | | | | | | | | | | Probably does much more: + add support DVB-T2 * DVB params set to AUTO by default * MAX_CARDS: 4 -> 16 * DMX_SET_BUFFER_SIZE: 64kb -> 256kb + add DTV_CLEAR call before tune + add logic from https://github.com/olifre/mpv/commits/dvb-mixed-api-scan * rename type to delsys * single playlist per adapter * card -> adapter * fix channels order in playlist * update internal api * auto fallback to old DVB API on tune * fix DELSYS_SUPP_MASK value * remove tone - unused * add channel mem zeroize in config parser + add code from libdvbv5 for detect delivery systems * SYS_DVBC_ANNEX_AC replaced to SYS_DVBC_ANNEX_A + SYS_DVBC_ANNEX_C Signed-off-by: wm4 <wm4@nowhere>
* dvb: move priv allocation to dvb_openThomas V2017-02-101-1/+1
| | | | | | | This fixes a crash when changing channels; previously stream->priv would not be initialized when dvb_get_state reused the existing state. Signed-off-by: Thomas VanSelus <tvanselus@diospyros.us>
* stream: get rid of streamtype enumwm42017-02-021-1/+0
| | | | | | | | | Because it's kind of dumb. (But not sure if it was worth the trouble.) For stream_file.c, we add new explicit fields. The rest are rather special uses and can be killed by comparing the stream impl. name. The changes to DVD/BD/CD/TV are entirely untested.
* stream_dvb: remove weird option parsing stuffwm42016-09-091-24/+24
| | | | Mostly untested.
* 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-221-8/+8
|
* stream_dvb: support frontends with multiple delivery systems.Oliver Freyermuth2016-01-211-48/+56
| | | | | | | | | 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.
* player, stream_dvb: implement dvb-channel-name property.Oliver Freyermuth2016-01-141-1/+34
| | | | | | | | | 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-141-1/+20
| | | | | | | | | | | | | 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-141-35/+70
| | | | | | | | | 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-141-86/+90
| | | | | | | | | 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.
* dvb: cleanup dvb_params struct, remove some unneeded fdsOliver Freyermuth2016-01-071-4/+3
| | | | | | | One was just used as an alias, the other one (sec_fd) was not used at all. Signed-off-by: wm4 <wm4@nowhere>
* options: add M_OPT_FILE to new options that are missing itPhilip Sequeira2015-03-071-1/+1
| | | | Fixes shell completion.
* 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.
* 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.
* dvb: uncrustifywm42015-01-061-789/+799
| | | | 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-061-4/+9
| | | | | | | | | | | | 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-061-0/+14
| | | | | | | | | | | 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-061-12/+43
| | | | | | | | | | | | 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 cha