Changeset 28422e789b04d3173cfb52c5fe1b3e29bd0c51f9

Show
Ignore:
Timestamp:
16/06/06 21:05:55 (2 years ago)
Author:
Yoann Peronneau <yoann@videolan.org>
git-committer:
Yoann Peronneau <yoann@videolan.org> 1150484755 +0000
git-parent:

[baacaea316cff470f3fe11e52a833ef4a51afe74]

git-author:
Yoann Peronneau <yoann@videolan.org> 1150484755 +0000
Message:

* If we are passed a SUB file as subtitle, just open the IDX instead, if there is one. (Closes: #681)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/input/input.c

    rbaacaea r28422e7  
    4040#include "vlc_interface.h" 
    4141#include "vlc_interaction.h" 
     42 
     43#include "charset.h" 
    4244 
    4345/***************************************************************************** 
     
    24232425    vlc_value_t count; 
    24242426    vlc_value_t list; 
     2427    char *psz_path, *psz_extension; 
    24252428 
    24262429    if( b_check_extension && !subtitles_Filter( psz_subtitle ) ) 
    24272430    { 
    24282431        return VLC_FALSE; 
     2432    } 
     2433 
     2434    /* if we are provided a subtitle.sub file, 
     2435     * see if we don't have a subtitle.idx and use it instead */ 
     2436    psz_path = strdup( psz_subtitle ); 
     2437    if( psz_path ) 
     2438    { 
     2439        psz_extension = strrchr( psz_path, '.'); 
     2440        if( psz_extension && strcmp( psz_extension, ".sub" ) == 0 ) 
     2441        { 
     2442            FILE *f; 
     2443 
     2444            strcpy( psz_extension, ".idx" ); 
     2445            /* FIXME: a portable wrapper for stat() or access() would be more suited */ 
     2446            if( ( f = utf8_fopen( psz_path, "rt" ) ) ) 
     2447            { 
     2448                fclose( f ); 
     2449                msg_Dbg( p_input, "using %s subtitles file instead of %s", 
     2450                         psz_path, psz_subtitle ); 
     2451                strcpy( psz_subtitle, psz_path ); 
     2452            } 
     2453        } 
     2454        free( psz_path ); 
    24292455    } 
    24302456