ページ 1 / 1
pspsdk環境でmake&実行
Posted: 2011年5月29日(日) 18:30
by 通りすがりの学生
test.elf とmakefileでmake&実行をしました。
psp-strip TEST.elf -o TEST_strip.elf
psp-strip: TEST.elf: File format not recognized
make: *** [EBOOT.PBP] Error 1
とでました。 たぶんmakefileかな・・・ 動画を再生させるアプリなのですが・・・
どのように書けば良いでしょうか?
Re: pspsdk環境でmake&実行
Posted: 2011年5月29日(日) 21:07
by system32
そのアプリというのは全てあなたの開発されたものでしょうか?
elfファイルだけでなく.cのファイルも持っていますか?
.oファイルの生成などに問題はありませんでしたか?
一度*.o,*.elf,EBOOT.PBP等のファイルを削除して再びmakeしてみてください
それでもエラーが出るのならmakefileを見せてください
Re: pspsdk環境でmake&実行
Posted: 2011年5月29日(日) 23:20
by 通りすがりの学生
コード:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspaudiolib.h>
#include <pspaudio.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <string.h>
PSP_MODULE_INFO("TEST",0,1,1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
int endflag=0;
FILE *in;
int exit_callback(int arg1,int arg2,void *common)
{
endflag=1;
return 0;
}
int CallbackThread(SceSize args,void *argp)
{
int cbid = sceKernelCreateCallback("Exit Callback",exit_callback,NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
int setupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread",CallbackThread,0x11,0xFA0,0,0);
if(thid >= 0)
sceKernelStartThread(thid,0,0);
return thid;
}
int wavfileheadread(){
char read[50],str[50];/*tmp*/
unsigned int id;/*tmp*/
unsigned long size;/*tmp*/
int lengthofwavefmtchunk,startofdatasecinwavfile;
int datasize;/*datachunksize*/
/* //////////////////////////header check//////////////////////////// */
fgets(read,5,in);
if(strcmp(read,"RIFF")!=0)
{
pspDebugScreenSetXY(0,0);
sprintf(str,"riff mp4head er.");
pspDebugScreenPrintf(str);
}
/* //////////////////////////file size/////////////////////////////// */
size=(long)fgetc(in)|(long)fgetc(in)<<8|(long)fgetc(in)<<16|(long)fgetc(in)<<24;
size+=8;
/* ////////////////////////wave file check/////////////////////////// */
fgets(read,9,in);
if(strcmp(read,"mp4fmt ")!=0)
{
pspDebugScreenSetXY(0,0);
sprintf(str,"mp4fmt mp4 head er.");
pspDebugScreenPrintf(str);
}
/* /////////////////////////length of 'wavefmt 'chank//////////////// */
lengthofwavefmtchunk=(long)fgetc(in)|(long)fgetc(in)<<8|(long)fgetc(in)<<16|(long)fgetc(in)<<24;
/* /////////////////////////format id/////////////////////////////// */
id=(long)fgetc(in)|(long)fgetc(in)<<8;
if(id!=0x1)
{
pspDebugScreenSetXY(0,0);
sprintf(str,"id mp4head er.");
pspDebugScreenPrintf(str);
}
/* ////////////////////////channel///////////////////////////////// */
id=(long)fgetc(in)|(long)fgetc(in)<<8;
/* //////////////////////sampling rate/////////////////////////// */
size=(long)fgetc(in)|(long)fgetc(in)<<8|(long)fgetc(in)<<16|(long)fgetc(in)<<24;
if(size!=44100)
{
pspDebugScreenSetXY(0,0);
sprintf(str,"sr mp4head er.");
pspDebugScreenPrintf(str);
}
/* /////////////////////data speed //////////////////////////// */
size=(long)fgetc(in)|(long)fgetc(in)<<8|(long)fgetc(in)<<16|(long)fgetc(in)<<24;
/* /////////////////////brock size//////////////////////////// */
id=(long)fgetc(in)|(long)fgetc(in)<<8;
/* ////////////////////bits of one sample///////////////////// */
id=(long)fgetc(in)|(long)fgetc(in)<<8;
fseek(in,0x14+lengthofwavefmtchunk,SEEK_SET);
startofdatasecinwavfile=0x14+lengthofwavefmtchunk;
/*factとかある場合を考えた*/
datasize=0x14+lengthofwavefmtchunk;
fseek(in,datasize,SEEK_SET);
while((char)fgetc(in)!='d'){
fseek(in,0x3,SEEK_CUR);
datasize=((long)fgetc(in)|(long)fgetc(in)<<8|(long)fgetc(in)<<16|(long)fgetc(in)<<24);
fseek(in,datasize,SEEK_CUR);
startofdatasecinwavfile+=8+datasize;
}/*while*/
fseek(in,0x3,SEEK_CUR);
datasize=(long)fgetc(in)|(long)fgetc(in)<<8|(long)fgetc(in)<<16|(long)fgetc(in)<<24;
startofdatasecinwavfile+=8;
return(datasize);
}//func
int main(int argc,char *argv[])
{
int ret=0,pcmhandle;
char str[50],pcmbuf[128000];
//homeボタンコールバック
setupCallbacks();
//pspDebugScreenなんたら使うのの初期化
pspDebugScreenInit();
//カレントディレクトリのc_FANG.mp4というファイルを再生する。
if((in=fopen("FANG.mp4","rb"))==NULL){
pspDebugScreenSetXY(0,0);
sprintf(str,"file open failed.");
pspDebugScreenPrintf(str);
endflag=1;
}
//wavファイルヘッダーを処理。
wavfileheadread();
//オーディオ出力初期化割り当て バッファ最大、ステレオで
pcmhandle=ret=sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL,PSP_AUDIO_SAMPLE_MAX,PSP_AUDIO_FORMAT_STEREO);
if(ret<0){//失敗
pspDebugScreenSetXY(0,0);
sprintf(str,"pcm open failed.");
pspDebugScreenPrintf(str);
endflag=1;
}
else{//成功
pspDebugScreenSetXY(0,0);
sprintf(str,"pcm open ok.");
pspDebugScreenPrintf(str);
}
//再生するループ
while(feof(in)==0&&endflag==0){//homeボタンで終わりを指定するか、ファイルが最後まで行ったらループ抜ける。
//ファイルから読み込み。サンプル指定なので*2(ステレオ)*2(16bit)なんかおかしい気もするけどこうなってる。
fread(pcmbuf,1,PSP_AUDIO_SAMPLE_MAX*2*2,in);
//ボリューム最大で(これも最大かはあやしい。)再生。
sceAudioOutputBlocking(pcmhandle,PSP_AUDIO_VOLUME_MAX,pcmbuf);
}
//解放
sceAudioChRelease(pcmhandle);
//終了
sceKernelExitGame();
return 0;
}
です。自分ではないのですが、fmtをmp4にかえてみたのです。
Re: pspsdk環境でmake&実行
Posted: 2011年5月29日(日) 23:26
by 通りすがりの学生
すいませんが、どのようにしたら、pspのゲームのOP的なものをめざしたいので・・・
書けば良いですか?
Re: pspsdk環境でmake&実行
Posted: 2011年5月30日(月) 18:11
by 通りすがりの学生
動画をpspで再生すると・・・
途中で音が固まりかくかく状態になってしまうので・・・
ゲーム形式にしてなんとかそこを解決したいと思い、質問を投稿しました。 (追伸)
Re: pspsdk環境でmake&実行
Posted: 2011年5月30日(月) 18:19
by system32
http://www7.atwiki.jp/pspprogram/pages/35.html
このサイトからの引用のようですね
まず結論から言いますがこれをmakeできたとしてもmp4は再生できません
そもそもmp4とwavの違いってご存知ですか?もう少しコンピュータの基礎知識を学ばれてはいかがですか?
そいでもって質問の答えですがmakefile見てないので分かりませんがコンパイラに渡すライブラリかなんか抜けてるんじゃないですか?(音の再生はあんまりやったこと無いのではっきりしたことは言えないが)
今調べてますんでもう少し待ってて下さい
Re: pspsdk環境でmake&実行
Posted: 2011年5月30日(月) 18:21
by system32
そうだったんですか
失礼なこと言って申し訳ありませんでした
簡単に言うとwavは音だけ格納してmp4は動画を格納します
このプログラムをwavの音を取り出すだけなのでmp4は無理とそう言いたかったのです
たしか動画再生関係のAPIはあまり解析されていなかったともいます(そもそもそんなのあったかな?)
ですので自分でプログラムを組むのは諦めて2chや知恵袋などでなぜPSPの動画再生がおかしくなるのかを聞いたほうが得策かと思います
Re: pspsdk環境でmake&実行
Posted: 2011年5月30日(月) 18:55
by bitter_fox
mp4(MPEG-4)を再生するにはpspmpeg.hの関数を用いる必要があるのではないでしょうか?
http://psp.jim.sh/pspsdk-doc/pspmpeg_8h.html