Getting started with ortp Library

Source: Internet
Author: User
Tags linphone
I. Introduction

Ortp is a database that supports RTP and rfc3550 protocols. It has the following features:
(1) It can be written in C language and can work on Windows, Linux, and UNIX platforms.
(2) implements the rfc3550 protocol and provides easy-to-use APIs. Multiple configurations are supported. rfc3551 is the default configuration.
(3) supports multiple RTP sessions in a single thread and adaptive jitter processing.
(4) based on the GPL copyright statement.

Ortp can be downloaded on its official website (http://www.linphone.org/index.php/eng/code_review/ortp), download and unzip to get ortp source code package and example Program (tests ). The help documentation is in the docs directory, and can also be found at http://developer.veriportal.com/savannah/linphone/ortp/docs/on-line.

There is not much information about ortp, mainly the source code, help documentation and sample programs. The sample programs are described as follows:
Rtprecv. C and rtpsend. c demonstrate how to receive and send single RTP data streams.
Mrtprecv. c mrtpsend. C shows how to receive and send multiple RTP data streams at the same time.

II. Introduction to main functions

Ortp_init
[Prototype]: void ortp_init (void)
[Function]: Initialize the ortp library. You must call this function before using the ortp API.

Ortp_exit
[Prototype]: void ortp_exit (void)
[Function]: ends the use of ortp.

Rtp_session_new
[Prototype]: rtpsession * rtp_session_new (INT Mode)
[Function]: rtpsession is the structure object of the RTP session. This function creates a new RTP session object.
[Parameter]: Mode: rtp_session_sendonly (send only), rtp_session_recvonly (receive only), rtp_session_sendrecv (send and receive both), etc.
Return Value: pointer to the newly created RTP session object.

Rtp_session_set_remote_addr
[Prototype]: int rtp_session_set_remote_addr (rtpsession * Session, const char * ADDR, int port)
[Function]: Set the IP address of the remote RTP data receiver.
[Parameters ]:
Session: The created RTP session object.
ADDR: IP address of the destination address
Port: the RTP Port Number of the destination address.
[Return value]: 0 indicates success.

Rtp_session_set_local_addr
[Prototype]: int rtp_session_set_local_addr (rtpsession * Session, const char * ADDR, int port)
[Function]: Set the local listening address. If the RTP session is set to send only mode, you do not need to call this function. If this function is not called, the local IP address is set to 0.0.0.0 in system mode, and a listening port is randomly allocated.
[Parameters ]:
Session: The created RTP session object.
ADDR: IP address of the local listener
Port: the port number of the local listener. If-1 is selected, the system randomly assigns a port number.

Rtp_session_set_send_payload_type
[Prototype]: int rtp_session_set_send_payload_type (rtpsession * Session, int paytype)
[Function]: Set the load type of the RTP session. The load type is used to tell the player which type of media is transmitted (such as H.264, MPEG-4, etc., the player only knows the format, will call the appropriate codecs to play.
[Parameters ]:
Session: The created RTP session object.
Paytype: load type (integer)
[Return value]: 0 indicates success, and-1 indicates that the load type is not defined.

Rtp_session_get_recv_payload_type
[Prototype]: int rtp_session_get_recv_payload_type (const rtpsession * session)
[Function]: gets the media type of the current RTP data stream.
[Return value]: media type (integer)

Rtp_session_send_with_ts
[Prototype]: int rtp_session_send_with_ts (rtpsession * Session, const char * buffer, int Len, uint32_t userts)
[Function]: Send RTP data packets to the destination address.
[Parameters ]:
Session: The created RTP session object.
Buffer: buffer that contains the data to be sent
Len: the length of the data to be sent.
Userts: The timestamp of the sent data. For details, refer to RFC.
[Return value]: number of successfully sent bytes

Rtp_session_recv_with_ts
[Prototype]: int rtp_session_recv_with_ts (rtpsession * Session, uint8_t * buffer, int Len, uint32_t ts, int * have_more)
[Function]: receives/reads RTP data packets from the sender.
[Parameters ]:
Session: The created RTP session object.
Buffer: buffer for storing received RTP data packets
Len: the length of the received data
TS: The specified data packet timestamp. We recommend that you start from 0 when calling this function for the first time.
Have_more: When the buffer size in the parameter is insufficient, this flag sets 1 to prompt the caller to obtain the remaining data with the same timestamp again.

Rtp_session_destroy
[Prototype]: void rtp_session_destroy (rtpsession * session)
[Function]: destroys RTP session objects and releases resources.
[Parameter]: RTP Session object created by the session

Getting started with ortp Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.