7
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2007 Gena Batyan <bgeradz@mediatomb.cc>,
10
Copyright (C) 2006-2008 Gena Batyan <bgeradz@mediatomb.cc>,
11
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
12
Leonhard Wimmer <leo@mediatomb.cc>
24
24
version 2 along with MediaTomb; if not, write to the Free Software
25
25
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
27
$Id: cds_resource.h 1294 2007-05-13 16:28:24Z lww $
27
$Id: cds_resource.h 1698 2008-02-23 20:48:30Z lww $
30
30
/// \file cds_resource.h
35
35
#include "common.h"
36
36
#include "dictionary.h"
38
#define RESOURCE_SEP '|'
39
#define RESOURCE_PART_SEP '~'
38
/// \brief name for external urls that can appear in object resources (i.e.
39
/// a YouTube thumbnail)
40
#define RESOURCE_OPTION_URL "url"
42
/// \brief if set, overrides the OBJECT_FLAG_PROXY_URL setting for the given
44
#define RESOURCE_OPTION_PROXY_URL "prx"
46
#define RESOURCE_OPTION_FOURCC "4cc"
41
48
class CdsResource : public zmm::Object
45
52
zmm::Ref<Dictionary> attributes;
46
53
zmm::Ref<Dictionary> parameters;
54
zmm::Ref<Dictionary> options;
57
/// \brief creates a new resource object.
59
/// The CdsResource object represents a <res> tag in the DIDL-Lite XML.
61
/// \param handler_type id of the associated handler
49
62
CdsResource(int handlerType);
50
63
CdsResource(int handlerType,
51
64
zmm::Ref<Dictionary> attributes,
52
zmm::Ref<Dictionary> parameters);
65
zmm::Ref<Dictionary> parameters,
66
zmm::Ref<Dictionary> options);
68
/// \brief Adds a resource attribute.
70
/// This maps to an attribute of the <res> tag in the DIDL-Lite XML.
72
/// \param name attribute name
73
/// \param value attribute value
54
74
void addAttribute(zmm::String name, zmm::String value);
76
/// \brief Merge existing attributes with new ones
77
void mergeAttributes(zmm::Ref<Dictionary> additional);
79
/// \brief Adds a parameter (will be appended to the URL)
81
/// The parameters will be appended to the object URL in the DIDL-Lite XML.
82
/// This is useful for cases, where you need to identify specific options,
83
/// i.e. something that is only relevant to a particular metadata handler
84
/// and so on. The parameters will be automatically URL encoded.
86
/// \param name parameter name
87
/// \param value parameter value
55
88
void addParameter(zmm::String name, zmm::String value);
90
/// \brief Add an option to the resource.
92
/// The options are internal, they do not appear in the URL or in the
93
/// XML but can be used for any purpose.
94
void addOption(zmm::String name, zmm::String value);
57
96
// urlencode into string
58
97
int getHandlerType();
59
98
zmm::Ref<Dictionary> getAttributes();
60
99
zmm::Ref<Dictionary> getParameters();
100
zmm::Ref<Dictionary> getOptions();
61
101
zmm::String getAttribute(zmm::String name);
62
102
zmm::String getParameter(zmm::String name);
103
zmm::String getOption(zmm::String name);
64
105
bool equals(zmm::Ref<CdsResource> other);
65
106
zmm::Ref<CdsResource> clone();