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

📄 dcc_video.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 5 页
字号:
		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Error getting property RMSpuDecoderPropertyID_VSyncSurface! %s\n", RMstatusToString(err)));			return err;		}	}	(*ppVideoSource)->surface = surface;	return RM_OK;}RMstatus DCCCloseVideoSource(struct DCCVideoSource *pVideoSource){	RMbool surface_changed = FALSE;	RMDBGLOG((LOCALDBG, "DCCCloseVideoSource()\n"));	ASSERT_NULL_POINTER(pVideoSource);	if (pVideoSource->spu_scaler_moduleID != 0) {		struct EMhwlibSubPictureSurface_type val;		val.Scaler = 0;		val.Surface = 0;		DCCSP(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_SubPictureSurface, &val, sizeof(val));		DCCSP(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_Validate, NULL, 0);		surface_changed = TRUE;	}	if (pVideoSource->scaler_moduleID != 0) {		RMuint32 surface;		RMstatus err;		err = RUAGetProperty(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_Surface, &surface, sizeof(surface));		if (err != RM_OK) {			RMDBGLOG((ENABLE, "Cannot get the video surface, %s\n", RMstatusToString(err)));			return err;		}		if(surface != 0){			surface = 0;			DCCSP(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_Surface, &surface, sizeof(surface));			surface_changed = TRUE;		}	} 	if (surface_changed) {		RMstatus err;		struct RUAEvent evt;													RMuint32 index;													RMDBGLOG((LOCALDBG, "surface changed\n"));		evt.Mask = EMHWLIB_DISPLAY_EVENT_ID(pVideoSource->scaler_moduleID);										evt.ModuleID = EMHWLIB_MODULE(DisplayBlock, 0);									err = RUAWaitForMultipleEvents(pVideoSource->pRUA, &evt, 1, WAIT_COMMAND_TIMEOUT_US, &index);					if (RMFAILED(err)) {													RMDBGLOG((ENABLE, "wait for display update event completion failed, %s\n", RMstatusToString(err)));        			return err;												}												}	if (pVideoSource->decoder_moduleID != 0) {		RMuint32 close_profile = 0;		if (EMHWLIB_MODULE_CATEGORY(pVideoSource->decoder_moduleID) == DispVideoInput) {			DCCSPERR(pVideoSource->pRUA, pVideoSource->decoder_moduleID, 				RMDispVideoInputPropertyID_Close, &close_profile, sizeof(close_profile), 				"Error closing video input profile");		} else if (EMHWLIB_MODULE_CATEGORY(pVideoSource->decoder_moduleID) == DispGraphicInput) {			DCCSPERR(pVideoSource->pRUA, pVideoSource->decoder_moduleID, 				 RMDispGraphicInputPropertyID_Close, &close_profile, sizeof(close_profile), 				 "Error closing graphic input profile");		} else {			RMDBGLOG((LOCALDBG, "closing video decoder\n"));			DCCSPERR(pVideoSource->pRUA, pVideoSource->decoder_moduleID, 				 RMVideoDecoderPropertyID_Close, &close_profile, sizeof(close_profile), 				 "Error closing video decoder profile");		}	}	if (pVideoSource->spu_decoder_moduleID != 0) {		RMuint32 close_profile = 0;		DCCSP(pVideoSource->pRUA, pVideoSource->spu_decoder_moduleID, RMSpuDecoderPropertyID_Close, &close_profile, sizeof(close_profile));	}	if (pVideoSource->free_picture_protected && pVideoSource->picture_protected_address) {		RMDBGLOG((LOCALDBG, "free protected at %p\n", pVideoSource->picture_protected_address));		pVideoSource->pDCC->rua_free(pVideoSource->pRUA, pVideoSource->picture_protected_address);	}			if (pVideoSource->free_cached && pVideoSource->cached_address) {		RMDBGLOG((LOCALDBG, "free cached at %p\n", pVideoSource->cached_address));		pVideoSource->pDCC->rua_free(pVideoSource->pRUA, pVideoSource->cached_address);	}	if (pVideoSource->free_uncached && pVideoSource->uncached_address) {		RMDBGLOG((LOCALDBG, "free uncached at %p\n", pVideoSource->uncached_address));		pVideoSource->pDCC->rua_free(pVideoSource->pRUA, pVideoSource->uncached_address);	}	if (pVideoSource->free_spu_cached && pVideoSource->spu_cached_address) {		RMDBGLOG((LOCALDBG, "free spu cached at %p\n", pVideoSource->spu_cached_address));		pVideoSource->pDCC->rua_free(pVideoSource->pRUA, pVideoSource->spu_cached_address);	}	if (pVideoSource->free_spu_uncached && pVideoSource->spu_uncached_address) {		RMDBGLOG((LOCALDBG, "free spu uncached at %p\n", pVideoSource->spu_uncached_address));		pVideoSource->pDCC->rua_free(pVideoSource->pRUA, pVideoSource->spu_uncached_address);	}	if (pVideoSource->pictures != NULL)		RMFree(pVideoSource->pictures);		/* is it a video source or an OSD source ? */	if (pVideoSource->engine_moduleID != 0) {		/* Free the video scheduler task database table {see DCCXOpenVideoDecoderSource for allocation} */		RMstatus err;		RMuint32 connected_task_count;		err = RUAGetProperty(pVideoSource->pRUA, pVideoSource->engine_moduleID, RMMpegEnginePropertyID_ConnectedTaskCount,				     &connected_task_count, sizeof(connected_task_count));		if (err != RM_OK) {			RMDBGLOG((ENABLE, "Cannot get RMMpegEnginePropertyID_ConnectedTaskCount %s %lu\n", RMstatusToString(err), pVideoSource->engine_moduleID));			return err;                                                         		}		if (connected_task_count == 0) {			struct MpegEngine_SchedulerSharedMemory_type schedmem;			struct MpegEngine_DecoderSharedMemory_type shared;			RMuint32 address;						err = RUAGetProperty(pVideoSource->pRUA, pVideoSource->engine_moduleID, RMMpegEnginePropertyID_DecoderSharedMemory,					     &shared, sizeof(shared));			if (err != RM_OK) {				RMDBGLOG((ENABLE, "Cannot get DecoderSharedMemory0, %s\n", RMstatusToString(err)));				return err;			}			if (pVideoSource->free_shared && shared.Address) {				RMDBGLOG((ENABLE, "FREE %lx_DRAM VIDEO SHARED MEMORY addr=0x%lx size=0x%lx!\n",					  EMHWLIB_MODULE_INDEX(pVideoSource->engine_moduleID), shared.Address, shared.Size));				address = shared.Address;				shared.Address = 0;				shared.Size = 0;				DCCSP(pVideoSource->pRUA, pVideoSource->engine_moduleID, RMMpegEnginePropertyID_DecoderSharedMemory,				      &shared, sizeof(shared));				/* Unlock the shared address */				err = RUASetAddressID(pVideoSource->pRUA, address, 0);				if (RMFAILED(err)) {					RMDBGLOG((ENABLE, "RUASetAddressID scheduler 0 ERROR %s\n", RMstatusToString(err)));					return err;				}				RUAFree(pVideoSource->pRUA, address);			}						err = RUAGetProperty(pVideoSource->pRUA, pVideoSource->engine_moduleID, RMMpegEnginePropertyID_SchedulerSharedMemory,					     &schedmem, sizeof(schedmem));			if (err != RM_OK) {				RMDBGLOG((ENABLE, "Cannot get SchedulerSharedMemory, %s\n", RMstatusToString(err)));				return err;			}			if (pVideoSource->free_scheduler && schedmem.Address) {				RMDBGLOG((ENABLE, "FREE %lx_DRAM SCHEDULER MEMORY addr=0x%lx size=0x%lx!\n",					  EMHWLIB_MODULE_INDEX(pVideoSource->engine_moduleID), schedmem.Address, schedmem.Size));				address = schedmem.Address;				schedmem.Address = 0;				schedmem.Size = 0;				DCCSP(pVideoSource->pRUA, pVideoSource->engine_moduleID, RMMpegEnginePropertyID_SchedulerSharedMemory,				      &schedmem, sizeof(schedmem));				/* Unlock the schedulers's address */				err = RUASetAddressID(pVideoSource->pRUA, address, 0);				if (RMFAILED(err)) {					RMDBGLOG((ENABLE, "RUASetAddressID scheduler 0 ERROR %s\n", RMstatusToString(err)));					return err;				}				RUAFree(pVideoSource->pRUA, address);			}		}		else {			RMDBGLOG((ENABLE, "CANNOT FREE %lx SCHEDULER and SHARED MEMORY. There are still %lx video tasks opened. \n",				  EMHWLIB_MODULE_INDEX(pVideoSource->engine_moduleID), connected_task_count));		}	}	RMFree(pVideoSource);		return RM_OK;}RMstatus DCCGetVideoDecoderSourceInfo(struct DCCVideoSource *pVideoSource, RMuint32 *video_decoder, RMuint32 *spu_decoder, RMuint32 *timer){	ASSERT_NULL_POINTER(pVideoSource);	if (video_decoder) 		*video_decoder = pVideoSource->decoder_moduleID;	if (timer) 		*timer = pVideoSource->timer_number;	if (spu_decoder)		*spu_decoder = pVideoSource->spu_decoder_moduleID;	return RM_OK;}RMstatus DCCSetVideoDecoderSourceCodec(struct DCCVideoSource *pVideoSource, enum VideoDecoder_Codec_type codec){	RMstatus err;	RMDBGLOG((LOCALDBG, "DCCSetVideoSourceCodec codec=%ld\n", (RMint32)codec));	ASSERT_NULL_POINTER(pVideoSource);	err = send_video_command(pVideoSource->pRUA, pVideoSource->decoder_moduleID, VideoDecoder_Command_Uninit);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Cannot send VideoDecoder_Command_Uninit, %s\n", RMstatusToString(err)));		return err;	}	/* send uninit command to spu decoder */	if (pVideoSource->spu_decoder_moduleID != 0) {		err = send_spu_command(pVideoSource->pRUA, pVideoSource->spu_decoder_moduleID, SpuDecoder_Command_Uninit);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Cannot send SpuDecoder_Command_Uninit, %s\n", RMstatusToString(err)));			return err;		}	}	DCCSP(pVideoSource->pRUA, pVideoSource->decoder_moduleID, RMVideoDecoderPropertyID_Codec, &codec, sizeof(codec));		err = send_video_command(pVideoSource->pRUA, pVideoSource->decoder_moduleID, VideoDecoder_Command_Init);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Cannot send VideoDecoder_Command_Init, %s\n", RMstatusToString(err)));		return err;	}	/* send init command to spu decoder */	if (pVideoSource->spu_decoder_moduleID != 0) {		err = send_spu_command(pVideoSource->pRUA, pVideoSource->spu_decoder_moduleID, SpuDecoder_Command_Init);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Cannot send SpuDecoder_Command_Init, %s\n", RMstatusToString(err)));			return err;		}	}	return RM_OK;}RMstatus DCCPlayVideoSource(struct DCCVideoSource *pVideoSource, enum DCCVideoPlayCommand cmd){	RMstatus err;	ASSERT_NULL_POINTER(pVideoSource);	/* 	   IMPORTANT NOTE: 'cmd=DCCVideoPlayNextFrame' only affects the display, so the video decoder remains in the current	   playback state, ie: playFwd, playIFrame, etc.	*/	if (cmd == DCCVideoPlayNextFrame) {		if (pVideoSource->scaler_moduleID != 0) {			DCCSP(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_Step, NULL, 0);		}				//cmd = VideoDecoder_Command_PlayFwd;	}		if (cmd != DCCVideoPlayNextFrame) {			err = send_video_command(pVideoSource->pRUA, pVideoSource->decoder_moduleID, cmd);				if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Cannot send video command play, %s\n", RMstatusToString(err)));			return err;		}	}	if (pVideoSource->spu_decoder_moduleID != 0) {		err = send_spu_command(pVideoSource->pRUA, pVideoSource->spu_decoder_moduleID, SpuDecoder_Command_Play);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Cannot send SpuDecoder_Command_Play, %s\n", RMstatusToString(err)));			return err;		}	}	return RM_OK;}RMstatus DCCStopVideoSource(struct DCCVideoSource *pVideoSource, enum DCCStopMode stop_mode){ 	RMstatus err;	ASSERT_NULL_POINTER(pVideoSource);	err = send_video_command(pVideoSource->pRUA, pVideoSource->decoder_moduleID, VideoDecoder_Command_Stop);	if (RMFAILED(err)) {		RMDBGLOG((ENABLE, "Cannot send VideoDecoder_Command_Stop, %s\n", RMstatusToString(err)));		return err;	}	if (pVideoSource->spu_decoder_moduleID != 0) {		err = send_spu_command(pVideoSource->pRUA, pVideoSource->spu_decoder_moduleID, SpuDecoder_Command_Stop);		if (RMFAILED(err)) {			RMDBGLOG((ENABLE, "Cannot send SpuDecoder_Command_Stop, %s\n", RMstatusToString(err)));			return err;		}	}	if (pVideoSource->scaler_moduleID != 0) {		struct RUAEvent evt;		switch (stop_mode) {		case DCCStopMode_BlackFrame: 			DCCSP(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_Stop, NULL, 0);			break;		case DCCStopMode_LastFrame: 			DCCSP(pVideoSource->pRUA, pVideoSource->scaler_moduleID, RMGenericPropertyID_Flush, NULL, 0);			break;		}

⌨️ 快捷键说明

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