, _does_download( does_download_r )
, _attach_mtime(0)
, _url( url_r )
+ , _parentId(0)
{
if ( !attach_point_r.empty() ) {
///////////////////////////////////////////////////////////////////
// DESCRIPTION :
//
bool
-MediaHandler::checkAttached(bool aDevice) const
+MediaHandler::checkAttached(bool isDevice, bool fsType) const
{
bool _isAttached = false;
MountEntries::const_iterator e;
for( e = entries.begin(); e != entries.end(); ++e)
{
- bool isDevice = (Pathname(e->src).dirname() == "/dev");
- if( aDevice == isDevice)
+ bool is_device = (Pathname(e->src).dirname() == "/dev");
+ if( is_device == isDevice)
{
PathInfo dinfo(e->src);
- MediaSource media(ref.mediaSource->type, e->src,
- dinfo.major(), dinfo.minor());
-
- if( ref.mediaSource->equals( media) &&
- ref.attachPoint->path == Pathname(e->dir))
- {
- DBG << "Found media "
- << ref.mediaSource->asString()
- << " in the mount table" << std::endl;
- _isAttached = true;
- break;
- }
- // differs
+ std::string mtype(fsType ? e->type : ref.mediaSource->type);
+ MediaSource media(mtype, e->src, dinfo.major(), dinfo.minor());
+
+ if( ref.mediaSource->equals( media) &&
+ ref.attachPoint->path == Pathname(e->dir))
+ {
+ DBG << "Found media "
+ << ref.mediaSource->asString()
+ << " in the mount table" << std::endl;
+ _isAttached = true;
+ break;
+ }
+ // differs
+ }
+ else
+ {
+ std::string mtype(fsType ? e->type : ref.mediaSource->type);
+ MediaSource media(mtype, e->src);
+ if( ref.mediaSource->equals( media) &&
+ ref.attachPoint->path == Pathname(e->dir))
+ {
+ DBG << "Found media "
+ << ref.mediaSource->asString()
+ << " in the mount table" << std::endl;
+ _isAttached = true;
+ break;
+ }
+ // differs
}
- else
- {
- MediaSource media(e->type, e->src);
-
- if( ref.mediaSource->equals( media) &&
- ref.attachPoint->path == Pathname(e->dir))
- {
- DBG << "Found media "
- << ref.mediaSource->asString()
- << " in the mount table" << std::endl;
- _isAttached = true;
- break;
- }
- // differs
- }
}
if( !_isAttached)
///////////////////////////////////////////////////////////////////
//
+// METHOD NAME : MediaHandler::dependsOnParent
+// METHOD TYPE : bool
+//
+// DESCRIPTION :
+//
+bool
+MediaHandler::dependsOnParent(MediaAccessId parentId)
+{
+ if( _parentId != 0)
+ {
+ if(parentId == _parentId)
+ return true;
+
+ MediaManager mm;
+ AttachedMedia am1 = mm.getAttachedMedia(_parentId);
+ AttachedMedia am2 = mm.getAttachedMedia(parentId);
+ if( am1.mediaSource && am2.mediaSource)
+ {
+ return am1.mediaSource->equals( *(am2.mediaSource));
+ }
+ }
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////
+//
//
// METHOD NAME : MediaHandler::provideFile
// METHOD TYPE : PMError
/**
* Url to handle
**/
- const Url _url;
+ const Url _url;
+
+ /**
+ * Access Id of media handler we depend on.
+ */
+ MediaAccessId _parentId;
/**
* Return the currently used attach point.
AttachedMedia
findAttachedMedia(const MediaSourceRef &media) const;
+ bool dependsOnParent(MediaAccessId parentId);
+
/**
* Returns the attached media. Used by MediaManager
* to find other handlers using the same source.
bool isSharedMedia() const;
- bool checkAttached(bool aDevice) const;
+ bool checkAttached(bool aDevice,
+ bool fsType=false) const;
protected: