[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / network / upnp / UPnPInternal.h
1 #pragma once
2 /*
3  *      Copyright (C) 2012-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21 #include "system.h"
22 #include "utils/StdString.h"
23 #include "NptTypes.h"
24 #include "NptReferences.h"
25 #include "NptStrings.h"
26 #include "FileItem.h"
27
28 class CUPnPServer;
29 class CFileItem;
30 class CThumbLoader;
31 class PLT_HttpRequestContext;
32 class PLT_MediaItemResource;
33 class PLT_MediaObject;
34 class NPT_String;
35 namespace MUSIC_INFO {
36   class CMusicInfoTag;
37 }
38 class CVideoInfoTag;
39
40 namespace UPNP
41 {
42   class CResourceFinder {
43   public:
44     CResourceFinder(const char* protocol, const char* content = NULL);
45     bool operator()(const PLT_MediaItemResource& resource) const;
46   private:
47     NPT_String m_Protocol;
48     NPT_String m_Content;
49   };
50
51   enum EClientQuirks
52   {
53     ECLIENTQUIRKS_NONE = 0x0
54
55     /* Client requires folder's to be marked as storageFolers as verndor type (360)*/
56   , ECLIENTQUIRKS_ONLYSTORAGEFOLDER = 0x01
57
58     /* Client can't handle subtypes for videoItems (360) */
59   , ECLIENTQUIRKS_BASICVIDEOCLASS = 0x02
60
61     /* Client requires album to be set to [Unknown Series] to show title (WMP) */
62   , ECLIENTQUIRKS_UNKNOWNSERIES = 0x04
63   };
64
65   EClientQuirks GetClientQuirks(const PLT_HttpRequestContext* context);
66
67   const char* GetMimeTypeFromExtension(const char* extension, const PLT_HttpRequestContext* context = NULL);
68   NPT_String  GetMimeType(const CFileItem& item, const PLT_HttpRequestContext* context = NULL);
69   NPT_String  GetMimeType(const char* filename, const PLT_HttpRequestContext* context = NULL);
70   const NPT_String GetProtocolInfo(const CFileItem& item, const char* protocol, const PLT_HttpRequestContext* context = NULL);
71
72
73   const CStdString& CorrectAllItemsSortHack(const CStdString &item);
74
75   NPT_Result PopulateTagFromObject(MUSIC_INFO::CMusicInfoTag& tag,
76                                    PLT_MediaObject&           object,
77                                    PLT_MediaItemResource*     resource = NULL);
78   NPT_Result PopulateTagFromObject(CVideoInfoTag&             tag,
79                                    PLT_MediaObject&           object,
80                                    PLT_MediaItemResource*     resource = NULL);
81
82   NPT_Result PopulateObjectFromTag(MUSIC_INFO::CMusicInfoTag&         tag,
83                                           PLT_MediaObject&       object,
84                                           NPT_String*            file_path,
85                                           PLT_MediaItemResource* resource,
86                                           EClientQuirks          quirks);
87   NPT_Result PopulateObjectFromTag(CVideoInfoTag&         tag,
88                                           PLT_MediaObject&       object,
89                                           NPT_String*            file_path,
90                                           PLT_MediaItemResource* resource,
91                                           EClientQuirks          quirks);
92
93   PLT_MediaObject* BuildObject(CFileItem&              item,
94                                       NPT_String&                   file_path,
95                                       bool                          with_count,
96                                       NPT_Reference<CThumbLoader>&  thumb_loader,
97                                       const PLT_HttpRequestContext* context = NULL,
98                                       CUPnPServer*                  upnp_server = NULL);
99
100   CFileItemPtr     BuildObject(PLT_MediaObject* entry);
101
102   bool             GetResource(const PLT_MediaObject* entry, CFileItem& item);
103   CFileItemPtr     GetFileItem(const NPT_String& uri, const NPT_String& meta);
104 }
105