Opened 13 years ago

Closed 9 years ago

#2598 closed enhancement (fixed)

Use MythMediaMonitor in plugins

Reported by: Nigel Owned by: Nigel
Priority: minor Milestone: unknown
Component: Plugin - MythMusic Version: 0.20
Severity: low Keywords:
Cc: Ticket locked: no

Description

MythMusic, and mtd (the transcoding part of MythDVD) use active polling to detect CD/DVD insertion. To get these working with multiple drives, or on OS X, they need to use MythMediaMonitor. Fairly simple - see [11333]

Attachments (6)

mtd.patch (3.0 KB) - added by awk@… 13 years ago.
Patches to mtd to use DiskArbitration? Framework on Mac OS X
mtd-darwin.cpp (9.9 KB) - added by awk@… 13 years ago.
mtd-darwin.cpp - Darwin subclass of mtd disk checking thread uses DiskArbitration?
mtd-darwin.h (507 bytes) - added by awk@… 13 years ago.
mtd-darwin.h - Darwin subclass of mtd disk checking thread uses DiskArbitration?
cdstore.patch (57.1 KB) - added by myth@… 13 years ago.
redo cd monitoring to use mediamonitor
cdstore.2.patch (57.5 KB) - added by myth@… 13 years ago.
updated patch, fixes race condition
cdstore.3.patch (41.6 KB) - added by myth@… 13 years ago.
updated to latest svn and fixes a wrong include.

Download all attachments as: .zip

Change History (25)

comment:1 Changed 13 years ago by Nigel

(In [11602]) Tidyup of DVD/VCD/SVCD directory detection. Tested on OS X, but have only tried compiling on Linux. Includes Mac OS X audio detection hack which will be needed for plugin MythMediaMonitor upgrade. See #2598

Changed 13 years ago by awk@…

Attachment: mtd.patch added

Patches to mtd to use DiskArbitration? Framework on Mac OS X

Changed 13 years ago by awk@…

Attachment: mtd-darwin.cpp added

mtd-darwin.cpp - Darwin subclass of mtd disk checking thread uses DiskArbitration?

Changed 13 years ago by awk@…

Attachment: mtd-darwin.h added

mtd-darwin.h - Darwin subclass of mtd disk checking thread uses DiskArbitration?

comment:2 Changed 13 years ago by awk@…

Using the MythMediaMonitor classes directly looks really rather complicated - since the Media Monitor posts custom events to the main thread for handling in a window whenever the media changes (disks inserted etc).

Since mtd doesn't (and wouldn't I think) ever have a window to handle such events it seemed more straight forward to leverage the DiskArbitration? changes from MythMediaMonitor and create a darwin/disk arbitration specific thread to handle the OS disk insertion/removal events.

comment:3 Changed 13 years ago by awk@…

I should add that my patches and new files are only for mtd - I don't use mythmusic myself so I've not tackled whatever media 'sniffing' it does.

comment:4 Changed 13 years ago by myth@…

I've actually been working on making MythMusic use MythMediaMonitor to look for CDs. I'm nearly done, just need to fix PlaybackBoxMusic? to it can actually play the audio tracks when detected. I hope I'll have a submittable patch sometime next week.

Changed 13 years ago by myth@…

Attachment: cdstore.patch added

redo cd monitoring to use mediamonitor

comment:5 Changed 13 years ago by myth@…

Description of cdstore.patch ;

Introduce two new classes, StoreManager? and Store; StoreManager creates Stores when given a MythMediaDevice? via an event from MediaMonitor? (passed to it from whoever is registered as the event handler). The returned store is a subclass that can handle the actual store. Currently only a subclass for CDs is implemented, but I've also got an iPod store in the works.

Store is responsible for creating the metadata objects that represent the store, as well as it's name. The intent here is that this object will later be the one that can add/remove tracks from a portable player (iPod...).

Add a call to CdDecoder? so you can override the configured device. If there's an event on a CD device, it should be up to MediaMonitor to decide whether to issue an event or not, and if, CdDecoder should just accept the device it's given.

Give GenericTree? two templated methods findNode and isNodeInPath that traverses a path and looks for a specific in a path respectively. findNode replaces recursiveNodeFinder and isNodeInPath replaces checkNode. recursiveNoderFinder seemed overly complex and didn't even look like it was correct.

Change UIManagedTreeListType to use these and to not return a pointer to the path when getRouteToActive is called. All calls would dereference the pointer and copy it anyway.

Change MediaMonitor to post events for OPEN and UNPLUGGED as well for USEABLE and MOUNTED. Otherwise listeners couldn't detect that a CD had been removed.

Added some helpers (setPathTo/getPathTo) to playbackbox.cpp to replace the many many places where it would construct a path to "Active Queue".

Make DatabaseBox? and PlaybackBoxMusic? use the StoreManager, and kinda prepare PlaybackBoxMusic to be able to handle multiple connected devices. For DatabaseBox?, this also kills off ReadCDThread, as this is now handled by StoreManager, which does the loading in a thread.

Change MusicNode::writeTree to assign the given counter as the int component of the GenericTree node, also return the created node so that a caller (PlaybackBoxMusic) can remember which node was added. This lets PlaybackBoxMusic easily insert new nodes at the root for new devices, and when the device is removed, move out from that branch if necessary and remove it from the tree.

Changed 13 years ago by myth@…

Attachment: cdstore.2.patch added

updated patch, fixes race condition

Changed 13 years ago by myth@…

Attachment: cdstore.3.patch added

updated to latest svn and fixes a wrong include.

comment:6 Changed 12 years ago by Nigel

(In [13336]) Don't lookup CD device in decoder, set it in the parent. See #2598. See #3077

comment:7 Changed 12 years ago by Nigel

(In [13362]) Multiple CD drive with media manager in Music Plugin. See #3077. See #2598

comment:8 Changed 12 years ago by Nigel

(In [13364]) Multiple DVD drive with media manager in Video Plugin. See #3077. See #2598. Not real happy about the structure here (TitleDialog? and DVDRipBox need to share the same dvd_device, and it the needs to get passed to mtd for use?), but that will have to wait for some extra, um, "brave pills". Until then, setting DVDDeviceLocation to "default" should let you play from multiple drives, but will break ripping.

comment:9 Changed 12 years ago by Nigel

(In [13829]) Add commands to allow setting (and forgetting) DVD device path. See #2598. Should enable multiple-drive support. Changes in the caller (DVDRipBox) will be next, and when the MediaMonitor? chain is modified to also send OPEN/UNPLUGGED/NOTMOUNTED messages, the disc checking thread can be removed

comment:10 Changed 12 years ago by Nigel

(In [13838]) Add code so MythMusic tells the MTD what drive to monitor/rip. Users with multiple DVD drives should now be able to rip from all of them. Either through the MythMediaMonitor, or by setting DVDDeviceLocation to default. See #2598

comment:11 Changed 12 years ago by Nigel

(In [13877]) Now also send eject/unplug events. See #2598. Also reduces VERBOSE output

comment:12 Changed 12 years ago by Nigel

(In [13879]) Device ignore list - see #3663. Send eject events - see #2598. Also changes the way events are send (now as a side-effect of status change, same as Unix)

comment:13 Changed 12 years ago by Nigel

(In [13937]) A few missing parts in [13879]. See #3662. See #2598.

comment:14 Changed 12 years ago by Nigel

(In [14177]) Add another method for plugins to use, tidy some login and comments. See #2598

comment:15 Changed 11 years ago by Dibblah

Status: newassigned

comment:16 Changed 10 years ago by stuartm

Component: mythmusicPlugin - MythMusic

comment:17 Changed 10 years ago by stuartm

Nigel, still working on this or can the ticket now be closed?

comment:18 Changed 10 years ago by stuartm

Status: assignedinfoneeded

comment:19 Changed 9 years ago by robertm

Resolution: fixed
Status: infoneededclosed

Appears fixed, can be re-opened as necessary if not. No change in three years.

Note: See TracTickets for help on using tickets.