Example #1
0
 internal static void NotifyAll(string key, TranscodingStatus status)
 {
     Utilities.DebugLine("NotifyAll({0}, {1}) #{2}", key, status, sProxies.Count);
     lock (sProxies)
         foreach (var uri in new List <string>(sProxies.Keys))
         {
             Utilities.DebugLine("NotifyAll({0}, {1}, {2})", uri, key, status);
             ThreadPool.QueueUserWorkItem(delegate
             {
                 var proxyHost = TranscodingNotifyingService.NewTranscodingNotifyingServiceProxy(uri);
                 try
                 {
                     proxyHost.Channel.StatusChanged(key, status);
                 }
                 catch (CommunicationException ex)
                 {
                     lock (sProxies)
                         sProxies.Remove(uri);
                     Utilities.DebugLine("NotifyAll({0}, {1}, {2}) Removing from registration: {3}", proxyHost.Endpoint.Address, key, status, ex.Message);
                 }
                 catch (Exception ex)
                 {
                     Utilities.DebugLine("NotifyAll({0}, {1}, {2}) {3}", proxyHost.Endpoint.Address, key, status, ex);
                 }
                 finally
                 {
                     try
                     {
                         proxyHost.Close();
                     }
                     catch { }
                 }
             });
         }
 }
Example #2
0
        public TranscodingAPI(MediaSource source, TranscodingStatusChanged action)
        {
            Source  = source;
            _Action = action;
            Status  = TranscodingStatus.Unknown;

            TranscodingNotifyingService.Start();
            TranscodingNotifyingService.OnMediaSourceStatusChanged += TranscodingNotifyingService_OnMediaSourceStatusChanged;
        }
Example #3
0
 void TranscodingNotifyingService_OnMediaSourceStatusChanged(string key, TranscodingStatus status)
 {
     Utilities.DebugLine("[TranscodingAPI] MediaSourceStatusChanged [Key: {0}, Status: {1}]", key, status);
     if (Source.Key == key)
     {
         if (Status != status)
         {
             Status = status;
             _Action(Source, status);
         }
         if (IsRunning == false)
         {
             TranscodingNotifyingService.Stop();
         }
     }
 }
Example #4
0
 public void Cancel()
 {
     Utilities.DebugLine("[TranscodingAPI] Cancel", Source);
     using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy())
         host.Channel.Cancel(Source.Key);
 }
Example #5
0
 public bool CreateSymbolicLink(string mpegFile, string vob)
 {
     Utilities.DebugLine("");
     using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy())
         return(host.Channel.CreateSymbolicLink(mpegFile, vob));
 }
Example #6
0
 public string MakeMPEGLink(string mpegFolder, string vob)
 {
     Utilities.DebugLine("[TranscodingAPI] MakeMPEGLink", mpegFolder, vob);
     using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy())
         return(host.Channel.MakeMPEGLink(mpegFolder, vob));
 }
Example #7
0
 public void Transcode()
 {
     Utilities.DebugLine("[TranscodingAPI] Transcode", Source);
     using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy())
         host.Channel.Transcode(Source, Environment.UserName);
 }