Is smpeg development stopped?
And my big question. I don’t understand why this not plays mpeg files.
The text ‘video update’ only ocurres at call SMPEG_quit. Sorry for the
big paste:
#include <kkvideo.h>
#include <kkag.h>
static void video_update(SDL_Surface* surface, Sint32 x, Sint32 y,
Uint32 w, Uint32 h);
KKVideo::KKVideo(string filename, int repeat)
{
// — load mpeg video —
SMPEG_Info mpeg_info;
m_Video = SMPEG_new(filename.c_str(), &mpeg_info, 1);
if(!m_Video)
{
cerr << "Cannot play video: " << SDL_GetError() << endl;
exit(1);
}
SMPEG_loop(m_Video, repeat);
// --- create video surface ---
m_VideoSurface = SDL_AllocSurface(
SDL_SWSURFACE,
mpeg_info.width,
mpeg_info.height,
32,
0x000000ff,
0x0000ff00,
0x00ff0000,
0xff000000
);
if(!m_VideoSurface)
{
cerr << "Cannot create a software surface: " << SDL_GetError() <<
endl;
exit(1);
}
SMPEG_setdisplay(m_Video, m_VideoSurface, NULL, video_update);
}
KKVideo::~KKVideo()
{
SMPEG_delete(m_Video);
SDL_FreeSurface(m_VideoSurface);
}
void KKVideo::play()
{
SMPEG_play(m_Video);
}
void KKVideo::pause()
{
SMPEG_pause(m_Video);
}
void KKVideo::stop()
{
SMPEG_stop(m_Video);
}
void KKVideo::rewind()
{
SMPEG_rewind(m_Video);
}
void KKVideo::seek(int bytes)
{
SMPEG_seek(m_Video, bytes);
}
void KKVideo::skip(float seconds)
{
SMPEG_skip(m_Video, seconds);
}
bool KKVideo::refresh()
{
return SMPEG_status(m_Video) != SMPEG_PLAYING;
}
static void video_update(SDL_Surface* surface, Sint32 x, Sint32 y,
Uint32 w, Uint32 h)
{
cout << “video update” << endl;
SDL_Rect dst;
dst.x = x;
dst.y = y;
dst.w = w;
dst.h = h;
SDL_BlitSurface(surface, NULL, kkag.system.getBackSurface(), &dst);
}
Thanks for readme!!! 