Opened 18 years ago

Closed 18 years ago

#1753 closed enhancement (fixed)

MythMediaMonitor for Darwin and OS X

Reported by: Nigel Owned by: Nigel
Priority: minor Milestone: 0.21
Component: mythtv Version: 0.19
Severity: medium Keywords: OSX media monitor mtd
Cc: nigel@… Ticket locked: no

Description

Darwin's IO is very different to other Unixes. There is no /dev/cdrom or /dev/dvd. The operating system creates /dev/disk? when a mountable volume is inserted/attached. This makes the drive detection code very different.
Apple has a Disk Arbitration framework that uses a daemon (/usr/sbin/diskarbitrationd), and can call user code when a volume is inserted/removed/formatted/et c. This is a fairly close match to what MythMediaMonitor does.
Please create a darwin-specific MythMediaMonitor class (e.g. mythmediamonitor-darwin.cpp) which is compiled in place of the existing Unix one (I think this is better than subclassing). For extra points, modify mythdvd/mtd to use MythMediaMonitor instead of its own device polling.

Attachments (16)

mythcdrom-darwin.cpp (2.9 KB) - added by awk@… 18 years ago.
libs/libmyth/mythcdrom-darwin.cpp - new darwin specific cd/dvd subclass
mythmediamonitor-darwin.h (385 bytes) - added by awk@… 18 years ago.
libs/libmyth/mythmediamonitor-darwin.cpp - new darwin specific media insertion/removal handlers
mythmediamonitor-darwin.cpp (5.1 KB) - added by awk@… 18 years ago.
libs/libmyth/mythmediamonitor-darwin.cpp - new darwin specific media insertion/removal handlers
mythcdrom.h.patch (770 bytes) - added by awk@… 18 years ago.
libs/libmyth/mythcdrom.h - patch for Darwin CD subclass
mythcdrom.cpp.patch (483 bytes) - added by awk@… 18 years ago.
libs/libmyth/mythcdrom.cpp - patch to create Darwin CD subclass
mythmediamonitor.h.patch (666 bytes) - added by awk@… 18 years ago.
libs/libmyth/mythmediamonitor.h - patch for Darwin specific methods.
mythmediamonitor.cpp.patch (1.6 KB) - added by awk@… 18 years ago.
libs/libmyth/mythmediamonitor.cpp - patch for Darwin specific methods.
libmyth.pro.patch (953 bytes) - added by awk@… 18 years ago.
libs/libmyth/libmyth.pro - patch to add Darwin headers and sources
mythmediamonitor.h.2.patch (806 bytes) - added by awk@… 18 years ago.
mythmediamonitor.h.patch V2 - 'cleanup' removes some Mac OS X header dependancies
mythmediamonitor.cpp.2.patch (1.1 KB) - added by awk@… 18 years ago.
mythmediamonitor.cpp.patch V2 - 'cleanup' removes some Mac OS X header dependancies
mythmediamonitor-darwin.2.h (385 bytes) - added by awk@… 18 years ago.
mythmediamonitor-darwin.cpp V2 - 'cleanup' removes some Mac OS X header dependancies
mythmediamonitor-darwin.2.cpp (6.0 KB) - added by awk@… 18 years ago.
mythmediamonitor-darwin.cpp V2 - 'cleanup' removes some Mac OS X header dependancies
patch.mediamon.2 (14.4 KB) - added by Nigel 18 years ago.
Last version before I subclass MythediaMonitor?
mythmediamonitor.patch (5.3 KB) - added by awk@… 18 years ago.
Patches to mythmediamonitor, cdrom classes and .pro file to support Darwin Disk arbitration
mythmediamonitor-darwin.3.h (1.2 KB) - added by awk@… 18 years ago.
Updated Darwin specific media monitor subclass
mythmediamonitor-darwin.3.cpp (7.5 KB) - added by awk@… 18 years ago.
Updated Darwin specific media monitor subclass

Download all attachments as: .zip

Change History (27)

Changed 18 years ago by awk@…

Attachment: mythcdrom-darwin.cpp added

libs/libmyth/mythcdrom-darwin.cpp - new darwin specific cd/dvd subclass

Changed 18 years ago by awk@…

Attachment: mythmediamonitor-darwin.h added

libs/libmyth/mythmediamonitor-darwin.cpp - new darwin specific media insertion/removal handlers

Changed 18 years ago by awk@…

Attachment: mythmediamonitor-darwin.cpp added

libs/libmyth/mythmediamonitor-darwin.cpp - new darwin specific media insertion/removal handlers

Changed 18 years ago by awk@…

Attachment: mythcdrom.h.patch added

libs/libmyth/mythcdrom.h - patch for Darwin CD subclass

Changed 18 years ago by awk@…

Attachment: mythcdrom.cpp.patch added

libs/libmyth/mythcdrom.cpp - patch to create Darwin CD subclass

Changed 18 years ago by awk@…

Attachment: mythmediamonitor.h.patch added

libs/libmyth/mythmediamonitor.h - patch for Darwin specific methods.

Changed 18 years ago by awk@…

Attachment: mythmediamonitor.cpp.patch added

libs/libmyth/mythmediamonitor.cpp - patch for Darwin specific methods.

Changed 18 years ago by awk@…

Attachment: libmyth.pro.patch added

libs/libmyth/libmyth.pro - patch to add Darwin headers and sources

comment:1 Changed 18 years ago by awk@…

Owner: changed from awk@… to anonymous
Status: newassigned

The attached patches and new files enable mythfrontend to detect when a DVD is inserted and to carry out the users selected 'on insertion' action (rip, play etc). Ejecting the DVD will remove the device from the media monitor list.

This code 'should' work for audio CD's too - but I don't have a mythmusic build to test this with.

comment:2 Changed 18 years ago by Nigel

Owner: changed from anonymous to Nigel
Status: assignednew

Changed 18 years ago by awk@…

Attachment: mythmediamonitor.h.2.patch added

mythmediamonitor.h.patch V2 - 'cleanup' removes some Mac OS X header dependancies

Changed 18 years ago by awk@…

mythmediamonitor.cpp.patch V2 - 'cleanup' removes some Mac OS X header dependancies

Changed 18 years ago by awk@…

Attachment: mythmediamonitor-darwin.2.h added

mythmediamonitor-darwin.cpp V2 - 'cleanup' removes some Mac OS X header dependancies

Changed 18 years ago by awk@…

mythmediamonitor-darwin.cpp V2 - 'cleanup' removes some Mac OS X header dependancies

comment:3 Changed 18 years ago by awk@…

The 'V2' patches and new 'darwin' files attached remove the inclusion of mac specfic headers in mediamonitor and the friend fucntions by adding new 'callback' methods which use Qt types to MonitorThread?. They in turn can all MediaMonitor::AddDevice? (etc) to get the new devices added/removed.

comment:4 Changed 18 years ago by Nigel

(In [9898]) OS X framework check, will be used by MythMediaMonitor check in. See #1753

comment:5 Changed 18 years ago by Nigel

Status: newassigned

I was doing the svn checkin of the final code, when I remembered the many times Isaac asked people to rework their patches because they had too many #ifdefs. "Always better to sub-class."
So I will. But, so that it isn't lost forever... svn diff libs/libmyth >../patch.mediamon.2

Changed 18 years ago by Nigel

Attachment: patch.mediamon.2 added

Last version before I subclass MythediaMonitor?

comment:6 Changed 18 years ago by Nigel

(In [10224]) Mac OS X - define qmake config symbol if disk arbitration found. See #1753

comment:7 Changed 18 years ago by Nigel

Milestone: 0.200.21

Sorry Andrew, I didn't get the subclassing tidied up in time.

comment:8 Changed 18 years ago by awk@…

New patch attached which subclasses MediaMonitor? for Darwin. The subclass handles the Darwin specific thread and also overrides AddDevice?() to remove the stat() calls (which don't apply on Mac OS X).

Note that a couple of methods in MediaMonitor? needed to become virtual to allow the subclassing to work correctly.

Changed 18 years ago by awk@…

Attachment: mythmediamonitor.patch added

Patches to mythmediamonitor, cdrom classes and .pro file to support Darwin Disk arbitration

Changed 18 years ago by awk@…

Attachment: mythmediamonitor-darwin.3.h added

Updated Darwin specific media monitor subclass

Changed 18 years ago by awk@…

Updated Darwin specific media monitor subclass

comment:9 Changed 18 years ago by awk@…

I also have some patches that allows the 'eject disk' option to work from the menu too.

However this ticket already has enought overlaid/redundant patches so I think I'll wait until we get this one sorted out and then open a new one for 'Support Eject operation on Mac OS X'

comment:10 Changed 18 years ago by Nigel

(In [11285]) At long last, Mac OS X DiskArbitration? based MediaMonitor?. See #1753 Also a small change to ChooseAndEjectMedia?() (it would call eject() twice)

comment:11 Changed 18 years ago by Nigel

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.