[patch] cooleyes' pspaudio plus some pspmpeg findings

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

[patch] cooleyes' pspaudio plus some pspmpeg findings

Post by Raphael »

I just added cooleyes pspaudio findings (sceAudioSetFrequency) and his updated stub file to my local SDK.
Along with that, I also found a way to set the pspmpeg's decode pixelformat, so it is now possible to decode video in any of the four possible display pixelformats (4444, 5650, 5551 and 8888). I'm not sure about the other value in SceMpegAvcMode though as it doesn't have any visible influence on the output.
Another change is my faulty doxygen comment on pspdisplays SetFrameBuf - the call obviously functions with other modes than 8888 too, at least with SET_NEXTFRAME.

I also took the chance and added my name to the headers in question, if no one's got a problem with that :P

Patch to be applied from pspsdk/

Code: Select all

Index: src/audio/pspaudio.h
===================================================================
--- src/audio/pspaudio.h	(revision 2270)
+++ src/audio/pspaudio.h	(working copy)
@@ -7,6 +7,8 @@
  *
  * Copyright (c) 2005 Adresd
  * Copyright &#40;c&#41; 2005 Marcus R. Brown <mrbrown@ocgnet.org>
+ * Copyright &#40;c&#41; 2007 cooleyes
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
@@ -38,6 +40,13 @@
     PSP_AUDIO_FORMAT_MONO   = 0x10
 &#125;;
 
+enum PspAudioFrequencies &#123;
+    /** Sampling frequency set to 44100Hz. */
+    PSP_AUDIO_FREQ_44K = 44100,
+    /** Sampling frequency set to 48000Hz. */
+    PSP_AUDIO_FREQ_48K = 48000
+&#125;;
+
 /** The minimum number of samples that can be allocated to a channel. */
 #define PSP_AUDIO_SAMPLE_MIN    64
 /** The maximum number of samples that can be allocated to a channel. */
@@ -114,6 +123,14 @@
   */
 int sceAudioChangeChannelVolume&#40;int channel, int leftvol, int rightvol&#41;;
 
+/**
+  * Set audio sampling frequency
+  *
+  * @param frequency - Sampling frequency to set audio output to - either 44100 or 48000.
+  *
+  * @returns 0 on success, an error if less than 0.
+  */
+int sceAudioSetFrequency&#40;int frequency&#41;;
 /*@&#125;*/
 
 #ifdef __cplusplus
Index&#58; src/audio/sceAudio.S
===================================================================
--- src/audio/sceAudio.S	&#40;revision 2270&#41;
+++ src/audio/sceAudio.S	&#40;working copy&#41;
@@ -3,62 +3,114 @@
 #include "pspimport.s"
 
 #ifdef F_sceAudio_0000
-	IMPORT_START	"sceAudio",0x40010000
+	IMPORT_START	"sceAudio",0x00010000
 #endif
+
 #ifdef F_sceAudio_0001
-	IMPORT_FUNC	"sceAudio",0x8C1009B2,sceAudioOutput
+	IMPORT_FUNC	"sceAudio",0x80F1F7E0,sceAudioInit
 #endif
-#ifdef F_sceAudio_0002
-	IMPORT_FUNC	"sceAudio",0x136CAF51,sceAudioOutputBlocking
+
+#ifdef F_sceAudio_0002 
+	IMPORT_FUNC	"sceAudio",0x210567F7,sceAudioEnd
 #endif
-#ifdef F_sceAudio_0003
-	IMPORT_FUNC	"sceAudio",0xE2D56B2D,sceAudioOutputPanned
+
+#ifdef F_sceAudio_0003 
+	IMPORT_FUNC	"sceAudio",0xA2BEAA6C,sceAudioSetFrequency 
 #endif
+
 #ifdef F_sceAudio_0004
-	IMPORT_FUNC	"sceAudio",0x13F592BC,sceAudioOutputPannedBlocking
+	IMPORT_FUNC	"sceAudio",0xB61595C0,sceAudioLoopbackTest 
 #endif
+
 #ifdef F_sceAudio_0005
-	IMPORT_FUNC	"sceAudio",0x5EC81C55,sceAudioChReserve
+	IMPORT_FUNC	"sceAudio",0x927AC32B,sceAudioSetVolumeOffset 
 #endif
+
 #ifdef F_sceAudio_0006
-	IMPORT_FUNC	"sceAudio",0x41EFADE7,sceAudioOneshotOutput
+	IMPORT_FUNC	"sceAudio",0x8C1009B2,sceAudioOutput 
 #endif
+
 #ifdef F_sceAudio_0007
-	IMPORT_FUNC	"sceAudio",0x6FC46853,sceAudioChRelease
+	IMPORT_FUNC	"sceAudio",0x136CAF51,sceAudioOutputBlocking 
 #endif
+
 #ifdef F_sceAudio_0008
-	IMPORT_FUNC	"sceAudio",0xE9D97901,sceAudioGetChannelRestLen
+	IMPORT_FUNC	"sceAudio",0xE2D56B2D,sceAudioOutputPanned 
 #endif
+
 #ifdef F_sceAudio_0009
-	IMPORT_FUNC	"sceAudio",0xCB2E439E,sceAudioSetChannelDataLen
+	IMPORT_FUNC	"sceAudio",0x13F592BC,sceAudioOutputPannedBlocking 
 #endif
+
 #ifdef F_sceAudio_0010
-	IMPORT_FUNC	"sceAudio",0x95FD0C2D,sceAudioChangeChannelConfig
+	IMPORT_FUNC	"sceAudio",0x5EC81C55,sceAudioChReserve 
 #endif
+
 #ifdef F_sceAudio_0011
-	IMPORT_FUNC	"sceAudio",0xB7E1D8E7,sceAudioChangeChannelVolume
+	IMPORT_FUNC	"sceAudio",0x41EFADE7,sceAudioOneshotOutput 
 #endif
+
 #ifdef F_sceAudio_0012
-	IMPORT_FUNC	"sceAudio",0x38553111,sceAudio_38553111
+	IMPORT_FUNC	"sceAudio",0x6FC46853,sceAudioChRelease 
 #endif
+
 #ifdef F_sceAudio_0013
-	IMPORT_FUNC	"sceAudio",0x5C37C0AE,sceAudio_5C37C0AE
+	IMPORT_FUNC	"sceAudio",0xB011922F,sceAudio_B011922F 
 #endif
+
 #ifdef F_sceAudio_0014
-	IMPORT_FUNC	"sceAudio",0xE0727056,sceAudio_E0727056
+	IMPORT_FUNC	"sceAudio",0xCB2E439E,sceAudioSetChannelDataLen 
 #endif
+
 #ifdef F_sceAudio_0015
-	IMPORT_FUNC	"sceAudio",0x086E5895,sceAudioInputBlocking
+	IMPORT_FUNC	"sceAudio",0x95FD0C2D,sceAudioChangeChannelConfig 
 #endif
+
 #ifdef F_sceAudio_0016
-	IMPORT_FUNC	"sceAudio",0x6D4BEC68,sceAudioInput
+	IMPORT_FUNC	"sceAudio",0xB7E1D8E7,sceAudioChangeChannelVolume 
 #endif
+
 #ifdef F_sceAudio_0017
-	IMPORT_FUNC	"sceAudio",0xA708C6A6,sceAudioGetInputLength
+	IMPORT_FUNC	"sceAudio",0x38553111,sceAudio_38553111 
 #endif
+
 #ifdef F_sceAudio_0018
-	IMPORT_FUNC	"sceAudio",0x87B2E651,sceAudioWaitInputEnd
+	IMPORT_FUNC	"sceAudio",0x5C37C0AE,sceAudio_5C37C0AE 
 #endif
+
 #ifdef F_sceAudio_0019
-	IMPORT_FUNC	"sceAudio",0x7DE61688,sceAudioInputInit
+	IMPORT_FUNC	"sceAudio",0xE0727056,sceAudio_E0727056 
 #endif
+
+#ifdef F_sceAudio_0020
+	IMPORT_FUNC	"sceAudio",0x086E5895,sceAudioInputBlocking 
+#endif
+
+#ifdef F_sceAudio_0021
+	IMPORT_FUNC	"sceAudio",0x6D4BEC68,sceAudioInput 
+#endif
+
+#ifdef F_sceAudio_0022
+	IMPORT_FUNC	"sceAudio",0xA708C6A6,sceAudioGetInputLength 
+#endif
+
+#ifdef F_sceAudio_0023
+	IMPORT_FUNC	"sceAudio",0x87B2E651,sceAudioWaitInputEnd 
+#endif
+
+#ifdef F_sceAudio_0024
+	IMPORT_FUNC	"sceAudio",0x7DE61688,sceAudioInputInit 
+#endif
+
+#ifdef F_sceAudio_0025
+	IMPORT_FUNC	"sceAudio",0xE926D3FB,sceAudioInputInitEx 
+#endif
+
+#ifdef F_sceAudio_0026
+	IMPORT_FUNC	"sceAudio",0xA633048E,sceAudioPollInputEnd 
+#endif
+
+#ifdef F_sceAudio_0027
+	IMPORT_FUNC	"sceAudio",0xE9D97901,sceAudioGetChannelRestLen 
+#endif
+
Index&#58; src/mpeg/pspmpeg.h
===================================================================
--- src/mpeg/pspmpeg.h	&#40;revision 2270&#41;
+++ src/mpeg/pspmpeg.h	&#40;working copy&#41;
@@ -6,6 +6,7 @@
  * pspmpeg.h - Prototypes for the sceMpeg library
  *
  * Copyright &#40;c&#41; 2006 Sorin P. C. <magik@hypermagik.com>
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
@@ -61,30 +62,38 @@
 
 typedef struct SceMpegAu
 &#123;
-    /** unknown */
-	SceUInt32			iUnk0;
-    /** presentation timestamp? */
-	SceInt32 			iTimestamp;
-    /** unknown */
-	SceUInt32			iUnk1;
-    /** unknown */
-	SceUInt32			iUnk2;
-    /** unknown */
-	SceUInt32			iUnk3;
-    /** unknown */
-	SceUInt32			iUnk4;
+    /** presentation timestamp MSB */
+	SceUInt32			iPtsMSB;
+    /** presentation timestamp LSB */
+	SceUInt32 			iPts;
+    /** decode timestamp MSB */
+	SceUInt32			iDtsMSB;
+    /** decode timestamp LSB */
+	SceUInt32			iDts;
+    /** Es buffer handle */
+	SceUInt32			iEsBuffer;
+    /** Au size */
+	SceUInt32			iAuSize;
 
 &#125; SceMpegAu;
 
+
+#define SCE_MPEG_AVC_FORMAT_DEFAULT -1
+#define SCE_MPEG_AVC_FORMAT_5650 0
+#define SCE_MPEG_AVC_FORMAT_5551 1
+#define SCE_MPEG_AVC_FORMAT_4444 2
+#define SCE_MPEG_AVC_FORMAT_8888 3
+
 typedef struct SceMpegAvcMode
 &#123;
 	/** unknown, set to -1 */
 	SceInt32			iUnk0;
-	/** unknonw, set to 3 */
-	SceInt32			iUnk1;
+	/** Decode pixelformat */
+	SceInt32			iPixelFormat;
 
 &#125; SceMpegAvcMode;
 
+
 /**
  * sceMpegInit
  *
@@ -275,6 +284,8 @@
 /**
  * sceMpegAvcDecodeMode
  *
+ * @param Mpeg - SceMpeg handle
+ * @param pMode - pointer to SceMpegAvcMode struct defining the decode mode &#40;pixelformat&#41;
  * @returns 0 if success.
  */
 SceInt32 sceMpegAvcDecodeMode&#40;SceMpeg* Mpeg, SceMpegAvcMode* pMode&#41;;
Index&#58; src/display/pspdisplay.h
===================================================================
--- src/display/pspdisplay.h	&#40;revision 2270&#41;
+++ src/display/pspdisplay.h	&#40;working copy&#41;
@@ -8,6 +8,7 @@
  * Copyright &#40;c&#41; 2005 Marcus R. Brown <mrbrown@ocgnet.org>
  * Copyright &#40;c&#41; 2005 James Forshaw <tyranid@gmail.com>
  * Copyright &#40;c&#41; 2005 John Kelley <ps2dev@kelley.ca>
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
@@ -77,7 +78,7 @@
  *
  * @param topaddr - address of start of framebuffer
  * @param bufferwidth - buffer width &#40;must be power of 2&#41;
- * @param pixelformat - One of &#58;&#58;PspDisplayPixelFormats. &#40;only succeeds with PSP_DISPLAY_PIXEL_FORMAT_8888&#41;
+ * @param pixelformat - One of &#58;&#58;PspDisplayPixelFormats.
  * @param sync - One of &#58;&#58;PspDisplaySetBufSync
  *
  * @return 0 on success
Index&#58; src/display/pspdisplay_kernel.h
===================================================================
--- src/display/pspdisplay_kernel.h	&#40;revision 2270&#41;
+++ src/display/pspdisplay_kernel.h	&#40;working copy&#41;
@@ -8,6 +8,7 @@
  * Copyright &#40;c&#41; 2005 Marcus R. Brown <mrbrown@ocgnet.org>
  * Copyright &#40;c&#41; 2005 James Forshaw <tyranid@gmail.com>
  * Copyright &#40;c&#41; 2005 John Kelley <ps2dev@kelley.ca>
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Code: Select all

/tmp/pspsdk$ svn update
At revision 2270.
/tmp/pspsdk$ cat /tmp/patch.txt | patch -p0 --dry-run
patching file src/audio/pspaudio.h
Hunk #1 succeeded at 7 with fuzz 2.
patching file src/audio/sceAudio.S
patching file src/mpeg/pspmpeg.h
Hunk #1 FAILED at 6.
Hunk #2 FAILED at 62.
Hunk #3 FAILED at 284.
3 out of 3 hunks FAILED -- saving rejects to file src/mpeg/pspmpeg.h.rej
patching file src/display/pspdisplay.h
Hunk #1 succeeded at 8 with fuzz 2.
patching file src/display/pspdisplay_kernel.h
Hunk #1 succeeded at 8 with fuzz 2.
This is what I get when I attempt to apply the patch. I'm a little hesitant to manually resolve the rejects - which revision of pspsdk did you use?
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Strange, I just redownloaded the rev 2270 and patched the files manually a couple of times and created a new patch file. Still gives the same error every time, no matter what I try.

Well, here's the patch for pspaudio/pspdisplay:

Code: Select all

Index&#58; src/audio/pspaudio.h
===================================================================
--- src/audio/pspaudio.h	&#40;revision 2270&#41;
+++ src/audio/pspaudio.h	&#40;working copy&#41;
@@ -7,6 +7,8 @@
  *
  * Copyright &#40;c&#41; 2005 Adresd
  * Copyright &#40;c&#41; 2005 Marcus R. Brown <mrbrown@ocgnet.org>
+ * Copyright &#40;c&#41; 2007 cooleyes
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
@@ -38,6 +40,13 @@
     PSP_AUDIO_FORMAT_MONO   = 0x10
 &#125;;
 
+enum PspAudioFrequencies &#123;
+    /** Sampling frequency set to 44100Hz. */
+    PSP_AUDIO_FREQ_44K = 44100,
+    /** Sampling frequency set to 48000Hz. */
+    PSP_AUDIO_FREQ_48K = 48000
+&#125;;
+
 /** The minimum number of samples that can be allocated to a channel. */
 #define PSP_AUDIO_SAMPLE_MIN    64
 /** The maximum number of samples that can be allocated to a channel. */
@@ -114,6 +123,14 @@
   */
 int sceAudioChangeChannelVolume&#40;int channel, int leftvol, int rightvol&#41;;
 
+/**
+  * Set audio sampling frequency
+  *
+  * @param frequency - Sampling frequency to set audio output to - either 44100 or 48000.
+  *
+  * @returns 0 on success, an error if less than 0.
+  */
+int sceAudioSetFrequency&#40;int frequency&#41;;
 /*@&#125;*/
 
 #ifdef __cplusplus
Index&#58; src/audio/sceAudio.S
===================================================================
--- src/audio/sceAudio.S	&#40;revision 2270&#41;
+++ src/audio/sceAudio.S	&#40;working copy&#41;
@@ -3,62 +3,114 @@
 #include "pspimport.s"
 
 #ifdef F_sceAudio_0000
-	IMPORT_START	"sceAudio",0x40010000
+	IMPORT_START	"sceAudio",0x00010000
 #endif
+
 #ifdef F_sceAudio_0001
-	IMPORT_FUNC	"sceAudio",0x8C1009B2,sceAudioOutput
+	IMPORT_FUNC	"sceAudio",0x80F1F7E0,sceAudioInit
 #endif
-#ifdef F_sceAudio_0002
-	IMPORT_FUNC	"sceAudio",0x136CAF51,sceAudioOutputBlocking
+
+#ifdef F_sceAudio_0002 
+	IMPORT_FUNC	"sceAudio",0x210567F7,sceAudioEnd
 #endif
-#ifdef F_sceAudio_0003
-	IMPORT_FUNC	"sceAudio",0xE2D56B2D,sceAudioOutputPanned
+
+#ifdef F_sceAudio_0003 
+	IMPORT_FUNC	"sceAudio",0xA2BEAA6C,sceAudioSetFrequency 
 #endif
+
 #ifdef F_sceAudio_0004
-	IMPORT_FUNC	"sceAudio",0x13F592BC,sceAudioOutputPannedBlocking
+	IMPORT_FUNC	"sceAudio",0xB61595C0,sceAudioLoopbackTest 
 #endif
+
 #ifdef F_sceAudio_0005
-	IMPORT_FUNC	"sceAudio",0x5EC81C55,sceAudioChReserve
+	IMPORT_FUNC	"sceAudio",0x927AC32B,sceAudioSetVolumeOffset 
 #endif
+
 #ifdef F_sceAudio_0006
-	IMPORT_FUNC	"sceAudio",0x41EFADE7,sceAudioOneshotOutput
+	IMPORT_FUNC	"sceAudio",0x8C1009B2,sceAudioOutput 
 #endif
+
 #ifdef F_sceAudio_0007
-	IMPORT_FUNC	"sceAudio",0x6FC46853,sceAudioChRelease
+	IMPORT_FUNC	"sceAudio",0x136CAF51,sceAudioOutputBlocking 
 #endif
+
 #ifdef F_sceAudio_0008
-	IMPORT_FUNC	"sceAudio",0xE9D97901,sceAudioGetChannelRestLen
+	IMPORT_FUNC	"sceAudio",0xE2D56B2D,sceAudioOutputPanned 
 #endif
+
 #ifdef F_sceAudio_0009
-	IMPORT_FUNC	"sceAudio",0xCB2E439E,sceAudioSetChannelDataLen
+	IMPORT_FUNC	"sceAudio",0x13F592BC,sceAudioOutputPannedBlocking 
 #endif
+
 #ifdef F_sceAudio_0010
-	IMPORT_FUNC	"sceAudio",0x95FD0C2D,sceAudioChangeChannelConfig
+	IMPORT_FUNC	"sceAudio",0x5EC81C55,sceAudioChReserve 
 #endif
+
 #ifdef F_sceAudio_0011
-	IMPORT_FUNC	"sceAudio",0xB7E1D8E7,sceAudioChangeChannelVolume
+	IMPORT_FUNC	"sceAudio",0x41EFADE7,sceAudioOneshotOutput 
 #endif
+
 #ifdef F_sceAudio_0012
-	IMPORT_FUNC	"sceAudio",0x38553111,sceAudio_38553111
+	IMPORT_FUNC	"sceAudio",0x6FC46853,sceAudioChRelease 
 #endif
+
 #ifdef F_sceAudio_0013
-	IMPORT_FUNC	"sceAudio",0x5C37C0AE,sceAudio_5C37C0AE
+	IMPORT_FUNC	"sceAudio",0xB011922F,sceAudio_B011922F 
 #endif
+
 #ifdef F_sceAudio_0014
-	IMPORT_FUNC	"sceAudio",0xE0727056,sceAudio_E0727056
+	IMPORT_FUNC	"sceAudio",0xCB2E439E,sceAudioSetChannelDataLen 
 #endif
+
 #ifdef F_sceAudio_0015
-	IMPORT_FUNC	"sceAudio",0x086E5895,sceAudioInputBlocking
+	IMPORT_FUNC	"sceAudio",0x95FD0C2D,sceAudioChangeChannelConfig 
 #endif
+
 #ifdef F_sceAudio_0016
-	IMPORT_FUNC	"sceAudio",0x6D4BEC68,sceAudioInput
+	IMPORT_FUNC	"sceAudio",0xB7E1D8E7,sceAudioChangeChannelVolume 
 #endif
+
 #ifdef F_sceAudio_0017
-	IMPORT_FUNC	"sceAudio",0xA708C6A6,sceAudioGetInputLength
+	IMPORT_FUNC	"sceAudio",0x38553111,sceAudio_38553111 
 #endif
+
 #ifdef F_sceAudio_0018
-	IMPORT_FUNC	"sceAudio",0x87B2E651,sceAudioWaitInputEnd
+	IMPORT_FUNC	"sceAudio",0x5C37C0AE,sceAudio_5C37C0AE 
 #endif
+
 #ifdef F_sceAudio_0019
-	IMPORT_FUNC	"sceAudio",0x7DE61688,sceAudioInputInit
+	IMPORT_FUNC	"sceAudio",0xE0727056,sceAudio_E0727056 
 #endif
+
+#ifdef F_sceAudio_0020
+	IMPORT_FUNC	"sceAudio",0x086E5895,sceAudioInputBlocking 
+#endif
+
+#ifdef F_sceAudio_0021
+	IMPORT_FUNC	"sceAudio",0x6D4BEC68,sceAudioInput 
+#endif
+
+#ifdef F_sceAudio_0022
+	IMPORT_FUNC	"sceAudio",0xA708C6A6,sceAudioGetInputLength 
+#endif
+
+#ifdef F_sceAudio_0023
+	IMPORT_FUNC	"sceAudio",0x87B2E651,sceAudioWaitInputEnd 
+#endif
+
+#ifdef F_sceAudio_0024
+	IMPORT_FUNC	"sceAudio",0x7DE61688,sceAudioInputInit 
+#endif
+
+#ifdef F_sceAudio_0025
+	IMPORT_FUNC	"sceAudio",0xE926D3FB,sceAudioInputInitEx 
+#endif
+
+#ifdef F_sceAudio_0026
+	IMPORT_FUNC	"sceAudio",0xA633048E,sceAudioPollInputEnd 
+#endif
+
+#ifdef F_sceAudio_0027
+	IMPORT_FUNC	"sceAudio",0xE9D97901,sceAudioGetChannelRestLen 
+#endif
+
Index&#58; src/display/pspdisplay.h
===================================================================
--- src/display/pspdisplay.h	&#40;revision 2270&#41;
+++ src/display/pspdisplay.h	&#40;working copy&#41;
@@ -8,6 +8,7 @@
  * Copyright &#40;c&#41; 2005 Marcus R. Brown <mrbrown@ocgnet.org>
  * Copyright &#40;c&#41; 2005 James Forshaw <tyranid@gmail.com>
  * Copyright &#40;c&#41; 2005 John Kelley <ps2dev@kelley.ca>
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
@@ -77,7 +78,7 @@
  *
  * @param topaddr - address of start of framebuffer
  * @param bufferwidth - buffer width &#40;must be power of 2&#41;
- * @param pixelformat - One of &#58;&#58;PspDisplayPixelFormats. &#40;only succeeds with PSP_DISPLAY_PIXEL_FORMAT_8888&#41;
+ * @param pixelformat - One of &#58;&#58;PspDisplayPixelFormats.
  * @param sync - One of &#58;&#58;PspDisplaySetBufSync
  *
  * @return 0 on success
Index&#58; src/display/pspdisplay_kernel.h
===================================================================
--- src/display/pspdisplay_kernel.h	&#40;revision 2270&#41;
+++ src/display/pspdisplay_kernel.h	&#40;working copy&#41;
@@ -8,6 +8,7 @@
  * Copyright &#40;c&#41; 2005 Marcus R. Brown <mrbrown@ocgnet.org>
  * Copyright &#40;c&#41; 2005 James Forshaw <tyranid@gmail.com>
  * Copyright &#40;c&#41; 2005 John Kelley <ps2dev@kelley.ca>
+ * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
  *
  * $Id$
  */
And the pspmpeg.h file as it should be:

Code: Select all

/*
 * PSP Software Development Kit - http&#58;//www.pspdev.org
 * -----------------------------------------------------------------------
 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
 *
 * pspmpeg.h - Prototypes for the sceMpeg library
 *
 * Copyright &#40;c&#41; 2006 Sorin P. C. <magik@hypermagik.com>
 * Copyright &#40;c&#41; 2007 Alexander Berl <raphael@fx-world.org>
 *
 * $Id$
 */

#ifndef __SCELIBMPEG_H__
#define __SCELIBMPEG_H__

#include <psptypes.h>

#ifdef __cplusplus
extern "C" &#123;
#endif

/** points to "LIBMPEG" */
typedef ScePVoid SceMpeg;

/** some structure */
typedef SceVoid  SceMpegStream;

/** Ringbuffer callback */
typedef SceInt32 &#40;*sceMpegRingbufferCB&#41;&#40;ScePVoid pData, SceInt32 iNumPackets, ScePVoid pParam&#41;;

typedef struct SceMpegRingbuffer
&#123;
    /** packets */
	SceInt32			iPackets;

    /** unknown */
	SceUInt32			iUnk0;
    /** unknown */
	SceUInt32			iUnk1;
    /** unknown */
	SceUInt32			iUnk2;
    /** unknown */
	SceUInt32			iUnk3;

    /** pointer to data */
	ScePVoid			pData;

    /** ringbuffer callback */
	sceMpegRingbufferCB	Callback;
    /** callback param */
	ScePVoid			pCBparam;

    /** unknown */
	SceUInt32			iUnk4;
    /** unknown */
	SceUInt32			iUnk5;
    /** mpeg id */
	SceMpeg				pSceMpeg;

&#125; SceMpegRingbuffer;

typedef struct SceMpegAu
&#123;
    /** presentation timestamp MSB */
	SceUInt32			iPtsMSB;
    /** presentation timestamp LSB */
	SceUInt32 			iPts;
    /** decode timestamp MSB */
	SceUInt32			iDtsMSB;
    /** decode timestamp LSB */
	SceUInt32			iDts;
    /** Es buffer handle */
	SceUInt32			iEsBuffer;
    /** Au size */
	SceUInt32			iAuSize;

&#125; SceMpegAu;

#define SCE_MPEG_AVC_FORMAT_DEFAULT -1
#define SCE_MPEG_AVC_FORMAT_5650 0
#define SCE_MPEG_AVC_FORMAT_5551 1
#define SCE_MPEG_AVC_FORMAT_4444 2
#define SCE_MPEG_AVC_FORMAT_8888 3

typedef struct SceMpegAvcMode
&#123;
	/** unknown, set to -1 */
	SceInt32			iUnk0;
	/** Decode pixelformat */
	SceInt32			iPixelFormat;

&#125; SceMpegAvcMode;

/**
 * sceMpegInit
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegInit&#40;&#41;;

/**
 * sceMpegFinish
 */
SceVoid sceMpegFinish&#40;&#41;;

/**
 * sceMpegRingbufferQueryMemSize
 *
 * @param iPackets - number of packets in the ringbuffer
 *
 * @returns < 0 if error else ringbuffer data size.
 */
SceInt32 sceMpegRingbufferQueryMemSize&#40;SceInt32 iPackets&#41;;

/**
 * sceMpegRingbufferConstruct
 *
 * @param Ringbuffer - pointer to a sceMpegRingbuffer struct
 * @param iPackets - number of packets in the ringbuffer
 * @param pData - pointer to allocated memory
 * @param iSize - size of allocated memory, shoud be sceMpegRingbufferQueryMemSize&#40;iPackets&#41;
 * @param Callback - ringbuffer callback
 * @param pCBparam - param passed to callback
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegRingbufferConstruct&#40;SceMpegRingbuffer* Ringbuffer, SceInt32 iPackets, ScePVoid pData, SceInt32 iSize, sceMpegRingbufferCB Callback, ScePVoid pCBparam&#41;;

/**
 * sceMpegRingbufferDestruct
 *
 * @param Ringbuffer - pointer to a sceMpegRingbuffer struct
 */
SceVoid sceMpegRingbufferDestruct&#40;SceMpegRingbuffer* Ringbuffer&#41;;

/**
 * sceMpegQueryMemSize 
 *
 * @param Ringbuffer - pointer to a sceMpegRingbuffer struct
 *
 * @returns < 0 if error else number of free packets in the ringbuffer.
 */
SceInt32 sceMpegRingbufferAvailableSize&#40;SceMpegRingbuffer* Ringbuffer&#41;;

/**
 * sceMpegRingbufferPut
 *
 * @param Ringbuffer - pointer to a sceMpegRingbuffer struct
 * @param iNumPackets - num packets to put into the ringbuffer
 * @param iAvailable - free packets in the ringbuffer, should be sceMpegRingbufferAvailableSize&#40;&#41;
 *
 * @returns < 0 if error else number of packets.
 */
SceInt32 sceMpegRingbufferPut&#40;SceMpegRingbuffer* Ringbuffer, SceInt32 iNumPackets, SceInt32 iAvailable&#41;;

/**
 * sceMpegQueryMemSize
 *
 * @param iUnk - Unknown, set to 0
 *
 * @returns < 0 if error else decoder data size.
 */
SceInt32 sceMpegQueryMemSize&#40;int iUnk&#41;;

/**
 * sceMpegCreate
 *
 * @param Mpeg - will be filled
 * @param pData - pointer to allocated memory of size = sceMpegQueryMemSize&#40;&#41;
 * @param iSize - size of data, should be = sceMpegQueryMemSize&#40;&#41;
 * @param Ringbuffer - a ringbuffer
 * @param iFrameWidth - display buffer width, set to 512 if writing to framebuffer
 * @param iUnk1 - unknown, set to 0
 * @param iUnk2 - unknown, set to 0
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegCreate&#40;SceMpeg* Mpeg, ScePVoid pData, SceInt32 iSize, SceMpegRingbuffer* Ringbuffer, SceInt32 iFrameWidth, SceInt32 iUnk1, SceInt32 iUnk2&#41;;

/**
 * sceMpegDelete
 *
 * @param Mpeg - SceMpeg handle
 */
SceVoid sceMpegDelete&#40;SceMpeg* Mpeg&#41;;

/**
 * sceMpegQueryStreamOffset
 *
 * @param Mpeg - SceMpeg handle
 * @param pBuffer - pointer to file header
 * @param iOffset - will contain stream offset in bytes, usually 2048
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegQueryStreamOffset&#40;SceMpeg* Mpeg, ScePVoid pBuffer, SceInt32* iOffset&#41;;

/**
 * sceMpegQueryStreamSize
 *
 * @param pBuffer - pointer to file header
 * @param iSize - will contain stream size in bytes
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegQueryStreamSize&#40;ScePVoid pBuffer, SceInt32* iSize&#41;;

/**
 * sceMpegRegistStream
 *
 * @param Mpeg - SceMpeg handle
 * @param iStreamID - stream id, 0 for video, 1 for audio
 * @param iUnk - unknown, set to 0
 *
 * @returns 0 if error.
 */
SceMpegStream* sceMpegRegistStream&#40;SceMpeg* Mpeg, SceInt32 iStreamID, SceInt32 iUnk&#41;;

/**
 * sceMpegUnRegistStream
 *
 * @param Mpeg - SceMpeg handle
 * @param pStream - pointer to stream
 */
SceVoid sceMpegUnRegistStream&#40;SceMpeg Mpeg, SceMpegStream* pStream&#41;;

/**
 * sceMpegFlushAllStreams
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegFlushAllStream&#40;SceMpeg* Mpeg&#41;;

/**
 * sceMpegMallocAvcEsBuf
 *
 * @returns 0 if error else pointer to buffer.
 */
ScePVoid sceMpegMallocAvcEsBuf&#40;SceMpeg* Mpeg&#41;;

/**
 * sceMpegFreeAvcEsBuf
 *
 */
SceVoid sceMpegFreeAvcEsBuf&#40;SceMpeg* Mpeg, ScePVoid pBuf&#41;;

/**
 * sceMpegQueryAtracEsSize
 *
 * @param Mpeg - SceMpeg handle
 * @param iEsSize - will contain size of Es
 * @param iOutSize - will contain size of decoded data
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegQueryAtracEsSize&#40;SceMpeg* Mpeg, SceInt32* iEsSize, SceInt32* iOutSize&#41;;

/**
 * sceMpegInitAu
 *
 * @param Mpeg - SceMpeg handle
 * @param pEsBuffer - prevously allocated Es buffer
 * @param pAu - will contain pointer to Au
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegInitAu&#40;SceMpeg* Mpeg, ScePVoid pEsBuffer, SceMpegAu* pAu&#41;;

/**
 * sceMpegGetAvcAu
 *
 * @param Mpeg - SceMpeg handle
 * @param pStream - associated stream
 * @param pAu - will contain pointer to Au
 * @param iUnk - unknown
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegGetAvcAu&#40;SceMpeg* Mpeg, SceMpegStream* pStream, SceMpegAu* pAu, SceInt32* iUnk&#41;;

/**
 * sceMpegAvcDecodeMode
 *
 * @param Mpeg - SceMpeg handle
 * @param pMode - pointer to SceMpegAvcMode struct defining the decode mode &#40;pixelformat&#41;
 * @returns 0 if success.
 */
SceInt32 sceMpegAvcDecodeMode&#40;SceMpeg* Mpeg, SceMpegAvcMode* pMode&#41;;

/**
 * sceMpegAvcDecode
 *
 * @param Mpeg - SceMpeg handle
 * @param pAu - video Au
 * @param iFrameWidth - output buffer width, set to 512 if writing to framebuffer
 * @param pBuffer - buffer that will contain the decoded frame
 * @param iInit - will be set to 0 on first call, then 1
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegAvcDecode&#40;SceMpeg* Mpeg, SceMpegAu* pAu, SceInt32 iFrameWidth, ScePVoid pBuffer, SceInt32* iInit&#41;;

/**
 * sceMpegAvcDecodeStop
 *
 * @param Mpeg - SceMpeg handle
 * @param iFrameWidth - output buffer width, set to 512 if writing to framebuffer
 * @param pBuffer - buffer that will contain the decoded frame
 * @param iFrameNum - frame number
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegAvcDecodeStop&#40;SceMpeg* Mpeg, SceInt32 iFrameWidth, ScePVoid pBuffer, SceInt32* iStatus&#41;;

/**
 * sceMpegGetAtracAu
 *
 * @param Mpeg - SceMpeg handle
 * @param pStream - associated stream
 * @param pAu - will contain pointer to Au
 * @param pUnk - unknown
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegGetAtracAu&#40;SceMpeg* Mpeg, SceMpegStream* pStream, SceMpegAu* pAu, ScePVoid pUnk&#41;;

/**
 * sceMpegAtracDecode
 *
 * @param Mpeg - SceMpeg handle
 * @param pAu - video Au
 * @param pBuffer - buffer that will contain the decoded frame
 * @param iInit - set this to 1 on first call
 *
 * @returns 0 if success.
 */
SceInt32 sceMpegAtracDecode&#40;SceMpeg* Mpeg, SceMpegAu* pAu, ScePVoid pBuffer, SceInt32 iInit&#41;;

#ifdef __cplusplus
&#125;
#endif

#endif
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Code: Select all

Sending        src/audio/pspaudio.h
Sending        src/audio/sceAudio.S
Sending        src/display/pspdisplay.h
Sending        src/display/pspdisplay_kernel.h
Sending        src/mpeg/pspmpeg.h
Transmitting file data .....
Committed revision 2271.
Added to the repository.

I noticed that pspmpeg.h had ^M at the end of every line, so that may have been arsing up the patch process.

We really should get you your own svn access at this point, btw. :)
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

That would be nice :) Just PM me on what you need from me for that
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
e_boris
Posts: 25
Joined: Sat May 19, 2007 2:45 pm

Post by e_boris »

hi,Raphael. thanks for the updating.

but the sceAudioSetFrequency returns 1 all the time including feeding with 44100. And this call takes no effect. Waveform plays at 44100Hz always. I am using pspsdk rev2270 on PSP FW3.40A.

before that, I am using cooleyes' .a and .h. The result is that sceAudioSetFrequency crashs psp always. I think maybe I made some mistake in making the .a.
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Are you calling the function from within a kernel mode app? Also, are you running the CFW in 3.40 kernel mode or 1.50 kernel mode?
The problem is that the new stub is actually a kernel mode stub (ie should actually be sceAudio_driver) because the SetFrequency function is a kernel-mode only function and there isn't a user mode stub yet (I'm gonna do one asap).

EDIT: I just submitted rev 2273 which contains a pspAudio and pspAudio_driver library. So be sure you link the latter and include pspaudio_kernel.h if you want to use sceAudioSetFrequency.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
e_boris
Posts: 25
Joined: Sat May 19, 2007 2:45 pm

Post by e_boris »

I'm testing the app with 1.5 kernel. At the first I set the main thread in user mode. But tried setting main thread in kernel mode. The problem remains. cooleyes also tells me the same way as you told to check the problem.

I will try the new revision ASAP, thanks for your quick update.
Post Reply