20 #ifndef _STELVIDEOMGR_HPP_ 21 #define _STELVIDEOMGR_HPP_ 31 #include <QMediaContent> 32 #include <QMediaPlayer> 33 #include "StelFader.hpp" 35 #include "StelModule.hpp" 37 class QGraphicsVideoItem;
107 virtual void init(){;}
111 virtual void update(
double deltaTime);
119 void loadVideo(
const QString& filename,
const QString&
id,
const float x,
const float y,
const bool show,
const float alpha);
121 void playVideo(
const QString&
id,
const bool keepVisibleAtEnd=
false);
136 void playVideoPopout(
const QString&
id,
float fromX,
float fromY,
float atCenterX,
float atCenterY,
float finalSizeX,
float finalSizeY,
float popupDuration,
bool frozenInTransition);
150 void seekVideo(
const QString&
id,
const qint64 ms,
bool pause=
false);
154 void setVideoXY(
const QString&
id,
const float x,
const float y,
const bool relative=
false);
169 void resizeVideo(
const QString&
id,
float w = -1.0f,
float h = -1.0f);
174 void showVideo(
const QString&
id,
const bool show);
209 void handleAudioAvailableChanged(
bool available);
210 void handleBufferStatusChanged(
int percentFilled);
211 void handleDurationChanged(qint64 duration);
212 void handleError(QMediaPlayer::Error error);
213 void handleMediaStatusChanged(QMediaPlayer::MediaStatus status);
214 void handleMutedChanged(
bool muted);
216 void handleSeekableChanged(
bool seekable);
217 void handleStateChanged(QMediaPlayer::State state);
218 void handleVideoAvailableChanged(
bool videoAvailable);
219 void handleVolumeChanged(
int volume);
222 void handleAvailabilityChanged(
bool available);
223 void handleAvailabilityChanged(QMultimedia::AvailabilityStatus availability);
225 void handleMetaDataChanged();
236 Phonon::VideoPlayer *player;
237 QGraphicsProxyWidget *pWidget;
239 QMap<QString, VideoPlayer*> videoObjects;
244 QGraphicsVideoItem *videoItem;
245 QMediaPlayer *player;
252 QSizeF targetFrameSize;
254 QPointF popupTargetCenter;
257 QMap<QString, VideoPlayer*> videoObjects;
262 #endif // _STELVIDEOMGR_HPP_ bool isVideoPlaying(const QString &id)
returns whether video is currently playing.
void setVideoXY(const QString &id, const float x, const float y, const bool relative=false)
move upper left corner of video id to x, y.
A scriptable way to show videos embedded in the screen.
int getVideoHeight(const QString &id)
returns native height (in pixels) of loaded video, or -1 in case of trouble.
Implementation of StelFader which implements a linear transition.
int getVideoVolume(const QString &id)
return currently set volume (0..100) of media player, or -1 in case of some error.
void dropVideo(const QString &id)
Unload video from memory.
qint64 getVideoDuration(const QString &id)
returns duration (in milliseconds) of loaded video.
void setVideoVolume(const QString &id, int newVolume)
set volume for video. Valid values are 0..100, values outside this range will be clamped.
void resizeVideo(const QString &id, float w=-1.0f, float h=-1.0f)
set video size to width w and height h.
void muteVideo(const QString &id, bool muteVideo=true)
set mute state of video player
void seekVideo(const QString &id, const qint64 ms, bool pause=false)
Seek a position in video id.
void playVideo(const QString &id, const bool keepVisibleAtEnd=false)
play video from current position. If keepLastFrame is true, video pauses at last frame.
int getVideoWidth(const QString &id)
returns native width (in pixels) of loaded video, or -1 in case of trouble.
qint64 getVideoPosition(const QString &id)
returns current position (in milliseconds) of loaded video.
void setVideoAlpha(const QString &id, const float alpha)
sets opacity
virtual void update(double deltaTime)
Update the module with respect to the time.
void stopVideo(const QString &id)
Stop playing, resets video and hides video output window.
void loadVideo(const QString &filename, const QString &id, const float x, const float y, const bool show, const float alpha)
load a video from filename, assign an id for it for later reference.
void playVideoPopout(const QString &id, float fromX, float fromY, float atCenterX, float atCenterY, float finalSizeX, float finalSizeY, float popupDuration, bool frozenInTransition)
Play a video which has previously been loaded with loadVideo() with a complex effect.
void pauseVideo(const QString &id)
Pause video, keep it visible on-screen.
QSize getVideoResolution(const QString &id)
returns resolution (in pixels) of loaded video. Returned value may be invalid before video has been f...
This is the common base class for all the main components of stellarium.
void showVideo(const QString &id, const bool show)
show or hide video player