HP-UX Multimedia Streaming Protocols (MSP) Programmer's Guide
);
/*
* constructing an RTP packet
* The RTP packet which we construct does not contain
* actual media data, but contains alphabets.
* Media streaming applications would replace this
* with actual media packets.
*/
rtp_pkt_t pkt ;
pkt.v=2;
pkt.p=0;
pkt.x=0;
pkt.cc=0;
pkt.m=1;
pkt.pt=7;
pkt.seq=1;
struct timeval tv;
struct timezone tzp;
gettimeofday(&tv,&tzp);
pkt.ts=tv2dbl(tv);
pkt.csrcp=0;
pkt.xtnhdrp=0;
pkt.datap=(char*)malloc(9);
strcpy(pkt.datap,”abcdefgh”,8);
pkt.datalen=8;
i=0;
printf(“send an RTP packet? “);
fflush(stdin);
scanf(“%c”,&ec);
/*
* The library automatically generates RTCP packets.
*/
while((ec==’y’) (ec==’Y’))
{
i++;
if((ret= rtp_send(rd,&pkt))<0) break;
printf(“send another packet? “);
fflush(stdin);
scanf(“%c”,&ec);
}
if(ret<0)
printf(“rtp_send failed n”);
else
printf(“%d RTP packet(s) sent n”,i);
}
The recver.c Program
The recver.c program is as follows:
/*
* HP MSP-RTP Sample application
* (c) Copyright 2003 Hewlett-Packard Company All Rights Reserved.
*
*/
88 Sample Programs