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

📄 play_psfdemux_checksum.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
		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;	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,		&section_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,		&section_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,		&section_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,		&section_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;}#ifdef MULTI2_EIGHT_KEYSstatic void HardcodeAVPids(struct context_per_task *context){	   	context->VideoPidList.index = 0;	context->VideoPidList.count = 1;	context->VideoPidList.pcr_pid = 0x1ff;	context->VideoPidList.stream_type[0] = 2; 	context->VideoPidList.elementary_pid[0] = 0x100;	context->VideoPidList.es_ecm_pid[0] = 0x1f1;	RMDBGLOG((ENABLE, "==============%ld_HardcodeAVPids vid pid=0x%x ecmpid=0x%x\n", 				context->id, context->VideoPidList.elementary_pid[0],  context->VideoPidList.es_ecm_pid[0] ));		context->AudioPidList.index = 0;	context->AudioPidList.count = 1;	context->AudioPidList.pcr_pid = 0x1ff;	context->AudioPidList.stream_type[0] = 6;	context->AudioPidList.elementary_pid[0] = 0x110;	context->AudioPidList.es_ecm_pid[0] = 0x1f2;	RMDBGLOG((ENABLE, "==============%ld_HardcodeAVPids aud pid=0x%x ecmpid=0x%x\n", 				context->id, context->AudioPidList.elementary_pid[0],  context->AudioPidList.es_ecm_pid[0] ));	return;}// hardcoding data pids works together with hardcoding the tables in psfdemux_parsing and // ecm association in psfdemux_drm ecmcallbackstatic void HardcodeDataPids(struct context_per_task *context) {	RMuint32 index = 0;	context->DataPidList.index = 0;	context->DataPidList.count = 6;	context->DataPidList.share_ecm = FALSE;	for( index = 0; index<context->DataPidList.count; index++ ){		context->DataPidList.data_pid_entries[index] = DATA_ENTRY+index;		context->DataPidList.ecm_pid_entries[index] = DATA_ENTRY+6+index;		context->DataPidList.cipher_indices[index] = 2 + index;	}	index = 0;	context->DataPidList.elementary_pids[index] = 0x111;	context->DataPidList.ecm_pids[index] = 0x1f3;	index = 1;	context->DataPidList.elementary_pids[index] = 0x140;	context->DataPidList.ecm_pids[index] = 0x1f4;	index = 2;	context->DataPidList.elementary_pids[index] = 0x150;	context->DataPidList.ecm_pids[index] = 0x1f5;	index = 3;	context->DataPidList.elementary_pids[index] = 0x155;	context->DataPidList.ecm_pids[index] = 0x1f6;	index = 4;	context->DataPidList.elementary_pids[index] = 0x156;	context->DataPidList.ecm_pids[index] = 0x1f7;	index = 5;	context->DataPidList.elementary_pids[index] = 0x157;	context->DataPidList.ecm_pids[index] = 0x1f8;	for( index = 0; index<context->DataPidList.count; index++ ){		RMDBGLOG((ENABLE, "==============%ld_HardcodeDataPids data %d pid=0x%x (entry %d) ecmpid=0x%x (entry %d), use cipher %d\n", 					context->id, index, context->DataPidList.elementary_pids[index], context->DataPidList.data_pid_entries[index],					context->DataPidList.ecm_pids[index], context->DataPidList.ecm_pid_entries[index], context->cipher_index[context->DataPidList.cipher_indices[index]] ));	}	return;}static RMstatus SetHwDataPlayback(struct context_per_task *context){	RMstatus err;	RMuint32 i;	RMbool one_data_entry_enabled = FALSE;	struct DemuxTask_PidEntry_type entry;	struct DemuxTask_PidEntryAddCipher_type cipher;	RMDBGLOG((ENABLE, "============== %ld_SetHwDataPlayback data pid count=%d \n", context->id, context->DataPidList.count ));	for( i=0; i<context->DataPidList.count; i++ ) {		if( context->DataPidList.elementary_pids[i] != 0x1fff ) {			// enable data pid			entry.index = context->DataPidList.data_pid_entries[i];			entry.PidEntry.pid = context->DataPidList.elementary_pids[i];			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, "%SetHwDataPlayback Error data 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, "%SetHwDataPlayback Error data RMDemuxTaskPropertyID_PidEntryEnable", context->id));				return err;			}			RMDBGLOG((ENABLE, "============== set data pid %d 0x%x \n", entry.index, entry.PidEntry.pid ));			one_data_entry_enabled = TRUE;			if( context->DataPidList.share_ecm == 0 && context->DataPidList.ecm_pids[i] != 0x1fff ) {				// associate the ecm pid to the data pid				cipher.index = context->DataPidList.data_pid_entries[i]; // pid index 				cipher.pid_cipher_index = 0;				cipher.cipher_index = context->cipher_index[ context->DataPidList.cipher_indices[i] ];				err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryAddCipher, &cipher, sizeof(cipher), 0);				if (RMFAILED(err)) {					RMDBGLOG((ENABLE, "SetHwDataPlayback Error RMDemuxTaskPropertyID_PidEntryAddCipher"));					return err;				}				RMDBGLOG((ENABLE, "==============          add cipher %d %d  \n", cipher.index, cipher.cipher_index));				// and the corresponding ecm pid				entry.index = context->DataPidList.ecm_pid_entries[i];				entry.PidEntry.pid = context->DataPidList.ecm_pids[i];				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, "%SetHwDataPlayback Error data 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, "%SetHwDataPlayback Error data RMDemuxTaskPropertyID_PidEntryEnable", context->id));					return err;				}				RMDBGLOG((ENABLE, "==============                  with ecm pid %d 0x%x \n", entry.index, entry.PidEntry.pid ));			}		}		else { // disable the  pid and ecm pid			entry.index = context->DataPidList.data_pid_entries[i];			err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "%SetHwDataPlayback Error data RMDemuxTaskPropertyID_PidEntryDisable", context->id));				return err;			}			RMDBGLOG((ENABLE, "============== disabled data pid %d 0x%x\n", entry.index, context->DataPidList.elementary_pids[i] ));			entry.index = context->DataPidList.ecm_pid_entries[i];			err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_PidEntryDisable, &entry.index, sizeof(entry.index), 0);			if (RMFAILED(err)) {				RMDBGLOG((ENABLE, "%SetHwDataPlayback Error data RMDemuxTaskPropertyID_PidEntryDisable", context->id));				return err;			}			RMDBGLOG((ENABLE, "============== disabled ecm pid %d 0x%x\n", entry.index, context->DataPidList.ecm_pids[i] ));		}	}	

⌨️ 快捷键说明

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