video with smpeg problem
Posted: Fri Jul 28, 2006 8:19 pm
Hello
I use smpeg for load video mpeg1 and found problems.
If run by network with ps2link program can display video mpeg1 correct but when change prorgam run from memorycard or burn to cd-rom then video mpeg1 not display on screen
is show black screen. Why program run by ps2link can display video correct but run from memorycard or cd-rom it not work ? Please suggest me.
best regards
wing64
file .elf here http://www.geocities.com/web13c/s200.zip
sourcecode here
I use smpeg for load video mpeg1 and found problems.
If run by network with ps2link program can display video mpeg1 correct but when change prorgam run from memorycard or burn to cd-rom then video mpeg1 not display on screen
is show black screen. Why program run by ps2link can display video correct but run from memorycard or cd-rom it not work ? Please suggest me.
best regards
wing64
file .elf here http://www.geocities.com/web13c/s200.zip
sourcecode here
Code: Select all
#include <tamtypes.h>
#include <kernel.h>
#include <sifrpc.h>
#include <iopheap.h>
#include <loadfile.h>
#include <iopcontrol.h>
#include <cdvd_rpc.h>
#include <fileio.h>
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include "SDL.h"
#include "smpeg.h"
#include "pak.h"
#include "romfs.h"
#include "romfs_io.h"
extern u8 *cdvd_irx;
extern int size_cdvd_irx;
extern u8 *fileXio_irx;
extern int size_fileXio_irx;
extern u8 *iomanX_irx;
extern int size_iomanX_irx;
extern u8 *ps2dev9_irx;
extern int size_ps2dev9_irx;
extern u8 *ps2fs_irx;
extern int size_ps2fs_irx;
extern u8 *ioptrap_irx;
extern int size_ioptrap_irx;
extern u8 *poweroff_irx;
extern int size_poweroff_irx;
int have_cdvd = 0;
SDL_Surface *screen;
void loadCdModules(void)
{
int ret;
if (!have_cdvd)
{ SifExecModuleBuffer(&cdvd_irx, size_cdvd_irx, 0, NULL, &ret);
CDVD_Init();
have_cdvd = 1;
}
SifExecModuleBuffer(&fileXio_irx, size_fileXio_irx, 0, NULL, &ret);
SifExecModuleBuffer(&iomanX_irx, size_iomanX_irx, 0, NULL, &ret);
SifExecModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, &ret);
SifExecModuleBuffer(&ps2fs_irx, size_ps2fs_irx, 0, NULL, &ret);
SifExecModuleBuffer(&ioptrap_irx, size_ioptrap_irx, 0, NULL, &ret);
SifExecModuleBuffer(&poweroff_irx, size_poweroff_irx, 0, NULL, &ret);
}
void loadBasicModules(void)
{
//if (!have_sio2man)
{ SifLoadModule("rom0:SIO2MAN", 0, NULL);
//have_sio2man = 1;
}
//if (!have_mcman)
{ SifLoadModule("rom0:MCMAN", 0, NULL);
//have_mcman = 1;
}
//if (!have_mcserv)
{ SifLoadModule("rom0:MCSERV", 0, NULL);
//have_mcserv = 1;
}
//if (!have_padman)
{ SifLoadModule("rom0:PADMAN", 0, NULL);
//have_padman = 1;
}
}
//------------------------------
//endfunc loadBasicModules
//--------------------------------------------------------------
void update(SDL_Surface *cscreen, Sint32 x, Sint32 y, Uint32 w, Uint32 h)
{
if ( screen->flags & SDL_DOUBLEBUF )
{
printf( "" );
SDL_Flip(screen);
}
}
int main(int argc, char *argv[])
{
SMPEG_Info movinfo;
SMPEG* mov;
char *bootPath;
loadBasicModules( );
loadCdModules( );
/* Initialize the SDL library */
if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0 ) {
fprintf(stderr,
"Couldn't initialize SDL: %s\n", SDL_GetError());
exit(1);
}
/* Clean up on exit */
atexit(SDL_Quit);
/*
* Initialize the display in a 640x480 8-bit palettized mode,
* requesting a software surface
*/
screen = SDL_SetVideoMode(320, 240, 16, SDL_FULLSCREEN | SDL_SWSURFACE );
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
SDL_GetError());
exit(1);
}
extern unsigned char romdisk_start[];
char *ptr; //ptr on datastruc file
SDL_RWops *context;
romdisk_mount(romdisk_start);
rfs_init();
rfs_open( "all2.mpg" );
ptr = (char *)malloc(sizeof(char)*(rfs_size()+1));
rfs_read(ptr,rfs_size());
context = SDL_RWFromMem(ptr,rfs_size());
mov = SMPEG_new_rwops( context, &movinfo, 0);
if( !mov )
{
printf( "error all2.mpg...\n" );
return -1;
}
SMPEG_setdisplay(mov, screen, NULL,NULL);
SMPEG_enableaudio(mov, 0);
SMPEG_enablevideo(mov, 1);
SMPEG_loop( mov, 1 );
SMPEG_play( mov );
while( 1 )
{
printf( "" );
SDL_Event event;
while ( SDL_PollEvent(&event) )
{
switch (event.type) {
case SDL_KEYDOWN:
if ( event.key.keysym.sym == SDLK_ESCAPE ) {
SMPEG_stop( mov );
}
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_QUIT:
SMPEG_stop( mov );
break;
}
}
SDL_Flip( screen );
}
SMPEG_delete( mov );
SDL_FreeSurface( screen );
return 0;
}