void krad_ipc_from_json (krad_ipc_session_data_t *pss, char *value, int len) { float floatval; krad_link_rep_t krad_link; cJSON *cmd; cJSON *part; cJSON *part2; cJSON *part3; cJSON *item; char codecs[64]; char audio_bitrate[64]; int video_bitrate; video_bitrate = 0; part = NULL; part2 = NULL; cmd = cJSON_Parse (value); if (!cmd) { printke ("Error before: [%s]\n", cJSON_GetErrorPtr()); } else { part = cJSON_GetObjectItem (cmd, "com"); if ((part != NULL) && (strcmp(part->valuestring, "kradmixer") == 0)) { part = cJSON_GetObjectItem (cmd, "cmd"); if ((part != NULL) && (strcmp(part->valuestring, "update_portgroup") == 0)) { part = cJSON_GetObjectItem (cmd, "portgroup_name"); part2 = cJSON_GetObjectItem (cmd, "control_name"); part3 = cJSON_GetObjectItem (cmd, "value"); if ((part != NULL) && (part2 != NULL) && (part3 != NULL)) { if (strcmp(part2->valuestring, "xmms2") == 0) { krad_ipc_mixer_portgroup_xmms2_cmd (pss->krad_ipc_client, part->valuestring, part3->valuestring); } else { floatval = part3->valuedouble; krad_ipc_set_control (pss->krad_ipc_client, part->valuestring, part2->valuestring, floatval); } } } if ((part != NULL) && (strcmp(part->valuestring, "push_dtmf") == 0)) { part = cJSON_GetObjectItem (cmd, "dtmf"); if (part != NULL) { krad_ipc_mixer_push_tone (pss->krad_ipc_client, part->valuestring); } } } if ((part != NULL) && (strcmp(part->valuestring, "kradcompositor") == 0)) { part = cJSON_GetObjectItem (cmd, "cmd"); if ((part != NULL) && (strcmp(part->valuestring, "jsnap") == 0)) { krad_ipc_compositor_snapshot_jpeg (pss->krad_ipc_client); } if ((part != NULL) && (strcmp(part->valuestring, "snap") == 0)) { krad_ipc_compositor_snapshot (pss->krad_ipc_client); } } if ((part != NULL) && (strcmp(part->valuestring, "kradradio") == 0)) { part = cJSON_GetObjectItem (cmd, "cmd"); if ((part != NULL) && (strcmp(part->valuestring, "stag") == 0)) { part2 = cJSON_GetObjectItem (cmd, "tag_name"); part3 = cJSON_GetObjectItem (cmd, "tag_value"); if ((part != NULL) && (part2 != NULL) && (part3 != NULL)) { krad_ipc_set_tag (pss->krad_ipc_client, NULL, part2->valuestring, part3->valuestring); //printk("aye got %s %s", part2->valuestring, part3->valuestring); } } } if ((part != NULL) && (strcmp(part->valuestring, "kradlink") == 0)) { part = cJSON_GetObjectItem (cmd, "cmd"); if ((part != NULL) && (strcmp(part->valuestring, "update_link") == 0)) { part = cJSON_GetObjectItem (cmd, "link_num"); part2 = cJSON_GetObjectItem (cmd, "control_name"); part3 = cJSON_GetObjectItem (cmd, "value"); if ((part != NULL) && (part2 != NULL) && (part3 != NULL)) { if (strcmp(part2->valuestring, "opus_signal") == 0) { krad_ipc_update_link_adv (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_OPUS_SIGNAL, part3->valuestring); } if (strcmp(part2->valuestring, "opus_bandwidth") == 0) { krad_ipc_update_link_adv (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_OPUS_BANDWIDTH, part3->valuestring); } if (strcmp(part2->valuestring, "opus_bitrate") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_OPUS_BITRATE, part3->valueint); } if (strcmp(part2->valuestring, "opus_complexity") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_OPUS_COMPLEXITY, part3->valueint); } if (strcmp(part2->valuestring, "opus_frame_size") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_OPUS_FRAME_SIZE, part3->valueint); } if (strcmp(part2->valuestring, "theora_quality") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_THEORA_QUALITY, part3->valueint); } if (strcmp(part2->valuestring, "vp8_bitrate") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_VP8_BITRATE, part3->valueint); } if (strcmp(part2->valuestring, "vp8_min_quantizer") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_VP8_MIN_QUANTIZER, part3->valueint); } if (strcmp(part2->valuestring, "vp8_max_quantizer") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_VP8_MAX_QUANTIZER, part3->valueint); } if (strcmp(part2->valuestring, "vp8_deadline") == 0) { krad_ipc_update_link_adv_num (pss->krad_ipc_client, part->valueint, EBML_ID_KRAD_LINK_LINK_VP8_DEADLINE, part3->valueint); } } } else { if ((part != NULL) && (strcmp(part->valuestring, "remove_link") == 0)) { part = cJSON_GetObjectItem (cmd, "link_num"); krad_ipc_destroy_link (pss->krad_ipc_client, part->valueint); } else { if ((part != NULL) && (strcmp(part->valuestring, "add_link") == 0)) { memset (&krad_link, 0, sizeof(krad_link_rep_t)); memset (codecs, 0, sizeof(codecs)); memset (audio_bitrate, 0, sizeof(audio_bitrate)); item = cJSON_GetObjectItem (cmd, "operation_mode"); if (item != NULL) { krad_link.operation_mode = krad_link_string_to_operation_mode (item->valuestring); if ((krad_link.operation_mode != TRANSMIT) && (krad_link.operation_mode != RECORD) && (krad_link.operation_mode != CAPTURE)) { cJSON_Delete (cmd); return; } item = cJSON_GetObjectItem (cmd, "av_mode"); if (item != NULL) { krad_link.av_mode = krad_link_string_to_av_mode (item->valuestring); } else { cJSON_Delete (cmd); return; } if (krad_link.operation_mode == CAPTURE) { item = cJSON_GetObjectItem (cmd, "video_source"); if (item != NULL) { krad_link.video_source = krad_link_string_to_video_source (item->valuestring); } item = cJSON_GetObjectItem (cmd, "video_device"); if (item != NULL) { strncpy (krad_link.video_device, item->valuestring, sizeof(krad_link.video_device)); } if ((krad_link.video_source == NOVIDEO) || (strlen(krad_link.video_device) == 0)) { cJSON_Delete (cmd); return; } } if (krad_link.operation_mode == RECORD) { item = cJSON_GetObjectItem (cmd, "filename"); if (item != NULL) { strncpy (krad_link.filename, item->valuestring, sizeof(krad_link.filename)); } if (strlen(krad_link.filename) == 0) { cJSON_Delete (cmd); return; } } if (krad_link.operation_mode == TRANSMIT) { item = cJSON_GetObjectItem (cmd, "host"); if (item != NULL) { strncpy (krad_link.host, item->valuestring, sizeof(krad_link.host)); } item = cJSON_GetObjectItem (cmd, "mount"); if (item != NULL) { strncpy (krad_link.mount, item->valuestring, sizeof(krad_link.mount)); } item = cJSON_GetObjectItem (cmd, "password"); if (item != NULL) { strncpy (krad_link.password, item->valuestring, sizeof(krad_link.password)); } item = cJSON_GetObjectItem (cmd, "port"); if (item != NULL) { krad_link.port = item->valueint; } if (!((strlen(krad_link.host)) && (strlen(krad_link.mount)) && (strlen(krad_link.password)) && (krad_link.port))) { cJSON_Delete (cmd); return; } } if ((krad_link.operation_mode == TRANSMIT) || (krad_link.operation_mode == RECORD)) { if ((krad_link.av_mode == AUDIO_ONLY) || (krad_link.av_mode == AUDIO_AND_VIDEO)) { item = cJSON_GetObjectItem (cmd, "audio_codec"); if (item != NULL) { strcat (codecs, item->valuestring); krad_link.audio_codec = krad_string_to_codec (item->valuestring); } item = cJSON_GetObjectItem (cmd, "audio_bitrate"); if (item != NULL) { if (krad_link.audio_codec == VORBIS) { krad_link.vorbis_quality = item->valuedouble; sprintf(audio_bitrate, "%f", krad_link.vorbis_quality); } if (krad_link.audio_codec == OPUS) { krad_link.opus_bitrate = item->valueint; sprintf(audio_bitrate, "%d", krad_link.opus_bitrate); } if (krad_link.audio_codec == FLAC) { krad_link.flac_bit_depth = item->valueint; sprintf(audio_bitrate, "%d", krad_link.flac_bit_depth); } } } if ((krad_link.av_mode == VIDEO_ONLY) || (krad_link.av_mode == AUDIO_AND_VIDEO)) { item = cJSON_GetObjectItem (cmd, "video_codec"); if (item != NULL) { strcat (codecs, item->valuestring); krad_link.video_codec = krad_string_to_codec (item->valuestring); } item = cJSON_GetObjectItem (cmd, "video_bitrate"); if (item != NULL) { if (krad_link.video_codec == THEORA) { krad_link.theora_quality = item->valueint; video_bitrate = krad_link.theora_quality; } if (krad_link.video_codec == VP8) { krad_link.vp8_bitrate = item->valueint; video_bitrate = krad_link.vp8_bitrate; } } } } if ((krad_link.av_mode == VIDEO_ONLY) || (krad_link.av_mode == AUDIO_AND_VIDEO)) { item = cJSON_GetObjectItem (cmd, "video_width"); if (item != NULL) { krad_link.width = item->valueint; } item = cJSON_GetObjectItem (cmd, "video_height"); if (item != NULL) { krad_link.height = item->valueint; } item = cJSON_GetObjectItem (cmd, "fps_numerator"); if (item != NULL) { krad_link.fps_numerator = item->valueint; } item = cJSON_GetObjectItem (cmd, "fps_denominator"); if (item != NULL) { krad_link.fps_denominator = item->valueint; } item = cJSON_GetObjectItem (cmd, "color_depth"); if (item != NULL) { krad_link.color_depth = item->valueint; } else { krad_link.color_depth = 420; } } char *string = malloc(2048); krad_link_rep_to_string (&krad_link, string); printk("%s", string); free(string); if (krad_link.operation_mode == TRANSMIT) { krad_ipc_create_transmit_link (pss->krad_ipc_client, krad_link.av_mode, krad_link.host, krad_link.port, krad_link.mount, krad_link.password, codecs, krad_link.width, krad_link.height, video_bitrate, audio_bitrate); } if (krad_link.operation_mode == RECORD) { krad_ipc_create_record_link (pss->krad_ipc_client, krad_link.av_mode, krad_link.filename, codecs, krad_link.width, krad_link.height, video_bitrate, audio_bitrate); } if (krad_link.operation_mode == CAPTURE) { krad_ipc_create_capture_link (pss->krad_ipc_client, krad_link.video_source, krad_link.video_device, krad_link.width, krad_link.height, krad_link.fps_numerator, krad_link.fps_denominator, krad_link.av_mode, "", ""); } } } } } } cJSON_Delete (cmd); } }
void krad_transponder_ebml_to_link ( krad_ipc_server_t *krad_ipc_server, krad_link_t *krad_link ) { uint32_t ebml_id; uint64_t ebml_data_size; char string[512]; memset (string, '\0', 512); //FIXME default krad_link->av_mode = AUDIO_AND_VIDEO; krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_TRANSPONDER_LINK) { printk ("hrm wtf"); } else { //printk ("tag size %zu", ebml_data_size); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_OPERATION_MODE) { printk ("hrm wtf"); } else { //printk ("tag size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->operation_mode = krad_link_string_to_operation_mode (string); if (krad_link->operation_mode == RECEIVE) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_TRANSPORT_MODE) { printk ("hrm wtf2"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->transport_mode = krad_link_string_to_transport_mode (string); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_PORT) { printk ("hrm wtf3"); } else { //printk ("tag value size %zu", ebml_data_size); } krad_link->port = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); //TEMP KLUDGE krad_link->av_mode = AUDIO_ONLY; } if (krad_link->operation_mode == PLAYBACK) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_TRANSPORT_MODE) { printk ("hrm wtf2"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->transport_mode = krad_link_string_to_transport_mode (string); if (krad_link->transport_mode == FILESYSTEM) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_FILENAME) { printk ("hrm wtf3"); } else { //printk ("tag value size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->input, ebml_data_size); } if (krad_link->transport_mode == TCP) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_HOST) { printk ("hrm wtf2"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->host, ebml_data_size); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_PORT) { printk ("hrm wtf3"); } else { //printk ("tag value size %zu", ebml_data_size); } krad_link->port = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_MOUNT) { printk ("hrm wtf2"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->mount, ebml_data_size); } } if (krad_link->operation_mode == CAPTURE) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VIDEO_SOURCE) { printk ("hrm wtf"); } else { //printk ("tag size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->video_source = krad_link_string_to_video_source (string); if (krad_link->video_source == DECKLINK) { krad_link->av_mode = AUDIO_AND_VIDEO; } if ((krad_link->video_source == V4L2) || (krad_link->video_source == X11)) { krad_link->av_mode = VIDEO_ONLY; } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_CAPTURE_DEVICE) { printk ("hrm wtf"); } else { //printk ("tag size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->device, ebml_data_size); if (krad_link->video_source == V4L2) { if (strlen(krad_link->device) == 0) { strncpy(krad_link->device, DEFAULT_V4L2_DEVICE, sizeof(krad_link->device)); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_CAPTURE_CODEC) { printk ("hrm wtf"); } else { //printk ("tag size %zu", ebml_data_size); } string[0] = '\0'; krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->video_passthru = 0; if (strlen(string)) { krad_link->video_codec = krad_string_to_codec (string); if (krad_link->video_codec == H264) { krad_link->video_passthru = 1; } if (strstr(string, "pass") != NULL) { krad_link->video_passthru = 1; } } } if (krad_link->video_source == DECKLINK) { if (strlen(krad_link->device) == 0) { strncpy(krad_link->device, DEFAULT_DECKLINK_DEVICE, sizeof(krad_link->device)); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_CAPTURE_DECKLINK_AUDIO_INPUT) { printk ("hrm wtf"); } else { //printk ("tag size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->audio_input, ebml_data_size); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VIDEO_WIDTH) { printk ("hrm wtf2v"); } else { krad_link->capture_width = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VIDEO_HEIGHT) { printk ("hrm wtf2v"); } else { krad_link->capture_height = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_FPS_NUMERATOR) { printk ("hrm wtf2v"); } else { krad_link->fps_numerator = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_FPS_DENOMINATOR) { printk ("hrm wtf2v"); } else { krad_link->fps_denominator = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } } if ((krad_link->operation_mode == TRANSMIT) || (krad_link->operation_mode == RECORD)) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_AV_MODE) { printk ("hrm wtf0"); } else { //printk ("tag size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->av_mode = krad_link_string_to_av_mode (string); if ((krad_link->av_mode == VIDEO_ONLY) || (krad_link->av_mode == AUDIO_AND_VIDEO)) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VIDEO_CODEC) { printk ("hrm wtf2v1"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->video_codec = krad_string_to_codec (string); if ((krad_link->video_codec == H264) || (krad_link->video_codec == MJPEG)) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_USE_PASSTHRU_CODEC) { printk ("hrm wtf2v2"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_link->video_passthru = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); if (krad_link->video_codec == MJPEG) { //FIXME should be optional krad_link->video_passthru = 1; } } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VIDEO_WIDTH) { printk ("hrm wtf2v3"); } else { krad_link->encoding_width = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VIDEO_HEIGHT) { printk ("hrm wtf2v4"); } else { krad_link->encoding_height = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } if ((krad_link->video_codec == VP8) || (krad_link->video_codec == H264)) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_VP8_BITRATE) { printk ("hrm wtf2v5"); } else { krad_link->vp8_bitrate = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } } if (krad_link->video_codec == THEORA) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_THEORA_QUALITY) { printk ("hrm wtf2v6"); } else { krad_link->theora_quality = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } } } if ((krad_link->av_mode == AUDIO_ONLY) || (krad_link->av_mode == AUDIO_AND_VIDEO)) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_AUDIO_CODEC) { printk ("hrm wtf2a7"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->audio_codec = krad_string_to_codec (string); if (krad_link->audio_codec == VORBIS) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id == EBML_ID_KRAD_LINK_LINK_VORBIS_QUALITY) { krad_link->vorbis_quality = krad_ebml_read_float (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } } if (krad_link->audio_codec == OPUS) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id == EBML_ID_KRAD_LINK_LINK_OPUS_BITRATE) { krad_link->opus_bitrate = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } } if (krad_link->audio_codec == FLAC) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id == EBML_ID_KRAD_LINK_LINK_FLAC_BIT_DEPTH) { krad_link->flac_bit_depth = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); } } } } if (krad_link->operation_mode == TRANSMIT) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_TRANSPORT_MODE) { printk ("hrm wtf28"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, string, ebml_data_size); krad_link->transport_mode = krad_link_string_to_transport_mode (string); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_HOST) { printk ("hrm wtf29"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->host, ebml_data_size); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_PORT) { printk ("hrm wtf310"); } else { //printk ("tag value size %zu", ebml_data_size); } krad_link->port = krad_ebml_read_number (krad_ipc_server->current_client->krad_ebml, ebml_data_size); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_MOUNT) { printk ("hrm wtf212"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->mount, ebml_data_size); krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_PASSWORD) { printk ("hrm wtf213"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->password, ebml_data_size); if (strstr(krad_link->mount, "flac") != NULL) { krad_link->audio_codec = FLAC; } if (strstr(krad_link->mount, ".opus") != NULL) { krad_link->audio_codec = OPUS; } } if (krad_link->operation_mode == RECORD) { krad_ebml_read_element (krad_ipc_server->current_client->krad_ebml, &ebml_id, &ebml_data_size); if (ebml_id != EBML_ID_KRAD_LINK_LINK_FILENAME) { printk ("hrm wtf214"); } else { //printk ("tag name size %zu", ebml_data_size); } krad_ebml_read_string (krad_ipc_server->current_client->krad_ebml, krad_link->output, ebml_data_size); if (strstr(krad_link->output, "flac") != NULL) { krad_link->audio_codec = FLAC; } if (strstr(krad_link->output, ".opus") != NULL) { krad_link->audio_codec = OPUS; } krad_link->transport_mode = FILESYSTEM; } }