//[HlePspNotImplemented] public int sceMpegAvcDecode(SceMpegPointer *SceMpegPointer, SceMpegAu *MpegAccessUnit, int FrameWidth, PspPointer *OutputBufferPointer, PspPointer *Init) { //if (*Init == 1) //{ // throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA)); //} var SceMpegData = GetSceMpegData(SceMpegPointer); var Mpeg = GetMpeg(SceMpegPointer); // Dummy var VideoPacket = new VideoPacket(); //Console.Error.WriteLine("0x{0:X}", PspMemory.PointerToPspAddress(OutputBuffer)); //Console.WriteLine("{0:X8}", (*OutputBufferPointer).Address); Mpeg.AvcDecode( MpegAccessUnit, FrameWidth, SceMpegData->SceMpegAvcMode.PixelFormat, *OutputBufferPointer ); SceMpegData->AvcFrameStatus = 1; //Init = SceMpegData->AvcFrameStatus; //throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA)); return(0); }
public void AtracDecode(SceMpegAu *MpegAccessUnit, byte *OutputBuffer, bool Init) { if (MpegAccessUnit != null) { *MpegAccessUnit = GetAtracAu(StreamId.Atrac); } }
public int sceMpegAtracDecode(SceMpegPointer *SceMpegPointer, SceMpegAu *MpegAccessUnit, byte *OutputBuffer, int Init) { var Mpeg = GetMpeg(SceMpegPointer); if (!Mpeg.HasData) { throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA)); } Mpeg.AtracDecode(MpegAccessUnit, OutputBuffer, (Init != 0)); return(0); }
public void AvcDecode(SceMpegAu *MpegAccessUnit, int FrameWidth, GuPixelFormats GuPixelFormat, PspPointer OutputBuffer) { if (MpegAccessUnit != null) { *MpegAccessUnit = GetAvcAu(StreamId.Avc); } while (MpegPsDemuxer.HasMorePackets) { if (!DecodePsPacket()) { return; } } if (VideoStream.Length <= 0) { return; } // Buffer 1MB //if (VideoStream.Length <= 1 * 1024 * 1024) return; try { //if (H264FrameDecoder.HasMorePackets) { //Console.WriteLine("VideoStream.Length: {0}", VideoStream.Length); var Frame = H264FrameDecoder.DecodeFrame(); ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.DarkGreen, () => { Console.WriteLine("DecodedFrame: {0}", FrameIndex); }); var Bitmap = FrameUtils.imageFromFrameWithoutEdges(Frame, FrameWidth, 272); var TempBuffer = new byte[PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Bitmap.Width * Bitmap.Height)]; fixed(byte *TempBufferPtr = TempBuffer) { var TempBufferPtr2 = TempBufferPtr; Bitmap.LockBitsUnlock(PixelFormat.Format32bppArgb, (BitmapData) => { var InputBuffer = (OutputPixel *)BitmapData.Scan0.ToPointer(); int Count = Bitmap.Width * Bitmap.Height; for (int n = 0; n < Count; n++) { var Color = InputBuffer[n]; InputBuffer[n].R = Color.B; InputBuffer[n].G = Color.G; InputBuffer[n].B = Color.R; InputBuffer[n].A = 0xFF; } PixelFormatDecoder.Encode(GuPixelFormat, InputBuffer, TempBufferPtr2, Bitmap.Width * Bitmap.Height); PixelFormatDecoder.Encode(PspDisplay.CurrentInfo.PixelFormat, InputBuffer, (byte *)Memory.PspAddressToPointerSafe(PspDisplay.CurrentInfo.FrameAddress), 512, Bitmap.Width, Bitmap.Height); PspDisplay.CurrentInfo.PlayingVideo = true; }); PspDisplay.CurrentInfo.PlayingVideo = true; Memory.WriteBytes(OutputBuffer.Address, TempBufferPtr, TempBuffer.Length); GpuImpl.InvalidateCache(OutputBuffer.Address, TempBuffer.Length); } if (SaveBitmapFrame) { Bitmap.Save(@"c:\temp\frame" + (FrameIndex) + ".png"); } FrameIndex++; } //PixelFormat return; } catch (EndOfStreamException) { ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.Red, () => { Console.WriteLine("H264FrameDecoder.DecodeFrame: EndOfStreamException"); }); } }
public int sceMpegGetAvcAu(SceMpeg *Mpeg, SceMpegStream *pStream, SceMpegAu *pAu, int *iUnk) { //throw(new NotImplementedException()); return(0); }
public int sceMpegAvcDecode(SceMpeg *Mpeg, SceMpegAu *pAu, int iFrameWidth, void *pBuffer, int *iInit) { //throw(new NotImplementedException()); return(0); }
public int sceMpegInitAu(SceMpeg *Mpeg, void *pEsBuffer, SceMpegAu *pAu) { //throw(new NotImplementedException()); return(-1); }
public int sceMpegAtracDecode(SceMpeg *Mpeg, SceMpegAu *pAu, void *pBuffer, int iInit) { //throw(new NotImplementedException()); return(-1); }