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
d7b4b27b
Commit
d7b4b27b
authored
Jan 09, 2002
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* ./src/interface/intf_eject.c: BSD/OS port by Steven M. Schultz.
parent
c7b1c474
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
74 deletions
+63
-74
src/interface/intf_eject.c
src/interface/intf_eject.c
+62
-63
src/interface/main.c
src/interface/main.c
+1
-11
No files found.
src/interface/intf_eject.c
View file @
d7b4b27b
...
...
@@ -2,7 +2,7 @@
* intf_eject.c: CD/DVD-ROM ejection handling functions
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: intf_eject.c,v 1.
1 2002/01/09 02:01:14
sam Exp $
* $Id: intf_eject.c,v 1.
2 2002/01/09 10:22:37
sam Exp $
*
* Author: Julien Blache <jb@technologeek.org> for the Linux part
* with code taken from the Linux "eject" command
...
...
@@ -29,9 +29,11 @@
#include <videolan/vlc.h>
#ifdef SYS_LINUX
#ifdef HAVE_DVD_H
# include <dvd.h>
#endif
/* This code could be extended to support CD/DVD-ROM chargers */
#ifdef SYS_LINUX
# include <linux/version.h>
/* handy macro found in 2.1 kernels, but not in older ones */
# ifndef KERNEL_VERSION
...
...
@@ -53,29 +55,71 @@
# include <scsi/scsi.h>
# include <scsi/sg.h>
# include <scsi/scsi_ioctl.h>
#endif
static
int
EjectCdrom
(
int
i_fd
);
static
int
EjectScsi
(
int
i_fd
);
/*****************************************************************************
* Local prototypes
*****************************************************************************/
#ifdef SYS_LINUX
static
int
EjectSCSI
(
int
i_fd
);
#endif
/*
* Eject using CDROMEJECT ioctl. Return 0 if successful
*/
static
int
EjectCdrom
(
int
i_fd
)
/*****************************************************************************
* intf_Eject: eject the CDRom
*****************************************************************************
* returns 0 on success
* returns 1 on failure
* returns -1 if not implemented
*****************************************************************************/
int
intf_Eject
(
const
char
*
psz_device
)
{
int
i_
status
;
int
i_
ret
;
i_status
=
ioctl
(
i_fd
,
CDROMEJECT
);
/* This code could be extended to support CD/DVD-ROM chargers */
int
i_fd
=
0
;
return
i_status
;
i_fd
=
open
(
psz_device
,
O_RDONLY
|
O_NONBLOCK
);
if
(
i_fd
==
-
1
)
{
intf_ErrMsg
(
"intf error: couldn't open device %s"
,
psz_device
);
return
1
;
}
#ifdef SYS_LINUX
/* Try a simple ATAPI eject */
i_ret
=
ioctl
(
i_fd
,
CDROMEJECT
,
0
);
if
(
i_ret
!=
0
)
{
i_ret
=
EjectSCSI
(
i_fd
);
}
if
(
i_ret
!=
0
)
{
intf_ErrMsg
(
"intf error: couldn't eject %s"
,
psz_device
);
}
#elif defined (HAVE_DVD_H)
i_ret
=
ioctl
(
i_fd
,
CDROMEJECT
,
0
);
#else
intf_ErrMsg
(
"intf error: CD-Rom ejection unsupported on this platform"
);
i_ret
=
-
1
;
#endif
close
(
i_fd
);
return
i_ret
;
}
/* The following functions are local */
/*
#ifdef SYS_LINUX
/*****************************************************************************
* Eject using SCSI commands. Return 0 if successful
*/
static
int
EjectS
csi
(
int
i_fd
)
*
****************************************************************************
/
static
int
EjectS
CSI
(
int
i_fd
)
{
int
i_status
;
...
...
@@ -133,50 +177,5 @@ static int EjectScsi( int i_fd )
return
i_status
;
}
/*
* returns 0 on success
* returns 1 on failure
* returns -1 if not implemented
*
* Modify eject_disc() prototype as needed for portability
*/
int
intf_Eject
(
const
char
*
psz_device
)
{
int
i_ret
;
#ifdef SYS_LINUX
int
i_fd
=
0
;
i_fd
=
open
(
psz_device
,
O_RDONLY
|
O_NONBLOCK
);
if
(
i_fd
==
-
1
)
{
intf_ErrMsg
(
"intf error: couldn't open device %s"
,
psz_device
);
return
1
;
}
if
(
EjectCdrom
(
i_fd
)
==
0
)
{
i_ret
=
0
;
}
else
if
(
EjectScsi
(
i_fd
)
==
0
)
{
i_ret
=
0
;
}
else
{
intf_ErrMsg
(
"intf error: couldn't eject %s"
,
psz_device
);
i_ret
=
1
;
}
close
(
i_fd
);
#else
i_ret
=
-
1
;
#endif
return
i_ret
;
}
src/interface/main.c
View file @
d7b4b27b
...
...
@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.14
3 2002/01/07 02:12:30
sam Exp $
* $Id: main.c,v 1.14
4 2002/01/09 10:22:37
sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
...
...
@@ -1308,16 +1308,6 @@ static u32 CPUCapabilities( void )
{
i_capabilities
|=
CPU_CAPABILITY_SSE
;
}
else
{
fprintf
(
stderr
,
"warning: your OS doesn't have support for "
"SSE instructions, some optimizations
\n
"
"will be disabled"
# ifdef SYS_LINUX
" (you will need Linux kernel 2.4.x or later)"
# endif
"
\n
"
);
}
# endif
}
...
...
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