[rygel] core: Adapt to new gupnp and gupnp-av APIs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: Adapt to new gupnp and gupnp-av APIs
- Date: Mon, 24 Aug 2009 23:28:21 +0000 (UTC)
commit 6d06491aac5626c2a9360dbfe78cf163f14a26d9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Aug 24 16:20:58 2009 +0300
core: Adapt to new gupnp and gupnp-av APIs
src/rygel/Makefile.am | 1 -
src/rygel/rygel-browse-filter.vala | 96 ----------------------
src/rygel/rygel-browse.vala | 11 +--
src/rygel/rygel-didl-lite-writer.vala | 129 ++++++++---------------------
src/rygel/rygel-http-server.vala | 26 +++----
src/rygel/rygel-l16-transcoder.vala | 28 ++++---
src/rygel/rygel-media-item.vala | 40 ++++++---
src/rygel/rygel-mp2ts-transcoder.vala | 21 +++--
src/rygel/rygel-mp3-transcoder.vala | 17 +++--
src/rygel/rygel-root-device-factory.vala | 25 ++----
src/rygel/rygel-root-device.vala | 9 +--
src/rygel/rygel-transcode-manager.vala | 8 +-
src/rygel/rygel-transcoder.vala | 31 +++----
13 files changed, 141 insertions(+), 301 deletions(-)
---
diff --git a/src/rygel/Makefile.am b/src/rygel/Makefile.am
index 10d8d2a..ef9466d 100644
--- a/src/rygel/Makefile.am
+++ b/src/rygel/Makefile.am
@@ -65,7 +65,6 @@ VAPI_SOURCE_FILES = rygel-configuration.vala \
rygel-media-item.vala \
rygel-browse.vala \
rygel-didl-lite-writer.vala \
- rygel-browse-filter.vala \
rygel-transcoder.vala \
rygel-mp2ts-transcoder.vala \
rygel-mp3-transcoder.vala \
diff --git a/src/rygel/rygel-browse.vala b/src/rygel/rygel-browse.vala
index 5722211..ad7a8f9 100644
--- a/src/rygel/rygel-browse.vala
+++ b/src/rygel/rygel-browse.vala
@@ -70,9 +70,6 @@ internal class Rygel.Browse: GLib.Object, Rygel.StateMachine {
public void run (Cancellable? cancellable) {
this.cancellable = cancellable;
- /* Start DIDL-Lite fragment */
- this.didl_writer.start_didl_lite (null, null, true);
-
/* Start by parsing the 'in' arguments */
this.parse_args ();
}
@@ -128,7 +125,7 @@ internal class Rygel.Browse: GLib.Object, Rygel.StateMachine {
}
try {
- this.didl_writer.serialize (this.media_object, this.filter);
+ this.didl_writer.serialize (this.media_object);
} catch (Error err) {
this.handle_error (err);
return;
@@ -201,8 +198,8 @@ internal class Rygel.Browse: GLib.Object, Rygel.StateMachine {
}
private void conclude () {
- /* End DIDL-Lite fragment */
- this.didl_writer.end_didl_lite ();
+ // Apply the filter from the client
+ this.didl_writer.filter (this.filter);
/* Retrieve generated string */
string didl = this.didl_writer.get_string ();
@@ -247,7 +244,7 @@ internal class Rygel.Browse: GLib.Object, Rygel.StateMachine {
/* serialize all children */
for (int i = 0; i < children.size; i++) {
try {
- this.didl_writer.serialize (children[i], this.filter);
+ this.didl_writer.serialize (children[i]);
} catch (Error err) {
this.handle_error (err);
return;
diff --git a/src/rygel/rygel-didl-lite-writer.vala b/src/rygel/rygel-didl-lite-writer.vala
index 138cef0..97d50e0 100644
--- a/src/rygel/rygel-didl-lite-writer.vala
+++ b/src/rygel/rygel-didl-lite-writer.vala
@@ -38,130 +38,73 @@ internal class Rygel.DIDLLiteWriter : GUPnP.DIDLLiteWriter {
this.http_server = http_server;
}
- public void serialize (MediaObject media_object,
- string filter_str)
- throws Error {
- var filter = new BrowseFilter (filter_str);
-
+ public void serialize (MediaObject media_object) throws Error {
if (media_object is MediaItem) {
- this.serialize_item ((MediaItem) media_object, filter);
+ this.serialize_item ((MediaItem) media_object);
} else if (media_object is MediaContainer) {
- this.serialize_container ((MediaContainer) media_object, filter);
+ this.serialize_container ((MediaContainer) media_object);
} else {
throw new DIDLLiteWriterError.UNSUPPORTED_OBJECT (
"Unable to serialize unsupported object");
}
}
- private void serialize_item (MediaItem item,
- BrowseFilter filter)
- throws Error {
- string parent_id;
+ private void serialize_item (MediaItem item) throws Error {
+ var didl_item = this.add_item ();
+ didl_item.id = item.id;
if (item.parent != null) {
- parent_id = item.parent.id;
+ didl_item.parent_id = item.parent.id;
} else {
- parent_id = "0";
+ didl_item.parent_id = "0";
}
- this.start_item (item.id, parent_id, null, false);
-
- /* Add fields */
- this.add_string ("title", NAMESPACE_DC, null, item.title);
-
- this.add_string ("class", NAMESPACE_UPNP, null, item.upnp_class);
+ didl_item.restricted = false;
+ didl_item.title = item.title;
+ didl_item.upnp_class = item.upnp_class;
if (item.author != null && item.author != "") {
- if (filter.have ("creator", NAMESPACE_DC)) {
- this.add_string ("creator", NAMESPACE_DC, null, item.author);
- }
+ didl_item.creator = item.author;
- if (item.upnp_class.has_prefix (MediaItem.VIDEO_CLASS) &&
- filter.have ("author", NAMESPACE_UPNP)) {
- this.add_string ("author", NAMESPACE_UPNP, null, item.author);
- } else if (item.upnp_class.has_prefix (MediaItem.MUSIC_CLASS) &&
- filter.have ("artist", NAMESPACE_UPNP)) {
- this.add_string ("artist", NAMESPACE_UPNP, null, item.author);
+ if (item.upnp_class.has_prefix (MediaItem.VIDEO_CLASS)) {
+ didl_item.author = item.author;
+ } else if (item.upnp_class.has_prefix (MediaItem.MUSIC_CLASS)) {
+ didl_item.artist = item.author;
}
}
- if (item.track_number >= 0 &&
- filter.have ("originalTrackNumber", NAMESPACE_UPNP)) {
- this.add_int ("originalTrackNumber",
- NAMESPACE_UPNP,
- null,
- item.track_number);
+ if (item.track_number >= 0) {
+ didl_item.track_number = item.track_number;
}
- if (item.album != null && item.album != "" &&
- filter.have ("album", NAMESPACE_UPNP)) {
- this.add_string ("album", NAMESPACE_UPNP, null, item.album);
+ if (item.album != null && item.album != "") {
+ didl_item.album = item.album;
}
- if (item.date != null && item.date != "" &&
- filter.have ("date", NAMESPACE_DC)) {
- this.add_string ("date", NAMESPACE_DC, null, item.date);
+ if (item.date != null && item.date != "") {
+ didl_item.date = item.date;
}
- if (filter.have ("res", null)) {
- /* Add resource data */
- var resources = this.get_original_resources (item);
-
- /* Now get the transcoded/proxy URIs */
- this.http_server.add_resources (resources, item);
+ // Add the transcoded/proxy URIs first
+ this.http_server.add_resources (didl_item, item);
- foreach (DIDLLiteResource res in resources) {
- filter.adjust_resource (ref res);
- this.add_res (res);
- }
- }
-
- /* End of item */
- this.end_item ();
+ // then original URIs
+ item.add_resources (didl_item);
}
- private void serialize_container (MediaContainer container,
- BrowseFilter filter)
- throws Error {
- string parent_id;
- int child_count = -1;
-
+ private void serialize_container (MediaContainer container) throws Error {
+ var didl_container = this.add_container ();
if (container.parent != null) {
- parent_id = container.parent.id;
+ didl_container.parent_id = container.parent.id;
} else {
- parent_id = "-1";
- }
-
- if (filter.have ("childCount", null)) {
- child_count = (int) container.child_count;
- }
-
- this.start_container (container.id,
- parent_id,
- child_count,
- false,
- false);
- this.add_string ("class",
- NAMESPACE_UPNP,
- null,
- "object.container.storageFolder");
-
- this.add_string ("title", NAMESPACE_DC, null, container.title);
-
- /* End of Container */
- this.end_container ();
- }
-
- private ArrayList<DIDLLiteResource?> get_original_resources (MediaItem item)
- throws Error {
- var resources = new ArrayList<DIDLLiteResource?> ();
-
- foreach (var uri in item.uris) {
- DIDLLiteResource res = item.create_res (uri);
-
- resources.add (res);
+ didl_container.parent_id = "-1";
}
- return resources;
+ didl_container.id = container.id;
+ didl_container.title = container.title;
+ didl_container.child_count = container.child_count;
+ didl_container.restricted = false;
+ didl_container.searchable = false;
+ didl_container.upnp_class = "object.container.storageFolder";
}
}
diff --git a/src/rygel/rygel-http-server.vala b/src/rygel/rygel-http-server.vala
index 2c32958..21c2610 100644
--- a/src/rygel/rygel-http-server.vala
+++ b/src/rygel/rygel-http-server.vala
@@ -62,28 +62,24 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
* implemenation out there just choose the first one in the list instead of
* the one they can handle.
*/
- internal override void add_resources (
- ArrayList<DIDLLiteResource?> resources,
- MediaItem item)
+ internal override void add_resources (DIDLLiteItem didl_item,
+ MediaItem item)
throws Error {
- // Create the HTTP proxy URI
- string protocol;
- var uri = this.create_uri_for_item (item, null, out protocol);
- DIDLLiteResource res = item.create_res (uri);
- res.protocol = protocol;
-
- if (!http_res_present (resources)) {
- resources.insert (0, res);
+ if (!this.http_uri_present (item)) {
+ // Create the HTTP proxy URI
+ string protocol;
+ var uri = this.create_uri_for_item (item, null, out protocol);
+ item.add_resource (didl_item, uri, protocol);
}
- base.add_resources (resources, item);
+ base.add_resources (didl_item, item);
}
- private bool http_res_present (ArrayList<DIDLLiteResource?> res_list) {
+ private bool http_uri_present (MediaItem item) {
bool present = false;
- foreach (var res in res_list) {
- if (res.protocol == "http-get") {
+ foreach (var uri in item.uris) {
+ if (uri.has_prefix ("http:")) {
present = true;
break;
diff --git a/src/rygel/rygel-l16-transcoder.vala b/src/rygel/rygel-l16-transcoder.vala
index 0b8b5c2..10cdb55 100644
--- a/src/rygel/rygel-l16-transcoder.vala
+++ b/src/rygel/rygel-l16-transcoder.vala
@@ -20,9 +20,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using Rygel;
using Gst;
using GUPnP;
+using Gee;
internal enum Endianness {
LITTLE = ByteOrder.LITTLE_ENDIAN,
@@ -61,21 +61,23 @@ internal class Rygel.L16Transcoder : Rygel.Transcoder {
return new L16TranscoderBin (src, this);
}
- public override DIDLLiteResource create_resource (
- MediaItem item,
- TranscodeManager manager)
- throws Error {
- var res = base.create_resource (item, manager);
-
- res.sample_freq = L16Transcoder.FREQUENCY;
- res.n_audio_channels = L16Transcoder.CHANNELS;
- res.bits_per_sample = L16Transcoder.WIDTH;
+ public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
+ var resource = base.add_resource (didl_item, item, manager);
+ if (resource == null)
+ return null;
+
+ resource.sample_freq = L16Transcoder.FREQUENCY;
+ resource.audio_channels = L16Transcoder.CHANNELS;
+ resource.bits_per_sample = L16Transcoder.WIDTH;
// Set bitrate in bytes/second
- res.bitrate = L16Transcoder.FREQUENCY *
- L16Transcoder.CHANNELS *
- L16Transcoder.WIDTH / 8;
+ resource.bitrate = L16Transcoder.FREQUENCY *
+ L16Transcoder.CHANNELS *
+ L16Transcoder.WIDTH / 8;
- return res;
+ return resource;
}
public Element create_encoder (string? src_pad_name,
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index 666dc03..be43b96 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -76,43 +76,55 @@ public class Rygel.MediaItem : MediaObject {
return null;
}
- internal DIDLLiteResource create_res (string uri) throws Error {
- DIDLLiteResource res = DIDLLiteResource ();
- res.reset ();
+ internal void add_resources (DIDLLiteItem didl_item) throws Error {
+ foreach (var uri in this.uris) {
+ this.add_resource (didl_item, uri, null);
+ }
+ }
- res.uri = uri;
- res.mime_type = this.mime_type;
- res.dlna_profile = this.dlna_profile;
+ internal DIDLLiteResource add_resource (DIDLLiteItem didl_item,
+ string uri,
+ string? protocol)
+ throws Error {
+ var res = didl_item.add_resource ();
+ res.uri = uri;
res.size = this.size;
res.duration = this.duration;
res.bitrate = this.bitrate;
res.sample_freq = this.sample_freq;
res.bits_per_sample = this.bits_per_sample;
- res.n_audio_channels = this.n_audio_channels;
+ res.audio_channels = this.n_audio_channels;
res.width = this.width;
res.height = this.height;
res.color_depth = this.color_depth;
/* Protocol info */
- if (res.uri != null) {
- string protocol = get_protocol_for_uri (res.uri);
- res.protocol = protocol;
+ var protocol_info = new ProtocolInfo ();
+
+ protocol_info.mime_type = this.mime_type;
+ protocol_info.dlna_profile = this.dlna_profile;
+ if (protocol == null) {
+ protocol_info.protocol = this.get_protocol_for_uri (res.uri);
+ } else {
+ protocol_info.protocol = protocol;
}
if (this.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
- res.dlna_flags |= DLNAFlags.INTERACTIVE_TRANSFER_MODE;
+ protocol_info.dlna_flags |= DLNAFlags.INTERACTIVE_TRANSFER_MODE;
} else {
- res.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
+ protocol_info.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
}
if (res.size > 0) {
- res.dlna_operation = DLNAOperation.RANGE;
- res.dlna_flags |= DLNAFlags.BACKGROUND_TRANSFER_MODE;
+ protocol_info.dlna_operation = DLNAOperation.RANGE;
+ protocol_info.dlna_flags |= DLNAFlags.BACKGROUND_TRANSFER_MODE;
}
+ res.protocol_info = protocol_info;
+
return res;
}
diff --git a/src/rygel/rygel-mp2ts-transcoder.vala b/src/rygel/rygel-mp2ts-transcoder.vala
index 4f65f1f..d12428e 100644
--- a/src/rygel/rygel-mp2ts-transcoder.vala
+++ b/src/rygel/rygel-mp2ts-transcoder.vala
@@ -20,9 +20,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using Rygel;
using Gst;
using GUPnP;
+using Gee;
internal enum Rygel.MP2TSProfile {
SD = 0,
@@ -58,16 +58,19 @@ internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
return new MP2TSTranscoderBin (src, this);
}
- public override DIDLLiteResource create_resource (MediaItem item,
- TranscodeManager manager)
- throws Error {
- var res = base.create_resource (item, manager);
+ public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
+ var resource = base.add_resource (didl_item, item, manager);
+ if (resource == null)
+ return null;
- res.width = WIDTH[profile];
- res.height = HEIGHT[profile];
- res.bitrate = (VIDEO_BITRATE + MP3Transcoder.BITRATE) * 1000 / 8;
+ resource.width = WIDTH[profile];
+ resource.height = HEIGHT[profile];
+ resource.bitrate = (VIDEO_BITRATE + MP3Transcoder.BITRATE) * 1000 / 8;
- return res;
+ return resource;
}
public Element create_encoder (string? src_pad_name,
diff --git a/src/rygel/rygel-mp3-transcoder.vala b/src/rygel/rygel-mp3-transcoder.vala
index 67c85a5..e882295 100644
--- a/src/rygel/rygel-mp3-transcoder.vala
+++ b/src/rygel/rygel-mp3-transcoder.vala
@@ -20,9 +20,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using Rygel;
using Gst;
using GUPnP;
+using Gee;
/**
* Transcoder for mpeg 1 layer 2 and 3 audio. This element uses MP3TrancoderBin
@@ -48,15 +48,18 @@ internal class Rygel.MP3Transcoder : Rygel.Transcoder {
return new MP3TranscoderBin (src, this);
}
- public override DIDLLiteResource create_resource (MediaItem item,
- TranscodeManager manager)
- throws Error {
- var res = base.create_resource (item, manager);
+ public override DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
+ var resource = base.add_resource (didl_item, item, manager);
+ if (resource == null)
+ return null;
// Convert bitrate to bytes/second
- res.bitrate = BITRATE * 1000 / 8;
+ resource.bitrate = BITRATE * 1000 / 8;
- return res;
+ return resource;
}
public Element create_encoder (string? src_pad_name,
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index b6d479d..f569f62 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -67,7 +67,7 @@ public class Rygel.RootDeviceFactory {
modified_desc);
/* Create the description xml */
- Xml.Doc *doc = this.create_desc (plugin, desc_path);
+ var doc = this.create_desc (plugin, desc_path);
return new RootDevice (this.context,
plugin,
@@ -76,8 +76,8 @@ public class Rygel.RootDeviceFactory {
BuildConfig.DATA_DIR);
}
- private Xml.Doc * create_desc (Plugin plugin,
- string desc_path) throws GLib.Error {
+ private XMLDoc create_desc (Plugin plugin,
+ string desc_path) throws GLib.Error {
string path;
if (this.check_path_exist (desc_path)) {
@@ -87,12 +87,7 @@ public class Rygel.RootDeviceFactory {
path = plugin.desc_path;
}
- Xml.Doc *doc = Xml.Parser.parse_file (path);
- if (doc == null) {
- string message = "Failed to parse %s".printf (path);
-
- throw new RootDeviceFactoryError.XML_PARSE (message);
- }
+ var doc = new XMLDoc.from_path (path);
/* Modify description to include Plugin-specific stuff */
this.prepare_desc_for_plugin (doc, plugin);
@@ -102,10 +97,10 @@ public class Rygel.RootDeviceFactory {
return doc;
}
- private void prepare_desc_for_plugin (Xml.Doc doc, Plugin plugin) {
+ private void prepare_desc_for_plugin (XMLDoc doc, Plugin plugin) {
Xml.Node *device_element;
- device_element = Utils.get_xml_element ((Xml.Node *) doc,
+ device_element = Utils.get_xml_element ((Xml.Node *) doc.doc,
"root",
"device",
null);
@@ -256,20 +251,18 @@ public class Rygel.RootDeviceFactory {
icon_node->new_child (null, "url", url);
}
- private void save_modified_desc (Xml.Doc *doc,
- string desc_path) throws GLib.Error {
+ private void save_modified_desc (XMLDoc doc,
+ string desc_path) throws GLib.Error {
FileStream f = FileStream.open (desc_path, "w+");
int res = -1;
if (f != null)
- res = Xml.Doc.dump (f, doc);
+ res = Xml.Doc.dump (f, doc.doc);
if (f == null || res == -1) {
string message = "Failed to write modified description" +
" to %s.\n".printf (desc_path);
- delete doc;
-
throw new IOError.FAILED (message);
}
}
diff --git a/src/rygel/rygel-root-device.vala b/src/rygel/rygel-root-device.vala
index b36dc4f..2ce64c9 100644
--- a/src/rygel/rygel-root-device.vala
+++ b/src/rygel/rygel-root-device.vala
@@ -31,11 +31,9 @@ using Gee;
public class Rygel.RootDevice: GUPnP.RootDevice {
internal ArrayList<ServiceInfo> services; /* Services we implement */
- private Xml.Doc *desc_doc;
-
public RootDevice (GUPnP.Context context,
Plugin plugin,
- Xml.Doc *description_doc,
+ XMLDoc description_doc,
string description_path,
string description_dir) {
this.resource_factory = plugin;
@@ -46,7 +44,6 @@ public class Rygel.RootDevice: GUPnP.RootDevice {
this.description_path = description_path;
this.description_dir = description_dir;
- this.desc_doc = description_doc;
this.services = new ArrayList<ServiceInfo> ();
// Now create the sevice objects
@@ -59,9 +56,5 @@ public class Rygel.RootDevice: GUPnP.RootDevice {
}
}
}
-
- ~RootDevice () {
- delete this.desc_doc;
- }
}
diff --git a/src/rygel/rygel-transcode-manager.vala b/src/rygel/rygel-transcode-manager.vala
index f5804c2..a29f474 100644
--- a/src/rygel/rygel-transcode-manager.vala
+++ b/src/rygel/rygel-transcode-manager.vala
@@ -57,8 +57,8 @@ internal abstract class Rygel.TranscodeManager : GLib.Object {
string? transcode_target,
out string protocol);
- public virtual void add_resources (ArrayList<DIDLLiteResource?> resources,
- MediaItem item)
+ public virtual void add_resources (DIDLLiteItem didl_item,
+ MediaItem item)
throws Error {
if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
// No transcoding for images yet :(
@@ -69,14 +69,14 @@ internal abstract class Rygel.TranscodeManager : GLib.Object {
// the UPnP class of the item concerned
foreach (var transcoder in this.transcoders) {
if (item.upnp_class.has_prefix (transcoder.upnp_class)) {
- transcoder.add_resources (resources, item, this);
+ transcoder.add_resource (didl_item, item, this);
}
}
// Then add resources from other transcoders
foreach (var transcoder in this.transcoders) {
if (!item.upnp_class.has_prefix (transcoder.upnp_class)) {
- transcoder.add_resources (resources, item, this);
+ transcoder.add_resource (didl_item, item, this);
}
}
}
diff --git a/src/rygel/rygel-transcoder.vala b/src/rygel/rygel-transcoder.vala
index e4f3585..3fa42e1 100644
--- a/src/rygel/rygel-transcoder.vala
+++ b/src/rygel/rygel-transcoder.vala
@@ -54,33 +54,28 @@ internal abstract class Rygel.Transcoder : GLib.Object {
*/
public abstract Element create_source (Element src) throws Error;
- public void add_resources (ArrayList<DIDLLiteResource?> resources,
- MediaItem item,
- TranscodeManager manager)
- throws Error {
+ public virtual DIDLLiteResource? add_resource (DIDLLiteItem didl_item,
+ MediaItem item,
+ TranscodeManager manager)
+ throws Error {
if (this.mime_type_is_a (item.mime_type, this.mime_type)) {
- return;
+ return null;
}
- resources.add (this.create_resource (item, manager));
- }
-
- public virtual DIDLLiteResource create_resource (MediaItem item,
- TranscodeManager manager)
- throws Error {
string protocol;
var uri = manager.create_uri_for_item (item,
this.dlna_profile,
out protocol);
- DIDLLiteResource res = item.create_res (uri);
- res.mime_type = this.mime_type;
- res.protocol = protocol;
- res.dlna_profile = this.dlna_profile;
- res.dlna_conversion = DLNAConversion.TRANSCODED;
- res.dlna_flags = DLNAFlags.STREAMING_TRANSFER_MODE;
- res.dlna_operation = DLNAOperation.TIMESEEK;
+ var res = item.add_resource (didl_item, uri, protocol);
res.size = -1;
+ var protocol_info = res.protocol_info;
+ protocol_info.mime_type = this.mime_type;
+ protocol_info.dlna_profile = this.dlna_profile;
+ protocol_info.dlna_conversion = DLNAConversion.TRANSCODED;
+ protocol_info.dlna_flags = DLNAFlags.STREAMING_TRANSFER_MODE;
+ protocol_info.dlna_operation = DLNAOperation.TIMESEEK;
+
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]