}
}
+
+void CmdPlaylistLoop::execute()
+{
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ if( pPlaylist != NULL )
+ {
+ vlc_value_t val;
+ val.b_bool = m_value;
+ var_Set( pPlaylist , "loop", val);
+ }
+}
+
bool m_value;
};
+/// Command to set the loop state
+class CmdPlaylistLoop: public CmdGeneric
+{
+ public:
+ CmdPlaylistLoop( intf_thread_t *pIntf, bool value ):
+ CmdGeneric( pIntf ), m_value( value ) {}
+ virtual ~CmdPlaylistLoop() {}
+
+ /// This method does the real job of the command
+ virtual void execute();
+
+ /// Return the type of the command
+ virtual string getType() const { return "playlist loop"; }
+
+ private:
+ /// Loop state
+ bool m_value;
+};
+
+
#endif
CmdGenericPtr( new CmdPlaylistRandom( getIntf(), true ) );
m_commandMap["playlist.setRandom(false)"] =
CmdGenericPtr( new CmdPlaylistRandom( getIntf(), false ) );
+ m_commandMap["playlist.setLoop(true)"] =
+ CmdGenericPtr( new CmdPlaylistLoop( getIntf(), true ) );
+ m_commandMap["playlist.setLoop(false)"] =
+ CmdGenericPtr( new CmdPlaylistLoop( getIntf(), false ) );
REGISTER_CMD( "vlc.fullscreen()", CmdFullscreen )
REGISTER_CMD( "vlc.play()", CmdPlay )
REGISTER_CMD( "vlc.pause()", CmdPause )
pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(),
"playlist.slider" );
REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
+ REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
REGISTER_VAR( m_cVarTime, Time, "time" )
REGISTER_VAR( m_cVarVolume, Volume, "volume" )
REGISTER_VAR( m_cVarStream, Stream, "stream" )
VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
+ VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
// Refresh sound volume
audio_volume_t volume;
vlc_value_t val;
var_Get( getIntf()->p_sys->p_playlist, "random", &val );
pVarRandom->set( val.b_bool );
+
+ // Refresh the loop variable
+ var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
+ pVarLoop->set( val.b_bool );
}
/// Getter for the playlist variable
Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
- /// Getter for the random variable
- VarBool &getIsRandomVar() { return *((VarBool*)m_cVarRandom.get()); }
-
/// Getter for the time variable
Time &getTimeVar() { return *((Time*)(m_cVarTime.get())); }
/// Playlist variable
VariablePtr m_cPlaylist;
VariablePtr m_cVarRandom;
+ VariablePtr m_cVarLoop;
/// Variable for current position of the stream
VariablePtr m_cVarTime;
/// Variable for audio volume