[TV] Improving the DiseqC Support for KNC TV-Station card (1 Viewer)

Django.edwards

Portal Pro
October 22, 2009
457
54
Eupen
Home Country
Belgium Belgium
Hi all,
since some days ago I started to merge the KNC branch https://github.com/MediaPortal/MediaPortal-1/tree/KNC
into the MP 1.2.3 and so one code.
Since there are only 16 changed files between the KNC branch and the 1.2.3 source, I replaced all the files from the KNC branch into the source of 1.2.3.
After compiling everything seems to be fine, except when I try to tune to a channel I got the following error:
2013-05-22 08:57:48.123328 [(7)]: Exception :confused:ystem.Collections.Generic.KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.
bei System.ThrowHelper.ThrowKeyNotFoundException()
bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
bei TvLibrary.Implementations.DVB.ConditionalAccess.SendPids(Int32 subChannel, DVBBaseChannel channel, List`1 pids)

I found out, that the exception is generated in the following module: .\TvEngine3\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs
in this area:
Code:
	/// <summary>
	/// Instructs the cam/ci module to use hardware filter and only send the pids listed in pids to the pc
	/// </summary>
	/// <param name="subChannel">The sub channel id</param>
	/// <param name="channel">The current tv/radio channel.</param>
	/// <param name="pids">The pids.</param>
	/// <remarks>when the pids array is empty, pid filtering is disabled and all pids are received</remarks>
	public void SendPids(int subChannel, DVBBaseChannel channel, List<ushort> pids)
	{
	  try
	  {
		List<ushort> HwPids = new List<ushort>();
 
		_mapSubChannels[subChannel].Pids = pids;
 
		Dictionary<int, ConditionalAccessContext>.Enumerator enSubch = _mapSubChannels.GetEnumerator();
		while (enSubch.MoveNext())
		{
		  List<ushort> enPid = enSubch.Current.Value.Pids;
		  if (enPid != null)
		  {
			for (int i = 0; i < enPid.Count; ++i)
			{
			  if (!HwPids.Contains(enPid[i]))
				HwPids.Add(enPid[i]);
			}
		  }
		}
 
		if (_digitalEveryWhere != null)
		{
		  bool isDvbc = ((channel as DVBCChannel) != null);
		  bool isDvbt = ((channel as DVBTChannel) != null);
		  bool isDvbs = ((channel as DVBSChannel) != null);
		  bool isAtsc = ((channel as ATSCChannel) != null);
 
		  // It is not ideal to have to enable hardware PID filtering because
		  // doing so can limit the number of channels that can be viewed/recorded
		  // simultaneously. However, it does seem that there is a need for filtering
		  // on transponders with high data rates. Problems have been observed with
		  // transponders on Thor 5/6, Intelsat 10-02 (0.8W) if the filter is not enabled:
		  //  Symbol Rate: 27500, Modulation: 8 PSK, FEC rate: 5/6, Pilot: On, Roll-Off: 0.35
		  //  Symbol Rate: 30000, Modulation: 8 PSK, FEC rate: 3/4, Pilot: On, Roll-Off: 0.35
		  if (pids.Count != 0 && isDvbs &&
			  (((DVBSChannel)channel).ModulationType == ModulationType.Mod8Psk ||
			  ((DVBSChannel)channel).ModulationType == ModulationType.Mod16Apsk ||
			  ((DVBSChannel)channel).ModulationType == ModulationType.Mod32Apsk)
		  )
		  {
			for (int i = 0; i < HwPids.Count; ++i)
			{
			  Log.Log.Info("FireDTV: HW Filtered Pid : 0x{0:X}", HwPids[i]);
			}
			_digitalEveryWhere.SetHardwarePidFiltering(isDvbc, isDvbt, true, isAtsc, HwPids);
		  }
		  else
		  {
			pids.Clear();
			Log.Log.Info("FireDTV: HW Filtering disabled.");
			_digitalEveryWhere.SetHardwarePidFiltering(isDvbc, isDvbt, isDvbs, isAtsc, pids);
		  }
		}
	  }
	  catch (Exception ex)
	  {
		Log.Log.Write(ex);
	  }
	}

at the following line: _mapSubChannels[subChannel].Pids = pids;

Since I'm an absolute beginner, I can't find out why this happens. It seems that the called key is not in the Directory. But I don't know if this is ok or not.

It would be really gret if somebody could help me out, as this is the only Problem that I have, and so I could use my tv Card with the latest release without having to wait for TVE3.5 coming out.

Maybe @mm1352000 could me give a hint.

Any help would be very appreciated.
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    The error is specific to some of my older branches. It is completely harmless.
    Hardware PID filtering is irrelevant for KNC tuners, so you can just directly return from that function:
    Code:
    public void SendPids(int subChannel, DVBBaseChannel channel, List<ushort> pids)
    {
    }

    Glad to hear you managed to merge it. :)
     
    Last edited:

    Django.edwards

    Portal Pro
    October 22, 2009
    457
    54
    Eupen
    Home Country
    Belgium Belgium
    Hi mm, thanks for your quick Response. Yes I'm glad too :)
    What do you think, would it be possible to merge this branch into the future Releases of Mepo? Since the release date of TVE3.5 is not know (for me) it would be nice to have your improvement in the offical Releases too.
    As I can see any Problems for the stability of the existing code..... it have only to be done.
    As I'm not really familiar with git and opening a own branch or something else, I don't know how to go further with this.
    What's your opinion?
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    What do you think, would it be possible to merge this branch into the future Releases of Mepo? Since the release date of TVE3.5 is not know (for me) it would be nice to have your improvement in the offical Releases too.

    As I can see any Problems for the stability of the existing code..... it have only to be done.
    That branch definitely doesn't have support for multi-channel decryption, and as I recall it also has bugs with the KNC Twin support. Really, it is only a solution for your specific problem. Further, if we merge it to TVE3, it causes problems for TVE3.5 => I'd prefer not merge.
     

    Django.edwards

    Portal Pro
    October 22, 2009
    457
    54
    Eupen
    Home Country
    Belgium Belgium
    OK, I absolutely agree! It was just a question.

    I have to thank you again for your Support, it is always appreciated! (y) So Keep going on with some awesome new Features in TVE3.5 ;)
     

    Users who are viewing this thread

    Top Bottom