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 { } } }); } }
public TranscodingAPI(MediaSource source, TranscodingStatusChanged action) { Source = source; _Action = action; Status = TranscodingStatus.Unknown; TranscodingNotifyingService.Start(); TranscodingNotifyingService.OnMediaSourceStatusChanged += TranscodingNotifyingService_OnMediaSourceStatusChanged; }
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(); } } }
public void Cancel() { Utilities.DebugLine("[TranscodingAPI] Cancel", Source); using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy()) host.Channel.Cancel(Source.Key); }
public bool CreateSymbolicLink(string mpegFile, string vob) { Utilities.DebugLine(""); using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy()) return(host.Channel.CreateSymbolicLink(mpegFile, vob)); }
public string MakeMPEGLink(string mpegFolder, string vob) { Utilities.DebugLine("[TranscodingAPI] MakeMPEGLink", mpegFolder, vob); using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy()) return(host.Channel.MakeMPEGLink(mpegFolder, vob)); }
public void Transcode() { Utilities.DebugLine("[TranscodingAPI] Transcode", Source); using (var host = TranscodingNotifyingService.NewTranscodingServiceProxy()) host.Channel.Transcode(Source, Environment.UserName); }