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 (c) 2005 Marcus R. Brown <[email protected]>
+ * Copyright (c) 2007 cooleyes
+ * Copyright (c) 2007 Alexander Berl <[email protected]>
*
* $Id$
*/
@@ -38,6 +40,13 @@
PSP_AUDIO_FORMAT_MONO = 0x10
};
+enum PspAudioFrequencies {
+ /** Sampling frequency set to 44100Hz. */
+ PSP_AUDIO_FREQ_44K = 44100,
+ /** Sampling frequency set to 48000Hz. */
+ PSP_AUDIO_FREQ_48K = 48000
+};
+
/** 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(int channel, int leftvol, int rightvol);
+/**
+ * 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(int frequency);
/*@}*/
#ifdef __cplusplus
Index: src/audio/sceAudio.S
===================================================================
--- src/audio/sceAudio.S (revision 2270)
+++ src/audio/sceAudio.S (working copy)
@@ -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: src/mpeg/pspmpeg.h
===================================================================
--- src/mpeg/pspmpeg.h (revision 2270)
+++ src/mpeg/pspmpeg.h (working copy)
@@ -6,6 +6,7 @@
* pspmpeg.h - Prototypes for the sceMpeg library
*
* Copyright (c) 2006 Sorin P. C. <[email protected]>
+ * Copyright (c) 2007 Alexander Berl <[email protected]>
*
* $Id$
*/
@@ -61,30 +62,38 @@
typedef struct SceMpegAu
{
- /** 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;
} 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
{
/** unknown, set to -1 */
SceInt32 iUnk0;
- /** unknonw, set to 3 */
- SceInt32 iUnk1;
+ /** Decode pixelformat */
+ SceInt32 iPixelFormat;
} SceMpegAvcMode;
+
/**
* sceMpegInit
*
@@ -275,6 +284,8 @@
/**
* sceMpegAvcDecodeMode
*
+ * @param Mpeg - SceMpeg handle
+ * @param pMode - pointer to SceMpegAvcMode struct defining the decode mode (pixelformat)
* @returns 0 if success.
*/
SceInt32 sceMpegAvcDecodeMode(SceMpeg* Mpeg, SceMpegAvcMode* pMode);
Index: src/display/pspdisplay.h
===================================================================
--- src/display/pspdisplay.h (revision 2270)
+++ src/display/pspdisplay.h (working copy)
@@ -8,6 +8,7 @@
* Copyright (c) 2005 Marcus R. Brown <[email protected]>
* Copyright (c) 2005 James Forshaw <[email protected]>
* Copyright (c) 2005 John Kelley <[email protected]>
+ * Copyright (c) 2007 Alexander Berl <[email protected]>
*
* $Id$
*/
@@ -77,7 +78,7 @@
*
* @param topaddr - address of start of framebuffer
* @param bufferwidth - buffer width (must be power of 2)
- * @param pixelformat - One of ::PspDisplayPixelFormats. (only succeeds with PSP_DISPLAY_PIXEL_FORMAT_8888)
+ * @param pixelformat - One of ::PspDisplayPixelFormats.
* @param sync - One of ::PspDisplaySetBufSync
*
* @return 0 on success
Index: src/display/pspdisplay_kernel.h
===================================================================
--- src/display/pspdisplay_kernel.h (revision 2270)
+++ src/display/pspdisplay_kernel.h (working copy)
@@ -8,6 +8,7 @@
* Copyright (c) 2005 Marcus R. Brown <[email protected]>
* Copyright (c) 2005 James Forshaw <[email protected]>
* Copyright (c) 2005 John Kelley <[email protected]>
+ * Copyright (c) 2007 Alexander Berl <[email protected]>
*
* $Id$
*/