⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 play_psfdemux_multicast.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
	}	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);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "InitPesTablePerTask Error RMDemuxTaskPropertyID_PesEntry"));			return err;		}	}	return RM_OK;}static RMstatus DisablePesTablePerTask(struct RUA *pRUA, RMuint32 demux_task, struct PesEntry_type *p, RMuint32 pes_table_count){	RMstatus err;	RMuint32 i;	RMDBGLOG((CALLDBG, "disablePESTablePerTask\n"));	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 = FALSE;		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];		entry.PesEntry.input_type = p[i].input_type;		err = RUASetProperty(pRUA, demux_task, RMDemuxTaskPropertyID_PesEntry, &entry, sizeof(entry), 0);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "DisablePesTable Error RMDemuxTaskPropertyID_PesEntry"));			return err;		}	}	return RM_OK;}static RMstatus InitSectionTable(struct context_per_task *context){	RMstatus err;	RMuint32 i;		RMDBGLOG((CALLDBG, "initSectionTable (context @0x%08lx)\n", (RMuint32)context));	for (i=0; i<context->match_section_table_count;i++) {		struct DemuxTask_MatchSectionEntry_type section_entry;				err = RUAGetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_AllocateMatchSectionEntry,				     &context->match_section_table[i].index, sizeof(context->match_section_table[i].index));		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "InitSectionTable Error RMDemuxTaskPropertyID_AllocateMatchSectionEntry"));			return err;		}		RMDBGLOG((ENABLE, "InitSectionTable RMDemuxTaskPropertyID_AllocateMatchSectionEntry %ld\n",			  context->match_section_table[i].index));				section_entry.Index = context->match_section_table[i].index;		section_entry.SectionEntry = context->match_section_table[i].section_entry;		err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_MatchSectionEntry,				     &section_entry, sizeof(section_entry), 0);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Error RMDemuxTaskPropertyID_MatchSectionEntry"));			return err;		}	}	return RM_OK;}	static RMstatus FreeSectionTable(struct context_per_task *context){	RMstatus err;	RMuint32 i;		RMDBGLOG((CALLDBG, "freeSectionTable (context @0x%08lx)\n", (RMuint32)context));	for (i=0; i<context->match_section_table_count;i++) {				err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_FreeMatchSectionEntry,				     &context->match_section_table[i].index, sizeof(context->match_section_table[i].index), 0);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "FreeSectionTable Error RMDemuxTaskPropertyID_FreeMatchSectionEntry"));			return err;		}		RMDBGLOG((ENABLE, "FreeSectionTable RMDemuxTaskPropertyID_FreeMatchSectionEntry %ld\n",			  context->match_section_table[i].index));	}	return RM_OK;}static void ClearInfoTable(struct context_per_task *context){	RMuint32 i;	RMMemset(&(context->pat_info), 0, sizeof(struct PATInfo_type));	RMMemset(&(context->cat_info), 0, sizeof(struct CATInfo_type));	RMMemset(&(context->VideoPidList), 0, sizeof(struct ESPidList_type));	RMMemset(&(context->AudioPidList), 0, sizeof(struct ESPidList_type));	for (i = 0; i < MAX_PROGRAM_NUMBER; i++) {		RMMemset(&(context->pmt_info[i]), 0, sizeof(struct PMTInfo_type));	} }static RMstatus ResetDemuxTask(struct context_per_task *context){	RMstatus err;	struct DemuxTask_MatchSectionEntry_type section_entry;	DisablePidTablePerTask(context->pRUA, context->demux_task, context->pid_table, context->pid_table_count);	ClearInfoTable(context);	context->pat = FALSE;	context->pmt = FALSE;	context->cat = FALSE;	context->av_flags = AV_PIDS_ENABLE_FIRST_TIME;	context->video_pid = 0x1FFF;	context->audio_pid = 0x1FFF;	context->pcr_pid = 0x1FFF;	context->ecm_pid[0] = 0x1FFF;	context->ecm_pid[1] = 0x1FFF;	/* reset PAT version_number in hardware section filter */	context->match_section_table[0].section_entry.mask[5] = 0x00; 	context->match_section_table[0].section_entry.mode[5] = 0x00;	context->match_section_table[0].section_entry.comp[5] = 0x00;	section_entry.Index = context->match_section_table[0].index;	section_entry.SectionEntry = context->match_section_table[0].section_entry;	err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_MatchSectionEntry,		&section_entry, sizeof(section_entry), 0);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Error RMDemuxTaskPropertyID_MatchSectionEntry"));	}	/* reset PMT version_number in hardware section filter */	context->match_section_table[1].section_entry.mask[5] = 0x00; 	context->match_section_table[1].section_entry.mode[5] = 0x00;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -