src/client.c
src/critical_log.c
src/file_service.c
+ src/conf.c
)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
#define VCONFKEY_MASTER_CLIENT_ADDR "db/data-provider-master/serveraddr"
#endif
+extern void conf_set_manual_sync(int flag);
+extern int conf_manual_sync(void);
+extern void conf_set_frame_drop_for_resizing(int flag);
+extern int conf_frame_drop_for_resizing(void);
+
/* End of a file */
*/
extern int livebox_is_active_update(struct livebox *handler);
+extern void livebox_set_manual_sync(int flag);
+
+extern int livebox_manual_sync(void);
+
+extern void livebox_set_frame_drop_for_resizing(int flag);
+
+extern int livebox_frame_drop_for_resizing(void);
+
+extern int livebox_sync_pd_fb(struct livebox *handler);
+
+extern int livebox_sync_lb_fb(struct livebox *handler);
+
/*!
* \}
*/
Name: liblivebox-viewer
Summary: Library for developing the application.
-Version: 0.14.4
+Version: 0.14.5
Release: 1
Group: HomeTF/Livebox
License: Flora License
* And then begin updating again after change its size.
*/
if (lb_get_lb_fb(handler)) {
- lb_set_lb_fb(handler, fbfile);
+ (void)lb_set_lb_fb(handler, fbfile);
ret = fb_sync(lb_get_lb_fb(handler));
if (ret != LB_STATUS_SUCCESS) {
}
if (lb_get_pd_fb(handler)) {
- lb_set_lb_fb(handler, fbfile);
+ (void)lb_set_lb_fb(handler, fbfile);
ret = fb_sync(lb_get_lb_fb(handler));
if (ret != LB_STATUS_SUCCESS) {
*/
goto out;
} else if (lb_get_lb_fb(handler)) {
- lb_set_lb_fb(handler, fbfile);
- ret = fb_sync(lb_get_lb_fb(handler));
- if (ret != LB_STATUS_SUCCESS) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ if (conf_frame_drop_for_resizing() && handler->size_changed_cb) {
+ /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
+ DbgPrint("Discards obsoloted update event\n");
+ ret = LB_STATUS_ERROR_BUSY;
+ } else {
+ (void)lb_set_lb_fb(handler, fbfile);
+
+ if (!conf_manual_sync()) {
+ ret = fb_sync(lb_get_lb_fb(handler));
+ if (ret != LB_STATUS_SUCCESS) {
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ }
+ } else {
+ ret = LB_STATUS_SUCCESS;
+ }
}
} else {
ret = LB_STATUS_SUCCESS;
if (lb_text_pd(handler)) {
(void)parse_desc(handler, descfile, 1);
} else {
- (void)lb_set_pd_fb(handler, fbfile);
-
- ret = fb_sync(lb_get_pd_fb(handler));
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ if (conf_frame_drop_for_resizing() && handler->size_changed_cb) {
+ /* Just for skipping the update event callback call, After request to resize buffer, update event will be discarded */
+ DbgPrint("Discards obsoloted update event\n");
} else {
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
+ (void)lb_set_pd_fb(handler, fbfile);
+
+ if (!conf_manual_sync()) {
+ ret = fb_sync(lb_get_pd_fb(handler));
+ if (ret < 0) {
+ ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ } else {
+ lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
+ }
+ }
}
}
* Update it too.
*/
if (lb_get_lb_fb(handler)) {
- lb_set_lb_fb(handler, fbfile);
+ (void)lb_set_lb_fb(handler, fbfile);
ret = fb_sync(lb_get_lb_fb(handler));
if (ret < 0) {
if (!strlen(lb_fname)) {
break;
}
- lb_set_lb_fb(handler, lb_fname);
+ (void)lb_set_lb_fb(handler, lb_fname);
+
ret = fb_sync(lb_get_lb_fb(handler));
if (ret < 0) {
ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
--- /dev/null
+#include <stdio.h>
+
+static struct info {
+ int manual_sync;
+ int frame_drop_for_resizing;
+} s_info = {
+ .manual_sync = 0,
+ .frame_drop_for_resizing = 1,
+};
+
+void conf_set_manual_sync(int flag)
+{
+ s_info.manual_sync = flag;
+}
+
+int conf_manual_sync(void)
+{
+ return s_info.manual_sync;
+}
+
+void conf_set_frame_drop_for_resizing(int flag)
+{
+ s_info.frame_drop_for_resizing = flag;
+}
+
+int conf_frame_drop_for_resizing(void)
+{
+ return s_info.frame_drop_for_resizing;
+}
+
+/* End of a file */
return 0;
}
+static inline void update_fb_size(struct fb_info *info)
+{
+ info->bufsz = info->w * info->h * s_info.depth;
+}
+
static inline int sync_for_file(struct fb_info *info)
{
int fd;
}
if (info->bufsz == 0) {
+ /*!
+ * If the client does not acquire the buffer,
+ * This function will do nothing.
+ * It will work only if the buffer is acquired.
+ * To sync its contents.
+ */
DbgPrint("Nothing can be sync\n");
return LB_STATUS_SUCCESS;
}
if (!info->buffer) {
if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- info->bufsz = info->w * info->h * s_info.depth;
+ update_fb_size(info);
+
buffer = calloc(1, sizeof(*buffer) + info->bufsz);
if (!buffer) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
*/
sync_for_pixmap(info);
} else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- info->bufsz = info->w * info->h * s_info.depth;
+ update_fb_size(info);
+
buffer = calloc(1, sizeof(*buffer) + info->bufsz);
if (!buffer) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
return 0;
}
- info->bufsz = info->w * info->h * s_info.depth;
+ update_fb_size(info);
+
return info->bufsz;
}
#include "master_rpc.h"
#include "client.h"
#include "critical_log.h"
+#include "conf.h"
#define EAPI __attribute__((visibility("default")))
#define MINIMUM_EVENT s_info.event_filter
void lb_set_filename(struct livebox *handler, const char *filename)
{
if (handler->filename) {
- if (unlink(handler->filename) < 0) {
- ErrPrint("unlink: %s\n", strerror(errno));
+ if (handler->filename[0] && unlink(handler->filename) < 0) {
+ ErrPrint("unlink: %s (%s)\n", strerror(errno), handler->filename);
}
free(handler->filename);
handler->filename = strdup(filename);
if (!handler->filename) {
- ErrPrint("Heap: %s\n", strerror(errno));
+ ErrPrint("Heap: %s (%s)\n", strerror(errno), handler->filename);
return;
}
}
return master_rpc_request_only(NULL, packet);
}
+EAPI void livebox_set_manual_sync(int flag)
+{
+ conf_set_manual_sync(flag);
+}
+
+EAPI int livebox_manual_sync(void)
+{
+ return conf_manual_sync();
+}
+
+EAPI void livebox_set_frame_drop_for_resizing(int flag)
+{
+ conf_set_frame_drop_for_resizing(flag);
+}
+
+EAPI int livebox_frame_drop_for_resizing(void)
+{
+ return conf_frame_drop_for_resizing();
+}
+
+EAPI int livebox_sync_lb_fb(struct livebox *handler)
+{
+ return fb_sync(lb_get_lb_fb(handler));
+}
+
+EAPI int livebox_sync_pd_fb(struct livebox *handler)
+{
+ return fb_sync(lb_get_pd_fb(handler));
+}
+
/* End of a file */