MediaPlayer: close() cd/dvd device after eject.
We were not closing cd/dvd device after eject. Also changed fDevice member to a local variable, since we only use it in one place. Change-Id: I169da97501f98e30deded1f5ff53d3bc00459eab Reviewed-on: https://review.haiku-os.org/c/haiku/+/4247 Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
committed by
Axel Dörfler
parent
899fdd042a
commit
60ead048b5
@@ -1254,14 +1254,15 @@ MainWin::Eject()
|
|||||||
{
|
{
|
||||||
status_t mediaStatus = B_DEV_NO_MEDIA;
|
status_t mediaStatus = B_DEV_NO_MEDIA;
|
||||||
// find the cd player device
|
// find the cd player device
|
||||||
fDevice = FindCdPlayerDevice("/dev/disk");
|
int cdPlayerFd = FindCdPlayerDevice("/dev/disk");
|
||||||
// get the status first
|
// get the status first
|
||||||
ioctl(fDevice, B_GET_MEDIA_STATUS, &mediaStatus, sizeof(mediaStatus));
|
ioctl(cdPlayerFd, B_GET_MEDIA_STATUS, &mediaStatus, sizeof(mediaStatus));
|
||||||
// if door open, load the media, else eject the cd
|
// if door open, load the media, else eject the cd
|
||||||
status_t result = ioctl(fDevice,
|
status_t result = ioctl(cdPlayerFd,
|
||||||
mediaStatus == B_DEV_DOOR_OPEN ? B_LOAD_MEDIA : B_EJECT_DEVICE);
|
mediaStatus == B_DEV_DOOR_OPEN ? B_LOAD_MEDIA : B_EJECT_DEVICE);
|
||||||
if (result != B_NO_ERROR)
|
if (result != B_NO_ERROR)
|
||||||
printf("Error ejecting device");
|
printf("Error ejecting device");
|
||||||
|
close(cdPlayerFd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ private:
|
|||||||
bool fScaleFullscreenControls;
|
bool fScaleFullscreenControls;
|
||||||
bigtime_t fInitialSeekPosition;
|
bigtime_t fInitialSeekPosition;
|
||||||
bool fAllowWinding;
|
bool fAllowWinding;
|
||||||
int fDevice;
|
|
||||||
|
|
||||||
static int sNoVideoWidth;
|
static int sNoVideoWidth;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user