Commit 18ed9eea authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

XCB: develop picture core initialization

parent 4fbb72f5
......@@ -164,14 +164,10 @@ int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
* format. If a XCB connection pointer is supplied, the segment is attached to
* the X server (MIT-SHM extension).
*/
int PictureInit (vout_thread_t *vout, picture_t *pic, xcb_connection_t *conn)
int PictureAlloc (vout_thread_t *vout, picture_t *pic, size_t size,
xcb_connection_t *conn)
{
assert (pic->i_status == FREE_PICTURE);
vout_InitPicture (vout, pic, vout->output.i_chroma,
vout->output.i_width, vout->output.i_height,
vout->output.i_aspect);
const size_t size = pic->p->i_pitch * pic->p->i_lines;
/* Allocate shared memory segment */
int id = shmget (IPC_PRIVATE, size, IPC_CREAT | 0700);
......@@ -219,7 +215,7 @@ int PictureInit (vout_thread_t *vout, picture_t *pic, xcb_connection_t *conn)
/**
* Release picture private data: detach the shared memory segment.
*/
void PictureDeinit (picture_t *pic, xcb_connection_t *conn)
void PictureFree (picture_t *pic, xcb_connection_t *conn)
{
xcb_shm_seg_t segment = (uintptr_t)pic->p_sys;
......
......@@ -343,7 +343,12 @@ static int Init (vout_thread_t *vout)
break;
if (pic->i_status != FREE_PICTURE)
continue;
if (PictureInit (vout, pic, p_sys->shm ? p_sys->conn : NULL))
vout_InitPicture (vout, pic, vout->output.i_chroma,
vout->output.i_width, vout->output.i_height,
vout->output.i_aspect);
if (PictureAlloc (vout, pic, pic->p->i_pitch * pic->p->i_lines,
p_sys->shm ? p_sys->conn : NULL))
break;
PP_OUTPUTPICTURE[I_OUTPUTPICTURES++] = pic;
}
......@@ -357,7 +362,7 @@ static int Init (vout_thread_t *vout)
static void Deinit (vout_thread_t *vout)
{
for (int i = 0; i < I_OUTPUTPICTURES; i++)
PictureDeinit (PP_OUTPUTPICTURE[i], vout->p_sys->conn);
PictureFree (PP_OUTPUTPICTURE[i], vout->p_sys->conn);
}
/**
......
......@@ -49,5 +49,5 @@ struct vout_window_t *GetWindow (vout_thread_t *obj,
bool *restrict pshm);
int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
unsigned *restrict width, unsigned *restrict height);
int PictureInit (vout_thread_t *vout, picture_t *pic, xcb_connection_t *conn);
void PictureDeinit (picture_t *pic, xcb_connection_t *conn);
int PictureAlloc (vout_thread_t *, picture_t *, size_t, xcb_connection_t *);
void PictureFree (picture_t *pic, xcb_connection_t *conn);
......@@ -448,7 +448,12 @@ static int Init (vout_thread_t *vout)
break;
if (pic->i_status != FREE_PICTURE)
continue;
if (PictureInit (vout, pic, p_sys->shm ? p_sys->conn : NULL))
vout_InitPicture (vout, pic, vout->output.i_chroma,
vout->output.i_width, vout->output.i_height,
vout->output.i_aspect);
if (PictureAlloc (vout, pic, pic->p->i_pitch * pic->p->i_lines,
p_sys->shm ? p_sys->conn : NULL))
break;
PP_OUTPUTPICTURE[I_OUTPUTPICTURES++] = pic;
}
......@@ -464,7 +469,7 @@ static void Deinit (vout_thread_t *vout)
vout_sys_t *p_sys = vout->p_sys;
for (int i = 0; i < I_OUTPUTPICTURES; i++)
PictureDeinit (PP_OUTPUTPICTURE[i], p_sys->conn);
PictureFree (PP_OUTPUTPICTURE[i], p_sys->conn);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment