HP-UX Multimedia Streaming Protocols (MSP) Programmer's Guide

Compiling the Sample RTSP Program
This section describes how to compile the sample RTSP program.
Before compiling the program, enure that the rtsp.h header file and the librtsp
library provided by the HP-UX MSP suite are available on the machine. The rtsp.h
header file is assumed to be in the /usr/include directory and the librtsp library
in the /usr/lib directory.To compile, issue the following command:
$ cc sampleclient.c -o sampleclient -lrtsp
SDP Sample Program
The following is a sample program for SDP module of the MSP suite of libraries:
#include <stdio.h>
#include <fcntl.h>
#include sdp.h
#define SDP_BUFSIZE 1024
sdp_t *init_parse_sdp(char *);
void print_session_level_fields(sdp_t *);
void print_media_descriptions(sdp_t *);
void print_media_attributes(sdp_t *);
int parse_media(sdp_t *, char *, char **);
main(int argc, char **argv)
{
sdp_t *sdp;
char sbuf[SDP_BUFSIZE];
int fd;
int n;
if( argc <= 1)
fd = open(./sample.in, O_RDONLY);
else
fd = open(argv[1], O_RDONLY);
n=read(fd, sbuf, sizeof(sbuf));
sbuf[n]= 0;
sdp = init_parse_sdp(sbuf);
if (sdp != NULL) {
print_session_level_fields(sdp);
print_media_descriptions(sdp);
print_media_attributes(sdp);
}
sdp_free(sdp);
return;
}
sdp_t *
init_parse_sdp(char *sbuf)
{
sdp_t *psdp = NULL;
int sdp_ret;
if ((psdp = sdp_init()) == NULL) /* initialize sdp structure */
return NULL;
/* Parse the input buffer and fill up the sdp structure */
if (sdp_ret = sdp_parse_buf(psdp, sbuf) != SDP_SUCCESS)
return NULL;
return psdp;
}
/* Prints some of the session level descriptions */
104 Sample Programs