X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcodec%2Fsubtitles%2Fsubsusf.c;h=54b303194daa182f53ea3248fd6b6715fcc2d8ba;hb=6f121876e5fcab04c7203fb259df7d80be98a4b0;hp=717f8da1272fa517d270a0d7c036781d8f531ff7;hpb=681ac9f14efd4a8611e7868004f59d5bf4f84d71;p=vlc diff --git a/modules/codec/subtitles/subsusf.c b/modules/codec/subtitles/subsusf.c index 717f8da127..54b303194d 100644 --- a/modules/codec/subtitles/subsusf.c +++ b/modules/codec/subtitles/subsusf.c @@ -40,8 +40,8 @@ static int ParseImageAttachments( decoder_t *p_dec ); static subpicture_t *ParseText ( decoder_t *, block_t * ); static void ParseUSFHeader( decoder_t * ); -static subpicture_region_t *ParseUSFString( decoder_t *, char *, subpicture_t * ); -static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, subpicture_t *p_spu, const char *psz_filename, int i_transparent_color ); +static subpicture_region_t *ParseUSFString( decoder_t *, char * ); +static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, const char *psz_filename, int i_transparent_color ); /***************************************************************************** * Module descriptor. @@ -68,7 +68,7 @@ static int OpenDecoder( vlc_object_t *p_this ) decoder_t *p_dec = (decoder_t*)p_this; decoder_sys_t *p_sys; - if( p_dec->fmt_in.i_codec != VLC_FOURCC('u','s','f',' ') ) + if( p_dec->fmt_in.i_codec != VLC_CODEC_USF ) return VLC_EGENERIC; /* Allocate the memory needed to store the decoder's structure */ @@ -220,7 +220,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block ) } /* Decode USF strings */ - p_spu->p_region = ParseUSFString( p_dec, psz_subtitle, p_spu ); + p_spu->p_region = ParseUSFString( p_dec, psz_subtitle ); p_spu->i_start = p_block->i_pts; p_spu->i_stop = p_block->i_pts + p_block->i_length; @@ -372,7 +372,6 @@ static void SetupPositions( subpicture_region_t *p_region, char *psz_subtitle ) } static subpicture_region_t *CreateTextRegion( decoder_t *p_dec, - subpicture_t *p_spu, char *psz_subtitle, int i_len, int i_sys_align ) @@ -383,7 +382,7 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec, /* Create a new subpicture 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 = 0; fmt.i_width = fmt.i_height = 0; fmt.i_x_offset = fmt.i_y_offset = 0; @@ -488,7 +487,7 @@ static int ParseImageAttachments( decoder_t *p_dec ) memset( &fmt_out, 0, sizeof( video_format_t)); fmt_in.i_chroma = type; - fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); + fmt_out.i_chroma = VLC_CODEC_YUVA; /* Find a suitable decoder module */ if( module_exists( "sdl_image" ) ) @@ -830,11 +829,9 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader ) static subpicture_region_t *ParseUSFString( decoder_t *p_dec, - char *psz_subtitle, - subpicture_t *p_spu_in ) + char *psz_subtitle ) { decoder_sys_t *p_sys = p_dec->p_sys; - subpicture_t *p_spu = p_spu_in; subpicture_region_t *p_region_first = NULL; subpicture_region_t *p_region_upto = p_region_first; @@ -856,7 +853,6 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec, psz_end += strcspn( psz_end, ">" ) + 1; p_text_region = CreateTextRegion( p_dec, - p_spu, psz_subtitle, psz_end - psz_subtitle, p_sys->i_align ); @@ -895,7 +891,6 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec, psz_end += strcspn( psz_end, ">" ) + 1; p_text_region = CreateTextRegion( p_dec, - p_spu, psz_subtitle, psz_end - psz_subtitle, p_sys->i_align ); @@ -949,7 +944,7 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec, char *psz_filename = strndup( &psz_content[1], psz_end - &psz_content[1] ); if( psz_filename ) { - p_image_region = LoadEmbeddedImage( p_dec, p_spu, + p_image_region = LoadEmbeddedImage( p_dec, psz_filename, i_transparent ); free( psz_filename ); } @@ -1138,17 +1133,15 @@ static char *CreatePlainText( char *psz_subtitle ) * download and resize image located at psz_url ***************************************************************************/ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, - subpicture_t *p_spu, const char *psz_filename, int i_transparent_color ) { decoder_sys_t *p_sys = p_dec->p_sys; subpicture_region_t *p_region; video_format_t fmt_out; - int k; picture_t *p_pic = NULL; - for( k = 0; k < p_sys->i_images; k++ ) + for( int k = 0; k < p_sys->i_images; k++ ) { if( p_sys->pp_images && !strcmp( p_sys->pp_images[k]->psz_filename, psz_filename ) ) @@ -1167,7 +1160,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, /* Display the feed's image */ memset( &fmt_out, 0, sizeof( video_format_t)); - fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); + fmt_out.i_chroma = VLC_CODEC_YUVA; fmt_out.i_aspect = VOUT_ASPECT_FACTOR; fmt_out.i_sar_num = fmt_out.i_sar_den = 1; fmt_out.i_width = @@ -1181,7 +1174,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, msg_Err( p_dec, "cannot allocate SPU region" ); return NULL; } - assert( p_pic->format.i_chroma == VLC_FOURCC('Y','U','V','A') ); + assert( p_pic->format.i_chroma == VLC_CODEC_YUVA ); /* FIXME the copy is probably not needed anymore */ picture_CopyPixels( p_region->p_picture, p_pic ); @@ -1201,7 +1194,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, int i_u = ( ( -38 * i_r - 74 * i_g + 112 * i_b + 128 ) >> 8 ) + 128 ; int i_v = ( ( 112 * i_r - 94 * i_g - 18 * i_b + 128 ) >> 8 ) + 128 ; - assert( p_region->fmt.i_chroma == VLC_FOURCC('Y','U','V','A') ); + assert( p_region->fmt.i_chroma == VLC_CODEC_YUVA ); for( unsigned int y = 0; y < p_region->fmt.i_height; y++ ) { for( unsigned int x = 0; x < p_region->fmt.i_width; x++ )