]> git.sesse.net Git - vlc/blobdiff - modules/codec/libass.c
codec_fake: use var_CreateGet* when applicable.
[vlc] / modules / codec / libass.c
index 4d1e35c9e0ca19afc4d31591e7f8bdd3cffbaf70..9dd811c70b486c33f5ae89361a99e3ce604f4ab4 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * SSA/ASS subtitle decoder using libass.
  *****************************************************************************
- * Copyright (C) 2008 the VideoLAN team
+ * Copyright (C) 2008-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir@videolan.org>
@@ -36,7 +36,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 #include <vlc_osd.h>
 #include <vlc_input.h>
@@ -136,7 +135,7 @@ static int Create( vlc_object_t *p_this )
     decoder_sys_t *p_sys;
     ass_track_t *p_track;
 
-    if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','s','a',' ') )
+    if( p_dec->fmt_in.i_codec != VLC_CODEC_SSA )
         return VLC_EGENERIC;
 
     p_dec->pf_decode_sub = DecodeBlock;
@@ -167,6 +166,9 @@ static int Create( vlc_object_t *p_this )
     ass_process_codec_private( p_track, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
     vlc_mutex_unlock( &libass_lock );
 
+    p_dec->fmt_out.i_cat = SPU_ES;
+    p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
+
     return VLC_SUCCESS;
 }
 
@@ -329,7 +331,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
 
     /* */
     fmt = *p_fmt;
-    fmt.i_chroma = VLC_FOURCC('R','G','B','A');
+    fmt.i_chroma = VLC_CODEC_RGBA;
     fmt.i_width = fmt.i_visible_width;
     fmt.i_height = fmt.i_visible_height;
     fmt.i_bits_per_pixel = 0;
@@ -614,6 +616,7 @@ static void RegionDraw( subpicture_region_t *p_region, ass_image_t *p_img )
 
 static void SubpictureReleaseRegions( spu_t *p_spu, subpicture_t *p_subpic )
 {
+    VLC_UNUSED( p_spu );
     subpicture_region_ChainDelete( p_subpic->p_region );
     p_subpic->p_region = NULL;
 }
@@ -682,6 +685,7 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
     char *psz_font_dir = NULL;
 
 #if defined(WIN32)
+    /* This makes Windows build of VLC hang */
     const UINT uPath = GetSystemWindowsDirectoryW( NULL, 0 );
     if( uPath > 0 )
     {
@@ -706,6 +710,7 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
 
     if( !psz_font_dir )
         goto error;
+    msg_Dbg( p_dec, "Setting libass fontdir: %s", psz_font_dir );
     ass_set_fonts_dir( p_library, psz_font_dir );
     free( psz_font_dir );
 
@@ -748,6 +753,8 @@ error:
     if( p_library )
         ass_library_done( p_library );
 
+    msg_Warn( p_dec, "Libass creation failed" );
+
     free( p_ass );
     vlc_mutex_unlock( &libass_lock );
     return NULL;