Esempio n. 1
0
 public void PlayStream(string name,ulong flowId,uint streamId, OutFileRTMPFLVStream flvStream)
 {
     if (_flvStream != null) return;
     var flowStream = new FlowWriter(FlowStream.Signature + (char)streamId,this, flowId);
     flowStream.Play(name);
     _flvStream = flvStream;
     _flvStream.SignalAttachedToInStream();
 }
Esempio n. 2
0
        public void PlayStream(string name, ulong flowId, uint streamId, OutFileRTMPFLVStream flvStream)
        {
            if (_flvStream != null)
            {
                return;
            }
            var flowStream = new FlowWriter(FlowStream.Signature + (char)streamId, this, flowId);

            flowStream.Play(name);
            _flvStream = flvStream;
            _flvStream.SignalAttachedToInStream();
        }
Esempio n. 3
0
        public IOutFileStream CreateOutFileStream(BaseProtocol protocol, string name, string filePath, bool append)
        {
            var    meta     = GetMetaData(name, false, protocol.Application.Configuration);
            string fileName = meta[Defines.META_SERVER_MEDIA_DIR];

            fileName += meta[Defines.META_SERVER_FILE_NAME];
            this.Log().Info("fileName: {0}", fileName);
            IOutFileStream pOutFileStream = null;

            switch ((string)meta[Defines.META_MEDIA_TYPE])
            {
            case Defines.MEDIA_TYPE_FLV:
            case Defines.MEDIA_TYPE_LIVE_OR_FLV:
                if (append)
                {
                    //删除原来的辅助文件
                    var seekPath     = meta[Defines.META_SERVER_FULL_PATH] + "." + Defines.MEDIA_TYPE_SEEK;
                    var metaDataPath = meta[Defines.META_SERVER_FULL_PATH] + "." + Defines.MEDIA_TYPE_META;
                    File.Delete(seekPath);
                    File.Delete(metaDataPath);
                }
                pOutFileStream = new OutFileRTMPFLVStream(protocol, Application.StreamsManager, filePath ?? fileName, name)
                {
                    Appending = append
                };
                break;

            case Defines.MEDIA_TYPE_MP4:
                Logger.FATAL("Streaming to MP4 file not supported");
                break;

            default:
                Logger.FATAL("Media type not supported");
                break;
            }

            return(pOutFileStream);
        }
Esempio n. 4
0
 public IOutFileStream CreateOutFileStream(BaseProtocol protocol,string name,string filePath,bool append)
 {
     var meta = GetMetaData(name, false,protocol.Application.Configuration);
     string fileName = meta[Defines.META_SERVER_MEDIA_DIR];
     fileName += meta[Defines.META_SERVER_FILE_NAME];
     this.Log().Info("fileName: {0}", fileName);
     IOutFileStream pOutFileStream = null;
     switch ((string)meta[Defines.META_MEDIA_TYPE])
     {
         case Defines.MEDIA_TYPE_FLV:
         case Defines.MEDIA_TYPE_LIVE_OR_FLV:
             if (append)
             {
                 //删除原来的辅助文件
                 var seekPath = meta[Defines.META_SERVER_FULL_PATH] + "." + Defines.MEDIA_TYPE_SEEK;
                 var metaDataPath = meta[Defines.META_SERVER_FULL_PATH] + "." + Defines.MEDIA_TYPE_META;
                 File.Delete(seekPath);
                 File.Delete(metaDataPath);
             }
             pOutFileStream = new OutFileRTMPFLVStream(protocol, Application.StreamsManager, filePath??fileName, name) { Appending = append };
             break;
         case Defines.MEDIA_TYPE_MP4:
             Logger.FATAL("Streaming to MP4 file not supported");
             break;
         default:
             Logger.FATAL("Media type not supported");
             break;
     }
    
     return pOutFileStream;
 }