Skip to content

Commit

Permalink
Complete rewrite of the sceMpeg and scePsmfPlayer modules to better
Browse files Browse the repository at this point in the history
match the PSP implementation mpeg.prx and libpsmfplayer.prx
  • Loading branch information
gid15 committed Dec 7, 2018
1 parent 05d67ab commit a054603
Show file tree
Hide file tree
Showing 13 changed files with 6,689 additions and 4,158 deletions.
5 changes: 3 additions & 2 deletions src/jpcsp/GUI/UmdBrowser.java
Expand Up @@ -5,6 +5,7 @@
package jpcsp.GUI;

import static jpcsp.HLE.modules.sceAudiocodec.PSP_CODEC_AT3PLUS;
import static jpcsp.HLE.modules.scePsmf.MPEG_HEADER_BUFFER_MINIMUM_SIZE;

import java.awt.Color;
import java.awt.Component;
Expand Down Expand Up @@ -51,7 +52,7 @@
import jpcsp.HLE.VFS.iso.UmdIsoVirtualFile;
import jpcsp.HLE.modules.sceMpeg;
import jpcsp.HLE.modules.sceAtrac3plus.AtracFileInfo;
import jpcsp.HLE.modules.sceMpeg.PSMFHeader;
import jpcsp.HLE.modules.scePsmf.PSMFHeader;
import jpcsp.filesystems.umdiso.UmdIsoFile;
import jpcsp.filesystems.umdiso.UmdIsoReader;
import jpcsp.format.PSF;
Expand Down Expand Up @@ -577,7 +578,7 @@ private void onSelectionChanged(ListSelectionEvent event) {
umdBrowserSound = new UmdBrowserSound(Memory.getInstance(), iso.readSnd0());
} else {
IVirtualFile pmf = new UmdIsoVirtualFile(iso.getFile("PSP_GAME/ICON1.PMF"));
byte mpegHeader[] = new byte[sceMpeg.MPEG_HEADER_BUFFER_MINIMUM_SIZE];
byte mpegHeader[] = new byte[MPEG_HEADER_BUFFER_MINIMUM_SIZE];
if (pmf.ioRead(mpegHeader, 0, mpegHeader.length) == mpegHeader.length) {
PSMFHeader psmfHeader = new PSMFHeader(0, mpegHeader);
if (psmfHeader.getSpecificStreamNum(sceMpeg.PSMF_ATRAC_STREAM) > 0) {
Expand Down
8 changes: 4 additions & 4 deletions src/jpcsp/GUI/UmdVideoPlayer.java
Expand Up @@ -28,6 +28,7 @@
import static jpcsp.HLE.modules.sceCtrl.PSP_CTRL_UP;
import static jpcsp.HLE.modules.sceMpeg.UNKNOWN_TIMESTAMP;
import static jpcsp.HLE.modules.sceMpeg.mpegTimestampPerSecond;
import static jpcsp.HLE.modules.scePsmfPlayer.videoTimestampStep;
import static jpcsp.HLE.modules.sceUtility.PSP_SYSTEMPARAM_BUTTON_CROSS;
import static jpcsp.HLE.modules.sceUtility.getSystemParamButtonPreference;
import static jpcsp.format.psmf.PsmfAudioDemuxVirtualFile.PACK_START_CODE;
Expand Down Expand Up @@ -88,7 +89,6 @@
import jpcsp.memory.MemoryWriter;
import jpcsp.util.Utilities;
import jpcsp.HLE.Modules;
import jpcsp.HLE.modules.sceMpeg;
import jpcsp.HLE.modules.sceUtility;

import com.twilight.h264.decoder.GetBitContext;
Expand Down Expand Up @@ -1199,7 +1199,7 @@ public void stepVideo() {
boolean skipFrame = false;
if ((frame % fastForwardSpeeds[fastForwardSpeed]) != 0) {
skipFrame = true;
startTime -= sceMpeg.videoTimestampStep;
startTime -= videoTimestampStep;
}

if (videoCodec.hasImage() && !skipFrame) {
Expand Down Expand Up @@ -1242,7 +1242,7 @@ public void stepVideo() {

long now = System.currentTimeMillis();
long currentDuration = now - startTime;
long videoDuration = frame * 100000L / sceMpeg.videoTimestampStep;
long videoDuration = frame * 100000L / videoTimestampStep;
if (currentDuration < videoDuration) {
Utilities.sleep((int) (videoDuration - currentDuration), 0);
}
Expand All @@ -1253,7 +1253,7 @@ public void stepVideo() {
if (pesHeaderVideo.getPts() != UNKNOWN_TIMESTAMP) {
currentVideoTimestamp = pesHeaderVideo.getPts();
} else {
currentVideoTimestamp += sceMpeg.videoTimestampStep;
currentVideoTimestamp += videoTimestampStep;
}
if (log.isTraceEnabled()) {
MpsStreamInfo streamInfo = mpsStreams.get(currentStreamIndex);
Expand Down
29 changes: 24 additions & 5 deletions src/jpcsp/HLE/kernel/types/SceKernelErrors.java
Expand Up @@ -534,17 +534,35 @@ public class SceKernelErrors {
public final static int ERROR_PSMF_INVALID_PSMF = 0x80615501;

public final static int ERROR_PSMFPLAYER_NOT_INITIALIZED = 0x80616001;
public final static int ERROR_PSMFPLAYER_NOT_SUPPORTED = 0x80616003;
public final static int ERROR_PSMFPLAYER_NO_MEMORY = 0x80616005;
public final static int ERROR_PSMFPLAYER_INVALID_CONFIG_MODE = 0x80616006;
public final static int ERROR_PSMFPLAYER_INVALID_CONFIG_VALUE = 0x80616008;
public final static int ERROR_PSMFPLAYER_AUDIO_VIDEO_OUT_OF_SYNC = 0x8061600c;

public final static int ERROR_PSMFPLAYER_TOO_BIG_OFFSET = 0x80616009;
public final static int ERROR_PSMFPLAYER_FAILED_READ_HEADER = 0x8061600A;
public final static int ERROR_PSMFPLAYER_FATAL = 0x8061600B;
public final static int ERROR_PSMFPLAYER_NO_DATA = 0x8061600C;
public final static int ERROR_PSMFPLAYER_INVALID_PSMF = 0x8061600D;

public final static int ERROR_MP4_NOT_INIT = 0x80617001;
public final static int ERROR_MP4_ALREADY_INIT = 0x80617002;
public final static int ERROR_MP4_INVALID_VALUE = 0x80617003;
public final static int ERROR_MP4_INVALID_VALUE3 = 0x80617004;
public final static int ERROR_MP4_INVALID_VALUE2 = 0x80617005;
public final static int ERROR_MP4_INVALID_SAMPLE_NUMBER = 0x80617006;
public final static int ERROR_MP4_INVALID_SAMPLE_NUMBER2 = 0x80617007;
public final static int ERROR_MP4_NO_MEMORY = 0x80617008;
public final static int ERROR_MP4_NO_AVAILABLE_SIZE = 0x80617009;
public final static int ERROR_MP4_NO_MORE_DATA = 0x8061700a;
public final static int ERROR_MP4_NO_MORE_DATA = 0x8061700A;
public final static int ERROR_MP4_AAC_DECODE_INIT_ERROR = 0x80617121;
public final static int ERROR_MP4_AAC_DECODE_ERROR = 0x80617141;
public final static int ERROR_MP4_AAC_DECODE_NO_MEMORY = 0x80617151;
public final static int ERROR_MP4_AAC_DECODE_ALREADY_INIT = 0x80617154;

public final static int ERROR_MPEG_NO_DATA = 0x80618001;
public final static int ERROR_MPEG_NO_NEXT_DATA = 0x80618004;
public final static int ERROR_MPEG_ALREADY_USED = 0x80618005;
public final static int ERROR_MPEG_ILLEGAL_STREAM = 0x80618007;
public final static int ERROR_MPEG_UNKNOWN_STREAM_ID = 0x80618009;

public final static int ERROR_AVC_INVALID_VALUE = 0x806201FE;
Expand Down Expand Up @@ -594,8 +612,9 @@ public class SceKernelErrors {
public final static int ERROR_AAC_NOT_ENOUGH_MEMORY = 0x80691501;
public final static int ERROR_AAC_RESOURCE_NOT_INITIALIZED = 0x80691503;

public final static int ERROR_CODEC_AUDIO_EDRAM_NOT_ALLOCATED = 0x807f0004;
public final static int ERROR_CODEC_AUDIO_FATAL = 0x807f00fc;
public final static int ERROR_CODEC_AUDIO_EDRAM_NOT_ALLOCATED = 0x807F0004;
public final static int ERROR_CODEC_AUDIO_FATAL = 0x807F00FC;
public final static int ERROR_CODEC_AUDIO_UNKNOWN_ERROR = 0x807F00FF;

public final static int FATAL_UMD_UNKNOWN_MEDIUM = 0xC0210004;
public final static int FATAL_UMD_HARDWARE_FAILURE = 0xC0210005;
Expand Down

0 comments on commit a054603

Please sign in to comment.