Example #1
0
 protected BaseOutStream(T pProtocol, StreamsManager pStreamsManager, string name) : base(pProtocol, pStreamsManager, name)
 {
     if (!Type.TagKindOf(StreamTypes.ST_OUT))
     {
         Logger.ASSERT("Incorrect stream type. Wanted a stream type in class {0} and got {1}", StreamTypes.ST_OUT.TagToString(), Type.TagToString());
     }
 }
Example #2
0
 protected BaseStream(T pProtocol, StreamsManager pStreamsManager, string name)
 {
     _pStreamsManager = pStreamsManager;
     UniqueId         = _pStreamsManager.GenerateUniqueId();
     Protocol         = pProtocol;
     Name             = name;
     Type             = GetType().GetCustomAttribute <StreamTypeAttribute>(true).Type;
     pStreamsManager.RegisterStream(this);
     CreationTimestamp = DateTime.Now.Ticks;
 }
 public OutNetRTMP4TSStream(BaseRTMPProtocol pProtocol, StreamsManager pStreamsManager, string name, uint rtmpStreamId, uint chunkSize) : base(pProtocol, pStreamsManager, name, rtmpStreamId, chunkSize)
 {
     _pSPSPPS[0] = 0x17; //0x10 - key frame; 0x07 - H264_CODEC_ID
     _pSPSPPS[1] = 0; //0: AVC sequence header; 1: AVC NALU; 2: AVC end of sequence
     _pSPSPPS[2] = 0; //CompositionTime
     _pSPSPPS[3] = 0; //CompositionTime
     _pSPSPPS[4] = 0; //CompositionTime
     _pSPSPPS[5] = 1; //version
     _pSPSPPS[9] = 0xff; //6 bits reserved (111111) + 2 bits nal size length - 1 (11)
     _pSPSPPS[10] = 0xe1; //3 bits reserved (111) + 5 bits number of sps (00001)
 }
 protected BaseInFileStream(BaseProtocol pProtocol, StreamsManager pStreamsManager, string name)
     : base(pProtocol, pStreamsManager, name)
 {
     if (!Type.TagKindOf(StreamTypes.ST_IN_FILE))
     {
         Logger.ASSERT("Incorrect stream type. Wanted a stream type in class {0} and got {1}", StreamTypes.ST_IN_FILE.TagToString(), Type.TagToString());
     }
     Paused = true;
     _audioVideoCodecsSent = false;
     Capabilities.Clear();
     _playLimit = -1;
 }
        public OutNetRTPUDPH264Stream(RtspProtocol pProtocol, StreamsManager pStreamsManager, string name, bool forceTcp) : base(pProtocol, pStreamsManager, name)
        {
            _forceTcp = forceTcp;
            _maxRTPPacketSize = _forceTcp ? 1500 : MAX_RTP_PACKET_SIZE;
            _videoData = new MsgHdr { Buffers = new[] { new byte[14],new byte[0],  } };
            _videoData.Buffers[0][0] = 0x80;
            _videoData.Buffers[0].Write(8,VideoSSRC);
            _audioData = new MsgHdr { Buffers = new[] { new byte[14],new byte[16], null } };
            _audioData.Buffers[0][0] = 0x80;
            _audioData.Buffers[0][1] = 0xe0;
            _audioData.Buffers[0].Write(8, AudioSSRC);

        }
        public static InFileRTMPStream GetInstance(BaseProtocol pRTMPProtocol, StreamsManager pStreamsManager,
            Variant metadata)
        {
            metadata[META_RTMP_META,HTTP_HEADERS_SERVER]= HTTP_HEADERS_SERVER_US;
	        if (!File.Exists(metadata[META_SERVER_FULL_PATH])) {
		        WARN("File not found. fullPath: `{0}`",metadata[META_SERVER_FULL_PATH]);
		        return null;
	        }
	        InFileRTMPStream pResult = null;
	        switch ((string)metadata[META_MEDIA_TYPE])
	        {
	            case MEDIA_TYPE_FLV:
	            case MEDIA_TYPE_LIVE_OR_FLV:
	            case MEDIA_TYPE_MP3:
	            case MEDIA_TYPE_MP4:
	            case MEDIA_TYPE_M4A:
	            case MEDIA_TYPE_M4V:
	            case MEDIA_TYPE_MOV:
	                pResult = new InFileRTMPStream(pRTMPProtocol,
	                    pStreamsManager,metadata[META_SERVER_FULL_PATH]);
	                break;
	            default:
	                FATAL("File type not supported yet. Metadata:\n{0}",
	                    metadata);
	                break;
	        }

	        if (pResult != null) {
		        pResult.CompleteMetadata = metadata;
	        }

	        return pResult;
        }
 public InFileRTMPStream(BaseProtocol pProtocol, StreamsManager pStreamsManager, string name) : base(pProtocol, pStreamsManager, name)
 {
     
     base.ChunkSize = 4 * 1024 * 1024;
 }
Example #8
0
 protected BaseInStream(T pProtocol, StreamsManager pStreamsManager, string name)
     : base(pProtocol, pStreamsManager, name)
 {
     OutStreams = new HashSet <IOutStream>();
 }
 public OutNetRTMP4RTMPStream(BaseRTMPProtocol pProtocol, StreamsManager pStreamsManager, string name, uint rtmpStreamId, uint chunkSize)
     : base(pProtocol, pStreamsManager, name, rtmpStreamId, chunkSize)
 {
 }