You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
sapenc: Use the normal URL port as RTP port
This makes the URL handling consistent - the URL hostname is used as destination for the RTP packets, so the URL port should also belong to that. Now the options announce_addr= and announce_port specify where the announcements are sent. Originally committed as revision 25424 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@ -70,7 +70,7 @@ static int sap_write_header(AVFormatContext *s)
|
|||||||
struct SAPState *sap = s->priv_data;
|
struct SAPState *sap = s->priv_data;
|
||||||
char host[1024], path[1024], url[1024], announce_addr[50] = "";
|
char host[1024], path[1024], url[1024], announce_addr[50] = "";
|
||||||
char *option_list;
|
char *option_list;
|
||||||
int port, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
|
int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
|
||||||
AVFormatContext **contexts = NULL;
|
AVFormatContext **contexts = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct sockaddr_storage localaddr;
|
struct sockaddr_storage localaddr;
|
||||||
@ -81,17 +81,17 @@ static int sap_write_header(AVFormatContext *s)
|
|||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
|
|
||||||
/* extract hostname and port */
|
/* extract hostname and port */
|
||||||
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port,
|
av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &base_port,
|
||||||
path, sizeof(path), s->filename);
|
path, sizeof(path), s->filename);
|
||||||
if (port < 0)
|
if (base_port < 0)
|
||||||
port = 9875;
|
base_port = 5004;
|
||||||
|
|
||||||
/* search for options */
|
/* search for options */
|
||||||
option_list = strrchr(path, '?');
|
option_list = strrchr(path, '?');
|
||||||
if (option_list) {
|
if (option_list) {
|
||||||
char buf[50];
|
char buf[50];
|
||||||
if (find_info_tag(buf, sizeof(buf), "base_port", option_list)) {
|
if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
|
||||||
base_port = strtol(buf, NULL, 10);
|
port = strtol(buf, NULL, 10);
|
||||||
}
|
}
|
||||||
if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
|
if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
|
||||||
same_port = strtol(buf, NULL, 10);
|
same_port = strtol(buf, NULL, 10);
|
||||||
|
Reference in New Issue
Block a user