[FFmpeg-devel] [PATCH v2] avformat/rtsp: introduce get_sa_len() function

Kevin Lo kevlo at kevlo.org
Fri Nov 25 09:22:06 EET 2016


On Thu, Nov 24, 2016 at 10:48:38PM -0800, Dave Yeo wrote:
> 
> 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.

Thanks for pointing it out, I just resent the patch, thanks

> Dave

	Kevin


More information about the ffmpeg-devel mailing list