Esempio n. 1
0
        public override BaseProtocol SpawnProtocol(ulong type, Variant parameters)
        {
            BaseProtocol pResult = null;

            switch (type)
            {
            case ProtocolTypes.PT_TCP:
                pResult = new TCPProtocol();
                break;

            case ProtocolTypes.PT_UDP:
                pResult = new UDPProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_SSL:
                pResult = new InboundSSLProtocol();
                break;

            case ProtocolTypes.PT_OUTBOUND_SSL:
                pResult = new OutboundSSLProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_RTMP:
                pResult = new InboundRTMPProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_RTMPS_DISC:
                break;

            case ProtocolTypes.PT_OUTBOUND_RTMP:
                pResult = new OutboundRTMPProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_RTMFP:
                pResult = new InboundRTMFPProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_CLUSTER:
                pResult = new InboundClusterProtocol();
                break;

            case ProtocolTypes.PT_OUTBOUND_CLUSTER:
                pResult = new OutboundClusterProtocol();
                break;

            case ProtocolTypes.PT_RTSP:
                pResult = new RtspProtocol();
                break;

            case ProtocolTypes.PT_RTP_NAT_TRAVERSAL:
                pResult = new NATTraversalProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_RTP:
                pResult = new InboundRtpProtocol();
                break;

            case ProtocolTypes.PT_RTCP:
                pResult = new RtcpProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_WEBSOCKET:
                pResult = new WebSocketProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_WEBRTC_SIGNAL:
                pResult = new WebRtcSignalProtocol();
                break;

            case ProtocolTypes.PT_INBOUND_MP4:
                pResult = new Mp4Protocol();
                break;

            default:
                Logger.FATAL("Spawning protocol {0} not yet implemented",
                             type.TagToString());
                break;
            }
            if (pResult != null)
            {
                if (!pResult.Initialize(parameters))
                {
                    Logger.FATAL("Unable to initialize protocol {0}",
                                 type.TagToString());

                    pResult = null;
                }
            }
            return(pResult);
        }
        public override BaseProtocol SpawnProtocol(ulong type, Variant parameters)
        {
            BaseProtocol pResult = null;
            switch (type)
            {
                case ProtocolTypes.PT_TCP:
                    pResult = new TCPProtocol();
                    break;
                case ProtocolTypes.PT_UDP:
                    pResult = new UDPProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_SSL:
                    pResult = new InboundSSLProtocol();
                    break;
                case ProtocolTypes.PT_OUTBOUND_SSL:
                    pResult = new OutboundSSLProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_RTMP:
                    pResult = new InboundRTMPProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_RTMPS_DISC:
                    break;
                case ProtocolTypes.PT_OUTBOUND_RTMP:
                    pResult = new OutboundRTMPProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_RTMFP:
                    pResult = new InboundRTMFPProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_CLUSTER:
                    pResult = new InboundClusterProtocol();
                    break;
                case ProtocolTypes.PT_OUTBOUND_CLUSTER:
                    pResult = new OutboundClusterProtocol();
                    break;
                case ProtocolTypes.PT_RTSP:
                    pResult = new RtspProtocol();
                    break;
                case ProtocolTypes.PT_RTP_NAT_TRAVERSAL:
                    pResult = new NATTraversalProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_RTP:
                    pResult = new InboundRtpProtocol();
                    break;
                case ProtocolTypes.PT_RTCP:
                    pResult = new RtcpProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_WEBSOCKET:
                    pResult = new WebSocketProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_WEBRTC_SIGNAL:
                    pResult = new WebRtcSignalProtocol();
                    break;
                case ProtocolTypes.PT_INBOUND_MP4:
                    pResult = new Mp4Protocol();
                    break;
                default:
                    Logger.FATAL("Spawning protocol {0} not yet implemented",
                        type.TagToString());
                    break;
            }
            if (pResult != null)
            {
                if (!pResult.Initialize(parameters))
                {
                    Logger.FATAL("Unable to initialize protocol {0}",
                            type.TagToString());

                    pResult = null;
                }
            }
            return pResult;
        }