From cbbf46ebb6287b34d0bca3cb06796e01183562ed Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 30 May 2020 14:52:26 +0900 Subject: Improved support for bluray discs. Signed-off-by: Michele Calgaro (cherry picked from commit 32381684a2eecaaa43616d5bc8ab51780d42e336) --- tdeioslave/media/mediamanager/halbackend.cpp | 32 +++++++++++++-- tdeioslave/media/mediamanager/linuxcdpolling.cpp | 46 ++++++++++++++-------- tdeioslave/media/mediamanager/linuxcdpolling.h | 4 +- .../media/mediamanager/tdehardwarebackend.cpp | 20 +++++----- 4 files changed, 70 insertions(+), 32 deletions(-) (limited to 'tdeioslave/media/mediamanager') diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp index 637b16bf0..37099cc84 100644 --- a/tdeioslave/media/mediamanager/halbackend.cpp +++ b/tdeioslave/media/mediamanager/halbackend.cpp @@ -571,24 +571,45 @@ void HALBackend::setVolumeProperties(Medium* medium) if ((discType == LIBHAL_VOLUME_DISC_TYPE_CDROM) || (discType == LIBHAL_VOLUME_DISC_TYPE_CDR) || (discType == LIBHAL_VOLUME_DISC_TYPE_CDRW)) + { if (libhal_volume_disc_is_blank(halVolume)) { mimeType = "media/blankcd"; medium->unmountableState(""); } else + { mimeType = "media/cdwriter" + MOUNT_SUFFIX; + } - if ((discType == LIBHAL_VOLUME_DISC_TYPE_DVDROM) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRAM) || + else if ((discType == LIBHAL_VOLUME_DISC_TYPE_DVDROM) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRAM) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDR) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRW) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDPLUSR) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDPLUSRW) ) + { if (libhal_volume_disc_is_blank(halVolume)) { mimeType = "media/blankdvd"; medium->unmountableState(""); } else + { mimeType = "media/dvd" + MOUNT_SUFFIX; + } + } + else if ((discType == LIBHAL_VOLUME_DISC_TYPE_BDROM) || (discType == LIBHAL_VOLUME_DISC_TYPE_BDR) || + (discType == LIBHAL_VOLUME_DISC_TYPE_BDRE) || (discType == LIBHAL_VOLUME_DISC_TYPE_HDDVDROM) || + (discType == LIBHAL_VOLUME_DISC_TYPE_HDDVDR) || (discType == LIBHAL_VOLUME_DISC_TYPE_HDDVDRW) ) + { + if (libhal_volume_disc_is_blank(halVolume)) + { + mimeType = "media/blankbluray"; + medium->unmountableState(""); + } + else + { + mimeType = "media/bluray" + MOUNT_SUFFIX; + } + } if (libhal_volume_disc_has_audio(halVolume) && !libhal_volume_disc_has_data(halVolume)) { @@ -599,13 +620,16 @@ void HALBackend::setVolumeProperties(Medium* medium) medium->setIconName(TQString::null); /* check if the disc id a vcd or a video dvd */ - if (libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_vcd", NULL)) { + if (libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_vcd", NULL)) + { mimeType = "media/vcd"; } - else if (libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_svcd", NULL)) { + else if (libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_svcd", NULL)) + { mimeType = "media/svcd"; } - else if (libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_videodvd", NULL)) { + else if (libhal_device_get_property_bool(m_halContext, udi, "volume.disc.is_videodvd", NULL)) + { mimeType = "media/dvdvideo"; } diff --git a/tdeioslave/media/mediamanager/linuxcdpolling.cpp b/tdeioslave/media/mediamanager/linuxcdpolling.cpp index 0fcda8d0f..eccdf1f34 100644 --- a/tdeioslave/media/mediamanager/linuxcdpolling.cpp +++ b/tdeioslave/media/mediamanager/linuxcdpolling.cpp @@ -216,7 +216,7 @@ void LinuxCDPolling::slotMediumAdded(const TQString &id) TQString mime = medium->mimeType(); kdDebug(1219) << "mime == " << mime << endl; - if (mime.find("dvd")==-1 && mime.find("cd")==-1) return; + if (mime.find("dvd")==-1 && mime.find("cd")==-1 && mime.find("bluray")==-1) return; if (!medium->isMounted()) { @@ -255,7 +255,7 @@ void LinuxCDPolling::slotMediumStateChanged(const TQString &id) TQString mime = medium->mimeType(); kdDebug(1219) << "mime == " << mime << endl; - if (mime.find("dvd")==-1 && mime.find("cd")==-1) return; + if (mime.find("dvd")==-1 && mime.find("cd")==-1 && mime.find("bluray")==-1) return; if (!m_threads.contains(id) && !medium->isMounted()) { @@ -319,7 +319,12 @@ static TQString baseType(const Medium *medium) FstabBackend::guess(devNode, mountPoint, fsType, mounted, mimeType, iconName, label); - if (devNode.find("dvd")!=-1) + if (devNode.find("bluray")!=-1) + { + kdDebug(1219) << "=> bluray" << endl; + return "bluray"; + } + else if (devNode.find("dvd")!=-1) { kdDebug(1219) << "=> dvd" << endl; return "dvd"; @@ -373,25 +378,30 @@ void LinuxCDPolling::applyType(DiscType type, const Medium *medium) m_mediaList.changeMediumState(id, "audiocd:/?device="+dev, notify, "media/audiocd"); break; - case DiscType::VCD: - m_mediaList.changeMediumState(id, false, notify, "media/vcd"); + case DiscType::BLURAY: + m_mediaList.changeMediumState(id, false, notify, "media/blurayvideo"); + break; + case DiscType::DVD: + m_mediaList.changeMediumState(id, false, notify, "media/dvdvideo"); break; case DiscType::SVCD: m_mediaList.changeMediumState(id, false, notify, "media/svcd"); break; - case DiscType::DVD: - m_mediaList.changeMediumState(id, false, notify, "media/dvdvideo"); + case DiscType::VCD: + m_mediaList.changeMediumState(id, false, notify, "media/vcd"); break; case DiscType::Blank: - if (baseType(medium)=="dvd") + if (baseType(medium)=="bluray") { - m_mediaList.changeMediumState(id, false, - notify, "media/blankdvd"); + m_mediaList.changeMediumState(id, false, notify, "media/blankbluray"); + } + else if (baseType(medium)=="dvd") + { + m_mediaList.changeMediumState(id, false, notify, "media/blankdvd"); } else { - m_mediaList.changeMediumState(id, false, - notify, "media/blankcd"); + m_mediaList.changeMediumState(id, false, notify, "media/blankcd"); } break; case DiscType::None: @@ -444,18 +454,22 @@ DiscType LinuxCDPolling::identifyDiscType(const TQCString &devNode, return DiscType::Audio; case CDS_DATA_1: case CDS_DATA_2: - if (hasDirectory(devNode, "video_ts")) + if (hasDirectory(devNode, "BDMV")) { - return DiscType::DVD; + return DiscType::BLURAY; } - else if (hasDirectory(devNode, "vcd")) + else if (hasDirectory(devNode, "video_ts")) { - return DiscType::VCD; + return DiscType::DVD; } else if (hasDirectory(devNode, "svcd")) { return DiscType::SVCD; } + else if (hasDirectory(devNode, "vcd")) + { + return DiscType::VCD; + } else { return DiscType::Data; diff --git a/tdeioslave/media/mediamanager/linuxcdpolling.h b/tdeioslave/media/mediamanager/linuxcdpolling.h index 3dec7e3ee..fc4947470 100644 --- a/tdeioslave/media/mediamanager/linuxcdpolling.h +++ b/tdeioslave/media/mediamanager/linuxcdpolling.h @@ -1,5 +1,5 @@ /* This file is part of the KDE Project - Copyright (c) 2004 Kévin Ottens + Copyright (c) 2004 Kévin Ottens This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -30,7 +30,7 @@ class DiscType { public: enum Type { None, Unknown, Audio, Data, DVD, Mixed, - Blank, VCD, SVCD, UnknownType, Broken }; + Blank, VCD, SVCD, BLURAY, UnknownType, Broken }; DiscType(Type type = Unknown); diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index 8869095d1..3dadda275 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -656,34 +656,34 @@ void TDEBackend::setVolumeProperties(Medium* medium) if (sdevice->isDiskOfType(TDEDiskDeviceType::BDROM)) { mimeType = "media/bluray" + MOUNT_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { - mimeType = "media/blankbd"; + mimeType = "media/blankbluray"; medium->unmountableState(""); - diskLabel = i18n("Blank BD-ROM"); + diskLabel = i18n("Blank BLURAY-ROM"); } } if (sdevice->isDiskOfType(TDEDiskDeviceType::BDR)) { mimeType = "media/bluray" + MOUNT_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { - mimeType = "media/blankbd"; + mimeType = "media/blankbluray"; medium->unmountableState(""); - diskLabel = i18n("Blank BD-R"); + diskLabel = i18n("Blank BLURAY-R"); } } if (sdevice->isDiskOfType(TDEDiskDeviceType::BDRW)) { mimeType = "media/bluray" + MOUNT_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { - mimeType = "media/blankbd"; + mimeType = "media/blankbluray"; medium->unmountableState(""); - diskLabel = i18n("Blank BD-RW"); + diskLabel = i18n("Blank BLURAY-RW"); } } if (sdevice->isDiskOfType(TDEDiskDeviceType::HDDVDROM)) { mimeType = "media/bluray" + MOUNT_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { - mimeType = "media/blankhddvd"; + mimeType = "media/blankbluray"; medium->unmountableState(""); diskLabel = i18n("Blank HDDVD-ROM"); } @@ -692,7 +692,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) if (sdevice->isDiskOfType(TDEDiskDeviceType::HDDVDR)) { mimeType = "media/bluray" + MOUNT_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { - mimeType = "media/blankhddvd"; + mimeType = "media/blankbluray"; medium->unmountableState(""); diskLabel = i18n("Blank HDDVD-R"); } @@ -701,7 +701,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) if (sdevice->isDiskOfType(TDEDiskDeviceType::HDDVDRW)) { mimeType = "media/bluray" + MOUNT_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { - mimeType = "media/blankhddvd"; + mimeType = "media/blankbluray"; medium->unmountableState(""); diskLabel = i18n("Blank HDDVD-RW"); } @@ -720,7 +720,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) mimeType = "media/dvdvideo"; } if (sdevice->isDiskOfType(TDEDiskDeviceType::BDVideo)) { - mimeType = "media/bdvideo"; + mimeType = "media/blurayvideo"; } medium->setIconName(TQString::null); -- cgit v1.2.1