Linux-7.0 mpeg player segmentation fault

Hi,
I am a newbie to SDL .I just edited the program
plaympeg.c in the smpeg0.4.2 version and my SDL version 1.1.7.
When ever i compile and play the program with my mpeg file its giving
either segmentation fault or segmentation fault and SDL Parachute
Deployed.
I am sending my program as an attachment.
Kindly go throught this…
Looking for a positive response…
everyours
S.PraveenKumar
(@praveen_at_gdit.iiit)
-------------- next part --------------
#include<iostream.h>
#include<smpeg/smpeg.h>
#include<stdlib.h>
#include<stdio.h>
#include<SDL.h>
#include<SDL_thread.h>
void update(SDL_Surface screen,Sint32 x,Sint32 y,Uint32 w,Uint32 h)
{
if(screen->flags & SDL_DOUBLEBUF)
SDL_Flip(screen);
}
int main(int argc,char
argv[])
{
SDL_Surface *screen;
SMPEG *mpeg;
SMPEG_Info info;
char *basefile;
SDL_version sdlver;
SMPEG_version smpegver;
int fd;
char buf[32];
int bilinear_filtering;

int use_audio=1;
int use_video=1;
int fullscreen=0;
int volume=100;
int scale_width=0,scale_height=0;	
int scalesize=1;
SDL_mutex *screenlock;
bilinear_filtering =0;
if(!argv[1])
	{
	cout<<"Usage::"<<argv[0]<<" filename"<<endl;
	exit(0);
	}

mpeg=SMPEG_new(argv[1],&info,use_audio);
if(SMPEG_error(mpeg))
	{
	cout<< "In "<<argv[1]<<" there is "<<SMPEG_error(mpeg); 
	exit(0);
	}
if(use_video)
   if(SDL_Init(SDL_INIT_VIDEO)< 0)	
	cout<<"WARNING:: couldn't open init SDL Video "<<SDL_GetError();
if(use_audio)
	if(SDL_Init(SDL_INIT_AUDIO) <0)
		cout<<"WARNING:: couldn't opne init SDL Audio "<<SDL_GetError();


SDL_VERSION(&sdlver);
SMPEG_VERSION(&smpegver);
cout<<"Sdl version "<<(int)sdlver.major<<"."<<(int)sdlver.minor<<"."<<(int)sdlver.patch<<endl;
cout<<"Smpeg version "<<(int)smpegver.major<<"."<<(int)smpegver.minor<<"."<<(int)smpegver.patch<<endl;	
if(bilinear_filtering)
	{
	SMPEG_Filter *filter;
	filter=SMPEGfilter_bilinear();
	filter=SMPEG_filter(mpeg,filter);
	filter->destroy(filter);
	}
cout<<info.has_audio<<info.has_video<<endl;	
if(info.has_audio && info.has_video)
	cout<<"The Mpeg "<<argv[1]<<" has both audio and Video"<<endl;
else if(info.has_audio)
	cout<<"The Mpeg "<<argv[1]<<" has only audio"<<endl;
else if(info.has_video)
	cout<<"The Mpeg "<<argv[1]<<" has only video"<<endl;
if(info.total_size)
	cout<<"The size of the mpeg is "<<info.total_size<<endl;
if(info.total_time)
	cout<<"The total time of the mpeg is "<<info.total_time<<endl;

if(info.has_video && use_video)
	{
	const SDL_VideoInfo *video_info;
	Uint32 video_flags;
	int video_bpp;
	int width,height;
	video_info=SDL_GetVideoInfo();
	switch(video_info->vfmt->BitsPerPixel)
		{
		case 16:
		case 32:
			video_bpp=video_info->vfmt->BitsPerPixel;
			break;
		default:
			video_bpp=16;
			break;
		}
		cout<<"Bits per Pixel is :: "<<video_bpp<<endl;		
	
	if(scale_width)
		width=scale_width;
	else
		width=info.width;
	width*=scalesize;
	if(scale_height)
		height=scale_height;
	else
		height=info.height;
	height*=scalesize;
	cout<<"The Window Size is ::"<<"Width:"<<width<<" Height:"<<height<<endl;
	video_flags=SDL_SWSURFACE|SDL_ASYNCBLIT;
	if(fullscreen)
		video_flags=SDL_FULLSCREEN| SDL_DOUBLEBUF | SDL_HWSURFACE;
	video_flags |=SDL_RESIZABLE;
	
	screen=SDL_SetVideoMode(width,height,video_bpp,video_flags);
	
	if(screen==NULL)
		cout<<" Unable to set "<<width<<"x"<<height<<" Video mode"<<endl;
	
	if(screen->flags & SDL_FULLSCREEN)
		SDL_ShowCursor(0);
	screenlock=SDL_CreateMutex();
	SMPEG_enableaudio(mpeg,use_audio);
	SMPEG_enablevideo(mpeg,use_video);
	SMPEG_setvolume(mpeg,volume);

	SMPEG_setdisplay(mpeg,screen,screenlock,update);
	SMPEG_scaleXY(mpeg,screen->w,screen->h);
	}
	else{
		SDL_QuitSubSystem(SDL_INIT_VIDEO);
	}
	int done=0;
	SMPEG_play(mpeg);
//	SDL_SaveBMP(screen,"Praveen.bmp");
	while(!done &&(SMPEG_status(mpeg)==SMPEG_PLAYING))
		{
		SDL_Event event;
		if(! SDL_PollEvent(&event))
			SDL_Delay(500);
		switch (event.type) {
			case SDL_VIDEORESIZE:
				break;
			case SDL_KEYDOWN:
				break;
			case SDL_QUIT:
				done=1;
				break;
			default:
				break;
			}
		}
	if(mpeg)  
		SMPEG_delete(mpeg);
	SDL_DestroyMutex(screenlock);
	SDL_Quit();
cout<<"hello";	
}