]> git.sesse.net Git - vlc/blobdiff - modules/codec/cc.c
Added support for avcodec SAMPLE_FMT_*.
[vlc] / modules / codec / cc.c
index 337ccad7e31e03037170f9be3975d5465d93c247..e00afb3742d90947be39d6658afe7e7b17d338e9 100644 (file)
@@ -37,7 +37,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <vlc_codec.h>
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
-vlc_module_begin();
-    set_shortname( N_("CC 608/708"));
-    set_description( N_("Closed Captions decoder") );
-    set_capability( "decoder", 50 );
-    set_callbacks( Open, Close );
-vlc_module_end();
+vlc_module_begin ()
+    set_shortname( N_("CC 608/708"))
+    set_description( N_("Closed Captions decoder") )
+    set_capability( "decoder", 50 )
+    set_callbacks( Open, Close )
+vlc_module_end ()
 
 /*****************************************************************************
  * Local prototypes
@@ -329,7 +329,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
         EnsureUTF8( psz_html );
 
     /* Create the subpicture unit */
-    p_spu = p_dec->pf_spu_buffer_new( p_dec );
+    p_spu = decoder_NewSubpicture( p_dec );
     if( !p_spu )
     {
         msg_Warn( p_dec, "can't get spu buffer" );
@@ -338,29 +338,27 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
         return NULL;
     }
 
-    p_spu->b_pausable = true;
-
     /* Create a new subpicture region */
     memset( &fmt, 0, sizeof(video_format_t) );
     fmt.i_chroma = VLC_FOURCC('T','E','X','T');
     fmt.i_aspect = 0;
     fmt.i_width = fmt.i_height = 0;
     fmt.i_x_offset = fmt.i_y_offset = 0;
-    p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_dec), &fmt );
+    p_spu->p_region = subpicture_region_New( &fmt );
     if( !p_spu->p_region )
     {
         msg_Err( p_dec, "cannot allocate SPU region" );
         free( psz_subtitle );
         free( psz_html );
-        p_dec->pf_spu_buffer_del( p_dec, p_spu );
+        decoder_DeleteSubpicture( p_dec, p_spu );
         return NULL;
     }
 
     /* Decode and format the subpicture unit */
     /* Normal text subs, easy markup */
     p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM;// | SUBPICTURE_ALIGN_LEFT;// | p_sys->i_align;
-    p_spu->i_x = 0; //p_sys->i_align ? 20 : 0;
-    p_spu->i_y = 10;
+    p_spu->p_region->i_x = 0; //p_sys->i_align ? 20 : 0;
+    p_spu->p_region->i_y = 10;
 
     p_spu->p_region->psz_text = psz_subtitle;
     p_spu->p_region->psz_html = psz_html;
@@ -375,6 +373,8 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
 
 static subpicture_t *Convert( decoder_t *p_dec, block_t *p_block )
 {
+    assert( p_block );
+
     decoder_sys_t *p_sys = p_dec->p_sys;
     const int64_t i_pts = p_block->i_pts;
     bool b_changed = false;
@@ -391,12 +391,10 @@ static subpicture_t *Convert( decoder_t *p_dec, block_t *p_block )
     if( p_block )
         block_Release( p_block );
 
-    static int64_t i_last = 0;
-    if( b_changed )//&& i_pts - i_last > 100*1000 )
+    if( b_changed )
     {
         char *psz_subtitle = Eia608Text( &p_sys->eia608, false );
         char *psz_html     = NULL;//Eia608Text( &p_sys->eia608, true );
-        i_last = i_pts;
         return Subtitle( p_dec, psz_subtitle, psz_html, i_pts );
     }
     return NULL;