Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added: time code seek support to the music visualization window #284

Open
wants to merge 1 commit into from

5 participants

@ghost

lacks the skin work

@jmarshallnz
Owner

Looks fine though c&p suggests a refactor may be advisable?

@ghost

i realize, but i have no idea how to refactor as there's no common base for the windows and it touches internals. i could break it out into a subclass, but i don't think it would save much (real) code..

@jmarshallnz
Owner

Yeah, it probably won't save all that much as you say.

@JezzX
Collaborator

I'll but in here with what I said on irc.
It needs to be moved out of the current codec info and a simple extra label in with a specific id in each window. (I assume you can't do it in anything but full screen)

As long as the proper visible conditions on the label get set we can then build up all the extra stuff like background,location, extra text like "Jump too" we can use Control.IsVisible(blah) in the window

But now I think about this my other trac ticket will prevent this from happening. Because video full screen acts like a idiot compared to music full screen when it comes to skinning http://trac.xbmc.org/ticket/10526

@tru tru referenced this pull request from a commit in plexinc/plex-home-theater-public
@tru tru Make sure we play Theme music
Fixes #284
06d1767
@tobbi

This can be closed right?

@da-anda
Collaborator

@xhaggi look what I found for you :) Any intererrest in finishing this in your endevor to move seeking stuff into CSeekHandler?

@xhaggi
Collaborator

Okay will take a look if we could move most of the code to our seek handler. But IMO we also need a new intermediate class for fullscreen/visualisation (e.g. CGUIWindowFullScreenBase) where we can put in all the dupe code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 8, 2011
This page is out of date. Refresh to see the latest.
View
4 xbmc/guilib/Key.h
@@ -401,7 +401,9 @@
#define WINDOW_VIDEO_MENU 12902
#define WINDOW_DIALOG_MUSIC_OVERLAY 12903
#define WINDOW_DIALOG_VIDEO_OVERLAY 12904
-#define WINDOW_VIDEO_TIME_SEEK 12905 // virtual window for time seeking during fullscreen video
+
+// virtual window for time seeking during fullscreen video/music
+#define WINDOW_TIME_SEEK 12905
#define WINDOW_START 12998 // first window to load
#define WINDOW_STARTUP_ANIM 12999 // for startup animations
View
3  xbmc/input/ButtonTranslator.cpp
@@ -300,7 +300,8 @@ static const ActionMapping windows[] =
{"screensaver" , WINDOW_SCREENSAVER},
{"videoosd" , WINDOW_DIALOG_VIDEO_OSD},
{"videomenu" , WINDOW_VIDEO_MENU},
- {"videotimeseek" , WINDOW_VIDEO_TIME_SEEK},
+ {"videotimeseek" , WINDOW_TIME_SEEK}, // backwards compat
+ {"timeseek" , WINDOW_TIME_SEEK},
{"musicoverlay" , WINDOW_DIALOG_MUSIC_OVERLAY},
{"videooverlay" , WINDOW_DIALOG_VIDEO_OVERLAY},
{"startwindow" , WINDOW_START},
View
102 xbmc/music/windows/GUIWindowVisualisation.cpp
@@ -28,6 +28,8 @@
#include "guilib/GUIWindowManager.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
+#include "input/ButtonTranslator.h"
+#include "utils/TimeUtils.h"
using namespace MUSIC_INFO;
@@ -35,16 +37,35 @@ using namespace MUSIC_INFO;
#define CONTROL_VIS 2
+#define BLUE_BAR 0
+#define LABEL_ROW1 10
+#define LABEL_ROW2 11
+#define LABEL_ROW3 12
+
CGUIWindowVisualisation::CGUIWindowVisualisation(void)
: CGUIWindow(WINDOW_VISUALISATION, "MusicVisualisation.xml"),
m_initTimer(true), m_lockedTimer(true)
{
m_bShowPreset = false;
+ m_timeCodeShow = false;
+ m_timeCodeTimeout = 0;
+ m_timeCodePosition = 0;
+ m_timeCodeStamp[0] = 0;
}
bool CGUIWindowVisualisation::OnAction(const CAction &action)
{
bool passToVis = false;
+ if (m_timeCodePosition > 0 && action.GetButtonCode())
+ { // check whether we have a mapping in our virtual timeseek "window" and have a select action
+ CKey key(action.GetButtonCode());
+ CAction timeSeek = CButtonTranslator::GetInstance().GetAction(WINDOW_TIME_SEEK, key, false);
+ if (timeSeek.GetID() == ACTION_SELECT_ITEM)
+ {
+ g_application.m_pPlayer->SeekTime(GetTimeCodeStamp());
+ return true;
+ }
+ }
switch (action.GetID())
{
case ACTION_VIS_PRESET_NEXT:
@@ -55,6 +76,14 @@ bool CGUIWindowVisualisation::OnAction(const CAction &action)
passToVis = true;
break;
+ case ACTION_PLAYER_PLAY:
+ case ACTION_PAUSE:
+ if (m_timeCodePosition > 0)
+ {
+ g_application.m_pPlayer->SeekTime(GetTimeCodeStamp());
+ return true;
+ }
+ break;
case ACTION_SHOW_INFO:
{
m_initTimer.Stop();
@@ -98,6 +127,18 @@ bool CGUIWindowVisualisation::OnAction(const CAction &action)
g_infoManager.SetShowInfo(true);
}
break;
+ case REMOTE_0:
+ case REMOTE_1:
+ case REMOTE_2:
+ case REMOTE_3:
+ case REMOTE_4:
+ case REMOTE_5:
+ case REMOTE_6:
+ case REMOTE_7:
+ case REMOTE_8:
+ case REMOTE_9:
+ ChangetheTimeCode(action.GetID());
+ break;
// TODO: These should be mapped to it's own function - at the moment it's overriding
// the global action of fastforward/rewind and OSD.
/* case KEY_BUTTON_Y:
@@ -236,5 +277,66 @@ void CGUIWindowVisualisation::FrameMove()
g_infoManager.SetShowCodec(false);
}
}
+ if (m_timeCodeShow && m_timeCodePosition != 0)
+ {
+ if ( (CTimeUtils::GetTimeMS() - m_timeCodeTimeout) >= 2500)
+ {
+ m_timeCodeShow = false;
+ m_timeCodePosition = 0;
+ }
+ CStdString strDispTime = "00:00:00";
+
+ CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1);
+
+ for (int pos = 7, i = m_timeCodePosition; pos >= 0 && i > 0; pos--)
+ {
+ if (strDispTime[pos] != ':')
+ {
+ i -= 1;
+ strDispTime[pos] = (char)m_timeCodeStamp[i] + '0';
+ }
+ }
+
+ strDispTime += "/" + g_infoManager.GetDuration(TIME_FORMAT_HH_MM_SS) + " [" + g_infoManager.GetCurrentPlayTime(TIME_FORMAT_HH_MM_SS) + "]"; // duration [ time ]
+ msg.SetLabel(strDispTime);
+ OnMessage(msg);
+ SET_CONTROL_VISIBLE(LABEL_ROW1);
+ SET_CONTROL_HIDDEN(LABEL_ROW2);
+ SET_CONTROL_HIDDEN(LABEL_ROW3);
+ SET_CONTROL_VISIBLE(BLUE_BAR);
+ }
CGUIWindow::FrameMove();
}
+
+void CGUIWindowVisualisation::ChangetheTimeCode(int remote)
+{
+ if (remote >= REMOTE_0 && remote <= REMOTE_9)
+ {
+ m_timeCodeShow = true;
+ m_timeCodeTimeout = CTimeUtils::GetTimeMS();
+
+ if (m_timeCodePosition < 6)
+ m_timeCodeStamp[m_timeCodePosition++] = remote - REMOTE_0;
+ else
+ {
+ // rotate around
+ for (int i = 0; i < 5; i++)
+ m_timeCodeStamp[i] = m_timeCodeStamp[i+1];
+ m_timeCodeStamp[5] = remote - REMOTE_0;
+ }
+ }
+}
+
+double CGUIWindowVisualisation::GetTimeCodeStamp()
+{
+ // Convert the timestamp into an integer
+ int tot = 0;
+ for (int i = 0; i < m_timeCodePosition; i++)
+ tot = tot * 10 + m_timeCodeStamp[i];
+
+ // Interpret result as HHMMSS
+ int s = tot % 100; tot /= 100;
+ int m = tot % 100; tot /= 100;
+ int h = tot % 100;
+ return (h * 3600 + m * 60 + s)*1000;
+}
View
11 xbmc/music/windows/GUIWindowVisualisation.h
@@ -36,9 +36,20 @@ class CGUIWindowVisualisation :
protected:
virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
+ void ChangetheTimeCode(int remote);
+
+ /*! \brief Convert the current timecode into a time in milliseconds to seek
+ */
+ double GetTimeCodeStamp();
+
CStopWatch m_initTimer;
CStopWatch m_lockedTimer;
bool m_bShowPreset;
MUSIC_INFO::CMusicInfoTag m_tag; // current tag info, for finding when the info manager updates
+
+ bool m_timeCodeShow;
+ unsigned int m_timeCodeTimeout;
+ int m_timeCodeStamp[6];
+ int m_timeCodePosition;
};
View
2  xbmc/video/windows/GUIWindowFullScreen.cpp
@@ -165,7 +165,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
if (m_timeCodePosition > 0 && action.GetButtonCode())
{ // check whether we have a mapping in our virtual videotimeseek "window" and have a select action
CKey key(action.GetButtonCode());
- CAction timeSeek = CButtonTranslator::GetInstance().GetAction(WINDOW_VIDEO_TIME_SEEK, key, false);
+ CAction timeSeek = CButtonTranslator::GetInstance().GetAction(WINDOW_TIME_SEEK, key, false);
if (timeSeek.GetID() == ACTION_SELECT_ITEM)
{
SeekToTimeCodeStamp(SEEK_ABSOLUTE);
Something went wrong with that request. Please try again.