[rygel] core: MediaItem.should_stream() -> is_live_stream()



commit 707716eb07fbd9ed61c91a0e8da0493425878ed1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Mar 18 16:40:12 2011 +0200

    core: MediaItem.should_stream() -> is_live_stream()
    
    Rename MediaItem.should_stream() to is_live_stream() and remove the now
    incorrect and redundant comment.

 src/rygel/rygel-http-get.vala              |    2 +-
 src/rygel/rygel-http-identity-handler.vala |    2 +-
 src/rygel/rygel-http-time-seek.vala        |    2 +-
 src/rygel/rygel-media-item.vala            |    7 ++-----
 tests/rygel-http-get-test.vala             |    2 +-
 tests/rygel-http-gst-response-test.vala    |    4 ++++
 tests/rygel-http-time-seek-test.vala       |    2 +-
 7 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index 3fac36a..e22612d 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -162,7 +162,7 @@ internal class Rygel.HTTPGet : HTTPRequest {
         case "Interactive":
         case "Background":
             correct =  this.handler is HTTPIdentityHandler &&
-                       (!this.item.should_stream () ||
+                       (!this.item.is_live_stream () ||
                         this.subtitle != null ||
                         this.thumbnail != null);
 
diff --git a/src/rygel/rygel-http-identity-handler.vala b/src/rygel/rygel-http-identity-handler.vala
index 9ae2eb6..00dee0b 100644
--- a/src/rygel/rygel-http-identity-handler.vala
+++ b/src/rygel/rygel-http-identity-handler.vala
@@ -75,7 +75,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPGetHandler {
     private HTTPResponse render_body_real (HTTPGet request) throws Error {
         if (request.subtitle != null ||
             request.thumbnail != null ||
-            !(request.item.should_stream ())) {
+            !(request.item.is_live_stream ())) {
             return new HTTPSeekableResponse (request, this);
         } else {
             return new HTTPGstResponse (request, this);
diff --git a/src/rygel/rygel-http-time-seek.vala b/src/rygel/rygel-http-time-seek.vala
index b7e67e7..9eea7ca 100644
--- a/src/rygel/rygel-http-time-seek.vala
+++ b/src/rygel/rygel-http-time-seek.vala
@@ -83,7 +83,7 @@ internal class Rygel.HTTPTimeSeek : Rygel.HTTPSeek {
                (request.handler is HTTPTranscodeHandler ||
                 (request.thumbnail == null &&
                  request.subtitle == null &&
-                 request.item.should_stream ()));
+                 request.item.is_live_stream ()));
     }
 
     public static bool requested (HTTPGet request) {
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index b0e0002..33f6210 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -122,10 +122,7 @@ public abstract class Rygel.MediaItem : MediaObject {
         return src;
     }
 
-    // Return true if item should be streamed as a gstreamer response with
-    // time based seeking, or false to serve directly with byte range
-    // seeking.
-    public bool should_stream () {
+    public bool is_live_stream () {
         return this.streamable () && this.size <= 0;
     }
 
@@ -261,7 +258,7 @@ public abstract class Rygel.MediaItem : MediaObject {
             protocol_info.dlna_flags |= DLNAFlags.STREAMING_TRANSFER_MODE;
         }
 
-        if (!this.should_stream ()) {
+        if (!this.is_live_stream ()) {
             protocol_info.dlna_flags |= DLNAFlags.BACKGROUND_TRANSFER_MODE;
         }
 
diff --git a/tests/rygel-http-get-test.vala b/tests/rygel-http-get-test.vala
index 010c878..7f3acde 100644
--- a/tests/rygel-http-get-test.vala
+++ b/tests/rygel-http-get-test.vala
@@ -249,7 +249,7 @@ public abstract class Rygel.MediaItem : Rygel.MediaObject {
     public ArrayList<Subtitle> subtitles = new ArrayList<Subtitle> ();
     public ArrayList<Thumbnail> thumbnails = new ArrayList<Thumbnail> ();
 
-    public bool should_stream () {
+    public bool is_live_stream () {
         return true;
     }
 
diff --git a/tests/rygel-http-gst-response-test.vala b/tests/rygel-http-gst-response-test.vala
index 3315d11..535984e 100644
--- a/tests/rygel-http-gst-response-test.vala
+++ b/tests/rygel-http-gst-response-test.vala
@@ -122,6 +122,10 @@ public class Rygel.MediaItem {
     public Element? create_stream_source () {
         return this.src;
     }
+
+    public bool is_live_stream () {
+        return ((int) this.src.num_buffers) < 0;
+    }
 }
 
 internal abstract class Rygel.HTTPSeek : GLib.Object {
diff --git a/tests/rygel-http-time-seek-test.vala b/tests/rygel-http-time-seek-test.vala
index da74f56..d84cf41 100644
--- a/tests/rygel-http-time-seek-test.vala
+++ b/tests/rygel-http-time-seek-test.vala
@@ -32,7 +32,7 @@ private class Rygel.HTTPTranscodeHandler : GLib.Object {}
 private abstract class Rygel.MediaItem : GLib.Object {
     public int64 size = -1;
 
-    public virtual bool should_stream () {
+    public bool is_live_stream () {
         return true;
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]