int edcast_init(edcastGlobals *g)
{
    int printConfig = 0;
   
    
    setServerStatusCallback(g, outputStatusCallback);
    setGeneralStatusCallback(g, NULL);
    setWriteBytesCallback(g, writeBytesCallback);
    setBitrateCallback(g, outputBitrateCallback);
    setServerNameCallback(g, outputServerNameCallback);
    setDestURLCallback(g, outputStreamURLCallback);
    readConfigFile(g);
    return 1;
}
Beispiel #2
0
int edcast_init(edcastGlobals *g)
{

	setServerStatusCallback(g, outputStatusCallback);
	setGeneralStatusCallback(g, NULL);
	setWriteBytesCallback(g, writeBytesCallback);
	setBitrateCallback(g, outputBitrateCallback);
	setServerNameCallback(g, outputServerNameCallback);
	setDestURLCallback(g, outputStreamURLCallback);

	readConfigFile(g);
	setFrontEndType(g, FRONT_END_EDCAST_PLUGIN);
	return 1;
}
int transcode_init()
{
	char	*serverURL = NULL;
	char	*defaultConfigFile = "transcoder.cfg";
	int 	c = 0;
	int	printConfig = 0;
	
	memset(&globals, '\000', sizeof(globals));

	// Setup Callbacks for all the interaction
	globals.mainStatusCallback = NULL;
	globals.inputStatusCallback = NULL;
	globals.inputStreamURLCallback = NULL;
	globals.readBytesCallback = NULL;
	globals.inputServerTypeCallback = NULL;
	globals.inputStreamTypeCallback = NULL;
	globals.inputStreamURLCallback = NULL;
	globals.inputStreamNameCallback = NULL;
	globals.inputMetadataCallback = NULL;
	globals.inputBitrateCallback = NULL;
	globals.outputStatusCallback = outputStatusCallback;
	globals.writeBytesCallback = writeBytesCallback;
	globals.outputServerTypeCallback = outputServerTypeCallback;
	globals.outputStreamTypeCallback = outputStreamTypeCallback;
	globals.outputBitrateCallback = outputBitrateCallback;
	globals.outputStreamURLCallback = outputStreamURLCallback;

	setServerStatusCallback(globals.outputStatusCallback);
	setGeneralStatusCallback(globals.mainStatusCallback);
	setWriteBytesCallback(globals.writeBytesCallback);
	setBitrateCallback(globals.outputBitrateCallback);
	setStreamTypeCallback(globals.outputStreamTypeCallback);
	setServerTypeCallback(globals.outputServerTypeCallback);
	setSourceURLCallback(globals.inputStreamURLCallback);
	setDestURLCallback(globals.outputStreamURLCallback);
	setVUCallback(VUCallback);

	if (gConfigFile == NULL) {
		gConfigFile = defaultConfigFile;
	}
	setConfigFileName(gConfigFile);
	readConfigFile();

	return 1;
}
Beispiel #4
0
int edcast_init(edcastGlobals *g)
{
	int	printConfig = 0;
	


	setServerStatusCallback(g, outputStatusCallback);
	setGeneralStatusCallback(g, NULL);
	setWriteBytesCallback(g, writeBytesCallback);
	setBitrateCallback(g, outputBitrateCallback);
	setServerNameCallback(g, outputServerNameCallback);
	setDestURLCallback(g, outputStreamURLCallback);
    //strcpy(g->gConfigFileName, ".\\edcast_multi");

	readConfigFile(g);
	
	setFrontEndType(g, FRONT_END_EDCAST_PLUGIN);
	
	return 1;
}
Beispiel #5
0
int
main (int argc, char *argv[])

{
	jack_client_t *client;
	jack_thread_info_t thread_info;
	int c;
	char	jackClientName[1024] = "";
	int ret = 0;
	struct stat buf;
	int i;

	int longopt_index = 0;
	extern int optind, opterr;
	int show_usage = 0;
	char *optstring = "p:n:c:d:f:b:B:h";
	struct option long_options[] = {
		{ "portmatch", 1, 0, 'p' },
		{ "name", 1, 0, 'n' },
		{ "config", 1, 0, 'c' },
		{ "help", 0, 0, 'h' },
		{ "duration", 1, 0, 'd' },
		{ "file", 1, 0, 'f' },
		{ "bitdepth", 1, 0, 'b' },
		{ "bufsize", 1, 0, 'B' },
		{ 0, 0, 0, 0 }
	};

	signal(SIGINT, sigHandler);

	memset (&thread_info, 0, sizeof (thread_info));
	thread_info.rb_size = DEFAULT_RB_SIZE;
	opterr = 0;


	memset(&g, '\000', sizeof(g));
	
	setServerStatusCallback(&g, serverStatusCallback);
	setGeneralStatusCallback(&g, generalStatusCallback);
	setWriteBytesCallback(&g, writeBytesCallback);

	addBasicEncoderSettings(&g);
	strcpy(jackClientName, "edcast");
	while ((c = getopt_long (argc, argv, optstring, long_options, &longopt_index)) != -1) {
		switch (c) {
		case 1:
			/* getopt signals end of '-' options */
			break;
		case 'p':
			strcpy(portMatch, optarg);
			getFirstTwo = 1;
			break;
		case 'n':
			strcpy(jackClientName, optarg);
			break;
		case 'c':
			i = stat (optarg, &buf );
			if ( i != 0 ) {
				printf("Cannot open config file (%s)\n", optarg);
				exit(1);
			}
			setConfigFileName(&g, optarg);
			readConfigFile(&g, 1);
			break;
		case 'h':
			show_usage++;
			break;
		case 'd':
			thread_info.duration = atoi (optarg);
			break;
		case 'f':
			thread_info.path = optarg;
			break;
		case 'b':
			thread_info.bitdepth = atoi (optarg);
			break;
		case 'B':
			thread_info.rb_size = atoi (optarg);
			break;
		default:
			fprintf (stderr, "error\n");
			show_usage++;
			break;
		}
	}

	if (show_usage || ((optind == argc) && (!getFirstTwo))) {
		fprintf (stderr, "usage: edcast -c configfile [ -n jack_client_name ] [ -p portmatch ] [ jackport1 [ jackport2 ... ]]\n");
		fprintf(stderr, "Where:\n");
		fprintf(stderr, "-c : config file that specified encoding settings\n");
		fprintf(stderr, "-n : name used to register with jackd\n");
		fprintf(stderr, "-p : if specified, edcast will connect to the first two output ports matching this name.\n");
		fprintf(stderr, "jackportX : explicitly specify a jack port name\n");
		exit (1);
	}



	if ((client = jack_client_new (jackClientName)) == 0) {
		fprintf (stderr, "jack server not running?\n");
		exit (1);
	}

	thread_info.client = client;
	if (getFirstTwo) {
		thread_info.channels = 2;
	}
	else {
		thread_info.channels = argc - optind;
	}
	thread_info.can_process = 0;

	setLogFlags();

	setup_edcast_thread (&thread_info);

	jack_set_process_callback (client, process, &thread_info);
	jack_on_shutdown (client, jack_shutdown, &thread_info);

	if (jack_activate (client)) {
		fprintf (stderr, "cannot activate client");
	}

	setup_ports (thread_info.channels, &argv[optind], &thread_info);

	run_edcast_thread (&thread_info);

	jack_client_close (client);

	jack_ringbuffer_free (rb[0]);
	jack_ringbuffer_free (rb[1]);

	exit (0);
}