struct __surface_s {
char *id;
+ int pid;
void (*update_cb)(struct tizen_remote_surface *trs, struct wl_buffer *buffer, uint32_t time, void *data);
void (*missing_cb)(struct tizen_remote_surface *trs, void *data);
void *data;
{
struct __remote_surface_s *remote = (struct __remote_surface_s *)data;
bundle *envelope = bundle_create();
+ int pid = getpid();
if (envelope == NULL) {
_E("failed to create envelope");
bundle_add_str(envelope, "__AUL_RSP_RESOURCE_ID__", remote->id);
bundle_add_byte(envelope, "__AUL_RSP_SURFACE_ID__", &res_id, sizeof(uint32_t));
+ bundle_add_byte(envelope, "__AUL_RSP_SURFACE_CREATOR_PID__", &pid, sizeof(int));
if (aul_app_com_send("tbm_surface_notify", envelope) < 0) {
_E("failed to send surface notify");
__rs_missing_cb,
};
-static void __redirect_surface(char *id, int res_id)
+static void __redirect_surface(struct __surface_s *surface)
{
- struct __surface_s *surface = NULL;
-
- if (id) {
- surface = g_hash_table_lookup(__viewer_tbl, id);
- if (!surface) {
- _E("unknown surface");
- return;
- }
- }
-
- surface->resource_id = res_id;
- surface->surface = tizen_remote_surface_manager_create_surface(__rsm,
- (uint32_t)res_id, __tbm);
tizen_remote_surface_add_listener(surface->surface, &__rs_listener,
surface);
tizen_remote_surface_redirect(surface->surface);
char *id = NULL;
uint32_t *res_id = NULL;
size_t sz;
+ int *pid = NULL;
+ struct __surface_s *surface = NULL;
bundle_get_str(envelope, "__AUL_RSP_RESOURCE_ID__", &id);
- bundle_get_byte(envelope, "__AUL_RSP_SURFACE_ID__", (void **)&res_id,
- &sz);
+ bundle_get_byte(envelope, "__AUL_RSP_SURFACE_ID__", (void **)&res_id, &sz);
+ bundle_get_byte(envelope, "__AUL_RSP_SURFACE_CREATOR_PID__", (void **)&pid, &sz);
+ if (id) {
+ surface = g_hash_table_lookup(__viewer_tbl, id);
+ if (!surface) {
+ _E("unknown surface");
+ return 0;
+ }
+ }
+
+ if (pid != NULL)
+ surface->pid = (int)*pid;
+
+ surface->resource_id = *res_id;
+ surface->surface = tizen_remote_surface_manager_create_surface(__rsm,
+ (uint32_t)*res_id, __tbm);
+
+ _D("__tbm_handler %d, %d, %s", *pid, *res_id, id);
if (id && res_id)
- __redirect_surface(id, (int)*res_id);
+ __redirect_surface(surface);
else
_E("bad tbm message received. missing arguments");
API int aul_rsm_viewer_set_surface_handler_by_rid(int resource_id, aul_rsm_handler *cbs, void *data)
{
char buf[32];
+ struct __surface_s *surface;
snprintf(buf, sizeof(buf), "%d", resource_id);
aul_rsm_viewer_set_surface_handler(buf, cbs, data);
- __redirect_surface(buf, resource_id);
+ surface = g_hash_table_lookup(__viewer_tbl, buf);
+ __redirect_surface(surface);
return 0;
}
*resource_id = surface->resource_id;
return 0;
}
+
+API int aul_rsm_viewer_get_surface_pid(const char *id, int *pid)
+{
+ struct __surface_s *surface;
+
+ if (!id || !pid) {
+ _E("illegal arguments");
+ return -1;
+ }
+
+ surface = g_hash_table_lookup(__viewer_tbl, id);
+ if (!surface) {
+ _E("unknown surface");
+ return -1;
+ }
+
+ if (surface->pid < 1) {
+ _E("resource id not yet initialized");
+ return -1;
+ }
+
+ *pid = surface->pid;
+ return 0;
+}