XCB: develop picture core initialization
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 26 Apr 2009 13:10:19 +0000 (16:10 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 26 Apr 2009 14:37:49 +0000 (17:37 +0300)
modules/video_output/xcb/common.c
modules/video_output/xcb/x11.c
modules/video_output/xcb/xcb_vlc.h
modules/video_output/xcb/xvideo.c

index b6d8f44..6bfac3f 100644 (file)
@@ -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;
 
index 4dea7da..c223212 100644 (file)
@@ -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);
 }
 
 /**
index ee4490c..eed941d 100644 (file)
@@ -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);
index 85a1a52..6d908b0 100644 (file)
@@ -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);
 }
 
 /**