public void StatusChanged(string key, TranscodingStatus status) { if (OnMediaSourceStatusChanged != null) { OnMediaSourceStatusChanged(key, status); } }
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 { } } }); } }
void TranscodingNotifyingService_OnMediaSourceStatusChanged(string key, TranscodingStatus status) { timer1.Stop(); AddTextString("Transcoder reports " + key + " - " + status.ToString()); AddTextString(""); if (status.ToString().Contains("BufferReady")) { AddTextString("Congratulations, the transcoder appears to be working fine!!"); AddTextString(""); TranscoderSuccess = true; timer1.Interval = 100; } if (status.ToString().Contains("Done")) { AddTextString("Congratulations, the transcoder appears to be working fine!!"); AddTextString(""); TranscoderSuccess = true; timer1.Interval = 100; } if (status.ToString().Contains("Error")) { AddTextString("Bad news, the transcoder reported an error. Try a different title (AVI, MPG or MKV are good)!!"); AddTextString(""); TranscoderSuccess = false; timer1.Interval = 100; } timer1.Start(); }
public void StatusChanged(string key, TranscodingStatus status) { Utilities.DebugLine("[TranscodingNotifier] WCF event: StatusChanged: {0}, status={1}", key, status); if (OnMediaSourceStatusChanged != null) { OnMediaSourceStatusChanged(key, status); } }
public TranscodingAPI(MediaSource source, TranscodingStatusChanged action) { Source = source; _Action = action; Status = TranscodingStatus.Unknown; TranscodingNotifyingService.Start(); TranscodingNotifyingService.OnMediaSourceStatusChanged += TranscodingNotifyingService_OnMediaSourceStatusChanged; }
public TranscodingStatus GetStatus(string key) { TranscodingStatus ret = TranscodingStatus.Error; lock (sTranscoders) if (sTranscoders.ContainsKey(key)) { ret = sTranscoders[key].Status; } Utilities.DebugLine("GetStatus: {0}, status={1}", key, ret); return(ret); }
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(); } } }
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 { } } }); } }
void trancoderStatusChanged(MediaSource source, TranscodingStatus status) { Utilities.DebugLine("[TranscodePlayer] Status Changed: {0}, Status: {1}", _source, status); OMLApplication.Current.IsStartingTranscodingJob = true; Application.DeferredInvoke(delegate { switch (status) { case TranscodingStatus.Initializing: OMLApplication.DebugLine("Received Transcoding Status Change: Initializing"); OMLApplication.Current.IsStartingTranscodingJob = true; OMLApplication.Current.TranscodeStatus = @"Initializing"; break; case TranscodingStatus.BufferReady: OMLApplication.DebugLine("Received Transcoding Status Change: Buffer Ready"); OMLApplication.Current.IsStartingTranscodingJob = true; OMLApplication.Current.TranscodeStatus = @"Buffer Ready"; break; case TranscodingStatus.Done: OMLApplication.DebugLine("Received Transcoding Status Change: Done"); OMLApplication.Current.IsStartingTranscodingJob = false; OMLApplication.Current.TranscodeStatus = @"Done"; break; case TranscodingStatus.Error: OMLApplication.DebugLine("Received Transcoding Status Change: Error"); OMLApplication.Current.IsStartingTranscodingJob = false; OMLApplication.Current.TranscodeStatus = @"Error"; break; case TranscodingStatus.Stopped: OMLApplication.DebugLine("Received Transcoding Status Change: Stopped"); OMLApplication.Current.IsStartingTranscodingJob = false; OMLApplication.Current.TranscodeStatus = @"Stopped"; break; default: OMLApplication.DebugLine("Received Transcoding Status Change: Unknown"); break; } }); if (OMLApplication.Current.NowPlayingMovieName == _source.Key && OMLApplication.Current.NowPlayingStatus == PlayState.Playing) { Utilities.DebugLine("[TranscodePlayer] Already started playing: {0}", _source); return; } if (status == TranscodingStatus.Done || status == TranscodingStatus.BufferReady) { Application.DeferredInvoke(delegate { if (AddInHost.Current.MediaCenterEnvironment.PlayMedia(MediaType.Video, transcodedFile, false)) { if (AddInHost.Current.MediaCenterEnvironment.MediaExperience != null) { OMLApplication.Current.IsStartingTranscodingJob = false; Utilities.DebugLine("TranscodePlayer.PlayMovie: movie '{0}', Playing file '{1}'", _source.Name, _source.GetTranscodingFileName()); OMLApplication.Current.NowPlayingMovieName = _source.Key; OMLApplication.Current.NowPlayingStatus = PlayState.Playing; AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.PropertyChanged -= this.Transport_PropertyChanged; AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.PropertyChanged += this.Transport_PropertyChanged; AddInHost.Current.MediaCenterEnvironment.MediaExperience.GoToFullScreen(); } } }); } }
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 StatusChanged(string key, TranscodingStatus status) { Utilities.DebugLine("[TranscodingNotifier] WCF event: StatusChanged: {0}, status={1}", key, status); if (OnMediaSourceStatusChanged != null) OnMediaSourceStatusChanged(key, status); }
public void StatusChanged(string key, TranscodingStatus status) { if (OnMediaSourceStatusChanged != null) OnMediaSourceStatusChanged(key, status); }