Hi !

Le mercredi 12 août 2009 07:31:39, Jean-Francois Mauguit a écrit :
> I would like to allow our user to use input.harbor on their webradio  
> to allow them doing live radio. But I also have to insert some ads and  
> I would like to announce to the radio editor when the ad will be  
> inserted in his stream (using a countdown). But due to the buffer  
> between this editor and the liquidsoap, I never know when to warn him.  
> How could I know the duration of the buffer ? Is it an easy way doing  
> that ?

I have just added a new telnet command for input.http and input.harbor: 
buffer_length. This commands returns the current buffer's length in seconds, up 
to two digits of precision.

I believe this should be sufficient for your need. You should also be able to 
backport the patch to 0.9.1. It is attached.


Romain

Index: liquidsoap/src/sources/harbor_input.ml
===================================================================
--- liquidsoap/src/sources/harbor_input.ml	(révision 6725)
+++ liquidsoap/src/sources/harbor_input.ml	(révision 6726)
@@ -160,7 +160,11 @@
          if relaying then
            "source client connected"
          else
-           "no source client connected")
+           "no source client connected") ;
+    Server.add ~ns "buffer_length" ~usage:"buffer_length"
+               ~descr:"Get the buffer's length, in seconds."
+       (fun _ -> Printf.sprintf "%.2f"
+             (Fmt.seconds_of_samples self#length))
 
   method private sleep =
     if relaying then self#disconnect
Index: liquidsoap/src/sources/http_source.ml
===================================================================
--- liquidsoap/src/sources/http_source.ml	(révision 6725)
+++ liquidsoap/src/sources/http_source.ml	(révision 6726)
@@ -474,8 +474,13 @@
     Server.add ~ns "start" ~usage:"start" ~descr:"Start the source, if needed."
        (fun _ -> relaying <- true ; "Done") ;
     Server.add ~ns "stop" ~usage:"stop" ~descr:"Stop the source if streaming."
-       (fun _ -> relaying <- false ; "Done")
+       (fun _ -> relaying <- false ; "Done") ;
+    Server.add ~ns "buffer_length" ~usage:"buffer_length" 
+               ~descr:"Get the buffer's length, in seconds."
+       (fun _ -> Printf.sprintf "%.2f" 
+             (Fmt.seconds_of_samples self#length))
 
+
   method sleep = poll_should_stop <- true
 
 end
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to