2012-11-01 15:19:01 +00:00
|
|
|
// Copyright (c) 2012- PPSSPP Project.
|
|
|
|
|
|
|
|
// 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
|
2012-11-04 22:01:49 +00:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
// 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 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2013-12-30 09:17:11 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Core/MIPS/MIPS.h"
|
2012-11-13 17:05:26 +00:00
|
|
|
|
2013-02-04 04:31:46 +00:00
|
|
|
class PointerWrap;
|
|
|
|
|
2012-11-13 17:05:26 +00:00
|
|
|
enum {
|
|
|
|
ERROR_MPEG_BAD_VERSION = 0x80610002,
|
|
|
|
ERROR_MPEG_NO_MEMORY = 0x80610022,
|
|
|
|
ERROR_MPEG_INVALID_ADDR = 0x80610103,
|
|
|
|
ERROR_MPEG_INVALID_VALUE = 0x806101fe,
|
|
|
|
ERROR_MPEG_NO_DATA = 0x80618001,
|
2013-06-07 08:10:25 +00:00
|
|
|
ERROR_MPEG_ALREADY_INIT = 0x80618005,
|
|
|
|
ERROR_MPEG_NOT_YET_INIT = 0x80618009,
|
2014-02-08 15:19:19 +00:00
|
|
|
ERROR_MPEG_AVC_INVALID_VALUE = 0x806201fe,
|
2014-02-01 15:53:48 +00:00
|
|
|
ERROR_MPEG_AVC_DECODE_FATAL = 0x80628002,
|
2014-02-08 16:10:28 +00:00
|
|
|
ERROR_JPEG_INVALID_VALUE = 0x80650051,
|
2012-11-13 17:05:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// MPEG statics.
|
2013-04-06 03:58:35 +00:00
|
|
|
static const u32 PSMF_MAGIC = 0x464D5350;
|
2012-11-13 17:05:26 +00:00
|
|
|
static const int PSMF_STREAM_VERSION_OFFSET = 0x4;
|
|
|
|
static const int PSMF_STREAM_OFFSET_OFFSET = 0x8;
|
|
|
|
static const int PSMF_STREAM_SIZE_OFFSET = 0xC;
|
2013-06-09 20:21:36 +00:00
|
|
|
static const int PSMF_FIRST_TIMESTAMP_OFFSET = 0x54;
|
|
|
|
static const int PSMF_LAST_TIMESTAMP_OFFSET = 0x5A;
|
2012-11-13 17:05:26 +00:00
|
|
|
|
|
|
|
struct SceMpegAu {
|
2013-07-31 15:40:45 +00:00
|
|
|
s64_le pts; // presentation time stamp
|
|
|
|
s64_le dts; // decode time stamp
|
|
|
|
u32_le esBuffer;
|
|
|
|
u32_le esSize;
|
2013-01-07 03:22:52 +00:00
|
|
|
|
|
|
|
void read(u32 addr) {
|
|
|
|
Memory::ReadStruct(addr, this);
|
2013-06-01 17:29:59 +00:00
|
|
|
pts = (pts & 0xFFFFFFFFULL) << 32 | (((u64)pts) >> 32);
|
|
|
|
dts = (dts & 0xFFFFFFFFULL) << 32 | (((u64)dts) >> 32);
|
2013-01-07 03:22:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void write(u32 addr) {
|
2013-06-01 17:29:59 +00:00
|
|
|
pts = (pts & 0xFFFFFFFFULL) << 32 | (((u64)pts) >> 32);
|
|
|
|
dts = (dts & 0xFFFFFFFFULL) << 32 | (((u64)dts) >> 32);
|
2013-01-07 03:22:52 +00:00
|
|
|
Memory::WriteStruct(addr, this);
|
|
|
|
}
|
2012-11-13 17:05:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// As native in PSP ram
|
|
|
|
struct SceMpegRingBuffer {
|
|
|
|
// PSP info
|
2013-07-27 22:53:30 +00:00
|
|
|
s32_le packets;
|
|
|
|
s32_le packetsRead;
|
|
|
|
s32_le packetsWritten;
|
|
|
|
s32_le packetsFree; // pspsdk: unk2, noxa: iUnk0
|
|
|
|
s32_le packetSize; // 2048
|
2014-01-06 06:20:27 +00:00
|
|
|
u32_le data; // address, ring buffer
|
2013-07-27 22:53:30 +00:00
|
|
|
u32_le callback_addr; // see sceMpegRingbufferPut
|
|
|
|
s32_le callback_args;
|
|
|
|
s32_le dataUpperBound;
|
|
|
|
s32_le semaID; // unused?
|
|
|
|
u32_le mpeg; // pointer to mpeg struct, fixed up in sceMpegCreate
|
2014-01-08 08:07:25 +00:00
|
|
|
// TODO: This appears in tests, but may not be in all versions.
|
|
|
|
//u32_le gp;
|
2012-11-13 17:05:26 +00:00
|
|
|
};
|
|
|
|
|
2013-06-08 20:53:36 +00:00
|
|
|
void __MpegInit();
|
2012-12-29 07:29:24 +00:00
|
|
|
void __MpegDoState(PointerWrap &p);
|
2012-11-13 17:05:26 +00:00
|
|
|
void __MpegShutdown();
|
|
|
|
|
2014-03-02 01:18:38 +00:00
|
|
|
void __MpegLoadModule(int version);
|
|
|
|
|
2013-12-30 09:17:11 +00:00
|
|
|
void Register_sceMpeg();
|