X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fdvbsub.c;h=8e90df80fce0cd4097491f6a2a134a44755bbe0e;hb=f17a9101783b93d2a482bceea93efb707c35fc7d;hp=0310fa4441fe32f69c2c0fcc60f971d5c51f63cf;hpb=0357e2cf82ad87897a43ea3b5a2540aacff504a7;p=vlc diff --git a/modules/codec/dvbsub.c b/modules/codec/dvbsub.c index 0310fa4441..8e90df80fc 100644 --- a/modules/codec/dvbsub.c +++ b/modules/codec/dvbsub.c @@ -45,11 +45,10 @@ #include #include -#include #include #include -#include "vlc_bits.h" +#include /* #define DEBUG_DVBSUB 1 */ @@ -86,29 +85,30 @@ static int OpenEncoder ( vlc_object_t * ); static void CloseEncoder( vlc_object_t * ); static block_t *Encode ( encoder_t *, subpicture_t * ); -vlc_module_begin(); +vlc_module_begin () # define DVBSUB_CFG_PREFIX "dvbsub-" - set_description( N_("DVB subtitles decoder") ); - set_capability( "decoder", 50 ); - set_category( CAT_INPUT ); - set_subcategory( SUBCAT_INPUT_SCODEC ); - set_callbacks( Open, Close ); - - add_integer( DVBSUB_CFG_PREFIX "position", 8, NULL, POS_TEXT, POS_LONGTEXT, true ); - change_integer_list( pi_pos_values, ppsz_pos_descriptions, NULL ); - add_integer( DVBSUB_CFG_PREFIX "x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, false ); - add_integer( DVBSUB_CFG_PREFIX "y", -1, NULL, POSY_TEXT, POSY_LONGTEXT, false ); + set_description( N_("DVB subtitles decoder") ) + set_shortname( N_("DVB subtitles") ) + set_capability( "decoder", 50 ) + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_SCODEC ) + set_callbacks( Open, Close ) + + add_integer( DVBSUB_CFG_PREFIX "position", 8, NULL, POS_TEXT, POS_LONGTEXT, true ) + change_integer_list( pi_pos_values, ppsz_pos_descriptions, NULL ) + add_integer( DVBSUB_CFG_PREFIX "x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, false ) + add_integer( DVBSUB_CFG_PREFIX "y", -1, NULL, POSY_TEXT, POSY_LONGTEXT, false ) # define ENC_CFG_PREFIX "sout-dvbsub-" - add_submodule(); - set_description( N_("DVB subtitles encoder") ); - set_capability( "encoder", 100 ); - set_callbacks( OpenEncoder, CloseEncoder ); + add_submodule () + set_description( N_("DVB subtitles encoder") ) + set_capability( "encoder", 100 ) + set_callbacks( OpenEncoder, CloseEncoder ) - add_integer( ENC_CFG_PREFIX "x", -1, NULL, ENC_POSX_TEXT, ENC_POSX_LONGTEXT, false ); - add_integer( ENC_CFG_PREFIX "y", -1, NULL, ENC_POSY_TEXT, ENC_POSY_LONGTEXT, false ); - add_obsolete_integer( ENC_CFG_PREFIX "timeout" ); /* Suppressed since 0.8.5 */ -vlc_module_end(); + add_integer( ENC_CFG_PREFIX "x", -1, NULL, ENC_POSX_TEXT, ENC_POSX_LONGTEXT, false ) + add_integer( ENC_CFG_PREFIX "y", -1, NULL, ENC_POSY_TEXT, ENC_POSY_LONGTEXT, false ) + add_obsolete_integer( ENC_CFG_PREFIX "timeout" ) /* Suppressed since 0.8.5 */ +vlc_module_end () static const char *const ppsz_enc_options[] = { "x", "y", NULL }; @@ -295,7 +295,7 @@ static int Open( vlc_object_t *p_this ) vlc_value_t val; int i_posx, i_posy; - if( p_dec->fmt_in.i_codec != VLC_FOURCC('d','v','b','s') ) + if( p_dec->fmt_in.i_codec != VLC_CODEC_DVBS ) { return VLC_EGENERIC; } @@ -339,7 +339,8 @@ static int Open( vlc_object_t *p_this ) p_sys->i_spu_y = i_posy; } - es_format_Init( &p_dec->fmt_out, SPU_ES, VLC_FOURCC( 'd','v','b','s' ) ); + p_dec->fmt_out.i_cat = SPU_ES; + p_dec->fmt_out.i_codec = 0; default_clut_init( p_dec ); @@ -1535,12 +1536,12 @@ static subpicture_t *render( decoder_t *p_dec ) continue; } - /* FIXME: don't create a subpicture region with VLC_FOURCC YUVP + /* FIXME: don't create a subpicture region with VLC CODEC YUVP * when it actually is a TEXT region */ /* Create new SPU region */ memset( &fmt, 0, sizeof(video_format_t) ); - fmt.i_chroma = VLC_FOURCC('Y','U','V','P'); + fmt.i_chroma = VLC_CODEC_YUVP; fmt.i_aspect = 0; /* 0 means use aspect ratio of background video */ fmt.i_width = fmt.i_visible_width = p_region->i_width; fmt.i_height = fmt.i_visible_height = p_region->i_height; @@ -1593,7 +1594,7 @@ static subpicture_t *render( decoder_t *p_dec ) /* Create new SPU region */ memset( &fmt, 0, sizeof(video_format_t) ); - fmt.i_chroma = VLC_FOURCC('T','E','X','T'); + fmt.i_chroma = VLC_CODEC_TEXT; fmt.i_aspect = VOUT_ASPECT_FACTOR; fmt.i_width = fmt.i_visible_width = p_region->i_width; fmt.i_height = fmt.i_visible_height = p_region->i_height; @@ -1657,7 +1658,7 @@ static int OpenEncoder( vlc_object_t *p_this ) encoder_sys_t *p_sys; vlc_value_t val; - if( ( p_enc->fmt_out.i_codec != VLC_FOURCC('d','v','b','s') ) && + if( ( p_enc->fmt_out.i_codec != VLC_CODEC_DVBS ) && !p_enc->b_force ) { return VLC_EGENERIC; @@ -1669,7 +1670,7 @@ static int OpenEncoder( vlc_object_t *p_this ) p_enc->p_sys = p_sys; p_enc->pf_encode_sub = Encode; - p_enc->fmt_out.i_codec = VLC_FOURCC('d','v','b','s'); + p_enc->fmt_out.i_codec = VLC_CODEC_DVBS; p_enc->fmt_out.subs.dvb.i_id = 1 << 16 | 1; config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg ); @@ -1690,8 +1691,8 @@ static int OpenEncoder( vlc_object_t *p_this ) return VLC_SUCCESS; } -/* FIXME: this routine is a hack to convert VLC_FOURCC('Y','U','V','A') - * into VLC_FOURCC('Y','U','V','P') +/* FIXME: this routine is a hack to convert VLC_CODEC_YUVA + * into VLC_CODEC_YUVP */ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic ) { @@ -1720,7 +1721,7 @@ static subpicture_t *YuvaYuvp( subpicture_t *p_subpic ) #ifdef DEBUG_DVBSUB msg_Dbg( p_enc, "YuvaYuvp: i_pixels=%d, i_iterator=%d", i_pixels, i_iterator ); #endif - p_fmt->i_chroma = VLC_FOURCC('Y','U','V','P'); + p_fmt->i_chroma = VLC_CODEC_YUVP; p_fmt->p_palette = (video_palette_t *) malloc( sizeof( video_palette_t ) ); if( !p_fmt->p_palette ) break; p_fmt->p_palette->i_entries = 0; @@ -1907,11 +1908,11 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic ) if( !p_subpic || !p_subpic->p_region ) return NULL; - /* FIXME: this is a hack to convert VLC_FOURCC('Y','U','V','A') into - * VLC_FOURCC('Y','U','V','P') + /* FIXME: this is a hack to convert VLC_CODEC_YUVA into + * VLC_CODEC_YUVP */ p_region = p_subpic->p_region; - if( p_region->fmt.i_chroma == VLC_FOURCC('Y','U','V','A') ) + if( p_region->fmt.i_chroma == VLC_CODEC_YUVA ) { p_temp = YuvaYuvp( p_subpic ); if( !p_temp ) @@ -1925,8 +1926,8 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic ) /* Sanity check */ if( !p_region ) return NULL; - if( ( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') ) && - ( p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) ) + if( ( p_region->fmt.i_chroma != VLC_CODEC_TEXT ) && + ( p_region->fmt.i_chroma != VLC_CODEC_YUVP ) ) { char psz_fourcc[5]; memset( &psz_fourcc, 0, sizeof( psz_fourcc ) ); @@ -2111,7 +2112,7 @@ static void encode_clut( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic ) /* Sanity check */ if( !p_region ) return; - if( p_region->fmt.i_chroma == VLC_FOURCC('Y','U','V','P') ) + if( p_region->fmt.i_chroma == VLC_CODEC_YUVP ) { p_pal = p_region->fmt.p_palette; } @@ -2165,7 +2166,7 @@ static void encode_region_composition( encoder_t *p_enc, bs_t *s, { int i_entries = 4, i_depth = 0x1, i_bg = 0; bool b_text = - ( p_region->fmt.i_chroma == VLC_FOURCC('T','E','X','T') ); + ( p_region->fmt.i_chroma == VLC_CODEC_TEXT ); if( !b_text ) { @@ -2251,10 +2252,10 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic ) /* object coding method */ switch( p_region->fmt.i_chroma ) { - case VLC_FOURCC( 'Y','U','V','P' ): + case VLC_CODEC_YUVP: bs_write( s, 2, 0 ); break; - case VLC_FOURCC( 'T','E','X','T' ): + case VLC_CODEC_TEXT: bs_write( s, 2, 1 ); break; default: @@ -2265,7 +2266,7 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic ) bs_write( s, 1, 0 ); /* non modifying color flag */ bs_write( s, 1, 0 ); /* Reserved */ - if( p_region->fmt.i_chroma == VLC_FOURCC( 'T','E','X','T' ) ) + if( p_region->fmt.i_chroma == VLC_CODEC_TEXT ) { int i_size, i; @@ -2324,7 +2325,7 @@ static void encode_pixel_data( encoder_t *p_enc, bs_t *s, unsigned int i_line; /* Sanity check */ - if( p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) return; + if( p_region->fmt.i_chroma != VLC_CODEC_YUVP ) return; /* Encode line by line */ for( i_line = !b_top; i_line < p_region->fmt.i_visible_height;