private void Config()
        {
            parser = (IDvbSiParser) new DvbSiParser();
            graph  = new BdaGraph();
            graph.InitializeGraph();

/*
 *    // The second pin go to the Mpeg-2 Tables and Sections filter
 *    IPin demuxPin = DsFindPin.ByDirection(graph.mpeg2Demux, PinDirection.Output, 1);
 *    pidMapper = (IMPEG2PIDMap)demuxPin;
 */

            int    hr = 0;
            int    regCookie;
            object mpeg2DataControl;

            IPin mpegPin = DsFindPin.ByDirection(graph.bdaSecTab, PinDirection.Input, 0);

            hr = (graph.networkProvider as IBDA_TIF_REGISTRATION).RegisterTIFEx(mpegPin, out regCookie, out mpeg2DataControl);
            DsError.ThrowExceptionForHR(hr);

            pidMapper = (IMPEG2PIDMap)mpeg2DataControl;

            graph.MakeTuneRequest();
            graph.RunGraph();
        }
Example #2
0
        private void Configure()
        {
            int          hr;
            IFilterGraph gb      = (IFilterGraph) new FilterGraph();
            DsROTEntry   rot     = new DsROTEntry(gb);
            IBaseFilter  pFilter = (IBaseFilter) new MPEG2Demultiplexer();
            AMMediaType  amt     = new AMMediaType();

            amt.majorType = MediaType.Video;
            IPin pPin;

            int [] pid = new int[1];
            pid[0] = 123;

            hr = gb.AddFilter(pFilter, "fdsa");
            DsError.ThrowExceptionForHR(hr);

            IMpeg2Demultiplexer ism = (IMpeg2Demultiplexer)pFilter;

            hr = ism.CreateOutputPin(amt, "Pin1", out pPin);
            DsError.ThrowExceptionForHR(hr);

            IMPEG2PIDMap pmap = pPin as IMPEG2PIDMap;

            //hr = pmap.MapPID(1, pid, MediaSampleContent.ElementaryStream);
            //DsError.ThrowExceptionForHR(hr);
            //hr = pmap.EnumPIDMap(out m_pm);
            DsError.ThrowExceptionForHR(hr);
        }
Example #3
0
        private void Configure()
        {
            int          hr;
            IFilterGraph gb      = (IFilterGraph) new FilterGraph();
            DsROTEntry   rot     = new DsROTEntry(gb);
            IBaseFilter  pFilter = (IBaseFilter) new MPEG2Demultiplexer();
            AMMediaType  amt     = new AMMediaType();
            IPin         pPin;

            hr = gb.AddFilter(pFilter, "fdsa");

            IMpeg2Demultiplexer ism = (IMpeg2Demultiplexer)pFilter;

            hr = ism.CreateOutputPin(amt, "Pin1", out pPin);
            DsError.ThrowExceptionForHR(hr);

            m_ipid = (IMPEG2PIDMap)pPin;
        }
Example #4
0
        private void BuildMosaicGraph(ITuningSpace tuningSpace, ArrayList programs)
        {
            this.graphBuilder = (IFilterGraph2) new FilterGraph();
            rot = new DsROTEntry(this.graphBuilder);

            // Method names should be self explanatory
            AddNetworkProviderFilter(tuningSpace);
            AddMPEG2DemuxFilter();

            AddAndConnectBDABoardFilters();
            AddTransportStreamFiltersToGraph();
            AddRenderers();

            //unsafe
            //{
            IntPtr formatPtr = Marshal.AllocHGlobal(g_Mpeg2ProgramVideo.Length);

            Marshal.Copy(g_Mpeg2ProgramVideo, 0, formatPtr, g_Mpeg2ProgramVideo.Length);

            IMpeg2Demultiplexer mpeg2Demultiplexer = this.mpeg2Demux as IMpeg2Demultiplexer;

            for (int p = 1; p < programs.Count; p++)
            {
                PSI.PSIPMT      pmt    = (PSI.PSIPMT)programs[p];
                PSI.PSIPMT.Data stream = (PSI.PSIPMT.Data)pmt.GetStreamByType(CodeTV.PSI.STREAM_TYPES.STREAMTYPE_13818_VIDEO);

                AMMediaType mediaType = new AMMediaType();
                mediaType.majorType           = MediaType.Video;
                mediaType.subType             = MediaSubType.Mpeg2Video;
                mediaType.fixedSizeSamples    = false;
                mediaType.temporalCompression = false;
                mediaType.sampleSize          = 0;
                mediaType.formatType          = FormatType.Mpeg2Video;
                mediaType.unkPtr = IntPtr.Zero;

                mediaType.formatSize = g_Mpeg2ProgramVideo.Length;
                mediaType.formatPtr  = formatPtr;

                //mediaType.formatType = FormatType.Mpeg2Video;
                //mediaType.formatSize = 0;
                //mediaType.formatPtr = IntPtr.Zero;

                string pinName = "video" + p;
                IPin   outputPin;
                int    hr = mpeg2Demultiplexer.CreateOutputPin(mediaType, pinName, out outputPin);
                if (outputPin != null)
                {
                    IMPEG2PIDMap mpeg2PIDMap = outputPin as IMPEG2PIDMap;
                    if (mpeg2PIDMap != null)
                    {
                        hr = mpeg2PIDMap.MapPID(1, new int[] { stream.Pid }, MediaSampleContent.ElementaryStream);
                    }
                    Marshal.ReleaseComObject(outputPin);
                }
            }
            Marshal.FreeHGlobal(formatPtr);
            //}

            ConfigureVMR9InWindowlessMode(programs.Count);
            ConnectAllOutputFilters();

            int   numberColumn  = 4;
            int   numberRow     = 4;
            float widthPadding  = 0.01f;
            float heightPadding = 0.01f;

            float width  = (1.0f / numberColumn) - 2.0f * widthPadding;
            float height = (1.0f / numberRow) - 2.0f * heightPadding;

            IVMRMixerControl9 vmrMixerControl9 = this.videoRenderer as IVMRMixerControl9;

            for (int p = 1; p < programs.Count; p++)
            {
                int            column, row = Math.DivRem(p - 1, numberColumn, out column);
                NormalizedRect rect = new NormalizedRect();
                rect.left   = (float)column / (float)numberColumn + widthPadding;
                rect.top    = (float)row / (float)numberRow + heightPadding;
                rect.right  = rect.left + width;
                rect.bottom = rect.top + height;
                vmrMixerControl9.SetOutputRect(p, ref rect);
            }
        }