rtp: rename modarg destination to destination_ip

The module argument 'source' already has special meaning as the
pa_source, however, the argument 'destination' expects an IP address.

Prior to introducing a source IP modarg for the source IP address,
rename the 'destination' argument to 'destination_ip'. Include
compatibility support for old RTP users so they don't need to change
their module usage immediately.

(changes in v2: minor formatting fixes, s/dstip/destination_ip)

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2012-11-17 23:31:17 +00:00 committed by Arun Raghavan
parent ce0294ccf2
commit d18c3664b5

View file

@ -63,7 +63,7 @@ PA_MODULE_USAGE(
"format=<sample format> " "format=<sample format> "
"channels=<number of channels> " "channels=<number of channels> "
"rate=<sample rate> " "rate=<sample rate> "
"destination=<destination IP address> " "destination_ip=<destination IP address> "
"port=<port number> " "port=<port number> "
"mtu=<maximum transfer unit> " "mtu=<maximum transfer unit> "
"loop=<loopback to local host?> " "loop=<loopback to local host?> "
@ -73,7 +73,7 @@ PA_MODULE_USAGE(
#define DEFAULT_PORT 46000 #define DEFAULT_PORT 46000
#define DEFAULT_TTL 1 #define DEFAULT_TTL 1
#define SAP_PORT 9875 #define SAP_PORT 9875
#define DEFAULT_DESTINATION "224.0.0.56" #define DEFAULT_DESTINATION_IP "224.0.0.56"
#define MEMBLOCKQ_MAXLENGTH (1024*170) #define MEMBLOCKQ_MAXLENGTH (1024*170)
#define DEFAULT_MTU 1280 #define DEFAULT_MTU 1280
#define SAP_INTERVAL (5*PA_USEC_PER_SEC) #define SAP_INTERVAL (5*PA_USEC_PER_SEC)
@ -83,7 +83,8 @@ static const char* const valid_modargs[] = {
"format", "format",
"channels", "channels",
"rate", "rate",
"destination", "destination", /* Compatbility */
"destination_ip",
"port", "port",
"mtu" , "mtu" ,
"loop", "loop",
@ -241,7 +242,9 @@ int pa__init(pa_module*m) {
goto fail; goto fail;
} }
dst_addr = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION); dst_addr = pa_modargs_get_value(ma, "destination", NULL);
if (dst_addr == NULL)
dst_addr = pa_modargs_get_value(ma, "destination_ip", DEFAULT_DESTINATION_IP);
if (inet_pton(AF_INET, dst_addr, &dst_sa4.sin_addr) > 0) { if (inet_pton(AF_INET, dst_addr, &dst_sa4.sin_addr) > 0) {
dst_sa4.sin_family = af = AF_INET; dst_sa4.sin_family = af = AF_INET;