summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvb.c
Commit message (Collapse)AuthorAgeFilesLines
* various: fix indentationnanahi26 hours1-3/+3
|
* various: fix -Wold-style-declaration warningnanahi2024-03-191-1/+1
| | | | warning: `static' is not at beginning of declaration
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-051-11/+11
|
* dvbin: do a big cleanup on code style and functionssfan52023-10-211-292/+249
|
* stream_dvb: avoid static function variablesfan52023-10-211-4/+3
|
* dvbin: revise many log linessfan52023-10-211-48/+23
|
* stream_dvb: use tallocsfan52023-10-211-79/+19
|
* stream_dvb: fix missing newlines on log messagessfan52023-10-211-6/+6
|
* stream/dvbin: drop too verbose messagesOliver Freyermuth2023-09-031-2/+0
| | | | | Echoing channel config format detection for each channel is a bit too noisy.
* stream/dvbin: add some helpful verbose outputOliver Freyermuth2023-09-031-0/+2
| | | | | These verbose messages will help in case adapter detection / channel list parsing fails.
* stream/dvbin: detect ZAP channel configs looking like VDR configsOliver Freyermuth2023-09-031-1/+13
| | | | | | | | | While ZAP config files should contain strings in most fields, their field number in the DVB-T / ISDBT case matches the number of fields for VDR config files, and some channel list writers (namely, dvbv5-scan) may insert "0" in unused string fields. To disentangle such config files from real VDR config files, add a check for the "INVERSION_" field which should always be filled.
* stream/dvbin: do not forget channel list for multiply delivery systemsOliver Freyermuth2023-09-031-2/+2
| | | | | | | | | | dvb_get_channels is expected to append to an existing channel list. For adapters supporting many delivery systems, a subsequent channel list may turn up with a non-existent channel config, and the pointer to the previously parsed channel list may be lost (i.e. the list will be leaked and no channels detected). Fix this by passing through the existing list (which may be NULL) in case no new channels are found.
* stream/dvbin: add support for delivery system ISDB-TOliver Freyermuth2023-09-031-0/+8
| | | | | | This is similar to DVB-T, but requires slightly different treatment as there is no T/T2 differentiation. Use a new channels.conf.isdbt file as channels config file.
* options: remove explicit initialization of integers to 0Christoph Heinrich2023-02-211-1/+0
|
* options: transition options from OPT_FLAG to OPT_BOOLChristoph Heinrich2023-02-211-1/+1
| | | | | | c78482045444c488bb7948305d583a55d17cd236 introduced a bool option type as a replacement for the flag type, but didn't actually transition and remove the flag type because it would have been too much mundane work.
* stream/dvb: drop support for DVB API before 5.8sfan52023-01-121-8/+1
| | | | | There is really no reason to keep the #ifdef mess around given that version is available since December 2012 (Linux 3.7).
* stream_dvb: add missing mutex unlockOliver Freyermuth2021-11-161-0/+1
| | | | | | | This deadlock was not triggered in real use since configuration validity does not change at runtime. closes #9459
* stream_dvb: Remove call to stream_drop_buffers in fill_buffer.Oliver Freyermuth2020-04-101-2/+0
| | | | | | | | The call was hidden very well, via dvb_streaming_read -> dvb_update_config -> dvb_streaming_start -> dvb_set_channel, and broke the stream buffering logic. Dropping that call does not noticeably slow down channel switches.
* options: change option macros and all option declarationswm42020-03-181-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change all OPT_* macros such that they don't define the entire m_option initializer, and instead expand only to a part of it, which sets certain fields. This requires changing almost every option declaration, because they all use these macros. A declaration now always starts with {"name", ... followed by designated initializers only (possibly wrapped in macros). The OPT_* macros now initialize the .offset and .type fields only, sometimes also .priv and others. I think this change makes the option macros less tricky. The old code had to stuff everything into macro arguments (and attempted to allow setting arbitrary fields by letting the user pass designated initializers in the vararg parts). Some of this was made messy due to C99 and C11 not allowing 0-sized varargs with ',' removal. It's also possible that this change is pointless, other than cosmetic preferences. Not too happy about some things. For example, the OPT_CHOICE() indentation I applied looks a bit ugly. Much of this change was done with regex search&replace, but some places required manual editing. In particular, code in "obscure" areas (which I didn't include in compilation) might be broken now. In wayland_common.c the author of some option declarations confused the flags parameter with the default value (though the default value was also properly set below). I fixed this with this change.
* 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 up