void vout_EndWrapper(vout_thread_t *vout) { vout_thread_sys_t *sys = vout->p; assert(!sys->display.filtered); if (sys->private_pool) picture_pool_Delete(sys->private_pool); if (sys->decoder_pool != sys->display_pool) { NoDrClean(vout); picture_pool_Delete(sys->decoder_pool); } }
static void NoDrClean(vout_thread_t *vout) { vout_thread_sys_t *sys = vout->p; if (!sys->display.use_dr) picture_pool_Delete(sys->display_pool); }
/** * Control for vout display */ static int Control(vout_display_t *vd, int query, va_list args) { VLC_UNUSED(args); vout_display_sys_t *sys = vd->sys; switch (query) { case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* We have to ignore what is requested */ vout_display_SendEventPicturesInvalid(vd); return VLC_SUCCESS; case VOUT_DISPLAY_RESET_PICTURES: if (sys->pool) picture_pool_Delete(sys->pool); sys->pool = NULL; vd->fmt.i_width = aa_imgwidth(sys->aa_context); vd->fmt.i_height = aa_imgheight(sys->aa_context); return VLC_SUCCESS; case VOUT_DISPLAY_HIDE_MOUSE: aa_hidemouse(sys->aa_context); return VLC_SUCCESS; default: msg_Err(vd, "Unsupported query in vout display aalib"); return VLC_EGENERIC; } }
static void Close(vlc_object_t *p_this) { vout_display_t *vd = (vout_display_t *)p_this; vout_display_sys_t *sys = vd->sys; picture_pool_Delete(sys->pool); dlclose(sys->p_library); free(sys); vlc_mutex_unlock(&single_instance); }
static void Close(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys = vd->sys; if (sys->pool) picture_pool_Delete(sys->pool); free(sys); }
static void DirectXDestroyPool(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (sys->pool) { DirectXDestroyPictureResource(vd); picture_pool_Delete(sys->pool); } sys->pool = NULL; }
/** * It destroys the pool of picture and its resources. */ static void Direct3DDestroyPool(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (sys->pool) { picture_sys_t *picsys = sys->picsys; IDirect3DSurface9_Release(picsys->surface); if (picsys->fallback) picture_Release(picsys->fallback); picture_pool_Delete(sys->pool); } sys->pool = NULL; }
/** * It destroys the pool of picture and its resources. */ static void Direct3DDestroyPool(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (sys->pool) { picture_resource_t *rsc = &sys->resource; IDirect3DSurface9_Release(rsc->p_sys->surface); if (rsc->p_sys->fallback) picture_Release(rsc->p_sys->fallback); picture_pool_Delete(sys->pool); } sys->pool = NULL; }
static void Clean(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (sys->pool) picture_pool_Delete(sys->pool); sys->pool = NULL; if (sys->off_dc) DeleteDC(sys->off_dc); if (sys->off_bitmap) DeleteObject(sys->off_bitmap); }
/** * Close Direct2D vout */ static void Close(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; D2D_DestroyRenderTarget(vd); if (vd->sys->pool) picture_pool_Delete(vd->sys->pool); CommonClean(vd); free(vd->sys); }
static void Close(vlc_object_t *p_this) { vout_display_t *vd = (vout_display_t *)p_this; vout_display_sys_t *sys = vd->sys; picture_pool_Delete(sys->pool); if (sys->window) sys->native_window.winRelease(sys->window); dlclose(sys->p_library); picture_Release(sys->subtitles_picture); if (sys->p_spu_blend) filter_DeleteBlend(sys->p_spu_blend); free(sys); }
static void ResetPictures (vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (!sys->pool) return; if (sys->seg_base != 0) for (unsigned i = 0; i < MAX_PICTURES; i++) xcb_shm_detach (sys->conn, sys->seg_base + i); picture_pool_Delete (sys->pool); sys->pool = NULL; }
static void CloseVideo(vlc_object_t *p_this) { vout_display_t *vd = (vout_display_t *)p_this; vout_display_sys_t *sys = vd->sys; if (sys->pool) picture_pool_Delete(sys->pool); if (sys->pic_nosignal) picture_Release(sys->pic_nosignal); free(sys); ReleaseDLSys(p_this); }
/***************************************************************************** * Close: destroy KVA video thread output method ***************************************************************************** * Terminate an output method created by Open *****************************************************************************/ static void Close ( vlc_object_t *object ) { vout_display_t * vd = (vout_display_t *)object; vout_display_sys_t * sys = vd->sys; WinPostQueueMsg( sys->hmq, WM_QUIT, 0, 0 ); DosWaitThread( &sys->tid, DCWW_WAIT ); if( sys->pool ) picture_pool_Delete( sys->pool ); DosCloseEventSem( sys->ack_event ); free( sys ); }
/** * Close a libcaca video output */ static void Close(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys = vd->sys; picture_pool_Delete(sys->pool); if (sys->dither) cucul_free_dither(sys->dither); caca_free_display(sys->dp); cucul_free_canvas(sys->cv); #if defined(WIN32) && !defined(UNDER_CE) FreeConsole(); #endif free(sys); }
/** * Terminate an output method created by Open */ static void Close(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys = vd->sys; if (sys->pool) picture_pool_Delete(sys->pool); if (!sys->is_hw_accel && sys->picture) picture_Release(sys->picture); CloseDisplay(vd); if (sys->is_tty) TtyExit(vd); free(sys); }
static int DirectXCreatePool(vout_display_t *vd, bool *use_overlay, video_format_t *fmt) { vout_display_sys_t *sys = vd->sys; /* */ *fmt = vd->source; if (DirectXCreatePictureResource(vd, use_overlay, fmt)) return VLC_EGENERIC; /* Create the associated picture */ picture_resource_t resource = { .p_sys = sys->picsys }; picture_t *picture = picture_NewFromResource(fmt, &resource); if (!picture) { DirectXDestroyPictureResource(vd); free(sys->picsys); return VLC_ENOMEM; } /* Wrap it into a picture pool */ picture_pool_configuration_t cfg; memset(&cfg, 0, sizeof(cfg)); cfg.picture_count = 1; cfg.picture = &picture; cfg.lock = DirectXLock; cfg.unlock = DirectXUnlock; sys->pool = picture_pool_NewExtended(&cfg); if (!sys->pool) { picture_Release(picture); DirectXDestroyPictureResource(vd); return VLC_ENOMEM; } return VLC_SUCCESS; } static void DirectXDestroyPool(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (sys->pool) { DirectXDestroyPictureResource(vd); picture_pool_Delete(sys->pool); } sys->pool = NULL; }
static void Clean(vout_display_t *vd) { vout_display_sys_t *sys = vd->sys; if (sys->pool) picture_pool_Delete(sys->pool); sys->pool = NULL; #ifdef MODULE_NAME_IS_wingapi GXCloseDisplay(); #else if (sys->off_dc) DeleteDC(sys->off_dc); if (sys->off_bitmap) DeleteObject(sys->off_bitmap); #endif }
static void ResetPictures (vout_display_t *vd) { vout_display_sys_t *p_sys = vd->sys; if (!p_sys->pool) return; for (unsigned i = 0; i < MAX_PICTURES; i++) { picture_resource_t *res = &p_sys->resource[i]; if (!res->p->p_pixels) break; PictureResourceFree (res, p_sys->conn); } picture_pool_Delete (p_sys->pool); p_sys->pool = NULL; }
/** * Terminate an output method created by Open */ static void Close(vlc_object_t *object) { int i; vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys = vd->sys; cedarx_picture_t pic; msg_Dbg( vd, "done cleaning up sun4i framebuffer" ); if (sys) { libcedarx_display_release_layer(); if (sys->cur) picture_Release(sys->last); if (sys->last) picture_Release(sys->last); if (sys->picture) { for (i = 0; i < sys->picture_count; i ++) { if (sys->picture[i]->p[0].p_pixels || sys->picture[i]->p[1].p_pixels) { memset(&pic, 0, sizeof(cedarx_picture_t)); pic.y[0] = sys->picture[i]->p[0].p_pixels; pic.u[0] = sys->picture[i]->p[1].p_pixels; pic.size_y[0] = sys->picture[i]->p[0].i_pitch * \ sys->picture[i]->p[0].i_lines; pic.size_u[0] = sys->picture[i]->p[1].i_pitch * \ sys->picture[i]->p[1].i_lines; libcedarx_display_free_frame(&pic); } } free(sys->picture); } libcedarx_display_close(); if (sys->pool) { picture_pool_Delete(sys->pool); } free(sys); vd->sys = NULL; } }
/** * Close a SDL video output */ static void Close(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys = vd->sys; if (sys->pool) picture_pool_Delete(sys->pool); if (sys->overlay) { SDL_LockYUVOverlay(sys->overlay); SDL_FreeYUVOverlay(sys->overlay); } SDL_UnlockSurface (sys->display); SDL_FreeSurface(sys->display); vlc_mutex_lock(&sdl_lock); SDL_QuitSubSystem(SDL_INIT_VIDEO); vlc_mutex_unlock(&sdl_lock); free(sys); }
picture_pool_t *picture_pool_Reserve(picture_pool_t *master, int count) { picture_pool_t *pool = Create(master, count); if (!pool) return NULL; int found = 0; for (int i = 0; i < master->picture_count && found < count; i++) { if (master->picture_reserved[i]) continue; assert(atomic_load(&master->picture[i]->gc.refcount) == 0); master->picture_reserved[i] = true; pool->picture[found] = master->picture[i]; pool->picture_reserved[found] = false; found++; } if (found < count) { picture_pool_Delete(pool); return NULL; } return pool; }
/** * This function initializes libcaca vout method. */ static int Open(vlc_object_t *object) { vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys; #if defined(WIN32) && !defined(UNDER_CE) CONSOLE_SCREEN_BUFFER_INFO csbiInfo; SMALL_RECT rect; COORD coord; HANDLE hstdout; if (!AllocConsole()) { msg_Err(vd, "cannot create console"); return VLC_EGENERIC; } hstdout = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); if (!hstdout || hstdout == INVALID_HANDLE_VALUE) { msg_Err(vd, "cannot create screen buffer"); FreeConsole(); return VLC_EGENERIC; } if (!SetConsoleActiveScreenBuffer(hstdout)) { msg_Err(vd, "cannot set active screen buffer"); FreeConsole(); return VLC_EGENERIC; } coord = GetLargestConsoleWindowSize(hstdout); msg_Dbg(vd, "SetConsoleWindowInfo: %ix%i", coord.X, coord.Y); /* Force size for now */ coord.X = 100; coord.Y = 40; if (!SetConsoleScreenBufferSize(hstdout, coord)) msg_Warn(vd, "SetConsoleScreenBufferSize %i %i", coord.X, coord.Y); /* Get the current screen buffer size and window position. */ if (GetConsoleScreenBufferInfo(hstdout, &csbiInfo)) { rect.Top = 0; rect.Left = 0; rect.Right = csbiInfo.dwMaximumWindowSize.X - 1; rect.Bottom = csbiInfo.dwMaximumWindowSize.Y - 1; if (!SetConsoleWindowInfo(hstdout, TRUE, &rect)) msg_Dbg(vd, "SetConsoleWindowInfo failed: %ix%i", rect.Right, rect.Bottom); } #endif /* Allocate structure */ vd->sys = sys = calloc(1, sizeof(*sys)); if (!sys) goto error; sys->cv = cucul_create_canvas(0, 0); if (!sys->cv) { msg_Err(vd, "cannot initialize libcucul"); goto error; } sys->dp = caca_create_display(sys->cv); if (!sys->dp) { msg_Err(vd, "cannot initialize libcaca"); goto error; } if (vd->cfg->display.title) caca_set_display_title(sys->dp, vd->cfg->display.title); else caca_set_display_title(sys->dp, VOUT_TITLE "(Colour AsCii Art)"); /* Fix format */ video_format_t fmt = vd->fmt; if (fmt.i_chroma != VLC_CODEC_RGB32) { fmt.i_chroma = VLC_CODEC_RGB32; fmt.i_rmask = 0x00ff0000; fmt.i_gmask = 0x0000ff00; fmt.i_bmask = 0x000000ff; } /* */ sys->pool = picture_pool_NewFromFormat(&fmt, 1); if (!sys->pool) goto error; /* TODO */ vout_display_info_t info = vd->info; /* Setup vout_display now that everything is fine */ vd->fmt = fmt; vd->info = info; vd->get = Get; vd->prepare = Prepare; vd->display = Display; vd->control = Control; vd->manage = Manage; /* Fix initial state */ vout_display_SendEventFullscreen(vd, false); Refresh(vd); return VLC_SUCCESS; error: if (sys) { if (sys->pool) picture_pool_Delete(sys->pool); if (sys->dither) cucul_free_dither(sys->dither); if (sys->dp) caca_free_display(sys->dp); if (sys->cv) cucul_free_canvas(sys->cv); free(sys); } #if defined(WIN32) && !defined(UNDER_CE) FreeConsole(); #endif return VLC_EGENERIC; }