protected void SetImageToGui(string imageFilePath) { if (string.IsNullOrEmpty(imageFilePath)) { return; } string texture = GetTextureFromFile(imageFilePath); if (GUITextureManager.LoadFromMemory(ImageFast.FromFile(imageFilePath), texture, 0, 0, 0) > 0) { ThumbnailImage = texture; IconImage = texture; IconImageBig = texture; } // if selected and GUIActors is current window force an update of thumbnail GUIActors actorWindow = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow) as GUIActors; if (actorWindow != null) { GUIListItem selectedItem = GUIControl.GetSelectedListItem(9816, 50); if (selectedItem == this) { GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, GUIWindowManager.ActiveWindow, 0, 50, ItemId, 0, null)); } } }
/// <summary> /// CUE Track End Procedure /// </summary> /// <param name="handle"></param> /// <param name="stream"></param> /// <param name="data"></param> /// <param name="userData"></param> private void CueTrackEndProc(int handle, int stream, int data, IntPtr userData) { new Thread(() => { Log.Debug("BASS: CueTrackEndProc of stream {0}", stream); if (Config.CrossFadeIntervalMs > 0) { // Only sent GUI_MSG_PLAYBACK_CROSSFADING when gapless/crossfading mode is used GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_CROSSFADING, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); } bool removed = Bass.BASS_ChannelRemoveSync(stream, handle); if (removed) { Log.Debug("BassAudio: *** BASS_ChannelRemoveSync in CueTrackEndProc"); } } ) { Name = "BASS CueEnd" }.Start(); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { GUIGraphicsContext.ResetLastActivity(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GETFOCUS, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); string windowID = processed[0]; int window = (int)GUIWindow.Window.WINDOW_INVALID; try { window = (int)Enum.Parse(typeof(GUIWindow.Window), "WINDOW_" + windowID, true); } catch (ArgumentException) { // Parsing the window id as a GUIWindow.Window failed, so parse it as an int } if (window == (int)GUIWindow.Window.WINDOW_INVALID) { int.TryParse(windowID, out window); } if (window == (int)GUIWindow.Window.WINDOW_INVALID) { throw new CommandStructureException(String.Format("Failed to parse Goto screen command window id \"{0}\"", windowID)); } GUIGraphicsContext.ResetLastActivity(); GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, window, 0, null)); }
/// <summary> /// Fade Out Procedure /// </summary> /// <param name="handle"></param> /// <param name="stream"></param> /// <param name="data"></param> /// <param name="userData"></param> private void PlaybackCrossFadeProc(int handle, int stream, int data, IntPtr userData) { new Thread(() => { try { Log.Debug("BASS: X-Fading out stream {0}", _filePath); if (Config.CrossFadeIntervalMs > 0) { // Only sent GUI_MSG_PLAYBACK_CROSSFADING when gapless/crossfading mode is used GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_CROSSFADING, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); } // We want to get informed, when Crossfading has ended _playBackSlideEndDelegate = new SYNCPROC(SlideEndedProc); Bass.BASS_ChannelSetSync(stream, BASSSync.BASS_SYNC_SLIDE, 0, _playBackSlideEndDelegate, IntPtr.Zero); _crossFading = true; Bass.BASS_ChannelSlideAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, 0, Config.CrossFadeIntervalMs); } catch (AccessViolationException) { Log.Error("BASS: Caught AccessViolationException in Crossfade Proc"); } } ) { Name = "BASS X-Fade" }.Start(); }
/* The following code was referenced from the Moving Pictures plugin */ static void suspendMP(bool suspend) { if (suspend) //suspend and hide MediaPortal { Logger.LogDebug("Suspending MediaPortal..."); // disable mediaportal input devices InputDevices.Stop(); // hide mediaportal and suspend rendering to save resources for the pc game GUIGraphicsContext.BlankScreen = true; GUIGraphicsContext.form.Hide(); GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.SUSPENDING; } else //resume Mediaportal { Logger.LogDebug("Resuming MediaPortal..."); InputDevices.Init(); // Resume Mediaportal rendering GUIGraphicsContext.BlankScreen = false; GUIGraphicsContext.form.Show(); GUIGraphicsContext.ResetLastActivity(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GETFOCUS, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.RUNNING; } }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { bool mpBasicHome = false; using (Settings xmlreader = new Settings(MPCommon.MPConfigFile)) mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false); GUIGraphicsContext.ResetLastActivity(); // Stop all media before suspending g_Player.Stop(); GUIMessage msg; if (mpBasicHome) { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_SECOND_HOME, 0, null); } else { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_HOME, 0, null); } GUIWindowManager.SendThreadMessage(msg); WindowsController.ExitWindows(RestartOptions.Suspend, false); }
/// <summary> /// Playback end Procedure /// </summary> /// <param name="handle"></param> /// <param name="stream"></param> /// <param name="data"></param> /// <param name="userData"></param> private void PlaybackEndProc(int handle, int stream, int data, IntPtr userData) { new Thread(() => { Log.Debug("BASS: End of stream {0}", _filePath); _crossFading = false; // The Playlist Player waits on a Crossfading message to play the next song. // So if X-fading is set to 0, we must send the message in order to start playback of the next // file. if (Config.CrossFadeIntervalMs == 0) { // Only sent GUI_MSG_PLAYBACK_CROSSFADING when gapless/crossfading mode is used GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_CROSSFADING, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); } if (MusicStreamMessage != null) { MusicStreamMessage(this, StreamAction.Ended); } } ) { Name = "BASS SongEnd" }.Start(); }
public void Show(int dwParentId) { m_dwParentWindowID = dwParentId; m_pParentWindow = GUIWindowManager.GetWindow(m_dwParentWindowID); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, GetID, 0, null); GUIWindowManager.SendThreadMessage(msg); }
/// <summary> /// Open a window (for example Moving Pictures, MP-TV Series, etc.), /// invoke on GUI thread if called from a different /// thread than UI thread /// </summary> /// <param name="windowId"></param> public static void OpenWindow(int windowId) { if (GUIGraphicsContext.form.InvokeRequired) { OpenWindowDelegate d = OpenWindow; GUIGraphicsContext.form.Invoke(d, new object[] { windowId }); } else { GUIGraphicsContext.ResetLastActivity(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, windowId, 0, null); GUIWindowManager.SendThreadMessage(msg); } }
/// <summary> /// Sends a Thread message to select an item on a facade object. Will only send if itemid parameter is currently selected /// </summary> /// <param name="self">the list object</param> /// <param name="windowId">the window id containing list control</param> /// <param name="index">the item id in list to check if selected</param> /// <param name="controlId">the id of the list control, defaults to 50</param> public static void UpdateItemIfSelected(this GUIListItem self, int windowId, int index, int controlId = 50) { if (GUIWindowManager.ActiveWindow != windowId) { return; } GUIListItem selectedItem = GUIControl.GetSelectedListItem(windowId, controlId); // only send message if the current item is selected if (selectedItem == self) { GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, GUIWindowManager.ActiveWindow, 0, controlId, index, 0, null)); } }
/// <summary> /// Send a MediaPortal message. /// </summary> /// <param name="command">The command.</param> public static void ProcessSendMediaPortalMessage(string[] command) { GUIMessage.MessageType type = (GUIMessage.MessageType)Enum.Parse(typeof(GUIMessage.MessageType), command[0], true); int windowId = int.Parse(command[1]); int senderId = int.Parse(command[2]); int controlId = int.Parse(command[3]); int param1 = int.Parse(command[4]); int param2 = int.Parse(command[5]); GUIMessage message = new GUIMessage(type, windowId, senderId, controlId, param1, param2, null); GUIGraphicsContext.ResetLastActivity(); GUIWindowManager.SendThreadMessage(message); }
public override void Process() { if (!Playing) { return; } if (_notifyPlaying && CurrentPosition >= 10.0) { _notifyPlaying = false; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null); msg.Label = CurrentFile; GUIWindowManager.SendThreadMessage(msg); } }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { string[] processed = ProcessParameters(variables, Parameters); GUIMessage.MessageType type = (GUIMessage.MessageType)Enum.Parse(typeof(GUIMessage.MessageType), processed[0]); int windowId = int.Parse(processed[1]); int senderId = int.Parse(processed[2]); int controlId = int.Parse(processed[3]); int param1 = int.Parse(processed[4]); int param2 = int.Parse(processed[5]); GUIMessage message = new GUIMessage(type, windowId, senderId, controlId, param1, param2, null); GUIGraphicsContext.ResetLastActivity(); GUIWindowManager.SendThreadMessage(message); }
/// <summary> /// Gets called by g_Player when playback of media has started. /// This handles cropping timeshifted TV and recordings. /// </summary> /// <param name="type"></param> /// <param name="filename"></param> private void g_Player_PlayBackStarted(g_Player.MediaType type, string filename) { if (type == g_Player.MediaType.TV || type == g_Player.MediaType.Recording) { try { if (CropSettings.Top > 0 || CropSettings.Bottom > 0 || CropSettings.Left > 0 || CropSettings.Right > 0) { Log.Info("TvCropManager.SendCropMessage(): {0}, {1}, {2}, {3}", CropSettings.Top, CropSettings.Bottom, CropSettings.Left, CropSettings.Right); GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLANESCENE_CROP, 0, 0, 0, 0, 0, CropSettings)); } } catch (Exception) { } } }
public override bool Play(string strFile) { m_iVolume = 100; m_bNotifyPlaying = true; m_state = PlayState.Init; m_strCurrentFile = strFile; VideoRendererStatistics.VideoState = VideoRendererStatistics.State.VideoPresent; Log.Info("AudioPlayerVMR7.play {0}", strFile); lock (typeof(AudioPlayerVMR7)) { CloseInterfaces(); if (!GetInterfaces()) { m_strCurrentFile = ""; return(false); } int hr = mediaEvt.SetNotifyWindow(GUIGraphicsContext.ActiveForm, WM_GRAPHNOTIFY, IntPtr.Zero); if (hr < 0) { m_strCurrentFile = ""; CloseInterfaces(); return(false); } GetFrameStepInterface(); _rotEntry = new DsROTEntry((IFilterGraph)graphBuilder); hr = mediaCtrl.Run(); if (hr < 0) { m_strCurrentFile = ""; CloseInterfaces(); return(false); } // mediaPos.put_CurrentPosition(4*60); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msg.Label = strFile; GUIWindowManager.SendThreadMessage(msg); } m_state = PlayState.Playing; return(true); }
public override void Process() { if (media == null) { return; } if (media.State == States.Ended || media.State == States.Stopped) { playState = PlayState.Ended; } if (Initializing && media.State == States.Playing) { playState = PlayState.Playing; } if (!bufferingDone && !Initializing) { GUIWaitCursor.Hide(); // hide the wait cursor bufferingDone = true; if (Ended) { PlaybackEnded(); } else { if (GoFullscreen) { GUIWindowManager.ActivateWindow(GUIOnlineVideoFullscreen.WINDOW_FULLSCREEN_ONLINEVIDEO); } GUIMessage msgPb = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msgPb.Label = CurrentFile; GUIWindowManager.SendThreadMessage(msgPb); SetVideoWindow(); osd = OSDController.Instance; } } if (osd != null) { osd.UpdateGUI(); } }
protected void SetImageToGui(string imageFilePath) { ThumbnailImage = imageFilePath; IconImage = imageFilePath; IconImageBig = imageFilePath; // if selected and OnlineVideos is current window force an update of #selectedthumb GUIOnlineVideos ovsWindow = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow) as GUIOnlineVideos; if (ovsWindow != null) { int listControlId = ovsWindow.CurrentState == GUIOnlineVideos.State.details ? 51 : 50; GUIListItem selectedItem = GUIControl.GetSelectedListItem(GUIOnlineVideos.WindowId, listControlId); if (selectedItem == this) { GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, GUIWindowManager.ActiveWindow, 0, listControlId, ItemId, 0, null)); } } }
public override bool Play(string strFile) { m_iVolume = 100; m_bNotifyPlaying = true; m_state = PlayState.Init; m_strCurrentFile = strFile; VideoRendererStatistics.VideoState = VideoRendererStatistics.State.VideoPresent; Logger.Instance.Debug("AirplayerAudioPlayer: Play"); CloseInterfaces(); if (!GetInterfaces()) { m_strCurrentFile = ""; return(false); } int hr = mediaEvt.SetNotifyWindow(GUIGraphicsContext.ActiveForm, WM_GRAPHNOTIFY, IntPtr.Zero); if (hr < 0) { m_strCurrentFile = ""; CloseInterfaces(); return(false); } _rotEntry = new DsROTEntry((IFilterGraph)graphBuilder); hr = mediaCtrl.Run(); if (hr < 0) { m_strCurrentFile = ""; CloseInterfaces(); return(false); } GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msg.Label = strFile; GUIWindowManager.SendThreadMessage(msg); m_state = PlayState.Playing; return(true); }
public override void Process() { //Log.Info("in Process"); //UpdateStatus(); if (_needUpdate) { SetVideoWindow(); } if (CurrentPosition >= 10.0) { if (_notifyPlaying) { _notifyPlaying = false; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null); msg.Label = ""; GUIWindowManager.SendThreadMessage(msg); //Log.Info("Message Playing 10 sec sent"); } } }
public override void Process() { if (wmpCtrl != null) { if (Initializing) { if (!bufferCompleted && wmpCtrl.playState.Equals(WMPPlayState.wmppsPlaying)) { bufferCompleted = true; } if (wmpCtrl.playState.Equals(WMPPlayState.wmppsReady)) { GUIWaitCursor.Hide(); // hide the wait cursor Log.Instance.Info("WMPVideoPlayer: error encountered while trying to play {0}", currentFile); bufferCompleted = true; PlaybackEnded(); } else if (bufferCompleted) { AdaptRefreshRate(); GUIWaitCursor.Hide(); // hide the wait cursor wmpCtrl.Visible = true; playState = PlayState.Playing; if (GoFullscreen) { GUIWindowManager.ActivateWindow(GUIOnlineVideoFullscreen.WINDOW_FULLSCREEN_ONLINEVIDEO); } GUIMessage msgPb = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msgPb.Label = CurrentFile; GUIWindowManager.SendThreadMessage(msgPb); SetVideoWindow(); osd = OSDController.Instance; } } else if (Playing && osd != null) { osd.UpdateGUI(); } } }
public override void Process() { if (!Playing) { return; } if (_wmp10Player == null) { return; } if (GUIGraphicsContext.BlankScreen || (GUIGraphicsContext.Overlay == false && GUIGraphicsContext.IsFullScreenVideo == false)) { if (_wmp10Player.Visible) { _wmp10Player.ClientSize = new Size(0, 0); _wmp10Player.Visible = false; //_wmp10Player.uiMode = "invisible"; } } else if (!_wmp10Player.Visible) { _needUpdate = true; SetVideoWindow(); //_wmp10Player.uiMode = "none"; _wmp10Player.Visible = true; } if (CurrentPosition >= 10.0) { if (_notifyPlaying) { _notifyPlaying = false; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYING_10SEC, 0, 0, 0, 0, 0, null); msg.Label = CurrentFile; GUIWindowManager.SendThreadMessage(msg); } } }
public override bool OnMessage(GUIMessage message) { switch (message.Message) { case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT: if (lblDate != null) { lblDate.Label = GUIPropertyManager.GetProperty("#date"); } if (lblTime != null) { lblTime.Label = GUIPropertyManager.GetProperty("#time"); } break; case GUIMessage.MessageType.GUI_MSG_CLICKED: GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, message.Param1, 0, null); GUIWindowManager.SendThreadMessage(msg); break; } return(base.OnMessage(message)); }
/// <summary> /// Sends a Thread message to select an item on a facade object. Will only send if itemid parameter is currently selected /// </summary> /// <param name="self">the list object</param> /// <param name="windowId">the window id containing list control</param> /// <param name="index">the item id in list to check if selected</param> /// <param name="controlId">the id of the list control, defaults to 50</param> public static void UpdateItemIfSelected(this GUIListItem self, int windowId, int index, int controlId = 50) { if (GUIWindowManager.ActiveWindow != windowId) { return; } try { GUIListItem selectedItem = GUIControl.GetSelectedListItem(windowId, controlId); // only send message if the current item is selected if (selectedItem == self) { GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, GUIWindowManager.ActiveWindow, 0, controlId, index, 0, null)); } } catch (Exception) { TraktLogger.Warning("Unable to update selected facade item, MediaPortal could not get a reference"); } }
/// <summary> /// Takes a MediaPortal window name or window number and activates it. /// </summary> /// <param name="screen">MediaPortal window name or number.</param> /// <param name="useBasicHome">Use the basic home screen when home is requested.</param> public static void ProcessGoTo(string screen, bool useBasicHome) { if (String.IsNullOrEmpty(screen)) { throw new ArgumentNullException("screen"); } int window = (int)GUIWindow.Window.WINDOW_INVALID; try { window = (int)Enum.Parse(typeof(GUIWindow.Window), "WINDOW_" + screen, true); } catch (ArgumentException) { // Parsing the window id as a GUIWindow.Window failed, so parse it as an int } if (window == (int)GUIWindow.Window.WINDOW_INVALID) { int.TryParse(screen, out window); } if (window == (int)GUIWindow.Window.WINDOW_INVALID) { throw new ArgumentException(String.Format("Failed to parse Goto command window id \"{0}\"", screen), "screen"); } if (window == (int)GUIWindow.Window.WINDOW_HOME && useBasicHome) { window = (int)GUIWindow.Window.WINDOW_SECOND_HOME; } GUIGraphicsContext.ResetLastActivity(); GUIWindowManager.SendThreadMessage(new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, window, 0, null)); }
private void OnHDPlayerExited(object obj, EventArgs e) { // Restore refresh rate if it was changed if (MovingPicturesCore.Settings.UseDynamicRefreshRateChangerWithExternalPlayer && RefreshRateChanger.RefreshRateChangePending) { RefreshRateChanger.AdaptRefreshRate(); } // enable mediaportal input devices InputDevices.InputDevices.Init(); // show mediaportal and start rendering GUIGraphicsContext.BlankScreen = false; GUIGraphicsContext.form.Show(); GUIGraphicsContext.ResetLastActivity(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GETFOCUS, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.RUNNING; logger.Info("HD Playback: The external player has exited."); // call the logic for when an external player exits onExternalExit(); }
public override bool Play(string strFile) { Log.Info("Playing flv with YoutubeFlvPlayer :{0}", strFile); try { //Uri site = new Uri(strFile); if (FlvControl != null) { } //string[] param = site.Query.Substring(1).Split('&'); string video_id = getIDSimple(strFile); FlvControl = new FlashControl(); FlvControl.Player.AllowScriptAccess = "always"; Log.Debug("Flash version : {0} ", FlvControl.Player.FlashVersion()); FlvControl.Player.FlashCall += new _IShockwaveFlashEvents_FlashCallEventHandler(OnFlashCall); FlvControl.Player.FSCommand += new _IShockwaveFlashEvents_FSCommandEventHandler(Player_FSCommand); //FlvControl.Player.FlashVars = site.Query.Replace("?", "&") + "&eh=myCallbackEventHandler&token=AA7Zx0hd0JeezyPS6TqLB0_1UnEUMZybQEmzIAWcIa7UHPEHNg--"; FlvControl.Player.OnProgress += new _IShockwaveFlashEvents_OnProgressEventHandler(Player_OnProgress); FlvControl.Player.AllowScriptAccess = "always"; //FlvControl.Player.LoadMovie(0, string.Format("http://www.youtube.com/v/{0}&color1=0x2b405b&color2=0x6b8ab6&fs=1&autoplay=1&enablejsapi=1&playerapiid=ytplayer", video_id)); if (strFile.Contains("http://www.youtube.com/v")) { FlvControl.Player.LoadMovie(0, "http://www.youtube.com/apiplayer?enablejsapi=1"); FlvControl.Visible = false; } else { FlvControl.Player.LoadMovie(0, string.Format("http://www.youtubeflashplayer.com/youtubeflashplayer.swf?vurl={0}&sn=http://&logo=http://www.youtubeflashplayer.com/images/youtubeplayericon.png&showlogo=false&showcontrol=false&autohide=false&delaytime=&autoplay=true&loopplay=false&", HttpUtility.UrlEncode(strFile))); FlvControl.Visible = true; //FlvControl.Player.LoadMovie(0, Config.GetFile(Config.Dir.Plugins, "ExternalPlayers", "yt.swf")); ////FlvControl.Player.FlashVars = String.Format("&file={0}&autostart=true&enablejs=true&allowfullscreen=true", HttpUtility.UrlDecode(strFile)); //FlvControl.Player.FlashVars = String.Format("&file={0}&autostart=true&enablejs=true&backcolor=0x000000&frontcolor=0xCCCCCC&showicons=false&showvolume=false&showdigits=false&displayheight={1}&allowfullscreen=true", strFile.Replace("&", "%26").Replace("?", "%3f"), 9999); //Log.Debug("flash vars: {0}", String.Format("&file={0}&autostart=true&enablejs=true&allowfullscreen=true", HttpUtility.UrlEncode(strFile))); //Log.Debug("flash vars: {0}", FlvControl.Player.FlashVars); } FlvControl.Player.AllowScriptAccess = "always"; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msg.Label = strFile; GUIWindowManager.SendThreadMessage(msg); this.VideoId = getIDSimple2(strFile); GUIGraphicsContext.form.SuspendLayout(); GUIWindowManager.OnNewAction += new OnActionHandler(OnAction2); _notifyPlaying = true; FlvControl.ClientSize = new Size(0, 0); FlvControl.Enabled = false; FlvControl.TabIndex = 0; GUIGraphicsContext.form.Controls.Add(FlvControl); _needUpdate = true; _isFullScreen = GUIGraphicsContext.IsFullScreenVideo; _positionX = GUIGraphicsContext.VideoWindow.Left; _positionY = GUIGraphicsContext.VideoWindow.Top; _videoWidth = GUIGraphicsContext.VideoWindow.Width; _videoHeight = GUIGraphicsContext.VideoWindow.Height; _currentFile = strFile; _duration = -1; _currentPosition = -1; _playState = PlayState.Playing; _updateTimer = DateTime.Now; SetVideoWindow(); GUIGraphicsContext.form.ResumeLayout(false); return(true); } catch (Exception ex) { Log.Error("Flv on Play Error {0} {1} {2}", ex.Message, ex.Source, ex.StackTrace); } return(false); }
private static void SendElapsedEventMessage(object data) { GUIWindowManager.SendThreadMessage((GUIMessage)data); }
public override bool Play(string strFile) { updateTimer = DateTime.Now; m_speedRate = 10000; GUIGraphicsContext.IsWindowVisible = false; m_iVolume = 100; _state = PlayState.Init; m_strCurrentFile = strFile; m_bFullScreen = true; m_ar = GUIGraphicsContext.ARType; VideoRendererStatistics.VideoState = VideoRendererStatistics.State.VideoPresent; _updateNeeded = true; Log.Info("RTSPPlayer:play {0}", strFile); //lock ( typeof(VideoPlayerVMR7) ) { CloseInterfaces(); m_bStarted = false; if (!GetInterfaces()) { m_strCurrentFile = ""; CloseInterfaces(); return(false); } int hr = mediaEvt.SetNotifyWindow(GUIGraphicsContext.ActiveForm, WM_GRAPHNOTIFY, IntPtr.Zero); if (hr < 0) { Error.SetError("Unable to play movie", "Can not set notifications"); m_strCurrentFile = ""; CloseInterfaces(); return(false); } DirectShowUtil.SetARMode(graphBuilder, AspectRatioMode.Stretched); _rotEntry = new DsROTEntry((IFilterGraph)graphBuilder); // DsUtils.DumpFilters(graphBuilder); hr = _mediaCtrl.Run(); if (hr < 0) { Error.SetError("Unable to play movie", "Unable to start movie"); m_strCurrentFile = ""; CloseInterfaces(); return(false); } GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STARTED, 0, 0, 0, 0, 0, null); msg.Label = strFile; GUIWindowManager.SendThreadMessage(msg); _state = PlayState.Playing; //Brutus GUIGraphicsContext.IsFullScreenVideo=true; m_iPositionX = GUIGraphicsContext.VideoWindow.X; m_iPositionY = GUIGraphicsContext.VideoWindow.Y; m_iWidth = GUIGraphicsContext.VideoWindow.Width; m_iHeight = GUIGraphicsContext.VideoWindow.Height; m_ar = GUIGraphicsContext.ARType; _updateNeeded = true; SetVideoWindow(); mediaPos.get_Duration(out _duration); Log.Info("RTSPPlayer:Duration:{0}", _duration); if (_mediaType == g_Player.MediaType.TV) { //if (_duration < 1) _duration = 1; //SeekAbsolute(_duration - 1); } else { //SeekAbsolute(0); } OnInitialized(); } // Wait for a while to wait VMR9 to get ready. // Implemented due to problems starting to play before VMR9 was ready resulting in black screen. Thread.Sleep(200); return(true); }
/// <summary> /// Evaluates the button number, gets its mapping and executes the action /// </summary> /// <param name="btnCode">Button code (ref: XML file)</param> /// <param name="processID">Process-ID for close/kill commands</param> private bool DoMapAction(string btnCode, int processID) { if (!_isLoaded) // No mapping loaded { Log.Info("Map: No button mapping loaded"); return(false); } Mapping map = null; map = GetMapping(btnCode); if (map == null) { return(false); } #if DEBUG Log.Info("{0} / {1} / {2} / {3}", map.Condition, map.ConProperty, map.Command, map.CmdProperty); #endif Action action; if (map.Sound != string.Empty) { Util.Utils.PlaySound(map.Sound, false, true); } if (map.Focus && !GUIGraphicsContext.HasFocus) { GUIGraphicsContext.ResetLastActivity(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GETFOCUS, 0, 0, 0, 0, 0, null); //GUIWindowManager.SendThreadMessage(msg); GUIGraphicsContext.SendMessage(msg); return(true); } switch (map.Command) { case "ACTION": // execute Action x Key key = new Key(map.CmdKeyChar, map.CmdKeyCode); #if DEBUG Log.Info("Executing: key {0} / {1} / Action: {2} / {3}", map.CmdKeyChar, map.CmdKeyCode, map.CmdProperty, ((Action.ActionType)Convert.ToInt32(map.CmdProperty)).ToString()); #endif action = new Action(key, (Action.ActionType)Convert.ToInt32(map.CmdProperty), 0, 0); GUIGraphicsContext.OnAction(action); break; case "KEY": // send Key x SendKeys.SendWait(map.CmdProperty); break; case "WINDOW": // activate Window x GUIGraphicsContext.ResetLastActivity(); GUIMessage msg; if ((Convert.ToInt32(map.CmdProperty) == (int)GUIWindow.Window.WINDOW_HOME) || (Convert.ToInt32(map.CmdProperty) == (int)GUIWindow.Window.WINDOW_SECOND_HOME)) { if (_basicHome) { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_SECOND_HOME, 0, null); } else { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_HOME, 0, null); } } else { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, Convert.ToInt32(map.CmdProperty), 0, null); } GUIWindowManager.SendThreadMessage(msg); break; case "TOGGLE": // toggle Layer 1/2 if (_currentLayer == 1) { _currentLayer = 2; } else { _currentLayer = 1; } break; case "POWER": // power down commands if ((map.CmdProperty == "STANDBY") || (map.CmdProperty == "HIBERNATE")) { GUIGraphicsContext.ResetLastActivity(); } switch (map.CmdProperty) { case "EXIT": action = new Action(Action.ActionType.ACTION_EXIT, 0, 0); GUIGraphicsContext.OnAction(action); break; case "REBOOT": action = new Action(Action.ActionType.ACTION_REBOOT, 0, 0); GUIGraphicsContext.OnAction(action); break; case "SHUTDOWN": action = new Action(Action.ActionType.ACTION_SHUTDOWN, 0, 0); GUIGraphicsContext.OnAction(action); break; case "STANDBY": action = new Action(Action.ActionType.ACTION_SUSPEND, 1, 0); //1 = ignore prompt GUIGraphicsContext.OnAction(action); break; case "HIBERNATE": action = new Action(Action.ActionType.ACTION_HIBERNATE, 1, 0); //1 = ignore prompt GUIGraphicsContext.OnAction(action); break; } break; case "PROCESS": { GUIGraphicsContext.ResetLastActivity(); if (processID > 0) { Process proc = Process.GetProcessById(processID); if (null != proc) { switch (map.CmdProperty) { case "CLOSE": proc.CloseMainWindow(); break; case "KILL": proc.Kill(); break; } } } } break; default: return(false); } return(true); }