streamMedia_interface.h File Reference

#include "legato.h"
#include "le_audio_interface.h"

Go to the source code of this file.

Macros

#define STREAMMEDIA_MAX_IP_LENGTH   15
 
#define STREAMMEDIA_MAX_BYE_REASON_LENGTH   255
 
#define STREAMMEDIA_MAX_SDES_FIELD_LENGTH   255
 
#define STREAMMEDIA_DEFAULT_RTP_PORT   4000
 

Typedefs

typedef void(* streamMedia_DisconnectHandler_t) (void *)
 
typedef struct streamMedia_RtcpHandler * streamMedia_RtcpHandlerRef_t
 
typedef void(* streamMedia_RtcpHandlerFunc_t) (le_audio_StreamRef_t streamRef, streamMedia_RtcpEvent_t event, void *contextPtr)
 

Enumerations

enum  streamMedia_RtcpEvent_t {
  STREAMMEDIA_RTCP_SDES = 0, STREAMMEDIA_RTCP_BYE = 1, STREAMMEDIA_RTCP_SR = 2, STREAMMEDIA_RTCP_RR = 3,
  STREAMMEDIA_RTCP_APP = 4
}
 

Functions

void streamMedia_ConnectService (void)
 
le_result_t streamMedia_TryConnectService (void)
 
void streamMedia_SetServerDisconnectHandler (streamMedia_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void streamMedia_DisconnectService (void)
 
le_audio_StreamRef_t streamMedia_OpenAudioRtpRx (int32_t localPort)
 
le_audio_StreamRef_t streamMedia_OpenAudioRtpTx (int32_t localPort, const char *LE_NONNULL remoteIpAddress, int32_t remotePort)
 
le_result_t streamMedia_Start (le_audio_StreamRef_t streamRef)
 
le_result_t streamMedia_Stop (le_audio_StreamRef_t streamRef)
 
le_result_t streamMedia_SendRtcpSdes (le_audio_StreamRef_t streamRef, const char *LE_NONNULL cname, const char *LE_NONNULL name, const char *LE_NONNULL email, const char *LE_NONNULL phone, const char *LE_NONNULL loc, const char *LE_NONNULL tool, const char *LE_NONNULL note)
 
le_result_t streamMedia_SendRtcpBye (le_audio_StreamRef_t streamRef, const char *LE_NONNULL reason)
 
void streamMedia_Close (le_audio_StreamRef_t streamRef)
 
streamMedia_RtcpHandlerRef_t streamMedia_AddRtcpHandler (le_audio_StreamRef_t streamRef, streamMedia_RtcpHandlerFunc_t handlerPtr, void *contextPtr)
 
void streamMedia_RemoveRtcpHandler (streamMedia_RtcpHandlerRef_t handlerRef)
 

Detailed Description

Legato Stream Media include file.

Macro Definition Documentation

◆ STREAMMEDIA_DEFAULT_RTP_PORT

#define STREAMMEDIA_DEFAULT_RTP_PORT   4000

The default RTP port.

◆ STREAMMEDIA_MAX_BYE_REASON_LENGTH

#define STREAMMEDIA_MAX_BYE_REASON_LENGTH   255

The maximum length of the optional RTCP BYE packet reason string length.

◆ STREAMMEDIA_MAX_IP_LENGTH

#define STREAMMEDIA_MAX_IP_LENGTH   15

The maximum length of the textual representation of an IP address.

◆ STREAMMEDIA_MAX_SDES_FIELD_LENGTH

#define STREAMMEDIA_MAX_SDES_FIELD_LENGTH   255

The maximum length of a RTCP SDES packet field string length.

Typedef Documentation

◆ streamMedia_DisconnectHandler_t

typedef void(* streamMedia_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

◆ streamMedia_RtcpHandlerFunc_t

typedef void(* streamMedia_RtcpHandlerFunc_t) (le_audio_StreamRef_t streamRef, streamMedia_RtcpEvent_t event, void *contextPtr)

Handler for RTCP packet reception.

◆ streamMedia_RtcpHandlerRef_t

typedef struct streamMedia_RtcpHandler* streamMedia_RtcpHandlerRef_t

Reference type used by Add/Remove functions for EVENT 'streamMedia_Rtcp'

Enumeration Type Documentation

◆ streamMedia_RtcpEvent_t

RTCP packet reception events, related to the RTCP packet type. See RFC-3550 for more details.

Enumerator
STREAMMEDIA_RTCP_SDES 

RTCP Session Description packet has been received.

STREAMMEDIA_RTCP_BYE 

RTCP BYE packet has been received.

STREAMMEDIA_RTCP_SR 

RTCP Sender Report packet has been received.

STREAMMEDIA_RTCP_RR 

RTCP Receiver Report packet has been received.

STREAMMEDIA_RTCP_APP 

RTCP Application-specific packet has been received.

Function Documentation

◆ streamMedia_AddRtcpHandler()

streamMedia_RtcpHandlerRef_t streamMedia_AddRtcpHandler ( le_audio_StreamRef_t  streamRef,
streamMedia_RtcpHandlerFunc_t  handlerPtr,
void *  contextPtr 
)

Add handler function for EVENT 'streamMedia_Rtcp'

This event provides information on RTCP packet type.

Parameters
[in]streamRefAudio stream reference.
[in]handlerPtr
[in]contextPtr

◆ streamMedia_Close()

void streamMedia_Close ( le_audio_StreamRef_t  streamRef)

Close an RTP stream.

Parameters
[in]streamRefAudio stream reference.

◆ streamMedia_ConnectService()

void streamMedia_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

◆ streamMedia_DisconnectService()

void streamMedia_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.

This function is created automatically.

◆ streamMedia_OpenAudioRtpRx()

le_audio_StreamRef_t streamMedia_OpenAudioRtpRx ( int32_t  localPort)

Open the received audio stream of the RTP interface.

Returns
Reference to the input audio stream, NULL if the function fails.
Parameters
[in]localPortThe local UDP socket port for the RTP session.

◆ streamMedia_OpenAudioRtpTx()

le_audio_StreamRef_t streamMedia_OpenAudioRtpTx ( int32_t  localPort,
const char *LE_NONNULL  remoteIpAddress,
int32_t  remotePort 
)

Open the transmitted audio stream of the RTP interface.

Returns
Reference to the output audio stream, NULL if the function fails.
Parameters
[in]localPortThe local UDP socket port for the RTP session.
[in]remoteIpAddressThe IP address of the remote peer.
[in]remotePortThe port of the remote peer.

◆ streamMedia_RemoveRtcpHandler()

void streamMedia_RemoveRtcpHandler ( streamMedia_RtcpHandlerRef_t  handlerRef)

Remove handler function for EVENT 'streamMedia_Rtcp'

Parameters
[in]handlerRef

◆ streamMedia_SendRtcpBye()

le_result_t streamMedia_SendRtcpBye ( le_audio_StreamRef_t  streamRef,
const char *LE_NONNULL  reason 
)

Send a RTCP BYE packet using pjmedia_rtcp_build_rtcp_bye().

Returns
LE_FAULT Function failed.
LE_OK Function succeeded.
Parameters
[in]streamRefAudio stream reference.
[in]reasonThe optional BYE reason.

◆ streamMedia_SendRtcpSdes()

le_result_t streamMedia_SendRtcpSdes ( le_audio_StreamRef_t  streamRef,
const char *LE_NONNULL  cname,
const char *LE_NONNULL  name,
const char *LE_NONNULL  email,
const char *LE_NONNULL  phone,
const char *LE_NONNULL  loc,
const char *LE_NONNULL  tool,
const char *LE_NONNULL  note 
)

Send a RTCP Session Description packet (SDES) using pjmedia_rtcp_build_rtcp_sdes().

Returns
LE_FAULT Function failed.
LE_OK Function succeeded.
Parameters
[in]streamRefAudio stream reference.
[in]cnameThe optional source canonical name.
[in]nameThe optional source name.
[in]emailThe optional source email.
[in]phoneThe optional source phone.
[in]locThe optional source location.
[in]toolThe optional source tool.
[in]noteThe optional source note.

◆ streamMedia_SetServerDisconnectHandler()

void streamMedia_SetServerDisconnectHandler ( streamMedia_DisconnectHandler_t  disconnectHandler,
void *  contextPtr 
)

Set handler called when server disconnection is detected.

When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.

◆ streamMedia_Start()

le_result_t streamMedia_Start ( le_audio_StreamRef_t  streamRef)

Start the RTP stream. This must be called after connecting the RTP interface to start RTP reception or transmission.

Returns
LE_FAULT Function failed.
LE_OK Function succeeded.
Parameters
[in]streamRefAudio stream reference.

◆ streamMedia_Stop()

le_result_t streamMedia_Stop ( le_audio_StreamRef_t  streamRef)

Stop the RTP stream.

Returns
LE_FAULT Function failed.
LE_OK Function succeeded.
Parameters
[in]streamRefAudio stream reference.

◆ streamMedia_TryConnectService()

le_result_t streamMedia_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.