From db8f01717c14f513850116abe638de4cc369873d Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 6 Jan 2014 20:16:11 +0400 Subject: [PATCH] cellPamf improvements --- rpcs3/Emu/SysCalls/Modules/cellPamf.cpp | 90 ++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index 3b5319e28a..980d297d53 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -64,6 +64,73 @@ struct CellCodecEsFilterId { be_t supplementalInfo2; }; +// AVC (MPEG4 AVC Video) Specific Information +struct CellPamfAvcInfo { + u8 profileIdc; + u8 levelIdc; + u8 frameMbsOnlyFlag; + u8 videoSignalInfoFlag; + u8 frameRateInfo; + u8 aspectRatioIdc; + be_t sarWidth; //reserved + be_t sarHeight; //reserved + be_t horizontalSize; //multiple of 16 + be_t verticalSize; //multiple of 16 + be_t frameCropLeftOffset; //reserved + be_t frameCropRightOffset; //reserved + be_t frameCropTopOffset; //reserved + be_t frameCropBottomOffset; + u8 videoFormat; //reserved + u8 videoFullRangeFlag; + u8 colourPrimaries; + u8 transferCharacteristics; + u8 matrixCoefficients; + u8 entropyCodingModeFlag; //reserved + u8 deblockingFilterFlag; + u8 minNumSlicePerPictureIdc; //reserved + u8 nfwIdc; //reserved + u8 maxMeanBitrate; //reserved +}; + +// M2V (MPEG2 Video) Specific Information +struct CellPamfM2vInfo { + u8 profileAndLevelIndication; + be_t progressiveSequence; + u8 videoSignalInfoFlag; + u8 frameRateInfo; + u8 aspectRatioIdc; + be_t sarWidth; + be_t sarHeight; + be_t horizontalSize; + be_t verticalSize; + be_t horizontalSizeValue; + be_t verticalSizeValue; + u8 videoFormat; + u8 videoFullRangeFlag; + u8 colourPrimaries; + u8 transferCharacteristics; + u8 matrixCoefficients; +}; + +// LPCM Audio Specific Information +struct CellPamfLpcmInfo { + be_t samplingFrequency; + u8 numberOfChannels; + be_t bitsPerSample; +}; + +// ATRAC3+ Audio Specific Information +struct CellPamfAtrac3plusInfo { + be_t samplingFrequency; + u8 numberOfChannels; +}; + +// AC3 Audio Specific Information +struct CellPamfAc3Info { + be_t samplingFrequency; + u8 numberOfChannels; +}; + #pragma pack(push, 1) //file data struct PamfStreamHeader_AVC { //AVC information @@ -72,8 +139,8 @@ struct PamfStreamHeader_AVC { //AVC information u8 unk0; u8 unk1; //1 u32 unk2; //0 - be_t horizontalSize; //multiplied by 16 - be_t verticalSize; //multiplied by 16 + be_t horizontalSize; //divided by 16 + be_t verticalSize; //divided by 16 u32 unk3; //0 u32 unk4; //0 u8 unk5; //0xA0 @@ -415,7 +482,24 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, //TODO switch (pAddr->stream_headers[pSelf->stream].type) { - case 0x1b: /*CELL_PAMF_STREAM_TYPE_AVC*/ break; + case 0x1b: /*CELL_PAMF_STREAM_TYPE_AVC*/ + { + //target structure + mem_ptr_t pInfo(pInfo_addr); + //file data structure (fixed offset 0x98, fixed step 0x30) + mem_ptr_t pAVC(pSelf->pAddr + 0x98 + pSelf->stream * 0x30); + if (size != sizeof(CellPamfAvcInfo)) { + cellPamf.Error("cellPamfReaderGetStreamInfo: incorrect AVC data size(%d)", size); + break; + } + //TODO + pInfo->profileIdc = pAVC->profileIdc; + pInfo->levelIdc = pAVC->levelIdc; + + pInfo->horizontalSize = pAVC->horizontalSize; + pInfo->verticalSize = pAVC->verticalSize; + } + break; case 0xdc: /*CELL_PAMF_STREAM_TYPE_ATRAC3PLUS*/ break; case 0x80: /*CELL_PAMF_STREAM_TYPE_PAMF_LPCM*/ break; case 0xdd: /*CELL_PAMF_STREAM_TYPE_USER_DATA*/ break;