- September 1, 2008
- 21,578
- 8,228
- Home Country
-
New Zealand
Developers - I need some help/advice!
My original goal was to enable DiSEqC to work on my Pinnacle PCTV 7010ix (see this thread). This relatively small goal has got a little out of hand
---------------------------------------------------------------------
My card uses the default GenericBDA DiSEqC handler. The only reason why the existing version of the handler doesn't work is that the driver for my card requires the DirectShow put_Range() function to be called *after* the graph is started. In other words, the call to ConditionalAccess.SendDiseqCommand() must be made after the call to ((IMediaControl)_graphBuilder).Run(). Obviously some cards work just fine with the existing handler - I don't want to mess that up! However I'm sure there are other cards just like mine so I thought it would be helpful to the community to create a patch that calls the SendDiseqCommand() function again after the graph has started if the first call fails and the handler is the GenericBDA handler. This would be similar to the existing hack-fix for Hauppauge cards (except the graph shouldn't be restarted)...
I thought creating a patch would be easy until I started getting deeper into the ConditionalAccess and hardware-specific code. The DiSEqC code within the hardware-specific classes seemed to be quite unstructured and this made it difficult to quickly make my patch. I decided to do "a little" ***careful*** refactoring to make my job easier. I finally finished what I thought was reasonable this evening, however "a little" had turned into *way more* than I intended. You can see what I have done in the attached patch...
Summary:
- I extended and modified the existing IHardwareProvider interface and created a HardwareProviderBase abstract class that all the hardware specific classes (except the SS2) now override. This means all the hardware-specific classes now have base properties/functionality such as a "provider name" (eg. "Hauppauge") and a list of capabilities (eg. CAM, DiSEqC switching, DiSEqC motor control). It also makes the ConditionalAccess constructor code much simpler.
- I extended the IHardwareProvider interface with a further IDiSEqCPortController interface. All hardware providers that support DiSEqC switching now implement this interface. Because many of the hardware specific classes had similar code for port switching I also created a base abstract DiSEqCPortControllerBase class with the generic port switching code from the GenericBDA handler.
- I extended the IDiSEqCPortController with a further IDiSEqCController interface. All hardware providers that support sending generic DiSEqC commands (for DiSEqC motor control) now implement this interface. Again, much of the hardware specific code for sending DiSEqC port commands was very similar so I created a DiSEqCControllerBase class to implement default port switching behaviour.
- I also created two other interfaces - IQAMHardwareProvider and IDVBS2HardwareProvider - which extend the IHardwareProvider interface. Hardware which support ATSC tuning and DVB-S2 tuning implement these interfaces.
What I have not done yet that could also be done is to create an interface for devices that have CI/CAM functionality...
After all that work I confess I am a quite afraid that you will reject my refactoring simply because the affected code is "mission critical" or that changes to this area of the code are out of scope at the moment. I urge you to take time to consider what I have done - I think what I have done is a huge improvement to the structure of the code. I have also been ***very*** careful to ensure that I don't make changes where changes don't need to be made to try to avoid breaking existing functionality.
Thank you for your consideration
---------------------------------------------------------------------
Update: 2010-10-08
I now have a patch which is not a hack! It supports the 7010ix using a special provider which inherits from the generic provider. Only specific hardware is supported by the provider (at present only the 7010ix). Hardware is identified by device path. My thanks to romadd64 and elorentz
The new version of the patch (built on SVN HEAD) is attached to this post.
---------------------------------------------------------------------
Update: 2010-10-09
Patch and DLLs for 1.1.0 final as requested by romadd64 are now also available.
DLLs = TVLibrary[1.1.0_SVN_26097].zip
Code patch = HardwareSpecificCodeRefactoring(v2)[1.1.0_SVN_26097].zip
---------------------------------------------------------------------
Update: 2010-10-13
Patch and DLLs for 1.1.1 final as requested by ColinT (see this thread). I have also made a few more changes:
- add the BGT3595 HWID to the BlackgoldBDA handler to support ColinT's card
- remove the Init() function from the IHardwareProvider interface. I think it is much safer to have all initialisation happen in the constructor - no chance of forgetting to call Init(). This required the constructors for all the hardware providers to be given an additional parameter (device path).
- use a common base class variable for IsSupported and remove a couple of other unnecessary class variables here and there in the other providers
- don't attempt to send DiSEqC commands for DVB-T cards (BlackgoldBDA handler)
- fix for Digital Devices provider (*only* 1.1.1 and SVN HEAD). The CI/CAM thread was not being stopped/disposed when the hardware provider is disposed
. This is an issue with the current code (not just my refactoring) so it could be added as a separate fix if necessary.
---------------------------------------------------------------------
Update: 2010-10-28
New patches and DLLs for 1.1.0, 1.1.1 and SVN 26615. Changes:
- fix Blackgold BGT3595 HWID
- add Pinnacle PCTV 710ix
- provide a proper build for 1.1.1 (thanks NTAuthority
)
This build (v4) does not have any CI/CAM refactoring.
---------------------------------------------------------------------
Update: 2010-11-28
New patches and DLLs for 1.1.0, 1.1.1 and SVN 26867. Changes:
- add Blackgold BGT3540 HWID to support DiSEqC switching for that card
- new interface ICamController and refactoring of CI/CAM control code to implement it
- new interface IAddOnDevice and refactoring of WinTV CI and DigitalDevices code to implement it.
- integrate IAddOnDevice in ConditionalAccess and TvCardDvbBase.
Still TODO:
- integrate morpheus_xxx's plugin manager
This build (v5) has substantial code refactoring in the CI/CAM code. I have been ***very*** careful, but I may have inadvertently broken support for scrambled channels. I'd appreciate it if you could test and help me to find any bugs
---------------------------------------------------------------------
Update: 2010-11-29
Add patch for 1.2.0a.
---------------------------------------------------------------------
Update: 2010-12-10
Add patch for 1.1.2
My original goal was to enable DiSEqC to work on my Pinnacle PCTV 7010ix (see this thread). This relatively small goal has got a little out of hand
---------------------------------------------------------------------
My card uses the default GenericBDA DiSEqC handler. The only reason why the existing version of the handler doesn't work is that the driver for my card requires the DirectShow put_Range() function to be called *after* the graph is started. In other words, the call to ConditionalAccess.SendDiseqCommand() must be made after the call to ((IMediaControl)_graphBuilder).Run(). Obviously some cards work just fine with the existing handler - I don't want to mess that up! However I'm sure there are other cards just like mine so I thought it would be helpful to the community to create a patch that calls the SendDiseqCommand() function again after the graph has started if the first call fails and the handler is the GenericBDA handler. This would be similar to the existing hack-fix for Hauppauge cards (except the graph shouldn't be restarted)...
I thought creating a patch would be easy until I started getting deeper into the ConditionalAccess and hardware-specific code. The DiSEqC code within the hardware-specific classes seemed to be quite unstructured and this made it difficult to quickly make my patch. I decided to do "a little" ***careful*** refactoring to make my job easier. I finally finished what I thought was reasonable this evening, however "a little" had turned into *way more* than I intended. You can see what I have done in the attached patch...
Summary:
- I extended and modified the existing IHardwareProvider interface and created a HardwareProviderBase abstract class that all the hardware specific classes (except the SS2) now override. This means all the hardware-specific classes now have base properties/functionality such as a "provider name" (eg. "Hauppauge") and a list of capabilities (eg. CAM, DiSEqC switching, DiSEqC motor control). It also makes the ConditionalAccess constructor code much simpler.
- I extended the IHardwareProvider interface with a further IDiSEqCPortController interface. All hardware providers that support DiSEqC switching now implement this interface. Because many of the hardware specific classes had similar code for port switching I also created a base abstract DiSEqCPortControllerBase class with the generic port switching code from the GenericBDA handler.
- I extended the IDiSEqCPortController with a further IDiSEqCController interface. All hardware providers that support sending generic DiSEqC commands (for DiSEqC motor control) now implement this interface. Again, much of the hardware specific code for sending DiSEqC port commands was very similar so I created a DiSEqCControllerBase class to implement default port switching behaviour.
- I also created two other interfaces - IQAMHardwareProvider and IDVBS2HardwareProvider - which extend the IHardwareProvider interface. Hardware which support ATSC tuning and DVB-S2 tuning implement these interfaces.
What I have not done yet that could also be done is to create an interface for devices that have CI/CAM functionality...
After all that work I confess I am a quite afraid that you will reject my refactoring simply because the affected code is "mission critical" or that changes to this area of the code are out of scope at the moment. I urge you to take time to consider what I have done - I think what I have done is a huge improvement to the structure of the code. I have also been ***very*** careful to ensure that I don't make changes where changes don't need to be made to try to avoid breaking existing functionality.
Thank you for your consideration
---------------------------------------------------------------------
Update: 2010-10-08
I now have a patch which is not a hack! It supports the 7010ix using a special provider which inherits from the generic provider. Only specific hardware is supported by the provider (at present only the 7010ix). Hardware is identified by device path. My thanks to romadd64 and elorentz
---------------------------------------------------------------------
Update: 2010-10-09
Patch and DLLs for 1.1.0 final as requested by romadd64 are now also available.
DLLs = TVLibrary[1.1.0_SVN_26097].zip
Code patch = HardwareSpecificCodeRefactoring(v2)[1.1.0_SVN_26097].zip
---------------------------------------------------------------------
Update: 2010-10-13
Patch and DLLs for 1.1.1 final as requested by ColinT (see this thread). I have also made a few more changes:
- add the BGT3595 HWID to the BlackgoldBDA handler to support ColinT's card
- remove the Init() function from the IHardwareProvider interface. I think it is much safer to have all initialisation happen in the constructor - no chance of forgetting to call Init(). This required the constructors for all the hardware providers to be given an additional parameter (device path).
- use a common base class variable for IsSupported and remove a couple of other unnecessary class variables here and there in the other providers
- don't attempt to send DiSEqC commands for DVB-T cards (BlackgoldBDA handler)
- fix for Digital Devices provider (*only* 1.1.1 and SVN HEAD). The CI/CAM thread was not being stopped/disposed when the hardware provider is disposed
---------------------------------------------------------------------
Update: 2010-10-28
New patches and DLLs for 1.1.0, 1.1.1 and SVN 26615. Changes:
- fix Blackgold BGT3595 HWID
- add Pinnacle PCTV 710ix
- provide a proper build for 1.1.1 (thanks NTAuthority
This build (v4) does not have any CI/CAM refactoring.
---------------------------------------------------------------------
Update: 2010-11-28
New patches and DLLs for 1.1.0, 1.1.1 and SVN 26867. Changes:
- add Blackgold BGT3540 HWID to support DiSEqC switching for that card
- new interface ICamController and refactoring of CI/CAM control code to implement it
- new interface IAddOnDevice and refactoring of WinTV CI and DigitalDevices code to implement it.
- integrate IAddOnDevice in ConditionalAccess and TvCardDvbBase.
Still TODO:
- integrate morpheus_xxx's plugin manager
This build (v5) has substantial code refactoring in the CI/CAM code. I have been ***very*** careful, but I may have inadvertently broken support for scrambled channels. I'd appreciate it if you could test and help me to find any bugs
---------------------------------------------------------------------
Update: 2010-11-29
Add patch for 1.2.0a.
---------------------------------------------------------------------
Update: 2010-12-10
Add patch for 1.1.2
Attachments
-
HardwareSpecificRefactoring[v4][1.1.0_SVN_26097].zip31.6 KB
-
HardwareSpecificRefactoring[v4][1.1.1_26460].zip31.7 KB
-
HardwareSpecificRefactoring[v4][SVN_HEAD_26615].zip32.9 KB
-
TVLibrary[v4][1.1.0_SVN_26097].zip182.4 KB
-
TVLibrary[v4][1.1.1_26460].zip181.6 KB
-
TvLibrary[v4][SVN_HEAD_26615].zip185.8 KB
-
HardwareSpecificRefactoring[v5][1.1.0_SVN_26097].zip69.3 KB
-
HardwareSpecificRefactoring[v5][1.1.1_26460].zip69.3 KB
-
HardwareSpecificRefactoring[v5][SVN_HEAD_26867].zip74.3 KB
-
TVLibrary[v5][1.1.0_SVN_26097].zip180.8 KB
-
TVLibrary[v5][1.1.1_26460].zip181.1 KB
-
TvLibrary[v5][SVN_HEAD_26867].zip184.3 KB
-
HardwareSpecificRefactoring[v5][1.2.0a_26637].zip74.3 KB
-
TvLibrary[v5][1.2.0a_26637].zip184 KB
-
HardwareSpecificRefactoring[v5][1.1.2_26886].zip69.3 KB
-
TVLibrary[v5][1.1.2_26886].zip181.3 KB
Last edited by a moderator: