static void scene_video_render(void *data) { struct obs_scene *scene = data; struct obs_scene_item *item; pthread_mutex_lock(&scene->mutex); item = scene->first_item; while (item) { if (obs_source_removed(item->source)) { struct obs_scene_item *del_item = item; item = item->next; obs_sceneitem_remove(del_item); continue; } gs_matrix_push(); gs_matrix_translate3f(item->origin.x, item->origin.y, 0.0f); gs_matrix_scale3f(item->scale.x, item->scale.y, 1.0f); gs_matrix_rotaa4f(0.0f, 0.0f, 1.0f, RAD(-item->rot)); gs_matrix_translate3f(-item->pos.x, -item->pos.y, 0.0f); obs_source_video_render(item->source); gs_matrix_pop(); item = item->next; } pthread_mutex_unlock(&scene->mutex); }
static void scene_destroy(void *data) { struct obs_scene *scene = data; struct obs_scene_item *item; pthread_mutex_lock(&scene->mutex); item = scene->first_item; while (item) { struct obs_scene_item *del_item = item; item = item->next; obs_sceneitem_remove(del_item); } pthread_mutex_unlock(&scene->mutex); pthread_mutex_destroy(&scene->mutex); bfree(scene); }
void OBSBasic::RemoveSceneItemFromSource(const char* name) { std::string str_name = name; auto delayDelete = [=](){ obs_source_t * source = obs_get_source_by_name(str_name.c_str()); for (int i = 0; i < ui->sources->count(); i++) { QListWidgetItem *listItem = ui->sources->item(i); OBSSceneItem item = GetOBSRef<OBSSceneItem>(listItem); obs_source_t * item_source = obs_sceneitem_get_source(item); if (source == item_source) { DeleteListItem(ui->sources, listItem); obs_source_release(source); obs_sceneitem_remove(item); return; } } obs_source_release(source); }; base::GetUIMessageLoop()->PostTask(FROM_HERE, base::Lambda(delayDelete)); }
void BiliSceneWidgetItem::onRemoveButtonClicked() { obs_sceneitem_remove(sceneItem); }