Exemple #1
0
int CCPreLoad::dumpXMLToFile(const char* fileName)
{
	ofstream of(fileName);
	if(!of.good())
	{
		CCLOG("open %s fail", fileName);
		return -1;
	}

	if( dumpXML(of) != 0)
		return -1;
	of.close();
	return 0;
}
Exemple #2
0
int main(int argc, char *argv[])
{

	FILE *infile = stdin;
	FILE *outfile = stdout;
	char	*arg_onTV ;
	//int		staCount ;
	int   inclose = 0;
	int   outclose = 0;
	SECcache   secs[SECCOUNT];
	char	*ontvheader ;

	if(argc == 4){
		arg_onTV = argv[1];
		if(strcmp(argv[2], "-")) {
			infile = fopen(argv[2], "r");
			if ( !infile) {
			  printf( "tsFile not found (Can't open file: %s)\n", argv[2] );
			  exit( -1 );
			}
			inclose = 1;
		}
		else {
			infile = stdin;
		}
		if(strcmp(argv[3], "-")) {
			outfile = fopen(argv[3], "w+");
			if ( !outfile) {
			  printf( "xmlFile not found (Can't open file: %s)\n", argv[3] );
			  exit( -1 );
			}
			outclose = 1;
		}
		else {
			outfile = stdout;
		}
	}else{
		fprintf(stdout, "Usage : %s {/BS|/CS|<id>} <tsFile> <outfile>\n", argv[0]);
		fprintf(stdout, "\n");
		fprintf(stdout, "id       チャンネル識別子。地上波の物理チャンネルを与えます。\n");
		fprintf(stdout, "/BS      BSモード。一つのTSからBS全局のデータを読み込みます。\n");
		fprintf(stdout, "/CS      CSモード。一つのTSから複数局のデータを読み込みます。\n");
		return 0;
	}

	//staCount = 0;
	svttop = calloc(1, sizeof(SVT_CONTROL));

	/* 興味のあるpidを指定 */
	memset(secs, 0,  sizeof(SECcache) * SECCOUNT);
	secs[0].pid = 0x10;
	secs[1].pid = 0x11;
	secs[2].pid = 0x12;
	secs[3].pid = 0x26;
	secs[4].pid = 0x27;
	GetEITSDTInfo(infile, secs, SECCOUNT);
	if(strcmp(arg_onTV, "/BS") == 0){
		ontvheader = "BS";
	}else if(strcmp(arg_onTV, "/CS") == 0){
		ontvheader = "CS";
	}else{
		ontvheader = arg_onTV;
	}
	dumpXML(outfile, ontvheader);

	if(inclose) {
		fclose(infile);
	}
	if(outclose) {
		fclose(outfile);
	}

	return 0;
}