Changeset 1559e11e0001f39c791289c2c7f3734277934bdc

Show
Ignore:
Timestamp:
04/08/04 12:40:43 (4 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1091616043 +0000
git-parent:

[ce2d74fd095331aff8bfbc0c3aa8af5f0a908d8b]

git-author:
Gildas Bazin <gbazin@videolan.org> 1091616043 +0000
Message:

* modules/access/dvdnav.c: very basic probing that avoids doing a dvdnav_open() on files when they are not DVD images.
* src/input/input.c: auto-probe access_demux as well.
* modules/access/vcd/vcd.c: raised priority above the file access one.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/dvdnav.c

    rcefad26 r1559e11  
    3030#include <vlc/input.h> 
    3131 
     32#ifdef HAVE_SYS_TYPES_H 
     33#   include <sys/types.h> 
     34#endif 
     35#ifdef HAVE_SYS_STAT_H 
     36#   include <sys/stat.h> 
     37#endif 
     38#ifdef HAVE_FCNTL_H 
     39#   include <fcntl.h> 
     40#endif 
     41 
    3242#include "vlc_keys.h" 
    3343#include "iso_lang.h" 
     
    5262    add_integer( "dvdnav-caching", DEFAULT_PTS_DELAY / 1000, NULL, 
    5363        CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE ); 
    54     set_capability( "access_demux", 0 ); 
     64    set_capability( "access_demux", 5 ); 
    5565    add_shortcut( "dvd" ); 
    5666    add_shortcut( "dvdnav" ); 
     
    122132static void ButtonUpdate( demux_t * ); 
    123133 
     134static int ProbeDVD( demux_t *, char * ); 
     135 
    124136/***************************************************************************** 
    125137 * DemuxOpen: 
     
    139151        return VLC_EGENERIC; 
    140152    } 
     153 
     154    /* Try some simple probing to avoid going through dvdnav_open too often */ 
     155    if( ProbeDVD( p_demux, psz_name ) != VLC_SUCCESS ) 
     156    { 
     157        free( psz_name ); 
     158        return VLC_EGENERIC; 
     159    } 
     160 
     161    msg_Dbg( p_this, "dvdroot=%s title=%d chapter=%d angle=%d", 
     162             psz_name, i_title, i_chapter, i_angle ); 
    141163 
    142164    /* Open dvdnav */ 
     
    780802#endif 
    781803 
    782     msg_Dbg( p_this, "dvdroot=%s title=%d chapter=%d angle=%d", 
    783              psz_source, *i_title, *i_chapter, *i_angle ); 
    784  
    785804    return psz_source; 
    786805} 
     
    13181337    return VLC_SUCCESS; 
    13191338} 
     1339 
     1340/***************************************************************************** 
     1341 * ProbeDVD: very weak probing that avoids going too often into a dvdnav_open() 
     1342 *****************************************************************************/ 
     1343static int ProbeDVD( demux_t *p_demux, char *psz_name ) 
     1344{ 
     1345#ifdef HAVE_SYS_STAT_H 
     1346    struct stat stat_info; 
     1347    uint8_t pi_anchor[2]; 
     1348    uint16_t i_tag_id = 0; 
     1349    int i_fd, i_ret; 
     1350 
     1351    if( stat( psz_name, &stat_info ) || !S_ISREG( stat_info.st_mode ) ) 
     1352    { 
     1353        /* Let dvdnav_open() do the probing */ 
     1354        return VLC_SUCCESS; 
     1355    } 
     1356 
     1357    if( (i_fd = open( psz_name, O_RDONLY )) == -1 ) 
     1358    { 
     1359        /* Let dvdnav_open() do the probing */ 
     1360        return VLC_SUCCESS; 
     1361    } 
     1362 
     1363    /* Try to find the anchor (2 bytes at LBA 256) */ 
     1364    i_ret = VLC_SUCCESS; 
     1365    if( lseek( i_fd, 256 * DVD_VIDEO_LB_LEN, SEEK_SET ) == -1 ) 
     1366    { 
     1367        i_ret = VLC_EGENERIC; 
     1368    } 
     1369 
     1370    if( read( i_fd, pi_anchor, 2 ) == 2 ) 
     1371    { 
     1372        i_tag_id = GetWLE(pi_anchor); 
     1373        if( i_tag_id != 2 ) i_ret = VLC_EGENERIC; /* Not an anchor */ 
     1374    } 
     1375    else 
     1376    { 
     1377        i_ret = VLC_EGENERIC; 
     1378    } 
     1379 
     1380    close( i_fd ); 
     1381 
     1382    return i_ret; 
     1383#else 
     1384 
     1385    return VLC_SUCCESS; 
     1386#endif 
     1387} 
  • modules/access/vcd/vcd.c

    rfb820b4 r1559e11  
    4545vlc_module_begin(); 
    4646    set_description( _("VCD input") ); 
    47     set_capability( "access2", 10 ); 
     47    set_capability( "access2", 60 ); 
    4848    set_callbacks( Open, Close ); 
    4949 
  • src/input/input.c

    r7978642 r1559e11  
    14561456 
    14571457    /* Try access_demux if no demux given */ 
    1458     if( *psz_access && *psz_demux == '\0' ) 
     1458    if( *psz_demux == '\0' ) 
    14591459    { 
    14601460        in->p_demux = demux2_New( p_input, psz_access, psz_demux, psz_path,