const struct ::tizen_video_interface tizen_video::m_tizen_video_interface = {
tizen_video::handle_get_object,
tizen_video::handle_get_viewport,
- tizen_video::handle_destroy,
- tizen_video::handle_get_surface_provider
+ tizen_video::handle_destroy
};
void tizen_video::tizen_video_get_object(Resource *, uint32_t, struct ::wl_resource *)
{
}
- void tizen_video::tizen_video_get_surface_provider(Resource *, uint32_t, struct ::wl_resource *)
- {
- }
-
void tizen_video::handle_get_object(
::wl_client *client,
r);
}
- void tizen_video::handle_get_surface_provider(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video *>(r->tizen_video_object)->tizen_video_get_surface_provider(
- r,
- id,
- surface);
- }
-
void tizen_video::send_format(uint32_t format)
{
DS_ASSERT_X(m_resource, "tizen_video::format", "Uninitialised resource");
}
- tizen_video_surface_provider::tizen_video_surface_provider(struct ::wl_client *client, int id, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- {
- init(client, id, version);
- }
-
- tizen_video_surface_provider::tizen_video_surface_provider(struct ::wl_display *display, int version)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- {
- init(display, version);
- }
-
- tizen_video_surface_provider::tizen_video_surface_provider(struct ::wl_resource *resource)
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- {
- init(resource);
- }
-
- tizen_video_surface_provider::tizen_video_surface_provider()
- : m_resource_map()
- , m_resource(NULL)
- , m_global(NULL)
- {
- }
-
- tizen_video_surface_provider::~tizen_video_surface_provider()
- {
- std::multimap<struct ::wl_client*, tizen_video_surface_provider::Resource*>::iterator it;
- for (it = m_resource_map.begin() ; it != m_resource_map.end() ; it++) {
- tizen_video_surface_provider::Resource *resource = (*it).second;
- wl_resource_set_implementation(resource->handle, NULL, NULL, NULL);
- }
-
- if (m_global) {
- wl_global_destroy(m_global);
- wl_list_remove(&m_displayDestroyedListener.link);
- }
- }
-
- void tizen_video_surface_provider::init(struct ::wl_client *client, int id, int version)
- {
- m_resource = bind(client, id, version);
- }
-
- void tizen_video_surface_provider::init(struct ::wl_resource *resource)
- {
- m_resource = bind(resource);
- }
-
- tizen_video_surface_provider::Resource *tizen_video_surface_provider::add(struct ::wl_client *client, int version)
- {
- Resource *resource = bind(client, 0, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- tizen_video_surface_provider::Resource *tizen_video_surface_provider::add(struct ::wl_client *client, int id, int version)
- {
- Resource *resource = bind(client, id, version);
- m_resource_map.insert(std::pair<struct ::wl_client*, Resource*>(client, resource));
- return resource;
- }
-
- void tizen_video_surface_provider::init(struct ::wl_display *display, int version)
- {
- m_global = wl_global_create(display, &::tizen_video_surface_provider_interface, version, this, bind_func);
- m_globalVersion = version;
- m_displayDestroyedListener.notify = tizen_video_surface_provider::display_destroy_func;
- m_displayDestroyedListener.parent = this;
- wl_display_add_destroy_listener(display, &m_displayDestroyedListener);
- }
-
- const struct wl_interface *tizen_video_surface_provider::interface()
- {
- return &::tizen_video_surface_provider_interface;
- }
-
- tizen_video_surface_provider::Resource *tizen_video_surface_provider::tizen_video_surface_provider_allocate()
- {
- return new Resource;
- }
-
- void tizen_video_surface_provider::tizen_video_surface_provider_bind_resource(Resource *)
- {
- }
-
- void tizen_video_surface_provider::tizen_video_surface_provider_destroy_resource(Resource *)
- {
- }
-
- void tizen_video_surface_provider::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)
- {
- tizen_video_surface_provider *that = static_cast<tizen_video_surface_provider *>(data);
- that->add(client, id, std::min(that->m_globalVersion, version));
- }
-
- void tizen_video_surface_provider::display_destroy_func(struct ::wl_listener *listener, void *data)
- {
- DS_UNUSED(data);
- tizen_video_surface_provider *that = static_cast<tizen_video_surface_provider::DisplayDestroyedListener *>(listener)->parent;
- that->m_global = NULL;
- }
-
- void tizen_video_surface_provider::destroy_func(struct ::wl_resource *client_resource)
- {
- Resource *resource = Resource::fromResource(client_resource);
- DS_ASSERT(resource);
- tizen_video_surface_provider *that = resource->tizen_video_surface_provider_object;
- that->m_resource_map.erase(resource->client());
- that->tizen_video_surface_provider_destroy_resource(resource);
- delete resource;
- }
-
- tizen_video_surface_provider::Resource *tizen_video_surface_provider::bind(struct ::wl_client *client, uint32_t id, int version)
- {
- DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id);
- struct ::wl_resource *handle = wl_resource_create(client, &::tizen_video_surface_provider_interface, version, id);
- return bind(handle);
- }
-
- tizen_video_surface_provider::Resource *tizen_video_surface_provider::bind(struct ::wl_resource *handle)
- {
- Resource *resource = tizen_video_surface_provider_allocate();
- resource->tizen_video_surface_provider_object = this;
-
- wl_resource_set_implementation(handle, &m_tizen_video_surface_provider_interface, resource, destroy_func);
- resource->handle = handle;
- tizen_video_surface_provider_bind_resource(resource);
- return resource;
- }
- tizen_video_surface_provider::Resource *tizen_video_surface_provider::Resource::fromResource(struct ::wl_resource *resource)
- {
- if (DS_UNLIKELY(!resource))
- return NULL;
- if (wl_resource_instance_of(resource, &::tizen_video_surface_provider_interface, &m_tizen_video_surface_provider_interface))
- return static_cast<Resource *>(wl_resource_get_user_data(resource));
- return NULL;
- }
-
- const struct ::tizen_video_surface_provider_interface tizen_video_surface_provider::m_tizen_video_surface_provider_interface = {
- tizen_video_surface_provider::handle_destroy,
- tizen_video_surface_provider::handle_set_sync_serial
- };
-
- void tizen_video_surface_provider::tizen_video_surface_provider_destroy(Resource *)
- {
- }
-
- void tizen_video_surface_provider::tizen_video_surface_provider_set_sync_serial(Resource *, uint32_t )
- {
- }
-
-
- void tizen_video_surface_provider::handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_surface_provider *>(r->tizen_video_surface_provider_object)->tizen_video_surface_provider_destroy(
- r);
- }
-
- void tizen_video_surface_provider::handle_set_sync_serial(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_surface_provider *>(r->tizen_video_surface_provider_object)->tizen_video_surface_provider_set_sync_serial(
- r,
- serial);
- }
-
- void tizen_video_surface_provider::send_sync_done(uint32_t serial)
- {
- DS_ASSERT_X(m_resource, "tizen_video_surface_provider::sync_done", "Uninitialised resource");
- if (DS_UNLIKELY(!m_resource)) {
- WRN("could not call tizen_video_surface_provider::sync_done as it's not initialised");
- return;
- }
- send_sync_done(
- m_resource->handle,
- serial);
- }
-
- void tizen_video_surface_provider::send_sync_done(struct ::wl_resource *resource, uint32_t serial)
- {
- tizen_video_surface_provider_send_sync_done(
- resource,
- serial);
- }
-
-
tizen_video_object::tizen_video_object(struct ::wl_client *client, int id, int version)
: m_resource_map()
, m_resource(NULL)
tizen_video_object::handle_follow_topmost_visibility,
tizen_video_object::handle_unfollow_topmost_visibility,
tizen_video_object::handle_allowed_attribute,
- tizen_video_object::handle_disallowed_attribute,
- tizen_video_object::handle_set_sync_serial
+ tizen_video_object::handle_disallowed_attribute
};
void tizen_video_object::tizen_video_object_destroy(Resource *)
{
}
- void tizen_video_object::tizen_video_object_set_sync_serial(Resource *, uint32_t )
- {
- }
-
void tizen_video_object::handle_destroy(
::wl_client *client,
r);
}
- void tizen_video_object::handle_set_sync_serial(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial)
- {
- DS_UNUSED(client);
- Resource *r = Resource::fromResource(resource);
- static_cast<tizen_video_object *>(r->tizen_video_object_object)->tizen_video_object_set_sync_serial(
- r,
- serial);
- }
-
void tizen_video_object::send_attribute(const std::string &name, uint32_t value)
{
DS_ASSERT_X(m_resource, "tizen_video_object::attribute", "Uninitialised resource");
virtual void tizen_video_get_object(Resource *resource, uint32_t id, struct ::wl_resource *surface);
virtual void tizen_video_get_viewport(Resource *resource, uint32_t id, struct ::wl_resource *surface);
virtual void tizen_video_destroy(Resource *resource);
- virtual void tizen_video_get_surface_provider(Resource *resource, uint32_t id, struct ::wl_resource *surface);
private:
static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
static void handle_destroy(
::wl_client *client,
struct wl_resource *resource);
- static void handle_get_surface_provider(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t id,
- struct ::wl_resource *surface);
std::multimap<struct ::wl_client*, Resource*> m_resource_map;
Resource *m_resource;
DisplayDestroyedListener m_displayDestroyedListener;
};
- class tizen_video_surface_provider
- {
- public:
- tizen_video_surface_provider(struct ::wl_client *client, int id, int version);
- tizen_video_surface_provider(struct ::wl_display *display, int version);
- tizen_video_surface_provider(struct ::wl_resource *resource);
- tizen_video_surface_provider();
-
- virtual ~tizen_video_surface_provider();
-
- class Resource
- {
- public:
- Resource() : tizen_video_surface_provider_object(NULL), handle(NULL) {}
- virtual ~Resource() {}
-
- tizen_video_surface_provider *tizen_video_surface_provider_object;
- tizen_video_surface_provider *object() { return tizen_video_surface_provider_object; }
- struct ::wl_resource *handle;
-
- struct ::wl_client *client() const { return wl_resource_get_client(handle); }
- int version() const { return wl_resource_get_version(handle); }
-
- static Resource *fromResource(struct ::wl_resource *resource);
- };
-
- void init(struct ::wl_client *client, int id, int version);
- void init(struct ::wl_display *display, int version);
- void init(struct ::wl_resource *resource);
-
- Resource *add(struct ::wl_client *client, int version);
- Resource *add(struct ::wl_client *client, int id, int version);
- Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);
-
- Resource *resource() { return m_resource; }
- const Resource *resource() const { return m_resource; }
-
- std::multimap<struct ::wl_client*, Resource*> resourceMap() { return m_resource_map; }
- const std::multimap<struct ::wl_client*, Resource*> resourceMap() const { return m_resource_map; }
-
- bool isGlobal() const { return m_global != NULL; }
- bool isResource() const { return m_resource != NULL; }
-
- static const struct ::wl_interface *interface();
- static std::string interfaceName() { return interface()->name; }
- static int interfaceVersion() { return interface()->version; }
-
-
- void send_sync_done(uint32_t serial);
- void send_sync_done(struct ::wl_resource *resource, uint32_t serial);
-
- protected:
- virtual Resource *tizen_video_surface_provider_allocate();
-
- virtual void tizen_video_surface_provider_bind_resource(Resource *resource);
- virtual void tizen_video_surface_provider_destroy_resource(Resource *resource);
-
- virtual void tizen_video_surface_provider_destroy(Resource *resource);
- virtual void tizen_video_surface_provider_set_sync_serial(Resource *resource, uint32_t serial);
-
- private:
- static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
- static void destroy_func(struct ::wl_resource *client_resource);
- static void display_destroy_func(struct ::wl_listener *listener, void *data);
-
- Resource *bind(struct ::wl_client *client, uint32_t id, int version);
- Resource *bind(struct ::wl_resource *handle);
-
- static const struct ::tizen_video_surface_provider_interface m_tizen_video_surface_provider_interface;
-
- static void handle_destroy(
- ::wl_client *client,
- struct wl_resource *resource);
- static void handle_set_sync_serial(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
-
- std::multimap<struct ::wl_client*, Resource*> m_resource_map;
- Resource *m_resource;
- struct ::wl_global *m_global;
- uint32_t m_globalVersion;
- struct DisplayDestroyedListener : ::wl_listener {
- tizen_video_surface_provider *parent;
- };
- DisplayDestroyedListener m_displayDestroyedListener;
- };
-
class tizen_video_object
{
public:
virtual void tizen_video_object_unfollow_topmost_visibility(Resource *resource);
virtual void tizen_video_object_allowed_attribute(Resource *resource);
virtual void tizen_video_object_disallowed_attribute(Resource *resource);
- virtual void tizen_video_object_set_sync_serial(Resource *resource, uint32_t serial);
private:
static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);
static void handle_disallowed_attribute(
::wl_client *client,
struct wl_resource *resource);
- static void handle_set_sync_serial(
- ::wl_client *client,
- struct wl_resource *resource,
- uint32_t serial);
std::multimap<struct ::wl_client*, Resource*> m_resource_map;
Resource *m_resource;