Skip to content

Commit

Permalink
MP1-5190: TVE: Add SymbolRate multiplier for DVB-C cards (Hauppauge W…
Browse files Browse the repository at this point in the history
…inTV)
  • Loading branch information
epbk committed Jan 2, 2024
1 parent 5021437 commit 85425e1
Show file tree
Hide file tree
Showing 10 changed files with 395 additions and 274 deletions.
6 changes: 6 additions & 0 deletions TvEngine3/TVLibrary/SetupTv/62_upgrade_mysql_database.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
USE %TvLibrary%;

ALTER TABLE "Card"
ADD COLUMN "symbolRateMultiplier" INT NOT NULL DEFAULT 0;

UPDATE Version SET versionNumber=62;
9 changes: 9 additions & 0 deletions TvEngine3/TVLibrary/SetupTv/62_upgrade_sqlserver_database.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use %TvLibrary%
GO

ALTER TABLE Card
ADD symbolRateMultiplier int NOT NULL CONSTRAINT DF_symbolRateMultiplier DEFAULT ((0))
GO

UPDATE Version SET versionNumber=62
GO
585 changes: 314 additions & 271 deletions TvEngine3/TVLibrary/SetupTv/Dialogs/FormEditCard.Designer.cs

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions TvEngine3/TVLibrary/SetupTv/Dialogs/FormEditCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ private void FormEditCard_Load(object sender, EventArgs e)
checkBoxAllowEpgGrab.Enabled = true;
}

if (_cardType == "DvbC")
{
this.checkBoxSrMultiply.Enabled = true;
this.checkBoxSrMultiply.Checked = this._card.SymbolRateMultiplier > 0;
}
else
{
this.checkBoxSrMultiply.Enabled = false;
this.checkBoxSrMultiply.Checked = false;
}

IList<CardGroupMap> GrpList = _card.ReferringCardGroupMap();
if (GrpList.Count != 0)
{
Expand Down Expand Up @@ -134,5 +145,10 @@ private void checkBoxCAMenabled_CheckedChanged(object sender, EventArgs e)
{
setCAMLimitVisibility();
}

private void checkBoxSrMultiply_CheckedChanged(object sender, EventArgs e)
{
this._card.SymbolRateMultiplier = this.checkBoxSrMultiply.Checked ? 1000 : 0;
}
}
}
4 changes: 2 additions & 2 deletions TvEngine3/TVLibrary/SetupTv/Dialogs/FormEditCard.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
5 changes: 5 additions & 0 deletions TvEngine3/TVLibrary/SetupTv/Sections/ImportExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private void Export(string fileName, bool exporttv, bool exporttvgroups, bool ex
AddAttribute(nodeCard, "CAM", card.CAM);
AddAttribute(nodeCard, "netProvider", card.netProvider);
AddAttribute(nodeCard, "StopGraph", card.StopGraph);
AddAttribute(nodeCard, "symbolRateMultiplier", card.SymbolRateMultiplier);
nodeCards.AppendChild(nodeCard);
}
nodeServer.AppendChild(nodeCards);
Expand Down Expand Up @@ -398,6 +399,10 @@ private void importButton_Click(object sender, EventArgs e)
{
card.CAM = (nodeCard.Attributes["CAM"].Value == "True");
}
if (nodeCard.Attributes["symbolRateMultiplier"] != null)
{
card.SymbolRateMultiplier = Int32.Parse(nodeCard.Attributes["symbolRateMultiplier"].Value);
}
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions TvEngine3/TVLibrary/SetupTv/SetupTv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@
<EmbeddedResource Include="60_upgrade_sqlserver_database.sql" />
<EmbeddedResource Include="61_upgrade_mysql_database.sql" />
<EmbeddedResource Include="61_upgrade_sqlserver_database.sql" />
<EmbeddedResource Include="62_upgrade_mysql_database.sql" />
<EmbeddedResource Include="62_upgrade_sqlserver_database.sql" />
<Content Include="images\animation.SatDish.gif" />
<Content Include="images\icon.card.gif" />
<Content Include="images\icon.computer.gif" />
Expand Down
15 changes: 15 additions & 0 deletions TvEngine3/TVLibrary/TVDatabase/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class Card : Persistent, IComparable
[TableColumn("CAM", NotNull = true)] private bool caModule;
[TableColumn("NetProvider", NotNull = true)] private int NetProvider;

[TableColumn("symbolRateMultiplier", NotNull = true)] private int _SymbolRateMultiplier;

#endregion

#region Constructors
Expand Down Expand Up @@ -383,6 +385,19 @@ public int netProvider
}
}

public int SymbolRateMultiplier
{
get { return this._SymbolRateMultiplier; }
set
{
if (value < 0)
value = 0;

this.isChanged |= this._SymbolRateMultiplier != value;
this._SymbolRateMultiplier = value;
}
}

#endregion

#region Storage and Retrieval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ public Card AddCard(string name, string devicePath, Server server)
//
Card newCard = new Card(devicePath, name, 1, true, new DateTime(2000, 1, 1), "", server.IdServer, true, 0, "", 0,
0, false, true, false, (int)TvDatabase.DbNetworkProvider.Generic);

//Set symbolrate multiplier for some cards
if (name.StartsWith("Hauppauge WinTV-soloHD DVBC", StringComparison.CurrentCultureIgnoreCase)
|| name.StartsWith("Hauppauge WinTV-dualHD DVBC Tuner", StringComparison.CurrentCultureIgnoreCase))
card.SymbolRateMultiplier = 1000;

newCard.Persist();
return newCard;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,26 @@ private bool BeforeTune(IChannel channel, ref int subChannelId)
dvbcLocator.put_OuterFEC(FECMethod.MethodNotSet);
dvbcLocator.put_OuterFECRate(BinaryConvolutionCodeRate.RateNotSet);
dvbcLocator.put_Modulation(dvbcChannel.ModulationType);
dvbcLocator.put_SymbolRate(dvbcChannel.SymbolRate);

//SymbolRate multiplier
int iSr = dvbcChannel.SymbolRate;
if (iSr > 0 && iSr < 1000000)
{
System.Collections.Generic.IList<Card> cards = Card.ListAll();
for (int i = 0; i < cards.Count; i++)
{
Card card = cards[i];
if (card.DevicePath.Equals(this._device.DevicePath))
{
if (card.SymbolRateMultiplier > 0)
iSr *= 1000;

break;
}
}
}
dvbcLocator.put_SymbolRate(iSr);

IDVBTuneRequest tuneRequest = (IDVBTuneRequest)_tuneRequest;
tuneRequest.put_ONID(dvbcChannel.NetworkId);
tuneRequest.put_SID(dvbcChannel.ServiceId);
Expand Down

0 comments on commit 85425e1

Please sign in to comment.