📄 em85xx.cpp
字号:
AacConf.AacFormat = eaAacFormat_DSI; break; default: DEBUGMSG (1, ("SetAACParameters: Unknown AACType\n")); return MPEG_DECODER_ERROR_INVALID_PARAMETER; break; } Dp.PropSet = AUDIO_SET; Dp.PropId = eaAacConf; Dp.PropTypeLength = sizeof (eaAacConf_type); Dp.pValue = &AacConf; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); RMuint32 sr = pAacParameters->SamplesPerSecond; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioSampleRate; Dp.PropTypeLength = sizeof (RMuint32); Dp.pValue = &sr; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); eAudioDigitalOutput_type outputType = eAudioDigitalOutput_Pcm; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioDigitalOutput; Dp.PropTypeLength = sizeof (outputType); Dp.pValue = &outputType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); eAudioFormat_type formatType = eAudioFormat_AAC; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioFormat; Dp.PropTypeLength = sizeof (formatType); Dp.pValue = &formatType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); activate = 1; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::SetDTSParameters (DTS_PARAMETERS *pDtsParameters){ decoderproperty Dp; RMint32 activate = 0; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); RMuint32 sr = pDtsParameters->SamplesPerSecond; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioSampleRate; Dp.PropTypeLength = sizeof (RMuint32); Dp.pValue = &sr; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); // only pass though allowed ASSERT (pDtsParameters->rawOutput); eAudioDigitalOutput_type outputType = eAudioDigitalOutput_Compressed; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioDigitalOutput; Dp.PropTypeLength = sizeof (outputType); Dp.pValue = &outputType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); eAudioFormat_type formatType = eAudioFormat_DTS; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioFormat; Dp.PropTypeLength = sizeof (formatType); Dp.pValue = &formatType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); activate = 1; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::SetMpegAudioParameters (MPEGAUDIO_PARAMETERS *pMpegAudioParameters){ decoderproperty Dp; RMint32 activate = 0; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); RMuint32 sr = pMpegAudioParameters->SamplesPerSecond; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioSampleRate; Dp.PropTypeLength = sizeof (RMuint32); Dp.pValue = &sr; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); eAudioDigitalOutput_type outputType = eAudioDigitalOutput_Pcm; if (pMpegAudioParameters->rawOutput) outputType = eAudioDigitalOutput_Compressed; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioDigitalOutput; Dp.PropTypeLength = sizeof (outputType); Dp.pValue = &outputType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); eAudioFormat_type formatType = eAudioFormat_MPEG1; if (pMpegAudioParameters->layer == 3) { ASSERT (0); formatType = eAudioFormat_MPEG1_LAYER3; } Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioFormat; Dp.PropTypeLength = sizeof (formatType); Dp.pValue = &formatType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); activate = 1; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::SetMpegVideoParameters (MPEGVIDEO_PARAMETERS *pMpegVideoParameters){ DEBUGMSG (1, ("MpegDecoder::SetMpegVideoParameters:\n")); DEBUGMSG (1, (" isMPEG4: %lu\n", pMpegVideoParameters->isMPEG4)); DEBUGMSG (1, (" vopTimeIncrRes: %lu\n", pMpegVideoParameters->vopTimeIncrRes)); DEBUGMSG (1, (" videoTimeScale: %lu\n", pMpegVideoParameters->videoTimeScale)); DEBUGMSG (1, (" audioTimeScale: %lu\n", pMpegVideoParameters->audioTimeScale)); DEBUGMSG (1, (" fixedVOPRate: %lu\n", pMpegVideoParameters->fixedVOPRate)); DEBUGMSG (1, (" vopTimeIncr: %lu\n", pMpegVideoParameters->vopTimeIncr)); RUA_DECODER_STOP (m_handle); RUA_DECODER_SET_PROPERTY (m_handle, DECODER_SET, edecVideoStd, sizeof (pMpegVideoParameters->isMPEG4), &pMpegVideoParameters->isMPEG4); RUA_DECODER_PLAY (m_handle, VideoHwPlayNormal); if (pMpegVideoParameters->isMPEG4) { RUA_DECODER_SET_PROPERTY (m_handle, TIME_SET, etimVOPTimeIncrRes, sizeof (pMpegVideoParameters->vopTimeIncrRes), &pMpegVideoParameters->vopTimeIncrRes); RUA_DECODER_SET_PROPERTY (m_handle, TIME_SET, etimVideoCTSTimeScale, sizeof (pMpegVideoParameters->videoTimeScale), &pMpegVideoParameters->videoTimeScale); RUA_DECODER_SET_PROPERTY (m_handle, TIME_SET, etimAudioCTSTimeScale, sizeof (pMpegVideoParameters->audioTimeScale), &pMpegVideoParameters->audioTimeScale); if (pMpegVideoParameters->fixedVOPRate) { edecForceFixedVOPRate_type FixedVOPRate; FixedVOPRate.dwFixedTimeIncrRes = pMpegVideoParameters->videoTimeScale; FixedVOPRate.dwFixedVopTimeIncr = pMpegVideoParameters->vopTimeIncr; FixedVOPRate.dwForceFixedVOPRate = 1; RUA_DECODER_SET_PROPERTY (m_handle, DECODER_SET, edecForceFixedVOPRate, sizeof (FixedVOPRate), &FixedVOPRate); } else { edecForceFixedVOPRate_type FixedVOPRate; FixedVOPRate.dwFixedTimeIncrRes = 30000; FixedVOPRate.dwFixedVopTimeIncr = 1000; FixedVOPRate.dwForceFixedVOPRate = 0; RUA_DECODER_SET_PROPERTY (m_handle, DECODER_SET, edecForceFixedVOPRate, sizeof (FixedVOPRate), &FixedVOPRate); } } m_isMPEG4 = pMpegVideoParameters->isMPEG4; return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::WritePCM (RMuint8 *pPCM, RMuint32 length, RMuint8 *prefcount, RMuint32 flags, RMint64 scr, RMint64 pts){ feedpacket *pDataPacket; pDataPacket = getFreeFeedPacket (); if (pDataPacket == 0) { return MPEG_DECODER_ERROR_NO_ROOM; } DEBUGMSG (0, ("-> PCM (%10lu, %10lu)\n", (RMuint32)scr, (RMuint32)pts)); pDataPacket->vobu_sptm = 0; pDataPacket->scr = scr; pDataPacket->flags = flags; pDataPacket->packet.Pts = pts; pDataPacket->packet.pData = pPCM; pDataPacket->packet.EncryptedInfo = 0; pDataPacket->packet.unused1 = 0; pDataPacket->packet.pOverlapped = prefcount; pDataPacket->packet.DataLeft = length; ASSERT (length <= 0x2000); pDataPacket->streamID = AUDIO; pDataPacket->packet.nFrameHeaders = 0xffff; pDataPacket->packet.FirstAccessUnitPointer = 0x0; asm ("mcr p15, 0, r0, c7, c10, 0\n"); nextPacket (pAudioQ); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::WriteAC3 (RMuint8 *pAc3, RMuint32 length, RMuint8 *prefcount, RMuint32 flags, RMint64 scr, RMint64 pts, RMuint32 firstaccessunitpointer){ feedpacket *pDataPacket; pDataPacket = getFreeFeedPacket (); if (pDataPacket == 0) { return MPEG_DECODER_ERROR_NO_ROOM; } DEBUGMSG (0, ("-> AC3 (%10lu, %10lu)\n", (RMuint32)scr, (RMuint32)pts)); pDataPacket->vobu_sptm = 0; pDataPacket->scr = scr; pDataPacket->flags = flags; pDataPacket->packet.Pts = pts; pDataPacket->packet.pData = pAc3; pDataPacket->packet.EncryptedInfo = 0; pDataPacket->packet.unused1 = 0; pDataPacket->packet.pOverlapped = prefcount; pDataPacket->packet.DataLeft = length; ASSERT (length <= 0xffff); pDataPacket->streamID = AUDIO; pDataPacket->packet.nFrameHeaders = 0xffff; pDataPacket->packet.FirstAccessUnitPointer = firstaccessunitpointer; asm ("mcr p15, 0, r0, c7, c10, 0\n"); nextPacket (pAudioQ); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::WriteAAC (RMuint8 *pAac, RMuint32 length, RMuint8 *prefcount, RMuint32 flags, RMint64 scr, RMint64 pts){ feedpacket *pDataPacket; pDataPacket = getFreeFeedPacket (); if (pDataPacket == 0) { return MPEG_DECODER_ERROR_NO_ROOM; } DEBUGMSG (0, ("-> AAC (%10lu, %10lu)\n", (RMuint32)scr, (RMuint32)pts)); pDataPacket->vobu_sptm = 0; pDataPacket->scr = scr; pDataPacket->flags = flags; pDataPacket->packet.Pts = pts; pDataPacket->packet.pData = pAac; pDataPacket->packet.EncryptedInfo = 0; pDataPacket->packet.unused1 = 0; pDataPacket->packet.pOverlapped = prefcount; pDataPacket->packet.DataLeft = length; ASSERT (length <= 0x2000); pDataPacket->streamID = AUDIO; pDataPacket->packet.nFrameHeaders = 0xffff; pDataPacket->packet.FirstAccessUnitPointer = 0x0; asm ("mcr p15, 0, r0, c7, c10, 0\n"); nextPacket (pAudioQ); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::WriteDTS (RMuint8 *pDts, RMuint32 length, RMuint8 *prefcount, RMuint32 flags, RMint64 scr, RMint64 pts, RMint32 nFrameHeaders, RMint32 FirstAccessUnitPointer){ feedpacket *pDataPacket; pDataPacket = getFreeFeedPacket (); if (pDataPacket == 0) { return MPEG_DECODER_ERROR_NO_ROOM; } DEBUGMSG (0, ("-> DTS (%10lu, %10lu)\n", (RMuint32)scr, (RMuint32)pts)); pDataPacket->vobu_sptm = 0; pDataPacket->scr = scr; pDataPacket->flags = flags; pDataPacket->packet.Pts = pts; pDataPacket->packet.pData = pDts; pDataPacket->packet.EncryptedInfo = 0; pDataPacket->packet.unused1 = 0; pDataPacket->packet.pOverlapped = prefcount; pDataPacket->packet.DataLeft = length; ASSERT (length <= 0xffff); pDataPacket->streamID = AUDIO; pDataPacket->packet.nFrameHeaders = 1; pDataPacket->packet.FirstAccessUnitPointer = 0; asm ("mcr p15, 0, r0, c7, c10, 0\n"); nextPacket (pAudioQ); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::WriteMpegAudio (RMuint8 *pAudio, RMuint32 length, RMuint8 *prefcount, RMuint32 flags, RMint64 scr, RMint64 pts){ feedpacket *pDataPacket; pDataPacket = getFreeFeedPacket (); if (pDataPacket == 0) { return MPEG_DECODER_ERROR_NO_ROOM; } DEBUGMSG (0, ("-> MPEGA (%10lu, %10lu)\n", (RMuint32)scr, (RMuint32)pts)); pDataPacket->vobu_sptm = 0; pDataPacket->scr = scr; pDataPacket->flags = flags; pDataPacket->packet.Pts = pts; pDataPacket->packet.pData = pAudio; pDataPacket->packet.EncryptedInfo = 0; pDataPacket->packet.unused1 = 0; pDataPacket->packet.pOverlapped = prefcount; pDataPacket->packet.DataLeft = length; ASSERT (length <= 0xffff); pDataPacket->streamID = AUDIO; pDataPacket->packet.nFrameHeaders = 0xffff; pDataPacket->packet.FirstAccessUnitPointer = 0x0; asm ("mcr p15, 0, r0, c7, c10, 0\n"); nextPacket (pAudioQ); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::WriteMpegVideo (RMuint8 *pVideo, RMuint32 length, RMuint8 *prefcount, RMuint32 flags, RMint64 scr, RMint64 pts){ feedpacket *pDataPacket; pDataPacket = getFreeFeedPacket (); if (pDataPacket == 0) { ASSERT (0); return MPEG_DECODER_ERROR_NO_ROOM; } DEBUGMSG (0, ("-> VID (%10lu, %10lu) : %10lu (%ld)\n", (RMuint32)scr, (RMuint32)pts)); pDataPacket->vobu_sptm = 0; pDataPacket->scr = scr; pDataPacket->flags = flags; pDataPacket->packet.Pts = pts; pDataPacket->packet.pData = pVideo; pDataPacket->packet.EncryptedInfo = 0; pDataPacket->packet.unused1 = 0; pDataPacket->packet.pOverlapped = prefcount; ASSERT (length <= 0xffff); pDataPacket->packet.DataLeft = length; pDataPacket->streamID = VIDEO; asm ("mcr p15, 0, r0, c7, c10, 0\n"); nextPacket (pVideoQ); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::Brightness (RMint32 direction, RMint32 *pvalue){ RUA_DECODER_GET_PROPERTY (m_handle, VIDEO_SET, evBrightness, sizeof(*pvalue), pvalue); if (direction == 0) { *pvalue /= 32; return MPEG_DECODER_ERROR_NO_ERROR; } if (direction > 0) *pvalue += 32; else *pvalue -= 32; if (*pvalue > 1000) *pvalue = 1000; if (*pvalue < 0) *pvalue = 0; RUA_DECODER_SET_PROPERTY (m_handle, VIDEO_SET, evBrightness, sizeof(*pvalue), pvalue); RUA_DECODER_GET_PROPERTY (m_handle, VIDEO_SET, evBrightness, sizeof(*pvalue), pvalue); *pvalue /= 32; return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::Contrast (RMint32 direction, RMint32 *pvalue){ RUA_DECODER_GET_PROPERTY (m_handle, VIDEO_SET, evContrast, sizeof(*pvalue), pvalue); if (direction == 0) { *pvalue /= 32; return MPEG_DECODER_ERROR_NO_ERROR; } if (direction > 0) *pvalue += 32; else *pvalue -= 32; if (*pvalue > 1000) *pvalue = 1000; if (*pvalue < 0) *pvalue = 0; RUA_DECODER_SET_PROPERTY (m_handle, VIDEO_SET, evContrast, sizeof(*pvalue), pvalue); RUA_DECODER_GET_PROPERTY (m_handle, VIDEO_SET, evContrast, sizeof(*pvalue), pvalue); *pvalue /= 32; return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::Saturation (RMint32 direction, RMint32 *pvalue){ RUA_DECODER_GET_PROPERTY (m_handle, VIDEO_SET, evSaturation, sizeof(*pvalue), pvalue); if (direction == 0) { *pvalue /= 32; return MPEG_DECODER_ERROR_NO_ERROR; } if (direction > 0) *pvalue += 32; else *pvalue -= 32; if (*pvalue > 1000) *pvalue = 1000; if (*pvalue < 0) *pvalue = 0; RUA_DECODER_SET_PROPERTY (m_handle, VIDEO_SET, evSaturation, sizeof(*pvalue), pvalue); RUA_DECODER_GET_PROPERTY (m_handle, VIDEO_SET, evSaturation, sizeof(*pvalue), pvalue); *pvalue /= 32; return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::ClearScreen (){ ebiCommand_type command; command = ebiCommand_VideoHwBlackFrame; RUA_DECODER_SET_PROPERTY (m_handle, BOARDINFO_SET, ebiCommand, sizeof(command), &command); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::Exit (){ ASSERT (m_handle); close (m_handle); m_handle = 0; return MPEG_DECODER_ERROR_NO_ERROR;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -