[MPlayer-cvslog] r25068 - trunk/stream/stream_dvd.c
reimar
subversion at mplayerhq.hu
Sat Nov 17 19:26:25 CET 2007
Author: reimar
Date: Sat Nov 17 19:26:25 2007
New Revision: 25068
Log:
Open device file only right before we need it, so we do not
have to add close to all the abort code-paths
Modified:
trunk/stream/stream_dvd.c
Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c (original)
+++ trunk/stream/stream_dvd.c Sat Nov 17 19:26:25 2007
@@ -65,11 +65,6 @@ static void dvd_set_speed(char *device,
if (!S_ISBLK(st.st_mode)) return; /* not a block device */
- if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1) {
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDspeedCantOpen);
- return;
- }
-
if (speed < 100) { /* speed times 1350KB/s (DVD single speed) */
speed *= 1350;
}
@@ -114,6 +109,11 @@ static void dvd_set_speed(char *device,
AV_WB16(buffer + 18, 1000);
AV_WB16(buffer + 26, 1000);
+ if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1) {
+ mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDspeedCantOpen);
+ return;
+ }
+
if (ioctl(fd, SG_IO, &sghdr) < 0) {
mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitFail);
} else
More information about the MPlayer-cvslog
mailing list