Jump to content
  • Advertisement
Sign in to follow this  

Smpeg won't stop playing

This topic is 4644 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! In the project I'm currently working on we need to play a introsequence in the beginning of the game. We're using SDL and mpegfiles so I figured the easiest alternetive would be the SMPEGlibrary. After some installing and testing the video showed with sound on the screen, the only problem is that I can't pick up signals from the keyboard while playing the video. This is the templatecode of an example included in the downloaded version throught dev-cpp (extended with some keyreadingcode):
SDL with SMPEG - Test

Hint: in the path of the EXE must exist a test.mpg!
in Examples\SMPEG you will find a MPEG-1 file :)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h>

#include <SMPEG/smpeg.h>

SDL_Surface *screen = NULL;

void shutdown(void){

int main(int argc, char *argv[]){


    screen = SDL_SetVideoMode(640,480,32,SDL_HWSURFACE | SDL_DOUBLEBUF);
    SDL_WM_SetCaption("Dev-C++ SMPEG-Lib Test", NULL);

	SMPEG_Info mpg_info;
	SMPEGstatus mpg_status;
	SMPEG* mpg = SMPEG_new("test.mpg",&mpg_info,1);
	mpg_status = SMPEG_status(mpg);
	while(mpg_status == SMPEG_PLAYING){
       SDL_Event event;
        while ( SDL_PollEvent(&event) )
              if ( event.type == SDL_QUIT )  {SMPEG_stop(mpg); }
              if ( event.type == SDL_KEYDOWN )
                   if ( event.key.keysym.sym == SDLK_ESCAPE ) {SMPEG_stop(mpg);}
		mpg_status = SMPEG_status(mpg);
	mpg = NULL;

    return 0;

The code seems to freeze at the "SMPEG_play(mpg);"-line, nothing appears to happen after the call of that function, until the end of the movie. I've tried several other examples (compiled in VC6) and the exe-files runs fine with inputhandling, but if I try to compile the exact same code in dev-cpp (gcc, g++) it doesn't respond on a keydown. Thanks! //David

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!