CdsResourceManager Class Reference

This class is responsible for handling the DIDL-Lite res tags. More...

#include <cds_resource_manager.h>

Inheritance diagram for CdsResourceManager:
zmm::Object

Data Structures

class  UrlBase

Public Member Functions

 CdsResourceManager ()
 Constructor, currently empty.
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static void addResources (zmm::Ref< CdsItem > item, zmm::Ref< mxml::Element > element)
 Adds a resource tag to the item.
static zmm::String getFirstResource (zmm::Ref< CdsItem > item)
 Gets the URL of the first resource of the CfsItem.
static void * operator new (size_t size)
static void operator delete (void *ptr)

Static Protected Member Functions

static zmm::Ref< UrlBaseaddResources_getUrlBase (zmm::Ref< CdsItem > item, bool forceLocal=false)
 Gets the baseUrl for a CdsItem.
static zmm::String renderExtension (zmm::String contentType, zmm::String location)
 renders an ext=.extension string, where the extension is determined either from content type or from the filename

Protected Attributes

mt_atomic_t _ref_count
pthread_mutex_t mutex

Detailed Description

This class is responsible for handling the DIDL-Lite res tags.

Definition at line 42 of file cds_resource_manager.h.


Constructor & Destructor Documentation

CdsResourceManager::CdsResourceManager (  ) 

Constructor, currently empty.

Definition at line 47 of file cds_resource_manager.cc.


Member Function Documentation

void CdsResourceManager::addResources ( zmm::Ref< CdsItem item,
zmm::Ref< mxml::Element element 
) [static]

Adds a resource tag to the item.

Parameters:
item Item for which the resources should be added.
element Element in the XML to which the resource should be appended.

This function figures out what resources should be added to what files. It looks at the server configuration to find out what it needs. For example, if you want to add another mime/type alias for an existing mime/type, this function would do it. Also, when transcoding will be implemented, the various transcoded streams will be identified here.

Todo:
what if the resource has a different mimetype than the item??
Todo:
who will sync mimetype that is part of the protocl info and that is lying in the resources with the information that is in the resource tags?
Todo:
currently resource is misused for album art

Definition at line 81 of file cds_resource_manager.cc.

References _, _Exception, _URL_PARAM_SEPARATOR, addResources_getUrlBase(), zmm::String::c_str(), CFG_IMPORT_MAPPINGS_MIMETYPE_TO_CONTENTTYPE_LIST, CH_EXTURL, CH_FFTH, CH_ID3, CH_LIBEXIF, CH_MP4, CH_TRANSCODE, check_resolution(), CONTENT_TYPE_AVI, CONTENT_TYPE_JPG, CONTENT_TYPE_MP3, CONTENT_TYPE_OGG, CONTENT_TYPE_PCM, EXIF_THUMBNAIL, Singleton< ConfigManager >::getInstance(), MetadataHandler::getMetaFieldName(), getMTFromProtocolInfo(), MetadataHandler::getResAttrName(), ID3_ALBUM_ART, IS_CDS_ITEM_EXTERNAL_URL, IS_CDS_ITEM_INTERNAL_URL, log_debug, M_ALBUMARTURI, nil, OBJECT_FLAG_DVD_IMAGE, OBJECT_FLAG_OGG_THEORA, OBJECT_FLAG_PROXY_URL, R_DURATION, R_NRAUDIOCHANNELS, R_PROTOCOLINFO, R_RESOLUTION, R_SAMPLEFREQUENCY, renderExtension(), renderProtocolInfo(), RESOURCE_CONTENT_TYPE, RESOURCE_HANDLER, RESOURCE_OPTION_FOURCC, RESOURCE_OPTION_URL, zmm::String::rindex(), zmm::String::startsWith(), string_ok(), zmm::String::substring(), THUMBNAIL, and UpnpXML_DIDLRenderResource().

Referenced by UpnpXML_DIDLRenderObject().

Ref< CdsResourceManager::UrlBase > CdsResourceManager::addResources_getUrlBase ( zmm::Ref< CdsItem item,
bool  forceLocal = false 
) [static, protected]

Gets the baseUrl for a CdsItem.

Parameters:
item Item for which the baseUrl should be built.

This function gets the baseUrl for the CdsItem and sets addResID to true if the resource id needs to be added to the URL.

Todo:
resource options must be read from configuration files
Todo:
move this down into the "for" loop and create different urls for each resource once the io handlers are ready

Definition at line 496 of file cds_resource_manager.cc.

References _, _URL_PARAM_SEPARATOR, CONTENT_DVD_IMAGE_HANDLER, CONTENT_MEDIA_HANDLER, CONTENT_ONLINE_HANDLER, CONTENT_SERVE_HANDLER, Singleton< Server >::getInstance(), IS_CDS_ITEM, IS_CDS_ITEM_EXTERNAL_URL, IS_CDS_ITEM_INTERNAL_URL, OBJECT_FLAG_DVD_IMAGE, OBJECT_FLAG_ONLINE_SERVICE, OBJECT_FLAG_PROXY_URL, URL_OBJECT_ID, and URL_RESOURCE_ID.

Referenced by addResources(), and getFirstResource().

String CdsResourceManager::getFirstResource ( zmm::Ref< CdsItem item  )  [static]

Gets the URL of the first resource of the CfsItem.

Parameters:
item Item for which the resources should be built.
Returns:
The URL

Definition at line 562 of file cds_resource_manager.cc.

References addResources_getUrlBase().

Referenced by web::items::process().

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

void Object::release (  )  [inherited]
String CdsResourceManager::renderExtension ( zmm::String  contentType,
zmm::String  location 
) [static, protected]

renders an ext=.extension string, where the extension is determined either from content type or from the filename

Definition at line 51 of file cds_resource_manager.cc.

References _, _URL_PARAM_SEPARATOR, CONTENT_TYPE_PLAYLIST, zmm::String::index(), nil, zmm::String::rindex(), string_ok(), zmm::String::substring(), URL_FILE_EXTENSION, and URL_PARAM_SEPARATOR.

Referenced by addResources().

void Object::retain (  )  [inherited]

Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
pthread_mutex_t zmm::Object::mutex [protected, inherited]

The documentation for this class was generated from the following files:

Generated on Fri Mar 26 20:16:56 2010 for MediaTomb by  doxygen 1.6.1