Commit Graph

53 Commits

Author SHA1 Message Date
sfan5 490af95c10 dvbin: do a big cleanup on code style and functions 2023-10-21 11:07:59 +02:00
sfan5 c78c33bf7c stream_dvb: avoid static function variable 2023-10-21 11:07:59 +02:00
sfan5 e8e1466426 stream_dvb: use talloc 2023-10-21 11:07:59 +02:00
Oliver Freyermuth d88e3d105a stream/dvbin: add support for delivery system ISDB-T
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.
2023-09-03 13:08:58 +02:00
Christoph Heinrich 91cc0d8cf6 options: transition options from OPT_FLAG to OPT_BOOL
c784820454 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.
2023-02-21 17:15:17 +00:00
sfan5 b6b8380518 stream/dvb: drop support for DVB API before 5.8
There is really no reason to keep the #ifdef mess around given
that version is available since December 2012 (Linux 3.7).
2023-01-12 22:02:07 +01:00
Nicolas F 5bf92b628d stream/dvbin: remove "full-featured" API includes
In Linux kernel commit 819fbd3d8ef36c09576c2a0ffea503f5c46e9177
these two header files were moved to staging (though they've since
been moved out again by Linus.)

We do not actually use this, and it's in a state of maybe-removal
from the kernel as of Linux 5.14. Get rid of it; mpv still builds
fine without it, so it wasn't needed anyways.

Fixes #9233.
2021-09-22 19:48:14 +03:00
Oliver Freyermuth 8c52cd4e4a stream_dvb: Remove now replaced stream-control code for good. 2019-10-02 01:25:45 +02:00
Oliver Freyermuth 12d74e4d95 stream_dvb: Allow actual zapping of channels again.
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.
2019-10-02 01:25:45 +02:00
Oliver Freyermuth 9cd4638d2b stream_dvb: Add dvb_update_config to poll config parameters.
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.
2019-10-02 01:25:45 +02:00
Oliver Freyermuth 1768ea0d15 stream_dvb: Move stream->is_on initialization to state preparation.
Notably, this allows to call dvb_streaming_start more than once,
simplifying e.g. channel switching.
Also, get rid of unused timeout variable.
2019-10-02 01:25:45 +02:00
Oliver Freyermuth c15ec393dd stream_dvb: Factor out logic to determine program and card.
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).
2019-10-02 01:25:45 +02:00
Oliver Freyermuth 76918be267 stream_dvb: Use separated out options struct.
This also allows the use of m_config_cache_alloc
which allows to watch config updates.
2019-10-02 01:25:45 +02:00
rim 04d04033e6 dvb: Add multiple frontends support: MAX_FRONTENDS now 8. 2017-12-16 23:24:55 -08:00
wm4 14541ae258 Add checks for HAVE_GPL to various GPL-only source files
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.
2017-10-10 15:51:16 +02:00
Oliver Freyermuth 6b05c774a4 dvb: SYS_DVBC_ANNEX_B is now supported if ATSC is activated.
Signed-off-by: Oliver Freyermuth <o.freyermuth@googlemail.com>
2017-10-09 20:06:29 +02:00
ivan-83 e40c41de19 dvb: add support for DVB-T2
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>
2017-03-06 16:12:27 +01:00
wm4 05f63edc7b Revert "dvb: add support for DVB-T2"
This reverts commit df91e492fd.

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.
2017-02-14 13:31:06 +01:00
ivan-83 df91e492fd dvb: add support for DVB-T2
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>
2017-02-13 11:17:51 +01:00
wm4 67888a41e7 build: make DVB test stricter
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.
2016-04-02 20:51:39 +02:00
wm4 ff4bd73fcb dvb: fix compilation with older Linux headers
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.
2016-01-22 11:54:37 +01:00
Oliver Freyermuth c55b242b4e stream_dvb: global protection mutex and usage bit for global_dvb_state.
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).
2016-01-14 00:36:53 +01:00
Oliver Freyermuth 16723d4bb1 stream_dvb: persist state-information across channel-switches.
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.
2016-01-14 00:36:53 +01:00
Oliver Freyermuth 4c3f95708f dvb: rename dvb_config_t to dvb_state_t, keep config and state there.
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.
2016-01-14 00:36:53 +01:00
Oliver Freyermuth 2dd8982f73 dvb: cleanup dvb_params struct, remove some unneeded fds
One was just used as an alias, the other one (sec_fd) was not used at
all.

Signed-off-by: wm4 <wm4@nowhere>
2016-01-07 19:20:48 +01:00
Oliver Freyermuth 40c9e79068 stream_dvb: Always define NO_STREAM_ID_FILTER if missing.
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 .
2015-02-28 18:27:21 +01:00
wm4 c915b0b0ec dvb: uncrustify
Mostly automatic, some manual changes.
2015-01-06 20:19:49 +01:00
Oliver Freyermuth ca32a15a22 stream_dvb: Add possibility to dump a full transponder.
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.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth 7f84da4902 stream_dvb: Record PIDs with human-readable content, bump max demuxer count.
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.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth f309ecebe5 stream_dvb: Also demux PMT if possible, reactivate TPID parsing.
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.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth 7fe5d8c78e dvb: Extend understanding of VDR channel config: stream_id, inversion.
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).
2015-01-06 19:52:27 +01:00
Oliver Freyermuth bef1893cd5 dvb: Extend dvb_channel struct, needs to know whether channel is S2.
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.
2015-01-06 19:52:27 +01:00
Oliver Freyermuth ae81cb4343 dvbin: Prepare S2API-implementation, support different DVB-API versions.
Define a new macro "DVB_USE_S2API" to be used to switch to S2API if available,
also document what is the main difference in the new S2API.

StreamID-handling is only supported since API 5.2, and some macros
were renamed or only added later with 5.8 (somewhere around kernel 3.6),
so some define-fixups are needed to support these intermediate
kernel header versions.
2015-01-06 19:52:27 +01:00
wm4 3234f5a123 stream_dvb: restore --dvbin-file option
Got lost some time ago. Although I'm not sure if it actually does
anything on MPlayer (it exists there, but might broken, not sure).

Fixes #988 (untested).
2014-08-06 20:30:48 +02:00
wm4 959b718957 stream_dvb: remove global option variables 2014-06-11 00:35:03 +02:00
wm4 78128bddda Kill all tabs
I hate tabs.

This replaces all tabs in all source files with spaces. The only
exception is old-makefile. The replacement was made by running the
GNU coreutils "expand" command on every file. Since the replacement was
automatic, it's possible that some formatting was destroyed (but perhaps
only if it was assuming that the end of a tab does not correspond to
aligning the end to multiples of 8 spaces).
2014-04-13 18:03:01 +02:00
wm4 0335011f11 stream: mp_msg conversions
We also drop some slave mode stuff from stream_vcd.
2013-12-21 21:43:16 +01:00
wm4 bc1d61cf42 stream: redo URL parsing, replace m_struct usage with m_config
Move the URL parsing code from m_option.c to stream.c, and simplify it
dramatically. This code originates from times when http code used this,
but now it's just relict from other stream implementations reusing this
code. Remove the unused bits and simplify the rest.

stream_vcd is insane, and the priv struct is different on every
platform, so drop the URL parsing. This means you can't specify a track
anymore, only the device. (Does anyone use stream_vcd? Not like this
couldn't be fixed, but it doesn't seem worth the effort, especially
because it'd require potentially touching platform specific code.)
2013-08-02 17:02:34 +02:00
wm4 f63193f58f stream: remove fd member
Stream implementations could set this to a unix file descriptor. The
generic stream code could use it as fallback for a few things. This
was confusing and insane. In most cases, the stream implementations
defined all callbacks, so setting the fd member didn't have any
advantages, other than avoiding defining a private struct to store it.

It appears that even if the stream implementation used close() on the
fd (or something equivalent), stream.c would close() it a second time
(and on windows, even would call closesocket()), which should be proof
for the insanity of this code.

For stream_file.c, additionally make sure we don't close stdin or
stdout if "-" is used as filename.

For stream_vcd.c, remove the control() code. This code most likely
didn't make the slightest sense, because it used a different type
for stream->priv. It also leaked memory. Maybe it worked, but it's
incorrect and insignificant anyway, so kill it. This code was added
with commit 9521c19 (svn commit 31019).

Untested for all protocols other than stream_file.c.
2013-07-12 22:16:26 +02:00
diego 262dde35ff stream/dvbin.h: Use angular brackets for system #includes.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31516 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:11:07 +02:00
diego c106fe7751 Drop support for old-style DVB code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30818 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-02 19:57:17 +00:00
diego 00ad5d3fed Add a few missing header #includes and #defines.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30207 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-04 18:58:35 +00:00
diego ee50536b74 Accept DVB API 5, patch by Steven Brudenell, steven.brudenell gmail com.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28702 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-22 14:12:33 +00:00
diego 0864f92e7a Get rid of pointless 'extern' keywords.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28085 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-03 23:01:03 +00:00
diego 02135001b4 Change a bunch of video/audio-output-specific preprocessor directives from
a HAVE_ prefix to a CONFIG_ prefix.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27402 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-08-03 15:21:40 +00:00
diego 8efb2fa21c Add MPLAYER_ prefix to multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26061 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-22 09:09:46 +00:00
diego fba0b66ff9 Add explanatory comments to the #endif part of multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25563 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-31 16:15:50 +00:00
nicodvb 22d9f6ea0c removed the obscene priv->stream entry. Someone must have injected vodka in my milk when I wrote it
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25408 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 13:37:41 +00:00
nicodvb a9d2f4db42 get rid of the file-static dvb_config and free the config at close() . Patch by Andrew Calkin and me
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25407 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 13:30:44 +00:00
nicodvb c5ad15d8c0 dvb cleanup: call dvb_(set|step)_channel() without dereferencing stream->priv (1000l to me)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25405 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 13:05:06 +00:00