Exemple #1
0
        /// <summary>
        /// This method returns the time of the graphs
        /// <see cref="IReferenceClock"/>.
        /// </summary>
        /// <returns>The <see cref="Int64"/> value of the
        /// <see cref="IReferenceClock"/>.</returns>
        public long GetCurrentTime(out int dropped)
        {
            dropped = 0;
            long start = 0;
            long time  = -1;

            if (this.referenceClock != null)
            {
                int hr = this.referenceClock.GetTime(out time);
                DsError.ThrowExceptionForHR(hr);
            }

            IAMDroppedFrames droppedFrames = this.videoStreamConfig as IAMDroppedFrames;

            if (droppedFrames != null)
            {
                int hr = droppedFrames.GetNumDropped(out dropped);
                DsError.ThrowExceptionForHR(hr);
            }

            IGraphConfig graphConfig = this.graphBuilder as IGraphConfig;

            if (graphConfig != null)
            {
                graphConfig.GetStartTime(out start);
            }

            return(time - start);
        }
        public IGraphServiceClient Create(IGraphConfig graphConfig)
        {
            var builder = ConfidentialClientApplicationBuilder
                          .Create(graphConfig.ClientId)
                          .WithClientSecret(graphConfig.ClientSecret)
                          .WithAuthority(graphConfig.Authority);

            var scope = $"{graphConfig.ApiUri}.default";

            if (!string.IsNullOrEmpty(graphConfig.HttpProxyHost) && graphConfig.HttpProxyPort.HasValue)
            {
                // Using proxy
                builder.WithHttpClientFactory(new HttpClientFactoryWithProxy(graphConfig.HttpProxyHost, graphConfig.HttpProxyPort.Value));
                var clientApp    = builder.Build();
                var httpProvider = new HttpProvider(
                    HttpClientFactoryWithProxy.CreateHttpClientHandler(
                        graphConfig.HttpProxyHost, graphConfig.HttpProxyPort.Value),
                    true);
                return(new GraphServiceClient(new ClientCredentialProvider(clientApp, scope), httpProvider));
            }
            else
            {
                var clientApp = builder.Build();
                return(new GraphServiceClient(new ClientCredentialProvider(clientApp, scope)));
            }
        }
        private void Configure()
        {
            m_FilterGraph = (IFilterGraph2) new FilterGraph();
            m_pNero       = FindNero();

            m_igc = (IGraphConfig)m_FilterGraph;
            m_ibf = (IBaseFilter) new SampleGrabber();
        }