コード例 #1
0
 private async void m_Thumbnail_mChangeState(bool isEnable)
 {
     if (isEnable)
     {
         await mSwitcherControl.resumeSwitchersAsync(mISession);
     }
     else
     {
         await mSwitcherControl.pauseSwitchersAsync(mISession);
     }
 }
コード例 #2
0
        private async void m_StartBtn_Click(object sender, RoutedEventArgs e)
        {
            if (mState == State.Paused && mISession != null)
            {
                await mSwitcherControl.resumeSwitchersAsync(mISession);

                mState = State.Started;

                m_PauseBtn.IsEnabled = true;

                m_StopBtn.IsEnabled = true;

                m_StartStopBtn.IsEnabled = false;

                return;
            }

            mVideoSwitcherNode = null;

            mAudioSwitcherNode = null;

            object RenderNode = null;


            List <object> lRenderOutputNodesList = await mEVRMultiSinkFactory.createOutputNodesAsync(
                IntPtr.Zero,
                m_EVRDisplay.Surface.texture,
                1);

            if (lRenderOutputNodesList.Count == 1)
            {
                RenderNode = lRenderOutputNodesList[0];
            }

            List <object> lSourceNodes = new List <object>();

            if ((bool)m_VideoStreamChkBtn.IsChecked)
            {
                mVideoSwitcherNode = await createSwitcher(null);

                if (mVideoSwitcherNode == null)
                {
                    return;
                }

                object lSourceNode = await getSourceNode(
                    m_VideoSourceComboBox.SelectedItem as XmlNode,
                    m_VideoStreamComboBox.SelectedItem as XmlNode,
                    m_VideoSourceMediaTypeComboBox.SelectedItem as XmlNode,
                    m_VideoEncodersComboBox.SelectedItem as XmlNode,
                    m_VideoEncodingModeComboBox.SelectedItem as XmlNode,
                    m_VideoCompressedMediaTypesComboBox.SelectedIndex,
                    RenderNode,
                    mVideoSwitcherNode);

                if (lSourceNodes != null && lSourceNode != null)
                {
                    lSourceNodes.Add(lSourceNode);
                }
                else
                {
                    mVideoSwitcherNode = null;
                }
            }

            if ((bool)m_AudioStreamChkBtn.IsChecked)
            {
                mAudioSwitcherNode = await createSwitcher(null);

                if (mAudioSwitcherNode == null)
                {
                    return;
                }

                object lSourceNode = await getSourceNode(
                    m_AudioSourceComboBox.SelectedItem as XmlNode,
                    m_AudioStreamComboBox.SelectedItem as XmlNode,
                    m_AudioSourceMediaTypeComboBox.SelectedItem as XmlNode,
                    m_AudioEncodersComboBox.SelectedItem as XmlNode,
                    m_AudioEncodingModeComboBox.SelectedItem as XmlNode,
                    m_AudioCompressedMediaTypesComboBox.SelectedIndex,
                    null,
                    mAudioSwitcherNode);

                if (lSourceNodes != null && lSourceNode != null)
                {
                    lSourceNodes.Add(lSourceNode);
                }
                else
                {
                    mAudioSwitcherNode = null;
                }
            }

            mISession = await mISessionControl.createSessionAsync(lSourceNodes.ToArray());

            if (mISession == null)
            {
                return;
            }

            if (await mISession.startSessionAsync(0, Guid.Empty))
            {
                mState = State.Started;

                mRecordingState = State.Paused;

                mStateLabel.Visibility = System.Windows.Visibility.Collapsed;

                m_PauseBtn.IsEnabled = true;

                m_StopBtn.IsEnabled = true;

                m_StartStopBtn.IsEnabled = false;

                mSourceGrid.IsEnabled = false;
            }
        }
コード例 #3
0
        private async void m_StartBtn_Click(object sender, RoutedEventArgs e)
        {
            if (mState == State.Paused && mISession != null)
            {
                await mSwitcherControl.resumeSwitchersAsync(mISession);

                mState = State.Started;

                m_PauseBtn.IsEnabled = true;

                m_StopBtn.IsEnabled = true;

                m_StartStopBtn.IsEnabled = false;

                return;
            }


            List <object> lCompressedMediaTypeList = new List <object>();


            object lCompressedMediaType = await getCompressedMediaType(
                m_VideoSourceComboBox.SelectedItem as XmlNode,
                m_VideoStreamComboBox.SelectedItem as XmlNode,
                m_VideoSourceMediaTypeComboBox.SelectedItem as XmlNode,
                m_VideoEncodersComboBox.SelectedItem as XmlNode,
                m_VideoEncodingModeComboBox.SelectedItem as XmlNode,
                m_VideoCompressedMediaTypesComboBox.SelectedIndex);

            if (lCompressedMediaType != null)
            {
                lCompressedMediaTypeList.Add(lCompressedMediaType);
            }

            List <object> lOutputNodes = await getOutputNodes(lCompressedMediaTypeList);

            if (lOutputNodes == null || lOutputNodes.Count == 0)
            {
                return;
            }

            int lOutputIndex = 0;

            List <object> lSourceNodes = new List <object>();


            object RenderNode = null;


            List <object> lRenderOutputNodesList = new List <object>();

            if (mEVRMultiSinkFactory != null)
            {
                lRenderOutputNodesList = await mEVRMultiSinkFactory.createOutputNodesAsync(
                    IntPtr.Zero,
                    m_EVRDisplay.Surface.texture,
                    1);
            }

            if (lRenderOutputNodesList.Count == 1)
            {
                RenderNode = lRenderOutputNodesList[0];
            }

            object lEncoderNode = await getEncoder(
                m_VideoSourceComboBox.SelectedItem as XmlNode,
                m_VideoStreamComboBox.SelectedItem as XmlNode,
                m_VideoSourceMediaTypeComboBox.SelectedItem as XmlNode,
                m_VideoEncodersComboBox.SelectedItem as XmlNode,
                m_VideoEncodingModeComboBox.SelectedItem as XmlNode,
                m_VideoCompressedMediaTypesComboBox.SelectedIndex,
                lOutputNodes[lOutputIndex++]);

            if (lEncoderNode == null)
            {
                return;
            }

            object lSwitcherNode = await getSwitcher(lEncoderNode);

            if (lSwitcherNode == null)
            {
                return;
            }

            object lSourceNode = await getSourceNode(
                m_VideoSourceComboBox.SelectedItem as XmlNode,
                m_VideoStreamComboBox.SelectedItem as XmlNode,
                m_VideoSourceMediaTypeComboBox.SelectedItem as XmlNode,
                m_VideoEncodersComboBox.SelectedItem as XmlNode,
                m_VideoEncodingModeComboBox.SelectedItem as XmlNode,
                m_VideoCompressedMediaTypesComboBox.SelectedIndex,
                RenderNode,
                lSwitcherNode);

            if (lSourceNodes != null)
            {
                lSourceNodes.Add(lSourceNode);
            }

            mISession = await mISessionControl.createSessionAsync(lSourceNodes.ToArray());

            if (mISession == null)
            {
                return;
            }

            await mSwitcherControl.pauseSwitchersAsync(mISession);

            if (await mISession.startSessionAsync(0, Guid.Empty))
            {
                mState = State.Started;

                mRecordingState = State.Paused;

                mStateLabel.Visibility = System.Windows.Visibility.Collapsed;

                m_PauseBtn.IsEnabled = true;

                m_StopBtn.IsEnabled = true;

                m_StartStopBtn.IsEnabled = false;
            }
        }