コード例 #1
0
        private void m_btnStartStreaming_Click(object sender, EventArgs e)
        {
            m_bSupportSoftwareEncoder = m_checkSoftwareEncoder.Checked;

            m_bSupportHardwareEncoder = m_checkHardwareEncoder.Checked;

            m_bSupportIntelGPUEncoder = m_checkIntelGPUEncoder.Checked;

            // CREATE RTSP SERVER
            //
            String strAccount = "root";

            String strPassword = "******";

            EXPORTS.QCAP_CREATE_BROADCAST_RTSP_SERVER(0, 4, ref m_hRtspCapDev, ref strAccount, ref strPassword, 554);

            if (m_bSupportSoftwareEncoder)
            {
                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));
            }

            if (m_bSupportHardwareEncoder)
            {
                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_HARDWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_HARDWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_HARDWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_HARDWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));
            }

            if (m_bSupportIntelGPUEncoder)
            {
                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'V', '1', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 12582912, 30, 0, 0, 0, 0, 0, (uint)(EXPORTS.BroadCastFlagEnum.QCAP_BROADCAST_FLAG_FULL));
            }

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            if (m_hRtspCapDev != 0)
            {
                m_pMainForm.m_pMainForm.m_bIsStreaming = true;

                m_pMainForm.m_pMainForm.m_hRtspCapDev = m_hRtspCapDev;
            }

            EXPORTS.QCAP_START_BROADCAST_SERVER(m_hRtspCapDev);

            //CRITICAL SECTION



            if (m_hRtspCapDev != 0)
            {
                // STOP RTSP STREAMING
                //
                EXPORTS.QCAP_STOP_BROADCAST_SERVER(m_hRtspCapDev);

                EXPORTS.QCAP_DESTROY_BROADCAST_SERVER(m_hRtspCapDev);
            }

            m_btnStartStreaming.Enabled = true;

            m_btnStopStreaming.Enabled = false;
        }
コード例 #2
0
        private void m_btnStartStreaming_Click(object sender, EventArgs e)
        {
            m_bSupportGPU = m_checkRtspGPU.Checked;

            // CREATE RTSP SERVER
            //
            String strAccount = "root";

            String strPassword = "******";

            EXPORTS.QCAP_CREATE_BROADCAST_RTSP_SERVER(0, 4, ref m_hRtspCapDev, ref strAccount, ref strPassword, 554);

            if (m_bSupportGPU)
            {
                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_INTEL_MEDIA_SDK, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);
            }
            else
            {
                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);

                EXPORTS.QCAP_SET_VIDEO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.VideoEncoderFormatEnum.QCAP_ENCODER_FORMAT_H264, MAKEFOURCC('Y', 'U', 'Y', '2'), m_nVideoWidth / 2, m_nVideoHeight / 2, m_dVideoFrameRate, (uint)EXPORTS.RecordModeEnum.QCAP_RECORD_MODE_CBR, 8000, 4 * 1024 * 1024, 30, 0, 0);
            }

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 0, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 1, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 2, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            EXPORTS.QCAP_SET_AUDIO_BROADCAST_SERVER_PROPERTY(m_hRtspCapDev, 3, (uint)EXPORTS.EncoderTypeEnum.QCAP_ENCODER_TYPE_SOFTWARE, (uint)EXPORTS.AudioEncoderFormatEnum.QCAP_ENCODER_FORMAT_PCM, 2, 16, 48000);

            if (m_hRtspCapDev != 0)
            {
                m_pMainForm.m_pMainForm.m_bIsStreaming = true;

                m_pMainForm.m_pMainForm.m_hRtspCapDev = m_hRtspCapDev;
            }

            EXPORTS.QCAP_START_BROADCAST_SERVER(m_hRtspCapDev);

            //CRITICAL SECTION

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_v0)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_v[0] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_a0)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_a[0] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_v1)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_v[1] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_a1)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_a[1] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_v2)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_v[2] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_a2)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_a[2] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_v3)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_v[3] = 0x00000001;
            }

            lock (m_pMainForm.m_pMainForm.m_hNetworkServerAccessCriticalSection_a3)
            {
                m_pMainForm.m_pMainForm.m_nNetworkServerState_a[3] = 0x00000001;
            }

            m_btnStartStreaming.Enabled = false;

            m_btnStopStreaming.Enabled = true;
        }