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

📄 filedump.c

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 C
📖 第 1 页 / 共 4 页
字号:
			ReorderAU(sample_list, au);		}	}	count = gf_list_count(sample_list);	for (i=0; i<count; i++) {		GF_AUContext *au = gf_list_get(sample_list, i);				for (j=0; j<gf_list_count(au->commands); j++) {			GF_Command *com = gf_list_get(au->commands, j);			/*stat level 2 - get command stats*/			if (stat_level==2) {				e = gf_sm_stats_for_command(sm, com);				if (e) goto exit;			}			/*stat level 3 - apply command*/			if (stat_level==3) gf_sg_command_apply(scene_graph, com, 0);		}		/*stat level 3: get graph stat*/		if (stat_level==3) {			e = gf_sm_stats_for_graph(sm, scene_graph);			if (e) goto exit;		}		if (stat_level==2) {			fprintf(dump, "<AUStatistics StreamID=\"%d\" AUTime=\""LLD"\">\n", au->owner->ESID, LLD_CAST au->timing);		} else {			fprintf(dump, "<GraphStatistics StreamID=\"%d\" AUTime=\""LLD"\">\n", au->owner->ESID, LLD_CAST au->timing);		}		/*dump stats*/		dump_stats(dump, gf_sm_stats_get(sm) );		/*reset stats*/		gf_sm_stats_reset(sm);		if (stat_level==2) {			fprintf(dump, "</AUStatistics>\n");		} else {			fprintf(dump, "</GraphStatistics>\n");		}		gf_set_progress("Analysing AU", i+1, count);	}exit:		if (sample_list) gf_list_del(sample_list);	if (sm) gf_sm_stats_del(sm);	gf_sm_del(ctx);	gf_sg_del(scene_graph);	if (e) {		fprintf(stdout, "%s\n", gf_error_to_string(e));	} else {		fprintf(dump, "</SceneStatistics>\n");	}	if (dump && close) fclose(dump);	fprintf(stdout, "done\n");}#endifvoid PrintFixed(Fixed val, Bool add_space){	if (add_space) fprintf(stdout, " ");	if (val==FIX_MIN) fprintf(stdout, "-I");	else if (val==FIX_MAX) fprintf(stdout, "+I");	else fprintf(stdout, "%g", FIX2FLT(val));}void PrintNodeSFField(u32 type, void *far_ptr){	if (!far_ptr) return;	switch (type) {	case GF_SG_VRML_SFBOOL:		fprintf(stdout, "%s", (*(SFBool *)far_ptr) ? "TRUE" : "FALSE");		break;	case GF_SG_VRML_SFINT32:		fprintf(stdout, "%d", (*(SFInt32 *)far_ptr));		break;	case GF_SG_VRML_SFFLOAT:		PrintFixed((*(SFFloat *)far_ptr), 0);		break;	case GF_SG_VRML_SFTIME:		fprintf(stdout, "%g", (*(SFTime *)far_ptr));		break;	case GF_SG_VRML_SFVEC2F:		PrintFixed(((SFVec2f *)far_ptr)->x, 0);		PrintFixed(((SFVec2f *)far_ptr)->y, 1);		break;	case GF_SG_VRML_SFVEC3F:		PrintFixed(((SFVec3f *)far_ptr)->x, 0);		PrintFixed(((SFVec3f *)far_ptr)->y, 1);		PrintFixed(((SFVec3f *)far_ptr)->z, 1);		break;	case GF_SG_VRML_SFROTATION:		PrintFixed(((SFRotation *)far_ptr)->x, 0);		PrintFixed(((SFRotation *)far_ptr)->y, 1);		PrintFixed(((SFRotation *)far_ptr)->z, 1);		PrintFixed(((SFRotation *)far_ptr)->q, 1);		break;	case GF_SG_VRML_SFCOLOR:		PrintFixed(((SFColor *)far_ptr)->red, 0);		PrintFixed(((SFColor *)far_ptr)->green, 1);		PrintFixed(((SFColor *)far_ptr)->blue, 1);		break;	case GF_SG_VRML_SFSTRING:		if (((SFString*)far_ptr)->buffer)			fprintf(stdout, "\"%s\"", ((SFString*)far_ptr)->buffer);		else			fprintf(stdout, "NULL");		break;	}}void PrintNode(const char *name, u32 graph_type){	const char *nname, *std_name;	GF_Node *node;	GF_SceneGraph *sg;	u32 tag, nbF, i;	GF_FieldInfo f;	u8 qt, at;	Fixed bmin, bmax;	u32 nbBits;	tag = 0;	if (graph_type==2) {#ifndef GPAC_DISABLE_SVG		tag = gf_svg_get_element_tag(name);#endif		std_name = "SVG";	} else if (graph_type==1) {		tag = gf_node_x3d_type_by_class_name(name);		std_name = "X3D";	} else {		tag = gf_node_mpeg4_type_by_class_name(name);		std_name = "MPEG4";	}	if (!tag) {		fprintf(stdout, "Unknown %s node %s\n", std_name, name);		return;	}	sg = gf_sg_new();	node = gf_node_new(sg, tag);	gf_node_register(node, NULL);	nname = gf_node_get_class_name(node);	if (!node) {		fprintf(stdout, "Node %s not supported in current built\n", nname);		return;	}	nbF = gf_node_get_field_count(node);	if (graph_type==2) {		fprintf(stdout, "SVG Element Syntax:\n");		fprintf(stdout, "<%s ", nname);	} else {		fprintf(stdout, "Node Syntax:\n%s {\n", nname);	}	for (i=0; i<nbF; i++) {		gf_node_get_field(node, i, &f);		if (graph_type==2) {			fprintf(stdout, "\t%s=\"...\"\n", f.name);			continue;		}		fprintf(stdout, "\t%s %s %s", gf_sg_vrml_get_event_type_name(f.eventType, 0), gf_sg_vrml_get_field_type_by_name(f.fieldType), f.name);		if (f.fieldType==GF_SG_VRML_SFNODE) fprintf(stdout, " NULL");		else if (f.fieldType==GF_SG_VRML_MFNODE) fprintf(stdout, " []");		else if (gf_sg_vrml_is_sf_field(f.fieldType)) {			fprintf(stdout, " ");			PrintNodeSFField(f.fieldType, f.far_ptr);		} else {			void *ptr;			u32 i, sftype;			GenMFField *mffield = (GenMFField *) f.far_ptr;			fprintf(stdout, " [");			sftype = gf_sg_vrml_get_sf_type(f.fieldType);			for (i=0; i<mffield->count; i++) {				if (i) fprintf(stdout, " ");				gf_sg_vrml_mf_get_item(f.far_ptr, f.fieldType, &ptr, i);				PrintNodeSFField(sftype, ptr);			}			fprintf(stdout, "]");		}		if (gf_bifs_get_aq_info(node, i, &qt, &at, &bmin, &bmax, &nbBits)) {			if (qt) {				fprintf(stdout, " #QP=%d", qt);				if (qt==13) fprintf(stdout, " NbBits=%d", nbBits);				if (bmin && bmax) {					fprintf(stdout, " Bounds=[");					PrintFixed(bmin, 0);					fprintf(stdout, ",");					PrintFixed(bmax, 0);					fprintf(stdout, "]");				}			}		}		fprintf(stdout, "\n");	}	if (graph_type==2) {		fprintf(stdout, "/>\n%d possible attributes\n",nbF);	} else {		fprintf(stdout, "}\n\n");	}	gf_node_unregister(node, NULL);	gf_sg_del(sg);}void PrintBuiltInNodes(u32 graph_type){	GF_Node *node;	GF_SceneGraph *sg;	u32 i, nb_in, nb_not_in, start_tag, end_tag;	if (graph_type==1) {		start_tag = GF_NODE_RANGE_FIRST_X3D;		end_tag = TAG_LastImplementedX3D;	} else if (graph_type==2) {		start_tag = GF_NODE_RANGE_FIRST_SVG;		end_tag = GF_NODE_RANGE_LAST_SVG;	} else {		start_tag = GF_NODE_RANGE_FIRST_MPEG4;		end_tag = TAG_LastImplementedMPEG4;	}	nb_in = nb_not_in = 0;	sg = gf_sg_new();		if (graph_type==1) {		fprintf(stdout, "Available X3D nodes in this build (dumping):\n");	} else if (graph_type==2) {		fprintf(stdout, "Available SVG nodes in this build (dumping and LASeR coding):\n");	} else {		fprintf(stdout, "Available MPEG-4 nodes in this build (encoding/decoding/dumping):\n");	}	for (i=start_tag; i<end_tag; i++) {		node = gf_node_new(sg, i);		if (node) {			gf_node_register(node, NULL);			fprintf(stdout, " %s\n", gf_node_get_class_name(node));			gf_node_unregister(node, NULL);			nb_in++;		} else {			if (graph_type==2) 				break;			nb_not_in++;		}	}	gf_sg_del(sg);	if (graph_type==2) {		fprintf(stdout, "\n%d nodes supported\n", nb_in);	} else {		fprintf(stdout, "\n%d nodes supported - %d nodes not supported\n", nb_in, nb_not_in);	}}void dump_file_mp4(GF_ISOFile *file, char *inName){	FILE *dump;	char szBuf[1024];	if (inName) {		strcpy(szBuf, inName);		strcat(szBuf, "_info.xml");		dump = fopen(szBuf, "wt");		gf_isom_dump(file, dump);		fclose(dump);	} else {		gf_isom_dump(file, stdout);	}}void dump_file_rtp(GF_ISOFile *file, char *inName){	u32 i, j;	FILE *dump;	char szBuf[1024];	if (inName) {		strcpy(szBuf, inName);		strcat(szBuf, "_rtp.xml");		dump = fopen(szBuf, "wt");	} else {		dump = stdout;	}	fprintf(dump, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");	fprintf(dump, "<!-- MP4Box RTP trace -->\n");	fprintf(dump, "<RTPFile>\n");	for (i=0; i<gf_isom_get_track_count(file); i++) {		if (gf_isom_get_media_type(file, i+1) != GF_ISOM_MEDIA_HINT) continue;		fprintf(dump, "<RTPHintTrack trackID=\"%d\">\n", gf_isom_get_track_id(file, i+1));		for (j=0; j<gf_isom_get_sample_count(file, i+1); j++) {			gf_isom_dump_hint_sample(file, i+1, j+1, dump);		}		fprintf(dump, "</RTPHintTrack>\n");	}	fprintf(dump, "</RTPFile>\n");	if (inName) fclose(dump);}void dump_file_ts(GF_ISOFile *file, char *inName){	u32 i, j, k, count;	Bool has_error;	FILE *dump;	char szBuf[1024];	if (inName) {		strcpy(szBuf, inName);		strcat(szBuf, "_ts.txt");		dump = fopen(szBuf, "wt");	} else {		dump = stdout;	}	has_error = 0;	for (i=0; i<gf_isom_get_track_count(file); i++) {			Bool has_cts_offset = gf_isom_has_time_offset(file, i+1);		fprintf(dump, "#dumping track ID %d timing\n", gf_isom_get_track_id(file, i+1));		count = gf_isom_get_sample_count(file, i+1);		for (j=0; j<count; j++) {			u64 dts, cts;			GF_ISOSample *samp = gf_isom_get_sample_info(file, i+1, j+1, NULL, NULL);			dts = samp->DTS;			cts = dts + (s32) samp->CTS_Offset;			gf_isom_sample_del(&samp);			fprintf(dump, "Sample %d - DTS "LLD" - CTS "LLD"", j+1, LLD_CAST dts, LLD_CAST cts);			if (cts<dts) { fprintf(dump, " #NEGATIVE CTS OFFSET!!!"); has_error = 1;}					if (has_cts_offset) {				for (k=0; k<count; k++) {					u64 adts, acts;					if (k==j) continue;					samp = gf_isom_get_sample_info(file, i+1, k+1, NULL, NULL);					adts = samp->DTS;					acts = adts + (s32) samp->CTS_Offset;					if (adts==dts) { fprintf(dump, " #SAME DTS USED!!!"); has_error = 1; }					if (acts==cts) { fprintf(dump, " #SAME CTS USED!!! "); has_error = 1; }					gf_isom_sample_del(&samp);				}			}			fprintf(dump, "\n");			gf_set_progress("Analysing Track Timing", j+1, count);		}		fprintf(dump, "\n\n");		gf_set_progress("Analysing Track Timing", count, count);	}	if (inName) fclose(dump);	if (has_error) fprintf(stdout, "\tFile has CTTS table errors\n");}void dump_file_ismacryp(GF_ISOFile *file, char *inName){	u32 i, j;	FILE *dump;	char szBuf[1024];	if (inName) {		strcpy(szBuf, inName);		strcat(szBuf, "_ismacryp.xml");		dump = fopen(szBuf, "wt");	} else {		dump = stdout;	}	fprintf(dump, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");	fprintf(dump, "<!-- MP4Box ISMACryp trace -->\n");	fprintf(dump, "<ISMACrypFile>\n");	for (i=0; i<gf_isom_get_track_count(file); i++) {		if (gf_isom_get_media_subtype(file, i+1, 1) != GF_ISOM_SUBTYPE_MPEG4_CRYP) continue;		gf_isom_dump_ismacryp_protection(file, i+1, dump);		fprintf(dump, "<ISMACrypTrack trackID=\"%d\">\n", gf_isom_get_track_id(file, i+1));		for (j=0; j<gf_isom_get_sample_count(file, i+1); j++) {			gf_isom_dump_ismacryp_sample(file, i+1, j+1, dump);		}		fprintf(dump, "</ISMACrypTrack >\n");	}	fprintf(dump, "</ISMACrypFile>\n");	if (inName) fclose(dump);}void dump_timed_text_track(GF_ISOFile *file, u32 trackID, char *inName, Bool is_convert, u32 dump_type){	FILE *dump;	GF_Err e;	u32 track;	char szBuf[1024];	track = gf_isom_get_track_by_id(file, trackID);	if (!track) {		fprintf(stdout, "Cannot find track ID %d\n", trackID);		return;	}	if (gf_isom_get_media_type(file, track) != GF_ISOM_MEDIA_TEXT) {		fprintf(stdout, "Track ID %d is not a 3GPP text track\n", trackID);		return;	}	if (inName) {		if (is_convert)				sprintf(szBuf, "%s.%s", inName, (dump_type==2) ? "svg" : ((dump_type==1) ? "srt" : "ttxt") ) ;		else

⌨️ 快捷键说明

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