[MPlayer-users] RTP multicast error

pl p_l at gmx.fr
Sun May 26 15:57:01 CEST 2002


On Sun, May 26, 2002 at 08:12:08PM +0800, Ruslan Araslanov wrote:
> for working mplayer with rtp://multicast_ip
> need change rtp.c module as is:

Please read DOC/tech/patches.txt and send a proper patch to mplayer-dev.

> /* create a receiver socket, i.e. join the multicast group. */
> int makeclientsocket(char *szAddr, unsigned short port, int TTL, 
> struct sockaddr_in *sSockAddr)
> {
>     int socket = makesocket(szAddr, port, TTL, sSockAddr);
>     struct ip_mreqn blub; // arn00
>     struct sockaddr_in sin;
>     unsigned int tempaddr;
>     char localhost[1024]; // ++arn00
>     struct in_addr local; 
>     struct hostent *host; 
> 
>     gethostname(localhost, sizeof localhost);
>     host = gethostbyname(localhost);
>     if (host != NULL)
>         local = *((struct in_addr **) host->h_addr_list)[0];
>     else
>     {
>         perror("unknown local host address");
>         return -1;
>     } // --arn00
> 
>     sin.sin_family=AF_INET;
>     sin.sin_port=htons(port);
>     sin.sin_addr.s_addr=inet_addr(szAddr);
>   
>     if (bind(socket,(struct sockaddr *) &sin,sizeof(sin)))
>     {
>         perror("bind failed");
>         return -1;
>     }
>     tempaddr=inet_addr(szAddr);
>     if ((ntohl(tempaddr) >> 28) == 0xe)
>     {
>         blub.imr_multiaddr.s_addr = inet_addr(szAddr);
>         blub.imr_address.s_addr = local.s_addr; // arn00
>         blub.imr_ifindex = 0;   // arn00
>         if (setsockopt(socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, 
> &blub, sizeof(blub)))
>         {
>             perror("setsockopt IP_ADD_MEMBERSHIP failed (multicast 
> kernel?)");
>             return -1;
>         }
>     }
>     return socket;
> }

-- 
Best regards,
  pl




More information about the MPlayer-users mailing list