[FFmpeg-devel] [PATCH v2] avformat/rtsp: introduce get_sa_len() function
Dave Yeo
daveryeo at telus.net
Fri Nov 25 08:48:38 EET 2016
On 11/24/16 07:47 PM, Kevin Lo wrote:
> Since the Linux implementation of sockaddr doesn't have sa_len as a member,
> but the FreeBSD version does, introduce a get_sa_len() function that
> determines the size based on the address family.
>
> Signed-off-by: Kevin Lo <kevlo at kevlo.org>
> ---
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index c6292c5..4c543ed 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -202,6 +202,19 @@ static int get_sockaddr(AVFormatContext *s,
> return 0;
> }
>
> +static socklen_t
> +get_sa_len(struct sockaddr *addr)
> +{
> + switch (addr->sa_family) {
> + case AF_INET:
> + return (sizeof(struct sockaddr_in));
> + case AF_INET6:
> + return (sizeof(struct sockaddr_in6));
> + default:
> + return (sizeof(struct sockaddr));
> + }
> +}
> +
[...]
Fails here (OS/2),
...
CC libavformat/rtspdec.o
K:/usr/local/src/ffmpeg/libavformat/rtsp.c: In function 'get_sa_len':
K:/usr/local/src/ffmpeg/libavformat/rtsp.c:212:17: error: invalid
application of
'sizeof' to incomplete type 'struct sockaddr_in6'
return (sizeof(struct sockaddr_in6));
^
make: *** [libavformat/rtsp.o] Error 1
...
Perhaps use
#if HAVE_STRUCT_SOCKADDR_IN6
case AF_INET6:
return (sizeof(struct sockaddr_in6));
#endif
or such.
Dave
More information about the ffmpeg-devel
mailing list