Exemplo n.º 1
0
 public XdcamStream(XdcamMedia media, bool forWrite)
 {
     if (!(media?.Directory is IngestDirectory dir))
     {
         throw new ApplicationException("XDCAM media directory is not IngestDirectory");
     }
     //var fileName = string.Join(media.Directory.PathSeparator.ToString(), media.Directory.Folder, "Clip",  $"{media.XdcamClipAlias?.clipId ?? media.XdcamClip.clipId}.MXF");
     _client = dir.GetFtpClient();
     if (!Monitor.TryEnter(dir.XdcamLockObject))
     {
         throw new ApplicationException("Directory is in use");
     }
     try
     {
         _client.Connect();
         if (media.XdcamMaterial.type == MaterialType.Edl)
         {
             var smilXml = dir.ReadXmlDocument(media.XdcamMaterial.uri, _client);
             if (smilXml != null)
             {
                 _smil = SerializationHelper <Smil> .Deserialize(smilXml);
             }
             _isEditList = true;
         }
         _smilIndex = 0;
         _media     = media;
         if (_isEditList)
         {
             _currentStream = _getNextStream();
         }
         else
         {
             _currentStream = forWrite ? _client.OpenWrite($"Clip/{media.FileName}") : _client.OpenRead(media.XdcamMaterial.uri);
         }
     }
     catch
     {
         Monitor.Exit(dir.XdcamLockObject);
         _client.Disconnect();
         throw;
     }
 }
Exemplo n.º 2
0
 public XdcamStream(XdcamMedia media, bool forWrite)
 {
     if (!(media?.Directory is IngestDirectory dir))
     {
         throw new ApplicationException("XDCAM media directory is not IngestDirectory");
     }
     //var fileName = string.Join(media.Directory.PathSeparator.ToString(), media.Directory.Folder, "Clip",  $"{media.XdcamClipAlias?.clipId ?? media.XdcamClip.clipId}.MXF");
     _client = dir.GetFtpClient();
     if (!Monitor.TryEnter(dir.XdcamLockObject))
     {
         throw new ApplicationException("Directory is in use");
     }
     try
     {
         _client.Connect();
         _smilIndex  = 0;
         _media      = media;
         _isEditList = media.XdcamEdl != null;
         if (_isEditList)
         {
             _currentStream = _getNextStream();
         }
         else
         {
             if (forWrite)
             {
                 _currentStream = _client.OpenWrite($"/Clip/{media.FileName}");
             }
             else
             {
                 string fileName = string.Join("/", "/Clip", $"{(media.XdcamAlias != null ? media.XdcamAlias.value : media.XdcamClip.clipId)}.MXF");
                 _currentStream = _client.OpenRead(fileName);
             }
         }
     }
     catch
     {
         _client.Disconnect();
     }
 }
Exemplo n.º 3
0
 public XdcamStream(XdcamMedia media, bool forWrite)
 {
     _directory = media?.Directory as IngestDirectory ?? throw new ApplicationException("XDCAM media directory is not IngestDirectory");
     _client    = _directory.GetFtpClient();
     if (!Monitor.TryEnter(_directory.XdcamLockObject))
     {
         throw new ApplicationException("Directory is in use");
     }
     try
     {
         _client.Connect();
         if (media.XdcamMaterial?.type == MaterialType.Edl)
         {
             var smilXml = _directory.ReadXmlDocument(media.XdcamMaterial.uri, _client);
             if (smilXml != null)
             {
                 _smil = SerializationHelper <Smil> .Deserialize(smilXml);
             }
             _isEditList = true;
         }
         _smilIndex = 0;
         _media     = media;
         if (_isEditList)
         {
             _currentStream = _getNextStream();
         }
         else
         {
             _currentStream = forWrite ? _client.OpenWrite($"Clip/{media.FileName}") : _client.OpenRead(media.XdcamMaterial.uri.TrimStart('.', '/'));
         }
     }
     catch
     {
         Monitor.Exit(_directory.XdcamLockObject);
         _client.Disconnect();
         throw;
     }
 }