1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 10:19:55 +00:00
openmw-tes3mp/apps/openmw/mwrender/videoplayer.hpp

111 lines
1.7 KiB
C++
Raw Normal View History

2012-09-25 00:35:50 +00:00
#ifndef MWRENDER_VIDEOPLAYER_H
#define MWRENDER_VIDEOPLAYER_H
//#ifdef OPENMW_USE_FFMPEG
#include <string>
#include <OgreDataStream.h>
#include <OgreTexture.h>
2012-09-25 00:54:29 +00:00
#include <OgreTimer.h>
2012-09-25 00:35:50 +00:00
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;
2012-09-25 00:54:29 +00:00
Ogre::Timer mTimer;
2012-09-25 00:35:50 +00:00
// VIDEO
AVCodecContext* mVideoCodecContext;
AVCodec* mVideoCodec;
int mVideoStreamId;
AVFrame* mRawFrame;
AVFrame* mRGBAFrame;
SwsContext* mSwsContext;
float mWantedFrameTime;
float mDecodingTime;
std::queue <AVPacket *> mVideoPacketQueue;
2012-09-25 00:54:29 +00:00
int mDisplayedFrameCount;
2012-09-25 00:35:50 +00:00
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