Beispiel #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;
     }
 }
Beispiel #2
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;
     }
 }