LVAVSPresetContainer *lvavs_preset_container_from_xml_node(LVAVSPresetContainer *cont, xmlNodePtr node) { xmlNodePtr child; LVAVSPresetElement *element; int i; for(child = node->children; child; child = child->next) { if (xmlIsBlankNode (child) || child->type != XML_ELEMENT_NODE) continue; if(xmlStrcmp(child->name, (xmlChar *)"container_child") == 0) { LVAVSPresetContainer *cont2 = lvavs_preset_container_new(); VisParamContainer *pcont = visual_param_container_new(); LVAVS_PRESET_ELEMENT(cont2)->pcont = pcont; visual_param_container_add_many(pcont, container_params); visual_list_add(cont->members, cont2); lvavs_preset_container_from_xml_node(cont2, child); } for(i = 0; id_to_name_map[i] != NULL; i++) if (xmlStrcmp (child->name, (const xmlChar *) id_to_name_map[i]) == 0) break; if(id_to_name_map[i] == NULL) continue; element = lvavs_preset_element_new(LVAVS_PRESET_ELEMENT_TYPE_PLUGIN, (char*)child->name); if(parse_element(child, element)) visual_list_add(cont->members, element); } return cont; }
/** * Adds a change notification callback, this shouldn't be used to get notificated within a plugin, but is for * things like VisUI. * * @param param Pointer to the VisParamEntry to which a change notification callback is added. * @param callback The notification callback, which is called on changes in the VisParamEntry. * @param priv A private that can be used in the callback function. * * return callback id in the form of a positive value on succes, * -VISUAL_ERROR_PARAM_NULL, -VISUAL_ERROR_PARAM_CALLBACK_NULL or * -VISUAL_ERROR_PARAM_CALLBACK_TOO_MANY on failure. */ int visual_param_entry_add_callback (VisParamEntry *param, VisParamChangedCallbackFunc callback, void *priv) { VisParamEntryCallback *pcall; int id; visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); visual_log_return_val_if_fail (callback != NULL, -VISUAL_ERROR_PARAM_CALLBACK_NULL); id = get_next_pcall_id (¶m->callbacks); visual_log_return_val_if_fail (id >= 0, -VISUAL_ERROR_PARAM_CALLBACK_TOO_MANY); pcall = visual_mem_new0 (VisParamEntryCallback, 1); /* Do the VisObject initialization for the VisParamEntryCallback */ visual_object_initialize (VISUAL_OBJECT (pcall), TRUE, NULL); pcall->id = id; pcall->callback = callback; visual_object_set_private (VISUAL_OBJECT (pcall), priv); visual_list_add (¶m->callbacks, pcall); return id; }
int visual_hashlist_put (VisHashlist *hashlist, char *key, void *data) { VisHashlistEntry *hentry; VisListEntry *le; visual_return_val_if_fail (hashlist != NULL, -VISUAL_ERROR_HASHLIST_NULL); visual_return_val_if_fail (key != NULL, -VISUAL_ERROR_NULL); visual_return_val_if_fail (data != NULL, -VISUAL_ERROR_NULL); le = visual_hashmap_get_string (hashlist->index, key); if (le != NULL) { hentry = le->data; hentry->data = data; } else { hentry = visual_mem_new0 (VisHashlistEntry, 1); hentry->key = key; hentry->data = data; visual_list_add (hashlist->list, hentry); le = hashlist->list->tail; visual_hashmap_put_string (hashlist->index, key, le); } return VISUAL_OK; }
int visual_audio_samplepool_add_channel (VisAudioSamplePool *samplepool, VisAudioSamplePoolChannel *channel) { visual_return_val_if_fail (samplepool != NULL, -VISUAL_ERROR_AUDIO_SAMPLEPOOL_NULL); visual_return_val_if_fail (channel != NULL, -VISUAL_ERROR_AUDIO_SAMPLEPOOL_CHANNEL_NULL); visual_list_add (samplepool->channels, channel); return VISUAL_OK; }
int visual_ringbuffer_add_entry (VisRingBuffer *ringbuffer, VisRingBufferEntry *entry) { visual_return_val_if_fail (ringbuffer != NULL, -VISUAL_ERROR_RINGBUFFER_NULL); visual_return_val_if_fail (entry != NULL, -VISUAL_ERROR_RINGBUFFER_ENTRY_NULL); visual_list_add (ringbuffer->entries, entry); return VISUAL_OK; }
LVAVSPreset *lvavs_preset_new_from_preset (char *filename) { LVAVSPreset *preset = NULL; LVAVSPresetElement *element; LVAVSPresetContainer *cont; xmlDocPtr doc; xmlNodePtr cur; int i; doc = xmlParseFile(filename); if(doc == NULL) { return NULL; } cur = xmlDocGetRootElement (doc); if(!cur) { xmlFreeDoc(doc); fprintf(stderr, "No root element\n"); return NULL; } if(xmlStrcmp(cur->name, (const xmlChar *) "pipeline_preset") != 0) { xmlFreeDoc(doc); fprintf(stderr, "Bad opening node in preset file %s. Looking for 'pipeline_preset' but got '%s'.", filename, cur->name); return NULL; } preset = lvavs_preset_new (); preset->main = lvavs_preset_container_new(); VisParamContainer *pcont = visual_param_container_new(); visual_param_container_add_many(pcont, container_params); LVAVS_PRESET_ELEMENT(preset->main)->pcont = pcont; for (cur = cur->children; cur; cur = cur->next) { if(xmlStrcmp(cur->name, (const xmlChar *)"container_main") == 0) { xmlNodePtr child; LVAVSPresetContainer *cont = lvavs_preset_container_new(); LVAVS_PRESET_ELEMENT(cont)->pcont = pcont; visual_list_add(preset->main->members, cont); cont = lvavs_preset_container_from_xml_node(cont, cur); } if(xmlStrcmp(cur->name, (const xmlChar *)"params") == 0) { parse_element(cur, LVAVS_PRESET_ELEMENT(preset->main)); } } xmlFreeDoc (doc); return preset; }
/** * Adds a VisParamEntry to a VisParamContainer. * * @param paramcontainer A pointer to the VisParamContainer in which the VisParamEntry is added. * @param param A pointer to the VisParamEntry that is added to the VisParamContainer. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, -VISUAL_ERROR_PARAM_NULL or * error values returned by visual_list_add () on failure. */ int visual_param_container_add (VisParamContainer *paramcontainer, VisParamEntry *param) { visual_log_return_val_if_fail (paramcontainer != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL); visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->parent = paramcontainer; /* On container add, we always set changed once, so vars can be synchronised in the plugin * it's event loop */ visual_param_entry_changed (param); return visual_list_add (¶mcontainer->entries, param); }
/** * Adds a VisParamEntry to a VisParamContainer, storing default values in the process. * * @param paramcontainer A pointer to the VisParamContainer in which the VisParamEntry is added. * @param param A pointer to the VisParamEntry that is added to the VisParamContainer. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, -VISUAL_ERROR_PARAM_NULL or * error values returned by visual_list_add () on failure. */ int visual_param_container_add_with_defaults (VisParamContainer *paramcontainer, VisParamEntry *param) { visual_log_return_val_if_fail (paramcontainer != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL); visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->parent = paramcontainer; visual_mem_copy(¶m->defaultnum, ¶m->numeric, sizeof(param->defaultnum)); if(param->type == VISUAL_PARAM_ENTRY_TYPE_STRING) param->defaultstring = strdup(param->string); /* if(param->type == VISUAL_PARAM_ENTRY_TYPE_COLOR) visual_color_copy(¶m->defaultcolor, ¶m->color); */ /* On container add, we always set changed once, so vars can be synchronised in the plugin * it's event loop */ visual_param_entry_changed (param); return visual_list_add (¶mcontainer->entries, param); }
int avs_parse_tree (AVSTree *avstree, AVSContainer *curcontainer) { AVSElement *element = NULL; char namedelem[30]; int isnamed; char *next_section = NULL; int marker; if (curcontainer == NULL) return -1; while (avstree->cur < (avstree->data + avstree->datasize)) { element = NULL; marker = AVS_SERIALIZE_GET_INT (AVS_TREE_GET_CURRENT_POINTER (avstree)); AVS_SERIALIZE_SKIP_INT (AVS_TREE_GET_CURRENT_POINTER (avstree)); /* Named preset section */ isnamed = FALSE; if (marker > 0xff) { printf ("Marker > 0xff, named APE %x\n", marker); strncpy (namedelem, AVS_TREE_GET_CURRENT_POINTER (avstree), 30); AVS_SERIALIZE_SKIP_LENGTH (avstree->cur, 32); isnamed = TRUE; marker = AVS_ELEMENT_TYPE_APE; printf("avstree->cur %s\n", avstree->cur); } // FIXME: In some files next_section doesn't point to the correct location. // Check the location of the section's size data. For now I've commented the // line at the bottom of this function where avstree->cur is assigned next_section. // This may not work for every file, but it works with the few I've checked. next_section = AVS_SERIALIZE_GET_NEXT_SECTION (AVS_TREE_GET_CURRENT_POINTER (avstree)); avstree->cur_section_length = next_section - avstree->cur; AVS_SERIALIZE_SKIP_INT (AVS_TREE_GET_CURRENT_POINTER (avstree)); printf (":: 0x%x marker! %d\n", marker, marker); /* FIXME: Use a table lookup here instead of giant function */ switch (marker) { case AVS_ELEMENT_TYPE_RENDER_SIMPLESPECTRUM: break; case AVS_ELEMENT_TYPE_MISC_COMMENT: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_MISC_COMMENT, "text", AVS_SERIALIZE_ENTRY_TYPE_STRING, NULL); break; case AVS_ELEMENT_TYPE_MISC_RENDERSTATE: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_MISC_RENDERSTATE, "newmode", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_MISC_BPM: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_MISC_BPM, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "arbitrary", AVS_SERIALIZE_ENTRY_TYPE_INT, "skip", AVS_SERIALIZE_ENTRY_TYPE_INT, "invert", AVS_SERIALIZE_ENTRY_TYPE_INT, "arbVal", AVS_SERIALIZE_ENTRY_TYPE_INT, "skipVal", AVS_SERIALIZE_ENTRY_TYPE_INT, "skipfirst", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_MISC_STACK: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_MISC_STACK, "dir", AVS_SERIALIZE_ENTRY_TYPE_INT, "which", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "adjblend_val", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_RENDER_RING: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_RENDER_RING, "source and place", AVS_SERIALIZE_ENTRY_TYPE_INT, "palette", AVS_SERIALIZE_ENTRY_TYPE_PALETTE, "size", AVS_SERIALIZE_ENTRY_TYPE_BYTE, "type", AVS_SERIALIZE_ENTRY_TYPE_BYTE, NULL); break; case AVS_ELEMENT_TYPE_RENDER_SUPERSCOPE: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_RENDER_SUPERSCOPE, "empty", AVS_SERIALIZE_ENTRY_TYPE_BYTE, "point", AVS_SERIALIZE_ENTRY_TYPE_STRING, "frame", AVS_SERIALIZE_ENTRY_TYPE_STRING, "beat", AVS_SERIALIZE_ENTRY_TYPE_STRING, "init", AVS_SERIALIZE_ENTRY_TYPE_STRING, "channel source", AVS_SERIALIZE_ENTRY_TYPE_INT, "palette", AVS_SERIALIZE_ENTRY_TYPE_PALETTE, "draw type", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_DMOVE: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_DMOVE, "empty", AVS_SERIALIZE_ENTRY_TYPE_BYTE, "point", AVS_SERIALIZE_ENTRY_TYPE_STRING, "frame", AVS_SERIALIZE_ENTRY_TYPE_STRING, "beat", AVS_SERIALIZE_ENTRY_TYPE_STRING, "init", AVS_SERIALIZE_ENTRY_TYPE_STRING, "subpixel", AVS_SERIALIZE_ENTRY_TYPE_INT, "rectcoords", AVS_SERIALIZE_ENTRY_TYPE_INT, "xres", AVS_SERIALIZE_ENTRY_TYPE_INT, "yres", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "wrap", AVS_SERIALIZE_ENTRY_TYPE_INT, "buffern", AVS_SERIALIZE_ENTRY_TYPE_INT, "nomove", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_RENDER_CLEARSCREEN: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_RENDER_CLEARSCREEN, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, "clear type", AVS_SERIALIZE_ENTRY_TYPE_INT, "clear 5050", AVS_SERIALIZE_ENTRY_TYPE_INT, "first", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_RENDER_BASSSPIN: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_RENDER_BASSSPIN, "chan enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "left color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, "right color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, "draw type", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_FASTBRIGHT: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_FASTBRIGHT, "brightness type", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_INVERT: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_INVERT, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_BLUR: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_BLUR, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "roundmode", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_MOVEMENT: element = AVS_ELEMENT (avs_parse_trans_movement (avstree)); break; case AVS_ELEMENT_TYPE_TRANS_ONETONE: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_ONETONE, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "blendavg", AVS_SERIALIZE_ENTRY_TYPE_INT, "invert", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_GRAIN: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_GRAIN, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "blendavg", AVS_SERIALIZE_ENTRY_TYPE_INT, "smax", AVS_SERIALIZE_ENTRY_TYPE_INT, "staticgrain", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_MIRROR: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_MIRROR, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "mode", AVS_SERIALIZE_ENTRY_TYPE_INT, "onbeat", AVS_SERIALIZE_ENTRY_TYPE_INT, "smooth", AVS_SERIALIZE_ENTRY_TYPE_INT, "slower", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_SCATTER: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_SCATTER, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_FADEOUT: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_FADEOUT, "fadelen", AVS_SERIALIZE_ENTRY_TYPE_INT, "color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, NULL); break; case AVS_ELEMENT_TYPE_TRANS_MOSAIC: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_MOSAIC, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "quality", AVS_SERIALIZE_ENTRY_TYPE_INT, "quality2", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "blendavg", AVS_SERIALIZE_ENTRY_TYPE_INT, "onbeat", AVS_SERIALIZE_ENTRY_TYPE_INT, "frame duration", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_WATER: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_BRIGHTNESS, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_WATERBUMP: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_WATERBUMP, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "density", AVS_SERIALIZE_ENTRY_TYPE_INT, "depth", AVS_SERIALIZE_ENTRY_TYPE_INT, "random prop", AVS_SERIALIZE_ENTRY_TYPE_INT, "drop position x", AVS_SERIALIZE_ENTRY_TYPE_INT, "drop position y", AVS_SERIALIZE_ENTRY_TYPE_INT, "drop radius", AVS_SERIALIZE_ENTRY_TYPE_INT, "method", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_BRIGHTNESS: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_BRIGHTNESS, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "blendavg", AVS_SERIALIZE_ENTRY_TYPE_INT, "redp", AVS_SERIALIZE_ENTRY_TYPE_INT, "greenp", AVS_SERIALIZE_ENTRY_TYPE_INT, "bleup", AVS_SERIALIZE_ENTRY_TYPE_INT, "dissoc", AVS_SERIALIZE_ENTRY_TYPE_INT, "color", AVS_SERIALIZE_ENTRY_TYPE_INT, "exclude", AVS_SERIALIZE_ENTRY_TYPE_INT, "distance", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_BUMPMAP: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_BUMPMAP, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "onbeat", AVS_SERIALIZE_ENTRY_TYPE_INT, "frame duration", AVS_SERIALIZE_ENTRY_TYPE_INT, "depth", AVS_SERIALIZE_ENTRY_TYPE_INT, "depth 2", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "blendavg", AVS_SERIALIZE_ENTRY_TYPE_INT, "code1", AVS_SERIALIZE_ENTRY_TYPE_STRING, "code2", AVS_SERIALIZE_ENTRY_TYPE_STRING, "code3", AVS_SERIALIZE_ENTRY_TYPE_STRING, "showlight", AVS_SERIALIZE_ENTRY_TYPE_INT, "invert", AVS_SERIALIZE_ENTRY_TYPE_INT, "oldstyle", AVS_SERIALIZE_ENTRY_TYPE_INT, "buffern", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_TRANS_NFRAMECLEAR: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_NFRAMECLEAR, "color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, "n frame", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_RENDER_PARTICLE: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_RENDER_PARTICLE, "enabled", AVS_SERIALIZE_ENTRY_TYPE_INT, "color", AVS_SERIALIZE_ENTRY_TYPE_COLOR, "maxdist", AVS_SERIALIZE_ENTRY_TYPE_INT, "size", AVS_SERIALIZE_ENTRY_TYPE_INT, "size2", AVS_SERIALIZE_ENTRY_TYPE_INT, "blend", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_RENDER_OSCSTARS: element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_RENDER_OSCSTARS, "effect", AVS_SERIALIZE_ENTRY_TYPE_INT, "palette", AVS_SERIALIZE_ENTRY_TYPE_PALETTE, "size", AVS_SERIALIZE_ENTRY_TYPE_INT, "rotate", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); break; case AVS_ELEMENT_TYPE_APE: printf ("APE NAME: %s\n", namedelem); element = NULL; if (strcmp (namedelem, "Multiplier") == 0) { element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_MULTIPLIER, "multiply", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); } else if (strcmp (namedelem, "Channel Shift") == 0) { element = avs_parse_element_non_complex (avstree, AVS_ELEMENT_TYPE_TRANS_CHANNELSHIFT, "shift", AVS_SERIALIZE_ENTRY_TYPE_INT, "onbeat", AVS_SERIALIZE_ENTRY_TYPE_INT, NULL); } else { printf ("Unhandled named entry: %s position: %x\n", namedelem, avstree->cur - avstree->data); } break; default: printf ("Unhandled type: %x position: %x\n", *avstree->cur, avstree->cur - avstree->data); return -1; break; } if (element != NULL) { visual_list_add (curcontainer->members, element); show_options (element); } avstree->cur = next_section; } return 0; }
/* Internal functions */ int pipeline_from_preset (LVAVSPipelineContainer *container, LVAVSPresetContainer *presetcont) { VisListEntry *le = NULL; LVAVSPresetElement *pelem; LVAVSPipelineElement *element; LVAVSPipelineContainer *cont; VisPluginRef *ref; LVAVSPipeline *pipeline = LVAVS_PIPELINE_ELEMENT(container)->pipeline; while ((pelem = visual_list_next (presetcont->members, &le)) != NULL) { switch (pelem->type) { case LVAVS_PRESET_ELEMENT_TYPE_PLUGIN: ref = visual_plugin_find (visual_plugin_get_registry (), pelem->element_name); if (ref == NULL) { visual_log (VISUAL_LOG_CRITICAL, "Requested plugin %s not in registry", pelem->element_name); break; } if (ref->info == NULL) { visual_log (VISUAL_LOG_CRITICAL, "Could not get VisPluginInfo for %s", pelem->element_name); break; } /* FIXME fix libvisual type lookup and use the functions here */ if (strcmp (ref->info->type, VISUAL_PLUGIN_TYPE_ACTOR) == 0) { element = lvavs_pipeline_element_new (LVAVS_PIPELINE_ELEMENT_TYPE_ACTOR); element->data.actor = visual_actor_new (pelem->element_name); visual_object_set_private(VISUAL_OBJECT(element->data.actor->plugin), pipeline); } else if (strcmp (ref->info->type, VISUAL_PLUGIN_TYPE_MORPH) == 0) { element = lvavs_pipeline_element_new (LVAVS_PIPELINE_ELEMENT_TYPE_MORPH); element->data.morph = visual_morph_new (pelem->element_name); visual_object_set_private(VISUAL_OBJECT(element->data.morph->plugin), pipeline); } else if (strcmp (ref->info->type, VISUAL_PLUGIN_TYPE_TRANSFORM) == 0) { element = lvavs_pipeline_element_new (LVAVS_PIPELINE_ELEMENT_TYPE_TRANSFORM); element->data.transform = visual_transform_new (pelem->element_name); visual_object_set_private(VISUAL_OBJECT(element->data.transform->plugin), pipeline); } else { printf("uknown type '%s' '%s'\n", ref->info->type, ref->info->name); } if (pelem->pcont != NULL) { element->params = visual_param_container_new (); visual_param_container_copy (element->params, pelem->pcont); } element->pipeline = LVAVS_PIPELINE_ELEMENT (container)->pipeline; visual_list_add (container->members, element); break; case LVAVS_PRESET_ELEMENT_TYPE_CONTAINER: cont = lvavs_pipeline_container_new (); LVAVS_PIPELINE_ELEMENT(cont)->params = LVAVS_PIPELINE_ELEMENT(container)->params; LVAVS_PIPELINE_ELEMENT(cont)->pipeline = LVAVS_PIPELINE_ELEMENT(container)->pipeline; visual_list_add (container->members, cont); pipeline_from_preset (cont, LVAVS_PRESET_CONTAINER (pelem)); break; case LVAVS_PRESET_ELEMENT_TYPE_RENDERSTATE: break; case LVAVS_PRESET_ELEMENT_TYPE_COMMENT: break; case LVAVS_PRESET_ELEMENT_TYPE_BPM: break; case LVAVS_PRESET_ELEMENT_TYPE_STACK: break; default: visual_log (VISUAL_LOG_CRITICAL, "Invalid LVAVSPresetElementType in LVAVSPresetElement"); break; } } return VISUAL_OK; }
int avs_serialize_container_add (AVSSerializeContainer *scont, AVSSerializeEntry *sentry) { visual_list_add (&scont->layout, sentry); return 0; }