5 The objective of the media_api is to construct and run the necessary
6 processing on audio and video data flows for a given call (two party call) or
8 The media_api must support calls where callmember can be remote as well
9 local hosted, in other words the media_api can be used inside linphone as
10 well as in sip conferencing server. The api must support multiples way of
11 getting media data: from disk, from rtp, from soundcard...
12 The media_api is object oriented in C, and is based on the mediastreamer library
13 to deal with audio or video signals, and on glib for types and usefull routines.
15 The api must provide object and methods that describes the call, and then functions
16 that executes the processing (using the mediastreamer) that is necessary for the
21 ************************************************************************
23 This object reprensent a media that is shared between all members of the call,
26 MediaFlow *media_flow_new(char *id_string,gint type,gint duplex);
27 type can be FLOW_AUDIO, FLOW_VIDEO.
28 if duplex is 1, it means that the media flow is used by every member in both
29 receiving and sending mode.
30 id_string is just a string to identify the flow.
32 void media_flow_destroy(MediaFlow *flow);
35 **************************************************************************
37 This object reprensent a member of a call.
39 CallMember *call_member_new();
41 gint call_member_setup_flow(CallMember *member, MediaFlow *flow,
42 char *rx_endpoint, char *tx_endpoint);
43 This is the most important function of the API. It describes the way each
44 call member receives and send a given media flow.
45 The MediaFlow "flow" is added to the list of flows used by the member "member".
46 rx_endpoint is a string that described how data is received by the call member.
47 It should be an url, for example "rtp://213.21.54.127:7080". In this case it
48 means that data will be received on port 7080 at ip address 213.21.54.127.
49 tx_endpoint is a string that described how data is sent by the call member.
50 The role of url is very important. They can be:
51 "rtp://213.21.54.127:7080"
52 "file://tmp/media.out" -a file on disk
53 "oss://0" -souncard 0 using oss api
54 "alsa://0" -soundcard 0 using alsa api.
55 In order to work, the call member must be part of a BasicCall, as well as
56 the flow must be part of the BasicCall too (using basic_call_add_flow())
57 This function may (on the backend) create a MediaEndpoint object that stores
58 the rx_endpoint and tx_endpoint parameter. This object is added to:
59 -the list of MediaEndpoint maintained by the member (list per member)
60 -the list of MediaEndpoint maintained by the flow (list per flow)
63 **************************************************************************
65 This object handles simple calls (two party calls). It defines inside itself
66 two CallMember objects.
68 BasicCall *basic_call_new();
70 CallMember *basic_call_get_member(BasicCall *call, gint member_number);
71 Returns a member of a BasicCall according to a number.
73 void basic_call_add_flow(BasicCall *call, MediaFlow *flow);
74 Adds a flow to the call's list of flow.
76 gint basic_call_start_flow(BasicCall *call, MediaFlow *flow);
77 This function construct the mediastreamer processing chain necessary to make
78 the call running, if not done, and runs it using ms_start()
80 gint basic_call_stop_flow(BasicCall *call, MediaFlow *flow);
82 gint basic_call_start_all_flows(BasicCall *call);
84 void basic_call_destroy(BasicCall *call);
85 Destroy all data used by the call: call members, call flows.
87 **************************************************************************
88 object: ConferenceCall
89 This object handles conference call (which are quite much complicated than basic
90 calls). But this object should have the same method as the BasicCall object.
92 *******************************************************************
94 *******************************************************************
96 Two party call between call member A on machine "linphone.org" and call member B on machine "home.com".
97 The media_api is running on "home.com".
99 A (on linphone.org) B (on home.com)
101 ------>(send to rtp://home.com:7080 MSRTPReceiver------>Decode----->(send to oss:/0)
103 ------<(recv on rtp://linphone.org:7020 MSRTPSender<--------Encode<-----(read on oss://0)
105 This is how to setup this call using the media_api:
107 CallMember *memberA,*memberB;
110 /* create a basic call*/
111 call=basic_call_new();
112 /* get a pointer to the pre-define members of the call */
113 memberA=basic_call_get_member(call,0);
114 memberB=basic_call_get_member(call,1);
116 /* create a media flow */
117 flow=media_flow_new("voice",FLOW_AUDIO,1);
118 /* tell that the flow is used by the call */
119 basic_call_add_flow(call,flow);
120 /* tell how each member uses the flow (how is the interface ?)*/
121 call_member_setup_flow(memberA,flow,"rtp://linphone.org:7020","rtp://home.com:7080");
122 /* note: it is not efficient to do name resolution at this stage: that's why in reality numeric ip address
123 should be given instead of host name */
124 call_member_setup_flow(memberB,flow,"oss://0","oss://0");
127 basic_call_start_flow(call,flow);
129 In case where the media api is running on another host called "toto" (in a media translator application for example),
130 the only thing that would change is the url given to memberB: tx="rtp://home.com:8820" for example and
131 rx="rtp://toto:9522".
133 In the sipomatic application (the test application I use to test linphone (it answers to call and plays
134 a short annoucement)), I would write rx="file://path_to_annoucement.raw" and tx="file://dev/null" instead of