diff options
author | vdrfan <vdrfan@svn> | 2010-05-26 21:36:36 +0000 |
---|---|---|
committer | vdrfan <vdrfan@svn> | 2010-05-26 21:36:36 +0000 |
commit | 48aa97d415d3f0687ddf7a844cd85809548e411a (patch) | |
tree | 6f91b23db578f8c5234450cf18f8cd8505409c48 | |
parent | cdb973581de70e7ad92364c3c14f0acd4e506f96 (diff) |
changed: renamed Get-/SetContentType to Get-/SetMimeType to avoid confusion with internal content (eg. tvshows, movies)
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@30596 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/FileItem.cpp | 52 | ||||
-rw-r--r-- | xbmc/FileItem.h | 8 | ||||
-rw-r--r-- | xbmc/FileSystem/DAVDirectory.cpp | 2 | ||||
-rw-r--r-- | xbmc/FileSystem/FileCurl.cpp | 8 | ||||
-rw-r--r-- | xbmc/FileSystem/FileCurl.h | 8 | ||||
-rw-r--r-- | xbmc/FileSystem/FileShoutcast.cpp | 4 | ||||
-rw-r--r-- | xbmc/FileSystem/FileShoutcast.h | 2 | ||||
-rw-r--r-- | xbmc/FileSystem/HTSPSession.cpp | 2 | ||||
-rw-r--r-- | xbmc/FileSystem/RSSDirectory.cpp | 8 | ||||
-rw-r--r-- | xbmc/FileSystem/ShoutcastDirectory.cpp | 2 | ||||
-rw-r--r-- | xbmc/FileSystem/UPnPDirectory.cpp | 8 | ||||
-rw-r--r-- | xbmc/LastFmManager.cpp | 2 | ||||
-rw-r--r-- | xbmc/PlayListFactory.cpp | 32 | ||||
-rw-r--r-- | xbmc/UPnP.cpp | 54 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxShoutcast.cpp | 8 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDPlayer.cpp | 6 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/paplayer/AudioDecoder.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/playercorefactory/PlayerSelectionRule.cpp | 2 | ||||
-rw-r--r-- | xbmc/utils/HttpHeader.h | 2 | ||||
-rw-r--r-- | xbmc/utils/TuxBoxUtil.cpp | 4 |
21 files changed, 109 insertions, 109 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 20d25e7a60..bc3607bf45 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -286,7 +286,7 @@ const CFileItem& CFileItem::operator=(const CFileItem& item) m_iHasLock = item.m_iHasLock; m_iBadPwdCount = item.m_iBadPwdCount; m_bCanQueue=item.m_bCanQueue; - m_contenttype = item.m_contenttype; + m_mimetype = item.m_mimetype; m_extrainfo = item.m_extrainfo; m_specialSort = item.m_specialSort; return *this; @@ -318,7 +318,7 @@ void CFileItem::Reset() m_iBadPwdCount = 0; m_iHasLock = 0; m_bCanQueue=true; - m_contenttype = ""; + m_mimetype = ""; delete m_musicInfoTag; m_musicInfoTag=NULL; delete m_videoInfoTag; @@ -354,7 +354,7 @@ void CFileItem::Serialize(CArchive& ar) ar << m_iBadPwdCount; ar << m_bCanQueue; - ar << m_contenttype; + ar << m_mimetype; ar << m_extrainfo; ar << m_specialSort; @@ -402,7 +402,7 @@ void CFileItem::Serialize(CArchive& ar) ar >> m_iBadPwdCount; ar >> m_bCanQueue; - ar >> m_contenttype; + ar >> m_mimetype; ar >> m_extrainfo; ar >> temp; m_specialSort = (SPECIAL_SORT)temp; @@ -459,17 +459,17 @@ bool CFileItem::IsVideo() const if (HasMusicInfoTag()) return false; if (HasPictureInfoTag()) return false; - /* check preset content type */ - if( m_contenttype.Left(6).Equals("video/") ) + /* check preset mime type */ + if( m_mimetype.Left(6).Equals("video/") ) return true; if (IsHDHomeRun() || IsTuxBox() || CUtil::IsDVD(m_strPath)) return true; CStdString extension; - if( m_contenttype.Left(12).Equals("application/") ) + if( m_mimetype.Left(12).Equals("application/") ) { /* check for some standard types */ - extension = m_contenttype.Mid(12); + extension = m_mimetype.Mid(12); if( extension.Equals("ogg") || extension.Equals("mp4") || extension.Equals("mxf") ) @@ -498,14 +498,14 @@ bool CFileItem::IsAudio() const if (!m_bIsFolder && IsShoutCast()) return true; if (!m_bIsFolder && IsLastFM()) return true; - /* check preset content type */ - if( m_contenttype.Left(6).Equals("audio/") ) + /* check preset mime type */ + if( m_mimetype.Left(6).Equals("audio/") ) return true; CStdString extension; - if( m_contenttype.Left(12).Equals("application/") ) + if( m_mimetype.Left(12).Equals("application/") ) { /* check for some standard types */ - extension = m_contenttype.Mid(12); + extension = m_mimetype.Mid(12); if( extension.Equals("ogg") || extension.Equals("mp4") || extension.Equals("mxf") ) @@ -538,7 +538,7 @@ bool CFileItem::IsPicture() const if (HasMusicInfoTag()) return false; if (HasVideoInfoTag()) return false; - if( m_contenttype.Left(6).Equals("image/") ) + if( m_mimetype.Left(6).Equals("image/") ) return true; CStdString extension; @@ -696,7 +696,7 @@ bool CFileItem::IsRSS() const { return m_strPath.Left(6).Equals("rss://", false) || CUtil::GetExtension(m_strPath).Equals(".rss", false) - || GetContentType() == "application/rss+xml"; + || GetMimeType() == "application/rss+xml"; } bool CFileItem::IsStack() const @@ -1032,12 +1032,12 @@ bool CFileItem::IsParentFolder() const return m_bIsParentFolder; } -const CStdString& CFileItem::GetContentType() const +const CStdString& CFileItem::GetMimeType() const { - if( m_contenttype.IsEmpty() ) + if( m_mimetype.IsEmpty() ) { // discard const qualifyier - CStdString& m_ref = (CStdString&)m_contenttype; + CStdString& m_ref = (CStdString&)m_mimetype; if( m_bIsFolder ) m_ref = "x-directory/normal"; @@ -1045,16 +1045,16 @@ const CStdString& CFileItem::GetContentType() const || m_strPath.Left(7).Equals("http://") || m_strPath.Left(8).Equals("https://")) { - CFileCurl::GetContent(GetAsUrl(), m_ref); + CFileCurl::GetMimeType(GetAsUrl(), m_ref); - // try to get content type again but with an NSPlayer User-Agent - // in order for server to provide correct content-type. Allows us + // try to get mime-type again but with an NSPlayer User-Agent + // in order for server to provide correct mime-type. Allows us // to properly detect an MMS stream if (m_ref.Left(11).Equals("video/x-ms-")) - CFileCurl::GetContent(GetAsUrl(), m_ref, "NSPlayer/11.00.6001.7000"); + CFileCurl::GetMimeType(GetAsUrl(), m_ref, "NSPlayer/11.00.6001.7000"); - // make sure there are no options set in content type - // content type can look like "video/x-ms-asf ; charset=utf8" + // make sure there are no options set in mime-type + // mime-type can look like "video/x-ms-asf ; charset=utf8" int i = m_ref.Find(';'); if(i>=0) m_ref.Delete(i,m_ref.length()-i); @@ -1066,14 +1066,14 @@ const CStdString& CFileItem::GetContentType() const m_ref = "application/octet-stream"; } - // change protocol to mms for the following content-type. Allows us to create proper FileMMS. - if( m_contenttype.Left(32).Equals("application/vnd.ms.wms-hdr.asfv1") || m_contenttype.Left(24).Equals("application/x-mms-framed") ) + // change protocol to mms for the following mome-type. Allows us to create proper FileMMS. + if( m_mimetype.Left(32).Equals("application/vnd.ms.wms-hdr.asfv1") || m_mimetype.Left(24).Equals("application/x-mms-framed") ) { CStdString& m_path = (CStdString&)m_strPath; m_path.Replace("http:", "mms:"); } - return m_contenttype; + return m_mimetype; } bool CFileItem::IsSamePath(const CFileItem *item) const diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h index 01eb8662fa..79ff684e12 100644 --- a/xbmc/FileItem.h +++ b/xbmc/FileItem.h @@ -241,10 +241,10 @@ public: virtual bool LoadMusicTag(); /* returns the content type of this item if known. will lookup for http streams */ - const CStdString& GetContentType() const; + const CStdString& GetMimeType() const; - /* sets the contenttype if known beforehand */ - void SetContentType(const CStdString& content) { m_contenttype = content; } ; + /* sets the mime-type if known beforehand */ + void SetMimeType(const CStdString& mimetype) { m_mimetype = mimetype; } ; /* general extra info about the contents of the item, not for display */ void SetExtraInfo(const CStdString& info) { m_extrainfo = info; }; @@ -277,7 +277,7 @@ private: bool m_bIsParentFolder; bool m_bCanQueue; bool m_bLabelPreformated; - CStdString m_contenttype; + CStdString m_mimetype; CStdString m_extrainfo; MUSIC_INFO::CMusicInfoTag* m_musicInfoTag; CVideoInfoTag* m_videoInfoTag; diff --git a/xbmc/FileSystem/DAVDirectory.cpp b/xbmc/FileSystem/DAVDirectory.cpp index c304dfee56..e9274560c9 100644 --- a/xbmc/FileSystem/DAVDirectory.cpp +++ b/xbmc/FileSystem/DAVDirectory.cpp @@ -174,7 +174,7 @@ bool CDAVDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items CStdString strRequest = "PROPFIND"; dav.SetCustomRequest(strRequest); - dav.SetContentType("text/xml; charset=\"utf-8\""); + dav.SetMimeType("text/xml; charset=\"utf-8\""); dav.SetRequestHeader("depth", 1); dav.SetPostData( "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" diff --git a/xbmc/FileSystem/FileCurl.cpp b/xbmc/FileSystem/FileCurl.cpp index 88b4146705..5b88d13f23 100644 --- a/xbmc/FileSystem/FileCurl.cpp +++ b/xbmc/FileSystem/FileCurl.cpp @@ -527,7 +527,7 @@ void CFileCurl::SetCorrectHeaders(CReadState* state) { CHttpHeader& h = state->m_httpheader; /* workaround for shoutcast server wich doesn't set content type on standard mp3 */ - if( h.GetContentType().IsEmpty() ) + if( h.GetMimeType().IsEmpty() ) { if( !h.GetValue("icy-notice1").IsEmpty() || !h.GetValue("icy-name").IsEmpty() @@ -536,7 +536,7 @@ void CFileCurl::SetCorrectHeaders(CReadState* state) } /* hack for google video */ - if ( h.GetContentType().Equals("text/html") + if ( h.GetMimeType().Equals("text/html") && !h.GetValue("Content-Disposition").IsEmpty() ) { CStdString strValue = h.GetValue("Content-Disposition"); @@ -1353,7 +1353,7 @@ bool CFileCurl::GetHttpHeader(const CURL &url, CHttpHeader &headers) } } -bool CFileCurl::GetContent(const CURL &url, CStdString &content, CStdString useragent) +bool CFileCurl::GetMimeType(const CURL &url, CStdString &content, CStdString useragent) { CFileCurl file; if (!useragent.IsEmpty()) @@ -1361,7 +1361,7 @@ bool CFileCurl::GetContent(const CURL &url, CStdString &content, CStdString user if( file.Stat(url, NULL) == 0 ) { - content = file.GetContent(); + content = file.GetMimeType(); return true; } diff --git a/xbmc/FileSystem/FileCurl.h b/xbmc/FileSystem/FileCurl.h index bfeddac28d..48f49dad30 100644 --- a/xbmc/FileSystem/FileCurl.h +++ b/xbmc/FileSystem/FileCurl.h @@ -50,7 +50,7 @@ namespace XFILE virtual void Close(); virtual bool ReadString(char *szLine, int iLineLength) { return m_state->ReadString(szLine, iLineLength); } virtual unsigned int Read(void* lpBuf, int64_t uiBufSize) { return m_state->Read(lpBuf, uiBufSize); } - virtual CStdString GetContent() { return m_state->m_httpheader.GetContentType(); } + virtual CStdString GetMimeType() { return m_state->m_httpheader.GetMimeType(); } bool Post(const CStdString& strURL, const CStdString& strPostData, CStdString& strHTML); bool Get(const CStdString& strURL, CStdString& strHTML); @@ -70,7 +70,7 @@ namespace XFILE void SetPostData(CStdString postdata) { m_postdata = postdata; } void SetReferer(CStdString referer) { m_referer = referer; } void SetCookie(CStdString cookie) { m_cookie = cookie; } - void SetContentType(CStdString contenttype) { SetRequestHeader("Content-Type", m_contenttype); } + void SetMimeType(CStdString mimetype) { SetRequestHeader("Content-Type", m_mimetype); } void SetRequestHeader(CStdString header, CStdString value); void SetRequestHeader(CStdString header, long value); @@ -81,7 +81,7 @@ namespace XFILE /* static function that will get content type of a file */ static bool GetHttpHeader(const CURL &url, CHttpHeader &headers); - static bool GetContent(const CURL &url, CStdString &content, CStdString useragent=""); + static bool GetMimeType(const CURL &url, CStdString &content, CStdString useragent=""); class CReadState { @@ -140,7 +140,7 @@ namespace XFILE CStdString m_postdata; CStdString m_referer; CStdString m_cookie; - CStdString m_contenttype; + CStdString m_mimetype; CStdString m_username; CStdString m_password; CStdString m_httpauth; diff --git a/xbmc/FileSystem/FileShoutcast.cpp b/xbmc/FileSystem/FileShoutcast.cpp index f7eca102c3..a941ebd7b3 100644 --- a/xbmc/FileSystem/FileShoutcast.cpp +++ b/xbmc/FileSystem/FileShoutcast.cpp @@ -297,7 +297,7 @@ bool CFileShoutcast::Open(const CURL& url) } /* store content type of stream */ - m_contenttype = rip_manager_get_content_type(); + m_mimetype = rip_manager_get_content_type(); //CHANGED CODE: Don't reset timer anymore. @@ -439,7 +439,7 @@ bool CFileShoutcast::GetMusicInfoTag(CMusicInfoTag& tag) CStdString CFileShoutcast::GetContent() { - switch (m_contenttype) + switch (m_mimetype) { case CONTENT_TYPE_MP3: return "audio/mpeg"; diff --git a/xbmc/FileSystem/FileShoutcast.h b/xbmc/FileSystem/FileShoutcast.h index 64efd785a7..740abcf676 100644 --- a/xbmc/FileSystem/FileShoutcast.h +++ b/xbmc/FileSystem/FileShoutcast.h @@ -76,7 +76,7 @@ public: protected: void outputTimeoutMessage(const char* message); unsigned int m_lastTime; - int m_contenttype; + int m_mimetype; RIP_MANAGER_OPTIONS m_opt; }; } diff --git a/xbmc/FileSystem/HTSPSession.cpp b/xbmc/FileSystem/HTSPSession.cpp index 408fcc2044..4941a8a2c9 100644 --- a/xbmc/FileSystem/HTSPSession.cpp +++ b/xbmc/FileSystem/HTSPSession.cpp @@ -645,7 +645,7 @@ bool CHTSPSession::ParseItem(const SChannel& channel, int tagid, const SEvent& e item.m_strPath = url.Get(); item.m_strTitle = tag->m_strTitle; item.SetThumbnailImage(channel.icon); - item.SetContentType("video/X-htsp"); + item.SetMimeType("video/X-htsp"); item.SetCachedVideoThumb(); return true; } diff --git a/xbmc/FileSystem/RSSDirectory.cpp b/xbmc/FileSystem/RSSDirectory.cpp index 7291f0c0bf..ae87b5d03f 100644 --- a/xbmc/FileSystem/RSSDirectory.cpp +++ b/xbmc/FileSystem/RSSDirectory.cpp @@ -120,7 +120,7 @@ static void ParseItemMRSS(CFileItem* item, TiXmlElement* item_child, const CStdS if (type) { CStdString strType(type); - item->SetContentType(strType); + item->SetMimeType(strType); if (url && item->m_strPath.IsEmpty() && (strType.Left(6).Equals("video/") || strType.Left(6).Equals("audio/") @@ -276,7 +276,7 @@ static void ParseItemRSS(CFileItem* item, TiXmlElement* item_child, const CStdSt const char * content_type = item_child->Attribute("type"); if (content_type) { - item->SetContentType(content_type); + item->SetMimeType(content_type); CStdString strContentType(content_type); if (url && item->m_strPath.IsEmpty() && (strContentType.Left(6).Equals("video/") || @@ -314,7 +314,7 @@ static void ParseItemVoddler(CFileItem* item, TiXmlElement* element, const CStdS if(item->m_strPath.IsEmpty()) { item->m_strPath = text; - item->SetContentType(type); + item->SetMimeType(type); } } else if(name == "year") @@ -343,7 +343,7 @@ static void ParseItemBoxee(CFileItem* item, TiXmlElement* element, const CStdStr else if(name == "user_agent") item->SetProperty("boxee:user_agent", text); else if(name == "content_type") - item->SetContentType(text); + item->SetMimeType(text); else if(name == "runtime") vtag->m_strRuntime = text; else if(name == "episode") diff --git a/xbmc/FileSystem/ShoutcastDirectory.cpp b/xbmc/FileSystem/ShoutcastDirectory.cpp index 0207f61290..9991c7250e 100644 --- a/xbmc/FileSystem/ShoutcastDirectory.cpp +++ b/xbmc/FileSystem/ShoutcastDirectory.cpp @@ -137,7 +137,7 @@ bool CShoutcastDirectory::ParseStations(TiXmlElement *root, CFileItemList &items /* content type is known before hand, should save later lookup */ /* wonder if we could combine the contentype of the playlist and of the real stream */ - pItem->SetContentType("audio/x-scpls"); + pItem->SetMimeType("audio/x-scpls"); pItem->m_strPath = url.Get(); diff --git a/xbmc/FileSystem/UPnPDirectory.cpp b/xbmc/FileSystem/UPnPDirectory.cpp index 04aeb348ed..216152ef17 100644 --- a/xbmc/FileSystem/UPnPDirectory.cpp +++ b/xbmc/FileSystem/UPnPDirectory.cpp @@ -274,16 +274,16 @@ CUPnPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items) // set a general content type CStdString type = (const char*)(*entry)->m_ObjectClass.type.Left(21); if (type.Equals("object.item.videoitem")) - pItem->SetContentType("video/octet-stream"); + pItem->SetMimeType("video/octet-stream"); else if(type.Equals("object.item.audioitem")) - pItem->SetContentType("audio/octet-stream"); + pItem->SetMimeType("audio/octet-stream"); else if(type.Equals("object.item.imageitem")) - pItem->SetContentType("image/octet-stream"); + pItem->SetMimeType("image/octet-stream"); // look for content type in protocol info if (resource.m_ProtocolInfo.IsValid()) { if (resource.m_ProtocolInfo.GetContentType().Compare("application/octet-stream") != 0) { - pItem->SetContentType((const char*)resource.m_ProtocolInfo.GetContentType()); + pItem->SetMimeType((const char*)resource.m_ProtocolInfo.GetContentType()); } } else { CLog::Log(LOGERROR, "CUPnPDirectory::GetDirectory - invalid protocol info '%s'", diff --git a/xbmc/LastFmManager.cpp b/xbmc/LastFmManager.cpp index b772f6d80d..0f42fecc7f 100644 --- a/xbmc/LastFmManager.cpp +++ b/xbmc/LastFmManager.cpp @@ -778,7 +778,7 @@ bool CLastFmManager::CallXmlRpc(const CStdString& action, const CStdString& arti CFileCurl http; CStdString html; CStdString url = "http://ws.audioscrobbler.com/1.0/rw/xmlrpc.php"; - http.SetContentType("text/xml"); + http.SetMimeType("text/xml"); if (!http.Post(url, strBody, html)) { CLog::Log(LOGERROR, "Last.fm action %s failed.", action.c_str()); diff --git a/xbmc/PlayListFactory.cpp b/xbmc/PlayListFactory.cpp index a810bf8d49..45c8864a9c 100644 --- a/xbmc/PlayListFactory.cpp +++ b/xbmc/PlayListFactory.cpp @@ -43,30 +43,30 @@ CPlayList* CPlayListFactory::Create(const CFileItem& item) if( item.IsInternetStream() ) { - CStdString strContentType = item.GetContentType(); - strContentType.MakeLower(); - - if (strContentType == "video/x-ms-asf" - || strContentType == "video/x-ms-asx" - || strContentType == "video/x-ms-wmv" - || strContentType == "video/x-ms-wma" - || strContentType == "video/x-ms-wfs" - || strContentType == "video/x-ms-wvx" - || strContentType == "video/x-ms-wax") + CStdString strMimeType = item.GetMimeType(); + strMimeType.MakeLower(); + + if (strMimeType == "video/x-ms-asf" + || strMimeType == "video/x-ms-asx" + || strMimeType == "video/x-ms-wmv" + || strMimeType == "video/x-ms-wma" + || strMimeType == "video/x-ms-wfs" + || strMimeType == "video/x-ms-wvx" + || strMimeType == "video/x-ms-wax") return new CPlayListASX(); - if (strContentType == "audio/x-pn-realaudio") + if (strMimeType == "audio/x-pn-realaudio") return new CPlayListRAM(); - if (strContentType == "audio/x-scpls" - || strContentType == "playlist" - || strContentType == "text/html") + if (strMimeType == "audio/x-scpls" + || strMimeType == "playlist" + || strMimeType == "text/html") return new CPlayListPLS(); - if (strContentType == "audio/x-mpegurl") + if (strMimeType == "audio/x-mpegurl") return new CPlayListM3U(); - if (strContentType == "application/vnd.ms-wpl") + if (strMimeType == "application/vnd.ms-wpl") return new CPlayListWPL(); } diff --git a/xbmc/UPnP.cpp b/xbmc/UPnP.cpp index 7e08b3f51e..b959001cea 100644 --- a/xbmc/UPnP.cpp +++ b/xbmc/UPnP.cpp @@ -227,9 +227,9 @@ public: bool with_count, const PLT_HttpRequestContext* context = NULL, CUPnPServer* upnp_server = NULL); - static const char* GetContentTypeFromExtension(const char* extension, const PLT_HttpRequestContext* context = NULL); - static NPT_String GetContentType(const CFileItem& item, const PLT_HttpRequestContext* context = NULL); - static NPT_String GetContentType(const char* filename, const PLT_HttpRequestContext* context = NULL); + static const char* GetMimeTypeFromExtension(const char* extension, const PLT_HttpRequestContext* context = NULL); + static NPT_String GetMimeType(const CFileItem& item, const PLT_HttpRequestContext* context = NULL); + static NPT_String GetMimeType(const char* filename, const PLT_HttpRequestContext* context = NULL); static const CStdString& CorrectAllItemsSortHack(const CStdString &item); private: @@ -265,10 +265,10 @@ public: NPT_UInt32 CUPnPServer::m_MaxReturnedItems = 0; /*---------------------------------------------------------------------- -| CUPnPServer::GetContentType +| CUPnPServer::GetMimeType +---------------------------------------------------------------------*/ NPT_String -CUPnPServer::GetContentType(const char* filename, +CUPnPServer::GetMimeType(const char* filename, const PLT_HttpRequestContext* context /* = NULL */) { NPT_String ext = CUtil::GetExtension(filename).c_str(); @@ -279,10 +279,10 @@ CUPnPServer::GetContentType(const char* filename, } /*---------------------------------------------------------------------- -| CUPnPServer::GetContentType +| CUPnPServer::GetMimeType +---------------------------------------------------------------------*/ NPT_String -CUPnPServer::GetContentType(const CFileItem& item, +CUPnPServer::GetMimeType(const CFileItem& item, const PLT_HttpRequestContext* context /* = NULL */) { NPT_String ext = CUtil::GetExtension(item.m_strPath).c_str(); @@ -294,38 +294,38 @@ CUPnPServer::GetContentType(const CFileItem& item, ext.TrimLeft('.'); ext = ext.ToLowercase(); - NPT_String content; + NPT_String mime; - /* We always use Platinum content type first - as it is defined to map extension to DLNA compliant content type + /* We always use Platinum mime type first + as it is defined to map extension to DLNA compliant mime type or custom according to context (who asked for it) */ if (!ext.IsEmpty()) { - content = PLT_MediaObject::GetMimeTypeFromExtension(ext, context); - if (content == "application/octet-stream") content = ""; + mime = PLT_MediaObject::GetMimeTypeFromExtension(ext, context); + if (mime == "application/octet-stream") mime = ""; } /* if Platinum couldn't map it, default to XBMC mapping */ - if (content.IsEmpty()) { - NPT_String content = item.GetContentType().c_str(); - if (content == "application/octet-stream") content = ""; + if (mime.IsEmpty()) { + NPT_String mime = item.GetMimeType().c_str(); + if (mime == "application/octet-stream") mime = ""; } - /* fallback to generic content type if not found */ - if (content.IsEmpty()) { + /* fallback to generic mime type if not found */ + if (mime.IsEmpty()) { if (item.IsVideo() || item.IsVideoDb() ) - content = "video/" + ext; + mime = "video/" + ext; else if (item.IsAudio() || item.IsMusicDb() ) - content = "audio/" + ext; + mime = "audio/" + ext; else if (item.IsPicture() ) - content = "image/" + ext; + mime = "image/" + ext; } /* nothing we can figure out */ - if (content.IsEmpty()) { - content = "application/octet-stream"; + if (mime.IsEmpty()) { + mime = "application/octet-stream"; } - return content; + return mime; } /*---------------------------------------------------------------------- @@ -355,8 +355,8 @@ CUPnPServer::GetProtocolInfo(const CFileItem& item, } /* we need a valid extension to retrieve the mimetype for the protocol info */ - NPT_String content = GetContentType(item, context); - proto += ":*:" + content + ":" + PLT_MediaObject::GetDlnaExtension(content, context); + NPT_String mime = GetMimeType(item, context); + proto += ":*:" + mime + ":" + PLT_MediaObject::GetDlnaExtension(mime, context); return proto; } @@ -1473,7 +1473,7 @@ CUPnPRenderer::ProcessHttpRequest(NPT_HttpRequest& request, } NPT_InputStreamReference stream; file.GetInputStream(stream); - entity->SetContentType(CUPnPServer::GetContentType(filepath)); + entity->SetContentType(CUPnPServer::GetMimeType(filepath)); entity->SetInputStream(stream, true); return NPT_SUCCESS; @@ -1725,7 +1725,7 @@ CUPnPRenderer::PlayMedia(const char* uri, const char* meta, PLT_Action* action) } if (res && res->m_ProtocolInfo.IsValid()) { - item.SetContentType((const char*)res->m_ProtocolInfo.GetContentType()); + item.SetMimeType((const char*)res->m_ProtocolInfo.GetContentType()); } item.m_dateTime.SetFromDateString((const char*)object->m_Date); diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxShoutcast.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxShoutcast.cpp index 5fa4801db9..c7caa97c01 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxShoutcast.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxShoutcast.cpp @@ -69,7 +69,7 @@ bool CDVDDemuxShoutcast::Open(CDVDInputStream* pInput) CHttpHeader* pHeader = pInputStreamHttp->GetHttpHeader(); std::string strMetaInt = pHeader->GetValue(ICY_METAINTERVAL); - std::string strContentType = pHeader->GetContentType(); + std::string strMimeType = pHeader->GetMimeType(); // create new demuxer stream m_pDemuxStream = new CDemuxStreamAudioShoutcast(); @@ -82,13 +82,13 @@ bool CDVDDemuxShoutcast::Open(CDVDInputStream* pInput) // set meta interval m_iMetaStreamInterval = atoi(strMetaInt.c_str()); - if (stricmp(strContentType.c_str(), CONTENT_TYPE_AAC) == 0 || - stricmp(strContentType.c_str(), CONTENT_TYPE_AACPLUS) == 0) + if (stricmp(strMimeType.c_str(), CONTENT_TYPE_AAC) == 0 || + stricmp(strMimeType.c_str(), CONTENT_TYPE_AACPLUS) == 0) { // need an aac decoder first m_pDemuxStream->codec = CODEC_ID_AAC; } - else // (stricmp(strContentType, CONTENT_TYPE_MP3) == 0) + else // (stricmp(strMimeType, CONTENT_TYPE_MP3) == 0) { // default to mp3 m_pDemuxStream->codec = CODEC_ID_MP3; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index bbd03142bd..c27b875ddb 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -314,7 +314,7 @@ bool CDVDPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) m_PlayerOptions = options; m_item = file; - m_content = file.GetContentType(); + m_mimetype = file.GetMimeType(); m_filename = file.m_strPath; m_ready.Reset(); @@ -409,7 +409,7 @@ bool CDVDPlayer::OpenInputStream() m_filename = g_mediaManager.TranslateDevicePath(""); } - m_pInputStream = CDVDFactoryInputStream::CreateInputStream(this, m_filename, m_content); + m_pInputStream = CDVDFactoryInputStream::CreateInputStream(this, m_filename, m_mimetype); if(m_pInputStream == NULL) { CLog::Log(LOGERROR, "CDVDPlayer::OpenInputStream - unable to create input stream for [%s]", m_filename.c_str()); @@ -418,7 +418,7 @@ bool CDVDPlayer::OpenInputStream() else m_pInputStream->SetFileItem(m_item); - if (!m_pInputStream->Open(m_filename.c_str(), m_content)) + if (!m_pInputStream->Open(m_filename.c_str(), m_mimetype)) { CLog::Log(LOGERROR, "CDVDPlayer::OpenInputStream - error opening [%s]", m_filename.c_str()); return false; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h index 03fdbd74d7..f0a667e1a4 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h @@ -285,7 +285,7 @@ protected: bool m_bAbortRequest; std::string m_filename; // holds the actual filename - std::string m_content; // hold a hint to what content file contains (mime type) + std::string m_mimetype; // hold a hint to what content file contains (mime type) ECacheState m_caching; CFileItem m_item; diff --git a/xbmc/cores/paplayer/AudioDecoder.cpp b/xbmc/cores/paplayer/AudioDecoder.cpp index 06ec67d3cc..b28c9c1d98 100644 --- a/xbmc/cores/paplayer/AudioDecoder.cpp +++ b/xbmc/cores/paplayer/AudioDecoder.cpp @@ -84,7 +84,7 @@ bool CAudioDecoder::Create(const CFileItem &file, __int64 seekOffset, unsigned i filecache = g_guiSettings.GetInt("cacheaudio.lan"); // create our codec - m_codec=CodecFactory::CreateCodecDemux(file.m_strPath, file.GetContentType(), filecache * 1024); + m_codec=CodecFactory::CreateCodecDemux(file.m_strPath, file.GetMimeType(), filecache * 1024); if (!m_codec || !m_codec->Init(file.m_strPath, filecache * 1024)) { diff --git a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp index c846707f9e..487e08f4a5 100644 --- a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp +++ b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp @@ -142,7 +142,7 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, VECPLAYERCORES &vec if (CompileRegExp(m_protocols, regExp) && !MatchesRegExp(url.GetProtocol(), regExp)) return; - if (CompileRegExp(m_mimeTypes, regExp) && !MatchesRegExp(item.GetContentType(), regExp)) return; + if (CompileRegExp(m_mimeTypes, regExp) && !MatchesRegExp(item.GetMimeType(), regExp)) return; if (CompileRegExp(m_fileName, regExp) && !MatchesRegExp(item.m_strPath, regExp)) return; diff --git a/xbmc/utils/HttpHeader.h b/xbmc/utils/HttpHeader.h index bea7f70e12..51a25fb47b 100644 --- a/xbmc/utils/HttpHeader.h +++ b/xbmc/utils/HttpHeader.h @@ -41,7 +41,7 @@ public: void GetHeader(CStdString& strHeader); - CStdString GetContentType() { return GetValue(HTTPHEADER_CONTENT_TYPE); } + CStdString GetMimeType() { return GetValue(HTTPHEADER_CONTENT_TYPE); } CStdString GetProtoLine() { return m_protoLine; } void Clear(); diff --git a/xbmc/utils/TuxBoxUtil.cpp b/xbmc/utils/TuxBoxUtil.cpp index d16ed27c61..0fe25c8dd2 100644 --- a/xbmc/utils/TuxBoxUtil.cpp +++ b/xbmc/utils/TuxBoxUtil.cpp @@ -400,7 +400,7 @@ bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items, pbItem->m_bIsFolder = false; pbItem->SetLabel(strItemName); pbItem->m_strPath = "http://"+url.GetHostName()+":8001/"+strItemPath; - pbItem->SetContentType("video/mpeg2"); + pbItem->SetMimeType("video/mpeg2"); items.Add(pbItem); CLog::Log(LOGDEBUG, "%s - Name: %s", __FUNCTION__,strItemName.c_str()); CLog::Log(LOGDEBUG, "%s - Adress: %s", __FUNCTION__,pbItem->m_strPath.c_str()); @@ -599,7 +599,7 @@ bool CTuxBoxUtil::GetZapUrl(const CStdString& strPath, CFileItem &items ) items.SetLabel(items.GetLabel()); // VIDEOPLAYER_DIRECTOR: service_name (Program Name) items.SetLabel2(sCurSrvData.current_event_description); // current_event_description (Film Name) items.m_bIsFolder = false; - items.SetContentType("video/x-ms-asf"); + items.SetMimeType("video/x-ms-asf"); return true; } |