[rygel] engine-gst: Omit transcoder if transcoding for same format
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] engine-gst: Omit transcoder if transcoding for same format
- Date: Sun, 24 May 2015 11:27:08 +0000 (UTC)
commit 470accfdb508da2a0d442935e8b149661226c2aa
Author: Jens Georg <mail jensge org>
Date: Sun May 24 12:56:46 2015 +0200
engine-gst: Omit transcoder if transcoding for same format
Signed-off-by: Jens Georg <mail jensge org>
.../gstreamer/rygel-gst-media-engine.vala | 3 ++-
.../gstreamer/rygel-gst-transcoder.vala | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/media-engines/gstreamer/rygel-gst-media-engine.vala
b/src/media-engines/gstreamer/rygel-gst-media-engine.vala
index 3938498..3dbc6cd 100644
--- a/src/media-engines/gstreamer/rygel-gst-media-engine.vala
+++ b/src/media-engines/gstreamer/rygel-gst-media-engine.vala
@@ -162,7 +162,8 @@ public class Rygel.GstMediaEngine : Rygel.MediaEngine {
var list = new GLib.List<GstTranscoder> ();
foreach (var transcoder in transcoders) {
- if (transcoder.get_distance (item) != uint.MAX) {
+ if (transcoder.get_distance (item) != uint.MAX &&
+ transcoder.transcoding_necessary (item)) {
list.append (transcoder);
}
}
diff --git a/src/media-engines/gstreamer/rygel-gst-transcoder.vala
b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
index 0ae8199..e94bde2 100644
--- a/src/media-engines/gstreamer/rygel-gst-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
@@ -231,4 +231,17 @@ internal abstract class Rygel.GstTranscoder : GLib.Object {
bus.post (message);
}
}
+
+ public bool transcoding_necessary (MediaFileItem item) {
+ return !(this.mime_type_is_a (this.mime_type, item.mime_type) &&
+ this.dlna_profile == item.dlna_profile);
+ }
+
+ protected bool mime_type_is_a (string mime_type1, string mime_type2) {
+ string content_type1 = ContentType.get_mime_type (mime_type1);
+ string content_type2 = ContentType.get_mime_type (mime_type2);
+
+ return ContentType.is_a (content_type1, content_type2);
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]