static void ebml_apply_client (format_plugin_t *plugin, client_t *client) { ebml_source_state_t *ebml_source_state = plugin->_state; const char *s; refbuf_release (ebml_source_state->header); ebml_source_state->header = NULL; ebml_destroy (ebml_source_state->ebml); ebml_source_state->ebml = NULL; free (plugin->contenttype); if (client == NULL) return; s = plugin->parser ? httpp_getvar (plugin->parser, "content-type") : NULL; plugin->contenttype = strdup (s ? s : "video/x-matroska"); ebml_source_state->ebml = ebml_create(); }
int format_ebml_get_plugin(source_t *source) { ebml_source_state_t *ebml_source_state = calloc(1, sizeof(ebml_source_state_t)); format_plugin_t *plugin = calloc(1, sizeof(format_plugin_t)); plugin->get_buffer = ebml_get_buffer; plugin->write_buf_to_client = ebml_write_buf_to_client; plugin->create_client_data = ebml_create_client_data; plugin->free_plugin = ebml_free_plugin; plugin->write_buf_to_file = ebml_write_buf_to_file; plugin->set_tag = NULL; plugin->apply_settings = NULL; plugin->contenttype = httpp_getvar(source->parser, "content-type"); plugin->_state = ebml_source_state; vorbis_comment_init(&plugin->vc); source->format = plugin; ebml_source_state->ebml = ebml_create(); return 0; }