Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b8ce47bb
Commit
b8ce47bb
authored
May 31, 2001
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Win2000 DVD input by Jon Lech Johansen <jon-vl@nanocrew.net>.
parent
94d3d4d8
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
680 additions
and
213 deletions
+680
-213
AUTHORS
AUTHORS
+1
-0
include/common.h
include/common.h
+26
-26
include/intf_msg.h
include/intf_msg.h
+5
-5
plugins/dvd/dvd_css.c
plugins/dvd/dvd_css.c
+11
-4
plugins/dvd/dvd_ifo.c
plugins/dvd/dvd_ifo.c
+20
-5
plugins/dvd/dvd_ioctl.c
plugins/dvd/dvd_ioctl.c
+241
-24
plugins/dvd/dvd_ioctl.h
plugins/dvd/dvd_ioctl.h
+107
-2
plugins/dvd/dvd_netlist.c
plugins/dvd/dvd_netlist.c
+6
-6
plugins/dvd/dvd_udf.c
plugins/dvd/dvd_udf.c
+29
-7
plugins/dvd/input_dvd.c
plugins/dvd/input_dvd.c
+60
-12
plugins/mpeg/input_es.c
plugins/mpeg/input_es.c
+3
-3
plugins/mpeg/input_ps.c
plugins/mpeg/input_ps.c
+51
-44
plugins/mpeg/input_ps.h
plugins/mpeg/input_ps.h
+3
-7
plugins/mpeg/input_ts.c
plugins/mpeg/input_ts.c
+10
-9
src/audio_output/aout_spdif.c
src/audio_output/aout_spdif.c
+5
-5
src/input/input.c
src/input/input.c
+43
-24
src/misc/mtime.c
src/misc/mtime.c
+52
-27
src/video_output/video_text.c
src/video_output/video_text.c
+7
-3
No files found.
AUTHORS
View file @
b8ce47bb
...
@@ -115,6 +115,7 @@ D: Bug fixes
...
@@ -115,6 +115,7 @@ D: Bug fixes
N: Jon Lech Johansen
N: Jon Lech Johansen
E: jon-vl@nanocrew.net
E: jon-vl@nanocrew.net
D: PS input fixes
D: PS input fixes
D: Win32 port
N: Michel Kaempf
N: Michel Kaempf
E: maxx@via.ecp.fr
E: maxx@via.ecp.fr
...
...
include/common.h
View file @
b8ce47bb
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
* Collection of useful common types and macros definitions
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.3
3 2001/05/31 01:37:08
sam Exp $
* $Id: common.h,v 1.3
4 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
...
@@ -140,7 +140,6 @@ struct es_descriptor_s;
...
@@ -140,7 +140,6 @@ struct es_descriptor_s;
/*****************************************************************************
/*****************************************************************************
* Macros and inline functions
* Macros and inline functions
*****************************************************************************/
*****************************************************************************/
#ifdef NTOHL_IN_SYS_PARAM_H
#ifdef NTOHL_IN_SYS_PARAM_H
# include <sys/param.h>
# include <sys/param.h>
#elif defined(WIN32)
#elif defined(WIN32)
...
@@ -157,10 +156,10 @@ struct es_descriptor_s;
...
@@ -157,10 +156,10 @@ struct es_descriptor_s;
/* MAX and MIN: self explanatory */
/* MAX and MIN: self explanatory */
#ifndef MAX
#ifndef MAX
#define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#
define MAX(a, b) ( ((a) > (b)) ? (a) : (b) )
#endif
#endif
#ifndef MIN
#ifndef MIN
#define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#
define MIN(a, b) ( ((a) < (b)) ? (a) : (b) )
#endif
#endif
/* MSB (big endian)/LSB (little endian) conversions - network order is always
/* MSB (big endian)/LSB (little endian) conversions - network order is always
...
@@ -171,19 +170,19 @@ struct es_descriptor_s;
...
@@ -171,19 +170,19 @@ struct es_descriptor_s;
/* FIXME: hton64 should be declared as an extern inline function to avoid
/* FIXME: hton64 should be declared as an extern inline function to avoid
* border effects (see byteorder.h) */
* border effects (see byteorder.h) */
#if WORDS_BIGENDIAN
#if WORDS_BIGENDIAN
#define hton16 htons
#
define hton16 htons
#define hton32 htonl
#
define hton32 htonl
#define hton64(i) ( i )
#
define hton64(i) ( i )
#define ntoh16 ntohs
#
define ntoh16 ntohs
#define ntoh32 ntohl
#
define ntoh32 ntohl
#define ntoh64(i) ( i )
#
define ntoh64(i) ( i )
#else
#else
#define hton16 htons
#
define hton16 htons
#define hton32 htonl
#
define hton32 htonl
#define hton64(i) ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) )
#
define hton64(i) ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) )
#define ntoh16 ntohs
#
define ntoh16 ntohs
#define ntoh32 ntohl
#
define ntoh32 ntohl
#define ntoh64 hton64
#
define ntoh64 hton64
#endif
#endif
/* Macros with automatic casts */
/* Macros with automatic casts */
...
@@ -194,15 +193,16 @@ struct es_descriptor_s;
...
@@ -194,15 +193,16 @@ struct es_descriptor_s;
/* win32, cl and icl support */
/* win32, cl and icl support */
#if defined( _MSC_VER )
#if defined( _MSC_VER )
typedef
long
off_t
;
typedef
long
off_t
;
#define __attribute__(x)
#
define __attribute__(x)
#define __inline__ __inline
#
define __inline__ __inline
#define strncasecmp strnicmp
#
define strncasecmp strnicmp
#define strcasecmp stricmp
#
define strcasecmp stricmp
#define S_ISBLK(m) (0)
#
define S_ISBLK(m) (0)
#define S_ISCHR(m) (0)
#
define S_ISCHR(m) (0)
#define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
#
define S_ISFIFO(m) (((m)&_S_IFMT) == _S_IFIFO)
#define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
#
define S_ISREG(m) (((m)&_S_IFMT) == _S_IFREG)
#define I64C(x) x
#
define I64C(x) x
#else
#else
#define I64C(x) x##LL
#
define I64C(x) x##LL
#endif
#endif
include/intf_msg.h
View file @
b8ce47bb
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* interface, such as message output. See config.h for output configuration.
* interface, such as message output. See config.h for output configuration.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_msg.h,v 1.1
4 2001/05/31 01:37:08
sam Exp $
* $Id: intf_msg.h,v 1.1
5 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
*
...
@@ -49,11 +49,11 @@ void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line,
...
@@ -49,11 +49,11 @@ void _intf_DbgMsgImm ( char *psz_file, char *psz_function, int i_line,
/* Non-TRACE mode */
/* Non-TRACE mode */
#if defined( _MSC_VER )
#if defined( _MSC_VER )
#define intf_DbgMsg
#
define intf_DbgMsg
#define intf_DbgMsgImm
#
define intf_DbgMsgImm
#else
#else
#define intf_DbgMsg( format, args... )
#
define intf_DbgMsg( format, args... )
#define intf_DbgMsgImm( format, args...)
#
define intf_DbgMsgImm( format, args...)
#endif
#endif
#endif
#endif
...
...
plugins/dvd/dvd_css.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* dvd_css.c: Functions for DVD authentification and unscrambling
* dvd_css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_css.c,v 1.3
0 2001/05/31 01:37:08
sam Exp $
* $Id: dvd_css.c,v 1.3
1 2001/05/31 03:12:49
sam Exp $
*
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Author: Stphane Borel <stef@via.ecp.fr>
*
*
...
@@ -38,9 +38,9 @@
...
@@ -38,9 +38,9 @@
#include <stdlib.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#include <string.h>
#include <string.h>
...
@@ -50,9 +50,11 @@
...
@@ -50,9 +50,11 @@
#include "intf_msg.h"
#include "intf_msg.h"
#include "dvd_css.h"
#include "dvd_css.h"
#ifdef HAVE_CSS
#ifdef HAVE_CSS
#include "dvd_csstables.h"
#
include "dvd_csstables.h"
#endif
/* HAVE_CSS */
#endif
/* HAVE_CSS */
#include "dvd_ioctl.h"
#include "dvd_ioctl.h"
#include "input_dvd.h"
#include "input_dvd.h"
...
@@ -333,8 +335,13 @@ int CSSGetKey( int i_fd, css_t * p_css )
...
@@ -333,8 +335,13 @@ int CSSGetKey( int i_fd, css_t * p_css )
i_pos
=
p_css
->
i_title_pos
;
i_pos
=
p_css
->
i_title_pos
;
do
{
do
{
#if !defined( WIN32 )
i_pos
=
lseek
(
i_fd
,
i_pos
,
SEEK_SET
);
i_pos
=
lseek
(
i_fd
,
i_pos
,
SEEK_SET
);
i_bytes_read
=
read
(
i_fd
,
pi_buf
,
0x800
);
i_bytes_read
=
read
(
i_fd
,
pi_buf
,
0x800
);
#else
i_pos
=
SetFilePointer
(
(
HANDLE
)
i_fd
,
i_pos
,
0
,
FILE_BEGIN
);
ReadFile
(
(
HANDLE
)
i_fd
,
pi_buf
,
0x800
,
&
i_bytes_read
,
NULL
);
#endif
/* PES_scrambling_control */
/* PES_scrambling_control */
if
(
pi_buf
[
0x14
]
&
0x30
)
if
(
pi_buf
[
0x14
]
&
0x30
)
...
...
plugins/dvd/dvd_ifo.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* dvd_ifo.c: Functions for ifo parsing
* dvd_ifo.c: Functions for ifo parsing
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ifo.c,v 1.2
8 2001/05/31 01:37:08
sam Exp $
* $Id: dvd_ifo.c,v 1.2
9 2001/05/31 03:12:49
sam Exp $
*
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Author: Stphane Borel <stef@via.ecp.fr>
*
*
...
@@ -36,9 +36,9 @@
...
@@ -36,9 +36,9 @@
#include <stdlib.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#include <string.h>
#include <string.h>
...
@@ -51,9 +51,9 @@
...
@@ -51,9 +51,9 @@
#include "dvd_udf.h"
#include "dvd_udf.h"
#include "input_dvd.h"
#include "input_dvd.h"
/*
/*
****************************************************************************
* Local prototypes
* Local prototypes
*/
*
****************************************************************************
/
void
CommandRead
(
command_desc_t
);
void
CommandRead
(
command_desc_t
);
static
int
ReadTitle
(
ifo_t
*
,
title_t
*
,
off_t
);
static
int
ReadTitle
(
ifo_t
*
,
title_t
*
,
off_t
);
static
int
FreeTitle
(
title_t
*
);
static
int
FreeTitle
(
title_t
*
);
...
@@ -72,9 +72,18 @@ static int FreeTitleSet ( vts_t * );
...
@@ -72,9 +72,18 @@ static int FreeTitleSet ( vts_t * );
*****************************************************************************/
*****************************************************************************/
static
__inline__
u8
*
FillBuffer
(
ifo_t
*
p_ifo
,
u8
*
pi_buffer
,
off_t
i_pos
)
static
__inline__
u8
*
FillBuffer
(
ifo_t
*
p_ifo
,
u8
*
pi_buffer
,
off_t
i_pos
)
{
{
#if defined( WIN32 )
DWORD
tmp
;
#endif
memset
(
pi_buffer
,
0
,
DVD_LB_SIZE
);
memset
(
pi_buffer
,
0
,
DVD_LB_SIZE
);
#if !defined( WIN32 )
p_ifo
->
i_pos
=
lseek
(
p_ifo
->
i_fd
,
i_pos
,
SEEK_SET
);
p_ifo
->
i_pos
=
lseek
(
p_ifo
->
i_fd
,
i_pos
,
SEEK_SET
);
read
(
p_ifo
->
i_fd
,
pi_buffer
,
DVD_LB_SIZE
);
read
(
p_ifo
->
i_fd
,
pi_buffer
,
DVD_LB_SIZE
);
#else
p_ifo
->
i_pos
=
SetFilePointer
(
(
HANDLE
)
p_ifo
->
i_fd
,
i_pos
,
NULL
,
FILE_BEGIN
);
ReadFile
(
(
HANDLE
)
p_ifo
->
i_fd
,
pi_buffer
,
DVD_LB_SIZE
,
&
tmp
,
NULL
);
#endif
return
pi_buffer
;
return
pi_buffer
;
}
}
...
@@ -1095,9 +1104,15 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
...
@@ -1095,9 +1104,15 @@ static int ReadTitle( ifo_t * p_ifo, title_t * p_title, off_t i_pos )
/* parsing of chapter_map_t: it gives the entry cell for each chapter */
/* parsing of chapter_map_t: it gives the entry cell for each chapter */
if
(
p_title
->
i_chapter_map_start_byte
)
if
(
p_title
->
i_chapter_map_start_byte
)
{
{
#if !defined( WIN32 )
p_ifo
->
i_pos
=
lseek
(
p_ifo
->
i_fd
,
p_ifo
->
i_pos
=
lseek
(
p_ifo
->
i_fd
,
i_start
+
p_title
->
i_chapter_map_start_byte
,
i_start
+
p_title
->
i_chapter_map_start_byte
,
SEEK_SET
);
SEEK_SET
);
#else
p_ifo
->
i_pos
=
SetFilePointer
(
(
HANDLE
)
p_ifo
->
i_fd
,
i_start
+
p_title
->
i_chapter_map_start_byte
,
NULL
,
FILE_BEGIN
);
#endif
p_title
->
chapter_map
.
pi_start_cell
=
p_title
->
chapter_map
.
pi_start_cell
=
malloc
(
p_title
->
i_chapter_nb
*
sizeof
(
chapter_map_t
)
);
malloc
(
p_title
->
i_chapter_nb
*
sizeof
(
chapter_map_t
)
);
...
...
plugins/dvd/dvd_ioctl.c
View file @
b8ce47bb
...
@@ -2,10 +2,11 @@
...
@@ -2,10 +2,11 @@
* dvd_ioctl.c: DVD ioctl replacement function
* dvd_ioctl.c: DVD ioctl replacement function
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.c,v 1.1
5 2001/05/31 01:37:08
sam Exp $
* $Id: dvd_ioctl.c,v 1.1
6 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
* Samuel Hocevar <sam@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
*
*
* This program is free software; you can redistribute it and/or modify
* 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
* it under the terms of the GNU General Public License as published by
...
@@ -30,9 +31,12 @@
...
@@ -30,9 +31,12 @@
#include <string.h>
/* memcpy(), memset() */
#include <string.h>
/* memcpy(), memset() */
#include <sys/types.h>
#include <sys/types.h>
#if !defined( WIN32 )
#if defined( WIN32 )
#include <netinet/in.h>
# include <windows.h>
#include <sys/ioctl.h>
# include <winioctl.h>
#else
# include <netinet/in.h>
# include <sys/ioctl.h>
#endif
#endif
#ifdef DVD_STRUCT_IN_SYS_CDIO_H
#ifdef DVD_STRUCT_IN_SYS_CDIO_H
...
@@ -65,26 +69,6 @@
...
@@ -65,26 +69,6 @@
*****************************************************************************/
*****************************************************************************/
#if defined( SYS_BEOS )
#if defined( SYS_BEOS )
static
void
BeInitRDC
(
raw_device_command
*
,
int
);
static
void
BeInitRDC
(
raw_device_command
*
,
int
);
#define INIT_RDC( TYPE, SIZE ) \
raw_device_command rdc; \
u8 p_buffer[ (SIZE) ]; \
memset( &rdc, 0, sizeof( raw_device_command ) ); \
rdc.data = (char *)p_buffer; \
rdc.data_length = (SIZE); \
BeInitRDC( &rdc, (TYPE) );
#endif
/*****************************************************************************
* Local prototypes, Darwin specific
*****************************************************************************/
#if defined( SYS_DARWIN1_3 )
#define INIT_DVDIOCTL( SIZE ) \
dvdioctl_data_t dvdioctl; \
u8 p_buffer[ (SIZE) ]; \
dvdioctl.p_buffer = p_buffer; \
dvdioctl.i_size = (SIZE); \
dvdioctl.i_keyclass = kCSS_CSS2_CPRM; \
memset( p_buffer, 0, (SIZE) );
#endif
#endif
/*****************************************************************************
/*****************************************************************************
...
@@ -132,6 +116,49 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
...
@@ -132,6 +116,49 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
i_ret
=
0
;
i_ret
=
0
;
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
p_buffer
[
8
];
SCSI_PASS_THROUGH_DIRECT
sptd
;
memset
(
&
sptd
,
0
,
sizeof
(
sptd
)
);
memset
(
&
p_buffer
,
0
,
sizeof
(
p_buffer
)
);
/* When using IOCTL_DVD_READ_STRUCTURE and
DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
is always 6. So we send a raw scsi command instead. */
sptd
.
Length
=
sizeof
(
SCSI_PASS_THROUGH_DIRECT
);
sptd
.
CdbLength
=
12
;
sptd
.
DataIn
=
SCSI_IOCTL_DATA_IN
;
sptd
.
DataTransferLength
=
8
;
sptd
.
TimeOutValue
=
2
;
sptd
.
DataBuffer
=
p_buffer
;
sptd
.
Cdb
[
0
]
=
GPCMD_READ_DVD_STRUCTURE
;
sptd
.
Cdb
[
6
]
=
i_layer
;
sptd
.
Cdb
[
7
]
=
DVD_STRUCT_COPYRIGHT
;
sptd
.
Cdb
[
8
]
=
(
8
>>
8
)
&
0xff
;
sptd
.
Cdb
[
9
]
=
8
&
0xff
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_SCSI_PASS_THROUGH_DIRECT
,
&
sptd
,
sizeof
(
SCSI_PASS_THROUGH_DIRECT
),
&
sptd
,
sizeof
(
SCSI_PASS_THROUGH_DIRECT
),
&
tmp
,
NULL
)
?
0
:
-
1
;
*
pi_copyright
=
p_buffer
[
4
];
}
else
{
/* TODO: add WNASPI support for Win9x */
intf_ErrMsg
(
"css error: DVD ioctls not functional yet"
);
intf_ErrMsg
(
"css error: assuming disc is unencrypted"
);
*
pi_copyright
=
0
;
i_ret
=
0
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -202,6 +229,35 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
...
@@ -202,6 +229,35 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memset
(
p_key
,
0x00
,
2048
);
memset
(
p_key
,
0x00
,
2048
);
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
buffer
[
DVD_DISK_KEY_LENGTH
];
PDVD_COPY_PROTECT_KEY
key
=
(
PDVD_COPY_PROTECT_KEY
)
&
buffer
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
)
);
key
->
KeyLength
=
DVD_DISK_KEY_LENGTH
;
key
->
SessionId
=
*
pi_agid
;
key
->
KeyType
=
DvdDiskKey
;
key
->
KeyFlags
=
0
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_READ_KEY
,
key
,
key
->
KeyLength
,
key
,
key
->
KeyLength
,
&
tmp
,
NULL
)
?
0
:
-
1
;
if
(
i_ret
<
0
)
{
return
i_ret
;
}
memcpy
(
p_key
,
key
->
KeyData
,
2048
);
}
else
{
i_ret
=
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -257,6 +313,22 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
...
@@ -257,6 +313,22 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*
pi_agid
=
p_buffer
[
7
]
>>
6
;
*
pi_agid
=
p_buffer
[
7
]
>>
6
;
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
ULONG
id
;
DWORD
tmp
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_START_SESSION
,
&
tmp
,
4
,
&
id
,
sizeof
(
id
),
&
tmp
,
NULL
)
?
0
:
-
1
;
*
pi_agid
=
id
;
}
else
{
i_ret
=
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -312,6 +384,35 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
...
@@ -312,6 +384,35 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy
(
p_challenge
,
p_buffer
+
4
,
12
);
memcpy
(
p_challenge
,
p_buffer
+
4
,
12
);
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
buffer
[
DVD_CHALLENGE_KEY_LENGTH
];
PDVD_COPY_PROTECT_KEY
key
=
(
PDVD_COPY_PROTECT_KEY
)
&
buffer
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
)
);
key
->
KeyLength
=
DVD_CHALLENGE_KEY_LENGTH
;
key
->
SessionId
=
*
pi_agid
;
key
->
KeyType
=
DvdChallengeKey
;
key
->
KeyFlags
=
0
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_READ_KEY
,
key
,
key
->
KeyLength
,
key
,
key
->
KeyLength
,
&
tmp
,
NULL
)
?
0
:
-
1
;
if
(
i_ret
<
0
)
{
return
i_ret
;
}
memcpy
(
p_challenge
,
key
->
KeyData
,
10
);
}
else
{
i_ret
=
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -369,6 +470,37 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
...
@@ -369,6 +470,37 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
*
pi_asf
=
p_buffer
[
7
]
&
1
;
*
pi_asf
=
p_buffer
[
7
]
&
1
;
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
buffer
[
DVD_ASF_LENGTH
];
PDVD_COPY_PROTECT_KEY
key
=
(
PDVD_COPY_PROTECT_KEY
)
&
buffer
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
)
);
key
->
KeyLength
=
DVD_ASF_LENGTH
;
key
->
SessionId
=
*
pi_agid
;
key
->
KeyType
=
DvdAsf
;
key
->
KeyFlags
=
0
;
((
PDVD_ASF
)
key
->
KeyData
)
->
SuccessFlag
=
*
pi_asf
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_READ_KEY
,
key
,
key
->
KeyLength
,
key
,
key
->
KeyLength
,
&
tmp
,
NULL
)
?
0
:
-
1
;
if
(
i_ret
<
0
)
{
return
i_ret
;
}
*
pi_asf
=
((
PDVD_ASF
)
key
->
KeyData
)
->
SuccessFlag
;
}
else
{
i_ret
=
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -423,6 +555,30 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
...
@@ -423,6 +555,30 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy
(
p_key
,
p_buffer
+
4
,
8
);
memcpy
(
p_key
,
p_buffer
+
4
,
8
);
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
buffer
[
DVD_BUS_KEY_LENGTH
];
PDVD_COPY_PROTECT_KEY
key
=
(
PDVD_COPY_PROTECT_KEY
)
&
buffer
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
)
);
key
->
KeyLength
=
DVD_BUS_KEY_LENGTH
;
key
->
SessionId
=
*
pi_agid
;
key
->
KeyType
=
DvdBusKey1
;
key
->
KeyFlags
=
0
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_READ_KEY
,
key
,
key
->
KeyLength
,
key
,
key
->
KeyLength
,
&
tmp
,
NULL
)
?
0
:
-
1
;
memcpy
(
p_key
,
key
->
KeyData
,
8
);
}
else
{
i_ret
=
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -473,6 +629,19 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
...
@@ -473,6 +629,19 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret
=
ioctl
(
i_fd
,
IODVD_SEND_KEY
,
&
dvdioctl
);
i_ret
=
ioctl
(
i_fd
,
IODVD_SEND_KEY
,
&
dvdioctl
);
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
i_ret
=
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_END_SESSION
,
pi_agid
,
sizeof
(
*
pi_agid
),
NULL
,
0
,
&
tmp
,
NULL
)
?
0
:
-
1
;
}
else
{
i_ret
=
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
i_ret
=
-
1
;
i_ret
=
-
1
;
...
@@ -527,6 +696,30 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
...
@@ -527,6 +696,30 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return
ioctl
(
i_fd
,
IODVD_SEND_KEY
,
&
dvdioctl
);
return
ioctl
(
i_fd
,
IODVD_SEND_KEY
,
&
dvdioctl
);
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
buffer
[
DVD_CHALLENGE_KEY_LENGTH
];
PDVD_COPY_PROTECT_KEY
key
=
(
PDVD_COPY_PROTECT_KEY
)
&
buffer
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
)
);
key
->
KeyLength
=
DVD_CHALLENGE_KEY_LENGTH
;
key
->
SessionId
=
*
pi_agid
;
key
->
KeyType
=
DvdChallengeKey
;
key
->
KeyFlags
=
0
;
memcpy
(
key
->
KeyData
,
p_challenge
,
10
);
return
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_SEND_KEY
,
key
,
key
->
KeyLength
,
key
,
key
->
KeyLength
,
&
tmp
,
NULL
)
?
0
:
-
1
;
}
else
{
return
-
1
;
}
#else
#else
/* DVD ioctls unavailable - do as if the ioctl failed */
/* DVD ioctls unavailable - do as if the ioctl failed */
return
-
1
;
return
-
1
;
...
@@ -569,6 +762,30 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
...
@@ -569,6 +762,30 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
return
ioctl
(
i_fd
,
B_RAW_DEVICE_COMMAND
,
&
rdc
,
sizeof
(
rdc
)
);
return
ioctl
(
i_fd
,
B_RAW_DEVICE_COMMAND
,
&
rdc
,
sizeof
(
rdc
)
);
#elif defined( WIN32 )
if
(
GetVersion
()
<
0x80000000
)
/* NT/Win2000/Whistler */
{
DWORD
tmp
;
u8
buffer
[
DVD_BUS_KEY_LENGTH
];
PDVD_COPY_PROTECT_KEY
key
=
(
PDVD_COPY_PROTECT_KEY
)
&
buffer
;
memset
(
&
buffer
,
0
,
sizeof
(
buffer
)
);
key
->
KeyLength
=
DVD_BUS_KEY_LENGTH
;
key
->
SessionId
=
*
pi_agid
;
key
->
KeyType
=
DvdBusKey2
;
key
->
KeyFlags
=
0
;
memcpy
(
key
->
KeyData
,
p_key
,
8
);
return
DeviceIoControl
(
(
HANDLE
)
i_fd
,
IOCTL_DVD_SEND_KEY
,
key
,
key
->
KeyLength
,
key
,
key
->
KeyLength
,
&
tmp
,
NULL
)
?
0
:
-
1
;
}
else
{
return
-
1
;
}
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN1_3 )
INIT_DVDIOCTL
(
12
);
INIT_DVDIOCTL
(
12
);
...
...
plugins/dvd/dvd_ioctl.h
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* dvd_ioctl.h: DVD ioctl replacement function
* dvd_ioctl.h: DVD ioctl replacement function
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: dvd_ioctl.h,v 1.
8 2001/05/25 04:44
:49 sam Exp $
* $Id: dvd_ioctl.h,v 1.
9 2001/05/31 03:12
:49 sam Exp $
*
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Authors: Samuel Hocevar <sam@zoy.org>
*
*
...
@@ -32,7 +32,37 @@ int ioctl_InvalidateAgid ( int, int * );
...
@@ -32,7 +32,37 @@ int ioctl_InvalidateAgid ( int, int * );
int
ioctl_SendChallenge
(
int
,
int
*
,
u8
*
);
int
ioctl_SendChallenge
(
int
,
int
*
,
u8
*
);
int
ioctl_SendKey2
(
int
,
int
*
,
u8
*
);
int
ioctl_SendKey2
(
int
,
int
*
,
u8
*
);
#ifdef SYS_BEOS
/*****************************************************************************
* Common macro, BeOS specific
*****************************************************************************/
#if defined( SYS_BEOS )
#define INIT_RDC( TYPE, SIZE ) \
raw_device_command rdc; \
u8 p_buffer[ (SIZE) ]; \
memset( &rdc, 0, sizeof( raw_device_command ) ); \
rdc.data = (char *)p_buffer; \
rdc.data_length = (SIZE); \
BeInitRDC( &rdc, (TYPE) );
#endif
/*****************************************************************************
* Common macro, Darwin specific
*****************************************************************************/
#if defined( SYS_DARWIN1_3 )
#define INIT_DVDIOCTL( SIZE ) \
dvdioctl_data_t dvdioctl; \
u8 p_buffer[ (SIZE) ]; \
dvdioctl.p_buffer = p_buffer; \
dvdioctl.i_size = (SIZE); \
dvdioctl.i_keyclass = kCSS_CSS2_CPRM; \
memset( p_buffer, 0, (SIZE) );
#endif
/*****************************************************************************
* Various DVD I/O tables
*****************************************************************************/
#if defined( SYS_BEOS ) || defined( WIN32 )
/* The generic packet command opcodes for CD/DVD Logical Units,
/* The generic packet command opcodes for CD/DVD Logical Units,
* From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
* From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
...
@@ -43,6 +73,81 @@ int ioctl_SendKey2 ( int, int *, u8 * );
...
@@ -43,6 +73,81 @@ int ioctl_SendKey2 ( int, int *, u8 * );
/* DVD struct types */
/* DVD struct types */
#define DVD_STRUCT_COPYRIGHT 0x01
#define DVD_STRUCT_COPYRIGHT 0x01
#define DVD_STRUCT_DISCKEY 0x02
#define DVD_STRUCT_DISCKEY 0x02
#endif
#if defined( WIN32 )
#define IOCTL_DVD_START_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DVD_READ_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DVD_SEND_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DVD_END_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(FILE_DEVICE_CONTROLLER, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
typedef
ULONG
DVD_SESSION_ID
,
*
PDVD_SESSION_ID
;
typedef
enum
{
DvdChallengeKey
=
0x01
,
DvdBusKey1
,
DvdBusKey2
,
DvdTitleKey
,
DvdAsf
,
DvdSetRpcKey
=
0x6
,
DvdGetRpcKey
=
0x8
,
DvdDiskKey
=
0x80
,
DvdInvalidateAGID
=
0x3f
}
DVD_KEY_TYPE
;
typedef
struct
_DVD_COPY_PROTECT_KEY
{
ULONG
KeyLength
;
DVD_SESSION_ID
SessionId
;
DVD_KEY_TYPE
KeyType
;
ULONG
KeyFlags
;
union
{
struct
{
ULONG
FileHandle
;
ULONG
Reserved
;
// used for NT alignment
};
LARGE_INTEGER
TitleOffset
;
}
Parameters
;
UCHAR
KeyData
[
0
];
}
DVD_COPY_PROTECT_KEY
,
*
PDVD_COPY_PROTECT_KEY
;
typedef
struct
_DVD_ASF
{
UCHAR
Reserved0
[
3
];
UCHAR
SuccessFlag
:
1
;
UCHAR
Reserved1
:
7
;
}
DVD_ASF
,
*
PDVD_ASF
;
typedef
struct
_SCSI_PASS_THROUGH_DIRECT
{
USHORT
Length
;
UCHAR
ScsiStatus
;
UCHAR
PathId
;
UCHAR
TargetId
;
UCHAR
Lun
;
UCHAR
CdbLength
;
UCHAR
SenseInfoLength
;
UCHAR
DataIn
;
ULONG
DataTransferLength
;
ULONG
TimeOutValue
;
PVOID
DataBuffer
;
ULONG
SenseInfoOffset
;
UCHAR
Cdb
[
16
];
}
SCSI_PASS_THROUGH_DIRECT
,
*
PSCSI_PASS_THROUGH_DIRECT
;
#define SCSI_IOCTL_DATA_OUT 0
#define SCSI_IOCTL_DATA_IN 1
/* Key formats */
/* Key formats */
#define DVD_REPORT_AGID 0x00
#define DVD_REPORT_AGID 0x00
...
...
plugins/dvd/dvd_netlist.c
View file @
b8ce47bb
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* will only be given back to netlist when refcount is zero.
* will only be given back to netlist when refcount is zero.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: dvd_netlist.c,v 1.
6 2001/05/31 01:37:08
sam Exp $
* $Id: dvd_netlist.c,v 1.
7 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Henri Fallon <henri@videolan.org>
* Authors: Henri Fallon <henri@videolan.org>
* Stphane Borel <stef@videolan.org>
* Stphane Borel <stef@videolan.org>
...
@@ -37,14 +37,14 @@
...
@@ -37,14 +37,14 @@
#include <sys/types.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#endif
#endif
#if !defined( WIN32 )
#if defined( WIN32 )
#include <sys/uio.h>
/* struct iovec */
# include <io.h>
# include "iovec.h"
#else
#else
#include <io.h>
# include <sys/uio.h>
/* struct iovec */
#include "iovec.h"
#endif
#endif
#include "config.h"
#include "config.h"
...
...
plugins/dvd/dvd_udf.c
View file @
b8ce47bb
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* contains the basic udf handling functions
* contains the basic udf handling functions
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* Copyright (C) 1998-2001 VideoLAN
* $Id: dvd_udf.c,v 1.
7 2001/05/31 01:37:08
sam Exp $
* $Id: dvd_udf.c,v 1.
8 2001/05/31 03:12:49
sam Exp $
*
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Author: Stphane Borel <stef@via.ecp.fr>
*
*
...
@@ -34,25 +34,26 @@
...
@@ -34,25 +34,26 @@
#include "defs.h"
#include "defs.h"
#ifdef HAVE_CSS
#ifdef HAVE_CSS
#define MODULE_NAME dvd
#
define MODULE_NAME dvd
#else
/* HAVE_CSS */
#else
/* HAVE_CSS */
#define MODULE_NAME dvdnocss
#
define MODULE_NAME dvdnocss
#endif
/* HAVE_CSS */
#endif
/* HAVE_CSS */
#include "modules_inner.h"
#include "modules_inner.h"
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#include <string.h>
#ifdef STRNCASECMP_IN_STRINGS_H
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
# include <strings.h>
#endif
#endif
#include <fcntl.h>
#include "common.h"
#include "common.h"
#include "intf_msg.h"
#include "intf_msg.h"
...
@@ -99,18 +100,39 @@ typedef struct ad_s
...
@@ -99,18 +100,39 @@ typedef struct ad_s
*****************************************************************************/
*****************************************************************************/
static
int
UDFReadLB
(
int
i_fd
,
off_t
i_lba
,
size_t
i_block_count
,
u8
*
pi_data
)
static
int
UDFReadLB
(
int
i_fd
,
off_t
i_lba
,
size_t
i_block_count
,
u8
*
pi_data
)
{
{
#if !defined( WIN32 )
if
(
i_fd
<
0
)
if
(
i_fd
<
0
)
#else
DWORD
read
;
if
(
(
HANDLE
)
i_fd
==
INVALID_HANDLE_VALUE
)
#endif
{
{
return
0
;
return
0
;
}
}
#if !defined( WIN32 )
if
(
lseek
(
i_fd
,
i_lba
*
(
off_t
)
DVD_LB_SIZE
,
SEEK_SET
)
<
0
)
if
(
lseek
(
i_fd
,
i_lba
*
(
off_t
)
DVD_LB_SIZE
,
SEEK_SET
)
<
0
)
#else
if
(
SetFilePointer
(
(
HANDLE
)
i_fd
,
i_lba
*
(
off_t
)
DVD_LB_SIZE
,
NULL
,
FILE_BEGIN
)
==
-
1
)
#endif
{
{
intf_ErrMsg
(
"UDF: Postion not found"
);
intf_ErrMsg
(
"UDF: Postion not found"
);
return
0
;
return
0
;
}
}
#if !defined( WIN32 )
return
read
(
i_fd
,
pi_data
,
i_block_count
*
DVD_LB_SIZE
);
return
read
(
i_fd
,
pi_data
,
i_block_count
*
DVD_LB_SIZE
);
#else
if
(
!
ReadFile
(
(
HANDLE
)
i_fd
,
pi_data
,
i_block_count
*
DVD_LB_SIZE
,
&
read
,
NULL
)
||
read
!=
i_block_count
*
DVD_LB_SIZE
)
{
return
0
;
}
return
read
;
#endif
}
}
...
...
plugins/dvd/input_dvd.c
View file @
b8ce47bb
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* -dvd_udf to find files
* -dvd_udf to find files
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.6
3 2001/05/31 01:37:08
sam Exp $
* $Id: input_dvd.c,v 1.6
4 2001/05/31 03:12:49
sam Exp $
*
*
* Author: Stphane Borel <stef@via.ecp.fr>
* Author: Stphane Borel <stef@via.ecp.fr>
*
*
...
@@ -35,37 +35,38 @@
...
@@ -35,37 +35,38 @@
#include "defs.h"
#include "defs.h"
#ifdef HAVE_CSS
#ifdef HAVE_CSS
#define MODULE_NAME dvd
#
define MODULE_NAME dvd
#else
/* HAVE_CSS */
#else
/* HAVE_CSS */
#define MODULE_NAME dvdnocss
#
define MODULE_NAME dvdnocss
#endif
/* HAVE_CSS */
#endif
/* HAVE_CSS */
#include "modules_inner.h"
#include "modules_inner.h"
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#endif
#endif
#if !defined( WIN32 )
#if !defined( WIN32 )
#include <netinet/in.h>
#
include <netinet/in.h>
#endif
#endif
#include <fcntl.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/types.h>
#include <string.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
# include <strings.h>
#endif
#endif
#include <errno.h>
#if !defined( WIN32 )
#if defined( WIN32 )
#include <sys/uio.h>
/* struct iovec */
# include <io.h>
# include "iovec.h"
#else
#else
#include <io.h>
# include <sys/uio.h>
/* struct iovec */
#include "iovec.h"
#endif
#endif
#include "config.h"
#include "config.h"
...
@@ -151,6 +152,9 @@ static int DVDProbe( probedata_t *p_data )
...
@@ -151,6 +152,9 @@ static int DVDProbe( probedata_t *p_data )
char
*
psz_name
=
p_input
->
p_source
;
char
*
psz_name
=
p_input
->
p_source
;
int
i_handle
;
int
i_handle
;
int
i_score
=
5
;
int
i_score
=
5
;
#if defined( WIN32 )
char
buf
[
7
];
#endif
if
(
TestMethod
(
INPUT_METHOD_VAR
,
"dvd"
)
)
if
(
TestMethod
(
INPUT_METHOD_VAR
,
"dvd"
)
)
{
{
...
@@ -172,12 +176,25 @@ static int DVDProbe( probedata_t *p_data )
...
@@ -172,12 +176,25 @@ static int DVDProbe( probedata_t *p_data )
psz_name
+=
4
;
psz_name
+=
4
;
}
}
#if !defined( WIN32 )
i_handle
=
open
(
psz_name
,
0
);
i_handle
=
open
(
psz_name
,
0
);
if
(
i_handle
==
-
1
)
if
(
i_handle
==
-
1
)
{
{
return
(
0
);
return
(
0
);
}
}
close
(
i_handle
);
close
(
i_handle
);
#else
snprintf
(
buf
,
7
,
"
\\\\
.
\\
%c:"
,
psz_name
[
0
]
);
(
HANDLE
)
i_handle
=
CreateFile
(
i_score
<
90
?
psz_name
:
buf
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
if
(
(
HANDLE
)
i_handle
==
INVALID_HANDLE_VALUE
)
{
return
(
0
);
}
CloseHandle
(
(
HANDLE
)
i_handle
);
#endif
return
(
i_score
);
return
(
i_score
);
}
}
...
@@ -224,7 +241,11 @@ static void DVDInit( input_thread_t * p_input )
...
@@ -224,7 +241,11 @@ static void DVDInit( input_thread_t * p_input )
p_dvd
->
b_encrypted
=
i
;
p_dvd
->
b_encrypted
=
i
;
#if !defined( WIN32 )
lseek
(
p_input
->
i_handle
,
0
,
SEEK_SET
);
lseek
(
p_input
->
i_handle
,
0
,
SEEK_SET
);
#else
SetFilePointer
(
(
HANDLE
)
p_input
->
i_handle
,
0
,
0
,
FILE_BEGIN
);
#endif
/* Reading structures initialisation */
/* Reading structures initialisation */
p_input
->
p_method_data
=
p_input
->
p_method_data
=
...
@@ -818,6 +839,14 @@ static int DVDRead( input_thread_t * p_input,
...
@@ -818,6 +839,14 @@ static int DVDRead( input_thread_t * p_input,
return
-
1
;
return
-
1
;
}
}
pp_data
=
(
struct
data_packet_s
**
)
malloc
(
p_input
->
i_read_once
*
sizeof
(
struct
data_packet_s
*
)
);
if
(
pp_data
==
NULL
)
{
intf_ErrMsg
(
"dvd error: out of memory"
);
return
-
1
;
}
p_dvd
=
(
thread_dvd_data_t
*
)
p_input
->
p_plugin_data
;
p_dvd
=
(
thread_dvd_data_t
*
)
p_input
->
p_plugin_data
;
p_netlist
=
(
dvd_netlist_t
*
)
p_input
->
p_method_data
;
p_netlist
=
(
dvd_netlist_t
*
)
p_input
->
p_method_data
;
...
@@ -897,7 +926,11 @@ static int DVDRead( input_thread_t * p_input,
...
@@ -897,7 +926,11 @@ static int DVDRead( input_thread_t * p_input,
p_netlist
->
i_read_once
=
i_block_once
;
p_netlist
->
i_read_once
=
i_block_once
;
/* Reads from DVD */
/* Reads from DVD */
#if !defined( WIN32 )
i_read_bytes
=
readv
(
p_dvd
->
i_fd
,
p_vec
,
i_block_once
);
i_read_bytes
=
readv
(
p_dvd
->
i_fd
,
p_vec
,
i_block_once
);
#else
i_read_bytes
=
ReadFileV
(
p_dvd
->
i_fd
,
p_vec
,
i_block_once
);
#endif
i_read_blocks
=
(
i_read_bytes
+
0x7ff
)
>>
11
;
i_read_blocks
=
(
i_read_bytes
+
0x7ff
)
>>
11
;
/* Update netlist indexes */
/* Update netlist indexes */
...
@@ -922,7 +955,7 @@ static int DVDRead( input_thread_t * p_input,
...
@@ -922,7 +955,7 @@ static int DVDRead( input_thread_t * p_input,
while
(
i_pos
<
p_netlist
->
i_buffer_size
)
while
(
i_pos
<
p_netlist
->
i_buffer_size
)
{
{
pi_cur
=
(
(
u8
*
)
p_vec
[
i_iovec
].
iov_base
+
i_pos
)
;
pi_cur
=
(
u8
*
)
p_vec
[
i_iovec
].
iov_base
+
i_pos
;
/*default header */
/*default header */
if
(
U32_AT
(
pi_cur
)
!=
0x1BA
)
if
(
U32_AT
(
pi_cur
)
!=
0x1BA
)
...
@@ -987,6 +1020,8 @@ static int DVDRead( input_thread_t * p_input,
...
@@ -987,6 +1020,8 @@ static int DVDRead( input_thread_t * p_input,
free
(
pp_data
);
free
(
pp_data
);
free
(
pp_data
);
if
(
b_eof
)
if
(
b_eof
)
{
{
return
1
;
return
1
;
...
@@ -1115,10 +1150,18 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
...
@@ -1115,10 +1150,18 @@ static void DVDSeek( input_thread_t * p_input, off_t i_off )
p_dvd
->
i_chapter
=
i_chapter
;
p_dvd
->
i_chapter
=
i_chapter
;
p_input
->
stream
.
p_selected_area
->
i_part
=
p_dvd
->
i_chapter
;
p_input
->
stream
.
p_selected_area
->
i_part
=
p_dvd
->
i_chapter
;
#if !defined( WIN32 )
p_input
->
stream
.
p_selected_area
->
i_tell
=
p_input
->
stream
.
p_selected_area
->
i_tell
=
lseek
(
p_dvd
->
i_fd
,
p_dvd
->
i_title_start
+
lseek
(
p_dvd
->
i_fd
,
p_dvd
->
i_title_start
+
(
off_t
)(
p_dvd
->
i_sector
)
*
DVD_LB_SIZE
,
SEEK_SET
)
-
(
off_t
)(
p_dvd
->
i_sector
)
*
DVD_LB_SIZE
,
SEEK_SET
)
-
p_input
->
stream
.
p_selected_area
->
i_start
;
p_input
->
stream
.
p_selected_area
->
i_start
;
#else
p_input
->
stream
.
p_selected_area
->
i_tell
=
SetFilePointer
(
(
HANDLE
)
p_dvd
->
i_fd
,
p_dvd
->
i_title_start
+
(
off_t
)(
p_dvd
->
i_sector
)
*
DVD_LB_SIZE
,
NULL
,
FILE_BEGIN
)
-
p_input
->
stream
.
p_selected_area
->
i_start
;
#endif
/*
/*
intf_WarnMsg( 3, "Program Cell: %d Cell: %d Chapter: %d",
intf_WarnMsg( 3, "Program Cell: %d Cell: %d Chapter: %d",
p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter );
p_dvd->i_prg_cell, p_dvd->i_cell, p_dvd->i_chapter );
...
@@ -1249,7 +1292,12 @@ static int DVDChapterSelect( thread_dvd_data_t * p_dvd, int i_chapter )
...
@@ -1249,7 +1292,12 @@ static int DVDChapterSelect( thread_dvd_data_t * p_dvd, int i_chapter )
DVD_LB_SIZE
*
(
off_t
)(
p_dvd
->
i_sector
);
DVD_LB_SIZE
*
(
off_t
)(
p_dvd
->
i_sector
);
/* Position the fd pointer on the right address */
/* Position the fd pointer on the right address */
#if !defined( WIN32 )
p_dvd
->
i_start
=
lseek
(
p_dvd
->
i_fd
,
p_dvd
->
i_start
,
SEEK_SET
);
p_dvd
->
i_start
=
lseek
(
p_dvd
->
i_fd
,
p_dvd
->
i_start
,
SEEK_SET
);
#else
p_dvd
->
i_start
=
SetFilePointer
(
(
HANDLE
)
p_dvd
->
i_fd
,
p_dvd
->
i_start
,
NULL
,
FILE_BEGIN
);
#endif
p_dvd
->
i_chapter
=
i_chapter
;
p_dvd
->
i_chapter
=
i_chapter
;
return
0
;
return
0
;
...
...
plugins/mpeg/input_es.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* input_es.c: Elementary Stream demux and packet management
* input_es.c: Elementary Stream demux and packet management
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: input_es.c,v 1.
4 2001/05/31 01:37:08
sam Exp $
* $Id: input_es.c,v 1.
5 2001/05/31 03:12:49
sam Exp $
*
*
* Authors:
* Authors:
*
*
...
@@ -37,9 +37,9 @@
...
@@ -37,9 +37,9 @@
#include <sys/stat.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#include <fcntl.h>
#include <fcntl.h>
...
...
plugins/mpeg/input_ps.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* input_ps.c: PS demux and packet management
* input_ps.c: PS demux and packet management
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ps.c,v 1.2
6 2001/05/31 01:37:08
sam Exp $
* $Id: input_ps.c,v 1.2
7 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
...
@@ -32,18 +32,19 @@
...
@@ -32,18 +32,19 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
# include <strings.h>
#endif
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#include <fcntl.h>
#include <fcntl.h>
...
@@ -154,8 +155,8 @@ static void PSInit( input_thread_t * p_input )
...
@@ -154,8 +155,8 @@ static void PSInit( input_thread_t * p_input )
thread_ps_data_t
*
p_method
;
thread_ps_data_t
*
p_method
;
packet_cache_t
*
p_packet_cache
;
packet_cache_t
*
p_packet_cache
;
if
(
(
p_method
=
p_method
=
(
thread_ps_data_t
*
)
malloc
(
sizeof
(
thread_ps_data_t
)
);
(
thread_ps_data_t
*
)
malloc
(
sizeof
(
thread_ps_data_t
)
))
==
NULL
)
if
(
p_method
==
NULL
)
{
{
intf_ErrMsg
(
"Out of memory"
);
intf_ErrMsg
(
"Out of memory"
);
p_input
->
b_error
=
1
;
p_input
->
b_error
=
1
;
...
@@ -203,29 +204,31 @@ static void PSInit( input_thread_t * p_input )
...
@@ -203,29 +204,31 @@ static void PSInit( input_thread_t * p_input )
p_packet_cache
->
pes
.
l_index
=
0
;
p_packet_cache
->
pes
.
l_index
=
0
;
/* allocates the small buffer cache */
/* allocates the small buffer cache */
p_packet_cache
->
small
.
p_stack
=
malloc
(
SMALL_CACHE_SIZE
*
p_packet_cache
->
small
buffer
.
p_stack
=
malloc
(
SMALL_CACHE_SIZE
*
sizeof
(
packet_buffer_t
)
);
sizeof
(
packet_buffer_t
)
);
if
(
p_packet_cache
->
small
.
p_stack
==
NULL
)
if
(
p_packet_cache
->
small
buffer
.
p_stack
==
NULL
)
{
{
intf_ErrMsg
(
"Out of memory"
);
intf_ErrMsg
(
"Out of memory"
);
p_input
->
b_error
=
1
;
p_input
->
b_error
=
1
;
return
;
return
;
}
}
p_packet_cache
->
small
.
l_index
=
0
;
p_packet_cache
->
small
buffer
.
l_index
=
0
;
/* allocates the large buffer cache */
/* allocates the large buffer cache */
p_packet_cache
->
large
.
p_stack
=
malloc
(
LARGE_CACHE_SIZE
*
p_packet_cache
->
large
buffer
.
p_stack
=
malloc
(
LARGE_CACHE_SIZE
*
sizeof
(
packet_buffer_t
)
);
sizeof
(
packet_buffer_t
)
);
if
(
p_packet_cache
->
large
.
p_stack
==
NULL
)
if
(
p_packet_cache
->
large
buffer
.
p_stack
==
NULL
)
{
{
intf_ErrMsg
(
"Out of memory"
);
intf_ErrMsg
(
"Out of memory"
);
p_input
->
b_error
=
1
;
p_input
->
b_error
=
1
;
return
;
return
;
}
}
p_packet_cache
->
large
.
l_index
=
0
;
p_packet_cache
->
large
buffer
.
l_index
=
0
;
/* Re-open the socket as a buffered FILE stream */
/* Re-open the socket as a buffered FILE stream */
if
(
(
p_method
->
stream
=
fdopen
(
p_input
->
i_handle
,
"r"
))
==
NULL
)
p_method
->
stream
=
fdopen
(
p_input
->
i_handle
,
"r"
);
if
(
p_method
->
stream
==
NULL
)
{
{
intf_ErrMsg
(
"Cannot open file (%s)"
,
strerror
(
errno
)
);
intf_ErrMsg
(
"Cannot open file (%s)"
,
strerror
(
errno
)
);
p_input
->
b_error
=
1
;
p_input
->
b_error
=
1
;
...
@@ -504,8 +507,8 @@ static int PSRead( input_thread_t * p_input,
...
@@ -504,8 +507,8 @@ static int PSRead( input_thread_t * p_input,
}
}
/* Fetch a packet of the appropriate size. */
/* Fetch a packet of the appropriate size. */
if
(
(
p_data
=
NewPacket
(
p_input
->
p_method_data
,
i_packet_size
+
6
))
p_data
=
NewPacket
(
p_input
->
p_method_data
,
i_packet_size
+
6
);
==
NULL
)
if
(
p_data
==
NULL
)
{
{
intf_ErrMsg
(
"Out of memory"
);
intf_ErrMsg
(
"Out of memory"
);
return
(
-
1
);
return
(
-
1
);
...
@@ -600,7 +603,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -600,7 +603,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
if
(
p_cache
->
data
.
l_index
==
0
)
if
(
p_cache
->
data
.
l_index
==
0
)
{
{
/* Allocates a new packet */
/* Allocates a new packet */
if
(
(
p_data
=
malloc
(
sizeof
(
data_packet_t
)
))
==
NULL
)
p_data
=
malloc
(
sizeof
(
data_packet_t
)
);
if
(
p_data
==
NULL
)
{
{
intf_ErrMsg
(
"Out of memory"
);
intf_ErrMsg
(
"Out of memory"
);
vlc_mutex_unlock
(
&
p_cache
->
lock
);
vlc_mutex_unlock
(
&
p_cache
->
lock
);
...
@@ -627,10 +631,11 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -627,10 +631,11 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
/* Small buffer */
/* Small buffer */
/* Checks whether the buffer cache is empty */
/* Checks whether the buffer cache is empty */
if
(
p_cache
->
small
.
l_index
==
0
)
if
(
p_cache
->
small
buffer
.
l_index
==
0
)
{
{
/* Allocates a new packet */
/* Allocates a new packet */
if
(
(
p_data
->
p_buffer
=
malloc
(
l_size
))
==
NULL
)
p_data
->
p_buffer
=
malloc
(
l_size
);
if
(
p_data
->
p_buffer
==
NULL
)
{
{
intf_DbgMsg
(
"Out of memory"
);
intf_DbgMsg
(
"Out of memory"
);
free
(
p_data
);
free
(
p_data
);
...
@@ -645,8 +650,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -645,8 +650,8 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
else
else
{
{
/* Takes the packet out from the cache */
/* Takes the packet out from the cache */
l_index
=
--
p_cache
->
small
.
l_index
;
l_index
=
--
p_cache
->
small
buffer
.
l_index
;
if
(
(
p_data
->
p_buffer
=
p_cache
->
small
.
p_stack
[
l_index
].
p_data
)
if
(
(
p_data
->
p_buffer
=
p_cache
->
small
buffer
.
p_stack
[
l_index
].
p_data
)
==
NULL
)
==
NULL
)
{
{
intf_ErrMsg
(
"NULL packet in the small buffer cache"
);
intf_ErrMsg
(
"NULL packet in the small buffer cache"
);
...
@@ -655,15 +660,15 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -655,15 +660,15 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
return
NULL
;
return
NULL
;
}
}
/* Reallocates the packet if it is too small or too large */
/* Reallocates the packet if it is too small or too large */
if
(
p_cache
->
small
.
p_stack
[
l_index
].
l_size
<
l_size
||
if
(
p_cache
->
small
buffer
.
p_stack
[
l_index
].
l_size
<
l_size
||
p_cache
->
small
.
p_stack
[
l_index
].
l_size
>
2
*
l_size
)
p_cache
->
small
buffer
.
p_stack
[
l_index
].
l_size
>
2
*
l_size
)
{
{
p_data
->
p_buffer
=
realloc
(
p_data
->
p_buffer
,
l_size
);
p_data
->
p_buffer
=
realloc
(
p_data
->
p_buffer
,
l_size
);
p_data
->
l_size
=
l_size
;
p_data
->
l_size
=
l_size
;
}
}
else
else
{
{
p_data
->
l_size
=
p_cache
->
small
.
p_stack
[
l_index
].
l_size
;
p_data
->
l_size
=
p_cache
->
small
buffer
.
p_stack
[
l_index
].
l_size
;
}
}
}
}
}
}
...
@@ -672,10 +677,11 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -672,10 +677,11 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
/* Large buffer */
/* Large buffer */
/* Checks whether the buffer cache is empty */
/* Checks whether the buffer cache is empty */
if
(
p_cache
->
large
.
l_index
==
0
)
if
(
p_cache
->
large
buffer
.
l_index
==
0
)
{
{
/* Allocates a new packet */
/* Allocates a new packet */
if
(
(
p_data
->
p_buffer
=
malloc
(
l_size
))
==
NULL
)
p_data
->
p_buffer
=
malloc
(
l_size
);
if
(
p_data
->
p_buffer
==
NULL
)
{
{
intf_ErrMsg
(
"Out of memory"
);
intf_ErrMsg
(
"Out of memory"
);
free
(
p_data
);
free
(
p_data
);
...
@@ -690,9 +696,9 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -690,9 +696,9 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
else
else
{
{
/* Takes the packet out from the cache */
/* Takes the packet out from the cache */
l_index
=
--
p_cache
->
large
.
l_index
;
l_index
=
--
p_cache
->
large
buffer
.
l_index
;
if
(
(
p_data
->
p_buffer
=
p_cache
->
large
.
p_stack
[
l_index
].
p_data
)
p_data
->
p_buffer
=
p_cache
->
largebuffer
.
p_stack
[
l_index
].
p_data
;
==
NULL
)
if
(
p_data
->
p_buffer
==
NULL
)
{
{
intf_ErrMsg
(
"NULL packet in the small buffer cache"
);
intf_ErrMsg
(
"NULL packet in the small buffer cache"
);
free
(
p_data
);
free
(
p_data
);
...
@@ -700,15 +706,15 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
...
@@ -700,15 +706,15 @@ static struct data_packet_s * NewPacket( void * p_packet_cache,
return
NULL
;
return
NULL
;
}
}
/* Reallocates the packet if it is too small or too large */
/* Reallocates the packet if it is too small or too large */
if
(
p_cache
->
large
.
p_stack
[
l_index
].
l_size
<
l_size
||
if
(
p_cache
->
large
buffer
.
p_stack
[
l_index
].
l_size
<
l_size
||
p_cache
->
large
.
p_stack
[
l_index
].
l_size
>
2
*
l_size
)
p_cache
->
large
buffer
.
p_stack
[
l_index
].
l_size
>
2
*
l_size
)
{
{
p_data
->
p_buffer
=
realloc
(
p_data
->
p_buffer
,
l_size
);
p_data
->
p_buffer
=
realloc
(
p_data
->
p_buffer
,
l_size
);
p_data
->
l_size
=
l_size
;
p_data
->
l_size
=
l_size
;
}
}
else
else
{
{
p_data
->
l_size
=
p_cache
->
large
.
p_stack
[
l_index
].
l_size
;
p_data
->
l_size
=
p_cache
->
large
buffer
.
p_stack
[
l_index
].
l_size
;
}
}
}
}
}
}
...
@@ -750,7 +756,8 @@ static pes_packet_t * NewPES( void * p_packet_cache )
...
@@ -750,7 +756,8 @@ static pes_packet_t * NewPES( void * p_packet_cache )
if
(
p_cache
->
pes
.
l_index
==
0
)
if
(
p_cache
->
pes
.
l_index
==
0
)
{
{
/* Allocates a new packet */
/* Allocates a new packet */
if
(
(
p_pes
=
malloc
(
sizeof
(
pes_packet_t
)
))
==
NULL
)
p_pes
=
malloc
(
sizeof
(
pes_packet_t
)
);
if
(
p_pes
==
NULL
)
{
{
intf_DbgMsg
(
"Out of memory"
);
intf_DbgMsg
(
"Out of memory"
);
vlc_mutex_unlock
(
&
p_cache
->
lock
);
vlc_mutex_unlock
(
&
p_cache
->
lock
);
...
@@ -763,8 +770,8 @@ static pes_packet_t * NewPES( void * p_packet_cache )
...
@@ -763,8 +770,8 @@ static pes_packet_t * NewPES( void * p_packet_cache )
else
else
{
{
/* Takes the packet out from the cache */
/* Takes the packet out from the cache */
if
(
(
p_pes
=
p_cache
->
pes
.
p_stack
[
--
p_cache
->
pes
.
l_index
])
p_pes
=
p_cache
->
pes
.
p_stack
[
--
p_cache
->
pes
.
l_index
];
==
NULL
)
if
(
p_pes
==
NULL
)
{
{
intf_ErrMsg
(
"NULL packet in the data cache"
);
intf_ErrMsg
(
"NULL packet in the data cache"
);
vlc_mutex_unlock
(
&
p_cache
->
lock
);
vlc_mutex_unlock
(
&
p_cache
->
lock
);
...
@@ -814,12 +821,12 @@ static void DeletePacket( void * p_packet_cache,
...
@@ -814,12 +821,12 @@ static void DeletePacket( void * p_packet_cache,
if
(
p_data
->
l_size
<
MAX_SMALL_SIZE
)
if
(
p_data
->
l_size
<
MAX_SMALL_SIZE
)
{
{
/* Checks whether the small buffer cache is full */
/* Checks whether the small buffer cache is full */
if
(
p_cache
->
small
.
l_index
<
SMALL_CACHE_SIZE
)
if
(
p_cache
->
small
buffer
.
l_index
<
SMALL_CACHE_SIZE
)
{
{
p_cache
->
small
.
p_stack
[
p_cache
->
small
.
l_index
].
l_size
=
p_cache
->
small
buffer
.
p_stack
[
p_data
->
l_size
;
p_
cache
->
smallbuffer
.
l_index
].
l_size
=
p_
data
->
l_size
;
p_cache
->
small
.
p_stack
[
p_cache
->
small
.
l_index
++
].
p_data
=
p_cache
->
small
buffer
.
p_stack
[
p_data
->
p_buffer
;
p_
cache
->
smallbuffer
.
l_index
++
].
p_data
=
p_
data
->
p_buffer
;
}
}
else
else
{
{
...
@@ -833,12 +840,12 @@ static void DeletePacket( void * p_packet_cache,
...
@@ -833,12 +840,12 @@ static void DeletePacket( void * p_packet_cache,
else
else
{
{
/* Checks whether the large buffer cache is full */
/* Checks whether the large buffer cache is full */
if
(
p_cache
->
large
.
l_index
<
LARGE_CACHE_SIZE
)
if
(
p_cache
->
large
buffer
.
l_index
<
LARGE_CACHE_SIZE
)
{
{
p_cache
->
large
.
p_stack
[
p_cache
->
large
.
l_index
].
l_size
=
p_cache
->
large
buffer
.
p_stack
[
p_data
->
l_size
;
p_
cache
->
largebuffer
.
l_index
].
l_size
=
p_
data
->
l_size
;
p_cache
->
large
.
p_stack
[
p_cache
->
large
.
l_index
++
].
p_data
=
p_cache
->
large
buffer
.
p_stack
[
p_data
->
p_buffer
;
p_
cache
->
largebuffer
.
l_index
++
].
p_data
=
p_
data
->
p_buffer
;
}
}
else
else
{
{
...
...
plugins/mpeg/input_ps.h
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* input_ps.h: thread structure of the PS plugin
* input_ps.h: thread structure of the PS plugin
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ps.h,v 1.
7 2001/05/31 01:37:08
sam Exp $
* $Id: input_ps.h,v 1.
8 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
* Cyril Deguet <asmax@via.ecp.fr>
...
@@ -22,10 +22,6 @@
...
@@ -22,10 +22,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
*****************************************************************************/
#if defined( _MSC_VER )
#undef small
#endif
/*****************************************************************************
/*****************************************************************************
* thread_ps_data_t: extension of input_thread_t
* thread_ps_data_t: extension of input_thread_t
*****************************************************************************/
*****************************************************************************/
...
@@ -82,8 +78,8 @@ typedef struct
...
@@ -82,8 +78,8 @@ typedef struct
vlc_mutex_t
lock
;
vlc_mutex_t
lock
;
data_packet_cache_t
data
;
data_packet_cache_t
data
;
pes_packet_cache_t
pes
;
pes_packet_cache_t
pes
;
small_buffer_cache_t
small
;
small_buffer_cache_t
small
buffer
;
large_buffer_cache_t
large
;
large_buffer_cache_t
large
buffer
;
}
packet_cache_t
;
}
packet_cache_t
;
plugins/mpeg/input_ts.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* input_ts.c: TS demux and netlist management
* input_ts.c: TS demux and netlist management
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input_ts.c,v 1.2
2 2001/05/31 01:37:08
sam Exp $
* $Id: input_ts.c,v 1.2
3 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Henri Fallon <henri@videolan.org>
* Authors: Henri Fallon <henri@videolan.org>
*
*
...
@@ -31,34 +31,35 @@
...
@@ -31,34 +31,35 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
# include <strings.h>
#endif
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#if !defined( _MSC_VER )
#if !defined( _MSC_VER )
#include <sys/time.h>
#
include <sys/time.h>
#endif
#endif
#ifdef SYS_NTO
#ifdef SYS_NTO
#include <sys/select.h>
#
include <sys/select.h>
#endif
#endif
#include <sys/stat.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#endif
#endif
#include <fcntl.h>
#include <fcntl.h>
#if !defined( WIN32 )
#if defined( WIN32 )
#include <sys/uio.h>
/* struct iovec */
# include <io.h>
# include "iovec.h"
#else
#else
#include <io.h>
# include <sys/uio.h>
/* struct iovec */
#include "iovec.h"
#endif
#endif
#include "config.h"
#include "config.h"
...
...
src/audio_output/aout_spdif.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* aout_spdif: ac3 passthrough output
* aout_spdif: ac3 passthrough output
*****************************************************************************
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.
9 2001/05/31 01:37:08
sam Exp $
* $Id: aout_spdif.c,v 1.
10 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
...
@@ -114,10 +114,10 @@ void aout_SpdifThread( aout_thread_t * p_aout )
...
@@ -114,10 +114,10 @@ void aout_SpdifThread( aout_thread_t * p_aout )
mlast
=
mplay
;
mlast
=
mplay
;
/* play spdif frame to the external decoder */
/* play spdif frame to the external decoder */
p_aout
->
pf_play
(
p_aout
,
p_aout
->
pf_play
(
p_aout
,
((
byte_t
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
+
(
(
byte_t
*
)
p_aout
->
fifo
[
i_fifo
].
buffer
p_aout
->
fifo
[
i_fifo
].
l_start_frame
*
+
p_aout
->
fifo
[
i_fifo
].
l_start_frame
SPDIF_FRAME_SIZE
),
*
SPDIF_FRAME_SIZE
),
p_aout
->
fifo
[
i_fifo
].
l_frame_size
);
p_aout
->
fifo
[
i_fifo
].
l_frame_size
);
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
(
p_aout
->
fifo
[
i_fifo
].
l_start_frame
+
1
)
(
p_aout
->
fifo
[
i_fifo
].
l_start_frame
+
1
)
...
...
src/input/input.c
View file @
b8ce47bb
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* decoders.
* decoders.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.11
5 2001/05/31 01:37:08
sam Exp $
* $Id: input.c,v 1.11
6 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
*
...
@@ -34,33 +34,27 @@
...
@@ -34,33 +34,27 @@
#include <fcntl.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#
include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#include <string.h>
#include <string.h>
#include <errno.h>
#ifdef STRNCASECMP_IN_STRINGS_H
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
# include <strings.h>
#endif
#endif
#include <errno.h>
/* WinSock Includes */
#ifdef WIN32
#ifdef WIN32
#include <winsock2.h>
# include <winsock2.h>
#endif
#elif !defined( SYS_BEOS ) && !defined( SYS_NTO )
# include <netdb.h>
/* hostent ... */
# include <sys/socket.h>
/* Network functions */
# include <netinet/in.h>
# include <arpa/inet.h>
#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( WIN32 )
# include <sys/types.h>
#include <netdb.h>
/* hostent ... */
# include <sys/socket.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#endif
#endif
#ifdef STATS
#ifdef STATS
...
@@ -86,7 +80,6 @@
...
@@ -86,7 +80,6 @@
#include "main.h"
#include "main.h"
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
...
@@ -260,6 +253,7 @@ static void RunThread( input_thread_t *p_input )
...
@@ -260,6 +253,7 @@ static void RunThread( input_thread_t *p_input )
if
(
pp_packets
==
NULL
)
if
(
pp_packets
==
NULL
)
{
{
intf_ErrMsg
(
"input error: out of memory"
);
intf_ErrMsg
(
"input error: out of memory"
);
free
(
pp_packets
);
p_input
->
b_error
=
1
;
p_input
->
b_error
=
1
;
}
}
...
@@ -504,6 +498,10 @@ static void FileOpen( input_thread_t * p_input )
...
@@ -504,6 +498,10 @@ static void FileOpen( input_thread_t * p_input )
struct
stat
stat_info
;
struct
stat
stat_info
;
int
i_stat
;
int
i_stat
;
#if defined( WIN32 )
char
buf
[
7
]
=
{
0
};
#endif
char
*
psz_name
=
p_input
->
p_source
;
char
*
psz_name
=
p_input
->
p_source
;
/* FIXME: this code ought to be in the plugin so that code can
/* FIXME: this code ought to be in the plugin so that code can
...
@@ -518,6 +516,9 @@ static void FileOpen( input_thread_t * p_input )
...
@@ -518,6 +516,9 @@ static void FileOpen( input_thread_t * p_input )
/* get rid of the 'dvd:' stuff and try again */
/* get rid of the 'dvd:' stuff and try again */
psz_name
+=
4
;
psz_name
+=
4
;
i_stat
=
stat
(
psz_name
,
&
stat_info
);
i_stat
=
stat
(
psz_name
,
&
stat_info
);
#if defined( WIN32 )
snprintf
(
buf
,
7
,
"
\\\\
.
\\
%c:"
,
psz_name
[
0
]
);
#endif
}
}
else
if
(
(
i_size
>
5
)
else
if
(
(
i_size
>
5
)
&&
!
strncasecmp
(
psz_name
,
"file:"
,
5
)
)
&&
!
strncasecmp
(
psz_name
,
"file:"
,
5
)
)
...
@@ -527,7 +528,11 @@ static void FileOpen( input_thread_t * p_input )
...
@@ -527,7 +528,11 @@ static void FileOpen( input_thread_t * p_input )
i_stat
=
stat
(
psz_name
,
&
stat_info
);
i_stat
=
stat
(
psz_name
,
&
stat_info
);
}
}
if
(
i_stat
==
(
-
1
)
)
if
(
i_stat
==
(
-
1
)
#if defined( WIN32 )
&&
!
buf
[
0
]
#endif
)
{
{
intf_ErrMsg
(
"input error: cannot stat() file `%s' (%s)"
,
intf_ErrMsg
(
"input error: cannot stat() file `%s' (%s)"
,
psz_name
,
strerror
(
errno
));
psz_name
,
strerror
(
errno
));
...
@@ -542,7 +547,11 @@ static void FileOpen( input_thread_t * p_input )
...
@@ -542,7 +547,11 @@ static void FileOpen( input_thread_t * p_input )
p_input
->
stream
.
b_pace_control
=
1
;
p_input
->
stream
.
b_pace_control
=
1
;
if
(
S_ISREG
(
stat_info
.
st_mode
)
||
S_ISCHR
(
stat_info
.
st_mode
)
if
(
S_ISREG
(
stat_info
.
st_mode
)
||
S_ISCHR
(
stat_info
.
st_mode
)
||
S_ISBLK
(
stat_info
.
st_mode
)
)
||
S_ISBLK
(
stat_info
.
st_mode
)
#if defined( WIN32 )
||
(
buf
[
0
]
&&
(
(
stat_info
.
st_size
=
0
)
==
0
)
)
#endif
)
{
{
p_input
->
stream
.
b_seekable
=
1
;
p_input
->
stream
.
b_seekable
=
1
;
p_input
->
stream
.
p_selected_area
->
i_size
=
stat_info
.
st_size
;
p_input
->
stream
.
p_selected_area
->
i_size
=
stat_info
.
st_size
;
...
@@ -573,8 +582,10 @@ static void FileOpen( input_thread_t * p_input )
...
@@ -573,8 +582,10 @@ static void FileOpen( input_thread_t * p_input )
if
(
(
p_input
->
i_handle
=
open
(
psz_name
,
if
(
(
p_input
->
i_handle
=
open
(
psz_name
,
/*O_NONBLOCK | O_LARGEFILE*/
0
))
==
(
-
1
)
)
/*O_NONBLOCK | O_LARGEFILE*/
0
))
==
(
-
1
)
)
#else
#else
if
(
(
p_input
->
i_handle
=
open
(
psz_name
,
O_BINARY
if
(
(
buf
[
0
]
&&
(
(
HANDLE
)
p_input
->
i_handle
=
CreateFile
(
buf
,
/*O_NONBLOCK | O_LARGEFILE*/
))
==
(
-
1
)
)
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
)
)
==
INVALID_HANDLE_VALUE
)
||
(
!
buf
[
0
]
&&
(
p_input
->
i_handle
=
open
(
psz_name
,
O_BINARY
)
)
==
(
-
1
)
)
)
#endif
#endif
{
{
intf_ErrMsg
(
"input error: cannot open file (%s)"
,
strerror
(
errno
)
);
intf_ErrMsg
(
"input error: cannot open file (%s)"
,
strerror
(
errno
)
);
...
@@ -590,6 +601,14 @@ static void FileOpen( input_thread_t * p_input )
...
@@ -590,6 +601,14 @@ static void FileOpen( input_thread_t * p_input )
static
void
FileClose
(
input_thread_t
*
p_input
)
static
void
FileClose
(
input_thread_t
*
p_input
)
{
{
intf_WarnMsg
(
1
,
"input: closing file `%s'"
,
p_input
->
p_source
);
intf_WarnMsg
(
1
,
"input: closing file `%s'"
,
p_input
->
p_source
);
#if defined( WIN32 )
if
(
(
strlen
(
p_input
->
p_source
)
>
4
)
&&
!
strncasecmp
(
p_input
->
p_source
,
"dvd:"
,
4
)
)
{
CloseHandle
(
(
HANDLE
)
p_input
->
i_handle
);
}
else
#endif
close
(
p_input
->
i_handle
);
close
(
p_input
->
i_handle
);
return
;
return
;
...
...
src/misc/mtime.c
View file @
b8ce47bb
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* Functions are prototyped in mtime.h.
* Functions are prototyped in mtime.h.
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: mtime.c,v 1.
19 2001/05/31 01:37:08
sam Exp $
* $Id: mtime.c,v 1.
20 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
*
...
@@ -35,25 +35,55 @@
...
@@ -35,25 +35,55 @@
#include <stdio.h>
/* sprintf() */
#include <stdio.h>
/* sprintf() */
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#include <unistd.h>
/* select() */
# include <unistd.h>
/* select() */
#endif
#if !defined( _MSC_VER )
#include <sys/time.h>
#endif
#endif
#ifdef HAVE_KERNEL_OS_H
#ifdef HAVE_KERNEL_OS_H
#include <kernel/OS.h>
#
include <kernel/OS.h>
#endif
#endif
#if defined( WIN32 )
#if defined( WIN32 )
#include <windows.h>
# include <windows.h>
#else
# include <sys/time.h>
#endif
#endif
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#if defined( WIN32 )
/*****************************************************************************
* usleep: microsecond sleep for win32
*****************************************************************************
* This function uses performance counter if available, and Sleep() if not.
*****************************************************************************/
static
__inline__
void
usleep
(
unsigned
int
i_useconds
)
{
s64
i_cur
,
i_freq
;
s64
i_now
,
i_then
;
if
(
i_useconds
<
1000
&&
QueryPerformanceFrequency
(
(
LARGE_INTEGER
*
)
&
i_freq
)
)
{
QueryPerformanceCounter
(
(
LARGE_INTEGER
*
)
&
i_cur
);
i_now
=
(
cur
*
1000
*
1000
/
i_freq
);
i_then
=
i_now
+
i_useconds
;
while
(
i_now
<
i_then
)
{
QueryPerformanceCounter
(
(
LARGE_INTEGER
*
)
&
i_cur
);
now
=
cur
*
1000
*
1000
/
i_freq
;
}
}
else
{
Sleep
(
(
int
)
((
i_useconds
+
500
)
/
1000
)
);
}
}
#endif
/*****************************************************************************
/*****************************************************************************
* mstrtime: return a date in a readable format
* mstrtime: return a date in a readable format
*****************************************************************************
*****************************************************************************
...
@@ -87,22 +117,19 @@ mtime_t mdate( void )
...
@@ -87,22 +117,19 @@ mtime_t mdate( void )
/* We don't get the real date, just the value of a high precision timer.
/* We don't get the real date, just the value of a high precision timer.
* this is because the usual time functions have at best only a milisecond
* this is because the usual time functions have at best only a milisecond
* resolution */
* resolution */
mtime_t
freq
,
usec_time
;
mtime_t
freq
,
usec_time
;
if
(
!
QueryPerformanceFrequency
((
LARGE_INTEGER
*
)
&
freq
)
)
if
(
QueryPerformanceFrequency
(
(
LARGE_INTEGER
*
)
&
freq
)
)
{
{
/* Milisecond resolution */
/* Microsecond resolution */
FILETIME
file_time
;
QueryPerformanceCounter
(
(
LARGE_INTEGER
*
)
&
usec_time
);
GetSystemTimeAsFileTime
((
FILETIME
*
)
&
file_time
);
return
(
usec_time
*
1000000
)
/
freq
;
usec_time
*=
1000
;
}
}
else
else
{
{
/* Microsecond resolution */
/* Milisecond resolution */
QueryPerformanceCounter
((
LARGE_INTEGER
*
)
&
usec_time
);
return
1000
*
GetTickCount
();
usec_time
/=
(
freq
/
1000000
);
}
}
return
(
usec_time
);
#else
#else
struct
timeval
tv_date
;
struct
timeval
tv_date
;
...
@@ -144,8 +171,8 @@ void mwait( mtime_t date )
...
@@ -144,8 +171,8 @@ void mwait( mtime_t date )
{
{
return
;
return
;
}
}
/* Sleep only has milisecond resolution */
Sleep
(
(
DWORD
)(
delay
/
1000
)
);
usleep
(
delay
);
#else
#else
...
@@ -160,7 +187,10 @@ void mwait( mtime_t date )
...
@@ -160,7 +187,10 @@ void mwait( mtime_t date )
gettimeofday
(
&
tv_date
,
NULL
);
gettimeofday
(
&
tv_date
,
NULL
);
/* calculate delay and check if current date is before wished date */
/* calculate delay and check if current date is before wished date */
delay
=
date
-
(
mtime_t
)
tv_date
.
tv_sec
*
1000000
-
(
mtime_t
)
tv_date
.
tv_usec
-
10000
;
delay
=
date
-
(
mtime_t
)
tv_date
.
tv_sec
*
1000000
-
(
mtime_t
)
tv_date
.
tv_usec
-
10000
;
/* Linux/i386 has a granularity of 10 ms. It's better to be in advance
/* Linux/i386 has a granularity of 10 ms. It's better to be in advance
* than to be late. */
* than to be late. */
if
(
delay
<=
0
)
/* wished date is now or already passed */
if
(
delay
<=
0
)
/* wished date is now or already passed */
...
@@ -191,12 +221,7 @@ void msleep( mtime_t delay )
...
@@ -191,12 +221,7 @@ void msleep( mtime_t delay )
#if defined( HAVE_KERNEL_OS_H )
#if defined( HAVE_KERNEL_OS_H )
snooze
(
delay
);
snooze
(
delay
);
#elif defined( WIN32 )
#elif defined( HAVE_USLEEP ) || defined( WIN32 )
Sleep
(
delay
/
1000
);
/* Sleep only has milisecond resolution */
/* Maybe we could use the multimedia timer to reach the right resolution, */
/* or the old Winsock select() function ?*/
#elif defined( HAVE_USLEEP )
usleep
(
delay
);
usleep
(
delay
);
#else
#else
...
...
src/video_output/video_text.c
View file @
b8ce47bb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions
* video_text.c : text manipulation functions
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_text.c,v 1.2
7 2001/05/31 01:37:08
sam Exp $
* $Id: video_text.c,v 1.2
8 2001/05/31 03:12:49
sam Exp $
*
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
* Samuel Hocevar <sam@zoy.org>
...
@@ -34,9 +34,9 @@
...
@@ -34,9 +34,9 @@
#include <fcntl.h>
/* open() */
#include <fcntl.h>
/* open() */
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
#
include <unistd.h>
/* read(), close() */
#
include <unistd.h>
/* read(), close() */
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( _MSC_VER ) && defined( _WIN32 )
#include <io.h>
#
include <io.h>
#endif
#endif
#ifdef SYS_BEOS
#ifdef SYS_BEOS
...
@@ -47,6 +47,10 @@
...
@@ -47,6 +47,10 @@
# include "darwin_specific.h"
# include "darwin_specific.h"
#endif
#endif
#if defined( WIN32 )
# include <io.h>
#endif
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "video_text.h"
#include "video_text.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment