Made SPU commands go through vout.
authorLaurent Aimar <fenrir@videolan.org>
Mon, 10 May 2010 20:38:49 +0000 (22:38 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 10 May 2010 21:02:22 +0000 (23:02 +0200)
include/vlc_vout.h
modules/control/hotkeys.c
modules/misc/lua/libs/osd.c
src/input/decoder.c
src/input/resource.c
src/libvlccore.sym
src/video_output/video_epg.c
src/video_output/video_output.c
src/video_output/video_text.c
src/video_output/video_widgets.c
src/video_output/vout_intf.c

index 2e14ef7..2d3f0b2 100644 (file)
@@ -163,6 +163,11 @@ VLC_EXPORT( void,            vout_PutPicture,     ( vout_thread_t *, picture_t *
 VLC_EXPORT( void,            vout_HoldPicture,    ( vout_thread_t *, picture_t * ) );
 VLC_EXPORT( void,            vout_ReleasePicture, ( vout_thread_t *, picture_t * ) );
 
+/* */
+VLC_EXPORT( void, vout_PutSubpicture,             ( vout_thread_t *, subpicture_t * ) );
+VLC_EXPORT( int,  vout_RegisterSubpictureChannel, ( vout_thread_t * ) );
+VLC_EXPORT( void, vout_FlushSubpictureChannel,    ( vout_thread_t *, int ) );
+
 /**
  * Return the spu_t object associated to a vout_thread_t.
  *
index cbf1965..b1444d7 100644 (file)
@@ -170,7 +170,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
      * Alternatively, we should keep a reference to the vout thread. */
     if( p_vout && p_vout != p_sys->p_last_vout )
         for( unsigned i = 0; i < CHANNELS_NUMBER; i++ )
-            p_intf->p_sys->p_channels[i] = spu_RegisterChannel( vout_GetSpu( p_vout ) );
+            p_intf->p_sys->p_channels[i] = vout_RegisterSubpictureChannel( p_vout );
     p_sys->p_last_vout = p_vout;
 
     /* Quit */
@@ -1073,9 +1073,8 @@ static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
 {
     if( p_vout )
     {
-        spu_t *p_spu = vout_GetSpu( p_vout );
-        spu_ClearChannel( p_spu, SPU_DEFAULT_CHANNEL );
+        vout_FlushSubpictureChannel( p_vout, SPU_DEFAULT_CHANNEL );
         for( int i = 0; i < CHANNELS_NUMBER; i++ )
-            spu_ClearChannel( p_spu, p_intf->p_sys->p_channels[i]  );
+            vout_FlushSubpictureChannel( p_vout, p_intf->p_sys->p_channels[i]  );
     }
 }
index acba508..8d757a0 100644 (file)
@@ -152,7 +152,7 @@ static int vlclua_spu_channel_register( lua_State *L )
     if( !p_vout )
         return luaL_error( L, "Unable to find vout." );
 
-    i_chan = spu_RegisterChannel( vout_GetSpu( p_vout ) );
+    i_chan = vout_RegisterSubpictureChannel( p_vout );
     vlc_object_release( p_vout );
     lua_pushinteger( L, i_chan );
     return 1;
@@ -167,7 +167,7 @@ static int vlclua_spu_channel_clear( lua_State *L )
     if( !p_vout )
         return luaL_error( L, "Unable to find vout." );
 
-    spu_ClearChannel( vout_GetSpu( p_vout ), i_chan );
+    vout_ClearSubpitureChannel( p_vout, i_chan );
     vlc_object_release( p_vout );
     return 0;
 }
index 9c0aa3d..e5f84dd 100644 (file)
@@ -1593,7 +1593,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic,
                          p_subpic->i_start - SPU_MAX_PREPARE_TIME );
 
         if( !b_reject )
-            spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_subpic );
+            vout_PutSubpicture( p_vout, p_subpic );
         else
             subpicture_Delete( p_subpic );
 
@@ -1935,8 +1935,7 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush
         p_vout = input_resource_HoldVout( p_input->p->p_resource );
 
         if( p_vout && p_owner->p_spu_vout == p_vout )
-            spu_ClearChannel( vout_GetSpu( p_vout ),
-                              p_owner->i_spu_channel );
+            vout_FlushSubpictureChannel( p_vout, p_owner->i_spu_channel );
 
         if( p_vout )
             vlc_object_release( p_vout );
@@ -2098,7 +2097,7 @@ static void DeleteDecoder( decoder_t * p_dec )
         if( p_vout )
         {
             if( p_owner->p_spu_vout == p_vout )
-                spu_ClearChannel( vout_GetSpu( p_vout ), p_owner->i_spu_channel );
+                vout_FlushSubpictureChannel( p_vout, p_owner->i_spu_channel );
             vlc_object_release( p_vout );
         }
     }
@@ -2427,7 +2426,7 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
 
         vlc_mutex_unlock( &p_owner->lock );
 
-        p_owner->i_spu_channel = spu_RegisterChannel( vout_GetSpu( p_vout ) );
+        p_owner->i_spu_channel = vout_RegisterSubpictureChannel( p_vout );
         p_owner->i_spu_order = 0;
         p_owner->p_spu_vout = p_vout;
     }
index ba3cf7e..64cfa52 100644 (file)
@@ -273,7 +273,7 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
         {
             msg_Dbg( p_resource->p_input, "saving a free vout" );
             vout_Flush( p_vout, 1 );
-            spu_ClearChannel( vout_GetSpu( p_vout ), -1 );
+            vout_FlushSubpictureChannel( p_vout, -1 );
 
             p_resource->p_vout_free = p_vout;
         }
index 308f19b..ffb933a 100644 (file)
@@ -614,6 +614,9 @@ vout_GetPicture
 vout_PutPicture
 vout_HoldPicture
 vout_ReleasePicture
+vout_PutSubpicture
+vout_RegisterSubpictureChannel
+vout_FlushSubpictureChannel
 vout_EnableFilter
 vout_GetSnapshot
 vout_GetSpu
index 5f89457..48d31d7 100644 (file)
@@ -315,7 +315,7 @@ int vout_OSDEpg( vout_thread_t *p_vout, input_item_t *p_input )
     p_spu->b_absolute = true;
     p_spu->b_fade = true;
 
-    spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_spu );
+    vout_PutSubpicture( p_vout, p_spu );
 
     return VLC_SUCCESS;
 }
index 8467ca8..cc706c6 100644 (file)
@@ -506,6 +506,19 @@ void vout_DisplayTitle(vout_thread_t *vout, const char *title)
     vout_control_PushString(&vout->p->control, VOUT_CONTROL_OSD_TITLE, title);
 }
 
+void vout_PutSubpicture( vout_thread_t *vout, subpicture_t *subpic )
+{
+    spu_DisplaySubpicture(vout->p->p_spu, subpic);
+}
+int vout_RegisterSubpictureChannel( vout_thread_t *vout )
+{
+    return spu_RegisterChannel(vout->p->p_spu);
+}
+void vout_FlushSubpictureChannel( vout_thread_t *vout, int channel )
+{
+    spu_ClearChannel(vout->p->p_spu, channel);
+}
+
 spu_t *vout_GetSpu( vout_thread_t *p_vout )
 {
     return p_vout->p->p_spu;
index 6ac6af6..8bf7a71 100644 (file)
@@ -118,7 +118,7 @@ void vout_OSDText(vout_thread_t *vout, int channel,
     subpic->b_absolute = false;
     subpic->b_fade     = true;
 
-    spu_DisplaySubpicture(vout_GetSpu(vout), subpic);
+    vout_PutSubpicture(vout, subpic);
 }
 
 void vout_OSDMessage(vout_thread_t *vout, int channel, const char *format, ...)
index f8835d2..5d3e21b 100644 (file)
@@ -309,7 +309,7 @@ static void OSDWidget(vout_thread_t *vout, int channel, int type, int position)
     subpic->b_absolute = true;
     subpic->b_fade     = true;
 
-    spu_DisplaySubpicture(vout_GetSpu(vout), subpic);
+    vout_PutSubpicture(vout, subpic);
 }
 
 void vout_OSDSlider(vout_thread_t *vout, int channel, int position, short type)
index 7c2c8c5..4cf3b5e 100644 (file)
@@ -384,7 +384,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
     p_subpic->i_original_picture_width  *= 4;
     p_subpic->i_original_picture_height *= 4;
 
-    spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_subpic );
+    vout_PutSubpicture( p_vout, p_subpic );
     return VLC_SUCCESS;
 }