Commit 7c55c0b6 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Moved CAN_SEND/CAN_RECV flags to oRTP + added find method using flag

parent 7fb94bc4
......@@ -47,6 +47,9 @@ extern "C"{
#define PAYLOAD_TYPE_USER_FLAG_4 (1<<8)
/* ask for more if you need*/
#define PAYLOAD_TYPE_FLAG_CAN_RECV PAYLOAD_TYPE_USER_FLAG_1
#define PAYLOAD_TYPE_FLAG_CAN_SEND PAYLOAD_TYPE_USER_FLAG_2
#define PAYLOAD_AUDIO_CONTINUOUS 0
#define PAYLOAD_AUDIO_PACKETIZED 1
#define PAYLOAD_VIDEO 2
......
......@@ -81,7 +81,8 @@ ORTP_PUBLIC void rtp_profile_clear_all(RtpProfile *prof);
ORTP_PUBLIC void rtp_profile_set_name(RtpProfile *prof, const char *name);
ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_mime(RtpProfile *profile,const char *mime);
ORTP_PUBLIC PayloadType * rtp_profile_get_payload_from_rtpmap(RtpProfile *profile, const char *rtpmap);
ORTP_PUBLIC int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime);
ORTP_PUBLIC int rtp_profile_get_payload_number_from_mime(RtpProfile *profile, const char *mime);
ORTP_PUBLIC int rtp_profile_get_payload_number_from_mime_and_flag(RtpProfile *profile, const char *mime, int flag);
ORTP_PUBLIC int rtp_profile_get_payload_number_from_rtpmap(RtpProfile *profile, const char *rtpmap);
ORTP_PUBLIC int rtp_profile_find_payload_number(RtpProfile *prof,const char *mime,int rate, int channels);
ORTP_PUBLIC PayloadType * rtp_profile_find_payload(RtpProfile *prof,const char *mime,int rate, int channels);
......
......@@ -20,17 +20,22 @@
#include "ortp/ortp.h"
int rtp_profile_get_payload_number_from_mime(RtpProfile *profile,const char *mime)
int rtp_profile_get_payload_number_from_mime(RtpProfile *profile, const char *mime)
{
return rtp_profile_get_payload_number_from_mime_and_flag(profile, mime, -1);
}
int rtp_profile_get_payload_number_from_mime_and_flag(RtpProfile *profile, const char *mime, int flag)
{
PayloadType *pt;
int i;
for (i=0;i<RTP_PROFILE_MAX_PAYLOADS;i++)
{
pt=rtp_profile_get_payload(profile,i);
if (pt!=NULL)
{
if (strcasecmp(pt->mime_type,mime)==0){
return i;
for (i = 0; i < RTP_PROFILE_MAX_PAYLOADS; i++) {
pt = rtp_profile_get_payload(profile, i);
if (pt != NULL) {
if (strcasecmp(pt->mime_type, mime) == 0) {
if (flag < 0 || pt->flags & flag) {
return i;
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment