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

📄 parse_video_cmdline.c

📁 1. 8623L平台
💻 C
📖 第 1 页 / 共 4 页
字号:
				if (dtvsize < 128 - 1) {					dtvbuf[dtvsize++] = cc_entry.CC1;					dtvbuf[dtvsize++] = cc_entry.CC2;				}				if(dtvsize >= ((RMuint32)dtvbuf[0]&0x3f)*2){					RMSCCDecode(dcc_info->scc, dtvbuf, dtvsize, get_ustime() );					dtvsize = 0;				}				break;			default:				break;			}		}	}	if(ccsize){		RMSCCDecode(dcc_info->scc, ccbuf, ccsize, get_ustime() );		ccsize = 0;	}	if(dtvsize >= 128){		fprintf(stderr, "More than 127 dtv bytes without a header?\n");		return RM_ERROR;	}     	return RM_OK;}RMstatus flush_cc_fifo( struct dcc_context * dcc_info ){	RMstatus err = RM_OK;	RMuint32 count = 0;	RMuint32 retry = 100000;	if (dcc_info->ccfifo_in_id != 0) {		do {			err = RUASetProperty( dcc_info->pRUA, dcc_info->ccfifo_in_id, RMCCFifoPropertyID_Flush, 0, 0, 0 );			if( err == RM_ERROR || count > retry ){				fprintf(stderr, "flush in ccfifo %lx failed %s\n", dcc_info->ccfifo_in_id, RMstatusToString(err));				return err;			}  			count ++;		} while (err == RM_PENDING);		if (dcc_info->ccfifo_out_id != dcc_info->ccfifo_in_id ) {			RMuint32 count = 0;			do {				err = RUASetProperty(dcc_info->pRUA, dcc_info->ccfifo_out_id, RMCCFifoPropertyID_Flush, 0, 0, 0 );				if( err == RM_ERROR || count > retry ){					fprintf(stderr, "flush out ccfifo %lx failed %s\n", dcc_info->ccfifo_out_id, RMstatusToString(err));					return err;				}  				count ++;			} while (err == RM_PENDING);		}	}	return RM_OK;}RMstatus video_profile_to_codec(enum MPEG_Profile profile, enum EMhwlibVideoCodec *pvcodec,	RMuint32 *pprofile, RMuint32 *plevel, RMuint32 *pextra_buffers,	RMuint32 *pwidth, RMuint32 *pheight){	/* set codec based on command line option */	*pextra_buffers = 0;	*pprofile = 0;	*plevel = 0;		switch(profile) {	case Profile_MPEG2_SD:	case Profile_MPEG2_DVD:	case Profile_MPEG2_SD_DeInt:	case Profile_MPEG2_DVD_DeInt:		*pvcodec = EMhwlibVideoCodec_MPEG2;		*pwidth = 720;		*pheight = 576;		break;	case Profile_MPEG2_HD:	case Profile_MPEG2_HD_DeInt:		*pvcodec = EMhwlibVideoCodec_MPEG2;		*pwidth = 1920;		*pheight = 1080;		break;	case Profile_MPEG4_SD:	case Profile_MPEG4_SD_DeInt:		*pvcodec = EMhwlibVideoCodec_MPEG4;		*pwidth = 720;		*pheight = 576;		break;	case Profile_MPEG4_SD_Padding:	case Profile_MPEG4_SD_DeInt_Padding:		*pvcodec = EMhwlibVideoCodec_MPEG4_Padding;		*pwidth = 720;		*pheight = 576;		break;	case Profile_MPEG4_HD:	case Profile_MPEG4_HD_DeInt:		*pvcodec = EMhwlibVideoCodec_MPEG4;		*pwidth = 1920;		*pheight = 1080;		break;	case Profile_MPEG4_HD_Padding:	case Profile_MPEG4_HD_DeInt_Padding:		*pvcodec = EMhwlibVideoCodec_MPEG4_Padding;		*pwidth = 1920;		*pheight = 1080;		break;	case Profile_DIVX3_SD:		*pvcodec = EMhwlibVideoCodec_DIVX3;		*pwidth = 720;		*pheight = 576;		break;	case Profile_DIVX3_HD:		*pvcodec = EMhwlibVideoCodec_DIVX3;		*pwidth = 1920;		*pheight = 1080;		break;	case Profile_VC1_SD:		*pvcodec = EMhwlibVideoCodec_VC1;		*pwidth = 720;		*pheight = 576;		break;	case Profile_VC1_HD:		*pvcodec = EMhwlibVideoCodec_VC1;		*pwidth = 1920;		*pheight = 1080;		break;	case Profile_WMV_SD:		*pvcodec = EMhwlibVideoCodec_WMV;		*pwidth = 720;		*pheight = 576;		break;	case Profile_WMV_816P:		*pvcodec = EMhwlibVideoCodec_WMV;		*pwidth = 1440;		*pheight = 816;		break;	case Profile_WMV_HD:		*pvcodec = EMhwlibVideoCodec_WMV;		*pwidth = 1920;		*pheight = 1080;		break;	case Profile_H264_SD:	case Profile_H264_SD_DeInt:		*pvcodec = EMhwlibVideoCodec_H264;		*pprofile = EMhwlib_H264_BaselineProfile;		*plevel = EMhwlib_H264_Level_4;		*pwidth = 720;		*pheight = 576;		break;	case Profile_H264_HD:	case Profile_H264_HD_DeInt:		*pvcodec = EMhwlibVideoCodec_H264;		*pprofile = EMhwlib_H264_BaselineProfile;		*plevel = EMhwlib_H264_Level_4;		*pwidth = 1920;		*pheight = 1080;		break;	default:		RMDBGLOG((ENABLE, "Unknown video decoder codec \n"));		return RM_ERROR;	}	return RM_OK;}RMbool parse_WMV9_video_sequence_header(RMuint32 wmv9SequenceHeader){	RMuint8 bit_select;	RMuint8 byte0 = (wmv9SequenceHeader >> 24) & 0xFF;	RMuint8 byte1 = (wmv9SequenceHeader >> 16) & 0xFF;	RMuint8 byte2 = (wmv9SequenceHeader >> 8) & 0xFF;	RMuint8 byte3 = wmv9SequenceHeader & 0xFF;	RMbool codecSupported = TRUE;		bit_select = (byte0 >> 6) & 3;	switch (bit_select) {	case 0: 		RMDBGLOG((ENABLE, "    Simple Profile\n")); 		break; 	case 1: 		RMDBGLOG((ENABLE, "    Main Profile\n")); 		break;	case 2:  // Not supported		RMDBGLOG((ENABLE, "    Complex Profile\n")); 		fprintf(stderr, " Complex Profile is not supported by this hardware! \n"); 		codecSupported = FALSE;		break;	case 3: 		RMDBGLOG((ENABLE, "    Error in PROFILE\n")); 		break;	}		bit_select = (byte0 >> 5) & 1;      	if (bit_select) {		RMDBGLOG((ENABLE, "    Interlaced mode\n"));		fprintf(stderr, ">>> WARNING: this stream is marked as interlaced and it's not supported by the hardware, playback might fail\n");	}	else		RMDBGLOG((ENABLE, "    Progressive mode\n"));		bit_select = (byte0 >> 4) & 1;      	if(bit_select) {		RMDBGLOG((ENABLE, "    Sprite mode ON\n")); // Not supported		fprintf(stderr, " Sprite mode is not supported by this hardware! \n"); 		codecSupported = FALSE;	}	else		RMDBGLOG((ENABLE, "    Sprite mode OFF\n"));		bit_select = (byte0 >> 1) & 7;            	RMDBGLOG((ENABLE, "    Framerate is %0d fps\n", bit_select * 4 + 2));		bit_select = (((byte0 >> 0) & 1) << 4) + ((byte1 >> 4) & 15); 	if(bit_select == 31) // All supported		RMDBGLOG((ENABLE, "    Bitrate is > 4064 kbps\n"));	else		RMDBGLOG((ENABLE, "    Bitrate is %0d kbps\n", bit_select * 64 + 32));			bit_select = (byte1 >> 3) & 1;            	if(bit_select) {// All supported		RMDBGLOG((ENABLE, "    Loop filter ON\n")); // Supported		bit_select = (byte0 >> 6) & 3;		if(bit_select == 0)			RMDBGLOG((ENABLE, "Loop filter incompatible with simple profile\n"));	} else		RMDBGLOG((ENABLE, "    Loop filter OFF\n"));		bit_select = (byte1 >> 2) & 1;            	if(bit_select) { // Simple and main, should be 0		RMDBGLOG((ENABLE, "    XINTRA8 ON\n"));  // Not supported		fprintf(stderr, " XINTRA8 ON is only valid with complex profile and is not supported by this hardware! \n"); 		codecSupported = FALSE;		bit_select = (byte0 >> 6) & 3;		if(bit_select != 2)			RMDBGLOG((ENABLE, "XINTRA8 only present in complex profile\n"));	} else		RMDBGLOG((ENABLE, "    XINTRA8 OFF\n"));				bit_select = (byte1 >> 1) & 1;            	if(bit_select) { // All supported		RMDBGLOG((ENABLE, "    Multiresolution ON\n"));		bit_select = (byte0 >> 6) & 3;		if(bit_select == 0)			RMDBGLOG((ENABLE, "Multiresolution incompatible with simple profile\n"));	}	else		RMDBGLOG((ENABLE, "    Multiresolution OFF\n"));				bit_select = (byte1 >> 0) & 1;            	if(bit_select) // Simple and main should be 1		RMDBGLOG((ENABLE, "    Fast Transform ON\n"));  	else {		RMDBGLOG((ENABLE, "    Fast Transform OFF\n")); // Not supported		fprintf(stderr, " Fast transform OFF is only valid with complex profile and is not supported by this hardware! \n");		codecSupported = FALSE;		if(bit_select != 2)			RMDBGLOG((ENABLE, " IDCT is present\n"));	}				bit_select = (byte2 >> 7) & 1;            	if(bit_select)  // All supported		RMDBGLOG((ENABLE, "    Fast UVMC ON\n"));	else		RMDBGLOG((ENABLE, "    Fast UVMC OFF\n"));				bit_select = (byte2 >> 6) & 1;            	if(bit_select) {		RMDBGLOG((ENABLE, " Broadcast ON\n")); 	}	else		RMDBGLOG((ENABLE, "    Broadcast OFF\n"));				bit_select = (byte2 >> 4) & 3;        	switch(bit_select) { // All supported	case 0: 		RMDBGLOG((ENABLE, "    Frame quantization step size\n")); 		break;	case 1: 		RMDBGLOG((ENABLE, "    Macroblock quantization step size\n"));		bit_select = (byte0 >> 6) & 3;		if(bit_select == 0)			RMDBGLOG((ENABLE, "DQUANT incompatible with simple profile\n"));		break;	case 2:		RMDBGLOG((ENABLE, "    Boundary alternate quantization\n"));		bit_select = (byte0 >> 6) & 3;		if(bit_select == 0)			RMDBGLOG((ENABLE, "DQUANT incompatible with simple profile\n"));		break;	case 3: 		RMDBGLOG((ENABLE, "Error in DQUANT\n")); 		break;	}				bit_select = (byte2 >> 3) & 1;        	if(bit_select)		RMDBGLOG((ENABLE, "    Variable size transform ON\n")); // Supported	else		RMDBGLOG((ENABLE, "    Variable size transform OFF\n"));				bit_select = (byte2 >> 2) & 1;        	if(bit_select)		RMDBGLOG((ENABLE, "    Transform table switching ON\n"));  // Supported	else		RMDBGLOG((ENABLE, "    Transform table switching OFF\n"));				bit_select = (byte2 >> 1) & 1;        	if(bit_select)		RMDBGLOG((ENABLE, "    Overlap filter ON\n"));  // Supported	else		RMDBGLOG((ENABLE, "    Overlap filter OFF\n"));				bit_select = (byte2 >> 0) & 1;        	if(bit_select) {		RMDBGLOG((ENABLE, "    Startcodes present\n")); // Not supported by microcode if 1 - Could be written		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));		RMDBGLOG((ENABLE, " Start code present not be supported yet! \n")); 		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));	}	else		RMDBGLOG((ENABLE, "    No startcodes\n"));				bit_select = (byte3 >> 7) & 1;        	if(bit_select)		RMDBGLOG((ENABLE, "    Preprocessing ON\n")); // Supported	else		RMDBGLOG((ENABLE, "    Preprocessing OFF\n"));				bit_select = (byte3 >> 4) & 7; // Supported	if(bit_select)		RMDBGLOG((ENABLE, "    %d consecutive B-frames\n", bit_select));	else		RMDBGLOG((ENABLE, "    No B-frames\n"));				bit_select = (byte3 >> 2) & 3;	switch(bit_select) { // All supported	case 0: 		RMDBGLOG((ENABLE, "    Quantizer implicitly specified at frame level\n")); 		break;	case 1: 		RMDBGLOG((ENABLE, "    Quantizer explicitly specified at frame level\n")); 		break;	case 2: 		RMDBGLOG((ENABLE, "    5QP deadzone quantizer user for all frames\n")); 		break;	case 3: 		RMDBGLOG((ENABLE, "    3QP deadzone quantizer user for all frames\n")); 		break;	}				bit_select = (byte3 >> 1) & 1;        	if(bit_select) { // Not in spec... Usefull? (Frederic)		RMDBGLOG((ENABLE, "    Frame interpolation ON\n"));		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));		RMDBGLOG((ENABLE, " Frame interpolation may not be supported! \n")); 		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));		RMDBGLOG((ENABLE, " ***************** WARNING ************************\n"));	}	else		RMDBGLOG((ENABLE, "    Frame interpolation OFF\n"));				bit_select = (byte3 >> 0) & 1;        	if(bit_select)		RMDBGLOG((ENABLE, "    Release encoder used\n"));	else {		RMDBGLOG((ENABLE, "    Beta encoder used\n")); // Not supported		fprintf(stderr, " This file has been created by a WMV9 BETA encoder! \n"); 		fprintf(stderr, " This file is not supported due to changes that\n"); 		fprintf(stderr, " may have occured between this BETA version and the\n"); 		fprintf(stderr, " final version of Microsoft WMV9 encoder.\n"); 		codecSupported = FALSE;	}	return codecSupported;}

⌨️ 快捷键说明

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