📄 play_psfdemux_multicast.c
字号:
context->match_section_table[1].section_entry.comp[5] = 0x00; section_entry.Index = context->match_section_table[1].index; section_entry.SectionEntry = context->match_section_table[1].section_entry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_MatchSectionEntry, §ion_entry, sizeof(section_entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error RMDemuxTaskPropertyID_MatchSectionEntry")); } /* reset CAT version_number in hardware section filter */ context->match_section_table[3].section_entry.mask[5] = 0x00; context->match_section_table[3].section_entry.mode[5] = 0x00; context->match_section_table[3].section_entry.comp[5] = 0x00; section_entry.Index = context->match_section_table[3].index; section_entry.SectionEntry = context->match_section_table[3].section_entry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_MatchSectionEntry, §ion_entry, sizeof(section_entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "Error RMDemuxTaskPropertyID_MatchSectionEntry")); } /* reset ECM for next parity */ context->match_section_table[4].section_entry.mask[0] = 0xFC; context->match_section_table[4].section_entry.comp[0] = 0x80; section_entry.Index = context->match_section_table[4].index; section_entry.SectionEntry = context->match_section_table[4].section_entry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_MatchSectionEntry, §ion_entry, sizeof(section_entry), 0); if (RMFAILED(err)) { fprintf(stderr, "decoder: Error RMDemuxTaskPropertyID_MatchSectionEntry"); return RM_ERROR; } context->match_section_table[5].section_entry.mask[0] = 0xFC; context->match_section_table[5].section_entry.comp[0] = 0x80; section_entry.Index = context->match_section_table[5].index; section_entry.SectionEntry = context->match_section_table[5].section_entry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_MatchSectionEntry, §ion_entry, sizeof(section_entry), 0); if (RMFAILED(err)) { fprintf(stderr, "decoder: Error RMDemuxTaskPropertyID_MatchSectionEntry"); return RM_ERROR; } // enable pat pid#ifdef USE_HW_FIXED_PID_ENTRY { RMuint32 dummy; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PATPidEntryEnable, &dummy, sizeof(dummy), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "ResetDemuxTask Error RMDemuxTaskPropertyID_PATPidEntryEnable")); return err; } }#else err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &context->pat_pidentry, sizeof(context->pat_pidentry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "ResetDemuxTask Error RMDemuxTaskPropertyID_PidEntryEnable")); return err; }#endif return RM_OK;}static RMstatus SetHwAVPlayback(struct context_per_task *context){ RMstatus err; struct DemuxTask_PidEntry_type entry; struct DemuxTask_PidEntryAddCipher_type cipher; RMDBGLOG((ENABLE, "============== %ld_SetHwAVPlayback vpid=%x apid=%x pcrpid=%x\n", context->id, context->video_pid, context->audio_pid, context->pcr_pid)); if (context->video_pid != 0x1fff) { /* set the video pid */ entry.index = context->video_pidentry; entry.PidEntry.pid = context->video_pid; entry.PidEntry.input_type = EMhwlibPid_Ts; entry.PidEntry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntry, &entry, sizeof(entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error video RMDemuxTaskPropertyID_PidEntry", context->id)); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error video RMDemuxTaskPropertyID_PidEntryEnable", context->id)); return err; } } else { /* disable the video pid */ entry.index = context->video_pidentry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error video RMDemuxTaskPropertyID_PidEntryDisable", context->id)); return err; } } if (context->audio_pid != 0x1fff) { /* set the audio pid */ entry.index = context->audio_pidentry; entry.PidEntry.pid = context->audio_pid; /* same PidEntry.input_type as video */ entry.PidEntry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntry, &entry, sizeof(entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error audio RMDemuxTaskPropertyID_PidEntry", context->id)); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error audio RMDemuxTaskPropertyID_PidEntryEnable", context->id)); return err; } } else { /* disable the audio pid */ entry.index = context->audio_pidentry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error audio RMDemuxTaskPropertyID_PidEntryDisable", context->id)); return err; } } /* set the pcr pid */#ifdef USE_HW_PCR_PID_ENTRY /* EM8634 has three hardware PCR filters but only two clock recovery blocks, limiting us to only two hardware PCR filters. For the third task we have to use PCR extraction from PidBank. For task 0 and 1 I will use the hardware PCR pids and for task 2 the PidBank pcr pid. */ if(context->id < 2) { /* Set and enable the pcr extraction from special hardware pcr pid. We don't need any output connected. */ if ( context->pcr_pid != 0x1fff ) { RMuint32 dummy; struct EMhwlibPCRPidEntry_type hwpcr; RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback USE_HW_PCR_PID_ENTRY\n", context->id)); hwpcr.pid = context->pcr_pid; hwpcr.clock_recovery_id = context->id; /* 0 or 1 for EM8634. Next chips will have a clock recovery for every PCR: 0, 1, 2. */ err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PCRPidEntry, &hwpcr, sizeof(hwpcr), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PCRPidEntry", context->id)); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PCRPidEntryEnable, &dummy, sizeof(dummy), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PCRPidEntryEnable", context->id)); return err; } } } else /* third task will use PCR extraction from PidBank. */#endif { /* select the pcr extraction from pid bank. we need to have an output associated and enabled. */ if ( (context->pcr_pid != context->video_pid) && (context->pcr_pid != context->audio_pid) && (context->pcr_pid != 0x1fff) ) { err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidBankPCRPid, &context->pcr_pid, sizeof(context->pcr_pid), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PidBankPCRPid", context->id)); return err; } /* set and enable the pcr in pid bank */ entry.index = context->pcr_pidentry; entry.PidEntry.pid = context->pcr_pid; entry.PidEntry.input_type = EMhwlibPid_Ts; entry.PidEntry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntry, &entry, sizeof(entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PidEntry", context->id)); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PidEntryEnable", context->id)); return err; } } else if ((context->pcr_pid == context->video_pid) || (context->pcr_pid == context->audio_pid)) { err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidBankPCRPid, &context->pcr_pid, sizeof(context->pcr_pid), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PidBankPCRPid", context->id)); return err; } } else { /* disable the pcr pid */ entry.index = context->pcr_pidentry; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error pcr RMDemuxTaskPropertyID_PidEntryDisable", context->id)); return err; } } } /* Set the ECM pid */ if (context->ecm_pid[0] != 0x1FFF) { // Apply cipher to pid of video cipher.index = context->video_pidentry; /* pid index */ cipher.pid_cipher_index = 0; /* first and only cipher per pid in current implementation */ cipher.cipher_index = context->cipher_index[0]; /* 1st cipher index of this task */ err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddCipher, &cipher, sizeof(cipher), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryAddCipher")); return err; } // Apply cipher to pid of audio if (context->ecm_pid[0] == context->ecm_pid[1]) { cipher.index = context->audio_pidentry; /* pid index */ cipher.pid_cipher_index = 0; /* first and only cipher per pid in current implementation */ cipher.cipher_index = context->cipher_index[0]; /* 1st cipher index of this task */ err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddCipher, &cipher, sizeof(cipher), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryAddCipher")); return err; } } fprintf(stderr, " m> ecm_pid[0]=0x%04X pidentry[0]=0x%02x\n", (RMuint16)(context->ecm_pid[0]), (RMuint16)(context->ecm_pidentry[0])); entry.index = context->ecm_pidentry[0]; entry.PidEntry.pid = context->ecm_pid[0]; entry.PidEntry.input_type = EMhwlibPid_Ts; entry.PidEntry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntry, &entry, sizeof(entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error ECM RMDemuxTaskPropertyID_PidEntry", context->id)); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error ECM RMDemuxTaskPropertyID_PidEntryEnable", context->id)); return err; } } else { /* disable the ecm video pid */ entry.index = context->ecm_pidentry[0]; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error ECM0 RMDemuxTaskPropertyID_PidEntryDisable", context->id)); return err; } } if ((context->ecm_pid[1] != 0x1FFF) && (context->ecm_pid[1] != context->ecm_pid[0])) { // Apply cipher to pid of audio cipher.index = context->audio_pidentry; /* pid index */ cipher.pid_cipher_index = 0; /* first and only cipher per pid in current implementation */ cipher.cipher_index = context->cipher_index[1]; /* 2nd cipher index of this task */ err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddCipher, &cipher, sizeof(cipher), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryAddCipher")); return err; } fprintf(stderr, " m> ecm_pid[1]=0x%04X pidentry[1]=0x%02x\n", (RMuint16)(context->ecm_pid[1]), (RMuint16)(context->ecm_pidentry[1])); entry.index = context->ecm_pidentry[1]; entry.PidEntry.pid = context->ecm_pid[1]; entry.PidEntry.input_type = EMhwlibPid_Ts; entry.PidEntry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntry, &entry, sizeof(entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error ECM RMDemuxTaskPropertyID_PidEntry", context->id)); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error ECM RMDemuxTaskPropertyID_PidEntryEnable", context->id)); return err; } } else { /* disable the ecm audio pid */ entry.index = context->ecm_pidentry[1]; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_SetHwAVPlayback Error ECM1 RMDemuxTaskPropertyID_PidEntryDisable", context->id)); return err; } }#if (FORCE_DECRYPTION) if (((context->app_type == aes_cbc_decryption) || (context->app_type == aes_ecb_decryption) || (context->app_type == multi2_decryption) || (context->app_type == dvbcsa_decryption)) && ((context->ecm_pid[0] == 0x1FFF) && (context->ecm_pid[1] = 0x1FFF))) { // Apply cipher to pid of video cipher.index = context->video_pidentry; /* pid index */ cipher.pid_cipher_index = 0; /* first and only cipher per pid in current implementation */ cipher.cipher_index = context->cipher_index[0]; /* 1st cipher index of this task */ err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddCipher, &cipher, sizeof(cipher), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryAddCipher")); return err; } // Apply cipher to pid of audio cipher.index = context->audio_pidentry; /* pid index */ cipher.pid_cipher_index = 0; /* first and only cipher per pid in current implementation */ cipher.cipher_index = context->cipher_index[0]; /* 1st cipher index of this task */ err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddCipher, &cipher, sizeof(cipher), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryAddCipher")); return err; } }#endif return RM_OK;}static RMstatus OpenVideoDecoder(struct context_per_task *context){ RMstatus err; /* open video decoder using DCCX functions */ struct DCCXVideoProfile video_profile; RMDBGLOG((ENABLE, "openVideoDecoder\n")); video_profile.ProtectedFlags = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -