#ifndef RENDER_MULTI_H
#define RENDER_MULTI_H
#include <event2/util.h>
#include <event2/buffer.h>
#include "render.h"
#include "remote_pool.h"
/*
* Execute a given render_t operate across multiple remote render nodes, and aggregate the results into a single PNG stream locally
*/
struct render_multi;
// how many nodes can be involved in a render operation at most
#define RENDER_MULTI_NODES_MAX 2
/*
* Execute the given render operation on multiple nodes from the given remote pool, streaming back the result in PNG format via the given callbacks
*
* The behaviour of the callbacks is mostly the same as for render_remote.h
*/
struct render_multi *render_multi (
struct render *render_ctx, // what to render
struct remote_pool *pool_info, // what render pool to use
void (*cb_sent)(void *arg),
void (*cb_data)(struct evbuffer *buf, void *arg),
void (*cb_done)(void *arg),
void (*cb_fail)(void *arg),
void *cb_arg
);
void render_multi_cancel (struct render_multi *ctx);
void render_multi_set_recv (struct render_multi *ctx, size_t recv_threshold, size_t unread_buffer);
int render_multi_flush (struct render_multi *ctx);
void render_multi_free (struct render_multi *ctx);
#endif /* RENDER_MULTI_H */