[vlc-commits] vout: control SPU directly

Rémi Denis-Courmont git at videolan.org
Mon Aug 13 18:21:13 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 13 15:19:52 2018 +0300| [ab93258e33aa48b9344e3f0d7056e5af60225297] | committer: Rémi Denis-Courmont

vout: control SPU directly

Do not needlessly dispatch through the vout thread.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab93258e33aa48b9344e3f0d7056e5af60225297
---

 src/video_output/control.c      |  2 --
 src/video_output/control.h      |  3 ---
 src/video_output/video_output.c | 45 ++++++++++++++---------------------------
 3 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/src/video_output/control.c b/src/video_output/control.c
index c075a2b942..8b3da801e4 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -45,8 +45,6 @@ void vout_control_cmd_Clean(vout_control_cmd_t *cmd)
         break;
     case VOUT_CONTROL_OSD_TITLE:
     case VOUT_CONTROL_CHANGE_FILTERS:
-    case VOUT_CONTROL_CHANGE_SUB_SOURCES:
-    case VOUT_CONTROL_CHANGE_SUB_FILTERS:
         free(cmd->string);
         break;
     default:
diff --git a/src/video_output/control.h b/src/video_output/control.h
index 0518f45470..6f0e9c5382 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -43,9 +43,6 @@ enum {
     VOUT_CONTROL_OSD_TITLE,             /* string */
     VOUT_CONTROL_CHANGE_FILTERS,        /* string */
     VOUT_CONTROL_CHANGE_INTERLACE,      /* boolean */
-    VOUT_CONTROL_CHANGE_SUB_SOURCES,    /* string */
-    VOUT_CONTROL_CHANGE_SUB_FILTERS,    /* string */
-    VOUT_CONTROL_CHANGE_SUB_MARGIN,     /* integer */
 
     VOUT_CONTROL_PAUSE,
     VOUT_CONTROL_FLUSH,                 /* time */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 63036bfee5..6e25d292a2 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -601,20 +601,29 @@ void vout_ControlChangeFilters(vout_thread_t *vout, const char *filters)
     vout_control_PushString(&vout->p->control, VOUT_CONTROL_CHANGE_FILTERS,
                             filters);
 }
+
 void vout_ControlChangeSubSources(vout_thread_t *vout, const char *filters)
 {
-    vout_control_PushString(&vout->p->control, VOUT_CONTROL_CHANGE_SUB_SOURCES,
-                            filters);
+    vlc_mutex_lock(&vout->p->spu_lock);
+    if (likely(vout->p->spu != NULL))
+        spu_ChangeSources(vout->p->spu, filters);
+    vlc_mutex_unlock(&vout->p->spu_lock);
 }
+
 void vout_ControlChangeSubFilters(vout_thread_t *vout, const char *filters)
 {
-    vout_control_PushString(&vout->p->control, VOUT_CONTROL_CHANGE_SUB_FILTERS,
-                            filters);
+    vlc_mutex_lock(&vout->p->spu_lock);
+    if (likely(vout->p->spu != NULL))
+        spu_ChangeFilters(vout->p->spu, filters);
+    vlc_mutex_unlock(&vout->p->spu_lock);
 }
+
 void vout_ControlChangeSubMargin(vout_thread_t *vout, int margin)
 {
-    vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_CHANGE_SUB_MARGIN,
-                             margin);
+    vlc_mutex_lock(&vout->p->spu_lock);
+    if (likely(vout->p->spu != NULL))
+        spu_ChangeMargin(vout->p->spu, margin);
+    vlc_mutex_unlock(&vout->p->spu_lock);
 }
 
 void vout_ControlChangeViewpoint(vout_thread_t *vout,
@@ -1309,21 +1318,6 @@ static void ThreadDisplayOsdTitle(vout_thread_t *vout, const char *string)
                  string);
 }
 
-static void ThreadChangeSubSources(vout_thread_t *vout, const char *filters)
-{
-    spu_ChangeSources(vout->p->spu, filters);
-}
-
-static void ThreadChangeSubFilters(vout_thread_t *vout, const char *filters)
-{
-    spu_ChangeFilters(vout->p->spu, filters);
-}
-
-static void ThreadChangeSubMargin(vout_thread_t *vout, int margin)
-{
-    spu_ChangeMargin(vout->p->spu, margin);
-}
-
 static void ThreadChangePause(vout_thread_t *vout, bool is_paused, vlc_tick_t date)
 {
     assert(!vout->p->pause.is_on || !is_paused);
@@ -1710,15 +1704,6 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
         ThreadChangeFilters(vout, NULL, vout->p->filter.configuration,
                             cmd.boolean ? 1 : 0, false);
         break;
-    case VOUT_CONTROL_CHANGE_SUB_SOURCES:
-        ThreadChangeSubSources(vout, cmd.string);
-        break;
-    case VOUT_CONTROL_CHANGE_SUB_FILTERS:
-        ThreadChangeSubFilters(vout, cmd.string);
-        break;
-    case VOUT_CONTROL_CHANGE_SUB_MARGIN:
-        ThreadChangeSubMargin(vout, cmd.integer);
-        break;
     case VOUT_CONTROL_PAUSE:
         ThreadChangePause(vout, cmd.pause.is_on, cmd.pause.date);
         break;



More information about the vlc-commits mailing list