forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

video with smpeg problem

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
wing64



Joined: 09 Apr 2006
Posts: 15

PostPosted: Fri Jul 28, 2006 8:19 pm    Post subject: video with smpeg problem Reply with quote

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
Code:
#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;
}

_________________
kjdflkdfdfsdf
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group