Changeset 1559e11e0001f39c791289c2c7f3734277934bdc
- 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
| rcefad26 |
r1559e11 |
|
| 30 | 30 | #include <vlc/input.h> |
|---|
| 31 | 31 | |
|---|
| | 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 | |
|---|
| 32 | 42 | #include "vlc_keys.h" |
|---|
| 33 | 43 | #include "iso_lang.h" |
|---|
| … | … | |
| 52 | 62 | add_integer( "dvdnav-caching", DEFAULT_PTS_DELAY / 1000, NULL, |
|---|
| 53 | 63 | CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE ); |
|---|
| 54 | | set_capability( "access_demux", 0 ); |
|---|
| | 64 | set_capability( "access_demux", 5 ); |
|---|
| 55 | 65 | add_shortcut( "dvd" ); |
|---|
| 56 | 66 | add_shortcut( "dvdnav" ); |
|---|
| … | … | |
| 122 | 132 | static void ButtonUpdate( demux_t * ); |
|---|
| 123 | 133 | |
|---|
| | 134 | static int ProbeDVD( demux_t *, char * ); |
|---|
| | 135 | |
|---|
| 124 | 136 | /***************************************************************************** |
|---|
| 125 | 137 | * DemuxOpen: |
|---|
| … | … | |
| 139 | 151 | return VLC_EGENERIC; |
|---|
| 140 | 152 | } |
|---|
| | 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 ); |
|---|
| 141 | 163 | |
|---|
| 142 | 164 | /* Open dvdnav */ |
|---|
| … | … | |
| 780 | 802 | #endif |
|---|
| 781 | 803 | |
|---|
| 782 | | msg_Dbg( p_this, "dvdroot=%s title=%d chapter=%d angle=%d", |
|---|
| 783 | | psz_source, *i_title, *i_chapter, *i_angle ); |
|---|
| 784 | | |
|---|
| 785 | 804 | return psz_source; |
|---|
| 786 | 805 | } |
|---|
| … | … | |
| 1318 | 1337 | return VLC_SUCCESS; |
|---|
| 1319 | 1338 | } |
|---|
| | 1339 | |
|---|
| | 1340 | /***************************************************************************** |
|---|
| | 1341 | * ProbeDVD: very weak probing that avoids going too often into a dvdnav_open() |
|---|
| | 1342 | *****************************************************************************/ |
|---|
| | 1343 | static 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 | } |
|---|
| rfb820b4 |
r1559e11 |
|
| 45 | 45 | vlc_module_begin(); |
|---|
| 46 | 46 | set_description( _("VCD input") ); |
|---|
| 47 | | set_capability( "access2", 10 ); |
|---|
| | 47 | set_capability( "access2", 60 ); |
|---|
| 48 | 48 | set_callbacks( Open, Close ); |
|---|
| 49 | 49 | |
|---|
| r7978642 |
r1559e11 |
|
| 1456 | 1456 | |
|---|
| 1457 | 1457 | /* Try access_demux if no demux given */ |
|---|
| 1458 | | if( *psz_access && *psz_demux == '\0' ) |
|---|
| | 1458 | if( *psz_demux == '\0' ) |
|---|
| 1459 | 1459 | { |
|---|
| 1460 | 1460 | in->p_demux = demux2_New( p_input, psz_access, psz_demux, psz_path, |
|---|