[mythtv] Ticket #9520: [PATCH] MediaMonitor::GetMedias - search for multile media types

Stuart Morgan stuart at tase.co.uk
Sat Jan 29 13:14:46 UTC 2011


On Saturday 29 Jan 2011 12:23:59 MythTV wrote:
> Comment (by Lawrence Rust <lvr@…>):
> 
>  As it stands, MythGallery asks for MEDIATYPE_DATA which in the case of a
>  disk containing gifs and jpegs and scanned statistically results in no
>  match.  If MythGallery were to request MEDIATYPE_MGALLERY then a disk
>  without gifs or jpegs would not be matched even though the Qt QImageReader
>  might be able to read them.  QtImageReader uses system plugins to decode
>  images so you need to ask at runtime what formats are supported.  So it's
>  pragmatic to call GetMedias with a bit mask of types.
> 
>  I'm not suggesting a re-definition of MediaType as a bit mask.  That would
>  break a lot of code and weaken type checking.  Just change the parameter
>  type of GetMedias.
> 
>  I don't think it's necessary for MediaTypeString to return a list because
>  all the other APIs take an enum MediaType i.e. a single type.
>  Furthermore, it would unnecessarily complicate the code for no obvious
>  benefit.

Since we can query the supported image types from QT we should be registering 
that list and not a hard-coded one.

Having spent some time looking at the media monitor and considering how best 
to use it in the development of new features I think we need to scrap the 
existing register/callback setup. What I have in mind is a setup that replaces 
the existing plugin API so that every plugin creates and registers an object 
which monitors for events and does away with all the ugly callbacks we have 
now. There are other benefits to this which I can detail elsewhere if anyone 
needs convincing.

If we're going to change that, then we might as well look at changes to the 
media monitor. For example changing MediaType to a bitmask is actually a 
pretty sensible idea as media might hold a wide variety of content. Think 
music CDs containing a data partition with music videos and photos, or 
external drives with both music and video.

Given that we then have to consider asking the user want they want to do when 
two different plugins have been configured to 'auto-play', a popup asking if 
the user wants to "a) Watch videos or b) View Images or c) Neither".

While we're on the subject, MGALLERY should be renamed to IMAGES. There could 
be any number of plugins registering interest in images.
-- 
Stuart Morgan


More information about the mythtv-dev mailing list