📄 em85xx.cpp
字号:
ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); eAudioFormat_type formatType = eAudioFormat_PCM; 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); activate = 0; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); activate = 1; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); sr = pPcmParameters->SamplesPerSecond; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioSampleRate; Dp.PropTypeLength = sizeof (RMuint32); Dp.pValue = &sr; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); 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); bps = pPcmParameters->NumberOfBitsPerSample; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioNumberOfBitsPerSample; Dp.PropTypeLength = sizeof (bps); Dp.pValue = &bps; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); nac = pPcmParameters->NumberOfChannels; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioNumberOfChannels; Dp.PropTypeLength = sizeof (nac); Dp.pValue = &nac; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); formatType = eAudioFormat_PCM; Dp.PropSet = AUDIO_SET; Dp.PropId = eAudioFormat; Dp.PropTypeLength = sizeof (formatType); Dp.pValue = &formatType; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_SET_PROPERTY, &Dp); return MPEG_DECODER_ERROR_NO_ERROR;}MPEG_DECODER_ERROR MpegDecoder::SetAC3Parameters (AC3_PARAMETERS *pAc3Parameters){ decoderproperty Dp; RMint32 activate = 0; ioctl (m_handle, REALMAGICHWL_IOCTL_DECODER_AUDIO_SWITCH, &activate); RMuint32 sr = pAc3Parameters->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 (pAc3Parameters->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_AC3; 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, (" fixedVOPRate: %lu\n", pMpegVideoParameters->fixedVOPRate)); DEBUGMSG (1, (" videoTimeScale: %lu\n", pMpegVideoParameters->videoTimeScale)); 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->videoTimeScale), &pMpegVideoParameters->videoTimeScale); 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->videoTimeScale), &pMpegVideoParameters->videoTimeScale); ASSERT (pMpegVideoParameters->fixedVOPRate); 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); } } 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){ 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 = 0x0; 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::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 + -