Project

General

Profile

Bug #4249

Stream filter EMPTY rule wrong behavior

Added by Turnip Pinrut over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Service Mapping
Target version:
-
Start date:
2017-02-22
Due date:
% Done:

0%

Estimated time:
Found in version:
Git master 21 Feb 2017
Affected Versions:

Description

Say I want to remove a specific language from the audio streams in all channels, unless that is the only audio stream available in that channel.

I make two rules in the Audio stream filters:

1. language-I-don't-want IGNORE
2. language-I-don't-want EMPTY

Both the Stream type and Service fields are left blank, so that the rules would apply to all channels.

What is expected:
1. The first rule would remove the language-I-don't-want from any channel that has it, while the other language audio streams would remain, if any. This rule works as expected.
2. The second rule would add the language-I-don't-want back to the stream, ONLY if there are no other audio streams left after removing it with the first rule.

What is happening:

The EMPTY rule adds the language-I-don't-want back into the stream regardless whether there are other languages left in the stream after the first rule, essentially cancelling out the first rule.

Log shows the language-I-don't-want being removed and re-added regardless of the presence of other languages:
2017-02-21 23:30:42.770 [ INFO] service: esfilter: "AMEDIA HIT HD" AUDIO 002 001 02132 MPEG2AUDIO rus IGNORE
2017-02-21 23:30:42.770 [ INFO] service: esfilter: "AMEDIA HIT HD" AUDIO 003 001 02133 AC3 rus IGNORE
2017-02-21 23:30:42.770 [ INFO] service: esfilter: "AMEDIA HIT HD" AUDIO 002 002 02132 MPEG2AUDIO rus EMPTY
2017-02-21 23:30:42.770 [ INFO] service: esfilter: "AMEDIA HIT HD" AUDIO 003 002 02133 AC3 rus EMPTY
This channel has two audio streams, rus and eng, both mpeg2 audio.

I believe the problem lies in line 629 of /src/service.c, although I could be wrong; I don't quite understand the code logic there.
Link: [[https://github.com/tvheadend/tvheadend/blob/master/src/service.c#L629]]

Workaround:
Create an EMPTY rule that adds the language-I-don't-want back into the channel for each channel in which the language-I-don't-want is the only audio stream, manually specifying the channels.

My Tvheadend setup is IPTV with a single IPTV Automatic Network, using OSMC Kodi v17 as a front end. HTSP is used as the protocol, no transcoding.
Tvheadend configured with: --disable-libx264 --disable-libx264_static --disable-libx265 --disable-libx265_static --disable-libvpx --disable-libvpx_static --disable-libtheora --disable-libtheora_static --disable-libvorbis --disable-libvorbis_static --disable-libfdkaac --disable-libfdkaac_static --disable-nvenc --disable-libmfx_static

History

#1

Updated by Jaroslav Kysela over 7 years ago

It does not work as you think, because you should mark the languages which you want to use BEFORE the EMPTY rule is used (thus p != o in the line in the souce you mentined: p is pointer/index, o means old pointer/index). Otherwise, the implicit 'USE' is used, but it's set AFTER all other rules.

It's better to mark the 'USE' languages (specify the language field - tvh does also sorting), add 'EMPTY' rule bellow the 'USE' rules (maybe without the language field - to add the first language in the stream when the 'USE' languages are not present) and add 'IGNORE' as last to mark the unwanted languages.

Something like this:

English   USE             ; Mark English as wanted and the first audio stream
Italian   USE             ; Mark Italian as wanted and the second audio stream (if English is present, otherwise Italian will be the first stream)
ANY       EMPTY           ; If no English and Italian languages are not present, use the first audio stream regarless of the language
ANY       IGNORE          ; Ignore all other languages, otherwise they will be marked as 'USE' (implicit rule)

The things may be more extended to add AC3 etc. rules (prefer AC3 streams over MPEG2).

Also available in: Atom PDF