Gene C [Mon, 17 Apr 2023 12:55:50 +0000 (08:55 -0400)]
- fixed bug with _lang3_to_lang2()
Typo made using lang instead of lang3 in lookup map
- clean by running through autopep8
- Add more exception handling to prevent it crashing
Still needs some improvements with exception types
- tidy up for pylint
- python 2 is deprecated - simplify for python 3
- remove deprecated FF_API_CODED_FRAME
- remove pict_type from AVPacket_SideData
- use AVFrame->pict_type (same like ffmpeg 5.1.2 - ffprobe.c line 2595)
- remove patch for vaapi_encode
- ffmpeg_static will always compile with ffmpeg 5.1.2
- Makefile.ffmpeg added to 5.1.2
- src/muxer/muxer_libav.c: update 'AVOutputFrmat' to 'const AVOutputFrmat'
- src/transcoding/transcode/hwaccels/vaapi.c --> incorporated the struct from libavcodec/vaapi.h
- src/transcoding/transcode/video.c: update type for qdata_size
alingherghescu [Thu, 23 Mar 2023 03:23:50 +0000 (20:23 -0700)]
remove ffmpeg component avresample
- remove ffmpeg component avresample. Is deprecated and replaced by swresample. I verified that all functions from this component are not used in tvh (https://www.ffmpeg.org/doxygen/2.3/group__lavr.html)
alingherghescu [Tue, 31 Jan 2023 00:15:04 +0000 (16:15 -0800)]
update vaapi
- update libvpx to ver. 1.12.0
- replaced tvherror() with tvhinfo for bitrate report
- converted from bps to kbps
- reduced B frame to max 3 (4 is generating artifacts on my system)
- I had to set also bf otherwise will be set later in profile_video_class() with 3
- when low power is enabled max B frame will be disabled (because codec is not using B frames in low power mode)
- h264_vaapi and hevc_vaapi have also dynamic enable/disable for max B frame
- vp9 super frames can be enabled/disabled from the interface
- clean-up some javascript code
alingherghescu [Mon, 23 Jan 2023 06:54:06 +0000 (22:54 -0800)]
update vaapi
- updated function _video_filters_get_filters() due to a bug hidden by previous bug (Bug #6247)
- fixed Decoder HW + Encoder HW --> was generating download / upload that increase CPU usage
- remove vp9 profile0 to 3 (ffmpeg vaapi is not supporting profiles for vp9)
- improve 'tier' and added: level, qmin, qmax, desired_b_depth
- printing Bitrate, Buffer size, Max bitrate (for each transcoding start)
- added superframe for vp9
Peter Bašista [Sun, 15 Jan 2023 19:31:55 +0000 (20:31 +0100)]
Preserve existing Unicable idnode during the set operation
Currently, the Unicable settings are always cleared
when enabling or disabling the corresponding satellite position
or its owning adapter. The reason is that the idnode with Unicable
configuration is always unconditionally deleted
during the "set" operation.
This change adds a check for the existing Unicable configuration
and preserves the existing idnode if its type remains the same.
The same logic is already used when changing the configuration
related to LNB, switch and rotor.
dave-p [Sun, 25 Dec 2022 10:07:13 +0000 (10:07 +0000)]
Add autorec duplicate handling default to dvr config.
Default will be applied to new autorecs unless overridden.
duplicate_handling.md: Add details of "Record if Unique" option.
alingherghescu [Sat, 7 Jan 2023 02:09:28 +0000 (18:09 -0800)]
update vaapi
- added new settings: platform, bitrate scale factor, low power, loop filter level, loop filter sharpness, async depth
- implemented new (dynamic) settings adjustment (in js)
- added new parameters: b, low_power, loop_filter_level, loop_filter_sharpness, async_depth
- tvhva_context_check_profile() will change TVHVAContext->entrypoint from VAEntrypointEncSlice into VAEntrypointEncSliceLP if VAEntrypointEncSlice is not available for that CODEC (according to VAAPI info)
- moved low_power to tvh_codeo_profile in order to initialize properly the entrypoint
- many error reporting improvements
- separated some bundled conditions
In file included from src/main.c:41:
src/tcp.h: In function ‘ip_check_equal_v4’:
src/tcp.h:29:31: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
29 | #define IP_AS_V4(storage, f) ((struct sockaddr_in *)&(storage))->sin_##f
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/tcp.h:67:14: note: in expansion of macro ‘IP_AS_V4’
67 | { return IP_AS_V4(a, addr).s_addr == IP_AS_V4(b, addr).s_addr; }
| ^~~~~~~~
storage (a) here is a pointer to sockaddr_storage which is either backed
by a sockaddr_in or sockaddr_in6 struct (here, it would be good if it is
the former, we decided based on sa_family in ip_check_equal). Referencing
it means we have a pointer to a pointer to sockaddr_storage here, which
we then cast to a pointer to sockaddr_in. Our so type-punned pointer is
then dereferenced breaking strict-aliasing as this pointer as well as
our original pointer share a memory location and both could be used to
change it even through they are of different types.
We can avoid this situation simply by removing the reference as then it
is just casting a pointer to a different type (which in this case is
legal as storage is really a sockaddr_in).
Removing the reference breaks users of the macro who do not feed it a
pointer to a sockaddr_storage, so while the warnings were all produced
by tcp.h, we end up changing code everywhere else to resolve them –
usually by just taking a reference or not dereferencing there.
As this is the only instance of (detected) strict-aliasing breakage
the Makefile is also changed to no longer build the entirety of
tvheadend with strict-aliasing rules disabled. Similar for the disabled
stringop warnings which weren't (correctly) triggered in the current
code.
As a small bonus, this also prevents gcc-11 from tripping with a false
positive over the previous tcp change in c0f616e / #1473.
Simplify IPv6 compare functions to unconfuse gcc compiler
In file included from src/tcp.c:32:
In function ‘ip_check_is_any_v6’,
inlined from ‘ip_check_is_any’ at src/tcp.h:110:46,
inlined from ‘ip_check_is_local_address’ at src/tcp.c:89:17:
src/tcp.h:105:57: warning: array subscript 1 is outside array bounds of ‘const struct sockaddr_storage[0]’ [-Warray-bounds]
105 | { return ((uint64_t *)IP_AS_V6(address, addr).s6_addr)[0] == ((uint64_t *)(&in6addr_any.s6_addr))[0] &&
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
src/tcp.h: In function ‘ip_check_is_local_address’:
src/tcp.h:108:19: note: at offset 8 into object ‘address’ of size 8
108 | static inline int ip_check_is_any(const struct sockaddr_storage *address)
| ^~~~~~~~~~~~~~~
And more for the other half of the function and its three-times more or
less copy-paste instances. sockaddr_storage is not an array, but what
we actually do here is access s6_addr – which is an array of uint8_t.
Accessing the 16 uint8_t as 2 uint64_t apparently works, but not doing
it results in hopefully simpler to understand code for both humans and
compilers alike.
If you have e.g. all but dvb disabled and forgot to plug in your usb
adapter the wizard would crash upon you as no inputs are defined and the
looping assumes there is at least one. Ideally a message should be shown
to indicate that you need inputs, but a wizard displaying a mostly empty
page is far better than a crash to discover your mistake.
Use application/json instead of text/x-json as mimetype
The web has mostly agreed on this standardized mimetype and e.g.
trying to open an API URI with Firefox is now opened in its friendly
JSON viewer rather than downloaded.
epgdb: Resolve symlinks before using file location
The new epgdb is written to a temporary file and later renamed to
override the old epgdb file atomically. If you diverted the epgdb
to a different place away from your usual configuration (e.g. for
space and/or disk usage reasons like on an OpenWrt router) this
leads to overriding the symlink with a real file defeating the point.
By applying realpath on the path first we can resolve any symlink
along the path, while not considering it a failure if the epgdb
file doesn't exist yet. If on the other hand the path up to the file
doesn't exist we default to the old way of just taking the path
verbatim and let them be created by hts_settings_makedirs as before.
Note that this relies on the paths being sized PATH_MAX, which as the
manpage notes is POSIX.1-2001 conform, but broken by design as PATH_MAX
can't be relied upon, but the entire codebase makes heavy use of PATH_MAX
and there is a pre-existing usage of realpath() in this way so lets
pretend its okay for now.
Michael Marley [Thu, 27 Oct 2022 21:48:46 +0000 (17:48 -0400)]
iptv_auto: Add support for m3u "channel-number" tag
SiliconDust recently added m3u playlist generation support to the
HDHomeRun products. They use "channel-number" for the channel
number, so add support for that value to TVHeadend. It is used as
a fallback only if the previously-supported "tvh-chnum" and
"tvg-chno" tags aren't present. This should be particularly useful
for usage with ATSC 3.0 channels, as those aren't supported in the
libhdhomerun library that TVHeadend normally uses for HDHomeRun
devices. Without this, the channel number for all channels
imported from the HDHomeRun m3u is "0".
Norm Raden [Mon, 12 Sep 2022 17:30:30 +0000 (13:30 -0400)]
Added more 'text modes' to the ATSC Multiple String Structure decoder and convert text to UTF-8. (Fixes #5162)
- Added support for decoding ATSC's "Multiple String Structure" text modes 0x1-0x6, 0x9-0x10, 0x20-0x27, 0x30-0x33.
- Convert decoded text to UTF-8 instead of ISO-8859-1.
- For unsupported 'compression types' or 'text modes' return a text string "[comptype=0x??,mode=0x??]" indicating
the attempted compression type and text mode instead of the text segment.
Text output from ATSC's "Multiple String Structure" decoder should properly render in web browsers, specifically Unicode characters >= 0x80.
When 'change muxes' option for network discovery is enabled, allow network scan to modify muxes rather than duplicate them on minor changes such as FEC
Norm Raden [Tue, 10 May 2022 18:00:30 +0000 (14:00 -0400)]
Fixed and cleanup the "PSIP: ATSC Grabber" module (Fixes #5610)
- Bumped up limit on number of supported EIT/ETT tables from 5 to 256 (this is the max number of EIT/ETT tables in the ATSC specification)
- Remove table type 4 as a valid ETT table, there is no support for this table here and table type 4 doesn't supply any EPG data--just long names for channels/services, etc.
- Removed the very rapid toggling between mpegts_table_{add,destroy}(...) calls on EIT/ETT tables that caused continuous enabling/disabling of EIT and ETT PIDs.
- Added an 'ETM Location' check to EIT table handling to ensure that an event's extra text is cleared in the EPG database if there is no matching ETT.
- Removed epg_broadcast_change_finish(...) because it was erasing the extra text field in EPG database when updating title in EPG database (in EIT handler).
- Added the ability for receiving ETT tables with the same version ID. ETT tables use the same version ID for long runs of event IDs and 'Extra text's.
- Fix bug in retrieving the number of tables EIT/ETT tables listed in the MGT table.
- Removed the psip_{find,remove,add}_desc(...) functions (and supporting code) that stored ETT extra texts before
there was a matching EIT event and then would try to match up the ETT extra texts when the EIT event showed up.
However, the psip_*_desc(..) functions didn't keep track of the channel and would match up the ETT 'Extra text' with the wrong EIT event.
- Removed some non-functional code.
- Removed old commented out test code.
- Added placeholder support for 'stop' and 'done' functions of this module for future development.
The "Over-the-air: PSIP: ATSC Grabber" module now quickly and correctly populates 'Title', 'Extra text', 'Start time', 'End time', 'Duration', etc... fields in the EPG Database.
Building Tvheadend on Raspberry Pi with gcc 12 fails with this error
src/misc/json.c: In function ‘json_parse_string’:
src/misc/json.c:120:31: error: pointer ‘r’ used after ‘free’ [-Werror=use-after-free]
120 | *failp = (a - r) + start;
| ~~~^~~~
src/misc/json.c:118:19: note: call to ‘free’ here
118 | free(r);
| ^~~~~~~
This PR appears correct and fixes the gcc error but has not been tested as it is an error path.