/// <summary>
        /// Initializes a new instance of the <see cref="ViXSATSC"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public ViXSATSC(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");

            if (pin != null)
            {
                _propertySet = tunerFilter as IKsPropertySet;
                if (_propertySet != null)
                {
                    KSPropertySupport supported;
                    _propertySet.QuerySupported(guidViXSTunerExtention, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        Log.Log.Debug("ViXS ATSC: DVB-S card found!");
                        _tempValue  = Marshal.AllocCoTaskMem(1024);
                        _isViXSATSC = true;
                    }
                    else
                    {
                        Log.Log.Debug("ViXS ATSC: card NOT found!");
                        _isViXSATSC = false;
                    }
                }
            }
            else
            {
                Log.Log.Info("ViXS ATSC: could not find MPEG2 Transport pin!");
            }
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericATSC"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public GenericATSC(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("GenericATSC: QAM capable card found!");
         _isGenericATSC = true;
         _tempValue = Marshal.AllocCoTaskMem(1024);
         _tempInstance = Marshal.AllocCoTaskMem(1024);
       }
       else
       {
         Log.Log.Debug("GenericATSC: QAM card NOT found!");
         _isGenericATSC = false;
       }
     }
   }
   else
     Log.Log.Info("GenericATSC: tuner pin not found!");
 }
Exemple #3
0
        internal TBSDVBS2Handler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (!tuner.Name.ToUpperInvariant().Contains("TBS"))
            {
                return;
            }

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_NBC_PARAMS, out supported);
                    if (reply == 0)
                    {
                        dvbs2Capable = (supported & KSPropertySupport.Get) == KSPropertySupport.Get || (supported & KSPropertySupport.Set) == KSPropertySupport.Set;

                        if (dvbs2Capable)
                        {
                            useSet = (supported & KSPropertySupport.Set) == KSPropertySupport.Set;
                            useGet = !useSet;
                        }
                    }
                }
            }
        }
Exemple #4
0
        protected override void SetStructure(Guid guidPropSet, uint propId, Type structureType, object structValue)
        {
            Guid propertyGuid = guidPropSet;
            IPin pin          = DsFindPin.ByDirection(captureFilter, PinDirection.Input, 0);

            if (pin == null)
            {
                return;
            }
            IKsPropertySet propertySet = pin as IKsPropertySet;

            if (propertySet == null)
            {
                throw new ApplicationException("Twinhan: SetStructure() properySet=null");
                return;
            }
            int iSize = Marshal.SizeOf(structureType);
            //throw new ApplicationException("Twinhan: size:{0}", iSize);
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(iSize);

            Marshal.StructureToPtr(structValue, pDataReturned, true);
            int hr = propertySet.RemoteSet(ref propertyGuid, propId, IntPtr.Zero, 0, pDataReturned,
                                           (uint)Marshal.SizeOf(structureType));

            if (hr != 0)
            {
                // throw new ApplicationException("Twinhan: SetStructure() failed 0x{0:X}", hr);
            }
            else
            {
                //throw new ApplicationException("Twinhan: SetStructure() returned ok 0x{0:X}", hr);
            }
            Marshal.FreeCoTaskMem(pDataReturned);
        }
        private PTZDevice(string name, PTZType type)
        {
            var devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
            var device = devices.Where(d => d.Name == name).FirstOrDefault();

            _device = device;
            _type = type;

            if (_device == null) throw new ApplicationException(String.Format("Couldn't find device named {0}!", name));

            IFilterGraph2 graphBuilder = new FilterGraph() as IFilterGraph2;
            IBaseFilter filter = null;
            IMoniker i = _device.Mon as IMoniker;

            graphBuilder.AddSourceFilterForMoniker(i, null, _device.Name, out filter);
            _camControl = filter as IAMCameraControl;
            _ksPropertySet = filter as IKsPropertySet;

            if (_camControl == null) throw new ApplicationException("Couldn't get ICamControl!");
            if (_ksPropertySet == null) throw new ApplicationException("Couldn't get IKsPropertySet!");

            //TODO: Add Absolute
            if (type == PTZType.Relative &&
                !(SupportFor(KSProperties.CameraControlFeature.KSPROPERTY_CAMERACONTROL_PAN_RELATIVE) &&
                SupportFor(KSProperties.CameraControlFeature.KSPROPERTY_CAMERACONTROL_TILT_RELATIVE)))
            {
                throw new NotSupportedException("This camera doesn't appear to support Relative Pan and Tilt");
            }

            //TODO: Do I through NotSupported when methods are called or throw them now?

            //TODO: Do I check for Zoom or ignore if it's not there?
            InitZoomRanges();
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Hauppauge"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public Hauppauge(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                _propertySet = pin as IKsPropertySet;
                if (_propertySet != null)
                {
                    KSPropertySupport supported;
                    _propertySet.QuerySupported(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                                out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        Log.Log.Debug("Hauppauge: DVB-S card found!");
                        _isHauppauge  = true;
                        _ptrDiseqc    = Marshal.AllocCoTaskMem(1024);
                        _tempValue    = Marshal.AllocCoTaskMem(1024);
                        _tempInstance = Marshal.AllocCoTaskMem(1024);
                    }
                    else
                    {
                        Log.Log.Debug("Hauppauge: DVB-S card NOT found!");
                        _isHauppauge = false;
                        Dispose();
                    }
                }
            }
            else
            {
                Log.Log.Info("Hauppauge: tuner pin not found!");
            }
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericBDAS"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public GenericBDAS(IBaseFilter tunerFilter)
        {
            _TunerDevice = (IBDA_Topology)tunerFilter;
            //check if the BDA driver supports DiSEqC
            IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");

            if (pin != null)
            {
                _propertySet = pin as IKsPropertySet;
                if (_propertySet != null)
                {
                    KSPropertySupport supported;
                    _propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        Log.Log.Debug(FormatMessage("DiSEqC capable card found!"));
                        _isGenericBDAS = true;
                    }
                }
            }
            else
            {
                Log.Log.Info(FormatMessage("tuner pin not found!"));
            }
        }
        internal TBSDVBS2Handler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (!tuner.Name.ToUpperInvariant().Contains("TBS"))
                return;

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_NBC_PARAMS, out supported);
                    if (reply == 0)
                    {
                        dvbs2Capable = (supported & KSPropertySupport.Get) == KSPropertySupport.Get || (supported & KSPropertySupport.Set) == KSPropertySupport.Set;

                        if (dvbs2Capable)
                        {
                            useSet = (supported & KSPropertySupport.Set) == KSPropertySupport.Set;
                            useGet = !useSet;
                        }
                    }
                }
            }
        }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hauppauge"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public Hauppauge(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                   out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("Hauppauge: DVB-S card found!");
         _isHauppauge = true;
         _ptrDiseqc = Marshal.AllocCoTaskMem(1024);
         _tempValue = Marshal.AllocCoTaskMem(1024);
         _tempInstance = Marshal.AllocCoTaskMem(1024);
       }
       else
       {
         Log.Log.Debug("Hauppauge: DVB-S card NOT found!");
         _isHauppauge = false;
         Dispose();
       }
     }
   }
   else
     Log.Log.Info("Hauppauge: tuner pin not found!");
 }
Exemple #10
0
        public object GetStructure(Guid guidPropSet, int propId, System.Type structureType)
        {
            Guid              propertyGuid    = guidPropSet;
            IKsPropertySet    propertySet     = _captureFilter as IKsPropertySet;
            KSPropertySupport IsTypeSupported = 0;
            int uiSize;

            if (propertySet == null)
            {
                AppLogger.Message("GetStructure() properySet=null");
                return(null);
            }
            int hr = propertySet.QuerySupported(propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & KSPropertySupport.Get) == 0)
            {
                AppLogger.Message("GetString() GetStructure is not supported");
                return(null);
            }
            object objReturned   = null;
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(1000);

            hr = propertySet.Get(propertyGuid, propId, IntPtr.Zero, 0, pDataReturned, 1000, out uiSize);
            if (hr == 0)
            {
                objReturned = Marshal.PtrToStructure(pDataReturned, structureType);
            }
            else
            {
                AppLogger.Message(String.Format("GetStructure() failed 0x{0:X}", hr));
            }
            Marshal.FreeCoTaskMem(pDataReturned);
            return(objReturned);
        }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ViXSATSC"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public ViXSATSC(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");
   if (pin != null)
   {
     _propertySet = tunerFilter as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(guidViXSTunerExtention, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("ViXS ATSC: DVB-S card found!");
         _tempValue = Marshal.AllocCoTaskMem(1024);
         _isViXSATSC = true;
       }
       else
       {
         Log.Log.Debug("ViXS ATSC: card NOT found!");
         _isViXSATSC = false;
       }
     }
   }
   else
     Log.Log.Info("ViXS ATSC: could not find MPEG2 Transport pin!");
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericATSC"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public GenericATSC(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");

            if (pin != null)
            {
                _propertySet = pin as IKsPropertySet;
                if (_propertySet != null)
                {
                    KSPropertySupport supported;
                    _propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        Log.Log.Debug("GenericATSC: QAM capable card found!");
                        _isGenericATSC = true;
                        _tempValue     = Marshal.AllocCoTaskMem(1024);
                        _tempInstance  = Marshal.AllocCoTaskMem(1024);
                    }
                    else
                    {
                        Log.Log.Debug("GenericATSC: QAM card NOT found!");
                        _isGenericATSC = false;
                    }
                }
            }
            else
            {
                Log.Log.Info("GenericATSC: tuner pin not found!");
            }
        }
        protected virtual void SetStructure(Guid guidPropSet, uint propId, Type structureType, object structValue)
        {
            Guid           propertyGuid    = guidPropSet;
            IKsPropertySet propertySet     = captureFilter as IKsPropertySet;
            uint           IsTypeSupported = 0;

            if (propertySet == null)
            {
                //throw new ApplicationException("SetStructure() properySet=null");
                return;
            }

            int hr = propertySet.QuerySupported(ref propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & (uint)KsPropertySupport.Set) == 0)
            {
                //throw new ApplicationException("GetString() GetStructure is not supported");
                return;
            }

            int    iSize         = Marshal.SizeOf(structureType);
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(iSize);

            Marshal.StructureToPtr(structValue, pDataReturned, true);
            hr = propertySet.RemoteSet(ref propertyGuid, propId, pDataReturned, (uint)iSize, pDataReturned, (uint)iSize);
            if (hr != 0)
            {
                //throw new ApplicationException("SetStructure() failed 0x{0:X}", hr);
            }
            Marshal.FreeCoTaskMem(pDataReturned);
        }
Exemple #14
0
        public string GetPinCategory()
        {
            if (ipin == null)
            {
                return(null);
            }
            IKsPropertySet pset = ipin as IKsPropertySet;

            if (pset == null)
            {
                return(null);
            }
            IntPtr pGuid = Marshal.AllocHGlobal(16);
            int    ret   = 0;

            pset.Get(PropSetID.Pin, 0, IntPtr.Zero, 0, pGuid, 16, out ret);
            Guid guid = (Guid)Marshal.PtrToStructure(pGuid, typeof(Guid));

            Marshal.FreeHGlobal(pGuid);

            foreach (System.Reflection.FieldInfo m in typeof(PinCategory).GetFields())
            {
                if ((Guid)m.GetValue(null) == guid)
                {
                    return(m.Name);
                }
            }

            return(null);
        }
        protected object GetStructure(Guid guidPropSet, uint propId, Type structureType)
        {
            Guid           propertyGuid    = guidPropSet;
            IKsPropertySet propertySet     = captureFilter as IKsPropertySet;
            uint           IsTypeSupported = 0;
            uint           uiSize;

            if (propertySet == null)
            {
                //throw new ApplicationException("GetStructure() properySet=null");
                return(null);
            }
            int hr = propertySet.QuerySupported(ref propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & (uint)KsPropertySupport.Get) == 0)
            {
                // throw new ApplicationException("GetString() GetStructure is not supported");
                return(null);
            }

            object objReturned   = null;
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(1000);

            hr = propertySet.RemoteGet(ref propertyGuid, propId, IntPtr.Zero, 0, pDataReturned, 1000, out uiSize);
            if (hr == 0)
            {
                objReturned = Marshal.PtrToStructure(pDataReturned, structureType);
            }
            else
            {
                // throw new ApplicationException("GetStructure() failed 0x{0:X}", hr);
            }
            Marshal.FreeCoTaskMem(pDataReturned);
            return(objReturned);
        }
        protected string GetString(Guid guidPropSet, uint propId)
        {
            Guid           propertyGuid    = guidPropSet;
            IKsPropertySet propertySet     = captureFilter as IKsPropertySet;
            uint           IsTypeSupported = 0;
            uint           uiSize;

            if (propertySet == null)
            {
                //throw new ApplicationException("GetString() properySet=null");
                return(string.Empty);
            }
            int hr = propertySet.QuerySupported(ref propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & (uint)KsPropertySupport.Get) == 0)
            {
                //throw new ApplicationException("GetString() property is not supported");
                return(string.Empty);
            }

            IntPtr pDataReturned = Marshal.AllocCoTaskMem(100);
            string returnedText  = string.Empty;

            hr = propertySet.RemoteGet(ref propertyGuid, propId, IntPtr.Zero, 0, pDataReturned, 100, out uiSize);
            if (hr == 0)
            {
                returnedText = Marshal.PtrToStringAnsi(pDataReturned, (int)uiSize);
            }
            Marshal.FreeCoTaskMem(pDataReturned);
            return(returnedText);
        }
        protected void SetIntValue(Guid guidPropSet, uint propId, int intValue)
        {
            Guid           propertyGuid = guidPropSet;
            IKsPropertySet propertySet  = captureFilter as IKsPropertySet;

            if (propertySet == null)
            {
                //throw new ApplicationException("SetIntValue() properySet=null");
                return;
            }
            uint IsTypeSupported = 0;

            int hr = propertySet.QuerySupported(ref propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & (uint)KsPropertySupport.Set) == 0)
            {
                // throw new ApplicationException("SetIntValue() property is not supported");
                return;
            }
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(100);

            Marshal.WriteInt32(pDataReturned, intValue);
            hr = propertySet.RemoteSet(ref propertyGuid, propId, pDataReturned, 4, pDataReturned, 4);
            if (hr != 0)
            {
                //throw new ApplicationException("SetIntValue() failed 0x{0:X}", hr);
            }
            Marshal.FreeCoTaskMem(pDataReturned);
        }
Exemple #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Twinhan"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public Twinhan(IBaseFilter tunerFilter)
        {
            _ptrPmt             = Marshal.AllocCoTaskMem(8192);
            _ptrDwBytesReturned = Marshal.AllocCoTaskMem(4); // int32
            _thbdaBuf           = Marshal.AllocCoTaskMem(8192);
            _ptrOutBuffer       = Marshal.AllocCoTaskMem(8192);
            _ptrOutBuffer2      = Marshal.AllocCoTaskMem(8192);
            _ptrDiseqc          = Marshal.AllocCoTaskMem(8192);
            _ptrMMIBuffer       = Marshal.AllocCoTaskMem(8192);
            _captureFilter      = tunerFilter;
            _initialized        = false;
            _camPresent         = false;
            _isTwinHanCard      = false;
            if (_captureFilter != null)
            {
                IPin pin = DsFindPin.ByDirection(_captureFilter, PinDirection.Input, 0);
                propertySet = pin as IKsPropertySet;

                _isTwinHanCard = IsTwinhan;
                if (_isTwinHanCard)
                {
                    _camPresent = IsCamPresent();
                    Log.Log.WriteFile("Twinhan:  CAM detected:{0}", _camPresent);
                }
            }
            _initialized = true;
        }
Exemple #19
0
        protected virtual void SetStructure(Guid guidPropSet, int propId, System.Type structureType, object structValue)
        {
            Guid              propertyGuid    = guidPropSet;
            IKsPropertySet    propertySet     = _captureFilter as IKsPropertySet;
            KSPropertySupport IsTypeSupported = 0;

            if (propertySet == null)
            {
                AppLogger.Message("SetStructure() properySet=null");
                return;
            }
            int hr = propertySet.QuerySupported(propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & KSPropertySupport.Set) == 0)
            {
                AppLogger.Message("GetString() GetStructure is not supported");
                return;
            }
            int    iSize         = Marshal.SizeOf(structureType);
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(iSize);

            Marshal.StructureToPtr(structValue, pDataReturned, true);
            hr = propertySet.Set(propertyGuid, propId, pDataReturned, (int)iSize, pDataReturned, (int)iSize);
            if (hr != 0)
            {
                AppLogger.Message(String.Format("SetStructure() failed 0x{0:X}", hr));
            }
            Marshal.FreeCoTaskMem(pDataReturned);
        }
Exemple #20
0
        private void setLnbData(bool lnbPower, int turnon22Khz, int disEqcPort, SatelliteDish satelliteDish)
        {
            int thbdaLen  = 0x28;
            int disEqcLen = 20;

            Marshal.WriteByte(ptrDiseqc, 0, (byte)(lnbPower ? 1 : 0));                                  // 0: LNB_POWER
            Marshal.WriteByte(ptrDiseqc, 1, 0);                                                         // 1: Tone_Data_Burst (Tone_Data_OFF:0 | Tone_Burst_ON:1 | Data_Burst_ON:2)
            Marshal.WriteByte(ptrDiseqc, 2, 0);
            Marshal.WriteByte(ptrDiseqc, 3, 0);
            Marshal.WriteInt32(ptrDiseqc, 4, satelliteDish.LNBLowBandFrequency / 1000);     // 4: LNBLOF LowBand MHz
            Marshal.WriteInt32(ptrDiseqc, 8, satelliteDish.LNBHighBandFrequency / 1000);    // 8: LNBLOF HighBand MHz
            Marshal.WriteInt32(ptrDiseqc, 12, satelliteDish.LNBSwitchFrequency / 1000);     //12: LNBLOF HiLoSW MHz
            Marshal.WriteByte(ptrDiseqc, 16, (byte)turnon22Khz);                            //16: f22K_Output (F22K_Output_HiLo:0 | F22K_Output_Off:1 | F22K_Output_On:2
            Marshal.WriteByte(ptrDiseqc, 17, (byte)disEqcPort);                             //17: DiSEqC_Port
            Marshal.WriteByte(ptrDiseqc, 18, 0);
            Marshal.WriteByte(ptrDiseqc, 19, 0);
            Marshal.WriteInt32(thbdaBuf, 0, 0x255e0082);                                    //GUID_THBDA_CMD
            Marshal.WriteInt16(thbdaBuf, 4, 0x2017);
            Marshal.WriteInt16(thbdaBuf, 6, 0x4b03);
            Marshal.WriteByte(thbdaBuf, 8, 0x90);
            Marshal.WriteByte(thbdaBuf, 9, 0xf8);
            Marshal.WriteByte(thbdaBuf, 10, 0x85);
            Marshal.WriteByte(thbdaBuf, 11, 0x6a);
            Marshal.WriteByte(thbdaBuf, 12, 0x62);
            Marshal.WriteByte(thbdaBuf, 13, 0xcb);
            Marshal.WriteByte(thbdaBuf, 14, 0x3d);
            Marshal.WriteByte(thbdaBuf, 15, 0x67);
            Marshal.WriteInt32(thbdaBuf, 16, (int)THBDA_IOCTL_SET_LNB_DATA);                    //dwIoControlCode
            Marshal.WriteInt32(thbdaBuf, 20, (int)ptrDiseqc.ToInt32());                         //lpInBuffer
            Marshal.WriteInt32(thbdaBuf, 24, disEqcLen);                                        //nInBufferSize
            Marshal.WriteInt32(thbdaBuf, 28, (int)IntPtr.Zero);                                 //lpOutBuffer
            Marshal.WriteInt32(thbdaBuf, 32, 0);                                                //nOutBufferSize
            Marshal.WriteInt32(thbdaBuf, 36, (int)ptrDwBytesReturned);                          //lpBytesReturned

            IPin pin = DsFindPin.ByDirection(captureFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                IKsPropertySet propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    reply = propertySet.Set(THBDA_TUNER, 0, ptrOutBuffer2, 0x18, thbdaBuf, thbdaLen);
                    if (reply != 0)
                    {
                        Logger.Instance.Write("TwinHan/TechniSat SetLNB failed 0x" + reply.ToString("X"));
                    }
                    else
                    {
                        Logger.Instance.Write("TwinHan/TechniSat SetLNB OK 0x" + reply.ToString("X"));
                    }

                    Marshal.ReleaseComObject(propertySet);
                }

                Marshal.ReleaseComObject(pin);
            }
        }
 /// <summary>
 /// Initializes a new instance of the DigitalEverywhereDiseqcHandler class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 internal DigitalEverywhereDiseqcHandler(IBaseFilter tunerFilter)
 {
     propertySet = tunerFilter as IKsPropertySet;
     if (propertySet != null)
     {
         KSPropertySupport supported;
         reply = propertySet.QuerySupported(ksPropSetID, ksPropertyLNBControl, out supported);
         if (reply == 0 && (supported & KSPropertySupport.Set) != 0)
             cardCapable = true;
     }
 }
        protected byte GetByteValue(Guid guidPropSet, uint propId)
        {
            Guid           propertyGuid    = guidPropSet;
            IKsPropertySet propertySet     = captureFilter as IKsPropertySet;
            uint           IsTypeSupported = 0;
            uint           uiSize;

            if (propertySet == null)
            {
                //throw new ApplicationException("GetByteValue() properySet=null");
                return(0);
            }
            int hr = propertySet.QuerySupported(ref propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & (uint)KsPropertySupport.Get) == 0)
            {
                //throw new ApplicationException("GetByteValue() property is not supported");
                return(0);
            }

            byte           returnValue      = 0;
            KSPROPERTYByte propByte         = new KSPROPERTYByte();
            KSPROPERTY     prop             = new KSPROPERTY();
            int            sizeProperty     = Marshal.SizeOf(prop);
            int            sizeByteProperty = Marshal.SizeOf(propByte);

            KSPROPERTYByte newByteValue  = new KSPROPERTYByte();
            IntPtr         pDataReturned = Marshal.AllocCoTaskMem(100);

            Marshal.StructureToPtr(newByteValue, pDataReturned, true);

            int    adress  = pDataReturned.ToInt32() + sizeProperty;
            IntPtr ptrData = new IntPtr(adress);

            hr = propertySet.RemoteGet(ref propertyGuid,
                                       propId,
                                       ptrData,
                                       (uint)(sizeByteProperty - sizeProperty),
                                       pDataReturned,
                                       (uint)sizeByteProperty,
                                       out uiSize);
            if (hr == 0 && uiSize == 1)
            {
                returnValue = Marshal.ReadByte(ptrData);
            }
            Marshal.FreeCoTaskMem(pDataReturned);

            if (hr != 0)
            {
                //throw new ApplicationException("GetByteValue() failed 0x{0:X}", hr);
            }
            return(returnValue);
        }
 /// <summary>
 /// Prüft, in welchem Umfang eine bestimmte Eigenschaft unterstützt wird.
 /// </summary>
 /// <param name="set">Die zu erweiternde Schnittstelle.</param>
 /// <param name="node">Die Beschreibung der Eigenschaft.</param>
 /// <param name="types">Die benötigte Art der Unterstützung.</param>
 /// <returns>Gesetzt, wenn die gewünschte Unterstützung möglich ist.</returns>
 public static bool DoesSupport <T>(this IKsPropertySet <T> set, KsPNode node, PropertySetSupportedTypes types) where T : struct
 {
     // Process
     if (set == null)
     {
         throw new ArgumentNullException("set");
     }
     else
     {
         return(set.DoesSupport(node.Property, types));
     }
 }
 /// <summary>
 /// Initializes a new instance of the DigitalEverywhereDiseqcHandler class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 internal DigitalEverywhereDiseqcHandler(IBaseFilter tunerFilter)
 {
     propertySet = tunerFilter as IKsPropertySet;
     if (propertySet != null)
     {
         KSPropertySupport supported;
         reply = propertySet.QuerySupported(ksPropSetID, ksPropertyLNBControl, out supported);
         if (reply == 0 && (supported & KSPropertySupport.Set) != 0)
         {
             cardCapable = true;
         }
     }
 }
 /// <summary>
 /// Initializes a new instance of the HauppaugeDiseqcHandler class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 internal HauppaugeDiseqcHandler(IBaseFilter tunerFilter)
 {
     IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
     if (pin != null)
     {
         propertySet = pin as IKsPropertySet;
         if (propertySet != null)
         {
             KSPropertySupport supported;
             reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
             if (reply == 0 && (supported & KSPropertySupport.Set) != 0)
                 cardCapable = true;
         }
     }
 }
        void BuildGraph()
        {
            int         hr;
            IBaseFilter ppFilter;

            DsDevice [] devs = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
            DsDevice    dev  = devs[0];

            IGraphBuilder graphBuilder = new FilterGraph() as IGraphBuilder;
            DsROTEntry    ds           = new DsROTEntry(graphBuilder);
            IFilterGraph2 ifg2         = graphBuilder as IFilterGraph2;

            hr = ifg2.AddSourceFilterForMoniker(dev.Mon, null, dev.Name, out ppFilter);
            DsError.ThrowExceptionForHR(hr);

            m_ps = ppFilter as IKsPropertySet;
        }
Exemple #27
0
        private PTZDevice(string name)
        {
            var devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
            var device  = devices.Where(d => d.Name == name).FirstOrDefault();

            _device = device;

            if (_device == null)
            {
                throw new ApplicationException(String.Format("Couldn't find device named {0}!", name));
            }

            IFilterGraph2 graphBuilder = new FilterGraph() as IFilterGraph2;
            IBaseFilter   filter       = null;
            IMoniker      i            = _device.Mon as IMoniker;

            graphBuilder.AddSourceFilterForMoniker(i, null, _device.Name, out filter);
            _camControl    = filter as IAMCameraControl;
            _ksPropertySet = filter as IKsPropertySet;

            if (_camControl == null)
            {
                throw new ApplicationException("Couldn't get ICamControl!");
            }
            if (_ksPropertySet == null)
            {
                throw new ApplicationException("Couldn't get IKsPropertySet!");
            }

            //TODO: Add Absolute

            /*
             * if (type == PTZType.Relative &&
             *  !(SupportFor(KSProperties.CameraControlFeature.KSPROPERTY_CAMERACONTROL_PAN_RELATIVE) &&
             *  SupportFor(KSProperties.CameraControlFeature.KSPROPERTY_CAMERACONTROL_TILT_RELATIVE)))
             * {
             *  throw new NotSupportedException("This camera doesn't appear to support Relative Pan and Tilt");
             * }
             * /**/

            //TODO: Do I through NotSupported when methods are called or throw them now?

            //TODO: Do I check for Zoom or ignore if it's not there?
            InitZoomRanges();
        }
        internal GenPixDVBS2Handler(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Output, 0);

            if (pin != null)
            {
                IKsPropertySet propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        dvbs2Capable = true;
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the ConexantDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        /// <param name="tuner">The tuner.</param>
        internal ConexantDiseqcHandler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (tuner.Name.ToUpperInvariant().Contains("TBS"))
                return;

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                        cardCapable = true;
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the HauppaugeDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        internal HauppaugeDiseqcHandler(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if (reply == 0 && (supported & KSPropertySupport.Set) != 0)
                    {
                        cardCapable = true;
                    }
                }
            }
        }
Exemple #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProfRed"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public ProfRed(IBaseFilter tunerFilter)
 {
   IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(_bdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                   out supported);
       if (((supported & KSPropertySupport.Get) != 0) && ((supported & KSPropertySupport.Set) == 0))
       {
         Log.Log.Info("ProfRed BDA: DVB-S card found!");
         _isProfRed = true;
         _ptrDiseqc = Marshal.AllocCoTaskMem(1024);
       }
     }
   }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfRed"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public ProfRed(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                _propertySet = pin as IKsPropertySet;
                if (_propertySet != null)
                {
                    KSPropertySupport supported;
                    _propertySet.QuerySupported(_bdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                                out supported);
                    if (((supported & KSPropertySupport.Get) != 0) && ((supported & KSPropertySupport.Set) == 0))
                    {
                        Log.Log.Info("ProfRed BDA: DVB-S card found!");
                        _isProfRed = true;
                        _ptrDiseqc = Marshal.AllocCoTaskMem(1024);
                    }
                }
            }
        }
Exemple #33
0
        /// <summary>
        /// Initializes a new instance of the GenericDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        internal GenericDiseqcHandler(IBaseFilter tunerFilter)
        {
            this.tunerFilter = tunerFilter;

            IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");

            if (pin != null)
            {
                IKsPropertySet propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);

                    if (reply == 0 && (supported & KSPropertySupport.Set) != 0)
                    {
                        cardCapable = true;
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GenPixBDA"/> class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        public GenPixBDA(IBaseFilter tunerFilter)
        {
            //check the filter name
            FilterInfo tInfo;

            tunerFilter.QueryFilterInfo(out tInfo);
            Log.Log.Debug("GenPix tuner filter name: {0}", tInfo.achName);
            //check the pin name
            IPin    pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Output, 0);
            PinInfo pInfo;

            pin.QueryPinInfo(out pInfo);
            Log.Log.Debug("GenPix tuner filter pin name: {0}", pInfo.name);
            if (pin != null)
            {
                _propertySet = pin as IKsPropertySet;
                if (_propertySet != null)
                {
                    KSPropertySupport supported;
                    _propertySet.QuerySupported(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                                out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        Log.Log.Debug("GenPix BDA: DVB-S card found!");
                        _isGenPix        = true;
                        _ptrDiseqc       = Marshal.AllocCoTaskMem(1024);
                        _ptrTempInstance = Marshal.AllocCoTaskMem(1024);
                    }
                    else
                    {
                        Log.Log.Debug("GenPix BDA: DVB-S card NOT found!");
                        _isGenPix = false;
                    }
                }
            }
            else
            {
                Log.Log.Info("GenPix BDA: tuner pin not found!");
            }
        }
        protected void SetByteValue(Guid guidPropSet, uint propId, byte byteValue)
        {
            Guid           propertyGuid = guidPropSet;
            IKsPropertySet propertySet  = captureFilter as IKsPropertySet;

            if (propertySet == null)
            {
                //throw new ApplicationException("GetByteValue() properySet=null");
                return;
            }
            uint IsTypeSupported = 0;

            int hr = propertySet.QuerySupported(ref propertyGuid, propId, out IsTypeSupported);

            if (hr != 0 || (IsTypeSupported & (uint)KsPropertySupport.Set) == 0)
            {
                // throw new ApplicationException("SetByteValue() property is not supported");
                return;
            }

            KSPROPERTYByte KsProperty = new KSPROPERTYByte();

            KsProperty.byData = byteValue;
            IntPtr pDataReturned = Marshal.AllocCoTaskMem(100);

            Marshal.StructureToPtr(KsProperty, pDataReturned, false);
            hr = propertySet.RemoteSet(ref propertyGuid,
                                       propId,
                                       pDataReturned,
                                       1,
                                       pDataReturned,
                                       (uint)Marshal.SizeOf(KsProperty));
            Marshal.FreeCoTaskMem(pDataReturned);

            if (hr != 0)
            {
                //throw new ApplicationException("SetByteValue() failed 0x{0:X}", hr);
            }
        }
Exemple #36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericBDAS"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public GenericBDAS(IBaseFilter tunerFilter)
 {
   _TunerDevice = (IBDA_Topology)tunerFilter;
   //check if the BDA driver supports DiSEqC
   IPin pin = DsFindPin.ByName(tunerFilter, "MPEG2 Transport");
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug(FormatMessage("DiSEqC capable card found!"));
         _isGenericBDAS = true;
       }
     }
   }
   else
     Log.Log.Info(FormatMessage("tuner pin not found!"));
 }
Exemple #37
0
        /// <summary>
        /// Initializes a new instance of the ConexantDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        /// <param name="tuner">The tuner.</param>
        internal ConexantDiseqcHandler(IBaseFilter tunerFilter, Tuner tuner)
        {
            if (tuner.Name.ToUpperInvariant().Contains("TBS"))
            {
                return;
            }

            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if ((supported & KSPropertySupport.Set) != 0)
                    {
                        cardCapable = true;
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the ProfRedDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        internal ProfRedDiseqcHandler(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if (reply == 0)
                    {
                        cardCapable = (supported & KSPropertySupport.Get) == KSPropertySupport.Get || (supported & KSPropertySupport.Set) == KSPropertySupport.Set;

                        if (cardCapable)
                        {
                            useSet = (supported & KSPropertySupport.Set) == KSPropertySupport.Set;
                            useGet = !useSet;
                        }
                    }
                }
            }
        }
Exemple #39
0
        public static Guid GetPinCategory(IPin pPin)
        {
            Guid   empty     = Guid.Empty;
            int    cb        = Marshal.SizeOf(typeof(Guid));
            IntPtr pPropData = Marshal.AllocCoTaskMem(cb);

            try
            {
                Guid           pin = PropSetID.Pin;
                IKsPropertySet set = pPin as IKsPropertySet;
                if (set != null)
                {
                    int num3;
                    DsError.ThrowExceptionForHR(set.Get(pin, 0, IntPtr.Zero, 0, pPropData, cb, out num3));
                    empty = (Guid)Marshal.PtrToStructure(pPropData, typeof(Guid));
                }
            }
            finally
            {
                Marshal.FreeCoTaskMem(pPropData);
                pPropData = IntPtr.Zero;
            }
            return(empty);
        }
Exemple #40
0
        /// <summary>
        /// Initializes a new instance of the ProfRedDiseqcHandler class.
        /// </summary>
        /// <param name="tunerFilter">The tuner filter.</param>
        internal ProfRedDiseqcHandler(IBaseFilter tunerFilter)
        {
            IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Input, 0);

            if (pin != null)
            {
                propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    KSPropertySupport supported;
                    reply = propertySet.QuerySupported(bdaTunerExtensionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, out supported);
                    if (reply == 0)
                    {
                        cardCapable = (supported & KSPropertySupport.Get) == KSPropertySupport.Get || (supported & KSPropertySupport.Set) == KSPropertySupport.Set;

                        if (cardCapable)
                        {
                            useSet = (supported & KSPropertySupport.Set) == KSPropertySupport.Set;
                            useGet = !useSet;
                        }
                    }
                }
            }
        }
Exemple #41
0
        private bool checkTwinhanInterface()
        {
            bool success = false;

            IntPtr ptrDwBytesReturned = Marshal.AllocCoTaskMem(4);

            try
            {
                int thbdaLen = 0x28;

                IntPtr thbdaBuf = Marshal.AllocCoTaskMem(thbdaLen);

                try
                {
                    Marshal.WriteInt32(thbdaBuf, 0, 0x255e0082);
                    Marshal.WriteInt16(thbdaBuf, 4, 0x2017);
                    Marshal.WriteInt16(thbdaBuf, 6, 0x4b03);
                    Marshal.WriteByte(thbdaBuf, 8, 0x90);
                    Marshal.WriteByte(thbdaBuf, 9, 0xf8);
                    Marshal.WriteByte(thbdaBuf, 10, 0x85);
                    Marshal.WriteByte(thbdaBuf, 11, 0x6a);
                    Marshal.WriteByte(thbdaBuf, 12, 0x62);
                    Marshal.WriteByte(thbdaBuf, 13, 0xcb);
                    Marshal.WriteByte(thbdaBuf, 14, 0x3d);
                    Marshal.WriteByte(thbdaBuf, 15, 0x67);
                    Marshal.WriteInt32(thbdaBuf, 16, (int)THBDA_IOCTL_CHECK_INTERFACE);     //control code
                    Marshal.WriteInt32(thbdaBuf, 20, (int)IntPtr.Zero);
                    Marshal.WriteInt32(thbdaBuf, 24, 0);
                    Marshal.WriteInt32(thbdaBuf, 28, (int)IntPtr.Zero);
                    Marshal.WriteInt32(thbdaBuf, 32, 0);
                    Marshal.WriteInt32(thbdaBuf, 36, (int)ptrDwBytesReturned);

                    IPin pin = DsFindPin.ByDirection(captureFilter, PinDirection.Input, 0);
                    if (pin != null)
                    {
                        IKsPropertySet propertySet = pin as IKsPropertySet;
                        if (propertySet != null)
                        {
                            reply = propertySet.Set(THBDA_TUNER, 0, thbdaBuf, thbdaLen, thbdaBuf, thbdaLen);
                            if (reply == 0)
                            {
                                success = true;
                            }
                            Marshal.ReleaseComObject(propertySet);
                        }

                        Marshal.ReleaseComObject(pin);
                    }
                }
                finally
                {
                    Marshal.FreeCoTaskMem(thbdaBuf);
                }
            }
            finally
            {
                Marshal.FreeCoTaskMem(ptrDwBytesReturned);
            }

            return(success);
        }
Exemple #42
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Twinhan"/> class.
    /// </summary>
    /// <param name="tunerFilter">The tuner filter.</param>
    public Twinhan(IBaseFilter tunerFilter)
    {
      _ptrPmt = Marshal.AllocCoTaskMem(8192);
      _ptrDwBytesReturned = Marshal.AllocCoTaskMem(4); // int32
      _thbdaBuf = Marshal.AllocCoTaskMem(8192);
      _ptrOutBuffer = Marshal.AllocCoTaskMem(8192);
      _ptrOutBuffer2 = Marshal.AllocCoTaskMem(8192);
      _ptrDiseqc = Marshal.AllocCoTaskMem(8192);
      _ptrMMIBuffer = Marshal.AllocCoTaskMem(8192);
      _captureFilter = tunerFilter;
      _initialized = false;
      _camPresent = false;
      _isTwinHanCard = false;
      if (_captureFilter != null)
      {
        IPin pin = DsFindPin.ByDirection(_captureFilter, PinDirection.Input, 0);
        propertySet = pin as IKsPropertySet;

        _isTwinHanCard = IsTwinhan;
        if (_isTwinHanCard)
        {
          _camPresent = IsCamPresent();
          Log.Log.WriteFile("Twinhan:  CAM detected:{0}", _camPresent);
        }
      }
      _initialized = true;
    }
Exemple #43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenPixBDA"/> class.
 /// </summary>
 /// <param name="tunerFilter">The tuner filter.</param>
 public GenPixBDA(IBaseFilter tunerFilter)
 {
   //check the filter name
   FilterInfo tInfo;
   tunerFilter.QueryFilterInfo(out tInfo);
   Log.Log.Debug("GenPix tuner filter name: {0}", tInfo.achName);
   //check the pin name
   IPin pin = DsFindPin.ByDirection(tunerFilter, PinDirection.Output, 0);
   PinInfo pInfo;
   pin.QueryPinInfo(out pInfo);
   Log.Log.Debug("GenPix tuner filter pin name: {0}", pInfo.name);
   if (pin != null)
   {
     _propertySet = pin as IKsPropertySet;
     if (_propertySet != null)
     {
       KSPropertySupport supported;
       _propertySet.QuerySupported(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC,
                                   out supported);
       if ((supported & KSPropertySupport.Set) != 0)
       {
         Log.Log.Debug("GenPix BDA: DVB-S card found!");
         _isGenPix = true;
         _ptrDiseqc = Marshal.AllocCoTaskMem(1024);
         _ptrTempInstance = Marshal.AllocCoTaskMem(1024);
       }
       else
       {
         Log.Log.Debug("GenPix BDA: DVB-S card NOT found!");
         _isGenPix = false;
       }
     }
   }
   else
     Log.Log.Info("GenPix BDA: tuner pin not found!");
 }