Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        public int sceMpegAvcDecodeYCbCr(SceMpegPointer* Mpeg, int au_addr, int buffer_addr, int init_addr)
        {
            CheckEnabledMpeg();

            //throw (new NotImplementedException());
            return -1;
        }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 public int sceMpegQueryAtracEsSize(SceMpegPointer* Mpeg, int* ElementaryStreamSize, int* OutputSize)
 {
     *ElementaryStreamSize = MPEG_ATRAC_ES_SIZE;
     *OutputSize = MPEG_ATRAC_ES_OUTPUT_SIZE;
     //throw(new NotImplementedException());
     return 0;
 }
Esempio n. 5
0
        public int sceMpegAvcCsc(SceMpegPointer* Mpeg, int source_addr, int range_addr, int frameWidth, int dest_addr)
        {
            CheckEnabledMpeg();

            //throw(new NotImplementedException());
            return -1;
        }
Esempio n. 6
0
 public int sceMpegGetAtracAu(SceMpegPointer* SceMpegPointer, StreamId StreamId, out SceMpegAu MpegAccessUnit, out PspPointer Atrac3PlusPointer)
 {
     var Mpeg = GetMpeg(SceMpegPointer);
     if (!Mpeg.HasData) throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
     MpegAccessUnit = Mpeg.GetAtracAu(StreamId);
     Atrac3PlusPointer.Address = 0;
     return 0;
 }
Esempio n. 7
0
        public int sceMpegGetAtracAu(SceMpegPointer* Mpeg, StreamId StreamId, SceMpegAu* MpegAccessUnit, void* Atrac3PlusPointer)
        {
            CheckEnabledMpeg();

            //Mpeg->SceMpegData.

            throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
        }
Esempio n. 8
0
		public int sceMpegQueryStreamOffset(SceMpegPointer* MpegPointer, byte* PmfHeader, out uint Offset)
		{
			var Pmf = new Pmf().Load(new MemoryStream(PointerUtils.PointerToByteArray(PmfHeader, 2048)));

			var SceMpeg = MpegPointer->GetSceMpeg(PspMemory);

			SceMpeg->StreamSize = (int)(uint)Pmf.Header.StreamSize;

			Offset = (uint)Pmf.Header.StreamOffset;
			return 0;
		}
Esempio n. 9
0
		public int sceMpegGetAvcAu(SceMpegPointer* Mpeg, StreamId StreamId, SceMpegAu* MpegAccessUnit, int* DataAttributes)
		{
			CheckEnabledMpeg();

			if (DataAttributes != null)
			{
				*DataAttributes = 1;
			}

			throw(new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));

			//throw(new NotImplementedException());
			//return 0;
		}
Esempio n. 10
0
		//public SceMpegStream* sceMpegRegistStream(SceMpeg* Mpeg, int iStreamID, int iUnk)
		public int sceMpegRegistStream(SceMpegPointer* Mpeg, StreamId StreamId, int StreamIndex)
		{
			CheckEnabledMpeg();

			var StreamInfoId = RegisteredStreams.Create(new StreamInfo()
			{
				StreamId = StreamId,
				StreamIndex = StreamIndex,
			});
			//Console.WriteLine(iStreamID);
			//return 0;

			//var SceMpegData = GetSceMpegData(Mpeg);

			//throw(new NotImplementedException());
			return StreamInfoId;
		}
Esempio n. 11
0
        public int sceMpegAvcDecodeDetail(SceMpegPointer* Mpeg, AvcDecodeDetailStruct* AvcDecodeDetail)
        {
            CheckEnabledMpeg();

            var SceMpegData = GetSceMpegData(Mpeg);

            //throw(new NotImplementedException());
            AvcDecodeDetail->AvcDecodeResult = 0;
            AvcDecodeDetail->VideoFrameCount = 0;
            AvcDecodeDetail->AvcDetailFrameWidth = 512;
            AvcDecodeDetail->AvcDetailFrameHeight = 272;
            AvcDecodeDetail->FrameCropRectLeft = 0;
            AvcDecodeDetail->FrameCropRectRight = 0;
            AvcDecodeDetail->FrameCropRectTop = 0;
            AvcDecodeDetail->FrameCropRectBottom = 0;
            AvcDecodeDetail->AvcFrameStatus = SceMpegData->AvcFrameStatus;

            return 0;
        }
Esempio n. 12
0
        public int sceMpegInitAu(SceMpegPointer* Mpeg, int ElementaryStreamBuffer, SceMpegAu* MpegAccessUnit)
        {
            CheckEnabledMpeg();

            MpegAccessUnit->PresentationTimestampBe = unchecked((uint)0);
            MpegAccessUnit->PresentationTimestampLe = unchecked((uint)0);
            MpegAccessUnit->DecodeTimestampBe = unchecked((uint)0);
            MpegAccessUnit->DecodeTimestampLe = unchecked((uint)0);
            MpegAccessUnit->EsBuffer = ElementaryStreamBuffer;

            if (ElementaryStreamBuffer >= 1 && ElementaryStreamBuffer <= AbvEsBufAllocated.Length && AbvEsBufAllocated[ElementaryStreamBuffer - 1])
            {
                MpegAccessUnit->AuSize = MPEG_AVC_ES_SIZE;
            }
            else
            {
                MpegAccessUnit->AuSize = MPEG_ATRAC_ES_SIZE;
            }

            return 0;
        }
Esempio n. 13
0
		public int sceMpegCreate(SceMpegPointer* Mpeg, void* MpegData, int MpegSize, SceMpegRingbuffer* SceMpegRingbuffer, int FrameWidth, int Mode, int DdrTop)
		{
			CheckEnabledMpeg();

			//return -1;

			if (MpegSize < sceMpegQueryMemSize(0))
			{
				throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_MEMORY));
			}

			// Update the ring buffer struct.
			if (SceMpegRingbuffer->PacketSize == 0)
			{
				SceMpegRingbuffer->PacketsFree = 0;
			}
			else
			{
				SceMpegRingbuffer->PacketsFree = (int)((SceMpegRingbuffer->DataUpperBound.Address - SceMpegRingbuffer->Data.Address) / SceMpegRingbuffer->PacketSize);
			}
			SceMpegRingbuffer->SceMpeg = PspMemory.PointerToPspPointer(Mpeg);

			SceMpeg* SceMpegData = (SceMpeg*)&((byte*)MpegData)[0x30];

			Mpeg->SceMpeg = PspMemory.PointerToPspPointer(SceMpegData);

			PointerUtils.StoreStringOnPtr("LIBMPEG.001", Encoding.UTF8, SceMpegData->MagicBytes);
			SceMpegData->Unknown1 = -1;
			SceMpegData->RingBufferAddress = PspMemory.PointerToPspPointer(SceMpegRingbuffer);
			SceMpegData->RingBufferAddressDataUpper = SceMpegRingbuffer->DataUpperBound;
			SceMpegData->FrameWidth = FrameWidth;
			SceMpegData->SceMpegAvcMode.PixelFormat = Core.GuPixelFormats.RGBA_8888;
			SceMpegData->VideoFrameCount = 0;
			SceMpegData->AudioFrameCount = 0;

			SceMpegRingbuffer->Packets = 0;

			return 0;
		}
Esempio n. 14
0
        public int sceMpegAvcDecode(SceMpegPointer* Mpeg, SceMpegAu* MpegAccessUnit, int FrameWidth, PspPointer* OutputBufferPointer, int* Init)
        {
            CheckEnabledMpeg();

            if (*Init == 1)
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            }
            var SceMpegData = GetSceMpegData(Mpeg);

            //Console.Error.WriteLine("0x{0:X}", PspMemory.PointerToPspAddress(OutputBuffer));

            var OutputBuffer = (byte*)PspMemory.PspAddressToPointerSafe(OutputBufferPointer->Address);

            for (int n = 0; n < FrameWidth * 272 * 4; n++)
            {
                OutputBuffer[n] = 0xFF;
            }

            SceMpegData->AvcFrameStatus = 1;
            *Init = SceMpegData->AvcFrameStatus;
            //throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            return 0;
        }
Esempio n. 15
0
		public int sceMpegDelete(SceMpegPointer* Mpeg)
		{

			//throw(new NotImplementedException());

			return 0;
		}
Esempio n. 16
0
 public uint sceMpegFreeAvcEsBuf(SceMpegPointer* Mpeg, int ElementaryStream)
 {
     AbvEsBufAllocated[ElementaryStream - 1] = false;
     return 0;
 }
Esempio n. 17
0
 public int sceMpegMallocAvcEsBuf(SceMpegPointer* Mpeg)
 {
     for (int n = 0; n < 2; n++)
     {
         if (!AbvEsBufAllocated[n])
         {
             AbvEsBufAllocated[n] = true;
             return n + 1;
         }
     }
     return 0;
 }
Esempio n. 18
0
        public int sceMpegAvcDecodeMode(SceMpegPointer* Mpeg, SceMpegAvcMode* Mode)
        {
            CheckEnabledMpeg();

            var SceMpegData = GetSceMpegData(Mpeg);

            if (Mode != null)
            {
                SceMpegData->SceMpegAvcMode = *Mode;
            }
            return 0;
        }
Esempio n. 19
0
        public int sceMpegAvcDecodeStop(SceMpegPointer* Mpeg, int FrameWidth, byte* OutputBuffer, int* Status)
        {
            var SceMpegData = GetSceMpegData(Mpeg);

            //throw(new NotImplementedException());
            return 0;
        }
Esempio n. 20
0
 public int sceMpegAvcDecodeStopYCbCr(SceMpegPointer* Mpeg, byte* OutputBuffer, out int Status)
 {
     Status = 0;
     //throw (new NotImplementedException());
     //return -1;
     return 0;
 }
Esempio n. 21
0
 public int sceMpegQueryAtracEsSize(SceMpegPointer* Mpeg, out int ElementaryStreamSize, out int OutputSize)
 {
     ElementaryStreamSize = MPEG_ATRAC_ES_SIZE;
     OutputSize = MPEG_ATRAC_ES_OUTPUT_SIZE;
     return 0;
 }
Esempio n. 22
0
 public SceMpeg* GetSceMpegData(SceMpegPointer* SceMpeg)
 {
     return SceMpeg->GetSceMpeg(PspMemory);
 }
Esempio n. 23
0
        public int sceMpegGetAvcAu(SceMpegPointer* SceMpegPointer, StreamId StreamId, out SceMpegAu MpegAccessUnit, int* DataAttributes)
        {
            if (DataAttributes != null)
            {
                *DataAttributes = 1;
            }

            var Mpeg = GetMpeg(SceMpegPointer);
            if (!Mpeg.HasData) throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            MpegAccessUnit = Mpeg.GetAvcAu(StreamId);
            return 0;
        }
Esempio n. 24
0
 public int sceMpegAvcCsc(SceMpegPointer* Mpeg, int source_addr, int range_addr, int frameWidth, int dest_addr)
 {
     throw (new NotImplementedException());
 }
Esempio n. 25
0
		public int sceMpegAvcDecodeStopYCbCr(SceMpegPointer* Mpeg, int buffer_addr, int status_addr)
		{
			//throw (new NotImplementedException());
			return -1;
		}
Esempio n. 26
0
		public int sceMpegAvcInitYCbCr(SceMpegPointer* Mpeg, int mode, int width, int height, int ycbcr_addr)
		{
			CheckEnabledMpeg();

			//throw (new NotImplementedException());
			//return -1;
			return 0;
		}
Esempio n. 27
0
		public int sceMpegFlushAllStream(SceMpegPointer* Mpeg)
		{
			//throw(new NotImplementedException());
			return 0;
		}
Esempio n. 28
0
		public void sceMpegUnRegistStream(SceMpegPointer* Mpeg, int StreamInfoId)
		{
			RegisteredStreams.Remove(StreamInfoId);
			//throw(new NotImplementedException());
		}
Esempio n. 29
0
 public int sceMpegAvcDecodeFlush(SceMpegPointer* Mpeg)
 {
     //throw(new NotImplementedException());
     return 0;
 }
Esempio n. 30
0
		public int sceMpegAvcQueryYCbCrSize(SceMpegPointer* Mpeg, QueryYCbCrSizeModeEnum Mode, int Width, int Height, int* Result)
		{
			if ((Width & 15) != 0 || (Height & 15) != 0 || Width > 480 || Height > 272)
			{
				throw(new SceKernelException(SceKernelErrors.ERROR_MPEG_INVALID_VALUE));
			}

			*Result = (Width / 2) * (Height / 2) * 6 + 128;
			return 0;
		}