Exemplo n.º 1
0
        /* // TODO: We need to update this
         * WTV Files Pin Mapping (pin name between ||)
         *  Audio       -> Source Pin |DVR Out - 1| -> PBDA DT Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Video       -> Source Pin |DVR Out - 2| -> PBDA DT Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Subtitle    -> Source Pin |DVR Out - 5| -> PBDA DT Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *
         * DVRMS Files Pin Mapping (pin name between ||)
         *  Audio       -> Source Pin |DVR Out - 1| -> Decrypt/Tag Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Video       -> Source Pin |DVR Out - 3| -> Decrypt/Tag Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Subtitle    -> Source Pin |DVR Out - 2| -> Decrypt/Tag Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         */
        private void ConnectDecryptedDump(string sourceOutPinName, string DumpFileName)
        {
            int         hr;
            Type        comtype;
            IBaseFilter DecryptF;
            IPin        PinOut, PinIn;

            //Create the decrypt filter
            if (_CLSI_Decryptor != MediaType.Null)
            {
                _jobLog.WriteEntry(this, "Connecting Decryption filter", Log.LogEntryType.Debug);
                comtype  = Type.GetTypeFromCLSID(_CLSI_Decryptor);
                DecryptF = (IBaseFilter)Activator.CreateInstance(comtype);
                hr       = _gb.AddFilter((IBaseFilter)DecryptF, "Decrypt" + _gbFiltersCount++.ToString(CultureInfo.InvariantCulture));
                checkHR(hr);

                DecryptF.FindPin("In(Enc/Tag)", out PinIn);     // Get the decrypt filter pinIn |In(Enc/Tag)|
                _SourceF.FindPin(sourceOutPinName, out PinOut); // Get the Source filter pinOut (name taken from sourceOutPinName)

                try
                {
                    // Try to connect the decrypt filter if it is needed
                    hr = _gb.ConnectDirect(PinOut, PinIn, null); // Connect the source filter pinOut to the decrypt filter pinIn
                    checkHR(hr);
                    DecryptF.FindPin("Out", out PinOut);         // Get the Decrypt filter pinOut |Out| (for the next filter to connect to)
                }
                catch
                {
                    // Otherwise go direct
                    _SourceF.FindPin(sourceOutPinName, out PinOut); // Otherwise, go direct and get the source filter pinOut (name taken from sourceOutPinName) for the next filter to connect to
                }
            }
            else
            {
                _SourceF.FindPin(sourceOutPinName, out PinOut);  // Otherwise, go direct and get the source filter pinOut (name taken from sourceOutPinName) for the next filter to connect to
            }
            // Check if we need a Video Subtitle decoder (Line 21) (here use the Microsoft DTV decoder) - the subtitles are embedded in the Video stream

            /*if (UseVideoSubtitleDecoder)
             * {
             *  IBaseFilter SubtitleF;
             *
             *  // TODO: We need to add TEE splitter here and a new DUMP filter here and connect the tee output to the DTV decoder and then Line21 to Dump otherwise we end up with either video or Line21, we want both
             *  _jobLog.WriteEntry(this, "Connecting Video Subtitle Extraction filter", Log.LogEntryType.Debug);
             *  comtype = Type.GetTypeFromCLSID(CLSID_SubtitleDecoder);
             *  SubtitleF = (IBaseFilter)Activator.CreateInstance(comtype);
             *  hr = _gb.AddFilter((IBaseFilter)SubtitleF, "Subtitle" + _gbFilters.Count.ToString(CultureInfo.InvariantCulture));
             *  checkHR(hr);
             *  _gbFilters.Add(SubtitleF); // Keep track of filters to be released afterwards
             *
             *  // Get the subtitle filter pinIn |Video Input|
             *  SubtitleF.FindPin("Video Input", out PinIn);
             *
             *  // Try to connect the subtitle filter pinIn to the previous filter pinOut
             *  hr = _gb.ConnectDirect(PinOut, PinIn, null);
             *  checkHR(hr);
             *  SubtitleF.FindPin("~Line21 Output", out PinOut); // Get the new pinOut |~Line21 Output| from the subtitle filter for the next filter to connect to
             * }*/

            // Create the dump filter
            DumpFilter df = new DumpFilter();

            // Add the filter to the graph
            hr = _gb.AddFilter(df, "Dump" + _gbFiltersCount++.ToString(CultureInfo.InvariantCulture));
            checkHR(hr);

            // Set destination filename
            hr = df.SetFileName(DumpFileName, null);
            checkHR(hr);

            // Connect the dump filter pinIn |Input| to the previous filter pinOut
            _jobLog.WriteEntry(this, "Connecting MCEBuddy DumpStreams filter pins", Log.LogEntryType.Debug);
            hr = df.FindPin("Input", out PinIn);
            checkHR(hr);
            hr = _gb.ConnectDirect(PinOut, PinIn, null);
            checkHR(hr);

            _jobLog.WriteEntry(this, "All filters successfully connected", Log.LogEntryType.Debug);
        }
Exemplo n.º 2
0
        /* // TODO: We need to update this
         * WTV Files Pin Mapping (pin name between ||)
         *  Audio       -> Source Pin |DVR Out - 1| -> PBDA DT Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Video       -> Source Pin |DVR Out - 2| -> PBDA DT Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Subtitle    -> Source Pin |DVR Out - 5| -> PBDA DT Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  
         * DVRMS Files Pin Mapping (pin name between ||)
         *  Audio       -> Source Pin |DVR Out - 1| -> Decrypt/Tag Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Video       -> Source Pin |DVR Out - 3| -> Decrypt/Tag Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         *  Subtitle    -> Source Pin |DVR Out - 2| -> Decrypt/Tag Filter |In(Enc/Tag)| |Out| -> Dump |Input|
         */
        private void ConnectDecryptedDump(string sourceOutPinName, string DumpFileName)
        {
            int hr;
            Type comtype;
            IBaseFilter DecryptF;
            IPin PinOut, PinIn;

            //Create the decrypt filter
            if (_CLSI_Decryptor != MediaType.Null)
            {
                _jobLog.WriteEntry(this, "Connecting Decryption filter", Log.LogEntryType.Debug);
                comtype = Type.GetTypeFromCLSID(_CLSI_Decryptor);
                DecryptF = (IBaseFilter)Activator.CreateInstance(comtype);
                hr = _gb.AddFilter((IBaseFilter)DecryptF, "Decrypt" + _gbFiltersCount++.ToString(System.Globalization.CultureInfo.InvariantCulture));
                checkHR(hr);

                DecryptF.FindPin("In(Enc/Tag)", out PinIn); // Get the decrypt filter pinIn |In(Enc/Tag)|
                _SourceF.FindPin(sourceOutPinName, out PinOut); // Get the Source filter pinOut (name taken from sourceOutPinName)

                try
                {
                    // Try to connect the decrypt filter if it is needed
                    hr = _gb.ConnectDirect(PinOut, PinIn, null); // Connect the source filter pinOut to the decrypt filter pinIn
                    checkHR(hr);
                    DecryptF.FindPin("Out", out PinOut); // Get the Decrypt filter pinOut |Out| (for the next filter to connect to)
                }
                catch
                {
                    // Otherwise go direct
                    _SourceF.FindPin(sourceOutPinName, out PinOut); // Otherwise, go direct and get the source filter pinOut (name taken from sourceOutPinName) for the next filter to connect to
                }
            }
            else
                _SourceF.FindPin(sourceOutPinName, out PinOut);  // Otherwise, go direct and get the source filter pinOut (name taken from sourceOutPinName) for the next filter to connect to

            // Check if we need a Video Subtitle decoder (Line 21) (here use the Microsoft DTV decoder) - the subtitles are embedded in the Video stream
            /*if (UseVideoSubtitleDecoder)
            {
                IBaseFilter SubtitleF;
             
                // TODO: We need to add TEE splitter here and a new DUMP filter here and connect the tee output to the DTV decoder and then Line21 to Dump otherwise we end up with either video or Line21, we want both
                _jobLog.WriteEntry(this, "Connecting Video Subtitle Extraction filter", Log.LogEntryType.Debug);
                comtype = Type.GetTypeFromCLSID(CLSID_SubtitleDecoder);
                SubtitleF = (IBaseFilter)Activator.CreateInstance(comtype);
                hr = _gb.AddFilter((IBaseFilter)SubtitleF, "Subtitle" + _gbFilters.Count.ToString(System.Globalization.CultureInfo.InvariantCulture));
                checkHR(hr);
                _gbFilters.Add(SubtitleF); // Keep track of filters to be released afterwards

                // Get the subtitle filter pinIn |Video Input|
                SubtitleF.FindPin("Video Input", out PinIn);

                // Try to connect the subtitle filter pinIn to the previous filter pinOut
                hr = _gb.ConnectDirect(PinOut, PinIn, null);
                checkHR(hr);
                SubtitleF.FindPin("~Line21 Output", out PinOut); // Get the new pinOut |~Line21 Output| from the subtitle filter for the next filter to connect to
            }*/

            // Create the dump filter
            DumpFilter df = new DumpFilter();

            // Add the filter to the graph
            hr = _gb.AddFilter(df, "Dump" + _gbFiltersCount++.ToString(System.Globalization.CultureInfo.InvariantCulture));
            checkHR(hr);

            // Set destination filename
            hr = df.SetFileName(DumpFileName, null);
            checkHR(hr);

            // Connect the dump filter pinIn |Input| to the previous filter pinOut
            _jobLog.WriteEntry(this, "Connecting MCEBuddy DumpStreams filter pins", Log.LogEntryType.Debug);
            hr = df.FindPin("Input", out PinIn);
            checkHR(hr);
            hr = _gb.ConnectDirect(PinOut, PinIn, null);
            checkHR(hr);
            
            _jobLog.WriteEntry(this, "All filters successfully connected", Log.LogEntryType.Debug);
        }