📄 play_psfdemux_checksum.c
字号:
fullness = (RMreal)((100./XferFIFOInfo.Size)*XferFIFOInfo.Readable); \ fprintf(stderr, "XFER %lx: st=%08lx sz=%ld wr=%ld rd=%ld er=%lx --> f : %.02f \n", ModuleId, XferFIFOInfo.StartAddress, \ XferFIFOInfo.Size, XferFIFOInfo.Writable, XferFIFOInfo.Readable, XferFIFOInfo.Erasable, fullness); \ if ((fullness < 2) && checkStarvation) { \ struct timeval now; \ \ gettimeofday(&now, NULL); \ RMDBGLOG((ENABLE, "close to starvation at\n")); \ printTimeOfDay(now); \ } \ } \ } \#define MONITOR_INTERVAL_US 250000static void monitor(struct context_per_task *context, RMbool alwaysShow){ /* the bitrate reading of this probe is accurate only if the blocking call is RUASendData */ struct timeval now; RMuint64 elapsed; RMuint64 ptime; struct dcc_context *dcc_info = context->dcc_info; gettimeofday(&now, NULL); elapsed = (now.tv_sec - context->last.tv_sec) * 1000000; elapsed += (now.tv_usec - context->last.tv_usec); if (elapsed > MONITOR_INTERVAL_US || alwaysShow){ RMuint64 bitrate = (RMuint64)context->bitrate * 1000000; bitrate /= elapsed; context->meanBitrate += bitrate; context->meanCount++; DCCSTCGetTime(dcc_info->pStcSource, &ptime, 90000); fprintf(stderr, "\n*****************************\n"); fprintf(stderr, "timeofday %llu.%llu secs since epoch\n", (RMuint64)now.tv_sec, (RMuint64)now.tv_usec); printTimeOfDay(now); fprintf(stderr, "STC = %llu (%llu secs) bytes sent %lu\n", ptime, (ptime/90000), context->file_byte_counter); /* sample code to get fifo info */ fprintf(stderr, "Demux :\n"); GET_DATA_FIFO_INFO(dcc_info->pRUA, context->demux_task, FALSE); if (!context->play_opt->spi) { GET_XFER_FIFO_INFO(dcc_info->pRUA, context->demux_task, FALSE); } fprintf(stderr, "bitrate: mean %llu bit/sec, pseudo-instantaneus %llu bit/sec (%lu bytes/%llu us)\n", context->meanBitrate / context->meanCount, bitrate, context->bitrate >> 3, elapsed); fprintf(stderr, "Video :\n"); GET_DATA_FIFO_INFO(dcc_info->pRUA, dcc_info->video_decoder, TRUE); if (dcc_info->pMultipleAudioSource) { struct DCCAudioSourceHandle audioHandle; RMuint32 i; for (i = 0; i < context->audioInstances; i++) { fprintf(stderr, "Audio[%lu] :\n", i); DCCMultipleAudioSourceGetSingleDecoderHandleForInstance(dcc_info->pMultipleAudioSource, i, &audioHandle); GET_DATA_FIFO_INFO(dcc_info->pRUA, audioHandle.moduleID, TRUE); } } fprintf(stderr, "*****************************\n"); gettimeofday(&context->last, NULL); context->bitrate = 0; fflush(stderr); } return;}/****************************** static variables ******************************/static RMuint32 task_count = 0;static struct dcc_context *pdcc_info[MAX_TASK_COUNT];static struct context_per_task Tasks[MAX_TASK_COUNT] = {{0,},}; static struct RM_PSM_Context PSMcontext;static RMuint32 output_count_per_task;static RMuint32 idle_port = 0xff;static RMbool timedbg = FALSE;static enum AudioDecoder_Codec_type stream_type_6 = AudioDecoder_Codec_DTS;static struct llad *pllad = NULL;static struct gbus *pgbus = NULL;/* ############## AES_CBC_PRECIPHER CODE BEGIN ############## */static RMuint32 aes_state = 0;/* ############## AES_CBC_PRECIPHER CODE END ################ */#ifndef WITH_MONO/* these can stay global as they are only used by the standalone play_psfdemux app */static struct playback_cmdline playback_options[MAX_TASK_COUNT]; static struct display_cmdline display_options[MAX_TASK_COUNT]; static struct video_cmdline video_options[MAX_TASK_COUNT]; static struct audio_cmdline audio_options[MAX_TASK_COUNT*MAX_AUDIO_DECODER_INSTANCES]; static struct demux_cmdline demux_options[MAX_TASK_COUNT]; static struct display_context disp_info[MAX_TASK_COUNT]; static struct dh_context dh_info[MAX_TASK_COUNT] = {{0,},}; #endifstatic RMstatus InitPidTablePerTask(struct context_per_task *context){ RMstatus err; RMuint32 i; RMDBGLOG((CALLDBG, "initPIDTablePerTask (context @0x%08lx)\n", (RMuint32)context));#ifdef USE_HW_FIXED_PID_ENTRY /* set the fixed Pid entries available only for EM8634 */ struct EMhwlibFixedPidEntry_type fixed_entry; struct EMhwlibOutputMask_type out; RMuint32 dummy; RMDBGLOG((CALLDBG, "initPIDTablePerTask - useHWFixedPIDEntry\n")); /* PAT */ fixed_entry.input_type = EMhwlibPid_Ts; fixed_entry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PATPidEntry, &fixed_entry, sizeof(fixed_entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PATPidEntry")); return err; } out.output_mask[0] = PAT_OUTPUT_MASK; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PATPidEntryAddOutputs, &out, sizeof(out), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PATPidEntryAddOutputs")); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PATPidEntryEnable, &dummy, sizeof(dummy), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PATPidEntryEnable")); return err; } /* CAT */ fixed_entry.input_type = EMhwlibPid_Ts; fixed_entry.flags = TS_FLAGS; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_CATPidEntry, &fixed_entry, sizeof(fixed_entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_CATPidEntry")); return err; } out.output_mask[0] = CAT_OUTPUT_MASK; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_CATPidEntryAddOutputs, &out, sizeof(out), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_CATPidEntryAddOutputs")); return err; } err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_CATPidEntryEnable, &dummy, sizeof(dummy), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_CATPidEntryEnable")); return err; }#endif /* set the initial Pid entries */ for (i = 0; i < context->pid_table_count; i++) { struct DemuxTask_PidEntry_type entry; struct EMhwlibEntryOutputMask_type out; struct PidEntry_type *p = context->pid_table; struct DemuxTask_PidEntryRecipher_type recipher_entry; err = RUAGetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_AllocatePidEntry, &p[i].index, sizeof(p[i].index)); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_AllocatePidEntry")); return err; } RMDBGLOG((ENABLE, "InitPidTablePerTask RMDemuxTaskPropertyID_AllocatePidEntry %ld\n", p[i].index)); entry.index = p[i].index; entry.PidEntry.pid = p[i].pid; entry.PidEntry.input_type = p[i].input_type; entry.PidEntry.flags = p[i].flags; RMDBGLOG((ENABLE, "setPIDEntry[%lu]: index %lu pid 0x%lx type 0x%lx flags 0x%lx\n", i, (RMuint32)entry.index, (RMuint32)entry.PidEntry.pid, (RMuint32)entry.PidEntry.input_type, (RMuint32)entry.PidEntry.flags)); err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntry, &entry, sizeof(entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntry")); return err; } recipher_entry.index = p[i].index; recipher_entry.enable = FALSE; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryRecipher, &recipher_entry, sizeof(recipher_entry), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "%ld_InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryReciphe", context->id)); return err; } out.entry_index = entry.index; out.output_mask[0] = p[i].output_mask[0]; RMDBGLOG((ENABLE, "addOutputs2PIDEntry: mask 0x%lx\n", (RMuint32)out.output_mask[0])); err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddOutputs, &out, sizeof(out), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryAddOutputs")); return err; } if (p[i].enable) { err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryEnable, &entry.index, sizeof(entry.index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PidEntryEnable")); return err; } } /* initialize the variable used for playback */ switch (p[i].type) {#ifndef USE_HW_FIXED_PID_ENTRY case PAT_PID_ENTRY: context->pat_pidentry = p[i].index; break; case CAT_PID_ENTRY: context->cat_pidentry = p[i].index; break;#endif case PMT_PID_ENTRY: context->pmt_pidentry = p[i].index; break; case VIDEO_PID_ENTRY: context->video_pidentry = p[i].index; break; case AUDIO_PID_ENTRY: context->audio_pidentry = p[i].index; break; case PCR_PID_ENTRY: context->pcr_pidentry = p[i].index; break; case ECM0_PID_ENTRY: context->ecm_pidentry[0] = p[i].index; break; case ECM1_PID_ENTRY: context->ecm_pidentry[1] = p[i].index; break; case TTX_PID_ENTRY: context->teletext_pidentry = p[i].index; break; } } return RM_OK;}static RMstatus DisablePidTablePerTask(struct RUA *pRUA, RMuint32 demux_task, struct PidEntry_type *p, RMuint32 pid_table_count){ RMstatus err; RMuint32 i; RMDBGLOG((ENABLE, "disablePIDTablePerTask\n"));#ifdef USE_HW_FIXED_PID_ENTRY { RMuint32 dummy; err = RUASetProperty(pRUA, demux_task, RMDemuxTaskPropertyID_PATPidEntryDisable, &dummy, sizeof(dummy), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "DisablePidTablePerTask Error RMDemuxTaskPropertyID_PATPidEntryDisable")); return err; } err = RUASetProperty(pRUA, demux_task, RMDemuxTaskPropertyID_CATPidEntryDisable, &dummy, sizeof(dummy), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "DisablePidTablePerTask Error RMDemuxTaskPropertyID_CATPidEntryDisable")); return err; } }#endif for (i=0; i<pid_table_count; i++) { RMDBGLOG((ENABLE, "disabling PID_entry[%lu/%lu] index %lu\n", i, pid_table_count, p[i].index)); err = RUASetProperty(pRUA, demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &p[i].index, sizeof(p[i].index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "DisablePidTablePerTask Error RMDemuxTaskPropertyID_PidEntryDisable")); return err; } } return RM_OK;}static RMstatus FreePidTablePerTask(struct RUA *pRUA, RMuint32 demux_task, struct PidEntry_type *p, RMuint32 pid_table_count){ RMstatus err; RMuint32 i; RMDBGLOG((CALLDBG, "freePIDTablePerTask\n")); for (i=0; i<pid_table_count; i++) { err = RUASetProperty(pRUA, demux_task, RMDemuxTaskPropertyID_FreePidEntry, &p[i].index, sizeof(p[i].index), 0); if (RMFAILED(err)) { RMDBGLOG((ENABLE, "FreePidTablePerTask Error RMDemuxTaskPropertyID_FreePidEntry")); return err; } RMDBGLOG((ENABLE, "FreePidTablePerTask RMDemuxTaskPropertyID_FreePidEntry %ld\n", p[i].index)); } return RM_OK;}static RMstatus InitPesTablePerTask(struct context_per_task *context){ RMstatus err; RMuint32 i; struct PesEntry_type *p = context->pes_table; RMuint32 pes_table_count = context->pes_table_count; RMDBGLOG((CALLDBG, "initPESTablePerTask\n")); /* set the initial Pes entries */ for (i=0; i<pes_table_count; i++) { struct DemuxTask_PesEntry_type entry; entry.index = i; entry.PesEntry.stream_id = p[i].stream_id; entry.PesEntry.substream_id = p[i].substream_id; entry.PesEntry.enable = p[i].enable; entry.PesEntry.output_mask[0] = p[i].output_mask[0]; entry.PesEntry.cipher_mask = p[i].cipher_mask; entry.PesEntry.cipher_index[0] = p[i].cipher_index[0]; if(context->demux_opt->send_scrambled_packets_for_invalid_key) entry.PesEntry.input_type = EMhwlibPes_packet1; else entry.PesEntry.input_type = EMhwlibPes_packet; err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PesEntry, &entry, sizeof(entry), 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -