X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Falphamask.c;h=a9f17c23e0bfdc2e9fafa1133ae4813ddcfecc83;hb=056a2b9a08b01403b0111797372a042abab33953;hp=1b219447723446709aacad7528160f29de23ffaf;hpb=036a6a2e9efba5173b5695c44f34b0f01a478d58;p=vlc diff --git a/modules/video_filter/alphamask.c b/modules/video_filter/alphamask.c index 1b21944772..a9f17c23e0 100644 --- a/modules/video_filter/alphamask.c +++ b/modules/video_filter/alphamask.c @@ -1,24 +1,24 @@ /***************************************************************************** * alphamask.c : Alpha layer mask video filter for vlc ***************************************************************************** - * Copyright (C) 2007 the VideoLAN team + * Copyright (C) 2007 VLC authors and VideoLAN * $Id$ * * Authors: Antoine Cellerier * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -34,6 +34,7 @@ #include #include +#include #define ALPHAMASK_HELP N_( \ "Use an image's alpha channel as a transparency mask." ) @@ -65,11 +66,10 @@ vlc_module_begin () set_category( CAT_VIDEO ) set_subcategory( SUBCAT_VIDEO_VFILTER ) set_capability( "video filter2", 0 ) - add_shortcut( "alphamask" ) - add_shortcut( "mask" ) + add_shortcut( "alphamask", "mask" ) set_callbacks( Create, Destroy ) - add_string( CFG_PREFIX "mask", NULL, NULL, MASK_TEXT, + add_loadfile( CFG_PREFIX "mask", NULL, MASK_TEXT, MASK_LONGTEXT, false ) vlc_module_end () @@ -92,7 +92,7 @@ static int Create( vlc_object_t *p_this ) if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_YUVA ) { msg_Err( p_filter, - "Unsupported input chroma \"%4s\". " + "Unsupported input chroma \"%4.4s\". " "Alphamask can only use \"YUVA\".", (char*)&p_filter->fmt_in.video.i_chroma ); return VLC_EGENERIC; @@ -107,12 +107,8 @@ static int Create( vlc_object_t *p_this ) config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg ); - vlc_mutex_init( &p_sys->mask_lock ); psz_string = var_CreateGetStringCommand( p_filter, CFG_PREFIX "mask" ); - var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback, - p_filter ); - p_sys->p_mask = NULL; if( psz_string && *psz_string ) { LoadMask( p_filter, psz_string ); @@ -120,8 +116,13 @@ static int Create( vlc_object_t *p_this ) msg_Err( p_filter, "Error while loading mask (%s).", psz_string ); } + else + p_sys->p_mask = NULL; free( psz_string ); + vlc_mutex_init( &p_sys->mask_lock ); + var_AddCallback( p_filter, CFG_PREFIX "mask", MaskCallback, + p_filter ); p_filter->pf_video_filter = Filter; return VLC_SUCCESS; @@ -181,8 +182,10 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename ) if( p_filter->p_sys->p_mask ) picture_Release( p_filter->p_sys->p_mask ); p_image = image_HandlerCreate( p_filter ); + char *psz_url = vlc_path2uri( psz_filename, NULL ); p_filter->p_sys->p_mask = - image_ReadUrl( p_image, psz_filename, &fmt_in, &fmt_out ); + image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out ); + free( psz_url ); image_HandlerDelete( p_image ); }