]> git.sesse.net Git - vlc/commitdiff
Used vout_control_Push for vout_PutSubpicture.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 25 May 2010 19:03:20 +0000 (21:03 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 25 May 2010 19:03:20 +0000 (21:03 +0200)
It will be needed if we want to remove one of the timeout in the main vout
thread. It also avoids 1 access of vout->p->p_spu outside of the vout thread.

src/video_output/control.c
src/video_output/control.h
src/video_output/video_output.c

index 64c96f676ccc877aceafa858d5c9936d3c0dd684..57bb45f89553b332076382849e51507c057713fe 100644 (file)
@@ -39,6 +39,10 @@ void vout_control_cmd_Init(vout_control_cmd_t *cmd, int type)
 void vout_control_cmd_Clean(vout_control_cmd_t *cmd)
 {
     switch (cmd->type) {
+    case VOUT_CONTROL_SUBPICTURE:
+        if (cmd->u.subpicture)
+            subpicture_Delete(cmd->u.subpicture);
+        break;
     case VOUT_CONTROL_OSD_TITLE:
     case VOUT_CONTROL_CHANGE_FILTERS:
     case VOUT_CONTROL_CHANGE_SUB_FILTERS:
index b47cd457bdbe525adabec5afdb0c5c50d7aff5fc..c9c1cf0890f1a8d280f977802b5feb193a3181f6 100644 (file)
@@ -39,6 +39,7 @@ enum {
     VOUT_CONTROL_START,
     VOUT_CONTROL_STOP,
 #endif
+    VOUT_CONTROL_SUBPICTURE,            /* subpicture */
     VOUT_CONTROL_OSD_TITLE,             /* string */
     VOUT_CONTROL_CHANGE_FILTERS,        /* string */
     VOUT_CONTROL_CHANGE_SUB_FILTERS,    /* string */
@@ -92,6 +93,7 @@ typedef struct {
             unsigned height;
         } window;
         const vout_configuration_t *cfg;
+        subpicture_t *subpicture;
     } u;
 } vout_control_cmd_t;
 
index 0bf78c8d73653e78a1c37d0812088db94253cbed..248829ee291e566adba6eb7042d7602e2e296ef8 100644 (file)
@@ -349,7 +349,11 @@ void vout_DisplayTitle(vout_thread_t *vout, const char *title)
 
 void vout_PutSubpicture( vout_thread_t *vout, subpicture_t *subpic )
 {
-    spu_DisplaySubpicture(vout->p->p_spu, subpic);
+    vout_control_cmd_t cmd;
+    vout_control_cmd_Init(&cmd, VOUT_CONTROL_SUBPICTURE);
+    cmd.u.subpicture = subpic;
+
+    vout_control_Push(&vout->p->control, &cmd);
 }
 int vout_RegisterSubpictureChannel( vout_thread_t *vout )
 {
@@ -749,6 +753,11 @@ static void ThreadManage(vout_thread_t *vout,
     vout_ManageWrapper(vout);
 }
 
+static void ThreadDisplaySubpicture(vout_thread_t *vout,
+                                    subpicture_t *subpicture)
+{
+    spu_DisplaySubpicture(vout->p->p_spu, subpicture);
+}
 static void ThreadDisplayOsdTitle(vout_thread_t *vout, const char *string)
 {
     if (!vout->p->title.show)
@@ -1100,6 +1109,10 @@ static void *Thread(void *object)
                 if (ThreadReinit(vout, cmd.u.cfg))
                     return NULL;
                 break;
+            case VOUT_CONTROL_SUBPICTURE:
+                ThreadDisplaySubpicture(vout, cmd.u.subpicture);
+                cmd.u.subpicture = NULL;
+                break;
             case VOUT_CONTROL_OSD_TITLE:
                 ThreadDisplayOsdTitle(vout, cmd.u.string);
                 break;