char *abi;
char *pd_group;
double period;
+ int pixels;
} default_conf;
struct {
#define DEFAULT_ABI g_conf.default_conf.abi
#define DEFAULT_GROUP g_conf.default_conf.pd_group
#define DEFAULT_PERIOD g_conf.default_conf.period
+#define DEFAULT_PIXELS g_conf.default_conf.pixels
#define PRIORITY_NO_CHANGE -1.0f
#define BUNDLE_SLAVE_NAME g_conf.launch_key.name
extern int instance_unicast_created_event(struct inst_info *inst, struct client_node *client);
extern int instance_unicast_deleted_event(struct inst_info *inst, struct client_node *client, int reason);
-extern int instance_create_lb_buffer(struct inst_info *inst);
-extern int instance_create_pd_buffer(struct inst_info *inst);
+extern int instance_create_lb_buffer(struct inst_info *inst, int pixels);
+extern int instance_create_pd_buffer(struct inst_info *inst, int pixels);
extern void instance_slave_set_pd_pos(struct inst_info *inst, double x, double y);
extern void instance_slave_get_pd_pos(struct inst_info *inst, double *x, double *y);
Name: data-provider-master
Summary: Master service provider for liveboxes
-Version: 0.34.5
+Version: 0.35.0
Release: 1
Group: HomeTF/Livebox
License: Flora
gem = (struct gem_data *)buffer->data;
- snprintf(info->id, len, SCHEMA_PIXMAP "%d", (int)gem->pixmap);
+ snprintf(info->id, len, SCHEMA_PIXMAP "%d:%d", (int)gem->pixmap, info->pixel_size);
DbgPrint("Loaded pixmap(info->id): %s\n", info->id);
return LB_STATUS_SUCCESS;
}
{
int id;
char *new_id;
+ int pixels;
- new_id = strdup(SCHEMA_PIXMAP "0");
+ new_id = strdup(SCHEMA_PIXMAP "0:0");
if (!new_id) {
ErrPrint("Heap: %s\n", strerror(errno));
return LB_STATUS_ERROR_MEMORY;
}
- if (sscanf(info->id, SCHEMA_PIXMAP "%d", &id) != 1) {
+ if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &id, &pixels) != 2) {
ErrPrint("Invalid ID (%s)\n", info->id);
DbgFree(new_id);
return LB_STATUS_ERROR_INVALID;
{
struct buffer *buffer;
- buffer = calloc(1, sizeof(*buffer) + sizeof(int));
+ buffer = calloc(1, sizeof(*buffer) + DEFAULT_PIXELS);
if (!buffer) {
ErrPrint("Heap: %s\n", strerror(errno));
return NULL;
switch (type) {
case BUFFER_TYPE_SHM:
+ if (pixel_size != DEFAULT_PIXELS) {
+ DbgPrint("SHM only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
+ pixel_size = DEFAULT_PIXELS;
+ }
+
info->id = strdup(SCHEMA_SHM "-1");
if (!info->id) {
ErrPrint("Heap: %s\n", strerror(errno));
}
break;
case BUFFER_TYPE_FILE:
+ if (pixel_size != DEFAULT_PIXELS) {
+ DbgPrint("FILE only supportes %d bytes pixels (requested: %d)\n", DEFAULT_PIXELS, pixel_size);
+ pixel_size = DEFAULT_PIXELS;
+ }
+
info->id = strdup(SCHEMA_FILE "/tmp/.live.undefined");
if (!info->id) {
ErrPrint("Heap: %s\n", strerror(errno));
}
break;
case BUFFER_TYPE_PIXMAP:
- info->id = strdup(SCHEMA_PIXMAP "0");
+ info->id = strdup(SCHEMA_PIXMAP "0:0");
if (!info->id) {
ErrPrint("Heap: %s\n", strerror(errno));
DbgFree(info);
static const double CONF_DEFAULT_SCALE_WIDTH_FACTOR = 1.0f;
static const double CONF_DEFAULT_SCALE_HEIGHT_FACTOR = 1.0f;
static const double CONF_DEFAULT_PD_REQUEST_TIMEOUT = 5.0f;
+static const int CONF_DEFAULT_PIXELS = sizeof(int);
HAPI struct conf g_conf;
DbgPrint("Minimum period: %lf\n", g_conf.minimum_period);
}
+static void pixels_handler(char *buffer)
+{
+ if (sscanf(buffer, "%d", &g_conf.default_conf.pixels) != 1) {
+ ErrPrint("Failed to parse the minimum_period\n");
+ }
+ DbgPrint("Default pixels: %lf\n", g_conf.default_conf.pixels);
+}
+
static void script_handler(char *buffer)
{
g_conf.default_conf.script = strdup(buffer);
g_conf.base_height = CONF_DEFAULT_BASE_HEIGHT;
g_conf.minimum_period = CONF_DEFAULT_MINIMUM_PERIOD;
g_conf.default_conf.period = CONF_DEFAULT_PERIOD;
+ g_conf.default_conf.pixels = CONF_DEFAULT_PIXELS;
g_conf.minimum_space = CONF_DEFAULT_MINIMUM_SPACE;
g_conf.default_packet_time = CONF_DEFAULT_PACKET_TIME;
g_conf.slave_ttl = CONF_DEFAULT_SLAVE_TTL;
.handler = script_handler,
},
{
+ .name = "pixels",
+ .handler = pixels_handler,
+ },
+ {
.name = "default_abi",
.handler = default_abi_handler,
},
g_conf.scale_height_factor = CONF_DEFAULT_SCALE_HEIGHT_FACTOR;
g_conf.pd_request_timeout = CONF_DEFAULT_PD_REQUEST_TIMEOUT;
g_conf.premultiplied = CONF_DEFAULT_PREMULTIPLIED;
+ g_conf.default_conf.pixels = CONF_DEFAULT_PIXELS;
if (g_conf.default_conf.script != CONF_DEFAULT_SCRIPT_TYPE) {
DbgFree(g_conf.default_conf.script);
script_handler_load(inst->lb.canvas.script, 0);
}
} else if (package_lb_type(inst->info) == LB_TYPE_BUFFER) {
- instance_create_lb_buffer(inst);
+ instance_create_lb_buffer(inst, DEFAULT_PIXELS);
}
if (package_pd_type(inst->info) == PD_TYPE_SCRIPT) {
ErrPrint("Failed to create PD\n");
}
} else if (package_pd_type(inst->info) == PD_TYPE_BUFFER) {
- instance_create_pd_buffer(inst);
+ instance_create_pd_buffer(inst, DEFAULT_PIXELS);
}
instance_broadcast_created_event(inst);
instance_unref(inst);
}
-HAPI int instance_create_pd_buffer(struct inst_info *inst)
+HAPI int instance_create_pd_buffer(struct inst_info *inst, int pixels)
{
if (inst->pd.width == 0 && inst->pd.height == 0) {
instance_set_pd_size(inst, package_pd_width(inst->info), package_pd_height(inst->info));
}
if (!inst->pd.canvas.buffer) {
- inst->pd.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->pd.width, inst->pd.height, sizeof(int));
+ inst->pd.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->pd.width, inst->pd.height, pixels);
if (!inst->pd.canvas.buffer) {
ErrPrint("Failed to create PD Buffer\n");
}
return !!inst->pd.canvas.buffer;
}
-HAPI int instance_create_lb_buffer(struct inst_info *inst)
+HAPI int instance_create_lb_buffer(struct inst_info *inst, int pixels)
{
if (inst->lb.width == 0 && inst->lb.height == 0) {
livebox_service_get_size(LB_SIZE_TYPE_1x1, &inst->lb.width, &inst->lb.height);
* Slave doesn't call the acquire_buffer.
* In this case, create the buffer from here.
*/
- inst->lb.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->lb.width, inst->lb.height, sizeof(int));
+ inst->lb.canvas.buffer = buffer_handler_create(inst, s_info.env_buf_type, inst->lb.width, inst->lb.height, pixels);
if (!inst->lb.canvas.buffer) {
ErrPrint("Failed to create LB\n");
}
return NULL;
}
- info->buffer_handle = buffer_handler_create(inst, s_info.env_buf_type, w, h, sizeof(int));
+ info->buffer_handle = buffer_handler_create(inst, s_info.env_buf_type, w, h, DEFAULT_PIXELS);
if (!info->buffer_handle) {
/* buffer_handler_create will prints some log */
DbgFree(info);
info = instance_lb_buffer(inst);
if (!info) {
- if (!instance_create_lb_buffer(inst)) {
+ if (!instance_create_lb_buffer(inst, pixel_size)) {
ErrPrint("Failed to create a LB buffer\n");
ret = LB_STATUS_ERROR_FAULT;
goto out;
info = instance_pd_buffer(inst);
if (!info) {
- if (!instance_create_pd_buffer(inst)) {
+ if (!instance_create_pd_buffer(inst, pixel_size)) {
ErrPrint("Failed to create a PD buffer\n");
ret = LB_STATUS_ERROR_FAULT;
instance_client_pd_created(inst, ret);