[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdemultimedia/kscd/libwm
From: Alex Kern <alex.kern () gmx ! de>
Date: 2004-07-08 17:42:25
Message-ID: 20040708174225.2BC0C126C2 () office ! kde ! org
[Download RAW message or body]
CVS commit by kernalex:
do gen_get_status simple
M +22 -62 cdrom.c 1.30
--- kdemultimedia/kscd/libwm/cdrom.c #1.29:1.30
@@ -328,50 +328,13 @@ wm_cd_status( void )
int mode, err;
- if(!drive.proto ||
- wm_cur_cdmode == WM_CDM_EJECTED ||
- wm_cur_cdmode == WM_CDM_DEVICECHANGED) {
- /* device was be changed */
-
- if(drive.proto && drive.proto->gen_close)
- drive.proto->gen_close(&drive);
-
- if (wm_cur_cdmode != WM_CDM_EJECTED)
- wm_cur_cdmode = WM_CDM_UNKNOWN;
- }
-
- if(WM_CDS_NO_DISC(wm_cur_cdmode)) {
- /*
- * Open the drive.
- * This returns >0 if the device isn't ready and <0 if error.
- */
- cur_pos_abs = cur_pos_rel = cur_frame = 0;
- cur_pos_rel = cur_pos_abs = 0;
- thiscd.ntracks = 0;
-
+ if(!drive.proto) {
+ oldmode = WM_CDM_UNKNOWN;
err = wmcd_open( &drive );
if (err < 0) {
wm_cur_cdmode = WM_CDM_UNKNOWN;
- } else if (err > 0) {
- wm_cur_cdmode = WM_CDM_NO_DISC;
- } else if(read_toc() || 0 == thiscd.ntracks) {
- wm_cur_cdmode = WM_CDM_NO_DISC;
- } else {
- /* refresh cdtext info */
- get_glob_cdtext(&drive, 1);
-
- thiscd.curtrack = 0;
- wm_cur_cdmode = WM_CDM_STOPPED;
+ return err;
}
- return wm_cur_cdmode;
}
- /* If the user hit the stop button, don't pass PLAYING as oldmode.
- * Likewise, if we've just started playing, don't remember that
- * we were stopped before (or the state machine in get_drive_status
- * can get confused.)
- */
- if( (wm_cur_cdmode == WM_CDM_STOPPED) || (wm_cur_cdmode == WM_CDM_PLAYING) )
- oldmode = wm_cur_cdmode;
-
if(drive.proto->gen_get_drive_status &&
(drive.proto->gen_get_drive_status)(&drive, oldmode, &mode, &cur_frame,
@@ -385,22 +348,16 @@ wm_cd_status( void )
}
- /* workaround for CDDA get_status,
- I can not found a way for a cdda to get its right current mode. */
- if(drive.cdda && WM_CDS_NO_DISC(mode) && !read_toc()) {
- mode = WM_CDM_STOPPED;
- }
-
- oldmode = mode;
-
- if((mode == WM_CDM_EJECTED || mode == WM_CDM_UNKNOWN) &&
- (wm_cur_cdmode != WM_CDM_DEVICECHANGED)) {
- wm_cur_cdmode = WM_CDM_EJECTED;
- thiscd.curtrack = -1;
+ if(WM_CDS_NO_DISC(oldmode) && WM_CDS_DISC_READY(mode)) {
+ /* device changed */
thiscd.ntracks = 0;
- thiscd.length = thiscd.curtracklen = 1;
- cur_pos_abs = cur_pos_rel = cur_frame = 0;
+ if(read_toc() || 0 == thiscd.ntracks)
+ mode = WM_CDM_NO_DISC;
+ else /* refresh cdtext info */
+ get_glob_cdtext(&drive, 1);
- return wm_cur_cdmode;
+ wm_lib_message(WM_MSG_LEVEL_DEBUG|WM_MSG_CLASS, "device status changed() from %s to %s\n",
+ gen_status(oldmode), gen_status(mode));
}
+ oldmode = mode;
/*
@@ -428,5 +385,5 @@ wm_cd_status( void )
if (mode == WM_CDM_UNKNOWN)
{
- mode = WM_CDM_STOPPED;
+ mode = WM_CDM_NO_DISC;
cur_lasttrack = cur_firsttrack = -1;
}
@@ -460,6 +417,8 @@ wm_cd_status( void )
case WM_CDM_FORWARD:
case WM_CDM_EJECTED:
+ wm_cur_cdmode = mode;
break;
}
+
wm_lib_message(WM_MSG_LEVEL_DEBUG|WM_MSG_CLASS,
"wm_cd_status returns %s\n", gen_status(wm_cur_cdmode));
@@ -709,4 +668,5 @@ wm_cd_get_cdtext( void )
status = wm_cd_status();
+
if(WM_CDS_NO_DISC(status))
return NULL;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic