Exemplo n.º 1
0
 public void GetNextReturnsFileName()
 {
   PlayListPlayer player = new PlayListPlayer();
   player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
   PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
   PlayListItem item1 = new PlayListItem("apa", "c:\\apa.mp3");
   playlist.Add(item1);
   Assert.AreEqual("c:\\apa.mp3", player.GetNext());
 }
Exemplo n.º 2
0
 public void InsertItemButNotStartPlayingGivesNull()
 {
   PlayListPlayer player = new PlayListPlayer();
   player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
   PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
   PlayListItem item1 = new PlayListItem();
   playlist.Add(item1);
   Assert.IsNull(player.GetCurrentItem());
 }
    public GUIVideoBaseWindow()
    {
      playlistPlayer = PlayListPlayer.SingletonPlayer;

      if (handler == null)
      {
        handler = new VideoViewHandler();
      }

      GUIWindowManager.OnNewAction += new OnActionHandler(OnNewAction);
    }
Exemplo n.º 4
0
 public void PlayMovesCurrentToItem()
 {
   PlayListPlayer player = new PlayListPlayer();
   player.g_Player = this; //fake g_Player
   player.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC;
   PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_MUSIC);
   PlayListItem item1 = new PlayListItem();
   playlist.Add(item1);
   player.PlayNext();
   Assert.AreEqual(item1, player.GetCurrentItem());
   Assert.IsTrue(hasPlayBeenCalled);
 }
Exemplo n.º 5
0
        public VideoHandler()
        {
            playlistPlayer = MediaPortal.Playlists.PlayListPlayer.SingletonPlayer;

            // Check if External Player is being used
            MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
            m_bIsExternalPlayer    = !xmlreader.GetValueAsBool("movieplayer", "internal", true);
            m_bIsExternalDVDPlayer = !xmlreader.GetValueAsBool("dvdplayer", "internal", true);

            // external player handlers
            Utils.OnStartExternal += new Utils.UtilEventHandler(onStartExternal);
            Utils.OnStopExternal  += new Utils.UtilEventHandler(onStopExternal);

            g_Player.PlayBackStopped += new MediaPortal.Player.g_Player.StoppedHandler(OnPlayBackStopped);
            g_Player.PlayBackEnded   += new MediaPortal.Player.g_Player.EndedHandler(OnPlayBackEnded);
            g_Player.PlayBackStarted += new MediaPortal.Player.g_Player.StartedHandler(OnPlayBackStarted);
            g_Player.PlayBackChanged += new g_Player.ChangedHandler(OnPlaybackChanged);
            PlayPropertyUpdater.WorkerSupportsCancellation = true;
            PlayPropertyUpdater.DoWork += new DoWorkEventHandler(SetPlayProperties_DoWork);
        }
Exemplo n.º 6
0
 public GUISlideShow()
 {
   GetID = (int)Window.WINDOW_SLIDESHOW;
   playlistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 7
0
 public GUIVideoOSD()
 {
   GetID = (int)Window.WINDOW_OSD;
   playlistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 8
0
    public GUIMusicBaseWindow()
    {
      if (m_database == null)
      {
        m_database = MusicDatabase.Instance;
      }

      playlistPlayer = PlayListPlayer.SingletonPlayer;

      playlistPlayer.PlaylistChanged += new PlayListPlayer.PlaylistChangedEventHandler(playlistPlayer_PlaylistChanged); 

      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        string playNowJumpTo = xmlreader.GetValueAsString("music", "playnowjumpto", "none");

        switch (playNowJumpTo)
        {
          case "none":
            PlayNowJumpTo = PlayNowJumpToType.None;
            break;

          case "nowPlayingAlways":
            PlayNowJumpTo = PlayNowJumpToType.NowPlayingAlways;
            break;

          case "nowPlayingMultipleItems":
            PlayNowJumpTo = PlayNowJumpToType.NowPlayingMultipleItems;
            break;

          case "currentPlaylistAlways":
            PlayNowJumpTo = PlayNowJumpToType.CurrentPlaylistAlways;
            break;

          case "currentPlaylistMultipleItems":
            PlayNowJumpTo = PlayNowJumpToType.CurrentPlaylistMultipleItems;
            break;

          case "fullscreenAlways":
            PlayNowJumpTo = PlayNowJumpToType.FullscreenIfVizEnabledAlways;
            break;

          case "fullscreenMultipleItems":
            PlayNowJumpTo = PlayNowJumpToType.FullscreenIfVizEnabledMultipleItems;
            break;

          default:
            PlayNowJumpTo = PlayNowJumpToType.None;
            break;
        }

        _autoShuffleOnLoad = xmlreader.GetValueAsBool("musicfiles", "autoshuffle", false);
      }

      UsingInternalMusicPlayer = BassMusicPlayer.IsDefaultMusicPlayer;
    }
Exemplo n.º 9
0
 public GUIVideoFullscreen()
 {
   GetID = (int)Window.WINDOW_FULLSCREEN_VIDEO;
   playlistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 10
0
 public GUIMusicFullscreen()
 {
   GetID = (int)Window.WINDOW_FULLSCREEN_MUSIC;
   playlistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 11
0
    /// <summary>
    /// Initialise The Viz Window
    /// </summary>
    private void Init()
    {
      InitializeComponent();
      CheckForIllegalCrossThreadCalls = false;
      PlaylistPlayer = PlayListPlayer.SingletonPlayer;

      g_Player.PlayBackStarted += new g_Player.StartedHandler(OnPlayBackStarted);
      Bass.InternetStreamSongChanged += new BassAudioEngine.InternetStreamSongChangedDelegate(InternetStreamSongChanged);

      //if (GUIGraphicsContext.form != null)
      //    GUIGraphicsContext.form.Resize += new EventHandler(OnAppFormResize);

      GUIGraphicsContext.OnNewAction += new OnActionHandler(OnNewAction);

      SetStyle(ControlStyles.DoubleBuffer, true);
      SetStyle(ControlStyles.AllPaintingInWmPaint, true);
      SetStyle(ControlStyles.UserPaint, true);

      TextStringFormat.Trimming = StringTrimming.Character;
      TextStringFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.NoClip | StringFormatFlags.FitBlackBox;

      LoadSettings();

      // Soundspectrum Graphics always show the cursor, so let's hide it here
      if (GUIGraphicsContext.Fullscreen && _autoHideMouse)
      {
        Cursor.Hide();
      }
    }
Exemplo n.º 12
0
    /// Constructor
    /// </summary>
    public D3DApp()
    {
#if PERFCOUNTER
      _perfCounterCpu = new PerformanceCounter();
      _perfCounterCpu.CategoryName = "Processor";
      _perfCounterCpu.CounterName = "% Processor Time";
      _perfCounterCpu.InstanceName = "_Total";
#endif
      //GUIGraphicsContext.DX9Device = null;
      try
      {
        int hr = (int)timeBeginPeriod(MILLI_SECONDS_TIMER);
        if (hr != 0)
        {
          UseMillisecondTiming = false;
        }
      }
      catch (Exception)
      {
        UseMillisecondTiming = false;
        Log.Info("Exception");
      }
      active = false;
      ready = false;
      hasFocus = false;
      behavior = 0;
      ourRenderTarget = this;
      frameMoving = true;
      singleStep = false;
      deviceStats = null;
      frameStatsLine1 = null;
      frameStatsLine2 = null;
      this.Text = "D3D9 Sample";
      this.ClientSize = new Size(720, 576);
      this.KeyPreview = true;

      minDepthBits = 16;
      minStencilBits = 0;
      showCursorWhenFullscreen = false;
      bool debugChangeDeviceHack = false;

      using (Settings xmlreader = new MPSettings())
      {
        useExclusiveDirectXMode = xmlreader.GetValueAsBool("general", "exclusivemode", true);
        useEnhancedVideoRenderer = xmlreader.GetValueAsBool("general", "useEVRenderer", false);
        if (useEnhancedVideoRenderer)
        {
          useExclusiveDirectXMode = false;
        }
        autoHideTaskbar = xmlreader.GetValueAsBool("general", "hidetaskbar", true);
        alwaysOnTopConfig = alwaysOnTop = xmlreader.GetValueAsBool("general", "alwaysontop", false);
        debugChangeDeviceHack = xmlreader.GetValueAsBool("debug", "changedevicehack", false);
        _disableMouseEvents = xmlreader.GetValueAsBool("remote", "CentareaJoystickMap", false);
      }

      // When clipCursorWhenFullscreen is TRUE, the cursor is limited to
      // the device window when the app goes fullscreen.  This prevents users
      // from accidentally clicking outside the app window on a multimon system.
      // This flag is turned off by default for debug builds, since it makes 
      // multimon debugging difficult.
#if debug
      clipCursorWhenFullscreen = false;
#else
      clipCursorWhenFullscreen = true;
#endif
      InitializeComponent();


      menuItemMiniTv.Checked = miniTvMode;

      GUIGraphicsContext.IsVMR9Exclusive = useExclusiveDirectXMode;
      GUIGraphicsContext.IsEvr = useEnhancedVideoRenderer;
      playlistPlayer = PlayListPlayer.SingletonPlayer;
    }
Exemplo n.º 13
0
        public VideoHandler()
        {
            playlistPlayer = MediaPortal.Playlists.PlayListPlayer.SingletonPlayer;

            // Check if External Player is being used
            MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"));
            m_bIsExternalPlayer = !xmlreader.GetValueAsBool("movieplayer", "internal", true);
            m_bIsExternalDVDPlayer = !xmlreader.GetValueAsBool("dvdplayer", "internal", true);
            
			// external player handlers
			Utils.OnStartExternal += new Utils.UtilEventHandler(onStartExternal);
			Utils.OnStopExternal += new Utils.UtilEventHandler(onStopExternal);

            g_Player.PlayBackStopped += new MediaPortal.Player.g_Player.StoppedHandler(OnPlayBackStopped);
            g_Player.PlayBackEnded += new MediaPortal.Player.g_Player.EndedHandler(OnPlayBackEnded);
            g_Player.PlayBackStarted += new MediaPortal.Player.g_Player.StartedHandler(OnPlayBackStarted);
            g_Player.PlayBackChanged += new g_Player.ChangedHandler(OnPlaybackChanged);
            PlayPropertyUpdater.WorkerSupportsCancellation = true;
            PlayPropertyUpdater.DoWork += new DoWorkEventHandler(SetPlayProperties_DoWork);
        }
Exemplo n.º 14
0
    protected static Rectangle         _backupBounds;             // Bounds backup

    #endregion

    #region constructor

    /// <summary>
    /// Constructor
    /// </summary>
    protected D3D()
    {
      _firstTimeWindowDisplayed  = true;
      _firstTimeActivated       = true;
      MinimizeOnStartup         = false;
      MinimizeOnGuiExit         = false;
      MinimizeOnFocusLoss       = false;
      ShuttingDown              = false;
      AutoHideMouse             = true;
      MouseCursor               = true;
      Windowed                  = true;
      Volume                    = -1;
      AppActive                 = false;
      KeyPreview                = true;
      Frames                    = 0;
      FrameStatsLine1           = null;
      FrameStatsLine2           = null;
      Text                      = Resources.D3DApp_NotifyIcon_MediaPortal;
      PlaylistPlayer            = PlayListPlayer.SingletonPlayer;
      MouseTimeOutTimer         = DateTime.Now;
      _lastActiveWindow         = -1;
      IsVisible                 = true;
      IsDisplayTurnedOn         = true;
      IsInAwayMode              = false;
      IsUserPresent             = true;
      _lastMouseCursor          = !MouseCursor;
      _showCursorWhenFullscreen = false;
      _currentPlayListType      = PlayListType.PLAYLIST_NONE;
      _enumerationSettings      = new D3DEnumeration();
      _presentParams            = new PresentParameters();
      _renderTarget             = this;

      using (Settings xmlreader = new MPSettings())
      {
        _useExclusiveDirectXMode = xmlreader.GetValueAsBool("general", "exclusivemode", true);
        UseEnhancedVideoRenderer = xmlreader.GetValueAsBool("general", "useEVRenderer", false);
        _disableMouseEvents      = xmlreader.GetValueAsBool("remote", "CentareaJoystickMap", false);
        AutoHideTaskbar          = xmlreader.GetValueAsBool("general", "hidetaskbar", true);
        _alwaysOnTop             = xmlreader.GetValueAsBool("general", "alwaysontop", false);
        _reduceFrameRate         = xmlreader.GetValueAsBool("gui", "reduceframerate", false);
        _doNotWaitForVSync       = xmlreader.GetValueAsBool("debug", "donotwaitforvsync", false);
      }

      _useExclusiveDirectXMode = !UseEnhancedVideoRenderer && _useExclusiveDirectXMode;
      GUIGraphicsContext.IsVMR9Exclusive = _useExclusiveDirectXMode;
      GUIGraphicsContext.IsEvr = UseEnhancedVideoRenderer;
      
      InitializeComponent();
    }
Exemplo n.º 15
0
 public override bool Init()
 {
   _playlistPlayer = PlayListPlayer.SingletonPlayer;
   g_Player.PlayBackEnded += OnPlayBackEnded;
   g_Player.PlayBackChanged += OnPlayBackChanged;
   g_Player.PlayBackStopped += OnPlayBackStopped;
   var mdb = MusicDatabase.Instance;
   var sessionKey = mdb.GetLastFMSK();
   var currentUser = mdb.GetLastFMUser();
   var a = new LastFMLibrary(sessionKey, currentUser); //TODO this is just making _SK get loaded.   No need to actual instansiate
   return Load(GUIGraphicsContext.GetThemedSkinDirectory(@"\lastFmRadio.xml"));
 }
Exemplo n.º 16
0
    public override bool Init()
    {
      bool bResult = Load(GUIGraphicsContext.GetThemedSkinFile(@"\MyRadioLastFM.xml"));

      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        _configShowTrayIcon = xmlreader.GetValueAsBool("audioscrobbler", "showtrayicon", false);
        _configShowBallonTips = xmlreader.GetValueAsBool("audioscrobbler", "showballontips", false);
        _configDirectSkip = xmlreader.GetValueAsBool("audioscrobbler", "directskip", false);
        _configListEntryCount = xmlreader.GetValueAsInt("audioscrobbler", "listentrycount", 24);
        _configOneClickStart = xmlreader.GetValueAsBool("audioscrobbler", "oneclickstart", false);
      }

      PlaylistPlayer = PlayListPlayer.SingletonPlayer;
      LastFMStation = new StreamControl();
      InfoScrobbler = AudioscrobblerUtils.Instance;
      _usersTopArtists = new List<string>(_configListEntryCount);
      _usersOwnTags = new List<string>(_configListEntryCount);
      _usersFriends = new List<string>(_configListEntryCount);
      _radioTrackList = new List<Song>(5);
      _similarArtistCache = new List<string>(5);
      _trackTagsCache = new List<string>(5);
      _streamSong = new Song();
      _scrobbleUsers = new List<string>(1);

      if (_configShowTrayIcon)
      {
        InitTrayIcon();
      }

      g_Player.PlayBackStarted += new g_Player.StartedHandler(PlayBackStartedHandler);
      g_Player.PlayBackStopped += new g_Player.StoppedHandler(PlayBackStoppedHandler);
      g_Player.PlayBackEnded += new g_Player.EndedHandler(PlayBackEndedHandler);

      LastFMStation.RadioSettingsSuccess += new StreamControl.RadioSettingsLoaded(OnRadioSettingsSuccess);
      LastFMStation.RadioSettingsError += new StreamControl.RadioSettingsFailed(OnRadioSettingsError);
      this.PlaylistUpdateSuccess += new PlaylistUpdated(OnPlaylistUpdateSuccess);
      this.PlaylistUpdateError += new PlaylistEmpty(OnPlaylistUpdateError);

      return bResult;
    }
Exemplo n.º 17
0
    public GUIMusicOverlay()
    {
      GetID = (int)Window.WINDOW_MUSIC_OVERLAY;
      playlistPlayer = PlayListPlayer.SingletonPlayer;
      _useBassEngine = BassMusicPlayer.IsDefaultMusicPlayer;
      using (Profile.Settings xmlreader = new Profile.MPSettings())
      {
        _settingVisEnabled = xmlreader.GetValueAsBool("musicfiles", "doVisualisation", false) && _useBassEngine;
        _visualisationEnabled = _settingVisEnabled;
        _stripArtistPrefixes = xmlreader.GetValueAsBool("musicfiles", "stripartistprefixes", false);
        _playlistIsCurrent = xmlreader.GetValueAsBool("musicfiles", "playlistIsCurrent", true);
      }

      g_Player.PlayBackStarted += OnPlayBackStarted;
      g_Player.PlayBackEnded += OnPlayBackEnded;

      playlistPlayer.PlaylistChanged += OnPlaylistChanged;
    }
Exemplo n.º 18
0
    public override int RenderVisualization()
    {
      try
      {
        if (VisualizationWindow == null || !VisualizationWindow.Visible || _visParam.VisHandle == 0)
        {
          return 0;
        }

        // Any is wrong with PlaybackStateChanged, if the songfile automatically changed
        // so i have create a new variable which fix this problem
        if (Bass != null)
        {
          if (Bass.CurrentFile != _OldCurrentFile && !Bass.IsRadio)
          {
            trackTag = TagReader.TagReader.ReadTag(Bass.CurrentFile);
            if (trackTag != null)
            {
              _songTitle = String.Format("{0} - {1}", trackTag.Artist, trackTag.Title);
              _OldCurrentFile = Bass.CurrentFile;
            }
            else
            {
              _songTitle = "   ";
            }
          }

          // Set Song information, so that the plugin can display it
          if (trackTag != null && !Bass.IsRadio)
          {
            _playlistPlayer = PlayListPlayer.SingletonPlayer;
            PlayListItem curPlaylistItem = _playlistPlayer.GetCurrentItem();

            MusicStream streams = Bass.GetCurrentStream();
            // Do not change this line many Plugins search for Songtitle with a number before.
            _mediaInfo.SongFile = Bass.CurrentFile;
            _mediaInfo.SongTitle = (_playlistPlayer.CurrentPlaylistPos + 1) + ". " + _songTitle;
            _mediaInfo.Position = (int)(1000 * Bass.CurrentPosition);
            _mediaInfo.Duration = (int)Bass.Duration;
            _mediaInfo.PlaylistLen = 1;
            _mediaInfo.PlaylistPos = _playlistPlayer.CurrentPlaylistPos;
          }
          else
          {
            if (Bass.IsRadio)
            {
              // Change TrackTag to StreamTag for Radio
              trackTag = Bass.GetStreamTags();
              if (trackTag != null)
              {
                // Artist and Title show better i think
                _songTitle = trackTag.Artist + ": " + trackTag.Title;
                _mediaInfo.SongTitle = _songTitle;
              }
              else
              {
                _songTitle = "   ";
              }
              _mediaInfo.Position = (int)(1000 * Bass.CurrentPosition);
            }
            else
            {
              _mediaInfo.Position = 0;
              _mediaInfo.Duration = 0;
              _mediaInfo.PlaylistLen = 0;
              _mediaInfo.PlaylistPos = 0;
            }
          }
        }

        if (IsPreviewVisualization)
        {
          _mediaInfo.SongTitle = "Mediaportal Preview";
        }
        BassVis.BASSVIS_SetInfo(_visParam, _mediaInfo);

        if (RenderStarted)
        {
          return 1;
        }

        int stream = 0;

        if (Bass != null)
        {
          stream = (int)Bass.GetCurrentVizStream();
        }

        // ckeck is playing
        int nReturn = BassVis.BASSVIS_SetPlayState(_visParam, BASSVIS_PLAYSTATE.IsPlaying);
        if (nReturn == Convert.ToInt32(BASSVIS_PLAYSTATE.Play) && (_visParam.VisHandle != 0))
        {
          // Do not Render without playing
          if (MusicPlayer.BASS.Config.MusicPlayer == AudioPlayer.WasApi)
          {
            RenderStarted = BassVis.BASSVIS_RenderChannel(_visParam, stream, true);
          }
          else
          {
          RenderStarted = BassVis.BASSVIS_RenderChannel(_visParam, stream, false);
          }
        }
      }

      catch (Exception) {}

      return 1;
    }
Exemplo n.º 19
0
    public override int RenderVisualization()
    {
      try
      {
        if (VisualizationWindow == null || !VisualizationWindow.Visible || _visParam.VisHandle == 0)
        {
          return 0;
        }

        // Set Song information, so that the plugin can display it
        if (trackTag != null && Bass != null)
        {
          _playlistPlayer = PlayListPlayer.SingletonPlayer;
          PlayListItem curPlaylistItem = _playlistPlayer.GetCurrentItem();

          _mediaInfo.Position = (int)Bass.CurrentPosition;
          _mediaInfo.Duration = (int)Bass.Duration;
          _mediaInfo.PlaylistLen = 1;
          _mediaInfo.PlaylistPos = _playlistPlayer.CurrentPlaylistPos;
        }
        else
        {
          _mediaInfo.Position = 0;
          _mediaInfo.Duration = 0;
          _mediaInfo.PlaylistLen = 0;
          _mediaInfo.PlaylistPos = 0;
        }
        if (IsPreviewVisualization)
        {
          _mediaInfo.SongTitle = "Mediaportal Preview";
        }
        BassVis.BASSVIS_SetInfo(_visParam, _mediaInfo);

        if (RenderStarted)
        {
          return 1;
        }

        int stream = 0;

        if (Bass != null)
        {
          stream = (int)Bass.GetCurrentVizStream();
        }

        BassVis.BASSVIS_SetPlayState(_visParam, BASSVIS_PLAYSTATE.Play);
        RenderStarted = BassVis.BASSVIS_RenderChannel(_visParam, stream);
      }

      catch (Exception) {}

      return 1;
    }
Exemplo n.º 20
0
 /// <summary>
 /// Static Constructor for the Playlistplayer instance
 /// </summary>
 static MPlayerGUIPlugin()
 {
     PlaylistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 21
0
 static GUIVideoFiles()
 {
   _playlistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 22
0
 static MyFilmsDetail()
 {
   playlistPlayer = PlayListPlayer.SingletonPlayer;
 }
Exemplo n.º 23
0
    public GUIMusicPlayingNow()
    {
      GetID = (int)Window.WINDOW_MUSIC_PLAYING_NOW;
      PlaylistPlayer = PlayListPlayer.SingletonPlayer;
      ImagePathContainer = new List<string>();
      _imageMutex = new object();

      g_Player.PlayBackStarted += OnPlayBackStarted;
      g_Player.PlayBackStopped += OnPlayBackStopped;
      g_Player.PlayBackEnded += OnPlayBackEnded;

      LoadSettings();
    }
Exemplo n.º 24
0
    public StreamControl()
    {
      AudioscrobblerBase.RadioHandshakeSuccess += new AudioscrobblerBase.RadioHandshakeCompleted(OnRadioLoginSuccess);
      AudioscrobblerBase.RadioHandshakeError += new AudioscrobblerBase.RadioHandshakeFailed(OnRadioLoginFailed);

      PlaylistPlayer = PlayListPlayer.SingletonPlayer;
    }