=== modified file 'src/CMakeLists.txt'
--- old/src/CMakeLists.txt	2012-04-01 21:12:29 +0000
+++ new/src/CMakeLists.txt	2012-04-02 05:33:59 +0000
@@ -40,6 +40,8 @@
 	core/StelShader.cpp
 	core/StelAudioMgr.hpp
 	core/StelAudioMgr.cpp
+	core/StelVideoMgr.hpp
+	core/StelVideoMgr.cpp
 	core/StelGeodesicGrid.cpp
 	core/StelGeodesicGrid.hpp
 	core/StelMovementMgr.cpp
@@ -337,6 +339,7 @@
 # that is, all the headers with SIGNAL/SLOTS/PLUGIN_INTERFACE etc..
 SET(stellarium_MOC_HDRS
 	core/StelAudioMgr.hpp
+	core/StelVideoMgr.hpp
 	core/StelModuleMgr.hpp
 	core/StelObjectMgr.hpp
 	core/StelObserver.hpp

=== modified file 'src/core/StelApp.cpp'
--- old/src/core/StelApp.cpp	2012-03-22 06:18:01 +0000
+++ new/src/core/StelApp.cpp	2012-03-31 17:46:35 +0000
@@ -44,6 +44,7 @@
 #include "StelJsonParser.hpp"
 #include "StelSkyLayerMgr.hpp"
 #include "StelAudioMgr.hpp"
+#include "StelVideoMgr.hpp"
 #include "StelGuiBase.hpp"
 #include "StelPainter.hpp"
 
@@ -292,6 +293,9 @@
 	// Init audio manager
 	audioMgr = new StelAudioMgr();
 
+	// Init video manager
+	videoMgr = new StelVideoMgr();
+
 	// Constellations
 	ConstellationMgr* asterisms = new ConstellationMgr(hip_stars);
 	asterisms->init();

=== modified file 'src/core/StelApp.hpp'
--- old/src/core/StelApp.hpp	2012-02-17 18:12:37 +0000
+++ new/src/core/StelApp.hpp	2012-03-31 17:45:43 +0000
@@ -38,6 +38,7 @@
 class StelLocationMgr;
 class StelSkyLayerMgr;
 class StelAudioMgr;
+class StelVideoMgr;
 class StelGuiBase;
 
 //! @class StelApp
@@ -109,6 +110,9 @@
 	//! Get the audio manager
 	StelAudioMgr* getStelAudioMgr() {return audioMgr;}
 
+	//! Get the video manager
+	StelVideoMgr* getStelVideoMgr() {return videoMgr;}
+
 	//! Get the core of the program.
 	//! It is the one which provide the projection, navigation and tone converter.
 	//! @return the StelCore instance of the program
@@ -226,6 +230,9 @@
 	// The audio manager.  Must execute in the main thread.
 	StelAudioMgr* audioMgr;
 
+	// The video manager.  Must execute in the main thread.
+	StelVideoMgr* videoMgr;
+
 	StelSkyLayerMgr* skyImageMgr;
 
 	StelGuiBase* stelGui;

=== added file 'src/core/StelVideoMgr.cpp'
--- old/src/core/StelVideoMgr.cpp	1970-01-01 00:00:00 +0000
+++ new/src/core/StelVideoMgr.cpp	2012-04-06 13:45:44 +0000
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2012 Sibi Antony
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
+ */
+
+#include "StelVideoMgr.hpp"
+#include "StelMainGraphicsView.hpp"
+#include <QDebug>
+
+
+StelVideoMgr::StelVideoMgr()
+{
+}
+
+#ifdef HAVE_QT_PHONON
+StelVideoMgr::~StelVideoMgr()
+{
+	foreach(QString id, videoObjects.keys())
+	{
+		dropVideo(id);
+	}
+}
+
+void StelVideoMgr::loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha)
+{
+	if (videoObjects.contains(id))
+	{
+		qWarning() << "[StelVideoMgr] Video object with ID" << id << "already exists, dropping it";
+		dropVideo(id);
+	}
+
+	videoObjects[id] = new VideoPlayer;
+	videoObjects[id]->widget = new QWidget();
+	videoObjects[id]->player = new Phonon::VideoPlayer(Phonon::VideoCategory, videoObjects[id]->widget);
+
+	videoObjects[id]->player->load(Phonon::MediaSource(filename));
+	videoObjects[id]->pWidget = 
+		StelMainGraphicsView::getInstance().scene()->addWidget(videoObjects[id]->widget, Qt::FramelessWindowHint);
+
+	videoObjects[id]->pWidget->setPos(x, y);
+	videoObjects[id]->pWidget->setOpacity(alpha);
+	videoObjects[id]->pWidget->setVisible(show);
+	videoObjects[id]->player->show();
+
+}
+
+void StelVideoMgr::playVideo(const QString& id)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->player!=NULL)
+		{
+			// if already playing, stop and play from the start
+			if (videoObjects[id]->player->isPlaying() == true)
+				videoObjects[id]->player->stop();
+
+			// otherwise just play it
+			videoObjects[id]->player->play();
+		}
+}
+
+void StelVideoMgr::pauseVideo(const QString& id)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->player!=NULL)
+			videoObjects[id]->player->pause();
+}
+
+void StelVideoMgr::stopVideo(const QString& id)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->player!=NULL)
+			videoObjects[id]->player->stop();
+}
+
+void StelVideoMgr::seekVideo(const QString& id, qint64 ms)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->player!=NULL) 
+		{
+			if (videoObjects[id]->player->mediaObject()->isSeekable())
+				videoObjects[id]->player->seek(ms);
+			// Seek capability depends on the backend used.
+			else
+				qDebug() << "[StelVideoMgr] Cannot seek media source.";
+		}
+}
+
+void StelVideoMgr::dropVideo(const QString& id)
+{
+	if (!videoObjects.contains(id))
+		return;
+	if (videoObjects[id]->player!=NULL)
+	{
+		videoObjects[id]->player->stop();
+		delete videoObjects[id]->player;
+		delete videoObjects[id]->pWidget;
+		delete videoObjects[id];
+
+		videoObjects.remove(id); 
+	}
+}
+
+void StelVideoMgr::setVideoXY(const QString& id, float x, float y)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->pWidget!=NULL)
+			videoObjects[id]->pWidget->setPos(x, y);
+
+}
+
+void StelVideoMgr::setVideoAlpha(const QString& id, float alpha)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->pWidget!=NULL)
+			videoObjects[id]->pWidget->setOpacity(alpha);
+}
+
+void StelVideoMgr::resizeVideo(const QString& id, float w, float h)
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->pWidget!=NULL)
+		{
+			videoObjects[id]->pWidget->resize(w, h); 
+			videoObjects[id]->player->resize(w, h); 
+		}
+}
+
+void StelVideoMgr::showVideo(const QString& id, bool show) 
+{
+	if (videoObjects.contains(id))
+		if (videoObjects[id]->pWidget!=NULL)
+			videoObjects[id]->pWidget->setVisible(show);
+}
+
+#else  // HAVE_QT_PHONON
+void StelVideoMgr::loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha)
+{
+	qWarning() << "[StelVideoMgr] This build of Stellarium does not support video - cannot load video" << filename << id << x << y << show << alpha;
+}
+StelVideoMgr::~StelVideoMgr() {;}
+void StelVideoMgr::playVideo(const QString&) {;}
+void StelVideoMgr::pauseVideo(const QString&) {;}
+void StelVideoMgr::stopVideo(const QString&) {;}
+void StelVideoMgr::dropVideo(const QString&) {;}
+void StelVideoMgr::seekVideo(const QString&, qint64) {;}
+void StelVideoMgr::setVideoXY(const QString&, float, float) {;}
+void StelVideoMgr::setVideoAlpha(const QString&, float) {;}
+void StelVideoMgr::resizeVideo(const QString&, float, float) {;}
+void StelVideoMgr::showVideo(const QString&, bool) {;}
+#endif // HAVE_QT_PHONON
+
+

=== added file 'src/core/StelVideoMgr.hpp'
--- old/src/core/StelVideoMgr.hpp	1970-01-01 00:00:00 +0000
+++ new/src/core/StelVideoMgr.hpp	2012-04-06 13:45:36 +0000
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 Sibi Antony
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
+ */
+
+#ifndef _STELVIDEOMGR_HPP_
+#define _STELVIDEOMGR_HPP_
+
+#ifdef HAVE_QT_PHONON
+#include <phonon/videoplayer.h>
+#include <phonon/videowidget.h>
+#include <phonon/mediaobject.h>
+#endif
+
+#include <QObject>
+#include <QMap>
+#include <QString>
+#include <QGraphicsProxyWidget>
+
+class StelVideoMgr : public QObject
+{
+	Q_OBJECT
+
+public:
+	StelVideoMgr();
+	~StelVideoMgr();
+
+public slots:
+	void loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha);
+	void playVideo(const QString& id);
+	void pauseVideo(const QString& id);
+	void stopVideo(const QString& id);
+	void dropVideo(const QString& id);
+	void seekVideo(const QString& id, qint64 ms);
+	void setVideoXY(const QString& id, float x, float y);
+	void setVideoAlpha(const QString& id, float alpha);
+	void resizeVideo(const QString& id, float w, float h);
+	void showVideo(const QString& id, bool show);
+
+private:
+#ifdef HAVE_QT_PHONON
+	typedef struct {
+		QWidget *widget;
+		Phonon::VideoPlayer *player;
+		QGraphicsProxyWidget *pWidget;
+	} VideoPlayer;
+	QMap<QString, VideoPlayer*> videoObjects; 
+#endif
+
+};
+
+#endif // _STELVIDEOMGR_HPP_

=== modified file 'src/scripting/StelMainScriptAPI.cpp'
--- old/src/scripting/StelMainScriptAPI.cpp	2012-02-20 06:15:32 +0000
+++ new/src/scripting/StelMainScriptAPI.cpp	2012-04-06 13:39:46 +0000
@@ -33,6 +33,7 @@
 #include "StarMgr.hpp"
 #include "StelApp.hpp"
 #include "StelAudioMgr.hpp"
+#include "StelVideoMgr.hpp"
 #include "StelCore.hpp"
 #include "StelFileMgr.hpp"
 #include "StelLocation.hpp"
@@ -76,6 +77,18 @@
 	connect(this, SIGNAL(requestPauseSound(const QString&)), StelApp::getInstance().getStelAudioMgr(), SLOT(pauseSound(const QString&)));
 	connect(this, SIGNAL(requestStopSound(const QString&)), StelApp::getInstance().getStelAudioMgr(), SLOT(stopSound(const QString&)));
 	connect(this, SIGNAL(requestDropSound(const QString&)), StelApp::getInstance().getStelAudioMgr(), SLOT(dropSound(const QString&)));
+
+	connect(this, SIGNAL(requestLoadVideo(const QString&, const QString&, float, float, bool, float)), StelApp::getInstance().getStelVideoMgr(), SLOT(loadVideo(const QString&, const QString&, float, float, bool, float)));
+	connect(this, SIGNAL(requestPlayVideo(const QString&)), StelApp::getInstance().getStelVideoMgr(), SLOT(playVideo(const QString&)));
+	connect(this, SIGNAL(requestPauseVideo(const QString&)), StelApp::getInstance().getStelVideoMgr(), SLOT(pauseVideo(const QString&)));
+	connect(this, SIGNAL(requestStopVideo(const QString&)), StelApp::getInstance().getStelVideoMgr(), SLOT(stopVideo(const QString&)));
+	connect(this, SIGNAL(requestDropVideo(const QString&)), StelApp::getInstance().getStelVideoMgr(), SLOT(dropVideo(const QString&)));
+	connect(this, SIGNAL(requestSeekVideo(const QString&, qint64)), StelApp::getInstance().getStelVideoMgr(), SLOT(seekVideo(const QString&, qint64)));
+	connect(this, SIGNAL(requestSetVideoXY(const QString&, float, float)), StelApp::getInstance().getStelVideoMgr(), SLOT(setVideoXY(const QString&, float, float)));
+	connect(this, SIGNAL(requestSetVideoAlpha(const QString&, float)), StelApp::getInstance().getStelVideoMgr(), SLOT(setVideoAlpha(const QString&, float)));
+	connect(this, SIGNAL(requestResizeVideo(const QString&, float, float)), StelApp::getInstance().getStelVideoMgr(), SLOT(resizeVideo(const QString&, float, float)));
+	connect(this, SIGNAL(requestShowVideo(const QString&, bool)), StelApp::getInstance().getStelVideoMgr(), SLOT(showVideo(const QString&, bool)));
+
 	connect(this, SIGNAL(requestExit()), this->parent(), SLOT(stopScript()));
 	connect(this, SIGNAL(requestSetNightMode(bool)), &StelApp::getInstance(), SLOT(setVisionModeNight(bool)));
 	connect(this, SIGNAL(requestSetProjectionMode(QString)), StelApp::getInstance().getCore(), SLOT(setCurrentProjectionTypeKey(QString)));
@@ -385,6 +398,67 @@
 	emit(requestDropSound(id));
 }
 
+void StelMainScriptAPI::loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha)
+{
+	QString path;
+	try
+	{
+		path = StelFileMgr::findFile("scripts/" + filename);
+	}
+	catch(std::runtime_error& e)
+	{
+		qWarning() << "cannot play video" << filename << ":" << e.what();
+		return;
+	}
+
+	emit(requestLoadVideo(path, id, x, y, show, alpha));
+}
+
+void StelMainScriptAPI::playVideo(const QString& id)
+{
+	emit(requestPlayVideo(id));
+}
+
+void StelMainScriptAPI::pauseVideo(const QString& id)
+{
+	emit(requestPauseVideo(id));
+}
+
+void StelMainScriptAPI::stopVideo(const QString& id)
+{
+	emit(requestStopVideo(id));
+}
+
+void StelMainScriptAPI::dropVideo(const QString& id)
+{
+	emit(requestDropVideo(id));
+}
+
+void StelMainScriptAPI::seekVideo(const QString& id, qint64 ms)
+{
+	emit(requestSeekVideo(id, ms));
+}
+
+void StelMainScriptAPI::setVideoXY(const QString& id, float x, float y)
+{
+	emit(requestSetVideoXY(id, x, y));
+}
+
+void StelMainScriptAPI::setVideoAlpha(const QString& id, float alpha)
+{
+	emit(requestSetVideoAlpha(id, alpha));
+}
+
+void StelMainScriptAPI::resizeVideo(const QString& id, float w, float h)
+{
+	emit(requestResizeVideo(id, w, h));
+}
+
+void StelMainScriptAPI::showVideo(const QString& id, bool show)
+{
+	emit(requestShowVideo(id, show));
+}
+
 int StelMainScriptAPI::getScreenWidth()
 {
 	return StelMainGraphicsView::getInstance().size().width();

=== modified file 'src/scripting/StelMainScriptAPI.hpp'
--- old/src/scripting/StelMainScriptAPI.hpp	2012-01-11 10:50:37 +0000
+++ new/src/scripting/StelMainScriptAPI.hpp	2012-04-06 13:41:16 +0000
@@ -386,6 +386,63 @@
 	//! @param id the identifier used when loadSound was called
 	void dropSound(const QString& id);
 
+	//! Load a video from a file.
+	//! @param filename the name of the file to load.
+	//! @param id the identifier which will be used to refer to the video
+	//! when calling playVideo, pauseVideo, stopVideo and dropVideo.
+	//! @param x  the x-coordinate for the video widget.
+	//! @param y  the y-coordinate for the video widget.
+	//! @param show  the visibility state for the video.
+	//! @param alpha the initial alpha value of the video.
+	void loadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha);
+
+	//! Play a video which has previously been loaded with loadVideo
+	//! @param id the identifier used when loadVideo was called
+	void playVideo(const QString& id);
+
+	//! Pause a video which is playing.  Subsequent playVideo calls will
+	//! resume playing from the position in the file when it was paused.
+	//! @param id the identifier used when loadVideo was called
+	void pauseVideo(const QString& id);
+
+	//! Stop a video from playing.  This resets the position in the
+	//! video to the start so that subsequent playVideo calls will
+	//! start from the beginning.
+	//! @param id the identifier used when loadVideo was called
+	void stopVideo(const QString& id);
+
+	//! Drop a video from memory.  You should do this before the end
+	//! of your script.
+	//! @param id the identifier used when loadVideo was called
+	void dropVideo(const QString& id);
+
+	//! Seeks a video to the requested time.
+	//! @param id the identifier used when loadVideo was called
+	//! @param ms the time in milliseconds from the start of the media.
+        void seekVideo(const QString& id, qint64 ms);                                   
+
+	//! Sets the position of the video widget.
+	//! @param id the identifier used when loadVideo was called
+	//! @param x the new x-coordinate for the video. 
+	//! @param y the new y-coordinate for the video. 
+        void setVideoXY(const QString& id, float x, float y);                           
+
+	//! Set the alpha value of a video when visible.
+	//! @param id the identifier used when loadVideo was called
+	//! @param alpha the new alpha value to set.
+        void setVideoAlpha(const QString& id, float alpha);                             
+
+	//! Resize the video widget to the specified width, height. 
+	//! @param id the identifier used when loadVideo was called
+	//! @param w the new width for the widget.
+	//! @param h the new height for the widget.
+        void resizeVideo(const QString& id, float w, float h);
+
+	//! Set the visibility state of a video.
+	//! @param id the identifier used when loadVideo was called
+	//! @param show the new visible state of the video.
+        void showVideo(const QString& id, bool show);
+
 	//! Get the screen width in pixels.
 	//! @return The screen width in pixels
 	int getScreenWidth();
@@ -452,6 +509,17 @@
 	void requestPauseSound(const QString& id);
 	void requestStopSound(const QString& id);
 	void requestDropSound(const QString& id);
+	void requestLoadVideo(const QString& filename, const QString& id, float x, float y, bool show, float alpha);
+	void requestPlayVideo(const QString& id);
+	void requestPauseVideo(const QString& id);
+	void requestStopVideo(const QString& id);
+	void requestDropVideo(const QString& id);
+	void requestSeekVideo(const QString& id, qint64 ms);
+	void requestSetVideoXY(const QString& id, float x, float y);
+	void requestSetVideoAlpha(const QString& id, float alpha);
+	void requestResizeVideo(const QString& id, float w, float h);
+	void requestShowVideo(const QString& id, bool show);
+	
 	void requestSetNightMode(bool b);
 	void requestSetProjectionMode(QString id);
 	void requestSetSkyCulture(QString id);

