Commit 46d6f941 authored by Jens Georg's avatar Jens Georg

Add support for pv:subtitleFileUri and Type

https://bugzilla.gnome.org/show_bug.cgi?id=695990
parent 44f9992d
......@@ -8,6 +8,7 @@ gupnp_didl_lite_object_get_xml_node
gupnp_didl_lite_object_get_upnp_namespace
gupnp_didl_lite_object_get_dc_namespace
gupnp_didl_lite_object_get_dlna_namespace
gupnp_didl_lite_object_get_pv_namespace
gupnp_didl_lite_object_get_properties
gupnp_didl_lite_object_get_id
gupnp_didl_lite_object_get_parent_id
......@@ -181,6 +182,7 @@ GUPNP_DIDL_LITE_WRITER_GET_CLASS
GUPNP_DIDL_LITE_WRITER_NAMESPACE_DC
GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP
GUPNP_DIDL_LITE_WRITER_NAMESPACE_DLNA
GUPNP_DIDL_LITE_WRITER_NAMESPACE_PV
<SUBSECTION Private>
GUPnPDIDLLiteWriterPrivate
gupnp_didl_lite_writer_get_type
......@@ -222,6 +224,7 @@ gupnp_didl_lite_resource_get_color_depth
gupnp_didl_lite_resource_get_xml_node
gupnp_didl_lite_resource_get_cleartext_size
gupnp_didl_lite_resource_get_dlna_namespace
gupnp_didl_lite_resource_get_pv_namespace
gupnp_didl_lite_resource_get_update_count
gupnp_didl_lite_resource_set_update_count
gupnp_didl_lite_resource_unset_update_count
......@@ -230,6 +233,10 @@ gupnp_didl_lite_resource_get_track_total
gupnp_didl_lite_resource_set_track_total
gupnp_didl_lite_resource_track_total_is_set
gupnp_didl_lite_resource_unset_track_total
gupnp_didl_lite_resource_get_subtitle_file_type
gupnp_didl_lite_resource_get_subtitle_file_uri
gupnp_didl_lite_resource_set_subtitle_file_type
gupnp_didl_lite_resource_set_subtitle_file_uri
<SUBSECTION Standard>
GUPNP_TYPE_DIDL_LITE_RESOURCE
GUPNP_DIDL_LITE_RESOURCE
......
......@@ -35,7 +35,8 @@ gupnp_didl_lite_object_new_from_xml (xmlNode *xml_node,
GUPnPXMLDoc *xml_doc,
xmlNs *upnp_ns,
xmlNs *dc_ns,
xmlNs *dlna_ns);
xmlNs *dlna_ns,
xmlNs *pv_ns);
G_GNUC_INTERNAL GUPnPXMLDoc *
gupnp_didl_lite_object_get_gupnp_xml_doc
......
......@@ -54,6 +54,7 @@ struct _GUPnPDIDLLiteObjectPrivate {
xmlNs *upnp_ns;
xmlNs *dc_ns;
xmlNs *dlna_ns;
xmlNs *pv_ns;
};
static XSDData *didl_lite_xsd;
......@@ -65,6 +66,7 @@ enum {
PROP_UPNP_NAMESPACE,
PROP_DC_NAMESPACE,
PROP_DLNA_NAMESPACE,
PROP_PV_NAMESPACE,
PROP_ID,
PROP_PARENT_ID,
PROP_RESTRICTED,
......@@ -133,6 +135,9 @@ gupnp_didl_lite_object_set_property (GObject *object,
case PROP_DLNA_NAMESPACE:
didl_object->priv->dlna_ns = g_value_get_pointer (value);
break;
case PROP_PV_NAMESPACE:
didl_object->priv->pv_ns = g_value_get_pointer (value);
break;
case PROP_ID:
gupnp_didl_lite_object_set_id (didl_object,
g_value_get_string (value));
......@@ -257,6 +262,12 @@ gupnp_didl_lite_object_get_property (GObject *object,
gupnp_didl_lite_object_get_dlna_namespace
(didl_object));
break;
case PROP_PV_NAMESPACE:
g_value_set_pointer
(value,
gupnp_didl_lite_object_get_pv_namespace
(didl_object));
break;
case PROP_ID:
g_value_set_string
(value,
......@@ -482,6 +493,25 @@ gupnp_didl_lite_object_class_init (GUPnPDIDLLiteObjectClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
/**
* GUPnPDIDLLiteObject:pv-namespace:
*
* Pointer to the PV metadata namespace registered with the XML
* document containing this object.
*
**/
g_object_class_install_property
(object_class,
PROP_PV_NAMESPACE,
g_param_spec_pointer ("pv-namespace",
"XML namespace",
"Pointer to the PV metadata namespace "
"registered with the XML document "
"containing this object.",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* GUPnPDIDLLiteObject:id:
*
......@@ -914,6 +944,7 @@ unset_contributors_by_name (GUPnPDIDLLiteObject *object, const char *name)
* @upnp_ns: The pointer to 'upnp' namespace in XML document
* @dc_ns: The pointer to 'dc' namespace in XML document
* @dlna_ns: The pointer to 'dlna' namespace in XML document
* @pv_ns: The pointer to 'pv' namespace in XML document
*
* Creates a new #GUPnPDIDLLiteObject for the @xml_node.
*
......@@ -924,7 +955,8 @@ gupnp_didl_lite_object_new_from_xml (xmlNode *xml_node,
GUPnPXMLDoc *xml_doc,
xmlNs *upnp_ns,
xmlNs *dc_ns,
xmlNs *dlna_ns)
xmlNs *dlna_ns,
xmlNs *pv_ns)
{
g_return_val_if_fail (xml_node != NULL, NULL);
g_return_val_if_fail (xml_node->name != NULL, NULL);
......@@ -939,6 +971,7 @@ gupnp_didl_lite_object_new_from_xml (xmlNode *xml_node,
"upnp-namespace", upnp_ns,
"dc-namespace", dc_ns,
"dlna-namespace", dlna_ns,
"pv-namespace", pv_ns,
NULL);
else if (g_ascii_strcasecmp ((char *) xml_node->name, "item") == 0)
return g_object_new (GUPNP_TYPE_DIDL_LITE_ITEM,
......@@ -947,6 +980,7 @@ gupnp_didl_lite_object_new_from_xml (xmlNode *xml_node,
"upnp-namespace", upnp_ns,
"dc-namespace", dc_ns,
"dlna-namespace", dlna_ns,
"pv-namespace", pv_ns,
NULL);
else
return NULL;
......@@ -1052,6 +1086,24 @@ gupnp_didl_lite_object_get_dlna_namespace (GUPnPDIDLLiteObject *object)
return object->priv->dlna_ns;
}
/**
* gupnp_didl_lite_object_get_pv_namespace:
* @object: The #GUPnPDIDLLiteObject
*
* Get the pointer to the PV metadata namespace registered with the XML
* document containing this object.
*
* Returns: (transfer none): The pointer to PV namespace in XML document.
**/
xmlNsPtr
gupnp_didl_lite_object_get_pv_namespace (GUPnPDIDLLiteObject *object)
{
g_return_val_if_fail (GUPNP_IS_DIDL_LITE_OBJECT (object), NULL);
return object->priv->pv_ns;
}
/**
* gupnp_didl_lite_object_get_id:
* @object: #GUPnPDIDLLiteObject
......@@ -1514,7 +1566,8 @@ gupnp_didl_lite_object_get_resources (GUPnPDIDLLiteObject *object)
resource = gupnp_didl_lite_resource_new_from_xml
(res_node,
object->priv->xml_doc,
object->priv->dlna_ns);
object->priv->dlna_ns,
object->priv->pv_ns);
ret = g_list_append (ret, resource);
}
......@@ -2136,7 +2189,8 @@ gupnp_didl_lite_object_add_resource (GUPnPDIDLLiteObject *object)
return gupnp_didl_lite_resource_new_from_xml (res_node,
object->priv->xml_doc,
object->priv->dlna_ns);
object->priv->dlna_ns,
object->priv->pv_ns);
}
/**
......
......@@ -94,6 +94,9 @@ xmlNsPtr
gupnp_didl_lite_object_get_dlna_namespace
(GUPnPDIDLLiteObject *object);
xmlNsPtr
gupnp_didl_lite_object_get_pv_namespace
(GUPnPDIDLLiteObject *object);
const char *
gupnp_didl_lite_object_get_upnp_class (GUPnPDIDLLiteObject *object);
......
......@@ -83,6 +83,7 @@ parse_elements (GUPnPDIDLLiteParser *parser,
xmlNs *upnp_ns,
xmlNs *dc_ns,
xmlNs *dlna_ns,
xmlNs *pv_ns,
gboolean recursive,
GError **error);
......@@ -230,7 +231,8 @@ gupnp_didl_lite_parser_parse_didl_recursive (GUPnPDIDLLiteParser *parser,
xmlNs **ns_list;
xmlNs *upnp_ns = NULL;
xmlNs *dc_ns = NULL;
xmlNs *dlna_ns = NULL;
xmlNs *dlna_ns = NULL;
xmlNs *pv_ns = NULL;
GUPnPXMLDoc *xml_doc;
gboolean result;
......@@ -292,6 +294,9 @@ gupnp_didl_lite_parser_parse_didl_recursive (GUPnPDIDLLiteParser *parser,
else if (! dlna_ns &&
g_ascii_strcasecmp (prefix, "dlna") == 0)
dlna_ns = ns_list[i];
else if (! pv_ns &&
g_ascii_strcasecmp (prefix, "pv") == 0)
pv_ns = ns_list[i];
}
xmlFree (ns_list);
......@@ -316,6 +321,12 @@ gupnp_didl_lite_parser_parse_didl_recursive (GUPnPDIDLLiteParser *parser,
"urn:schemas-dlna-org:metadata-2-0/",
(unsigned char *)
GUPNP_DIDL_LITE_WRITER_NAMESPACE_DLNA);
if (! pv_ns)
dlna_ns = xmlNewNs (xmlDocGetRootElement (doc),
(unsigned char *)
"http://www.pv.com/pvns/",
(unsigned char *)
GUPNP_DIDL_LITE_WRITER_NAMESPACE_PV);
xml_doc = gupnp_xml_doc_new (doc);
......@@ -325,6 +336,7 @@ gupnp_didl_lite_parser_parse_didl_recursive (GUPnPDIDLLiteParser *parser,
upnp_ns,
dc_ns,
dlna_ns,
pv_ns,
recursive,
error);
g_object_unref (xml_doc);
......@@ -339,6 +351,7 @@ parse_elements (GUPnPDIDLLiteParser *parser,
xmlNs *upnp_ns,
xmlNs *dc_ns,
xmlNs *dlna_ns,
xmlNs *pv_ns,
gboolean recursive,
GError **error)
{
......@@ -349,7 +362,7 @@ parse_elements (GUPnPDIDLLiteParser *parser,
object = gupnp_didl_lite_object_new_from_xml (element, xml_doc,
upnp_ns, dc_ns,
dlna_ns);
dlna_ns, pv_ns);
if (object == NULL)
continue;
......@@ -366,6 +379,7 @@ parse_elements (GUPnPDIDLLiteParser *parser,
upnp_ns,
dc_ns,
dlna_ns,
pv_ns,
recursive,
error)) {
g_object_unref (object);
......
......@@ -32,7 +32,8 @@ G_BEGIN_DECLS
GUPnPDIDLLiteResource *
gupnp_didl_lite_resource_new_from_xml (xmlNode *xml_node,
GUPnPXMLDoc *xml_doc,
xmlNs *dlna_ns);
xmlNs *dlna_ns,
xmlNs *pv_ns);
G_END_DECLS
......
This diff is collapsed.
......@@ -164,6 +164,16 @@ void
gupnp_didl_lite_resource_unset_update_count
(GUPnPDIDLLiteResource *resource);
void
gupnp_didl_lite_resource_set_subtitle_file_uri
(GUPnPDIDLLiteResource *resource,
const char *uri);
void
gupnp_didl_lite_resource_set_subtitle_file_type
(GUPnPDIDLLiteResource *resource,
const char *type);
xmlNode *
gupnp_didl_lite_resource_get_xml_node (GUPnPDIDLLiteResource *resource);
......@@ -171,6 +181,10 @@ xmlNsPtr
gupnp_didl_lite_resource_get_dlna_namespace
(GUPnPDIDLLiteResource *resource);
xmlNsPtr
gupnp_didl_lite_resource_get_pv_namespace
(GUPnPDIDLLiteResource *resource);
const char *
gupnp_didl_lite_resource_get_uri (GUPnPDIDLLiteResource *resource);
......@@ -238,6 +252,13 @@ gboolean
gupnp_didl_lite_resource_track_total_is_set
(GUPnPDIDLLiteResource *resource);
const char *
gupnp_didl_lite_resource_get_subtitle_file_uri
(GUPnPDIDLLiteResource *resource);
const char *
gupnp_didl_lite_resource_get_subtitle_file_type
(GUPnPDIDLLiteResource *resource);
G_END_DECLS
#endif /* __GUPNP_DIDL_LITE_RESOURCE_H__ */
......@@ -49,6 +49,7 @@ struct _GUPnPDIDLLiteWriterPrivate {
xmlNs *upnp_ns;
xmlNs *dc_ns;
xmlNs *dlna_ns;
xmlNs *pv_ns;
char *language;
......@@ -416,6 +417,11 @@ gupnp_didl_lite_writer_constructed (GObject *object)
"urn:schemas-dlna-org:metadata-1-0/",
(unsigned char *)
GUPNP_DIDL_LITE_WRITER_NAMESPACE_DLNA);
priv->pv_ns = xmlNewNs (priv->xml_node,
(unsigned char *)
"http://www.pv.com/pvns/",
(unsigned char *)
GUPNP_DIDL_LITE_WRITER_NAMESPACE_PV);
xmlNewNs (priv->xml_node,
(unsigned char *)
"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/",
......@@ -520,7 +526,10 @@ gupnp_didl_lite_writer_class_init (GUPnPDIDLLiteWriterClass *klass)
/**
* gupnp_didl_lite_writer_new:
* @language: (allow-none):The language the DIDL-Lite fragment is in, or NULL
* @language: (allow-none):The language the DIDL-Lite fragment is in, or %NULL
*
* Note: @language should always be set to %NULL, DLNA does not support the
* language parameter.
*
* Return value: A new #GUPnPDIDLLiteWriter object.
**/
......@@ -557,7 +566,8 @@ gupnp_didl_lite_writer_add_item (GUPnPDIDLLiteWriter *writer)
writer->priv->xml_doc,
writer->priv->upnp_ns,
writer->priv->dc_ns,
writer->priv->dlna_ns);
writer->priv->dlna_ns,
writer->priv->pv_ns);
return GUPNP_DIDL_LITE_ITEM (object);
}
......@@ -594,7 +604,8 @@ gupnp_didl_lite_writer_add_container_child_item
writer->priv->xml_doc,
writer->priv->upnp_ns,
writer->priv->dc_ns,
writer->priv->dlna_ns);
writer->priv->dlna_ns,
writer->priv->pv_ns);
return GUPNP_DIDL_LITE_ITEM (object);
}
......@@ -623,7 +634,8 @@ gupnp_didl_lite_writer_add_container (GUPnPDIDLLiteWriter *writer)
writer->priv->xml_doc,
writer->priv->upnp_ns,
writer->priv->dc_ns,
writer->priv->dlna_ns);
writer->priv->dlna_ns,
writer->priv->pv_ns);
return GUPNP_DIDL_LITE_CONTAINER (object);
}
......
......@@ -80,6 +80,7 @@ typedef struct {
#define GUPNP_DIDL_LITE_WRITER_NAMESPACE_DC "dc"
#define GUPNP_DIDL_LITE_WRITER_NAMESPACE_UPNP "upnp"
#define GUPNP_DIDL_LITE_WRITER_NAMESPACE_DLNA "dlna"
#define GUPNP_DIDL_LITE_WRITER_NAMESPACE_PV "pv"
GUPnPDIDLLiteWriter *
gupnp_didl_lite_writer_new (const char *language);
......
GUPnPAV cheader_filename="libgupnp-av/gupnp-av.h"
*.get_*_namespace type="Xml.Ns*"
*.xml_node type="Xml.Node*"
*.dlna_namespace type="Xml.Ns*"
*.pv_namespace type="Xml.Ns*"
*.dc_namespace type="Xml.Ns*"
*.upnp_namespace type="Xml.Ns*"
DIDL_LITE_WRITER_NAMESPACE_* skip
*.gupnp_reserved skip
SearchCriteriaParserError skip
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment