Jump to content
  • Advertisement
Sign in to follow this  
ShyAngel

error when running SDL SMPEG

This topic is 2734 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

i got error saying the procedure entry point SMPEG_delete could not be locate in SDL_mixer, it happens when i run exe directly, if i use compiler (dev cpp) it only show command console then closed no sdl surface and no error message.
i use source that came from this forum

#include <SDL/SDL.h>
#include <SMPEG/smpeg.h>
#include <iostream>

// Surface for the main screen
SDL_Surface *screen;

// Surface for the movie
SDL_Surface *movieSurface = 0;

// Holds the movie information
SMPEG_Info movieInfo;

// Load the movie
SMPEG *movie = 0;

void DrawIMG(SDL_Surface *img, int x, int y)
{
SDL_Rect dest;
dest.x = x;
dest.y = y;
SDL_BlitSurface(img, NULL, screen, &dest);
}

int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
{
std::cout<<"Unable to init SDL: %s\n"<< SDL_GetError();
// return -1;
}

screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_ANYFORMAT);

if (screen == NULL)
{
std::cout<<"Unable to set 640x480 video: %s\n"<<SDL_GetError();
// return -1;
}

// Load the movie and store the information about it
movie = SMPEG_new("C:/Dev-Cpp/Examples/SMPEG/test.mpg", &movieInfo, true);

char* error = SMPEG_error(movie);

if( error != NULL || movie == NULL )
{
std::cout<<"Error loading MPEG: %s\n"<<error ;
// return -1;
}

// Create a temporary surface to render the movie to
SDL_Surface *tempSurface2 = SDL_CreateRGBSurface(SDL_SWSURFACE,
movieInfo.width, movieInfo.height, 32, screen->format->Rmask,
screen->format->Gmask, screen->format->Bmask, screen->format->Amask);

// Now make a surface optimized for the main screen
movieSurface = SDL_DisplayFormat(tempSurface2);

// Free the temporary surface
SDL_FreeSurface(tempSurface2);

// Set the surface to draw to
SMPEG_setdisplay(movie, movieSurface, 0, 0);

// Set the display region
SMPEG_setdisplayregion(movie, 0, 0, movieInfo.width, movieInfo.height);

// Loop forever
SMPEG_loop(movie, -1);

SDL_ShowCursor(SDL_DISABLE);

int done = 0;

SMPEG_play(movie);
SMPEG_getinfo(movie, &movieInfo);

while(done == 0)
{
SDL_Event event;

while (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT)
{
done = 1;
}

if (event.type == SDL_KEYDOWN)
{
if (event.key.keysym.sym == SDLK_ESCAPE)
{
done = 1;
}
}
}

DrawIMG(movieSurface, 0, 0);

// Flip the main screen
SDL_Flip(screen);
}

SDL_FreeSurface(movieSurface);
SMPEG_stop(movie);
SMPEG_delete(movie);
movie = NULL;
SDL_ShowCursor(SDL_ENABLE);

return 0;
}


Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!