示例#1
0
void krad_ipc_server_mixer_broadcast ( krad_ipc_server_t *krad_ipc_server, uint32_t ebml_id, uint32_t ebml_subid, char *portname, char *controlname, float floatval) {

	int c;

	uint64_t element;
	uint64_t subelement;

	element = 0;
	subelement = 0;

	for (c = 0; c < KRAD_IPC_SERVER_MAX_CLIENTS; c++) {
		if ((krad_ipc_server->clients[c].broadcasts == 1) && (krad_ipc_server->current_client != &krad_ipc_server->clients[c])) {
			if (krad_ipc_aquire_client (&krad_ipc_server->clients[c])) {
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, ebml_id, &element);	
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, ebml_subid, &subelement);	
				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_NAME, portname);
				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_CONTROL_NAME, controlname);
				krad_ebml_write_float (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_CONTROL_VALUE, floatval);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, subelement);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, element);
				krad_ebml_write_sync (krad_ipc_server->clients[c].krad_ebml2);
				krad_ipc_release_client (&krad_ipc_server->clients[c]);
			}
		}
	}
}
示例#2
0
void krad_ipc_server_broadcast_tag ( krad_ipc_server_t *krad_ipc_server, char *item, char *name, char *value, int internal) {

	int c;

	uint64_t element;
	uint64_t subelement;

	element = 0;
	subelement = 0;

	for (c = 0; c < KRAD_IPC_SERVER_MAX_CLIENTS; c++) {
		if ((krad_ipc_server->clients[c].broadcasts == 1) &&
		    ((internal) || (krad_ipc_server->current_client != &krad_ipc_server->clients[c]))) {
			if (krad_ipc_aquire_client (&krad_ipc_server->clients[c])) {
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_RADIO_MSG, &element);	
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_RADIO_TAG, &subelement);	
				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_RADIO_TAG_ITEM, item);
				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_RADIO_TAG_NAME, name);
				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_RADIO_TAG_VALUE, value);
				//krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_RADIO_TAG_SOURCE, "");
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, subelement);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, element);
				krad_ebml_write_sync (krad_ipc_server->clients[c].krad_ebml2);
				krad_ipc_release_client (&krad_ipc_server->clients[c]);
			}
		}
	}
}
示例#3
0
void krad_ipc_server_advanced_string_broadcast ( krad_ipc_server_t *krad_ipc_server, uint32_t ebml_id, uint32_t ebml_subid, uint32_t ebml_subid2, int num, uint32_t ebml_subid3, char *string) {

	int c;

	uint64_t element;
	uint64_t subelement;

	element = 0;
	subelement = 0;

	for (c = 0; c < KRAD_IPC_SERVER_MAX_CLIENTS; c++) {
		if ((krad_ipc_server->clients[c].broadcasts == 1) && (krad_ipc_server->current_client != &krad_ipc_server->clients[c])) {
			if (krad_ipc_aquire_client (&krad_ipc_server->clients[c])) {
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, ebml_id, &element);	
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, ebml_subid, &subelement);	
				krad_ebml_write_int32 (krad_ipc_server->clients[c].krad_ebml2, ebml_subid2, num);

				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, ebml_subid3, string);
			
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, subelement);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, element);
				krad_ebml_write_sync (krad_ipc_server->clients[c].krad_ebml2);
				krad_ipc_release_client (&krad_ipc_server->clients[c]);
			}
		}
	}
}
示例#4
0
void krad_ipc_server_response_add_tag ( krad_ipc_server_t *krad_ipc_server, char *tag_item, char *tag_name, char *tag_value) {

	uint64_t tag;

	krad_ebml_start_element (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_RADIO_TAG, &tag);	
	krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_RADIO_TAG_ITEM, tag_item);
	krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_RADIO_TAG_NAME, tag_name);
	krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_RADIO_TAG_VALUE, tag_value);	
	//krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_RADIO_TAG_SOURCE, "");
	krad_ebml_finish_element (krad_ipc_server->current_client->krad_ebml2, tag);

}
示例#5
0
void krad_ipc_server_broadcast_portgroup_created ( krad_ipc_server_t *krad_ipc_server, char *name, int channels,
											  	   int io_type, float volume, char *mixbus, int xmms2 ) {

	int c;
	uint64_t portgroup;
	uint64_t element;
	uint64_t subelement;

	for (c = 0; c < KRAD_IPC_SERVER_MAX_CLIENTS; c++) {
		if ((krad_ipc_server->clients[c].broadcasts == 1) && (krad_ipc_server->current_client != &krad_ipc_server->clients[c])) {
		//if (krad_ipc_server->clients[c].broadcasts == 1) {
			if (krad_ipc_aquire_client (&krad_ipc_server->clients[c])) {
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_MSG, &element);	
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CREATED, &subelement);

				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP, &portgroup);	

				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_NAME, name);
				krad_ebml_write_int8 (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CHANNELS, channels);
				if (io_type == 0) {
					krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_TYPE, "Jack");
				} else {
					krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_TYPE, "Internal");
				}
				krad_ebml_write_float (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_VOLUME, volume);	
				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_MIXBUS, mixbus);			

				krad_ebml_write_string (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CROSSFADE_NAME, "");
				krad_ebml_write_float (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CROSSFADE, 0.0);	
				krad_ebml_write_int8 (krad_ipc_server->clients[c].krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_XMMS2, xmms2);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, portgroup);
			
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, subelement);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, element);
				krad_ebml_write_sync (krad_ipc_server->clients[c].krad_ebml2);		
				krad_ipc_release_client (&krad_ipc_server->clients[c]);
			}
		}
	}
}
示例#6
0
void krad_ipc_server_simplest_broadcast ( krad_ipc_server_t *krad_ipc_server, uint32_t ebml_id, uint32_t ebml_subid, uint32_t val) {

	int c;

	uint64_t element;
	element = 0;

	for (c = 0; c < KRAD_IPC_SERVER_MAX_CLIENTS; c++) {
		if (krad_ipc_server->clients[c].broadcasts == 1) {
			if (krad_ipc_aquire_client (&krad_ipc_server->clients[c])) {		
				krad_ebml_start_element (krad_ipc_server->clients[c].krad_ebml2, ebml_id, &element);	
				krad_ebml_write_int32 (krad_ipc_server->clients[c].krad_ebml2, ebml_subid, val);
				krad_ebml_finish_element (krad_ipc_server->clients[c].krad_ebml2, element);
				krad_ebml_write_sync (krad_ipc_server->clients[c].krad_ebml2);
				krad_ipc_release_client (&krad_ipc_server->clients[c]);
			}
		}
	}
}
示例#7
0
void krad_ipc_server_response_add_portgroup ( krad_ipc_server_t *krad_ipc_server, char *name, int channels,
											  int io_type, float volume, char *mixbus, char *crossfade_name, float crossfade_value, int xmms2) {

	uint64_t portgroup;

	krad_ebml_start_element (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP, &portgroup);	

	krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_NAME, name);
	krad_ebml_write_int8 (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CHANNELS, channels);
	if (io_type == 0) {
		krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_TYPE, "Jack");
	} else {
		krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_TYPE, "Internal");
	}
	krad_ebml_write_float (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_VOLUME, volume);	
	krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_MIXBUS, mixbus);			

	krad_ebml_write_string (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CROSSFADE_NAME, crossfade_name);
	krad_ebml_write_float (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_CROSSFADE, crossfade_value);	
	krad_ebml_write_int8 (krad_ipc_server->current_client->krad_ebml2, EBML_ID_KRAD_MIXER_PORTGROUP_XMMS2, xmms2);
	krad_ebml_finish_element (krad_ipc_server->current_client->krad_ebml2, portgroup);

}
示例#8
0
void krad_ipc_server_response_list_finish ( krad_ipc_server_t *krad_ipc_server, uint64_t list) {

	krad_ebml_finish_element (krad_ipc_server->current_client->krad_ebml2, list);


}
void krad_transponder_link_to_ebml ( krad_ipc_server_client_t *client, krad_link_t *krad_link) {

	uint64_t link;

	krad_ebml_start_element (client->krad_ebml2, EBML_ID_KRAD_TRANSPONDER_LINK, &link);	

	krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_TRANSPONDER_LINK_NUMBER, krad_link->link_num);

	switch ( krad_link->av_mode ) {

		case AUDIO_ONLY:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AV_MODE, "audio only");
			break;
		case VIDEO_ONLY:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AV_MODE, "video only");
			break;
		case AUDIO_AND_VIDEO:		
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AV_MODE, "audio and video");
			break;
	}

	switch ( krad_link->operation_mode ) {

		case TRANSMIT:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPERATION_MODE, "transmit");
			break;
		case RECORD:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPERATION_MODE, "record");
			break;
		case PLAYBACK:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPERATION_MODE, "playback");
			break;
		case RECEIVE:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPERATION_MODE, "receive");
			break;
		case CAPTURE:
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPERATION_MODE, "capture");
			break;
		default:		
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPERATION_MODE, "Other/Unknown");
			break;
	}
	
	if (krad_link->operation_mode == RECEIVE) {

		krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_TRANSPORT_MODE, 
								krad_link_transport_mode_to_string (krad_link->transport_mode));

		if ((krad_link->transport_mode == UDP) || (krad_link->transport_mode == TCP)) {
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_PORT, krad_link->port);
		}
	}	
	
	if (krad_link->operation_mode == CAPTURE) {
		krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VIDEO_SOURCE, krad_link_video_source_to_string (krad_link->video_source));
	}
	
	if (krad_link->operation_mode == PLAYBACK) {
	
		krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_TRANSPORT_MODE, 
								krad_link_transport_mode_to_string (krad_link->transport_mode));
	
		if (krad_link->transport_mode == FILESYSTEM) {
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_FILENAME, krad_link->input);
		}

		if (krad_link->transport_mode == TCP) {
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_HOST, krad_link->host);
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_PORT, krad_link->port);
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_MOUNT, krad_link->mount);
		}
	}
	
	if ((krad_link->operation_mode == TRANSMIT) || (krad_link->operation_mode == RECORD)) {
		switch ( krad_link->av_mode ) {
			case AUDIO_ONLY:
				krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AUDIO_CODEC, krad_codec_to_string (krad_link->audio_codec));
				break;
			case VIDEO_ONLY:
				krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VIDEO_CODEC, krad_codec_to_string (krad_link->video_codec));
				break;
			case AUDIO_AND_VIDEO:		
				krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VIDEO_CODEC, krad_codec_to_string (krad_link->video_codec));				
				krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AUDIO_CODEC, krad_codec_to_string (krad_link->audio_codec));
				break;
		}

		if (krad_link->operation_mode == TRANSMIT) {
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_TRANSPORT_MODE, 
									krad_link_transport_mode_to_string (krad_link->transport_mode));
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_HOST, krad_link->host);
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_PORT, krad_link->port);
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_MOUNT, krad_link->mount);
		}
		
		if (krad_link->operation_mode == RECORD) {
			krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_FILENAME, krad_link->output);
		}

		if ((krad_link->av_mode == AUDIO_ONLY) || (krad_link->av_mode == AUDIO_AND_VIDEO)) {
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AUDIO_CHANNELS, 2);
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_AUDIO_SAMPLE_RATE, 48000);
		}

		if ((krad_link->av_mode == VIDEO_ONLY) || (krad_link->av_mode == AUDIO_AND_VIDEO)) {
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VIDEO_WIDTH, krad_link->encoding_width);
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VIDEO_HEIGHT, krad_link->encoding_height);						
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_FPS_NUMERATOR, krad_link->encoding_fps_numerator);
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_FPS_DENOMINATOR, krad_link->encoding_fps_denominator);
			krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VIDEO_COLOR_DEPTH, 420);							
		}		

		if ((krad_link->av_mode == AUDIO_ONLY) || (krad_link->av_mode == AUDIO_AND_VIDEO)) {
		
			if (krad_link->audio_codec == VORBIS) {
				krad_ebml_write_float (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VORBIS_QUALITY, krad_link->krad_vorbis->quality);
			}

			if (krad_link->audio_codec == FLAC) {
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_FLAC_BIT_DEPTH, krad_link->krad_flac->bit_depth);
			}

			if (krad_link->audio_codec == OPUS) {
				krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPUS_SIGNAL, 
										krad_opus_signal_to_string (krad_opus_get_signal (krad_link->krad_opus)));
				krad_ebml_write_string (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPUS_BANDWIDTH, 
										krad_opus_bandwidth_to_string (krad_opus_get_bandwidth (krad_link->krad_opus)));
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPUS_BITRATE, krad_opus_get_bitrate (krad_link->krad_opus));
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPUS_COMPLEXITY, krad_opus_get_complexity (krad_link->krad_opus));
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_OPUS_FRAME_SIZE, krad_opus_get_frame_size (krad_link->krad_opus));

				//EBML_ID_KRAD_LINK_LINK_OGG_MAX_PACKETS_PER_PAGE, atoi(argv[5]));
			}
		
		}

		if ((krad_link->av_mode == VIDEO_ONLY) || (krad_link->av_mode == AUDIO_AND_VIDEO)) {
			if (krad_link->video_codec == THEORA) {
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_THEORA_QUALITY, krad_theora_encoder_quality_get (krad_link->krad_theora_encoder));
			}

			if (krad_link->video_codec == VP8) {
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VP8_BITRATE, krad_vpx_encoder_bitrate_get (krad_link->krad_vpx_encoder));
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VP8_MIN_QUANTIZER, krad_vpx_encoder_min_quantizer_get (krad_link->krad_vpx_encoder));
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VP8_MAX_QUANTIZER, krad_vpx_encoder_max_quantizer_get (krad_link->krad_vpx_encoder));
				krad_ebml_write_int32 (client->krad_ebml2, EBML_ID_KRAD_LINK_LINK_VP8_DEADLINE, krad_vpx_encoder_deadline_get (krad_link->krad_vpx_encoder));
			}
		}
	}
	
	krad_ebml_finish_element (client->krad_ebml2, link);

}