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

📄 play_psfswpvr.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
		if ( RMFAILED(err) ) {					\			fprintf(stderr, "XFER %lx: ERROR\n", ModuleId);	\		}							\		else {							\			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;		static struct timeval last;		static int first = 1;	RMuint64 elapsed; 		RMuint64 ptime; 		struct dcc_context *dcc_info = context->dcc_info;	gettimeofday(&now, NULL);	elapsed = (now.tv_sec - last.tv_sec) * 1000000;			elapsed += (now.tv_usec - last.tv_usec);	if (elapsed > MONITOR_INTERVAL_US || first || 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)\n", ptime, (ptime/90000));		/* 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->pAudioSource) {			fprintf(stderr, "Audio :\n"); 						GET_DATA_FIFO_INFO(dcc_info->pRUA, dcc_info->audio_decoder, TRUE);		}		else 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(&last, NULL);		first = 0;		context->bitrate = 0;		fflush(stderr);			}					        	return;}/****************************** global variables ******************************//* these should be made local */RMuint32			task_count = 0;static struct dcc_context       *pdcc_info[MAX_TASK_COUNT];struct context_per_task		Tasks[MAX_TASK_COUNT] = {{0,},}; static struct RM_PSM_Context    PSMcontext;RMuint32			output_count_per_task;static RMuint32			idle_port = 0xff;static RMbool			timedbg = FALSE;enum AudioDecoder_Codec_type    stream_type_6 = AudioDecoder_Codec_DTS;/* ############## AES_CBC_PRECIPHER CODE BEGIN ############## */static RMuint32 aes_state = 0;/* ############## AES_CBC_PRECIPHER CODE END ################ *//* these can stay global as they are only used by the standalone play_psfdemux app */static RMbool		 load_ucode = TRUE;struct playback_cmdline  playback_options[MAX_TASK_COUNT]; struct display_cmdline   display_options[MAX_TASK_COUNT]; struct video_cmdline     video_options[MAX_TASK_COUNT]; struct audio_cmdline     audio_options[MAX_TASK_COUNT*MAX_AUDIO_DECODER_INSTANCES]; struct demux_cmdline     demux_options[MAX_TASK_COUNT]; struct display_context   disp_info[MAX_TASK_COUNT]; struct dh_context        dh_info[MAX_TASK_COUNT] = {{0,},}; static 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_PATPidEntry"));		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_PATPidEntryAddOutputs"));		return err;	}	err = RUASetProperty(context->pRUA, context->demux_task, RMDemuxTaskPropertyID_CATPidEntryEnable, &dummy, sizeof(dummy), 0);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "InitPidTablePerTask Error RMDemuxTaskPropertyID_PATPidEntryEnable"));		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;		}	}		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"));	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 RUA *pRUA, RMuint32 demux_task, struct PesEntry_type *p, RMuint32 pes_table_count){	RMstatus err;	RMuint32 i;	RMDBGLOG((CALLDBG, "initPESTablePerTask\n"));

⌨️ 快捷键说明

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