00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <freesdp/formatter.h>
00023
00024 int main(int argc, char *argv[])
00025 {
00026 fsdp_description_t *dsc = NULL;
00027 fsdp_media_description_t *mdsc1 = NULL, *mdsc2 = NULL;
00028 char *text = NULL;
00029 fsdp_error_t result;
00030
00031 printf(" Beginning to print a new SDP description...\n");
00032
00033
00034
00035
00036 fsdp_make_description(&dsc,0,"A test session","1000000000","1111111111",
00037 "userfoo",FSDP_NETWORK_TYPE_INET,
00038 FSDP_ADDRESS_TYPE_IPV4,"127.0.0.1",
00039 time(NULL),time(NULL)+36000);
00040
00041
00042 fsdp_set_information(dsc,"This is just a test multimedia session.");
00043 fsdp_set_session_type(dsc,FSDP_SESSION_TYPE_MODERATED);
00044 fsdp_set_uri(dsc,"http://www.example.com/foo/user.html");
00045 fsdp_add_email(dsc,"user1@foo.example.com (User 1)");
00046 fsdp_add_email(dsc,"user2@foo.example.com (User 2)");
00047 fsdp_add_phone(dsc,"+11 111 11 11 11");
00048
00049 fsdp_set_conn_address(dsc,FSDP_NETWORK_TYPE_INET,FSDP_ADDRESS_TYPE_IPV4,
00050 "127.0.0.3",0,0);
00051 fsdp_set_sendrecv(dsc,FSDP_SENDRECV_SENDRECV);
00052
00053
00054 fsdp_make_media(&mdsc1,FSDP_MEDIA_AUDIO,30000,0,FSDP_TP_RTP_AVP,"96");
00055 fsdp_add_media_format(mdsc1,"97");
00056 fsdp_add_media_format(mdsc1,"98");
00057 fsdp_add_media_rtpmap(mdsc1,"96","PCMA",8000,NULL);
00058 fsdp_add_media_rtpmap(mdsc1,"97","PCMU",8000,NULL);
00059 fsdp_add_media_rtpmap(mdsc1,"98","L6",11025,"2");
00060 fsdp_set_media_title(mdsc1,"An audio example.");
00061 fsdp_add_media_bw_info(mdsc1,FSDP_BW_MOD_TYPE_CONFERENCE_TOTAL,64000,NULL);
00062 fsdp_set_media_ptime(mdsc1,20);
00063 fsdp_set_media_maxptime(mdsc1,40);
00064
00065 fsdp_make_media(&mdsc2,FSDP_MEDIA_VIDEO,31000,0,FSDP_TP_RTP_AVP,"0");
00066 fsdp_set_media_title(mdsc2,"A video example.");
00067 fsdp_set_media_conn_address(mdsc2,FSDP_NETWORK_TYPE_INET,
00068 FSDP_ADDRESS_TYPE_IPV4,"127.0.0.5",0,0);
00069 fsdp_set_media_sendrecv(mdsc2,FSDP_SENDRECV_SENDONLY);
00070 fsdp_set_media_encryption(mdsc2,FSDP_ENCRYPTION_METHOD_URI,
00071 "http://www.example.com/key");
00072
00073 fsdp_add_media(dsc,mdsc1);
00074 fsdp_add_media(dsc,mdsc2);
00075
00076
00077 result = fsdp_format(dsc,&text);
00078
00079 if ( result == FSDPE_OK ) {
00080 printf(" completed succesfully!\n Below is the description:\n");
00081 printf("------------------------------------\n");
00082 } else {
00083 printf(" failed with error code %d: %s.\n",result,fsdp_strerror(result));
00084 printf(" Below is what could be formatted:\n");
00085 printf("------------------------------------\n");
00086 }
00087
00088
00089 printf(text);
00090
00091
00092 fsdp_description_delete(dsc);
00093 free(text);
00094
00095 return 0;
00096 }