Video Playlist - Enable Looping

From LinuxMCE
Jump to: navigation, search


Introduction

When playing an audio playlist it automatically 'loops'. Meaning when it reaches the end of the playlist it will automatically begin playing it from the beginning. However, video playlists do not act in this way. When a video playlist reaches the end it simply stops playing and returns you to the screen saver. This article is the instruction to change this default behavior for video playlists so they loop as the audio does.

Disclaimer

This process involves changing pluto system files and as with anytime you're doing that, you could break your installation with a misstep. If you do, don't say I didn't warn you.

Setting up the development environment

Run the following as root:

apt-get install subversion build-essential ccache libmysqlclient15-dev libattr1-dev
cd ~/
svn co http://svn.linuxmce.org/svn/branches/LinuxMCE-0710/
cd LinuxMCE-0710
cp /usr/pluto/lib/* src/lib
find . -iname Makefile -exec sed -e 's/<-mkr_t_compile_defines->/-DKDE_LMCE -DDEBUG -DTHREAD_LOG -DLOG_ALL_QUERIES -I\/opt\/libxine1-pluto\/include -I\/opt\/libsdl1.2-1.2.7+1.2.8cvs20041007\/include -I\/opt\/libsdl1.2-1.2.7+1.2.8cvs20041007\/include\/SD/' -i '{}' \;
find . -iname Makefile -exec sed -e 's/<-mkr_t_compile_libs->/-L\/opt\/libxine1-pluto\/lib -L\/opt\/libsdl1.2-1.2.7+1.2.8cvs20041007\/lib/' -i '{}' \;

You now have a development environment setup.

Modifying the Xine Plugin

cd ~/LinuxMCE-0710/src/Xine_Plugin

With whatever editor you like, open the file called: XineMediaStream.cpp

You will see this at the bottom of the file:

	{
		// do not remove the playlist when we are playing stored audio. (it will just confuse the user)
		if ( m_iPK_MediaType == MEDIATYPE_pluto_StoredAudio_CONST && m_iRepeat != -1)
			return true;

		return MediaStream::CanPlayMore();
	}

Change it to look like this:

	{
		// do not remove the playlist when we are playing stored audio. (it will just confuse the user)
		if ( m_iPK_MediaType == MEDIATYPE_pluto_StoredAudio_CONST && m_iRepeat != -1)
			return true;

 		if ( m_iPK_MediaType == MEDIATYPE_pluto_StoredVideo_CONST && m_iRepeat != -1)
 			return true;
  
		if ( m_iPK_MediaType == MEDIATYPE_pluto_DVD_CONST && m_iRepeat != -1)
			return true;

 
 		return MediaStream::CanPlayMore();
	}

Notice that all we did is duplicate the if statement and changed StoredAudio to StoredVideo and DVD.

Save the file

Run as root:

make so
cp XineMediaStream.so /usr/pluto/bin

Do a reload of your router and your video playlists now automatically loop.