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

📄 main.c

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 C
📖 第 1 页 / 共 5 页
字号:
	u32 i, count;	count = gf_isom_get_track_count(file);	if (count==1) return;	/*force PL rewrite*/	gf_isom_set_pl_indication(file, GF_ISOM_PL_VISUAL, 0);	gf_isom_set_pl_indication(file, GF_ISOM_PL_AUDIO, 0);	gf_isom_set_pl_indication(file, GF_ISOM_PL_OD, 1);	/*the lib always remove IOD when no profiles are specified..*/	for (i=0; i<gf_isom_get_track_count(file); i++) {		switch (gf_isom_get_media_type(file, i+1)) {		case GF_ISOM_MEDIA_VISUAL:		case GF_ISOM_MEDIA_AUDIO:		case GF_ISOM_MEDIA_TEXT:			gf_isom_remove_track_from_root_od(file, i+1);			check_media_profile(file, i+1);			break;		/*only remove real systems tracks (eg, delaing with scene description & presentation)		but keep meta & all unknown tracks*/		case GF_ISOM_MEDIA_SCENE:		case GF_ISOM_MEDIA_OD:		case GF_ISOM_MEDIA_OCR:		case GF_ISOM_MEDIA_MPEGJ:			gf_isom_remove_track(file, i+1);			i--;			break;		default:			break;		}	}	/*none required*/	if (!gf_isom_get_pl_indication(file, GF_ISOM_PL_AUDIO)) gf_isom_set_pl_indication(file, GF_ISOM_PL_AUDIO, 0xFF);	if (!gf_isom_get_pl_indication(file, GF_ISOM_PL_VISUAL)) gf_isom_set_pl_indication(file, GF_ISOM_PL_VISUAL, 0xFF);	gf_isom_set_pl_indication(file, GF_ISOM_PL_OD, 0xFF);	gf_isom_set_pl_indication(file, GF_ISOM_PL_SCENE, 0xFF);	gf_isom_set_pl_indication(file, GF_ISOM_PL_GRAPHICS, 0xFF);	gf_isom_set_pl_indication(file, GF_ISOM_PL_INLINE, 0);}#endif/*return value:	0: not supported 	1: ISO media 	2: input bt file (.bt, .wrl)	3: input XML file (.xmt)	4: input SVG file (.svg)	5: input SWF file (.swf)	6: input LASeR file (.lsr or .saf)*/u32 get_file_type_by_ext(char *inName){	u32 type = 0;	char *__ext = strrchr(inName, '.');	if (__ext) {		char ext[20];		if (!strcmp(__ext, ".gz")) __ext = strrchr(__ext-1, '.');		strcpy(ext, __ext+1);		__ext = strchr(ext, '.');		if (__ext) __ext[0] = 0;		if (!stricmp(ext, "mp4") || !stricmp(ext, "3gp") || !stricmp(ext, "mov") || !stricmp(ext, "3g2")) type = 1;		else if (!stricmp(ext, "bt") || !stricmp(ext, "wrl") || !stricmp(ext, "x3dv")) type = 2;		else if (!stricmp(ext, "xmt") || !stricmp(ext, "x3d")) type = 3;		else if (!stricmp(ext, "lsr") || !stricmp(ext, "saf")) type = 6;		else if (!stricmp(ext, "svg")) type = 4;		else if (!stricmp(ext, "xsr")) type = 4;		else if (!stricmp(ext, "xml")) type = 4;		else if (!stricmp(ext, "swf")) type = 5;		else if (!stricmp(ext, "jp2")) return 0;		else type = 0;	}	/*try open file in read mode*/	if (!type && gf_isom_probe_file(inName)) type = 1;	return type;}#ifndef GPAC_READ_ONLYstatic Bool can_convert_to_isma(GF_ISOFile *file){	u32 spec = gf_isom_guess_specification(file);	if (spec==GF_4CC('I','S','M','A')) return 1;	return 0;}#endifstatic void progress_quiet(void *cbck, char *title, u32 done, u32 total) { }typedef struct{	u32 trackID;	char *line;} SDPLine;typedef struct{	/*actions:		0: set meta type		1: add item		2: rem item		3: set item primary		4: set XML		5: set binary XML		6: rem XML		7: dump item		8: dump XML	*/	u32 act_type;	Bool root_meta, use_dref;	u32 trackID;	u32 meta_4cc;	char szPath[GF_MAX_PATH];	char szName[1024], mime_type[1024], enc_type[1024];	u32 item_id;} MetaAction;/*for SDP_EX, AddTrack and RemTrack*/#define MAX_CUMUL_OPS	20#ifndef GPAC_READ_ONLYstatic Bool parse_meta_args(MetaAction *meta, char *opts){	Bool ret = 0;	char szSlot[1024], *next;	meta->mime_type[0] = 0;	meta->enc_type[0] = 0;	meta->szName[0] = 0;	meta->szPath[0] = 0;	meta->trackID = 0;	meta->root_meta = 1;	if (!opts) return 0;	while (1) {		if (!opts || !opts[0]) return ret;		if (opts[0]==':') opts += 1;		strcpy(szSlot, opts);		next = strchr(szSlot, ':');		/*use ':' as separator, but beware DOS paths...*/		if (next && next[1]=='\\') next = strchr(szSlot+2, ':');		if (next) next[0] = 0;				if (!strnicmp(szSlot, "tk=", 3)) {			sscanf(szSlot, "tk=%d", &meta->trackID);			meta->root_meta = 0;			ret = 1;		}		else if (!strnicmp(szSlot, "name=", 5)) { strcpy(meta->szName, szSlot+5); ret = 1; }		else if (!strnicmp(szSlot, "path=", 5)) { strcpy(meta->szPath, szSlot+5); ret = 1; }		else if (!strnicmp(szSlot, "mime=", 5)) { strcpy(meta->mime_type, szSlot+5); ret = 1; }		else if (!strnicmp(szSlot, "encoding=", 9)) { strcpy(meta->enc_type, szSlot+9); ret = 1; }		else if (!strnicmp(szSlot, "dref", 4)) { meta->use_dref = 1; ret = 1; }		else if (!stricmp(szSlot, "binary")) {			if (meta->act_type==4) meta->act_type=5;			ret = 1;		}		else if (!strchr(szSlot, '=')) {			switch (meta->act_type) {			case 0:				if (!stricmp(szSlot, "null") || !stricmp(szSlot, "0")) meta->meta_4cc = 0;				else meta->meta_4cc = GF_4CC(szSlot[0], szSlot[1], szSlot[2], szSlot[3]);				ret = 1;				break;			case 1: 			case 4: 			case 7: 				strcpy(meta->szPath, szSlot);  				ret = 1;				break;			case 2: 			case 3: 			case 8: 				meta->item_id = atoi(szSlot);  				ret = 1;				break;			}		}		opts += strlen(szSlot);	}	return ret;}#endif#define CHECK_NEXT_ARG	if (i+1==(u32)argc) { fprintf(stdout, "Missing arg - please check usage\n"); return 1; }#define CHECK_META_OPS	CHECK_NEXT_ARG if (nb_meta_act>=MAX_CUMUL_OPS) { fprintf(stdout, "Sorry - no more than %d meta operations allowed\n", MAX_CUMUL_OPS); return 1; }typedef struct{	/*	0: rem track	1: set track language	2: set track delay	3: set track KMS URI	4: set visual track PAR if possible	5: set track handler name	*/	u32 act_type;	/*track ID*/	u32 trackID;	char lang[4];	s32 delay_ms;	const char *kms;	const char *hdl_name;	s32 par_num, par_den;} TrackAction;enum{	GF_ISOM_CONV_TYPE_ISMA = 1,	GF_ISOM_CONV_TYPE_ISMA_EX,	GF_ISOM_CONV_TYPE_3GPP,	GF_ISOM_CONV_TYPE_IPOD,	GF_ISOM_CONV_TYPE_PSP};int main(int argc, char **argv){	char outfile[5000];	GF_Err e;	GF_SMEncodeOptions opts;	Double InterleavingTime, split_duration, split_start, import_fps;	SDPLine sdp_lines[MAX_CUMUL_OPS];	MetaAction metas[MAX_CUMUL_OPS];	char *szFilesToCat[MAX_CUMUL_OPS];	char *szTracksToAdd[MAX_CUMUL_OPS];	TrackAction tracks[MAX_CUMUL_OPS];	u32 brand_add[MAX_CUMUL_OPS], brand_rem[MAX_CUMUL_OPS];	u32 i, MTUSize, stat_level, hint_flags, info_track_id, import_flags, nb_add, nb_cat, ismaCrypt, agg_samples, nb_sdp_ex, max_ptime, raw_sample_num, split_size, nb_meta_act, nb_track_act, rtp_rate, major_brand, nb_alt_brand_add, nb_alt_brand_rem, old_interleave, car_dur, minor_version, conv_type;	Bool HintIt, needSave, FullInter, Frag, HintInter, dump_std, dump_rtp, dump_mode, regular_iod, trackID, HintCopy, remove_sys_tracks, remove_hint, force_new, keep_sys_tracks, remove_root_od, import_subtitle;	Bool print_sdp, print_info, open_edit, track_dump_type, dump_isom, dump_cr, force_ocr, encode, do_log, do_flat, dump_srt, dump_ttxt, x3d_info, chunk_mode, dump_ts, do_saf, dump_m2ts, dump_cart, do_hash, verbose;	char *inName, *outName, *arg, *mediaSource, *tmpdir, *input_ctx, *output_ctx, *drm_file, *avi2raw, *cprt, *chap_file, *pes_dump, *itunes_tags, *pack_file, *raw_cat;	GF_ISOFile *file;	if (argc < 2) {		PrintUsage();		return 1;	}	nb_add = nb_cat = nb_track_act = nb_sdp_ex = max_ptime = raw_sample_num = nb_meta_act = rtp_rate = major_brand = nb_alt_brand_add = nb_alt_brand_rem = car_dur = minor_version = 0;	e = GF_OK;	split_duration = 0.0;	split_start = -1.0;	InterleavingTime = 0.5;	import_fps = 0;	import_flags = 0;	split_size = 0;	MTUSize = 1450;	HintCopy = FullInter = HintInter = encode = do_log = old_interleave = do_saf = do_hash = verbose = 0;	chunk_mode = dump_mode = Frag = force_ocr = remove_sys_tracks = agg_samples = remove_hint = keep_sys_tracks = remove_root_od = 0;	x3d_info = conv_type = HintIt = needSave = print_sdp = print_info = regular_iod = dump_std = open_edit = dump_isom = dump_rtp = dump_cr = dump_srt = dump_ttxt = force_new = dump_ts = dump_m2ts = dump_cart = import_subtitle = 0;	track_dump_type = 0;	ismaCrypt = 0;	file = NULL;	itunes_tags = pes_dump = NULL;	memset(&opts, 0, sizeof(opts));		trackID = stat_level = hint_flags = 0;	info_track_id = 0;	do_flat = 0;	inName = outName = mediaSource = input_ctx = output_ctx = drm_file = avi2raw = cprt = chap_file = pack_file = raw_cat = NULL;	swf_flags = 0;	swf_flatten_angle = 0.0f;	tmpdir = NULL;		/*parse our args*/	for (i = 1; i < (u32) argc ; i++) {		arg = argv[i];		/*main file*/		if (isalnum(arg[0]) || (arg[0]=='/') || (arg[0]=='.') || (arg[0]=='\\') ) {			if (inName) { fprintf(stdout, "Error - 2 input names specified, please check usage\n"); return 1; }			inName = arg;		}		else if (!stricmp(arg, "-?")) { PrintUsage(); return 0; }		else if (!stricmp(arg, "-version")) { PrintVersion(); return 0; }		else if (!stricmp(arg, "-sdp")) print_sdp = 1;		else if (!stricmp(arg, "-quiet")) quiet = 1;		else if (!stricmp(arg, "-info")) {			print_info = 1;			if ((i+1<(u32) argc) && (sscanf(argv[i+1], "%d", &info_track_id)==1)) {				char szTk[20];				sprintf(szTk, "%d", info_track_id);				if (!strcmp(szTk, argv[i+1])) i++;				else info_track_id=0;			} else {				info_track_id=0;			}		}		else if (!stricmp(arg, "-raw")) {			CHECK_NEXT_ARG			track_dump_type = GF_EXPORT_NATIVE;			trackID = atoi(argv[i+1]);			i++;		}		else if (!stricmp(arg, "-qcp")) {			CHECK_NEXT_ARG			track_dump_type = GF_EXPORT_NATIVE | GF_EXPORT_USE_QCP;			trackID = atoi(argv[i+1]);			i++;		}		else if (!stricmp(arg, "-aviraw")) {			CHECK_NEXT_ARG			if (argv[i+1] && !stricmp(argv[i+1], "video")) trackID = 1;			else if (argv[i+1] && !stricmp(argv[i+1], "audio")) {				if (strlen(argv[i+1])==5) trackID = 2;				else trackID = 1 + atoi(argv[i+1] + 5);			}			else { fprintf(stdout, "Usage: \"-aviraw video\" or \"-aviraw audio\"\n"); return 1; }			track_dump_type = GF_EXPORT_AVI_NATIVE;			i++;		}		else if (!stricmp(arg, "-raws")) {			CHECK_NEXT_ARG			track_dump_type = GF_EXPORT_RAW_SAMPLES;			if (strchr(argv[i+1], ':')) {				sscanf(argv[i+1], "%d:%d", &trackID, &raw_sample_num);			} else {				trackID = atoi(argv[i+1]);			}			i++;		}		else if (!stricmp(arg, "-nhnt")) {			CHECK_NEXT_ARG			track_dump_type = GF_EXPORT_NHNT;			trackID = atoi(argv[i+1]);			i++;		}		else if (!stricmp(arg, "-nhml")) {			CHECK_NEXT_ARG			track_dump_type = GF_EXPORT_NHML;			if (argv[i+1][0]=='+') {				track_dump_type |= GF_EXPORT_NHML_FULL;				trackID = atoi(argv[i+1] + 1);			} else {				trackID = atoi(argv[i+1]);			}			i++;		}		else if (!stricmp(arg, "-avi")) {			CHECK_NEXT_ARG			track_dump_type = GF_EXPORT_AVI;			trackID = atoi(argv[i+1]);			i++;		}		else if (!stricmp(arg, "-node")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 0); return (0); }		else if (!stricmp(arg, "-xnode")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 1); return (0); }		else if (!stricmp(arg, "-snode")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 2); return (0); }		else if (!stricmp(arg, "-nodes")) { PrintBuiltInNodes(0); return (0); }		else if (!stricmp(arg, "-xnodes")) { PrintBuiltInNodes(1); return (0); } 		else if (!stricmp(arg, "-snodes")) { PrintBuiltInNodes(2); return (0); } 		else if (!stricmp(arg, "-std")) dump_std = 1;		else if (!stricmp(arg, "-bt")) dump_mode = 1 + GF_SM_DUMP_BT;		else if (!stricmp(arg, "-xmt")) dump_mode = 1 + GF_SM_DUMP_XMTA;

⌨️ 快捷键说明

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