RFE: Make VDR more friendly when using combinations of DVB-S, DVB-T and DVB-C

Message ID 4FDDCAB5.2030006@tvdr.de
State New
Headers

Commit Message

Klaus Schmidinger June 17, 2012, 12:16 p.m. UTC
  On 16.06.2012 16:53, Ludi wrote:
> Hi Klaus,
>
> First of all, thanks for your reply and for taking the problem into
> account.
>
> On Sat, 16 Jun 2012 15:32:11 +0200
> Klaus Schmidinger<Klaus.Schmidinger@tvdr.de>  wrote:
>
>> On 15.06.2012 17:17, Ludi wrote:
>>> Hello,
>>>
>>> Some time ago, I started a discussion in german on the VDR forum
>>> about making the VDR more friendly for users that are
>>> simultaneously using different sources to receive channels:
>>> http://www.vdr-portal.de/board16-video-disk-recorder/board8-vdr-grundlagen/110156-%C3%BCberlegungen-zur-channels-conf-f%C3%BCr-dvb-c-s-t-mischbetrieb/index3.html
>>>
>>> I am going to explain the problem, when receiving channels from two
>>> different sources by using the second german public channel named
>>> ZDF:
>>>
>>> Suppose a user is receiving the channel ZDF by dvb-s and dvb-t. For
>>> the VDR, these are two different channels, and it probably is not a
>>> bad thing that the VDR differentiates between them because these
>>> channels might be of different quality (different data rates,
>>> etc.). However, as both sources name these channels often the same
>>> way, it is not easily possible to differentiate between the two
>>> channels in the VDR OSD, which is particularly annoying for the
>>> timers, one of the main VDR features.
>>>
>>> Currently, I work around this problem, by setting the VDR to not
>>> update channelnames and manually adding a suffix to the
>>> channelnames in the channels.conf. So, to use the example above and
>>> differentiate between the two channels, they could be renamed to
>>> ZDF-s and ZDF-t (or ZDF.s and ZDF.t, or...). In practice, I only
>>> only rename the channelnames of the source with the smallest number
>>> of channels; I know that the channelnames without suffix are those
>>> from the other source.
>>>
>>> @ Klaus
>>>
>>> Do you think that you could add an additional option to one of your
>>> next VDR releases, like "Add suffix about source to channelnames"; I
>>> could imagine such an option next to the "Update channels" option in
>>> the DVB section of the Setup in the OSD of the VDR.
>>>
>>> Since the information is already in the channels.conf for every
>>> channel, I assume, that it will not require huge changes to the VDR
>>> code to use channelnames-source (or something similar) instead of
>>> only the channelname in the channelname field of the channels.conf,
>>> when the corresponding option is active.
>>
>> I'd rather have the channels.conf entries keep the names that are
>> broadcast in the SI data. I wouldn't want to add a "source" suffix
>> there.
>
> I understand your concerns.
>
> I assumed that changing the names in the channels.conf would be the
> best in order to make also the plugins and other software use the
> names+source for free. Moreover, since the channels.conf can be
> constantly updated, I thought that it would not really matter, because
> the names without source could be restored in the channels.conf by
> simply disabling the new option and configure the update setting to
> also  modify the channelnames. I was not aware that there was a
> standard for the broadcasting of the channelnames; but it does not
> surprise me either now.
>
>> However, I could imagine adding a function like
>>
>>     cString cChannel::NameWithSource(void)
>>
>> which would return things like
>>
>>     ZDF (DVB-T)
>>     ZDF (DVB-S)
>>
>> or, shorter,
>>
>>     ZDF (T)
>>     ZDF (S)
>>
>> and using that function instead of the Name() function at the
>> appropriate places.
>
> If I get you right, that means that if the user activates the new option
> (I assume that you will make it optional, since most people
> probably use only one source and do not have the problem), the VDR uses
> the NameWithSource() method instead of the Name() method.
>
> But what does this mean for the plugins? I am particularly thinking at
> the plugins related to the timers, like the epgsearch and the live
> plugin. Will they have to be adapted or will they also show the
> name+source if the new option is enabled?
>
> Concerning whether to use the longer or the shorter version of the
> name+source, I would choose the shorter version to not increase chances
> of the new name not fitting in the OSD. Thus:
>
>      ZDF (S)
>      ZDF (T)
>      ZDF (C)

After sleeping over this for a night I tend to follow your idea of using modifed
names directly, thus having them appear everywhere.

I won't change these names in channels.conf, though (this file shall always
store what comes from the broadcaster - provided it is enabled in the setup).
I'll rather

- Make a setup option to "Show channel names with source" (default is "no").
- Modify cChannel::Name() and cChannel::ShortName() to optionally
   append the source character (A, C, S, T, I, ...) to the channel name
   in the (short) form mentioned above.

The attached patch implements this (i18n stuff left out for brevity).
Please give it a try.

@Ludi: BTW: in order to give you credit in VDR's HISTORY/CONTRIBUTORS file I'll
need your full name.

Klaus
  

Comments

Wolfgang Rohdewald June 17, 2012, 1:19 p.m. UTC | #1
Am Sonntag, 17. Juni 2012, 14:16:53 schrieb Klaus Schmidinger:
> - Make a setup option to "Show channel names with source" (default is "no").
> - Modify cChannel::Name() and cChannel::ShortName() to optionally
>    append the source character (A, C, S, T, I, ...) to the channel name
>    in the (short) form mentioned above.

you could give that option different values like

- never show channel source
- always show channel source
- only show channel source if the same channel has different sources

for space conserving people, something shorter than (%c) might be nice

maybe an additional option "channel source format" which only 
triggers if the channel source is to be displayed:

with values like

%s (%c)
%n/%c
%c %s
  
Klaus Schmidinger June 17, 2012, 1:36 p.m. UTC | #2
On 17.06.2012 15:19, Wolfgang Rohdewald wrote:
> Am Sonntag, 17. Juni 2012, 14:16:53 schrieb Klaus Schmidinger:
>> - Make a setup option to "Show channel names with source" (default is "no").
>> - Modify cChannel::Name() and cChannel::ShortName() to optionally
>>     append the source character (A, C, S, T, I, ...) to the channel name
>>     in the (short) form mentioned above.
>
> you could give that option different values like
>
> - never show channel source
> - always show channel source
> - only show channel source if the same channel has different sources
>
> for space conserving people, something shorter than (%c) might be nice
>
> maybe an additional option "channel source format" which only
> triggers if the channel source is to be displayed:
>
> with values like
>
> %s (%c)
> %n/%c
> %c %s

Let's keep this simple ;-)

Klaus
  
Ludi June 17, 2012, 2:50 p.m. UTC | #3
On Sun, 17 Jun 2012 14:16:53 +0200
Klaus Schmidinger <Klaus.Schmidinger@tvdr.de> wrote:

> After sleeping over this for a night I tend to follow your idea of
> using modifed names directly, thus having them appear everywhere.

That's great news. 

> I won't change these names in channels.conf, though (this file shall
> always store what comes from the broadcaster - provided it is enabled
> in the setup). I'll rather
> 
> - Make a setup option to "Show channel names with source" (default is
> "no").
> - Modify cChannel::Name() and cChannel::ShortName() to optionally
>    append the source character (A, C, S, T, I, ...) to the channel
> name in the (short) form mentioned above.
> 
> The attached patch implements this (i18n stuff left out for brevity).
> Please give it a try.

Could you please tell us whether the patch is compatible to vdr 1.7.27?
It is the version that is currently in use in the development version of
yavdr. 

> @Ludi: BTW: in order to give you credit in VDR's HISTORY/CONTRIBUTORS
> file I'll need your full name.

You can use Ludi Kaleni <ludi113 * hotmail * com>.

Ludi
  
Klaus Schmidinger June 17, 2012, 2:55 p.m. UTC | #4
On 17.06.2012 16:50, Ludi wrote:
> On Sun, 17 Jun 2012 14:16:53 +0200
> Klaus Schmidinger<Klaus.Schmidinger@tvdr.de>  wrote:
>
>> ...
>> The attached patch implements this (i18n stuff left out for brevity).
>> Please give it a try.
>
> Could you please tell us whether the patch is compatible to vdr 1.7.27?
> It is the version that is currently in use in the development version of
> yavdr.

It should apply just fine.

Klaus
  
Henning Pingel June 17, 2012, 9:42 p.m. UTC | #5
Am 17.06.2012 14:16, schrieb Klaus Schmidinger:
> On 16.06.2012 16:53, Ludi wrote:
>> Hi Klaus,
>>
>> First of all, thanks for your reply and for taking the problem into
>> account.
>>
>> On Sat, 16 Jun 2012 15:32:11 +0200
>> Klaus Schmidinger<Klaus.Schmidinger@tvdr.de>  wrote:
>>
>>> On 15.06.2012 17:17, Ludi wrote:
>>>> Hello,
>>>>
>>>> Some time ago, I started a discussion in german on the VDR forum
>>>> about making the VDR more friendly for users that are
>>>> simultaneously using different sources to receive channels:
>>>> http://www.vdr-portal.de/board16-video-disk-recorder/board8-vdr-grundlagen/110156-%C3%BCberlegungen-zur-channels-conf-f%C3%BCr-dvb-c-s-t-mischbetrieb/index3.html 
>>>>
>>>>
>>>> I am going to explain the problem, when receiving channels from two
>>>> different sources by using the second german public channel named
>>>> ZDF:
>>>>
>>>> Suppose a user is receiving the channel ZDF by dvb-s and dvb-t. For
>>>> the VDR, these are two different channels, and it probably is not a
>>>> bad thing that the VDR differentiates between them because these
>>>> channels might be of different quality (different data rates,
>>>> etc.). However, as both sources name these channels often the same
>>>> way, it is not easily possible to differentiate between the two
>>>> channels in the VDR OSD, which is particularly annoying for the
>>>> timers, one of the main VDR features.
>>>>
>>>> Currently, I work around this problem, by setting the VDR to not
>>>> update channelnames and manually adding a suffix to the
>>>> channelnames in the channels.conf. So, to use the example above and
>>>> differentiate between the two channels, they could be renamed to
>>>> ZDF-s and ZDF-t (or ZDF.s and ZDF.t, or...). In practice, I only
>>>> only rename the channelnames of the source with the smallest number
>>>> of channels; I know that the channelnames without suffix are those
>>>> from the other source.
>>>>
>>>> @ Klaus
>>>>
>>>> Do you think that you could add an additional option to one of your
>>>> next VDR releases, like "Add suffix about source to channelnames"; I
>>>> could imagine such an option next to the "Update channels" option in
>>>> the DVB section of the Setup in the OSD of the VDR.
>>>>
>>>> Since the information is already in the channels.conf for every
>>>> channel, I assume, that it will not require huge changes to the VDR
>>>> code to use channelnames-source (or something similar) instead of
>>>> only the channelname in the channelname field of the channels.conf,
>>>> when the corresponding option is active.
>>>
>>> I'd rather have the channels.conf entries keep the names that are
>>> broadcast in the SI data. I wouldn't want to add a "source" suffix
>>> there.
>>
>> I understand your concerns.
>>
>> I assumed that changing the names in the channels.conf would be the
>> best in order to make also the plugins and other software use the
>> names+source for free. Moreover, since the channels.conf can be
>> constantly updated, I thought that it would not really matter, because
>> the names without source could be restored in the channels.conf by
>> simply disabling the new option and configure the update setting to
>> also  modify the channelnames. I was not aware that there was a
>> standard for the broadcasting of the channelnames; but it does not
>> surprise me either now.
>>
>>> However, I could imagine adding a function like
>>>
>>>     cString cChannel::NameWithSource(void)
>>>
>>> which would return things like
>>>
>>>     ZDF (DVB-T)
>>>     ZDF (DVB-S)
>>>
>>> or, shorter,
>>>
>>>     ZDF (T)
>>>     ZDF (S)
>>>
>>> and using that function instead of the Name() function at the
>>> appropriate places.
>>
>> If I get you right, that means that if the user activates the new option
>> (I assume that you will make it optional, since most people
>> probably use only one source and do not have the problem), the VDR uses
>> the NameWithSource() method instead of the Name() method.
>>
>> But what does this mean for the plugins? I am particularly thinking at
>> the plugins related to the timers, like the epgsearch and the live
>> plugin. Will they have to be adapted or will they also show the
>> name+source if the new option is enabled?
>>
>> Concerning whether to use the longer or the shorter version of the
>> name+source, I would choose the shorter version to not increase chances
>> of the new name not fitting in the OSD. Thus:
>>
>>      ZDF (S)
>>      ZDF (T)
>>      ZDF (C)
>
> After sleeping over this for a night I tend to follow your idea of 
> using modifed
> names directly, thus having them appear everywhere.
>
> I won't change these names in channels.conf, though (this file shall 
> always
> store what comes from the broadcaster - provided it is enabled in the 
> setup).
> I'll rather
>
> - Make a setup option to "Show channel names with source" (default is 
> "no").
> - Modify cChannel::Name() and cChannel::ShortName() to optionally
>   append the source character (A, C, S, T, I, ...) to the channel name
>   in the (short) form mentioned above.

Hi,

satellite sources are a special case because with satellites it is 
possible to receive more than one satellite position. For example, there 
is a channel called "Sky Atlantic HD" on S28.2E, but there's also a 
channel called "Sky Atlantic HD" on S19.2E. Both channels have different 
EPG data and different audio/language streams.

My suggestion: Users with more than one satellite position might want to 
enable an option "Show full satellite position name" so that they don't 
see "Sky Atlantic HD (S)" but instead "Sky Atlantic HD (S19.2E)".

Cheers,
Henning
  
mtron June 18, 2012, 9:27 a.m. UTC | #6
On 06/17/2012 02:16 PM, Klaus Schmidinger wrote:

>> Concerning whether to use the longer or the shorter version of the
>> name+source, I would choose the shorter version to not increase chances
>> of the new name not fitting in the OSD. Thus:
>>
>>      ZDF (S)
>>      ZDF (T)
>>      ZDF (C)
> 
> After sleeping over this for a night I tend to follow your idea of using
> modifed
> names directly, thus having them appear everywhere.
> 
> I won't change these names in channels.conf, though (this file shall always
> store what comes from the broadcaster - provided it is enabled in the
> setup).
> I'll rather
> 
> - Make a setup option to "Show channel names with source" (default is
> "no").
> - Modify cChannel::Name() and cChannel::ShortName() to optionally
>   append the source character (A, C, S, T, I, ...) to the channel name
>   in the (short) form mentioned above.

Hello Klaus!

Just in case you miss this: Your patch puts a '(' after a channel
Category defined with ':CategoryName' in channels.conf

here is a screenshot:  http://i.imgur.com/maSlV.jpg?1

Cheers!
  
Klaus Schmidinger June 18, 2012, 9:31 a.m. UTC | #7
On 18.06.2012 11:27, mtron wrote:
> On 06/17/2012 02:16 PM, Klaus Schmidinger wrote:
>
>>> Concerning whether to use the longer or the shorter version of the
>>> name+source, I would choose the shorter version to not increase chances
>>> of the new name not fitting in the OSD. Thus:
>>>
>>>       ZDF (S)
>>>       ZDF (T)
>>>       ZDF (C)
>>
>> After sleeping over this for a night I tend to follow your idea of using
>> modifed
>> names directly, thus having them appear everywhere.
>>
>> I won't change these names in channels.conf, though (this file shall always
>> store what comes from the broadcaster - provided it is enabled in the
>> setup).
>> I'll rather
>>
>> - Make a setup option to "Show channel names with source" (default is
>> "no").
>> - Modify cChannel::Name() and cChannel::ShortName() to optionally
>>    append the source character (A, C, S, T, I, ...) to the channel name
>>    in the (short) form mentioned above.
>
> Hello Klaus!
>
> Just in case you miss this: Your patch puts a '(' after a channel
> Category defined with ':CategoryName' in channels.conf
>
> here is a screenshot:  http://i.imgur.com/maSlV.jpg?1

Thanks, I did miss that.
Will fix it after my vacation ;-)

Klaus
  

Patch

--- ./channels.c	2012/04/01 09:27:08	2.22
+++ ./channels.c	2012/06/17 11:53:10
@@ -112,10 +112,34 @@ 
   provider = strcpyrealloc(provider, Channel.provider);
   portalName = strcpyrealloc(portalName, Channel.portalName);
   memcpy(&__BeginData__, &Channel.__BeginData__, (char *)&Channel.__EndData__ - (char *)&Channel.__BeginData__);
+  nameSource = NULL; // these will be recalculated automatically
+  shortNameSource = NULL;
   parameters = Channel.parameters;
   return *this;
 }
 
+const char *cChannel::Name(void) const
+{
+  if (Setup.ShowChannelNamesWithSource) {
+     if (isempty(nameSource))
+        nameSource = cString::sprintf("%s (%c)", name, cSource::ToChar(source));
+     return nameSource;
+     }
+  return name;
+}
+
+const char *cChannel::ShortName(bool OrName) const
+{
+  if (OrName && isempty(shortName))
+     return Name();
+  if (Setup.ShowChannelNamesWithSource) {
+     if (isempty(shortNameSource))
+        shortNameSource = cString::sprintf("%s (%c)", shortName, cSource::ToChar(source));
+     return shortNameSource;
+     }
+  return shortName;
+}
+
 int cChannel::Transponder(int Frequency, char Polarization)
 {
   // some satellites have transponders at the same frequency, just with different polarization:
@@ -233,10 +257,14 @@ 
            modification |= CHANNELMOD_NAME;
            Channels.SetModified();
            }
-        if (nn)
+        if (nn) {
            name = strcpyrealloc(name, Name);
-        if (ns)
+           nameSource = NULL;
+           }
+        if (ns) {
            shortName = strcpyrealloc(shortName, ShortName);
+           shortNameSource = NULL;
+           }
         if (np)
            provider = strcpyrealloc(provider, Provider);
         }
@@ -721,6 +749,8 @@ 
         free(tpidbuf);
         free(caidbuf);
         free(namebuf);
+        nameSource = NULL;
+        shortNameSource = NULL;
         if (!GetChannelID().Valid()) {
            esyslog("ERROR: channel data results in invalid ID!");
            return false;
--- ./channels.h	2012/03/11 11:46:39	2.15
+++ ./channels.h	2012/06/17 11:21:33
@@ -123,6 +123,8 @@ 
   int number;    // Sequence number assigned on load
   bool groupSep;
   int __EndData__;
+  mutable cString nameSource;
+  mutable cString shortNameSource;
   cString parameters;
   int modification;
   mutable const cSchedule *schedule;
@@ -137,8 +139,8 @@ 
   cString ToText(void) const;
   bool Parse(const char *s);
   bool Save(FILE *f);
-  const char *Name(void) const { return name; }
-  const char *ShortName(bool OrName = false) const { return (OrName && isempty(shortName)) ? name : shortName; }
+  const char *Name(void) const;
+  const char *ShortName(bool OrName = false) const;
   const char *Provider(void) const { return provider; }
   const char *PortalName(void) const { return portalName; }
   int Frequency(void) const { return frequency; } ///< Returns the actual frequency, as given in 'channels.conf'
--- ./config.c	2012/06/13 09:12:53	2.25
+++ ./config.c	2012/06/17 11:15:03
@@ -462,6 +462,7 @@ 
   DeviceBondings = "";
   InitialVolume = -1;
   ChannelsWrap = 0;
+  ShowChannelNamesWithSource = 0;
   EmergencyExit = 1;
 }
 
--- ./config.h	2012/06/03 13:04:49	2.48
+++ ./config.h	2012/06/17 11:14:50
@@ -323,6 +323,7 @@ 
   int CurrentDolby;
   int InitialVolume;
   int ChannelsWrap;
+  int ShowChannelNamesWithSource;
   int EmergencyExit;
   int __EndData__;
   cString InitialChannel;
--- ./menu.c	2012/06/13 13:03:26	2.57
+++ ./menu.c	2012/06/17 11:12:25
@@ -3158,6 +3158,7 @@ 
   Add(new cMenuEditChanItem(tr("Setup.Miscellaneous$Initial channel"),            &data.InitialChannel, tr("Setup.Miscellaneous$as before")));
   Add(new cMenuEditIntItem( tr("Setup.Miscellaneous$Initial volume"),             &data.InitialVolume, -1, 255, tr("Setup.Miscellaneous$as before")));
   Add(new cMenuEditBoolItem(tr("Setup.Miscellaneous$Channels wrap"),              &data.ChannelsWrap));
+  Add(new cMenuEditBoolItem(tr("Setup.Miscellaneous$Show channel names with source"), &data.ShowChannelNamesWithSource));
   Add(new cMenuEditBoolItem(tr("Setup.Miscellaneous$Emergency exit"),             &data.EmergencyExit));
 }
 
--- ./sources.h	2010/03/07 13:53:11	2.3
+++ ./sources.h	2012/06/17 11:19:23
@@ -33,6 +33,7 @@ 
   int Code(void) const { return code; }
   const char *Description(void) const { return description; }
   bool Parse(const char *s);
+  static char ToChar(int Code) { return (Code & st_Mask) >> 24; }
   static cString ToString(int Code);
   static int FromString(const char *s);
   static int FromData(eSourceType SourceType, int Position = 0, bool East = false);