[vlc-commits] [Git][videolan/vlc][master] input: subtitles: fix subtitle input duplication
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Jan 27 09:14:00 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
34f0e4f6 by François Cartegnie at 2024-01-27T08:53:35+00:00
input: subtitles: fix subtitle input duplication
SPU files triggering auto SPU slave of itself
due to stripped extension in filename comparison
regression by 485005a0b6aa4719044a1c0db7e598b9acd5d0e6
- - - - -
1 changed file:
- src/input/subtitles.c
Changes:
=====================================
src/input/subtitles.c
=====================================
@@ -230,22 +230,26 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
if( !psz_name_org )
return VLC_EGENERIC;
- char *psz_fname = vlc_uri2path( psz_name_org );
- if( !psz_fname )
+ char *psz_fname_ext = vlc_uri2path( psz_name_org );
+ if( !psz_fname_ext )
return VLC_EGENERIC;
- /* extract filename & dirname from psz_fname */
- char *f_dir = strdup( psz_fname );
- if( f_dir == 0 )
+ char *psz_fname = strdup( psz_fname_ext );
+ char *f_dir = strdup( psz_fname_ext );
+ if( psz_fname == NULL || f_dir == NULL )
{
+ free( psz_fname_ext );
free( psz_fname );
+ free( f_dir );
return VLC_ENOMEM;
}
+ /* extract filename & dirname from psz_fname */
char *f_fname_trim = strrchr( psz_fname, DIR_SEP_CHAR );
if( !f_fname_trim )
{
free( f_dir );
+ free( psz_fname_ext );
free( psz_fname );
return VLC_EGENERIC;
}
@@ -332,7 +336,7 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
if( asprintf( &path, psz_format, psz_dir, psz_name ) < 0 )
continue;
- if( strcmp( path, psz_fname )
+ if( strcmp( path, psz_fname_ext )
&& vlc_stat( path, &st ) == 0
&& S_ISREG( st.st_mode ) )
{
@@ -363,6 +367,7 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
}
free( f_dir );
free( psz_fname );
+ free( psz_fname_ext );
for( int i = 0; i < i_slaves; i++ )
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/34f0e4f6b882ff1acebb986f17ab5032f93e6891
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/34f0e4f6b882ff1acebb986f17ab5032f93e6891
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list