25 May '13 - 19:09 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: On a connected IceCast stream, updating song title works, but stream title not.  (Read 1092 times)
jeroenp
Posts: 93


« on: 5 Apr '11 - 09:55 »
Reply with quoteQuote

See the sample code below:

When streaming to IceCast, performing an _broadCast.UpdateTitle just works, whereas setting the iceCast.StreamDescription or iceCast.StreamName needs a reconnect.

Since a reconnect cycle takes somwehere between 300 and 1000 milliseconds it seems expensive.

So:
  • Can I do this without a reconnect? (if so: how?)
  • If not: why is the reconnect needed?

DOES NOT WORK:

        public void UpdateStreamDescription(string streamDescription)
        {
            if (_broadCast != null)
            {
                IStreamingServer streamingServer = _broadCast.Server;
                ICEcast iceCast = streamingServer as ICEcast;
                if (null != iceCast)
                    iceCast.StreamDescription = streamDescription;
                Logger.WriteVerbose(null, "UpdateStreamDescription", this, streamDescription);
            }
        }

        public void UpdateStreamName(string streamName)
        {
            if (_broadCast != null)
            {
                IStreamingServer streamingServer = _broadCast.Server;
                ICEcast iceCast = streamingServer as ICEcast;
                if (null != iceCast)
                    iceCast.StreamName = streamName;
                Logger.WriteVerbose(null, "UpdateStreamName", this, streamName);
            }
        }


WORKS:

        public void UpdateSongTitle(string songTitle)
        {
            if (_broadCast != null)
            {
                string url = "http://IcecastUrl";
                _broadCast.UpdateTitle(songTitle, url);
                Logger.WriteVerbose(null, "UpdateSongTitle", this, songTitle, url);
            }
        }

        public void UpdateStreamDescription(string streamDescription)
        {
            if (_broadCast != null)
            {
                IStreamingServer streamingServer = _broadCast.Server;
                ICEcast iceCast = streamingServer as ICEcast;
                if (null != iceCast)
                    if (iceCast.StreamDescription != streamDescription)
                    {
                        iceCast.StreamDescription = streamDescription;
                        Reconnect();
                        Logger.WriteVerbose(null, "UpdateStreamDescription", this, streamDescription);
                    }
            }
        }

        public void UpdateStreamName(string streamName)
        {
            if (_broadCast != null)
            {
                IStreamingServer streamingServer = _broadCast.Server;
                ICEcast iceCast = streamingServer as ICEcast;
                if (null != iceCast)
                {
                    iceCast.StreamName = streamName;
                        Reconnect();
                    Logger.WriteVerbose(null, "UpdateStreamName", this, streamName);
                }
            }
        }

        public virtual void Reconnect()
        {
            if (_broadCast.IsConnected)
            {
                _broadCast.Disconnect();
            }
            if (!_broadCast.AutoConnect())
            {
                Logger.WriteVerbose(null, "Reconnect", this, "Not connected!");
            }
        }
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #1 on: 5 Apr '11 - 13:33 »
Reply with quoteQuote

When streaming to IceCast, performing an _broadCast.UpdateTitle just works, whereas setting the iceCast.StreamDescription or iceCast.StreamName needs a reconnect.

The stream description and name information is sent to the server when the connection is made (in a BASS_Encode_CastInit call), before any audio data is sent. Unfortunately, I don't think there is any way to update the information after that, besides reconnecting.
Logged
jeroenp
Posts: 93


« Reply #2 on: 5 Apr '11 - 15:17 »
Reply with quoteQuote

Thanks for the quick answer.

Who can shed some light on the BassEnc.dll API and if this can be changed somewhere in the future at all?

If it is a limitation of the IceCast protocol, it is fine with me, just hoping it isn't Smiley

BTW: if anyone can point me at the IceCast protocol, I'd be very happy, as I couldn't find it on their site.

--jeroen
Logged
Ian @ un4seen
Administrator
Posts: 15276


« Reply #3 on: 5 Apr '11 - 16:53 »
Reply with quoteQuote

The Icecast documentation is available here...

   www.icecast.org/docs/icecast-2.3.2/

The "Admin Interface" section is the relevant part to your query. That is used by BASS_Encode_CastSetTitle to set the metadata, but unfortunately there doesn't appear to be any way to update the description/name/etc info that was sent when the connection was setup by BASS_Encode_CastInit.
Logged
jeroenp
Posts: 93


« Reply #4 on: 7 Apr '11 - 12:44 »
Reply with quoteQuote

OK, thanks!
--jeroen
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines