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

📄 play_psfswpvr.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
	/* 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];		entry.PesEntry.input_type = p[i].input_type;		err = RUASetProperty(pRUA, 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 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 {

⌨️ 快捷键说明

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