mirror of
https://github.com/rgaufman/live555.git
synced 2026-01-19 00:04:34 +08:00
43 lines
1.6 KiB
C++
43 lines
1.6 KiB
C++
/**********
|
|
This library is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
Free Software Foundation; either version 3 of the License, or (at your
|
|
option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
|
|
|
|
This library is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
|
|
more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this library; if not, write to the Free Software Foundation, Inc.,
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
**********/
|
|
// Copyright (c) 1996-2025, Live Networks, Inc. All rights reserved
|
|
// A common function that outputs the URL(s) that can be used to access a stream
|
|
// served by a RTSP server.
|
|
// Implementation
|
|
|
|
#include "announceURL.hh"
|
|
#include <GroupsockHelper.hh> // for "weHaveAnIPv*Address()"
|
|
|
|
void announceURL(RTSPServer* rtspServer, ServerMediaSession* sms) {
|
|
if (rtspServer == NULL || sms == NULL) return; // sanity check
|
|
|
|
UsageEnvironment& env = rtspServer->envir();
|
|
|
|
env << "Play this stream using the URL ";
|
|
if (weHaveAnIPv4Address(env)) {
|
|
char* url = rtspServer->ipv4rtspURL(sms);
|
|
env << "\"" << url << "\"";
|
|
delete[] url;
|
|
if (weHaveAnIPv6Address(env)) env << " or ";
|
|
}
|
|
if (weHaveAnIPv6Address(env)) {
|
|
char* url = rtspServer->ipv6rtspURL(sms);
|
|
env << "\"" << url << "\"";
|
|
delete[] url;
|
|
}
|
|
env << "\n";
|
|
}
|