1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 07:19:54 +00:00
openmw-tes3mp/apps/openmw/mwrender/videoplayer.hpp
2012-09-25 02:54:29 +02:00

110 lines
1.7 KiB
C++

#ifndef MWRENDER_VIDEOPLAYER_H
#define MWRENDER_VIDEOPLAYER_H
//#ifdef OPENMW_USE_FFMPEG
#include <string>
#include <OgreDataStream.h>
#include <OgreTexture.h>
#include <OgreTimer.h>
namespace Ogre
{
class Rectangle2D;
class SceneManager;
class TextureUnitState;
}
struct AVFormatContext;
struct AVCodecContext;
struct AVCodec;
struct AVFrame;
struct SwsContext;
struct AVPacket;
namespace MWRender
{
class VideoPlayer
{
public:
VideoPlayer(Ogre::SceneManager* sceneMgr);
~VideoPlayer();
void play (const std::string& resourceName);
void update();
private:
Ogre::Rectangle2D* mRectangle;
Ogre::TextureUnitState* mTextureUnit;
Ogre::DataStreamPtr mStream;
Ogre::TexturePtr mVideoTexture;
private:
AVFormatContext* mAvContext;
bool mEOF;
Ogre::Timer mTimer;
// VIDEO
AVCodecContext* mVideoCodecContext;
AVCodec* mVideoCodec;
int mVideoStreamId;
AVFrame* mRawFrame;
AVFrame* mRGBAFrame;
SwsContext* mSwsContext;
float mWantedFrameTime;
float mDecodingTime;
std::queue <AVPacket *> mVideoPacketQueue;
int mDisplayedFrameCount;
bool readFrameAndQueue();
bool saveFrame(AVPacket* frame);
void decodeFrontFrame();
void close();
void deleteContext();
void throwError(int error);
};
}
//#else
/*
// If FFMPEG not available, dummy implentation that does nothing
namespace MWRender
{
class VideoPlayer
{
public:
VideoPlayer(Ogre::SceneManager* sceneMgr){}
void play (const std::string& resourceName) {}
void update() {}
};
}
*/
//#endif
#endif