a sample to decode a psp mp4(avc) file

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

a sample to decode a psp mp4(avc) file

Post by cooleyes »

Here is a sample code to decode a psp mp4(avc) file.
to decode mp4(avc), we need a mpeg_vsh.prx from psp fw (ver > 2.00)
so I use the mpeg_vsh.prx from psp fw(3.30),
I decompress and decrypt mpeg_vsh.prx from psp fw(3.30) and rename to mpeg_vsh330.prx , and use it to decode mp4(avc)

now, I can decode <=480*272 avc frame from psp mp4 file,
and I am trying to decode 720*480 avc frame from psp mp4 file.

Code: Select all

/* 
 *	Copyright &#40;C&#41; 2008 cooleyes
 *	eyes.cooleyes@gmail.com 
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or &#40;at your option&#41;
 *  any later version.
 *   
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *   
 *  You should have received a copy of the GNU General Public License
 *  along with GNU Make; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *  http&#58;//www.gnu.org/copyleft/gpl.html
 *
 */
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <psputils.h>
#include <pspgu.h>
#include <pspdebug.h>
#include <psppower.h>
#include <stdio.h>
#include <stdlib.h>
#include <psprtc.h>
#include <pspsdk.h>
#include <string.h>
#include <malloc.h>
#include "mem64.h"
#include "pspmpeg/pspmpeg.h"
#include "mp4ff.h"

int SetupCallbacks&#40;&#41;;

PSP_MODULE_INFO&#40;"avcdecode test", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;
PSP_HEAP_SIZE_KB&#40;18*1024&#41;;

SceCtrlData input;

typedef struct &#123;
	ScePVoid sps_buffer;
	SceInt32 sps_size;
	ScePVoid pps_buffer;
	SceInt32 pps_size;
	SceInt32 unkown0;
	ScePVoid nal_buffer;
	SceInt32 nal_size;
	SceInt32 mode;
&#125; AvcNalStruct;

typedef struct &#123;
	SceInt32 unknown0;
	SceInt32 unknown1;
	SceInt32 width;
	SceInt32 height;
	SceInt32 unknown4;
	SceInt32 unknown5;
	SceInt32 unknown6;
	SceInt32 unknown7;
	SceInt32 unknown8;
	SceInt32 unknown9;
&#125; AvcInfoStruct;

typedef struct &#123;
	ScePVoid buffer0;
	ScePVoid buffer1;
	ScePVoid buffer2;
	ScePVoid buffer3;
	ScePVoid buffer4;
	ScePVoid buffer5;
	ScePVoid buffer6;
	ScePVoid buffer7;
	SceInt32 unknown0;
	SceInt32 unknown1;
	SceInt32 unknown2;
&#125; AvcYuvStruct;


typedef struct &#123;
	SceInt32 unknown0;
	SceInt32 unknown1;
	SceInt32 unknown2;
	SceInt32 unknown3;
	AvcInfoStruct* info_buffer;
	SceInt32 unknown5;
	SceInt32 unknown6;
	SceInt32 unknown7;
	SceInt32 unknown8;
	SceInt32 unknown9;
	SceInt32 unknown10;
	AvcYuvStruct* yuv_buffer;
	SceInt32 unknown12;
	SceInt32 unknown13;
	SceInt32 unknown14;
	SceInt32 unknown15;
	SceInt32 unknown16;
	SceInt32 unknown17;
	SceInt32 unknown18;
	SceInt32 unknown19;
	SceInt32 unknown20;
	SceInt32 unknown21;
	SceInt32 unknown22;
	SceInt32 unknown23;
&#125; AvcCodecStruct;

typedef struct &#123;
	SceInt32 height;
	SceInt32 width;
	SceInt32 mode0;
	SceInt32 mode1;
	ScePVoid buffer0;
	ScePVoid buffer1;
	ScePVoid buffer2;
	ScePVoid buffer3;
	ScePVoid buffer4;
	ScePVoid buffer5;
	ScePVoid buffer6;
	ScePVoid buffer7;
&#125; AvcCscStruct;

typedef struct &#123;
	ScePVoid mpeg_buffer;
	SceMpeg mpeg;
	SceMpegRingbuffer mpeg_ringbuffer;
	SceMpegAu* mpeg_au;
	SceInt32 mpeg_mode;
	SceInt32 mpeg_buffer_size;
	ScePVoid mpeg_ddrtop;
	ScePVoid mpeg_au_buffer;
	AvcNalStruct mpeg_nal;
	AvcCodecStruct* mpeg_codec_buffer;
	AvcYuvStruct* mpeg_yuv_buffer;
	AvcInfoStruct* mpeg_info_buffer;	
&#125; AvcDecodeStruct;

static uint32_t mp4_read&#40;void *user_data, void *buffer, uint32_t length&#41; &#123;
	FILE** fp = &#40;FILE**&#41;user_data;
	uint32_t res = fread&#40;buffer, length, 1, *fp&#41;;
	return &#40;res*length&#41;;
&#125;

static uint32_t mp4_seek&#40;void *user_data, uint64_t position&#41; &#123;
	FILE** fp = &#40;FILE**&#41;user_data;
	return fseek&#40;*fp, position, PSP_SEEK_SET &#41;;
&#125;

AvcDecodeStruct avc_struct;
AvcDecodeStruct* avc = &avc_struct;
AvcCscStruct csc_struct;
AvcCscStruct* csc = &csc_struct;
//unsigned char RGBBuffer&#91;4*512*512&#93;;
unsigned char RGBBuffer0&#91;4*512*272&#93;;
unsigned char RGBBuffer1&#91;4*512*272&#93;;
unsigned char* FrameBuffer&#91;&#93; = &#123;RGBBuffer0, RGBBuffer1&#125;;
int frame_index = 0;
char filename&#91;1024&#93;;

mp4ff_callback_t mp4_callback = &#123;mp4_read, 0, mp4_seek, 0, 0&#125;;

int main&#40;void&#41;
&#123;
	SetupCallbacks&#40;&#41;;
	
	pspDebugScreenInit&#40;&#41;;
	pspDebugScreenSetXY&#40;0, 2&#41;;
	//scePowerSetClockFrequency&#40;333,333,166&#41;;
	//scePowerSetCpuClockFrequency&#40;333&#41;;
	//scePowerSetBusClockFrequency&#40;166&#41;;
	scePowerSetClockFrequency&#40;133,133,66&#41;;
	scePowerSetCpuClockFrequency&#40;133&#41;;
	scePowerSetBusClockFrequency&#40;66&#41;;
	u32 cpu = scePowerGetCpuClockFrequency&#40;&#41;;
	u32 bus = scePowerGetBusClockFrequency&#40;&#41;;
	
	pspDebugScreenPrintf&#40;"cpu=%d, bus=%d\n", cpu, bus&#41;;
	
	getcwd&#40;filename, 256&#41;;
	strcat&#40;filename, "/mpeg_vsh330.prx"&#41;;
	pspDebugScreenPrintf&#40;"%s\n", filename&#41;;
	
	FILE* mp4_file = fopen&#40;"ms0&#58;/VIDEO/Test.MP4", "rb"&#41;;
	mp4_callback.user_data = &mp4_file;
	mp4ff_t* mp4_handle = mp4ff_open_read&#40;&mp4_callback&#41;;
	u32 total_tracks = mp4ff_total_tracks&#40;mp4_handle&#41;;
	pspDebugScreenPrintf&#40;"total_tracks=%d\n", total_tracks&#41;;
	int ii;
	for&#40;ii = 0; ii < total_tracks; ii++&#41; &#123;
		pspDebugScreenPrintf&#40;"track%d &#58; type 0x%08X\n", ii, mp4ff_get_track_type&#40;mp4_handle, ii&#41;&#41;;
		pspDebugScreenPrintf&#40;"track%d &#58; %d samples\n", ii, mp4ff_num_samples&#40;mp4_handle, ii&#41;&#41;;
	&#125;
	u32 total_samples = mp4ff_num_samples&#40;mp4_handle, 0&#41;;
	unsigned char* sps_pps_buffer;
	unsigned int sps_size, pps_size;
	
	if &#40; mp4ff_get_avc_sps_pps&#40;mp4_handle, 0, &sps_pps_buffer, &sps_size, &pps_size&#41; != 0 || sps_size == 0 || pps_size == 0 &#41;  &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; get_avc_sps_pps\n"&#41;;
		goto wait;
	&#125;
	
	//pspDebugScreenPrintf&#40;"sps_size=%d, pps_size=%d\n", sps_size, pps_size&#41;;
	
	int result;
	result = sceUtilityLoadAvModule&#40;0&#41;;
	if &#40; result < 0 &#41; &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceUtilityLoadAvModule&#40;0&#41;\n"&#41;;
		goto wait;
	&#125;
	
	SceUID modid;
	int status;
	modid = sceKernelLoadModule&#40;filename, 0, NULL&#41;;
	if&#40;modid >= 0&#41; &#123;
		modid = sceKernelStartModule&#40;modid, 0, 0, &status, NULL&#41;;
	&#125;
	else &#123;
		pspDebugScreenPrintf&#40;"\nerr=0x%08X &#58; sceKernelLoadModule\n", modid&#41;;
		goto wait;
	&#125;

//	result = pspSdkLoadStartModule&#40;"ms0&#58;/mpeg_vsh330.prx", PSP_MEMORY_PARTITION_USER&#41;;
//	result = sceUtilityLoadAvModule&#40;3&#41;;
//	if &#40; result < 0 &#41;&#123;
//		pspDebugScreenPrintf&#40;"\nerr=0x%08X &#58; sceUtilityLoadAvModule&#40;3&#41;\n", result&#41;;
//		goto wait;
//	&#125;
	
	result = sceMpegInit&#40;&#41;;
	if &#40; result != 0 &#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegInit\n"&#41;;
		goto wait;
	&#125;
	
	avc->mpeg_mode = 4;
//	avc->mpeg_ddrtop = 0x09400000;
//	avc->mpeg_au_buffer = 0x09410000;
	avc->mpeg_ddrtop =  memalign&#40;0x400000, 0x400000&#41;;
	avc->mpeg_au_buffer = avc->mpeg_ddrtop + 0x10000;

//	pspDebugScreenPrintf&#40;"\naddress=0x%08X\n", avc->mpeg_au_buffer&#41;;
	
	
	result = sceMpegQueryMemSize&#40;avc->mpeg_mode&#41;;
	if &#40; result < 0 &#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegQueryMemSize&#40;0x%08X&#41;\n", avc->mpeg_mode&#41;;
		goto wait;
	&#125;
	
//	pspDebugScreenPrintf&#40;"\n%d\n", result&#41;;
	
	avc->mpeg_buffer_size = result;
	
	if &#40; &#40;result & 0xF&#41; != 0 &#41;
		result = &#40;result & 0xFFFFFFF0&#41; + 16;
			
	avc->mpeg_buffer = malloc_64&#40;result&#41;;
	if &#40; avc->mpeg_buffer == 0 &#41; &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; alloc\n"&#41;;
		goto wait;
	&#125;
	
	result = sceMpegCreate&#40;&avc->mpeg, avc->mpeg_buffer, avc->mpeg_buffer_size, &avc->mpeg_ringbuffer, 512, avc->mpeg_mode, avc->mpeg_ddrtop&#41;;	
	if &#40; result != 0&#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegCreate\n"&#41;;
		goto wait;
	&#125;
	
	avc->mpeg_au = &#40;SceMpegAu*&#41;malloc_64&#40;64&#41;;
	if &#40; avc->mpeg_au == 0 &#41; &#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; alloc\n"&#41;;
		goto wait;
	&#125;
	memset&#40;avc->mpeg_au, 0xFF, 64&#41;;
	if &#40; sceMpegInitAu&#40;&avc->mpeg, avc->mpeg_au_buffer, avc->mpeg_au&#41; != 0 &#41;&#123;
		pspDebugScreenPrintf&#40;"\nerr&#58; sceMpegInitAu\n"&#41;;
		goto wait;
	&#125;
	
	unsigned char* nal_buffer = &#40;unsigned char*&#41;malloc_64&#40;1024*1024&#41;;
	
//	unsigned char sps_pps_buffer&#91;27&#93;;
//	
//	FILE* fp;
//	fp = fopen&#40;"ms0&#58;/sps_pps.dat", "rb"&#41;;
//	fread&#40;sps_pps_buffer, 27, 1, fp&#41;;
//	fclose&#40;fp&#41;;
//	sps_size = 23;
//	pps_size = 4;
	
	//---------------------------------------------------------------------------------//
	float curr_ms = 1.0f;
	u64 last_tick;
	sceRtcGetCurrentTick&#40;&last_tick&#41;;
	u32 tick_frequency = sceRtcGetTickResolution&#40;&#41;;
	int frame_count = 0;
	sceCtrlReadBufferPositive&#40;&input, 1&#41;;
	
	int pic_num;
	
	sceDisplayWaitVblankStart&#40;&#41;;
	sceDisplaySetFrameBuf&#40;FrameBuffer&#91;frame_index&#93;, 512, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_IMMEDIATE&#41;;
	
while&#40;!&#40;input.Buttons & PSP_CTRL_TRIANGLE&#41;&#41; &#123;
	
	float curr_fps = 1.0f / curr_ms;
	//pspDebugScreenSetXY&#40;0,0&#41;;
	//pspDebugScreenPrintf&#40;"fps&#58; %d.%03d \n",&#40;int&#41;curr_fps,&#40;int&#41;&#40;&#40;curr_fps-&#40;int&#41;curr_fps&#41; * 1000.0f&#41;&#41;;
	
	avc->mpeg_nal.sps_buffer = &#40;&sps_pps_buffer&#91;0&#93;&#41;;
	avc->mpeg_nal.sps_size = sps_size;
	avc->mpeg_nal.pps_buffer = &#40;&sps_pps_buffer&#91;sps_size&#93;&#41;;
	avc->mpeg_nal.pps_size = pps_size;
	avc->mpeg_nal.unkown0 = 4;
	memset&#40;nal_buffer, 0, 1024*1024&#41;;
	mp4ff_read_sample_v2&#40;mp4_handle, 0, frame_count, nal_buffer&#41;;
	avc->mpeg_nal.nal_buffer = nal_buffer;
	avc->mpeg_nal.nal_size = mp4ff_read_sample_getsize&#40;mp4_handle, 0, frame_count&#41;;//size1 ;
	if &#40; frame_count == 0 &#41;
		avc->mpeg_nal.mode = 3;
	else
		avc->mpeg_nal.mode = 0;
	FILE* fp1;
//	memset&#40;filename,0,1024&#41;;
//	sprintf&#40;filename, "ms0&#58;/mpeg%d_0.dat", frame_count&#41;;
//	fp1 = fopen&#40;filename, "wb"&#41;;
//	fwrite&#40;p1, 512, 1, fp1&#41;;
//	fclose&#40;fp1&#41;;
	
	result = sceMpegGetAvcNalAu&#40;&avc->mpeg, &avc->mpeg_nal, avc->mpeg_au&#41;;
	memset&#40;filename,0,1024&#41;;
//	sprintf&#40;filename, "ms0&#58;/au%d_1.dat", frame_count&#41;;
//	fp1 = fopen&#40;filename, "wb"&#41;;
//	fwrite&#40;au0, 64, 1, fp1&#41;;
//	fclose&#40;fp1&#41;;
//	pspDebugScreenPrintf&#40;" GetAvcNalAu=0x%08X\n", result&#41;;
	
	result = sceMpegAvcDecode&#40;&avc->mpeg, avc->mpeg_au, 512, 0, &pic_num&#41;;
//	pspDebugScreenPrintf&#40;" AvcDecode=0x%08X,0x%08X\n", result, pic_num&#41;;
	result = sceMpegAvcDecodeDetail2&#40;&avc->mpeg, &avc->mpeg_codec_buffer&#41;;
//	pspDebugScreenPrintf&#40;" AvcDecodeDetail2=0x%08X\n", result&#41;;
	
	
	if &#40; result == 0 &#41; &#123;
		avc->mpeg_yuv_buffer = avc->mpeg_codec_buffer->yuv_buffer;
		avc->mpeg_info_buffer = avc->mpeg_codec_buffer->info_buffer;
		
		if &#40; pic_num > 0 &#41; &#123;
			int i;
			for&#40;i=0;i<pic_num;i++&#41; &#123;
				int csc_mode = 0;//i % 2;
				csc->height = avc->mpeg_info_buffer->height >> 4;
				csc->width = avc->mpeg_info_buffer->width >> 4;
				csc->mode0 = csc_mode;
				csc->mode1 = csc_mode;
				if &#40; csc_mode == 0 &#41; &#123;
					csc->buffer0 = avc->mpeg_yuv_buffer->buffer0 ;
					csc->buffer1 = avc->mpeg_yuv_buffer->buffer1 ;
					csc->buffer2 = avc->mpeg_yuv_buffer->buffer2 ;
					csc->buffer3 = avc->mpeg_yuv_buffer->buffer3 ;
					csc->buffer4 = avc->mpeg_yuv_buffer->buffer4 ;
					csc->buffer5 = avc->mpeg_yuv_buffer->buffer5 ;
					csc->buffer6 = avc->mpeg_yuv_buffer->buffer6 ;
					csc->buffer7 = avc->mpeg_yuv_buffer->buffer7 ;
				&#125;
				else &#123;
					csc->buffer0 = avc->mpeg_yuv_buffer->buffer2 ;
					csc->buffer1 = avc->mpeg_yuv_buffer->buffer3 ;
					csc->buffer2 = avc->mpeg_yuv_buffer->buffer0 ;
					csc->buffer3 = avc->mpeg_yuv_buffer->buffer1 ;
					csc->buffer4 = avc->mpeg_yuv_buffer->buffer6 ;
					csc->buffer5 = avc->mpeg_yuv_buffer->buffer7 ;
					csc->buffer6 = avc->mpeg_yuv_buffer->buffer4 ;
					csc->buffer7 = avc->mpeg_yuv_buffer->buffer5 ;
				&#125;
				
				result = sceMpegBaseCscAvc&#40;FrameBuffer&#91;frame_index&#93;,0,512,csc&#41;;
//				pspDebugScreenPrintf&#40;" BaseCscAvc=0x%08X\n", result&#41;;
				if &#40; result == 0 &#41; &#123;
//					memset&#40;filename,0,1024&#41;;
//					sprintf&#40;filename, "ms0&#58;/RGB%d.%d.dat", frame_count,i&#41;;
//					fp1 = fopen&#40;filename, "wb"&#41;;
//					fwrite&#40;RGBBuffer, 4*512*512, 1, fp1&#41;;
//					fclose&#40;fp1&#41;;
					sceDisplayWaitVblankStart&#40;&#41;;
					sceDisplaySetFrameBuf&#40;FrameBuffer&#91;frame_index&#93;, 512, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_IMMEDIATE&#41;;
					frame_index = &#40;frame_index+1&#41; % 2;
					//sceKernelDelayThread&#40;10000&#41;;
				&#125;
			&#125;
		&#125;
	&#125;
//	memset&#40;filename,0,1024&#41;;
//	sprintf&#40;filename, "ms0&#58;/mpeg%d.dat", frame_count&#41;;
//	fp1 = fopen&#40;filename, "wb"&#41;;
//	fwrite&#40;p1, 512, 1, fp1&#41;;
//	fclose&#40;fp1&#41;;
	++frame_count;
	if &#40; frame_count >= total_samples &#41; 
		break;
	u64 curr_tick;
	sceRtcGetCurrentTick&#40;&curr_tick&#41;;
	if &#40;&#40;curr_tick-last_tick&#41; >= tick_frequency&#41;
	&#123;
		float time_span = &#40;&#40;int&#41;&#40;curr_tick-last_tick&#41;&#41; / &#40;float&#41;tick_frequency;
		curr_ms = time_span / frame_count;
		//frame_count = 0;
		sceRtcGetCurrentTick&#40;&last_tick&#41;;
	&#125;
	sceCtrlReadBufferPositive&#40;&input, 1&#41;;
&#125;
//	fclose&#40;fp&#41;;

wait&#58;
	mp4ff_close&#40;mp4_handle&#41;;
	fclose&#40;mp4_file&#41;;
	pspDebugScreenPrintf&#40;"\n"&#41;;
	pspDebugScreenPrintf&#40;"press triangle to exit...\n"&#41;;
	sceCtrlReadBufferPositive&#40;&input, 1&#41;;
	while&#40;!&#40;input.Buttons & PSP_CTRL_TRIANGLE&#41;&#41;
	&#123;
		sceKernelDelayThread&#40;10000&#41;;	// wait 10 milliseconds
		sceCtrlReadBufferPositive&#40;&input, 1&#41;;
	&#125;
	
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;


/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;


/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;

	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;


/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;
Makefile, it build a fw3xx eboot

Code: Select all

TARGET = AvcDecodeTest
OBJS = main.o mem64.o mpegbase.o

BUILD_PRX = 1
PSP_FW_VERSION=371

CFLAGS = -G0 -Wall -O2
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

INCDIR = ./mp4ff/include
LIBDIR =  .
LDFLAGS =
LIBS= -lpsppower -lm -lpsprtc -lpspgu -lpspmpeg -lmp4ff

EXTRA_TARGETS = EBOOT.PBP 
PSP_EBOOT_TITLE = AvcDecode Test

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Last edited by cooleyes on Tue Mar 11, 2008 3:06 pm, edited 2 times in total.
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

Excellent work.

Careful or you'll run out of formats to decode soon ;)
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

do not use "sceUtilityLoadAvModule(3)",
because when use sceUtilityLoadAvModule(3), it will load mpeg.prx from psp fw(ver>300), not mpeg_vsh.prx.
the mpeg.prx in psp fw(ver>300) is same mpeg_vsh.prx in psp fw(ver=150)
it can not decode avc frame in psp mp4 file
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

These are the AVC movies we use in the XMB?
Very good :)
If not actually, then potentially.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

Art wrote:These are the AVC movies we use in the XMB?
Very good :)
yes! :P
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Trouble compiling on my old toolchain :(
I assume mem64.H is part of the new updates for the slim?
Could these be uploaded somewhere so I can try in 1.50 kernel?
I can get the firmware file for myself.
Or does it actually require the 64Mb of the slim?
If not actually, then potentially.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

Art wrote:Trouble compiling on my old toolchain :(
I assume mem64.H is part of the new updates for the slim?
Could these be uploaded somewhere so I can try in 1.50 kernel?
I can get the firmware file for myself.
Or does it actually require the 64Mb of the slim?
no, it can run in slim psp or fat psp.
but it must run in 3.xx kernel.
here is my full source package,
http://www.mediafire.com/?zs1ojnnrxtx
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

Thanks heaps :)
If I can get that running with an MP3 player app, I'll make it the autoboot program
and use a PSP for that entirely :)
If not actually, then potentially.
Vincent_M
Posts: 73
Joined: Tue Apr 03, 2007 4:16 am

Post by Vincent_M »

I uh, kinda still use FW 1.5 because I haven't gotten around to making a Pandora Battery (I don't have XP on a computer I can get to...). Is it possible to do this with a 1.5 PSP? Are there methods for creating a Pandora's Battery on 64-bit Vista or 64-bit Linux systems out there?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

Windows has never been necessary to make a Pandora battery... see e.g. http://psp.jim.sh/fanjita/linux.txt. These days, just follow a guide like http://forums.exophase.com/showthread.php?t=3780 and you won't need a PC at all other than to move files around.
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

Many thanks again cooleyes, exellent work.
I will try to add this to the shell i'm working on.
Vincent_M
Posts: 73
Joined: Tue Apr 03, 2007 4:16 am

Post by Vincent_M »

Windows has never been necessary to make a Pandora battery... see e.g. http://psp.jim.sh/fanjita/linux.txt. These days, just follow a guide like http://forums.exophase.com/showthread.php?t=3780 and you won't need a PC at all other than to move files around.
Thanks, that's just what I need.
noxa
Posts: 39
Joined: Sat Aug 05, 2006 9:03 am
Contact:

Post by noxa »

Has anyone got this working? I'm trying to test it out and am having a bit of trouble; I put an MP4 on my memory stick and ran the app, it prints out the track information for the file but it fails with 'err: sceMpegInit'.
Using psplink's modlist command after this error, I see that sceMpeg_library is loaded but nothing like sceMpegbase/sceAudiocodec/Videocodec/etc are.

I'm running on a fat w/ 3.52 M33. Old, I know, but it works for most things. Does this require a newer firmware?

Edit: turns out that running under psplink causes it to fail - if I try running it from the xmb it starts and I'm assuming it plays something (constant ms usage), but I can't see anything. Progress :)
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

It's working great here on 390 under psplink.
edepot
Posts: 111
Joined: Sat Apr 09, 2005 3:39 pm

mp4

Post by edepot »

What about mpeg2? I am assuming there is no hardware acceleration of mpeg2 in the psp? Has anyone compiled vlc for the psp? I also forgot where the source is for reading inside .iso files (I assume it is inside the custom firmware). So the next step would be to be able to read .vob and once that is accomplished, shouldn't the psp slim be able to read dvd iso's and output to the TV in full 740x480 24bits/pixel mode? Your PSP becomes a dvd player. I think the 4.7gb of a DVD would fit inside 4GB if the dolby is stripped to containing only the stereo signals (the PSP slim can only output stereo to the tv). Even this may not be needed because most DVD is not filled up. Or just put the iso on a 8gb stick. Of course, using some of the hardware of the PSP to speed up mpeg2 decoding would greatly enhance the speed. To keep this in perspective, it can be used for homemade burned movies.
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

I want divx!!! Sigh sigh...(crying on the bed with face pushed in pillow)
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

jean wrote:I want divx!!! Sigh sigh...(crying on the bed with face pushed in pillow)
http://forums.ps2dev.org/viewtopic.php?t=8846
noxa
Posts: 39
Joined: Sat Aug 05, 2006 9:03 am
Contact:

Post by noxa »

I was able to get it working - it just can't be run under psplink for me. Probably just an old version issue.

Thanks for the sample cooleyes!
thereapman
Posts: 2
Joined: Fri Apr 04, 2008 12:22 am

Post by thereapman »

noxa wrote:...if I try running it from the xmb it starts and I'm assuming it plays something (constant ms usage), but I can't see anything. Progress :)
Same here. MS is doing some work but nothing on the Screen after the print of the Tracks. what's to do to see and hear the videostream?
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

Maybe you have the same problem i had with the mp3 decoding code, you should try to install the 3xx fatmsmod patch made by dark_alex.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

Cpasjuste wrote:Maybe you have the same problem i had with the mp3 decoding code, you should try to install the 3xx fatmsmod patch made by dark_alex.
hehe, I had updated PPA svn, the new beta fw3xx verison PPA can play mp4avc file now

PPA source svn:

http://code.google.com/p/pmplayer-advance/
frenchskud
Posts: 2
Joined: Wed Sep 05, 2007 6:09 pm

Post by frenchskud »

Hello, I m very impressed by all of this;
As you know the PSP is still not able to read Ipod MP4 movie because the stream is coded CAVLC and not CABAC ... this is really stupid from Sony to limit the decoding software.

Based on this work, is there any chance to enable CAVLC video stream decoding?

keep continuing such a good job, tis will probably enforce Sony to open there firmware one day or another:)
PSP+Ipod+Archos
peb
Posts: 26
Joined: Mon Mar 12, 2007 10:01 pm

Post by peb »

Wooo, it's very nice!

I had try your app, but I have problem with get_avc_sps_pps, why?!
Sorry for my English, I'm french.
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

frenchskud wrote:Hello, I m very impressed by all of this;
As you know the PSP is still not able to read Ipod MP4 movie because the stream is coded CAVLC and not CABAC ... this is really stupid from Sony to limit the decoding software.

Based on this work, is there any chance to enable CAVLC video stream decoding?

keep continuing such a good job, tis will probably enforce Sony to open there firmware one day or another:)
ok

if you want decode baseline profile avc, call sceMeBootStart(4) before sceMpegInit
decode main profile avc, call sceMeBootStart(3) before sceMpegInit
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Does that affect the supported resolutions as well?
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

J.F. wrote:Does that affect the supported resolutions as well?
still <=480*272

but I will continue to find out how to decode 480P . :P
victorprosa
Posts: 37
Joined: Wed Jan 14, 2009 5:53 am

Post by victorprosa »

cooleyes

Can you re-upload the full pack, with the libs, etc, because the link has expired :(
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

victorprosa wrote:cooleyes

Can you re-upload the full pack, with the libs, etc, because the link has expired :(
sorry , this sample code source, I had deleted. :(
but you can find the code from PPA project

http://pmplayer-advance.googlecode.com
victorprosa
Posts: 37
Joined: Wed Jan 14, 2009 5:53 am

Post by victorprosa »

i found the "pspmpeg" and the "mem64" libs, but no "mp4ff" lib, do someone has this lib, or maybe, knows it as an other name?
cooleyes
Posts: 123
Joined: Thu May 18, 2006 3:30 pm

Post by cooleyes »

victorprosa wrote:i found the "pspmpeg" and the "mem64" libs, but no "mp4ff" lib, do someone has this lib, or maybe, knows it as an other name?
ok, just wait a few days, I will post a new sample code
It can decode <=480*272 main profile avc,
it also can decode 480P main profile avc

:)
Post Reply