Add new QoS implementation

Code formatting
This commit is contained in:
Mamadou DIOP 2016-02-23 22:00:35 +01:00
parent 94b2219209
commit 50dfb43596
2065 changed files with 250781 additions and 246848 deletions

17
.gitignore vendored
View File

@ -2,3 +2,20 @@ Debug
*.user
*.suo
*.ncb
/bindings/csharp/Release
/tinyDAV/Release
/tinySIGCOMP/Release
/tinyBFCP/Release
/tinyMSRP/Release
/tinyHTTP/Release
/tinyMEDIA/Release
/tinyNET/Release
/tinySAK/Release
/plugins/pluginWinMF/Release
/tinySIP/Release
/tinySMS/Release
/tinyIPSec/Release
/tinySDP/Release
/tinyRTP/Release
/tinyXCAP/Release
*.orig

1
AStyle.sh Normal file
View File

@ -0,0 +1 @@
./thirdparties/win32/tools/AStyle.exe --style=k/r --lineend=linux --mode=c --add-brackets --break-closing-brackets --recursive "*.c" "*.cxx" "*.h" "*.cc"

View File

@ -30,11 +30,10 @@ IPSecCtx::IPSecCtx(tipsec_ipproto_t ipproto,
tipsec_ealg_t ealg,
tipsec_alg_t alg,
tipsec_proto_t protocol)
: m_pCtx(NULL)
: m_pCtx(NULL)
{
tipsec_ctx_t* pCtx = NULL;
if (!IPSecCtx::sInitialized)
{
if (!IPSecCtx::sInitialized) {
assert (tipsec_plugin_register_static(plugin_win_ipsec_vista_plugin_def_t) == 0);
IPSecCtx::sInitialized = true;
}

View File

@ -14,23 +14,42 @@
#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
template<typename T> class SwigValueWrapper
{
struct SwigMovePointer {
T *ptr;
SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointer() { delete ptr; }
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
~SwigMovePointer() {
delete ptr;
}
SwigMovePointer& operator=(SwigMovePointer& rhs) {
T* oldptr = ptr;
ptr = 0;
delete oldptr;
ptr = rhs.ptr;
rhs.ptr = 0;
return *this;
}
} pointer;
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
SwigValueWrapper() : pointer(0) { }
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
operator T&() const { return *pointer.ptr; }
T *operator&() { return pointer.ptr; }
SwigValueWrapper& operator=(const T& t) {
SwigMovePointer tmp(new T(t));
pointer = tmp;
return *this;
}
operator T&() const {
return *pointer.ptr;
}
T *operator&() {
return pointer.ptr;
}
};
template <typename T> T SwigValueInit() {
template <typename T> T SwigValueInit()
{
return T();
}
#endif
@ -205,7 +224,8 @@ static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
{ SWIG_CSharpArgumentOutOfRangeException, NULL }
};
static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg)
{
SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
callback = SWIG_csharp_exceptions[code].callback;
@ -213,7 +233,8 @@ static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes
callback(msg);
}
static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name)
{
SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
callback = SWIG_csharp_exceptions_argument[code].callback;
@ -236,18 +257,19 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_ipsec_lib(
SWIG_CSharpExceptionCallback_t nullReferenceCallback,
SWIG_CSharpExceptionCallback_t outOfMemoryCallback,
SWIG_CSharpExceptionCallback_t overflowCallback,
SWIG_CSharpExceptionCallback_t systemCallback) {
SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
SWIG_CSharpExceptionCallback_t systemCallback)
{
SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
}
#ifdef __cplusplus
@ -256,10 +278,11 @@ extern "C"
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_ipsec_lib(
SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback)
{
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
}
@ -271,8 +294,9 @@ static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStringHelperCallback callback) {
SWIG_csharp_string_callback = callback;
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStringHelperCallback callback)
{
SWIG_csharp_string_callback = callback;
}
@ -294,17 +318,20 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ipsec_lib(SWIG_CSharpStri
#endif
#include <string>
namespace Swig {
/* Director base class - not currently used in C# directors */
class Director {
};
namespace Swig
{
/* Director base class - not currently used in C# directors */
class Director
{
};
/* Base class for director exceptions */
class DirectorException {
protected:
/* Base class for director exceptions */
class DirectorException
{
protected:
std::string swig_msg;
public:
public:
DirectorException(const char* msg) : swig_msg(msg) {
}
DirectorException(const std::string &msg) : swig_msg(msg) {
@ -314,14 +341,15 @@ namespace Swig {
}
virtual ~DirectorException() {
}
};
};
/* Pure virtual method exception */
class DirectorPureVirtualException : public Swig::DirectorException {
public:
/* Pure virtual method exception */
class DirectorPureVirtualException : public Swig::DirectorException
{
public:
DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
}
};
};
}
#endif /* __cplusplus */
@ -346,7 +374,8 @@ namespace Swig {
extern "C" {
#endif
SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2, int jarg3, int jarg4, int jarg5, int jarg6) {
SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2, int jarg3, int jarg4, int jarg5, int jarg6)
{
void * jresult ;
tipsec_ipproto_t arg1 ;
bool arg2 ;
@ -368,7 +397,8 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_new_IPSecCtx(int jarg1, unsigned int jarg2,
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1) {
SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1)
{
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
arg1 = (IPSecCtx *)jarg1;
@ -376,7 +406,8 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_IPSecCtx(void * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1) {
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1)
{
int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_error_t result;
@ -388,7 +419,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_start(void * jarg1) {
}
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2, char * jarg3, unsigned short jarg4, unsigned short jarg5) {
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2, char * jarg3, unsigned short jarg4, unsigned short jarg5)
{
int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
char *arg2 = (char *) 0 ;
@ -408,7 +440,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setLocal(void * jarg1, char * jarg2,
}
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, void * jarg3) {
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, void * jarg3)
{
int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_key_t *arg2 = (tipsec_key_t *) 0 ;
@ -424,7 +457,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setKeys(void * jarg1, void * jarg2, v
}
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int jarg2, unsigned int jarg3, unsigned short jarg4, unsigned short jarg5, unsigned long long jarg6) {
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int jarg2, unsigned int jarg3, unsigned short jarg4, unsigned short jarg5, unsigned long long jarg6)
{
int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_spi_t arg2 ;
@ -446,7 +480,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_setRemote(void * jarg1, unsigned int
}
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1) {
SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1)
{
int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_error_t result;
@ -458,7 +493,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_IPSecCtx_stop(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1) {
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1)
{
unsigned int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_spi_t result;
@ -470,7 +506,8 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUC(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1) {
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1)
{
unsigned int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_spi_t result;
@ -482,7 +519,8 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiUS(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1) {
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1)
{
unsigned int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_spi_t result;
@ -494,7 +532,8 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPC(void * jarg1) {
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPS(void * jarg1) {
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_IPSecCtx_getSpiPS(void * jarg1)
{
unsigned int jresult ;
IPSecCtx *arg1 = (IPSecCtx *) 0 ;
tipsec_spi_t result;

View File

@ -3,16 +3,14 @@
#include <stdint.h>
typedef enum CpuFamily_e
{
typedef enum CpuFamily_e {
UNKNOWN = 0,
ARM,
X86
}
CpuFamily_t;
typedef enum CpuFeatures_e
{
typedef enum CpuFeatures_e {
ARMv7 = 1,
VFPv3 = 2,
NEON = 4
@ -22,8 +20,8 @@ CpuFeatures_t;
class AndroidUtils
{
public:
AndroidUtils(){};
virtual ~AndroidUtils(){};
AndroidUtils() {};
virtual ~AndroidUtils() {};
static uint64_t getCpuFamily();
static uint64_t getCpuFeatures();

View File

@ -110,12 +110,14 @@ read_file(const char* pathname, char* buffer, size_t buffsize)
int fd, len;
fd = open(pathname, O_RDONLY);
if (fd < 0)
if (fd < 0) {
return -1;
}
do {
len = read(fd, buffer, buffsize);
} while (len < 0 && errno == EINTR);
}
while (len < 0 && errno == EINTR);
close(fd);
@ -143,11 +145,13 @@ extract_cpuinfo_field(char* buffer, int buflen, const char* field)
bufend = buffer + buflen;
for (;;) {
p = memmem(p, bufend-p, field, fieldlen);
if (p == NULL)
if (p == NULL) {
goto EXIT;
}
if (p == buffer || p[-1] == '\n')
if (p == buffer || p[-1] == '\n') {
break;
}
p += fieldlen;
}
@ -155,20 +159,23 @@ extract_cpuinfo_field(char* buffer, int buflen, const char* field)
/* Skip to the first column followed by a space */
p += fieldlen;
p = memchr(p, ':', bufend-p);
if (p == NULL || p[1] != ' ')
if (p == NULL || p[1] != ' ') {
goto EXIT;
}
/* Find the end of the line */
p += 2;
q = memchr(p, '\n', bufend-p);
if (q == NULL)
if (q == NULL) {
q = bufend;
}
/* Copy the line into a heap-allocated buffer */
len = q-p;
result = malloc(len+1);
if (result == NULL)
if (result == NULL) {
goto EXIT;
}
memcpy(result, p, len);
result[len] = '\0';
@ -190,23 +197,27 @@ has_list_item(const char* list, const char* item)
const char* p = list;
int itemlen = strlen(item);
if (list == NULL)
if (list == NULL) {
return 0;
}
while (*p) {
const char* q;
/* skip spaces */
while (*p == ' ' || *p == '\t')
while (*p == ' ' || *p == '\t') {
p++;
}
/* find end of current list item */
q = p;
while (*q && *q != ' ' && *q != '\t')
while (*q && *q != ' ' && *q != '\t') {
q++;
}
if (itemlen == q-p && !memcmp(p, item, itemlen))
if (itemlen == q-p && !memcmp(p, item, itemlen)) {
return 1;
}
/* skip to next item */
p = q;
@ -231,13 +242,15 @@ parse_decimal(const char* input, const char* limit, int* result)
int val = 0;
while (p < limit) {
int d = (*p - '0');
if ((unsigned)d >= 10U)
if ((unsigned)d >= 10U) {
break;
}
val = val*10 + d;
p++;
}
if (p == input)
if (p == input) {
return NULL;
}
*result = val;
return p;
@ -254,24 +267,28 @@ typedef struct {
} CpuList;
static __inline__ void
cpulist_init(CpuList* list) {
cpulist_init(CpuList* list)
{
list->mask = 0;
}
static __inline__ void
cpulist_and(CpuList* list1, CpuList* list2) {
cpulist_and(CpuList* list1, CpuList* list2)
{
list1->mask &= list2->mask;
}
static __inline__ void
cpulist_set(CpuList* list, int index) {
cpulist_set(CpuList* list, int index)
{
if ((unsigned)index < 32) {
list->mask |= (uint32_t)(1U << index);
}
}
static __inline__ int
cpulist_count(CpuList* list) {
cpulist_count(CpuList* list)
{
return __builtin_popcount(list->mask);
}
@ -295,8 +312,7 @@ cpulist_parse(CpuList* list, const char* line, int line_len)
/* NOTE: the input line coming from sysfs typically contains a
* trailing newline, so take care of it in the code below
*/
while (p < end && *p != '\n')
{
while (p < end && *p != '\n') {
int val, start_value, end_value;
/* Find the end of current item, and put it into 'q' */
@ -307,8 +323,9 @@ cpulist_parse(CpuList* list, const char* line, int line_len)
/* Get first value */
p = parse_decimal(p, q, &start_value);
if (p == NULL)
if (p == NULL) {
goto BAD_FORMAT;
}
end_value = start_value;
@ -317,9 +334,10 @@ cpulist_parse(CpuList* list, const char* line, int line_len)
*/
if (p < q && *p == '-') {
p = parse_decimal(p+1, q, &end_value);
if (p == NULL)
if (p == NULL) {
goto BAD_FORMAT;
}
}
/* Set bits CPU list bits */
for (val = start_value; val <= end_value; val++) {
@ -328,9 +346,10 @@ cpulist_parse(CpuList* list, const char* line, int line_len)
/* Jump to next item */
p = q;
if (p < end)
if (p < end) {
p++;
}
}
BAD_FORMAT:
;
@ -391,7 +410,7 @@ android_cpuInit(void)
D("cpuinfo_len is (%d):\n%.*s\n", cpuinfo_len,
cpuinfo_len >= 0 ? cpuinfo_len : 0, cpuinfo);
if (cpuinfo_len < 0) /* should not happen */ {
if (cpuinfo_len < 0) { /* should not happen */
return;
}
@ -478,11 +497,13 @@ android_cpuInit(void)
D("found cpuFeatures = '%s'\n", cpuFeatures);
if (has_list_item(cpuFeatures, "vfpv3"))
if (has_list_item(cpuFeatures, "vfpv3")) {
g_cpuFeatures |= ANDROID_CPU_ARM_FEATURE_VFPv3;
}
else if (has_list_item(cpuFeatures, "vfpv3d16"))
else if (has_list_item(cpuFeatures, "vfpv3d16")) {
g_cpuFeatures |= ANDROID_CPU_ARM_FEATURE_VFPv3;
}
if (has_list_item(cpuFeatures, "neon")) {
/* Note: Certain kernels only report neon but not vfpv3
@ -503,7 +524,7 @@ android_cpuInit(void)
int regs[4];
/* According to http://en.wikipedia.org/wiki/CPUID */
/* According to http://en.wikipedia.org/wiki/CPUID */
#define VENDOR_INTEL_b 0x756e6547
#define VENDOR_INTEL_c 0x6c65746e
#define VENDOR_INTEL_d 0x49656e69

View File

@ -14,23 +14,42 @@
#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template<typename T> class SwigValueWrapper {
template<typename T> class SwigValueWrapper
{
struct SwigMovePointer {
T *ptr;
SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointer() { delete ptr; }
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
~SwigMovePointer() {
delete ptr;
}
SwigMovePointer& operator=(SwigMovePointer& rhs) {
T* oldptr = ptr;
ptr = 0;
delete oldptr;
ptr = rhs.ptr;
rhs.ptr = 0;
return *this;
}
} pointer;
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
SwigValueWrapper(const SwigValueWrapper<T>& rhs);
public:
SwigValueWrapper() : pointer(0) { }
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
operator T&() const { return *pointer.ptr; }
T *operator&() { return pointer.ptr; }
SwigValueWrapper& operator=(const T& t) {
SwigMovePointer tmp(new T(t));
pointer = tmp;
return *this;
}
operator T&() const {
return *pointer.ptr;
}
T *operator&() {
return pointer.ptr;
}
};
template <typename T> T SwigValueInit() {
template <typename T> T SwigValueInit()
{
return T();
}
#endif
@ -147,7 +166,7 @@ template <typename T> T SwigValueInit() {
/* Fix for jlong on some versions of gcc on Windows */
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
typedef long long __int64;
typedef long long __int64;
#endif
/* Fix for jlong on 64-bit x86 Solaris */
@ -181,7 +200,8 @@ typedef struct {
} SWIG_JavaExceptions_t;
static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg)
{
jclass excep;
static const SWIG_JavaExceptions_t java_exceptions[] = {
{ SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
@ -197,13 +217,15 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
};
const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
while (except_ptr->code != code && except_ptr->code)
while (except_ptr->code != code && except_ptr->code) {
except_ptr++;
}
jenv->ExceptionClear();
excep = jenv->FindClass(except_ptr->java_exception);
if (excep)
if (excep) {
jenv->ThrowNew(excep, msg);
}
}
@ -224,10 +246,12 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
#include <iostream>
#endif
namespace Swig {
/* Java object wrapper */
class JObjectWrapper {
public:
namespace Swig
{
/* Java object wrapper */
class JObjectWrapper
{
public:
JObjectWrapper() : jthis_(NULL), weak_global_(true) {
}
@ -239,13 +263,15 @@ namespace Swig {
bool set(JNIEnv *jenv, jobject jobj, bool mem_own, bool weak_global) {
if (!jthis_) {
weak_global_ = weak_global;
if (jobj)
if (jobj) {
jthis_ = ((weak_global_ || !mem_own) ? jenv->NewWeakGlobalRef(jobj) : jenv->NewGlobalRef(jobj));
}
#if defined(DEBUG_DIRECTOR_OWNED)
std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> " << jthis_ << std::endl;
#endif
return true;
} else {
}
else {
#if defined(DEBUG_DIRECTOR_OWNED)
std::cout << "JObjectWrapper::set(" << jobj << ", " << (weak_global ? "weak_global" : "global_ref") << ") -> already set" << std::endl;
#endif
@ -256,10 +282,12 @@ namespace Swig {
jobject get(JNIEnv *jenv) const {
#if defined(DEBUG_DIRECTOR_OWNED)
std::cout << "JObjectWrapper::get(";
if (jthis_)
if (jthis_) {
std::cout << jthis_;
else
}
else {
std::cout << "null";
}
std::cout << ") -> return new local ref" << std::endl;
#endif
return (jthis_ ? jenv->NewLocalRef(jthis_) : jthis_);
@ -271,11 +299,14 @@ namespace Swig {
#endif
if (jthis_) {
if (weak_global_) {
if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE)
if (jenv->IsSameObject(jthis_, NULL) == JNI_FALSE) {
jenv->DeleteWeakGlobalRef((jweak)jthis_);
} else
}
}
else {
jenv->DeleteGlobalRef(jthis_);
}
}
jthis_ = NULL;
weak_global_ = true;
@ -295,7 +326,8 @@ namespace Swig {
jthis_ = jenv->NewWeakGlobalRef(jself);
weak_global_ = true;
}
} else { /* Java releases ownership of C++ object's lifetime */
}
else { /* Java releases ownership of C++ object's lifetime */
if (weak_global_) {
jenv->DeleteWeakGlobalRef((jweak)jthis_);
jthis_ = jenv->NewGlobalRef(jself);
@ -304,25 +336,27 @@ namespace Swig {
}
}
private:
private:
/* pointer to Java object */
jobject jthis_;
/* Local or global reference flag */
bool weak_global_;
};
};
/* director base class */
class Director {
/* director base class */
class Director
{
/* pointer to Java virtual machine */
JavaVM *swig_jvm_;
protected:
protected:
#if defined (_MSC_VER) && (_MSC_VER<1300)
class JNIEnvWrapper;
friend class JNIEnvWrapper;
#endif
/* Utility class for managing the JNI environment */
class JNIEnvWrapper {
class JNIEnvWrapper
{
const Director *director_;
JNIEnv *jenv_;
public:
@ -369,7 +403,7 @@ namespace Swig {
}
}
public:
public:
Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() {
/* Acquire the Java VM pointer */
jenv->GetJavaVM(&swig_jvm_);
@ -393,7 +427,7 @@ namespace Swig {
void swig_java_change_ownership(JNIEnv *jenv, jobject jself, bool take_or_release) {
swig_self_.java_change_ownership(jenv, jself, take_or_release);
}
};
};
}
#endif /* __cplusplus */
@ -418,7 +452,8 @@ namespace Swig {
extern "C" {
#endif
SWIGEXPORT jlong JNICALL Java_org_doubango_utils_utilsJNI_new_1AndroidUtils(JNIEnv *jenv, jclass jcls) {
SWIGEXPORT jlong JNICALL Java_org_doubango_utils_utilsJNI_new_1AndroidUtils(JNIEnv *jenv, jclass jcls)
{
jlong jresult = 0 ;
AndroidUtils *result = 0 ;
@ -430,7 +465,8 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_utils_utilsJNI_new_1AndroidUtils(JNIE
}
SWIGEXPORT void JNICALL Java_org_doubango_utils_utilsJNI_delete_1AndroidUtils(JNIEnv *jenv, jclass jcls, jlong jarg1) {
SWIGEXPORT void JNICALL Java_org_doubango_utils_utilsJNI_delete_1AndroidUtils(JNIEnv *jenv, jclass jcls, jlong jarg1)
{
AndroidUtils *arg1 = (AndroidUtils *) 0 ;
(void)jenv;
@ -440,7 +476,8 @@ SWIGEXPORT void JNICALL Java_org_doubango_utils_utilsJNI_delete_1AndroidUtils(JN
}
SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFamily(JNIEnv *jenv, jclass jcls) {
SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFamily(JNIEnv *jenv, jclass jcls)
{
jobject jresult = 0 ;
uint64_t result;
@ -468,7 +505,8 @@ SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpu
}
SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFeatures(JNIEnv *jenv, jclass jcls) {
SWIGEXPORT jobject JNICALL Java_org_doubango_utils_utilsJNI_AndroidUtils_1getCpuFeatures(JNIEnv *jenv, jclass jcls)
{
jobject jresult = 0 ;
uint64_t result;

View File

@ -42,7 +42,7 @@ private:
#if !defined(SWIG)
public:
const inline tsip_action_handle_t* getHandle()const{
const inline tsip_action_handle_t* getHandle()const {
return m_pHandle;
}
#endif

View File

@ -32,15 +32,15 @@
#include "tsk_debug.h"
AudioResampler::AudioResampler(uint32_t nInFreq, uint32_t nOutFreq, uint32_t nFrameDuration, uint32_t nChannels, uint32_t nQuality):
m_nOutFreq(nOutFreq),
m_nInFreq(nInFreq),
m_nFrameDuration(nFrameDuration),
m_nChannels(nChannels),
m_nQuality(nQuality)
m_nOutFreq(nOutFreq),
m_nInFreq(nInFreq),
m_nFrameDuration(nFrameDuration),
m_nChannels(nChannels),
m_nQuality(nQuality)
{
if ((m_pWrappedResampler = tmedia_resampler_create())) {
int ret;
if ((ret = tmedia_resampler_open(m_pWrappedResampler, nInFreq, nOutFreq, nFrameDuration, nChannels, nChannels, m_nQuality, 16))){
if ((ret = tmedia_resampler_open(m_pWrappedResampler, nInFreq, nOutFreq, nFrameDuration, nChannels, nChannels, m_nQuality, 16))) {
TSK_DEBUG_ERROR("Failed to open audio resampler (%d)", ret);
TSK_OBJECT_SAFE_FREE(m_pWrappedResampler);
}
@ -57,15 +57,15 @@ AudioResampler::~AudioResampler()
uint32_t AudioResampler::process(const void* pInData, uint32_t nInSizeInBytes, void* pOutData, uint32_t nOutSizeInBytes)
{
if(!m_pWrappedResampler){
if(!m_pWrappedResampler) {
TSK_DEBUG_ERROR("Embedded resampler is invalid");
return 0;
}
if(nInSizeInBytes < getInputRequiredSizeInShort()/2){
if(nInSizeInBytes < getInputRequiredSizeInShort()/2) {
TSK_DEBUG_ERROR("Input buffer is too short");
return 0;
}
if(nOutSizeInBytes < getOutputRequiredSizeInShort()/2){
if(nOutSizeInBytes < getOutputRequiredSizeInShort()/2) {
TSK_DEBUG_ERROR("Output buffer is too short");
return 0;
}

View File

@ -38,9 +38,15 @@ public:
~AudioResampler();
public:
inline bool isValid(){ return (m_pWrappedResampler != tsk_null); }
inline uint32_t getOutputRequiredSizeInShort(){ return (m_nOutFreq * m_nFrameDuration)/1000; }
inline uint32_t getInputRequiredSizeInShort(){ return (m_nInFreq * m_nFrameDuration)/1000; }
inline bool isValid() {
return (m_pWrappedResampler != tsk_null);
}
inline uint32_t getOutputRequiredSizeInShort() {
return (m_nOutFreq * m_nFrameDuration)/1000;
}
inline uint32_t getInputRequiredSizeInShort() {
return (m_nInFreq * m_nFrameDuration)/1000;
}
uint32_t process(const void* pInData, uint32_t nInSizeInBytes, void* pOutData, uint32_t nOutSizeInBytes);
private:

View File

@ -32,8 +32,7 @@
# define __JNIENV void
#endif
typedef enum twrap_media_type_e
{
typedef enum twrap_media_type_e {
// because of Java don't use OR
twrap_media_none = 0x00,
@ -53,13 +52,11 @@ twrap_media_type_t;
#if !defined(SWIG)
#include "tinymedia/tmedia_common.h"
struct media_type_bind_s
{
struct media_type_bind_s {
twrap_media_type_t twrap;
tmedia_type_t tnative;
};
static const struct media_type_bind_s __media_type_binds[] =
{
static const struct media_type_bind_s __media_type_binds[] = {
{ twrap_media_msrp, tmedia_msrp },
{ twrap_media_audio , tmedia_audio },
{ twrap_media_video, tmedia_video },

View File

@ -34,7 +34,7 @@
* Callbacks should not be used with Android (JNI).
*/
enum cb_type{
enum cb_type {
cb_info,
cb_warn,
cb_error,
@ -44,17 +44,17 @@ enum cb_type{
int debug_xxx_cb(const void* arg, const char* fmt, enum cb_type type, va_list *app)
{
int ret = -1;
if(!arg){
if(!arg) {
return -1;
}
const SipStack* stack = dyn_cast<const SipStack*>((const SipStack*)arg);
if(stack && stack->getDebugCallback()){
if(stack && stack->getDebugCallback()) {
char* message = tsk_null;
tsk_sprintf_2(&message, fmt, app);
switch(type){
switch(type) {
case cb_info:
ret=
#if ANDROID
@ -107,7 +107,8 @@ int DDebugCallback::debug_info_cb(const void* arg, const char* fmt, ...)
return ret;
}
int DDebugCallback::debug_warn_cb(const void* arg, const char* fmt, ...){
int DDebugCallback::debug_warn_cb(const void* arg, const char* fmt, ...)
{
va_list ap;
int ret;
@ -118,7 +119,8 @@ int DDebugCallback::debug_warn_cb(const void* arg, const char* fmt, ...){
return ret;
}
int DDebugCallback::debug_error_cb(const void* arg, const char* fmt, ...){
int DDebugCallback::debug_error_cb(const void* arg, const char* fmt, ...)
{
va_list ap;
int ret;
@ -129,7 +131,8 @@ int DDebugCallback::debug_error_cb(const void* arg, const char* fmt, ...){
return ret;
}
int DDebugCallback::debug_fatal_cb(const void* arg, const char* fmt, ...){
int DDebugCallback::debug_fatal_cb(const void* arg, const char* fmt, ...)
{
va_list ap;
int ret;

View File

@ -29,10 +29,18 @@ public:
virtual ~DDebugCallback() {}
virtual int OnDebugInfo(const char* message) { return -1; }
virtual int OnDebugWarn(const char* message) { return -1; }
virtual int OnDebugError(const char* message) { return -1; }
virtual int OnDebugFatal(const char* message) { return -1; }
virtual int OnDebugInfo(const char* message) {
return -1;
}
virtual int OnDebugWarn(const char* message) {
return -1;
}
virtual int OnDebugError(const char* message) {
return -1;
}
virtual int OnDebugFatal(const char* message) {
return -1;
}
#if !defined(SWIG)
public:

View File

@ -24,7 +24,7 @@
MediaContent::MediaContent(tmedia_content_t* pContent)
: m_pData(tsk_null)
: m_pData(tsk_null)
{
m_pContent = (tmedia_content_t*)tsk_object_ref(pContent);
}
@ -37,7 +37,7 @@ MediaContent::~MediaContent()
const char* MediaContent::getType()
{
if(m_pContent){
if(m_pContent) {
return m_pContent->type;
}
return tsk_null;
@ -45,12 +45,12 @@ const char* MediaContent::getType()
unsigned MediaContent::getDataLength()
{
if(!m_pContent){
if(!m_pContent) {
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
if(!m_pData){
if(!m_pData) {
m_pData = tmedia_content_get_data(m_pContent);
}
@ -61,16 +61,16 @@ unsigned MediaContent::getData(void* pOutput, unsigned nMaxsize)
{
unsigned nRetsize = 0;
if(!m_pContent){
if(!m_pContent) {
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
if(!m_pData){
if(!m_pData) {
m_pData = tmedia_content_get_data(m_pContent);
}
if(pOutput && nMaxsize && m_pData){
if(pOutput && nMaxsize && m_pData) {
nRetsize = (m_pData->size > nMaxsize) ? nMaxsize : m_pData->size;
memcpy(pOutput, m_pData->data, nRetsize);
}
@ -83,11 +83,11 @@ MediaContent* MediaContent::parse(const void* pData, unsigned nSize, const char*
MediaContent* pMediaContent = tsk_null;
tmedia_content_t* pContent = tmedia_content_parse(pData, (tsk_size_t)nSize, pType);
if(pContent){
if(TMEDIA_CONTENT_IS_CPIM(pContent)){
if(pContent) {
if(TMEDIA_CONTENT_IS_CPIM(pContent)) {
pMediaContent = new MediaContentCPIM(pContent);
}
else if(TMEDIA_CONTENT_IS_DUMMY(pContent)){
else if(TMEDIA_CONTENT_IS_DUMMY(pContent)) {
// Todo
}
TSK_OBJECT_SAFE_FREE(pContent);
@ -99,7 +99,7 @@ MediaContent* MediaContent::parse(const void* pData, unsigned nSize, const char*
MediaContentCPIM* MediaContent::parse(const void* pData, unsigned nSize)
{
MediaContent* pMediaContent;
if((pMediaContent = MediaContent::parse(pData, nSize, TMEDIA_CONTENT_CPIM_TYPE))){
if((pMediaContent = MediaContent::parse(pData, nSize, TMEDIA_CONTENT_CPIM_TYPE))) {
return dyn_cast<MediaContentCPIM*>(pMediaContent);
}
return tsk_null;
@ -108,7 +108,7 @@ MediaContentCPIM* MediaContent::parse(const void* pData, unsigned nSize)
/* ============ message/CPIM ================= */
MediaContentCPIM::MediaContentCPIM(tmedia_content_t* pContent)
: MediaContent(pContent)
: MediaContent(pContent)
{
}
@ -118,7 +118,7 @@ MediaContentCPIM::~MediaContentCPIM()
unsigned MediaContentCPIM::getPayloadLength()
{
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)){
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)) {
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
@ -130,12 +130,12 @@ unsigned MediaContentCPIM::getPayload(void* pOutput, unsigned nMaxsize)
{
unsigned nRetsize = 0;
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)){
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)) {
TSK_DEBUG_ERROR("Invalid internal object");
return 0;
}
if(pOutput && nMaxsize && TMEDIA_CONTENT_CPIM(m_pContent)->e){
if(pOutput && nMaxsize && TMEDIA_CONTENT_CPIM(m_pContent)->e) {
nRetsize = (TMEDIA_CONTENT_CPIM(m_pContent)->e->size > nMaxsize) ? nMaxsize : TMEDIA_CONTENT_CPIM(m_pContent)->e->size;
memcpy(pOutput, TMEDIA_CONTENT_CPIM(m_pContent)->e->data, nRetsize);
}
@ -143,8 +143,9 @@ unsigned MediaContentCPIM::getPayload(void* pOutput, unsigned nMaxsize)
return nRetsize;
}
const void* MediaContentCPIM::getPayloadPtr(){
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)){
const void* MediaContentCPIM::getPayloadPtr()
{
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)) {
TSK_DEBUG_ERROR("Invalid internal object");
return tsk_null;
}
@ -157,19 +158,19 @@ const char* MediaContentCPIM::getHeaderValue(const char* name)
const tmedia_content_cpim_t* cpim;
const tsk_list_item_t* item;
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)){
if(!m_pContent || !TMEDIA_CONTENT_IS_CPIM(m_pContent)) {
TSK_DEBUG_ERROR("Invalid internal object");
return tsk_null;
}
cpim = TMEDIA_CONTENT_CPIM(m_pContent);
tsk_list_foreach(item, cpim->h_headers){
if(tsk_striequals(name, TMEDIA_CONTENT_HEADER(item->data)->name)){
tsk_list_foreach(item, cpim->h_headers) {
if(tsk_striequals(name, TMEDIA_CONTENT_HEADER(item->data)->name)) {
return TMEDIA_CONTENT_HEADER(item->data)->value;
}
}
tsk_list_foreach(item, cpim->m_headers){
if(tsk_striequals(name, TMEDIA_CONTENT_HEADER(item->data)->name)){
tsk_list_foreach(item, cpim->m_headers) {
if(tsk_striequals(name, TMEDIA_CONTENT_HEADER(item->data)->name)) {
return TMEDIA_CONTENT_HEADER(item->data)->value;
}
}

View File

@ -21,6 +21,32 @@
*/
#include "MediaSessionMgr.h"
//
// QoS
//
QoS::QoS(float qavg, float q1 /*= -1.f*/, float q2 /*= -1.f*/, float q3 /*= -1.f*/, float q4 /*= -1.f*/, float q5 /*= -1.f*/)
: m_Qqvg(qavg)
, m_VideoInWidth(0)
, m_VideoOutWidth(0)
, m_VideoInHeight(0)
, m_VideoOutHeight(0)
, m_BandwidthDownKbps(0)
, m_BandwidthUpKbps(0)
, m_VideoInAvgFps(0)
, m_VideoDecAvgTime(0)
, m_VideoEncAvgTime(0)
{
m_Qn[0] = q1;
m_Qn[1] = q2;
m_Qn[2] = q3;
m_Qn[3] = q4;
m_Qn[4] = q5;
}
QoS::~QoS()
{
}
//
// Codec
//
@ -36,12 +62,16 @@ Codec::~Codec()
twrap_media_type_t Codec::getMediaType()
{
if(m_pWrappedCodec){
switch(m_pWrappedCodec->type){
case tmedia_audio: return twrap_media_audio;
case tmedia_video: return twrap_media_video;
case tmedia_msrp: return twrap_media_msrp;
default: break;
if(m_pWrappedCodec) {
switch(m_pWrappedCodec->type) {
case tmedia_audio:
return twrap_media_audio;
case tmedia_video:
return twrap_media_video;
case tmedia_msrp:
return twrap_media_msrp;
default:
break;
}
}
return twrap_media_none;
@ -49,7 +79,7 @@ twrap_media_type_t Codec::getMediaType()
const char* Codec::getName()
{
if(m_pWrappedCodec){
if(m_pWrappedCodec) {
return m_pWrappedCodec->name;
}
return tsk_null;
@ -57,7 +87,7 @@ const char* Codec::getName()
const char* Codec::getDescription()
{
if(m_pWrappedCodec){
if(m_pWrappedCodec) {
return m_pWrappedCodec->desc;
}
return tsk_null;
@ -65,7 +95,7 @@ const char* Codec::getDescription()
const char* Codec::getNegFormat()
{
if(m_pWrappedCodec){
if(m_pWrappedCodec) {
return m_pWrappedCodec->neg_format ? m_pWrappedCodec->neg_format : m_pWrappedCodec->format;
}
return tsk_null;
@ -73,7 +103,7 @@ const char* Codec::getNegFormat()
int Codec::getAudioSamplingRate()
{
if(m_pWrappedCodec && m_pWrappedCodec->plugin){
if(m_pWrappedCodec && m_pWrappedCodec->plugin) {
return m_pWrappedCodec->plugin->rate;
}
return 0;
@ -81,7 +111,7 @@ int Codec::getAudioSamplingRate()
int Codec::getAudioChannels()
{
if(m_pWrappedCodec && (m_pWrappedCodec->type & tmedia_audio) && m_pWrappedCodec->plugin){
if(m_pWrappedCodec && (m_pWrappedCodec->type & tmedia_audio) && m_pWrappedCodec->plugin) {
return m_pWrappedCodec->plugin->audio.channels;
}
return 0;
@ -89,7 +119,7 @@ int Codec::getAudioChannels()
int Codec::getAudioPTime()
{
if(m_pWrappedCodec && (m_pWrappedCodec->type & tmedia_audio) && m_pWrappedCodec->plugin){
if(m_pWrappedCodec && (m_pWrappedCodec->type & tmedia_audio) && m_pWrappedCodec->plugin) {
return m_pWrappedCodec->plugin->audio.ptime;
}
return 0;
@ -126,6 +156,35 @@ int32_t MediaSessionMgr::sessionGetInt32(twrap_media_type_t media, const char* k
return value;
}
QoS* MediaSessionMgr::sessionGetQoS(twrap_media_type_t media)
{
tmedia_type_t _media = twrap_get_native_media_type(media);
tmedia_session_t* session = tmedia_session_mgr_find(m_pWrappedMgr, _media);
if (session) {
QoS* pQoS = new QoS(
session->qos_metrics.qvag,
session->qos_metrics.q1,
session->qos_metrics.q2,
session->qos_metrics.q3,
session->qos_metrics.q4,
session->qos_metrics.q5);
if (pQoS && ((_media & tmedia_video) || (_media & tmedia_bfcp_video))) {
pQoS->m_VideoInWidth = session->qos_metrics.video_in_width;
pQoS->m_VideoInHeight = session->qos_metrics.video_in_height;
pQoS->m_VideoOutWidth = session->qos_metrics.video_out_width;
pQoS->m_VideoOutHeight = session->qos_metrics.video_out_height;
pQoS->m_BandwidthDownKbps = session->qos_metrics.bw_down_est_kbps;
pQoS->m_BandwidthUpKbps = session->qos_metrics.bw_up_est_kbps;
pQoS->m_VideoInAvgFps = session->qos_metrics.video_in_avg_fps;
pQoS->m_VideoDecAvgTime = session->qos_metrics.video_dec_avg_time;
pQoS->m_VideoEncAvgTime = session->qos_metrics.video_enc_avg_time;
}
TSK_OBJECT_SAFE_FREE(session);
return pQoS;
}
return NULL;
}
bool MediaSessionMgr::consumerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = twrap_get_native_media_type(media);
@ -166,12 +225,12 @@ Codec* MediaSessionMgr::producerGetCodec(twrap_media_type_t media)
TMEDIA_SESSION_PRODUCER_GET_POBJECT(_media, "codec", &_codec),
TMEDIA_SESSION_GET_NULL()));
if(_codec){
if(_codec) {
Codec* pCodec = new Codec(_codec);
TSK_OBJECT_SAFE_FREE(_codec);
return pCodec;
}
return tsk_null;
return NULL;
}
#include "tinydav/audio/tdav_session_audio.h"
@ -184,38 +243,38 @@ const ProxyPlugin* MediaSessionMgr::findProxyPlugin(twrap_media_type_t media, bo
const ProxyPlugin* plugin = tsk_null;
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(media != twrap_media_audio && media != twrap_media_video){
if(media != twrap_media_audio && media != twrap_media_video) {
TSK_DEBUG_ERROR("Invalid media type");
return tsk_null;
}
if(manager && m_pWrappedMgr){
if(manager && m_pWrappedMgr) {
tmedia_type_t _media = twrap_get_native_media_type(media);
tmedia_session_t* session = tmedia_session_mgr_find(m_pWrappedMgr, _media);
if(session){
if(session->plugin == tdav_session_audio_plugin_def_t){
if(consumer){
if(session) {
if(session->plugin == tdav_session_audio_plugin_def_t) {
if(consumer) {
plugin = manager->findPlugin(TDAV_SESSION_AV(session)->consumer);
}
else{
else {
plugin = manager->findPlugin(TDAV_SESSION_AV(session)->producer);
}
}
else if(session->plugin == tdav_session_video_plugin_def_t){
if(consumer){
else if(session->plugin == tdav_session_video_plugin_def_t) {
if(consumer) {
plugin = manager->findPlugin(TDAV_SESSION_AV(session)->consumer);
}
else{
else {
plugin = manager->findPlugin(TDAV_SESSION_AV(session)->producer);
}
}
else{
else {
TSK_DEBUG_ERROR("Unknown session with media type = %d", _media);
}
tsk_object_unref(session);
}
}
else{
else {
TSK_DEBUG_ERROR("Invalid state");
}
@ -226,20 +285,20 @@ const ProxyPlugin* MediaSessionMgr::findProxyPlugin(twrap_media_type_t media, bo
unsigned int MediaSessionMgr::registerAudioPluginFromFile(const char* path)
{
static struct tsk_plugin_s* __plugin = tsk_null;
if(__plugin){
if(__plugin) {
TSK_DEBUG_ERROR("Audio plugin already registered");
return 0;
}
if((__plugin = tsk_plugin_create(path))){
if((__plugin = tsk_plugin_create(path))) {
unsigned int count = 0;
tsk_plugin_def_ptr_const_t plugin_def_ptr_const;
if((plugin_def_ptr_const = tsk_plugin_get_def(__plugin, tsk_plugin_def_type_consumer, tsk_plugin_def_media_type_audio))){
if(tmedia_consumer_plugin_register((const tmedia_consumer_plugin_def_t*)plugin_def_ptr_const) == 0){
if((plugin_def_ptr_const = tsk_plugin_get_def(__plugin, tsk_plugin_def_type_consumer, tsk_plugin_def_media_type_audio))) {
if(tmedia_consumer_plugin_register((const tmedia_consumer_plugin_def_t*)plugin_def_ptr_const) == 0) {
++count;
}
}
if((plugin_def_ptr_const = tsk_plugin_get_def(__plugin, tsk_plugin_def_type_producer, tsk_plugin_def_media_type_audio))){
if(tmedia_producer_plugin_register((const tmedia_producer_plugin_def_t*)plugin_def_ptr_const) == 0){
if((plugin_def_ptr_const = tsk_plugin_get_def(__plugin, tsk_plugin_def_type_producer, tsk_plugin_def_media_type_audio))) {
if(tmedia_producer_plugin_register((const tmedia_producer_plugin_def_t*)plugin_def_ptr_const) == 0) {
++count;
}
}
@ -319,6 +378,16 @@ bool MediaSessionMgr::defaultsSetPrefVideoSize(tmedia_pref_video_size_t pref_vid
return tmedia_defaults_set_pref_video_size(pref_video_size) == 0;
}
bool MediaSessionMgr::defaultsSetPrefVideoSizeOutRange(tmedia_pref_video_size_t min, tmedia_pref_video_size_t max)
{
return tmedia_defaults_set_pref_video_size_range(min, max) == 0;
}
bool MediaSessionMgr::defaultsSetAdaptativeVideoSizeOutEnabled(bool enabled)
{
return tmedia_defaults_set_adapt_video_size_range_enabled(enabled ? tsk_true : tsk_false) == 0;
}
bool MediaSessionMgr::defaultsSetJbMargin(uint32_t jb_margin_ms)
{
return tmedia_defaults_set_jb_margin(jb_margin_ms) == 0;
@ -404,34 +473,42 @@ int32_t MediaSessionMgr::defaultsGetNoiseSuppLevel()
return tmedia_defaults_get_noise_supp_level();
}
bool MediaSessionMgr::defaultsSet100relEnabled(bool _100rel_enabled){
bool MediaSessionMgr::defaultsSet100relEnabled(bool _100rel_enabled)
{
return tmedia_defaults_set_100rel_enabled(_100rel_enabled ? tsk_true : tsk_false) == 0;
}
bool MediaSessionMgr::defaultsGet100relEnabled(){
bool MediaSessionMgr::defaultsGet100relEnabled()
{
return tmedia_defaults_get_100rel_enabled() == 0;
}
bool MediaSessionMgr::defaultsSetScreenSize(int32_t sx, int32_t sy){
bool MediaSessionMgr::defaultsSetScreenSize(int32_t sx, int32_t sy)
{
return tmedia_defaults_set_screen_size(sx, sy) == 0;
}
bool MediaSessionMgr::defaultsSetAudioGain(int32_t producer_gain, int32_t consumer_gain){
bool MediaSessionMgr::defaultsSetAudioGain(int32_t producer_gain, int32_t consumer_gain)
{
return tmedia_defaults_set_audio_gain(producer_gain, consumer_gain) == 0;
}
bool MediaSessionMgr::defaultsSetAudioPtime(int32_t ptime){
bool MediaSessionMgr::defaultsSetAudioPtime(int32_t ptime)
{
return tmedia_defaults_set_audio_ptime(ptime) == 0;
}
bool MediaSessionMgr::defaultsSetAudioChannels(int32_t channel_playback, int32_t channel_record){
bool MediaSessionMgr::defaultsSetAudioChannels(int32_t channel_playback, int32_t channel_record)
{
return tmedia_defaults_set_audio_channels(channel_playback, channel_record) == 0;
}
bool MediaSessionMgr::defaultsSetRtpPortRange(uint16_t range_start, uint16_t range_stop){
bool MediaSessionMgr::defaultsSetRtpPortRange(uint16_t range_start, uint16_t range_stop)
{
return tmedia_defaults_set_rtp_port_range(range_start, range_stop) == 0;
}
bool MediaSessionMgr::defaultsSetRtpSymetricEnabled(bool enabled){
bool MediaSessionMgr::defaultsSetRtpSymetricEnabled(bool enabled)
{
return tmedia_defaults_set_rtp_symetric_enabled(enabled ? tsk_true : tsk_false) == 0;
}
@ -457,103 +534,132 @@ bool MediaSessionMgr::defaultsSetInviteSessionTimers(int32_t timeout, const char
return (ret == 0);
}
bool MediaSessionMgr::defaultsSetSRtpMode(tmedia_srtp_mode_t mode){
bool MediaSessionMgr::defaultsSetSRtpMode(tmedia_srtp_mode_t mode)
{
return (tmedia_defaults_set_srtp_mode(mode) == 0);
}
tmedia_srtp_mode_t MediaSessionMgr::defaultsGetSRtpMode(){
tmedia_srtp_mode_t MediaSessionMgr::defaultsGetSRtpMode()
{
return tmedia_defaults_get_srtp_mode();
}
bool MediaSessionMgr::defaultsSetSRtpType(tmedia_srtp_type_t srtp_type){
bool MediaSessionMgr::defaultsSetSRtpType(tmedia_srtp_type_t srtp_type)
{
return (tmedia_defaults_set_srtp_type(srtp_type) == 0);
}
tmedia_srtp_type_t MediaSessionMgr::defaultsGetSRtpType(){
tmedia_srtp_type_t MediaSessionMgr::defaultsGetSRtpType()
{
return tmedia_defaults_get_srtp_type();
}
bool MediaSessionMgr::defaultsSetRtcpEnabled(bool enabled){
bool MediaSessionMgr::defaultsSetRtcpEnabled(bool enabled)
{
return (tmedia_defaults_set_rtcp_enabled(enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsGetRtcpEnabled(){
bool MediaSessionMgr::defaultsGetRtcpEnabled()
{
return (tmedia_defaults_get_rtcp_enabled() == tsk_true);
}
bool MediaSessionMgr::defaultsSetRtcpMuxEnabled(bool enabled){
bool MediaSessionMgr::defaultsSetRtcpMuxEnabled(bool enabled)
{
return (tmedia_defaults_set_rtcpmux_enabled(enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsGetRtcpMuxEnabled(){
bool MediaSessionMgr::defaultsGetRtcpMuxEnabled()
{
return (tmedia_defaults_get_rtcpmux_enabled() == tsk_true);
}
bool MediaSessionMgr::defaultsSetStunEnabled(bool stun_enabled){
bool MediaSessionMgr::defaultsSetStunEnabled(bool stun_enabled)
{
return (tmedia_defaults_set_stun_enabled(stun_enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsSetIceStunEnabled(bool icestun_enabled){
bool MediaSessionMgr::defaultsSetIceStunEnabled(bool icestun_enabled)
{
return (tmedia_defaults_set_icestun_enabled(icestun_enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsSetIceTurnEnabled(bool iceturn_enabled){
bool MediaSessionMgr::defaultsSetIceTurnEnabled(bool iceturn_enabled)
{
return (tmedia_defaults_set_iceturn_enabled(iceturn_enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsSetStunServer(const char* server_ip, uint16_t server_port){
bool MediaSessionMgr::defaultsSetStunServer(const char* server_ip, uint16_t server_port)
{
return (tmedia_defaults_set_stun_server(server_ip, server_port) == 0);
}
bool MediaSessionMgr::defaultsSetStunCred(const char* username, const char* password){
bool MediaSessionMgr::defaultsSetStunCred(const char* username, const char* password)
{
return (tmedia_defaults_set_stun_cred(username, password) == 0);
}
bool MediaSessionMgr::defaultsSetIceEnabled(bool ice_enabled){
bool MediaSessionMgr::defaultsSetIceEnabled(bool ice_enabled)
{
return (tmedia_defaults_set_ice_enabled(ice_enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsSetByPassEncoding(bool enabled){
bool MediaSessionMgr::defaultsSetByPassEncoding(bool enabled)
{
return (tmedia_defaults_set_bypass_encoding(enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsGetByPassEncoding(){
bool MediaSessionMgr::defaultsGetByPassEncoding()
{
return (tmedia_defaults_get_bypass_encoding() == tsk_true);
}
bool MediaSessionMgr::defaultsSetByPassDecoding(bool enabled){
bool MediaSessionMgr::defaultsSetByPassDecoding(bool enabled)
{
return (tmedia_defaults_set_bypass_decoding(enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsGetByPassDecoding(){
bool MediaSessionMgr::defaultsGetByPassDecoding()
{
return (tmedia_defaults_get_bypass_decoding() == tsk_true);
}
bool MediaSessionMgr::defaultsSetVideoJbEnabled(bool enabled){
bool MediaSessionMgr::defaultsSetVideoJbEnabled(bool enabled)
{
return (tmedia_defaults_set_videojb_enabled(enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsGetVideoJbEnabled(){
bool MediaSessionMgr::defaultsGetVideoJbEnabled()
{
return (tmedia_defaults_get_videojb_enabled() == tsk_true);
}
bool MediaSessionMgr::defaultsSetVideoZeroArtifactsEnabled(bool enabled){
bool MediaSessionMgr::defaultsSetVideoZeroArtifactsEnabled(bool enabled)
{
return (tmedia_defaults_set_video_zeroartifacts_enabled(enabled ? tsk_true : tsk_false) == 0);
}
bool MediaSessionMgr::defaultsGetVideoZeroArtifactsEnabled(){
bool MediaSessionMgr::defaultsGetVideoZeroArtifactsEnabled()
{
return (tmedia_defaults_get_video_zeroartifacts_enabled() == tsk_true);
}
bool MediaSessionMgr::defaultsSetRtpBuffSize(unsigned buffSize){
bool MediaSessionMgr::defaultsSetRtpBuffSize(unsigned buffSize)
{
return (tmedia_defaults_set_rtpbuff_size(buffSize) == 0);
}
unsigned MediaSessionMgr::defaultsGetRtpBuffSize(){
unsigned MediaSessionMgr::defaultsGetRtpBuffSize()
{
return tmedia_defaults_get_rtpbuff_size();
}
bool MediaSessionMgr::defaultsSetAvpfTail(unsigned tail_min, unsigned tail_max){
bool MediaSessionMgr::defaultsSetAvpfTail(unsigned tail_min, unsigned tail_max)
{
return (tmedia_defaults_set_avpf_tail(tail_min, tail_max) == 0);
}
bool MediaSessionMgr::defaultsSetAvpfMode(enum tmedia_mode_e mode){
bool MediaSessionMgr::defaultsSetAvpfMode(enum tmedia_mode_e mode)
{
return (tmedia_defaults_set_avpf_mode(mode) == 0);
}
bool MediaSessionMgr::defaultsSetOpusMaxCaptureRate(uint32_t opus_maxcapturerate){
bool MediaSessionMgr::defaultsSetOpusMaxCaptureRate(uint32_t opus_maxcapturerate)
{
return (tmedia_defaults_set_opus_maxcapturerate(opus_maxcapturerate) == 0);
}
bool MediaSessionMgr::defaultsSetOpusMaxPlaybackRate(uint32_t opus_maxplaybackrate){
bool MediaSessionMgr::defaultsSetOpusMaxPlaybackRate(uint32_t opus_maxplaybackrate)
{
return (tmedia_defaults_set_opus_maxplaybackrate(opus_maxplaybackrate) == 0);
}
bool MediaSessionMgr::defaultsSetMaxFds(int32_t max_fds) {
bool MediaSessionMgr::defaultsSetMaxFds(int32_t max_fds)
{
return (tmedia_defaults_set_max_fds(max_fds) == 0);
}

View File

@ -28,6 +28,74 @@
#include "Common.h"
class ProxyPlugin;
class MediaSessionMgr;
class TINYWRAP_API QoS
{
friend class MediaSessionMgr;
public:
#if !defined(SWIG)
QoS(float qavg, float q1 = -1.f, float q2 = -1.f, float q3 = -1.f, float q4 = -1.f, float q5 = -1.f);
#endif
virtual ~QoS();
float getQavg() {
return m_Qqvg;
}
float getQ1() {
return m_Qn[0];
}
float getQ2() {
return m_Qn[1];
}
float getQ3() {
return m_Qn[2];
}
float getQ4() {
return m_Qn[3];
}
float getQ5() {
return m_Qn[4];
}
unsigned getVideoInWidth() {
return m_VideoInWidth;
}
unsigned getVideoOutWidth() {
return m_VideoOutWidth;
}
unsigned getVideoInHeight() {
return m_VideoInHeight;
}
unsigned getVideoOutHeight() {
return m_VideoOutHeight;
}
unsigned getBandwidthDownKbps() {
return m_BandwidthDownKbps;
}
unsigned getBandwidthUpKbps() {
return m_BandwidthUpKbps;
}
unsigned getVideoInAvgFps() {
return m_VideoInAvgFps;
}
unsigned getVideoDecAvgTime() { // In millis
return m_VideoDecAvgTime;
}
unsigned getVideoEncAvgTime() { // In millis
return m_VideoEncAvgTime;
}
private:
float m_Qqvg;
float m_Qn[5];
unsigned m_VideoInWidth;
unsigned m_VideoOutWidth;
unsigned m_VideoInHeight;
unsigned m_VideoOutHeight;
unsigned m_BandwidthDownKbps;
unsigned m_BandwidthUpKbps;
unsigned m_VideoInAvgFps;
unsigned m_VideoDecAvgTime;
unsigned m_VideoEncAvgTime;
};
class TINYWRAP_API Codec
{
@ -39,8 +107,12 @@ public:
public:
#if !defined(SWIG)
const struct tmedia_codec_s* getWrappedCodec(){ return m_pWrappedCodec; }
inline bool isOpened(){ return (m_pWrappedCodec && (m_pWrappedCodec->opened == tsk_true)); }
const struct tmedia_codec_s* getWrappedCodec() {
return m_pWrappedCodec;
}
inline bool isOpened() {
return (m_pWrappedCodec && (m_pWrappedCodec->opened == tsk_true));
}
#endif
twrap_media_type_t getMediaType();
const char* getName();
@ -65,6 +137,7 @@ public:
public:
bool sessionSetInt32(twrap_media_type_t media, const char* key, int32_t value);
int32_t sessionGetInt32(twrap_media_type_t media, const char* key);
QoS* sessionGetQoS(twrap_media_type_t media);
bool consumerSetInt32(twrap_media_type_t media, const char* key, int32_t value);
bool consumerSetInt64(twrap_media_type_t media, const char* key, int64_t value);
@ -77,10 +150,10 @@ public:
const ProxyPlugin* findProxyPlugin(twrap_media_type_t media, bool consumer)const;
#endif
const ProxyPlugin* findProxyPluginConsumer(twrap_media_type_t media)const{
const ProxyPlugin* findProxyPluginConsumer(twrap_media_type_t media)const {
return this->findProxyPlugin(media, true);
}
const ProxyPlugin* findProxyPluginProducer(twrap_media_type_t media)const{
const ProxyPlugin* findProxyPluginProducer(twrap_media_type_t media)const {
return this->findProxyPlugin(media, false);
}
@ -89,7 +162,9 @@ public:
uint64_t getSessionId(twrap_media_type_t media)const;
#if !defined(SWIG)
inline const tmedia_session_mgr_t* getWrappedMgr()const { return m_pWrappedMgr; }
inline const tmedia_session_mgr_t* getWrappedMgr()const {
return m_pWrappedMgr;
}
#endif
// Defaults
@ -103,6 +178,8 @@ public:
static bool defaultsSetBandwidthVideoUploadMax(int32_t bw_video_up_max_kbps);
static bool defaultsSetBandwidthVideoDownloadMax(int32_t bw_video_down_max_kbps);
static bool defaultsSetPrefVideoSize(tmedia_pref_video_size_t pref_video_size);
static bool defaultsSetPrefVideoSizeOutRange(tmedia_pref_video_size_t min, tmedia_pref_video_size_t max);
static bool defaultsSetAdaptativeVideoSizeOutEnabled(bool enabled);
static bool defaultsSetJbMargin(uint32_t jb_margin_ms);
static bool defaultsSetJbMaxLateRate(uint32_t jb_late_rate_percent);
static bool defaultsSetEchoTail(uint32_t echo_tail);

View File

@ -26,7 +26,7 @@
/* ======================== MsrpMessage ========================*/
MsrpMessage::MsrpMessage()
:m_pMessage(tsk_null)
:m_pMessage(tsk_null)
{
}
@ -57,7 +57,7 @@ const char* MsrpMessage::getPhrase()
tmsrp_request_type_t MsrpMessage::getRequestType()
{
if(TMSRP_MESSAGE_IS_REQUEST(m_pMessage)){
if(TMSRP_MESSAGE_IS_REQUEST(m_pMessage)) {
return m_pMessage->line.request.type;
}
return tmsrp_NONE;
@ -65,23 +65,23 @@ tmsrp_request_type_t MsrpMessage::getRequestType()
void MsrpMessage::getByteRange(int64_t* start, int64_t* end, int64_t* total)
{
if(m_pMessage->ByteRange){
if(m_pMessage->ByteRange) {
*start = m_pMessage->ByteRange->start;
*end = m_pMessage->ByteRange->end;
*total = m_pMessage->ByteRange->total;
}
else{
else {
*start = *end = *total = -1;
}
}
bool MsrpMessage::isLastChunck()
{
if(TMSRP_MESSAGE_IS_REQUEST(m_pMessage)){
if(TMSRP_MESSAGE_IS_REQUEST(m_pMessage)) {
return (m_pMessage->end_line.cflag == '$');
}
else{
if(m_pMessage->ByteRange){
else {
if(m_pMessage->ByteRange) {
return (m_pMessage->ByteRange->end >= m_pMessage->ByteRange->total);
}
}
@ -90,8 +90,8 @@ bool MsrpMessage::isLastChunck()
bool MsrpMessage::isSuccessReport()
{
if(TMSRP_REQUEST_IS_REPORT(m_pMessage)){
if(m_pMessage->Status){
if(TMSRP_REQUEST_IS_REPORT(m_pMessage)) {
if(m_pMessage->Status) {
return m_pMessage->Status->code >= 200 && m_pMessage->Status->code <= 299;
}
}
@ -106,7 +106,7 @@ bool MsrpMessage::isFirstChunck()
char* MsrpMessage::getMsrpHeaderValue(const char* name)
{
const tmsrp_header_t* header = this->getMsrpHeader(name, 0);
if(header){
if(header) {
return tmsrp_header_tostring(header);
}
return tsk_null;
@ -122,7 +122,7 @@ unsigned MsrpMessage::getMsrpContentLength()
if(m_pMessage &&
m_pMessage->Content &&
m_pMessage->Content->data &&
m_pMessage->Content->size){
m_pMessage->Content->size) {
return m_pMessage->Content->size;
}
return 0;
@ -135,7 +135,7 @@ unsigned MsrpMessage::getMsrpContent(void* output, unsigned maxsize)
!m_pMessage ||
!m_pMessage->Content ||
!m_pMessage->Content->data ||
!m_pMessage->Content->size){
!m_pMessage->Content->size) {
return 0;
}
@ -152,56 +152,88 @@ const tmsrp_header_t* MsrpMessage::getMsrpHeader(const char* name, unsigned inde
const tsk_list_item_t *item;
/* From tmsrp_message_get_headerAt() */
if(!m_pMessage || !name){
if(!m_pMessage || !name) {
return tsk_null;
}
if(tsk_striequals(name, "To-Path")){
if(index == 0){
if(tsk_striequals(name, "To-Path")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->To;
goto bail;
}else pos++; }
if(tsk_striequals(name, "From-Path")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "From-Path")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->From;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Message-ID")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "Message-ID")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->MessageID;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Byte-Range")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "Byte-Range")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->ByteRange;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Failure-Report")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "Failure-Report")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->FailureReport;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Success-Report")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "Success-Report")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->SuccessReport;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Status")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "Status")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->Status;
goto bail;
}else pos++; }
if(tsk_striequals(name, "Content-Type")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "Content-Type")) {
if(index == 0) {
hdr = (const tmsrp_header_t*)m_pMessage->ContentType;
goto bail;
}else pos++; }
}
else {
pos++;
}
}
/* All other headers */
tsk_list_foreach(item, m_pMessage->headers){
if(tsk_striequals(tmsrp_header_get_nameex(TMSRP_HEADER(item->data)), name)){
if(pos++ >= index){
tsk_list_foreach(item, m_pMessage->headers) {
if(tsk_striequals(tmsrp_header_get_nameex(TMSRP_HEADER(item->data)), name)) {
if(pos++ >= index) {
hdr = (const tmsrp_header_t*)item->data;
break;
}
@ -220,24 +252,24 @@ bail:
MsrpEvent::MsrpEvent(const tmsrp_event_t *_msrpevent)
{
this->_event = _msrpevent;
if(this->_event && this->_event->message){
if(this->_event && this->_event->message) {
m_pMessage = new MsrpMessage((tmsrp_message_t *)this->_event->message);
}
else{
else {
m_pMessage = tsk_null;
}
}
MsrpEvent::~MsrpEvent()
{
if(m_pMessage){
if(m_pMessage) {
delete m_pMessage;
}
}
tmsrp_event_type_t MsrpEvent::getType()
{
if(this->_event){
if(this->_event) {
return this->_event->type;
}
return tmsrp_event_type_none;
@ -245,7 +277,7 @@ tmsrp_event_type_t MsrpEvent::getType()
const MsrpSession* MsrpEvent::getSipSession()
{
if(this->_event && this->_event->callback_data){
if(this->_event && this->_event->callback_data) {
return dyn_cast<const MsrpSession*>((const MsrpSession*)this->_event->callback_data);
}
return tsk_null;
@ -265,17 +297,17 @@ int twrap_msrp_cb(const tmsrp_event_t* _event)
MsrpCallback* callback;
int ret = -1;
if(session){
if((callback = session->getCallback())){
if(session) {
if((callback = session->getCallback())) {
MsrpEvent* e = new MsrpEvent(_event);
ret = callback->OnEvent(e);
delete e;
}
else{
else {
return 0;
}
}
else{
else {
TSK_DEBUG_ERROR("Invalid parameter");
}

View File

@ -54,7 +54,9 @@ public:
unsigned getMsrpContentLength();
unsigned getMsrpContent(void* output, unsigned maxsize);
#if !defined(SWIG)
const tmsrp_message_t* getWrappedMsrpMessage() { return m_pMessage; }
const tmsrp_message_t* getWrappedMsrpMessage() {
return m_pMessage;
}
#endif
private:
@ -86,7 +88,9 @@ class TINYWRAP_API MsrpCallback
public:
MsrpCallback() { }
virtual ~MsrpCallback() {}
virtual int OnEvent(const MsrpEvent* e) { return -1; }
virtual int OnEvent(const MsrpEvent* e) {
return -1;
}
};

View File

@ -40,8 +40,7 @@
/* ============ Audio Consumer Interface ================= */
typedef struct twrap_consumer_proxy_audio_s
{
typedef struct twrap_consumer_proxy_audio_s {
TDAV_DECLARE_CONSUMER_AUDIO;
uint64_t id;
@ -54,7 +53,7 @@ twrap_consumer_proxy_audio_t;
int twrap_consumer_proxy_audio_set(tmedia_consumer_t* _self, const tmedia_param_t* param)
{
twrap_consumer_proxy_audio_t* self = (twrap_consumer_proxy_audio_t*)_self;
if(param->plugin_type == tmedia_ppt_consumer){
if(param->plugin_type == tmedia_ppt_consumer) {
// specific proxy consumer
}
return tdav_consumer_audio_set(TDAV_CONSUMER_AUDIO(self), param);
@ -65,14 +64,14 @@ int twrap_consumer_proxy_audio_prepare(tmedia_consumer_t* self, const tmedia_cod
twrap_consumer_proxy_audio_t* audio = TWRAP_CONSUMER_PROXY_AUDIO(self);
ProxyPluginMgr* manager = NULL;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
if((audio->pcConsumer = manager->findAudioConsumer(audio->id)) && audio->pcConsumer->getCallback()){
if(codec && (manager = ProxyPluginMgr::getInstance())) {
if((audio->pcConsumer = manager->findAudioConsumer(audio->id)) && audio->pcConsumer->getCallback()) {
self->audio.ptime = TMEDIA_CODEC_PTIME_AUDIO_DECODING(codec);
self->audio.in.channels = TMEDIA_CODEC_CHANNELS_AUDIO_DECODING(codec);
self->audio.in.rate = TMEDIA_CODEC_RATE_DECODING(codec);
ret = audio->pcConsumer->getCallback()->prepare((int)self->audio.ptime, self->audio.in.rate, self->audio.in.channels);
if(ret == 0 && !audio->pcConsumer->getCallback()->isPivotSettings()){
if(ret == 0 && !audio->pcConsumer->getCallback()->isPivotSettings()) {
// say consumer can output these params
// Out "rate" and "channels" must be defined regardless previous values (already the case in other back-ends) to avoid issues on reINVITE with rate change (e.g. Opus -> PCMA).
/*if(!self->audio.out.rate)*/ self->audio.out.rate = self->audio.in.rate;
@ -91,9 +90,9 @@ int twrap_consumer_proxy_audio_start(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()) {
ret = audioConsumer->getCallback()->start();
}
}
@ -106,20 +105,20 @@ int twrap_consumer_proxy_audio_consume(tmedia_consumer_t* self, const void* buff
{
twrap_consumer_proxy_audio_t* audio = TWRAP_CONSUMER_PROXY_AUDIO(self);
if(!audio->pcConsumer){
if(!audio->pcConsumer) {
ProxyPluginMgr* manager;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
audio->pcConsumer = manager->findAudioConsumer(audio->id);
}
}
ProxyAudioConsumerCallback* callback;
int ret = -1;
if(audio->pcConsumer && (callback = audio->pcConsumer->getCallback())){
if(callback->putInJitterBuffer()){
if(audio->pcConsumer && (callback = audio->pcConsumer->getCallback())) {
if(callback->putInJitterBuffer()) {
ret = tdav_consumer_audio_put(TDAV_CONSUMER_AUDIO(self), buffer, size, proto_hdr);
}
else{
else {
ret = callback->consume(buffer, size, proto_hdr);
}
}
@ -131,9 +130,9 @@ int twrap_consumer_proxy_audio_pause(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()) {
ret = audioConsumer->getCallback()->pause();
}
}
@ -145,9 +144,9 @@ int twrap_consumer_proxy_audio_stop(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioConsumer* audioConsumer;
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()){
if((audioConsumer = manager->findAudioConsumer(TWRAP_CONSUMER_PROXY_AUDIO(self)->id)) && audioConsumer->getCallback()) {
ret = audioConsumer->getCallback()->stop();
}
}
@ -164,14 +163,14 @@ int twrap_consumer_proxy_audio_stop(tmedia_consumer_t* self)
static tsk_object_t* twrap_consumer_proxy_audio_ctor(tsk_object_t * self, va_list * app)
{
twrap_consumer_proxy_audio_t *consumer = (twrap_consumer_proxy_audio_t *)self;
if(consumer){
if(consumer) {
/* init base */
tdav_consumer_audio_init(TDAV_CONSUMER_AUDIO(consumer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
ProxyPlugin* proxyConsumer = new ProxyAudioConsumer(consumer);
uint64_t id = proxyConsumer->getId();
manager->addPlugin(&proxyConsumer);
@ -184,9 +183,9 @@ static tsk_object_t* twrap_consumer_proxy_audio_ctor(tsk_object_t * self, va_lis
static tsk_object_t* twrap_consumer_proxy_audio_dtor(tsk_object_t * self)
{
twrap_consumer_proxy_audio_t *consumer = (twrap_consumer_proxy_audio_t *)self;
if(consumer){
if(consumer) {
/* stop */
if(consumer->started){
if(consumer->started) {
twrap_consumer_proxy_audio_stop(TMEDIA_CONSUMER(consumer));
}
@ -197,7 +196,7 @@ static tsk_object_t* twrap_consumer_proxy_audio_dtor(tsk_object_t * self)
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
manager->getCallback()->OnPluginDestroyed(consumer->id, twrap_proxy_plugin_audio_consumer);
manager->removePlugin(consumer->id);
}
@ -206,16 +205,14 @@ static tsk_object_t* twrap_consumer_proxy_audio_dtor(tsk_object_t * self)
return self;
}
/* object definition */
static const tsk_object_def_t twrap_consumer_proxy_audio_def_s =
{
static const tsk_object_def_t twrap_consumer_proxy_audio_def_s = {
sizeof(twrap_consumer_proxy_audio_t),
twrap_consumer_proxy_audio_ctor,
twrap_consumer_proxy_audio_dtor,
tdav_consumer_audio_cmp,
};
/* plugin definition*/
static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_audio_plugin_def_s =
{
static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_audio_plugin_def_s = {
&twrap_consumer_proxy_audio_def_s,
tmedia_audio,
@ -235,14 +232,14 @@ static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_audio_plugin_def_
/* ============ ProxyAudioConsumer Class ================= */
ProxyAudioConsumer::ProxyAudioConsumer(twrap_consumer_proxy_audio_t* pConsumer)
:ProxyPlugin(twrap_proxy_plugin_audio_consumer),
m_pWrappedPlugin(pConsumer),
m_pCallback(tsk_null)
:ProxyPlugin(twrap_proxy_plugin_audio_consumer),
m_pWrappedPlugin(pConsumer),
m_pCallback(tsk_null)
{
memset(&m_PullBuffer, 0, sizeof(m_PullBuffer));
memset(&m_Resampler, 0, sizeof(m_Resampler));
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
m_pWrappedPlugin->id = this->getId();
}
}
@ -251,7 +248,7 @@ ProxyAudioConsumer::~ProxyAudioConsumer()
{
TSK_FREE(m_Resampler.pInBufferPtr);
m_Resampler.nInBufferSizeInByte = 0;
if(m_Resampler.pResampler){
if(m_Resampler.pResampler) {
delete m_Resampler.pResampler, m_Resampler.pResampler = tsk_null;
}
}
@ -259,14 +256,14 @@ ProxyAudioConsumer::~ProxyAudioConsumer()
// Use this function to request resampling when your sound card can't honor negotaited record parameters
bool ProxyAudioConsumer::setActualSndCardPlaybackParams(int nPtime, int nRate, int nChannels)
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
TSK_DEBUG_INFO("ProxyAudioConsumer::setActualSndCardRecordParams(ptime=%d, rate=%d, channels=%d)", nPtime, nRate, nChannels);
TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.ptime = nPtime;
TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.out.rate = nRate;
TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.out.channels = nChannels;
return true;
}
else{
else {
TSK_DEBUG_ERROR("Invalid state");
return false;
}
@ -275,16 +272,16 @@ bool ProxyAudioConsumer::setActualSndCardPlaybackParams(int nPtime, int nRate, i
bool ProxyAudioConsumer::queryForResampler(uint16_t nInFreq, uint16_t nOutFreq, uint16_t nFrameDuration, uint16_t nChannels, uint16_t nResamplerQuality)
{
TSK_DEBUG_INFO("queryForResampler(%hu,%hu,%hu,%hu,%hu)", nInFreq, nOutFreq, nFrameDuration, nChannels, nResamplerQuality);
if(nResamplerQuality > 10){
if(nResamplerQuality > 10) {
TSK_DEBUG_WARN("%d is invalid value for quality", nResamplerQuality);
}
m_Resampler.pResampler = new AudioResampler(nInFreq, nOutFreq, nFrameDuration, nChannels, nResamplerQuality);
if(!m_Resampler.pResampler){
if(!m_Resampler.pResampler) {
TSK_DEBUG_ERROR("Failed to create new 'AudioResampler' object");
return false;
}
bool bOK = m_Resampler.pResampler->isValid();
if(!bOK){
if(!bOK) {
goto bail;
}
m_Resampler.nInBufferSizeInByte = m_Resampler.pResampler->getInputRequiredSizeInShort() * 2;
@ -292,8 +289,8 @@ bool ProxyAudioConsumer::queryForResampler(uint16_t nInFreq, uint16_t nOutFreq,
bOK = (m_Resampler.pInBufferPtr != tsk_null);
bail:
if(!bOK){
if(m_Resampler.pResampler){
if(!bOK) {
if(m_Resampler.pResampler) {
delete m_Resampler.pResampler, m_Resampler.pResampler = tsk_null;
}
TSK_FREE(m_Resampler.pInBufferPtr);
@ -311,25 +308,25 @@ bool ProxyAudioConsumer::setPullBuffer(const void* pPullBufferPtr, unsigned nPul
unsigned ProxyAudioConsumer::pull(void* _pOutput/*=tsk_null*/, unsigned _nSize/*=0*/)
{
if((m_pWrappedPlugin = (twrap_consumer_proxy_audio_t*)tsk_object_ref(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_audio_t*)tsk_object_ref(m_pWrappedPlugin))) {
void* pOutput;
unsigned nSize;
if(_pOutput && _nSize){
if(_pOutput && _nSize) {
pOutput = _pOutput, nSize = _nSize;
}
else{
else {
pOutput = (void*)m_PullBuffer.pPullBufferPtr, nSize = m_PullBuffer.nPullBufferSize;
}
tsk_size_t nRetSize = 0;
if(m_Resampler.pResampler && m_Resampler.pInBufferPtr){
if(m_Resampler.pResampler && m_Resampler.pInBufferPtr) {
nRetSize = tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin), m_Resampler.pInBufferPtr, m_Resampler.nInBufferSizeInByte);
if(nRetSize){
if(nRetSize) {
nRetSize = m_Resampler.pResampler->process(m_Resampler.pInBufferPtr, nRetSize, pOutput, nSize);
}
}
else{
else {
nRetSize = tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin), pOutput, nSize);
}
@ -343,7 +340,7 @@ unsigned ProxyAudioConsumer::pull(void* _pOutput/*=tsk_null*/, unsigned _nSize/*
bool ProxyAudioConsumer::setGain(unsigned nGain)
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
// see also: MediaSessionMgr.consumerSetInt32(org.doubango.tinyWRAP.twrap_media_type_t.twrap_media_audio, "gain", nGain);
TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.gain = TSK_MIN(nGain,14);
return true;
@ -353,7 +350,7 @@ bool ProxyAudioConsumer::setGain(unsigned nGain)
unsigned ProxyAudioConsumer::getGain()
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
return TMEDIA_CONSUMER(m_pWrappedPlugin)->audio.gain;
}
return 0;
@ -361,7 +358,7 @@ unsigned ProxyAudioConsumer::getGain()
bool ProxyAudioConsumer::reset()
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
return (tdav_consumer_audio_reset(TDAV_CONSUMER_AUDIO(m_pWrappedPlugin)) == 0);
}
return false;
@ -408,8 +405,7 @@ bool ProxyAudioConsumer::registerPlugin()
/* ============ Video Consumer Interface ================= */
typedef struct twrap_consumer_proxy_video_s
{
typedef struct twrap_consumer_proxy_video_s {
TDAV_DECLARE_CONSUMER_VIDEO;
uint64_t id;
@ -429,8 +425,8 @@ int twrap_consumer_proxy_video_prepare(tmedia_consumer_t* self, const tmedia_cod
ProxyPluginMgr* manager;
twrap_consumer_proxy_video_t* video = TWRAP_CONSUMER_PROXY_VIDEO(self);
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
if((video->pcConsumer = manager->findVideoConsumer(video->id)) && video->pcConsumer->getCallback()){
if(codec && (manager = ProxyPluginMgr::getInstance())) {
if((video->pcConsumer = manager->findVideoConsumer(video->id)) && video->pcConsumer->getCallback()) {
self->video.fps = TMEDIA_CODEC_VIDEO(codec)->in.fps;
// in
self->video.in.chroma = tmedia_chroma_yuv420p;
@ -439,10 +435,10 @@ int twrap_consumer_proxy_video_prepare(tmedia_consumer_t* self, const tmedia_cod
// display (out)
self->video.display.chroma = video->pcConsumer->getChroma();
self->video.display.auto_resize = video->pcConsumer->getAutoResizeDisplay();
if(!self->video.display.width){
if(!self->video.display.width) {
self->video.display.width = self->video.in.width;
}
if(!self->video.display.height){
if(!self->video.display.height) {
self->video.display.height = self->video.in.height;
}
ret = video->pcConsumer->getCallback()->prepare(TMEDIA_CODEC_VIDEO(codec)->in.width, TMEDIA_CODEC_VIDEO(codec)->in.height, TMEDIA_CODEC_VIDEO(codec)->in.fps);
@ -456,9 +452,9 @@ int twrap_consumer_proxy_video_start(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()) {
ret = videoConsumer->getCallback()->start();
}
}
@ -469,16 +465,16 @@ int twrap_consumer_proxy_video_start(tmedia_consumer_t* self)
int twrap_consumer_proxy_video_consume(tmedia_consumer_t* self, const void* buffer, tsk_size_t size, const tsk_object_t* proto_hdr)
{
if(!self || !buffer || !size){
if(!self || !buffer || !size) {
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
twrap_consumer_proxy_video_t* video = TWRAP_CONSUMER_PROXY_VIDEO(self);
if(!video->pcConsumer){
if(!video->pcConsumer) {
ProxyPluginMgr* manager;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
video->pcConsumer = manager->findVideoConsumer(video->id);
}
}
@ -486,23 +482,23 @@ int twrap_consumer_proxy_video_consume(tmedia_consumer_t* self, const void* buff
int ret = -1;
ProxyVideoConsumerCallback* callback;
if(video->pcConsumer && (callback = video->pcConsumer->getCallback())){
if(tdav_consumer_video_has_jb(TDAV_CONSUMER_VIDEO(self))){
if(video->pcConsumer && (callback = video->pcConsumer->getCallback())) {
if(tdav_consumer_video_has_jb(TDAV_CONSUMER_VIDEO(self))) {
ret = tdav_consumer_video_put(TDAV_CONSUMER_VIDEO(self), buffer, size, proto_hdr);
}
else{
if(video->pcConsumer->hasConsumeBuffer()){
else {
if(video->pcConsumer->hasConsumeBuffer()) {
unsigned nCopiedSize = video->pcConsumer->copyBuffer(buffer, size);
ret = callback->bufferCopied(nCopiedSize, size);
}
else{
else {
ProxyVideoFrame* frame = new ProxyVideoFrame(buffer, size, const_cast<ProxyVideoConsumer*>(video->pcConsumer)->getDecodedWidth(), const_cast<ProxyVideoConsumer*>(video->pcConsumer)->getDecodedHeight(), proto_hdr);
ret = callback->consume(frame);
delete frame, frame = tsk_null;
}
}
}
else if(!video->pcConsumer){
else if(!video->pcConsumer) {
TSK_DEBUG_ERROR("Cannot find consumer with id=%lld", TWRAP_CONSUMER_PROXY_VIDEO(self)->id);
}
@ -514,9 +510,9 @@ int twrap_consumer_proxy_video_pause(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()) {
ret = videoConsumer->getCallback()->pause();
}
}
@ -528,9 +524,9 @@ int twrap_consumer_proxy_video_stop(tmedia_consumer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoConsumer* videoConsumer;
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()){
if((videoConsumer = manager->findVideoConsumer(TWRAP_CONSUMER_PROXY_VIDEO(self)->id)) && videoConsumer->getCallback()) {
ret = videoConsumer->getCallback()->stop();
}
}
@ -547,14 +543,14 @@ int twrap_consumer_proxy_video_stop(tmedia_consumer_t* self)
static tsk_object_t* twrap_consumer_proxy_video_ctor(tsk_object_t * self, va_list * app)
{
twrap_consumer_proxy_video_t *consumer = (twrap_consumer_proxy_video_t *)self;
if(consumer){
if(consumer) {
/* init base */
tdav_consumer_video_init(TDAV_CONSUMER_VIDEO(consumer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
ProxyPlugin* proxyConsumer = new ProxyVideoConsumer(ProxyVideoConsumer::getDefaultChroma(), consumer);
uint64_t id = proxyConsumer->getId();
manager->addPlugin(&proxyConsumer);
@ -567,10 +563,10 @@ static tsk_object_t* twrap_consumer_proxy_video_ctor(tsk_object_t * self, va_lis
static tsk_object_t* twrap_consumer_proxy_video_dtor(tsk_object_t * self)
{
twrap_consumer_proxy_video_t *consumer = (twrap_consumer_proxy_video_t *)self;
if(consumer){
if(consumer) {
/* stop */
if(consumer->started){
if(consumer->started) {
twrap_consumer_proxy_video_stop(TMEDIA_CONSUMER(consumer));
}
@ -580,7 +576,7 @@ static tsk_object_t* twrap_consumer_proxy_video_dtor(tsk_object_t * self)
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
manager->getCallback()->OnPluginDestroyed(consumer->id, twrap_proxy_plugin_video_consumer);
manager->removePlugin(consumer->id);
}
@ -589,16 +585,14 @@ static tsk_object_t* twrap_consumer_proxy_video_dtor(tsk_object_t * self)
return self;
}
/* object definition */
static const tsk_object_def_t twrap_consumer_proxy_video_def_s =
{
static const tsk_object_def_t twrap_consumer_proxy_video_def_s = {
sizeof(twrap_consumer_proxy_video_t),
twrap_consumer_proxy_video_ctor,
twrap_consumer_proxy_video_dtor,
tsk_null,
};
/* plugin definition*/
static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_video_plugin_def_s =
{
static const tmedia_consumer_plugin_def_t twrap_consumer_proxy_video_plugin_def_s = {
&twrap_consumer_proxy_video_def_s,
tmedia_video,
@ -621,11 +615,11 @@ tmedia_chroma_t ProxyVideoConsumer::s_eDefaultChroma = tmedia_chroma_rgb565le;
bool ProxyVideoConsumer::s_bAutoResizeDisplay = false;
ProxyVideoConsumer::ProxyVideoConsumer(tmedia_chroma_t eChroma, struct twrap_consumer_proxy_video_s* pConsumer)
: m_eChroma(eChroma),
m_bAutoResizeDisplay(ProxyVideoConsumer::getDefaultAutoResizeDisplay()),
m_pWrappedPlugin(pConsumer),
m_pCallback(tsk_null),
ProxyPlugin(twrap_proxy_plugin_video_consumer)
: m_eChroma(eChroma),
m_bAutoResizeDisplay(ProxyVideoConsumer::getDefaultAutoResizeDisplay()),
m_pWrappedPlugin(pConsumer),
m_pCallback(tsk_null),
ProxyPlugin(twrap_proxy_plugin_video_consumer)
{
m_pWrappedPlugin->id = this->getId();
m_ConsumeBuffer.pConsumeBufferPtr = tsk_null;
@ -638,7 +632,7 @@ ProxyVideoConsumer::~ProxyVideoConsumer()
bool ProxyVideoConsumer::setDisplaySize(unsigned nWidth, unsigned nHeight)
{
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.width = nWidth;
TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.height = nHeight;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
@ -651,11 +645,11 @@ bool ProxyVideoConsumer::setDisplaySize(unsigned nWidth, unsigned nHeight)
unsigned ProxyVideoConsumer::getDisplayWidth()
{
unsigned displayWidth = 0;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
displayWidth = TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.width;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
}
else{
else {
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
}
return displayWidth;
@ -664,11 +658,11 @@ unsigned ProxyVideoConsumer::getDisplayWidth()
unsigned ProxyVideoConsumer::getDisplayHeight()
{
unsigned displayHeight = 0;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
displayHeight = TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.height;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
}
else{
else {
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
}
return displayHeight;
@ -677,11 +671,11 @@ unsigned ProxyVideoConsumer::getDisplayHeight()
unsigned ProxyVideoConsumer::getDecodedWidth()
{
unsigned width = 0;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
width = TMEDIA_CONSUMER(m_pWrappedPlugin)->video.in.width;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
}
else{
else {
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
}
return width;
@ -690,11 +684,11 @@ unsigned ProxyVideoConsumer::getDecodedWidth()
unsigned ProxyVideoConsumer::getDecodedHeight()
{
unsigned height = 0;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
height = TMEDIA_CONSUMER(m_pWrappedPlugin)->video.in.height;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
}
else{
else {
TSK_DEBUG_ERROR("This consumer doesn't wrap any plugin");
}
return height;
@ -705,8 +699,9 @@ tmedia_chroma_t ProxyVideoConsumer::getChroma()const
return m_eChroma;
}
bool ProxyVideoConsumer::setAutoResizeDisplay(bool bAutoResizeDisplay){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
bool ProxyVideoConsumer::setAutoResizeDisplay(bool bAutoResizeDisplay)
{
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
TMEDIA_CONSUMER(m_pWrappedPlugin)->video.display.auto_resize = bAutoResizeDisplay ? tsk_true : tsk_false;
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
m_bAutoResizeDisplay = bAutoResizeDisplay;
@ -731,7 +726,7 @@ bool ProxyVideoConsumer::setConsumeBuffer(const void* pConsumeBufferPtr, unsigne
unsigned ProxyVideoConsumer::copyBuffer(const void* pBuffer, unsigned nSize)const
{
unsigned nRetsize = 0;
if(pBuffer && nSize && m_ConsumeBuffer.pConsumeBufferPtr && m_ConsumeBuffer.nConsumeBufferSize){
if(pBuffer && nSize && m_ConsumeBuffer.pConsumeBufferPtr && m_ConsumeBuffer.nConsumeBufferSize) {
nRetsize = (nSize > m_ConsumeBuffer.nConsumeBufferSize) ? m_ConsumeBuffer.nConsumeBufferSize : nSize;
memcpy((void*)m_ConsumeBuffer.pConsumeBufferPtr, pBuffer, nRetsize);
}
@ -740,10 +735,10 @@ unsigned ProxyVideoConsumer::copyBuffer(const void* pBuffer, unsigned nSize)cons
unsigned ProxyVideoConsumer::pull(void* pOutput, unsigned nSize)
{
if(pOutput && nSize && (m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if(pOutput && nSize && (m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
tsk_size_t nRetSize = 0;
if(!tdav_consumer_video_has_jb(TDAV_CONSUMER_VIDEO(m_pWrappedPlugin))){
if(!tdav_consumer_video_has_jb(TDAV_CONSUMER_VIDEO(m_pWrappedPlugin))) {
TSK_DEBUG_ERROR("This consumer doesn't hold any jitter buffer.\n\nTo pull a buffer you must register a callback ('class ProxyVideoConsumerCallback') and listen for either 'consume' or 'bufferCopied' functions");
goto done;
}
@ -762,11 +757,11 @@ done:
bool ProxyVideoConsumer::reset()
{
bool ret = false;
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))){
if(tdav_consumer_video_has_jb(TDAV_CONSUMER_VIDEO(m_pWrappedPlugin))){
if((m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_ref(m_pWrappedPlugin))) {
if(tdav_consumer_video_has_jb(TDAV_CONSUMER_VIDEO(m_pWrappedPlugin))) {
ret = (tdav_consumer_video_reset(TDAV_CONSUMER_VIDEO(m_pWrappedPlugin)) == 0);
}
else{
else {
TSK_DEBUG_ERROR("This consumer doesn't hold any jitter buffer");
}
m_pWrappedPlugin = (twrap_consumer_proxy_video_t*)tsk_object_unref(m_pWrappedPlugin);
@ -807,7 +802,7 @@ unsigned ProxyVideoFrame::getSize()
unsigned ProxyVideoFrame::getContent(void* pOutput, unsigned nMaxsize)
{
unsigned nRetsize = 0;
if(pOutput && nMaxsize && m_pBufferPtr){
if(pOutput && nMaxsize && m_pBufferPtr) {
nRetsize = (m_nBufferSize > nMaxsize) ? nMaxsize : m_nBufferSize;
memcpy(pOutput, m_pBufferPtr, nRetsize);
}

View File

@ -42,19 +42,33 @@ class ProxyAudioConsumerCallback
{
public:
ProxyAudioConsumerCallback() { }
virtual ~ProxyAudioConsumerCallback(){ }
virtual ~ProxyAudioConsumerCallback() { }
virtual int prepare(int ptime, int rate, int channels) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
virtual int prepare(int ptime, int rate, int channels) {
return -1;
}
virtual int start() {
return -1;
}
virtual int pause() {
return -1;
}
virtual int stop() {
return -1;
}
#if !defined(SWIG)
// whether the audio buffer have to be stored in the JB then pulled using "ProxyAudioConsumer::pull()" or not
virtual bool putInJitterBuffer(){ return true; }
virtual bool putInJitterBuffer() {
return true;
}
// whether we are using the "telepresence" system (PIVOT audio settings must not be changed)
virtual bool isPivotSettings() { return false; }
virtual bool isPivotSettings() {
return false;
}
// only called if "putInJitterBuffer()" return "true"
virtual int consume(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr){ return -1; }
virtual int consume(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr) {
return -1;
}
#endif
};
@ -73,14 +87,18 @@ public:
bool setGain(unsigned nGain);
unsigned getGain();
bool reset();
void setCallback(ProxyAudioConsumerCallback* pCallback) { m_pCallback = pCallback; }
void setCallback(ProxyAudioConsumerCallback* pCallback) {
m_pCallback = pCallback;
}
#if !defined(SWIG)
inline ProxyAudioConsumerCallback* getCallback()const { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* pWrappedPlugin){
inline ProxyAudioConsumerCallback* getCallback()const {
return m_pCallback;
}
virtual inline bool isWrapping(tsk_object_t* pWrappedPlugin) {
return m_pWrappedPlugin == pWrappedPlugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
virtual inline uint64_t getMediaSessionId() {
return m_pWrappedPlugin ? TMEDIA_CONSUMER(m_pWrappedPlugin)->session_id : 0;
}
@ -90,12 +108,12 @@ public:
private:
struct twrap_consumer_proxy_audio_s* m_pWrappedPlugin;
ProxyAudioConsumerCallback* m_pCallback;
struct{
struct {
const void* pPullBufferPtr;
unsigned nPullBufferSize;
} m_PullBuffer;
struct{
struct {
void* pInBufferPtr;
unsigned nInBufferSizeInByte;
AudioResampler* pResampler;
@ -108,16 +126,28 @@ class ProxyVideoFrame;
class ProxyVideoConsumerCallback
{
public:
ProxyVideoConsumerCallback(){}
ProxyVideoConsumerCallback() {}
virtual ~ProxyVideoConsumerCallback() {}
virtual int prepare(int nWidth, int nHeight, int nFps) { return -1; }
virtual int consume(const ProxyVideoFrame* frame) { return -1; }
virtual int prepare(int nWidth, int nHeight, int nFps) {
return -1;
}
virtual int consume(const ProxyVideoFrame* frame) {
return -1;
}
// only called if a buffer is registered using setPullBuffer(). Otherwise, consume() will be called
virtual int bufferCopied(unsigned nCopiedSize, unsigned nAvailableSize) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
virtual int bufferCopied(unsigned nCopiedSize, unsigned nAvailableSize) {
return -1;
}
virtual int start() {
return -1;
}
virtual int pause() {
return -1;
}
virtual int stop() {
return -1;
}
};
/* ============ ProxyVideoConsumer Class ================= */
@ -135,7 +165,9 @@ public:
unsigned getDecodedWidth();
unsigned getDecodedHeight();
void setCallback(ProxyVideoConsumerCallback* pCallback) { m_pCallback = pCallback; }
void setCallback(ProxyVideoConsumerCallback* pCallback) {
m_pCallback = pCallback;
}
bool setAutoResizeDisplay(bool bAutoResizeDisplay);
bool getAutoResizeDisplay()const;
bool setConsumeBuffer(const void* pConsumeBufferPtr, unsigned nConsumeBufferSize);
@ -143,33 +175,45 @@ public:
bool reset();
#if !defined(SWIG)
bool hasConsumeBuffer()const { return m_ConsumeBuffer.pConsumeBufferPtr && m_ConsumeBuffer.nConsumeBufferSize; }
bool hasConsumeBuffer()const {
return m_ConsumeBuffer.pConsumeBufferPtr && m_ConsumeBuffer.nConsumeBufferSize;
}
unsigned copyBuffer(const void* pBuffer, unsigned nSize)const;
inline ProxyVideoConsumerCallback* getCallback()const { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin){
inline ProxyVideoConsumerCallback* getCallback()const {
return m_pCallback;
}
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin) {
return m_pWrappedPlugin == wrapped_plugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
virtual inline uint64_t getMediaSessionId() {
return m_pWrappedPlugin ? TMEDIA_CONSUMER(m_pWrappedPlugin)->session_id : 0;
}
public:
static bool registerPlugin();
static void setDefaultChroma(tmedia_chroma_t eChroma){ s_eDefaultChroma = eChroma; }
static void setDefaultAutoResizeDisplay(bool bAutoResizeDisplay){ s_bAutoResizeDisplay = bAutoResizeDisplay;}
static void setDefaultChroma(tmedia_chroma_t eChroma) {
s_eDefaultChroma = eChroma;
}
static void setDefaultAutoResizeDisplay(bool bAutoResizeDisplay) {
s_bAutoResizeDisplay = bAutoResizeDisplay;
}
#if !defined(SWIG)
tmedia_chroma_t getChroma()const;
static tmedia_chroma_t getDefaultChroma() { return s_eDefaultChroma; }
static bool getDefaultAutoResizeDisplay() { return s_bAutoResizeDisplay; }
static tmedia_chroma_t getDefaultChroma() {
return s_eDefaultChroma;
}
static bool getDefaultAutoResizeDisplay() {
return s_bAutoResizeDisplay;
}
#endif
private:
struct twrap_consumer_proxy_video_s* m_pWrappedPlugin;
tmedia_chroma_t m_eChroma;
ProxyVideoConsumerCallback* m_pCallback;
struct{
struct {
const void* pConsumeBufferPtr;
unsigned nConsumeBufferSize;
} m_ConsumeBuffer;
@ -191,14 +235,24 @@ public:
public: /* For Java/C# applications */
unsigned getSize();
unsigned getContent(void* pOutput, unsigned nMaxsize);
inline unsigned getFrameWidth()const{ return m_nFrameWidth; }
inline unsigned getFrameHeight()const{ return m_nFrameHeight; }
inline unsigned getFrameWidth()const {
return m_nFrameWidth;
}
inline unsigned getFrameHeight()const {
return m_nFrameHeight;
}
#if !defined(SWIG) /* For C/C++ applications */
public:
inline unsigned getBufferSize()const{ return m_nBufferSize; }
inline const void* getBufferPtr()const{ return m_pBufferPtr; }
inline const tsk_object_t* getProtoHdr()const{ return m_pProtoHdr; }
inline unsigned getBufferSize()const {
return m_nBufferSize;
}
inline const void* getBufferPtr()const {
return m_pBufferPtr;
}
inline const tsk_object_t* getProtoHdr()const {
return m_pProtoHdr;
}
#endif
private:

View File

@ -27,8 +27,7 @@
//
// "twrap_proxy_plugin_t" Declarations
//
typedef struct twrap_proxy_plugin_s
{
typedef struct twrap_proxy_plugin_s {
TSK_DECLARE_OBJECT;
ProxyPlugin* plugin;
}
@ -45,17 +44,17 @@ ProxyPluginMgr* ProxyPluginMgr::instance = tsk_null;
static uint64_t __uniqueId = 0;
ProxyPluginMgr::ProxyPluginMgr(ProxyPluginMgrCallback* _callback)
:callback(_callback)
:callback(_callback)
{
this->plugins = tsk_list_create();
if(!this->callback){
if(!this->callback) {
TSK_DEBUG_WARN("Callback function is Null => You will have big problems as we won't check it before call");
}
}
ProxyPluginMgr::~ProxyPluginMgr()
{
if(this == ProxyPluginMgr::instance){
if(this == ProxyPluginMgr::instance) {
ProxyPluginMgr::instance = tsk_null;
}
TSK_OBJECT_SAFE_FREE(this->plugins);
@ -63,10 +62,10 @@ ProxyPluginMgr::~ProxyPluginMgr()
ProxyPluginMgr* ProxyPluginMgr::createInstance(ProxyPluginMgrCallback* pCallback)
{
if(!ProxyPluginMgr::instance){
if(!ProxyPluginMgr::instance) {
ProxyPluginMgr::instance = new ProxyPluginMgr(pCallback);
}
else{
else {
TSK_DEBUG_WARN("Plugin instance already exist");
ProxyPluginMgr::instance->callback = pCallback;
}
@ -75,10 +74,10 @@ ProxyPluginMgr* ProxyPluginMgr::createInstance(ProxyPluginMgrCallback* pCallback
void ProxyPluginMgr::destroyInstance(ProxyPluginMgr** ppInstance)
{
if(ppInstance && *ppInstance){
if(ppInstance && *ppInstance) {
bool bMatch = ProxyPluginMgr::instance && (*ppInstance == ProxyPluginMgr::instance);
delete *ppInstance, *ppInstance = tsk_null;
if(bMatch){
if(bMatch) {
ProxyPluginMgr::instance = tsk_null;
}
}
@ -86,7 +85,7 @@ void ProxyPluginMgr::destroyInstance(ProxyPluginMgr** ppInstance)
ProxyPluginMgr* ProxyPluginMgr::getInstance()
{
if(!ProxyPluginMgr::instance){
if(!ProxyPluginMgr::instance) {
TSK_DEBUG_ERROR("No instance of the manager could be found");
}
return ProxyPluginMgr::instance;
@ -104,21 +103,21 @@ int ProxyPluginMgr::addPlugin(ProxyPlugin** plugin)
tsk_list_lock(this->plugins);
if(!plugin || !*plugin){
if(!plugin || !*plugin) {
TSK_DEBUG_ERROR("Invalid parameter");
goto bail;
}
if(tsk_list_find_item_by_pred(this->plugins, pred_find_plugin_by_value, *plugin)){
if(tsk_list_find_item_by_pred(this->plugins, pred_find_plugin_by_value, *plugin)) {
TSK_DEBUG_ERROR("Plugin already exist");
goto bail;
}
if((twrap_plugin = twrap_proxy_plugin_create(plugin))){
if((twrap_plugin = twrap_proxy_plugin_create(plugin))) {
tsk_list_push_back_data(this->plugins, (void**)&twrap_plugin);
ret = 0;
}
else{
else {
TSK_DEBUG_ERROR("Failed to create plugin");
goto bail;
}
@ -131,7 +130,7 @@ bail:
int ProxyPluginMgr::removePlugin(ProxyPlugin** plugin)
{
if(!plugin || !*plugin){
if(!plugin || !*plugin) {
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -145,8 +144,8 @@ const ProxyPlugin* ProxyPluginMgr::findPlugin(uint64_t id)
tsk_list_item_t* item;
tsk_list_lock(this->plugins);
tsk_list_foreach(item, this->plugins){
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->getId() == id){
tsk_list_foreach(item, this->plugins) {
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->getId() == id) {
ret = TWRAP_PROXY_PLUGIN(item->data)->plugin;
break;
}
@ -162,14 +161,14 @@ const ProxyPlugin* ProxyPluginMgr::findPlugin(tsk_object_t* wrapped_plugin)
tsk_list_item_t* item;
if(!wrapped_plugin){
if(!wrapped_plugin) {
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
tsk_list_lock(this->plugins);
tsk_list_foreach(item, this->plugins){
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->isWrapping(wrapped_plugin)){
tsk_list_foreach(item, this->plugins) {
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->isWrapping(wrapped_plugin)) {
ret = TWRAP_PROXY_PLUGIN(item->data)->plugin;
break;
}
@ -185,8 +184,8 @@ int ProxyPluginMgr::removePlugin(uint64_t id)
tsk_list_lock(this->plugins);
tsk_list_foreach(item, this->plugins){
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->getId() == id){
tsk_list_foreach(item, this->plugins) {
if(TWRAP_PROXY_PLUGIN(item->data)->plugin->getId() == id) {
tsk_list_remove_item(this->plugins, item);
break;
}
@ -199,7 +198,7 @@ int ProxyPluginMgr::removePlugin(uint64_t id)
const ProxyAudioConsumer* ProxyPluginMgr::findAudioConsumer(uint64_t id)
{
const ProxyPlugin* audioConsumer = this->findPlugin(id);
if(audioConsumer && audioConsumer->getType() == twrap_proxy_plugin_audio_consumer){
if(audioConsumer && audioConsumer->getType() == twrap_proxy_plugin_audio_consumer) {
return dyn_cast<const ProxyAudioConsumer*>(audioConsumer);
}
return tsk_null;
@ -208,7 +207,7 @@ const ProxyAudioConsumer* ProxyPluginMgr::findAudioConsumer(uint64_t id)
const ProxyVideoConsumer* ProxyPluginMgr::findVideoConsumer(uint64_t id)
{
const ProxyPlugin* videoConsumer = this->findPlugin(id);
if(videoConsumer && videoConsumer->getType() == twrap_proxy_plugin_video_consumer){
if(videoConsumer && videoConsumer->getType() == twrap_proxy_plugin_video_consumer) {
return dyn_cast<const ProxyVideoConsumer*>(videoConsumer);
}
return tsk_null;
@ -217,7 +216,7 @@ const ProxyVideoConsumer* ProxyPluginMgr::findVideoConsumer(uint64_t id)
const ProxyAudioProducer* ProxyPluginMgr::findAudioProducer(uint64_t id)
{
const ProxyPlugin* audioProducer = this->findPlugin(id);
if(audioProducer && audioProducer->getType() == twrap_proxy_plugin_audio_producer){
if(audioProducer && audioProducer->getType() == twrap_proxy_plugin_audio_producer) {
return dyn_cast<const ProxyAudioProducer*>(audioProducer);
}
return tsk_null;
@ -226,7 +225,7 @@ const ProxyAudioProducer* ProxyPluginMgr::findAudioProducer(uint64_t id)
const ProxyVideoProducer* ProxyPluginMgr::findVideoProducer(uint64_t id)
{
const ProxyPlugin* videoProducer = this->findPlugin(id);
if(videoProducer && videoProducer->getType() == twrap_proxy_plugin_video_producer){
if(videoProducer && videoProducer->getType() == twrap_proxy_plugin_video_producer) {
return dyn_cast<const ProxyVideoProducer*>(videoProducer);
}
return tsk_null;
@ -239,7 +238,7 @@ const ProxyVideoProducer* ProxyPluginMgr::findVideoProducer(uint64_t id)
static tsk_object_t* twrap_proxy_plugin_ctor(tsk_object_t * self, va_list * app)
{
twrap_proxy_plugin_t *_self = dyn_cast<twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(self));
if(_self){
if(_self) {
}
return self;
}
@ -247,8 +246,8 @@ static tsk_object_t* twrap_proxy_plugin_ctor(tsk_object_t * self, va_list * app)
static tsk_object_t* twrap_proxy_plugin_dtor(tsk_object_t * self)
{
twrap_proxy_plugin_t *_self = dyn_cast<twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(self));
if(_self){
if(_self->plugin){
if(_self) {
if(_self->plugin) {
delete _self->plugin, _self->plugin = tsk_null;
}
}
@ -261,15 +260,18 @@ static int twrap_proxy_plugin_cmp(const tsk_object_t *_c1, const tsk_object_t *_
const twrap_proxy_plugin_t *c1 = dyn_cast<const twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(_c1));
const twrap_proxy_plugin_t *c2 = dyn_cast<const twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(_c2));
if(c1 && c2){
if(c1 && c2) {
return (c1->plugin == c2->plugin); // See "ProxyPlugin::operator =="
}
else if(!c1 && !c2) return 0;
else return -1;
else if(!c1 && !c2) {
return 0;
}
else {
return -1;
}
}
static const tsk_object_def_t twrap_proxy_plugin_def_s =
{
static const tsk_object_def_t twrap_proxy_plugin_def_s = {
sizeof(twrap_proxy_plugin_t),
twrap_proxy_plugin_ctor,
twrap_proxy_plugin_dtor,
@ -279,7 +281,7 @@ const tsk_object_def_t *twrap_proxy_plugin_def_t = &twrap_proxy_plugin_def_s;
static int pred_find_plugin_by_value(const tsk_list_item_t *item, const void *proxyPlugin)
{
if(item && item->data){
if(item && item->data) {
const twrap_proxy_plugin_t *twrap_plugin = dyn_cast<const twrap_proxy_plugin_t *>(TWRAP_PROXY_PLUGIN(item->data));
return (twrap_plugin->plugin == dyn_cast<const ProxyPlugin *>((const ProxyPlugin*)proxyPlugin)) ? 0 : -1;
}
@ -288,13 +290,13 @@ static int pred_find_plugin_by_value(const tsk_list_item_t *item, const void *pr
static twrap_proxy_plugin_t* twrap_proxy_plugin_create(ProxyPlugin** plugin)
{
if(!plugin || !*plugin){
if(!plugin || !*plugin) {
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
twrap_proxy_plugin_t* twrap_plugin = (twrap_proxy_plugin_t*)tsk_object_new(twrap_proxy_plugin_def_t);
if(!twrap_plugin){
if(!twrap_plugin) {
TSK_DEBUG_ERROR("Failed to create new instance of 'twrap_proxy_plugin_t'");
return tsk_null;
}

View File

@ -33,8 +33,7 @@ class ProxyAudioProducer;
class ProxyVideoProducer;
class ProxyPluginMgrCallback;
typedef enum twrap_proxy_plugin_type_e
{
typedef enum twrap_proxy_plugin_type_e {
twrap_proxy_plugin_audio_producer,
twrap_proxy_plugin_video_producer,
twrap_proxy_plugin_audio_consumer,
@ -68,7 +67,9 @@ public:
int removePlugin(uint64_t id);
int removePlugin(ProxyPlugin**);
inline ProxyPluginMgrCallback* getCallback(){ return this->callback; }
inline ProxyPluginMgrCallback* getCallback() {
return this->callback;
}
#endif
const ProxyPlugin* findPlugin(uint64_t id);
@ -93,8 +94,12 @@ public:
ProxyPluginMgrCallback() { }
virtual ~ProxyPluginMgrCallback() { }
virtual int OnPluginCreated(uint64_t id, enum twrap_proxy_plugin_type_e type) { return -1; }
virtual int OnPluginDestroyed(uint64_t id, enum twrap_proxy_plugin_type_e type) { return -1; }
virtual int OnPluginCreated(uint64_t id, enum twrap_proxy_plugin_type_e type) {
return -1;
}
virtual int OnPluginDestroyed(uint64_t id, enum twrap_proxy_plugin_type_e type) {
return -1;
}
};
/* ============ ProxyPlugin Class ================= */
@ -110,15 +115,19 @@ public:
virtual ~ProxyPlugin() {}
#if !defined(SWIG)
virtual bool operator ==(const ProxyPlugin &plugin)const{
virtual bool operator ==(const ProxyPlugin &plugin)const {
return this->getId() == plugin.getId();
}
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin) = 0;
virtual inline uint64_t getMediaSessionId() = 0;
#endif
inline twrap_proxy_plugin_type_t getType()const{ return this->type; }
inline uint64_t getId()const{ return this->id; }
inline twrap_proxy_plugin_type_t getType()const {
return this->type;
}
inline uint64_t getId()const {
return this->id;
}
protected:
uint64_t id;

View File

@ -37,8 +37,7 @@
/* ============ Audio Media Producer Interface ================= */
typedef struct twrap_producer_proxy_audio_s
{
typedef struct twrap_producer_proxy_audio_s {
TDAV_DECLARE_PRODUCER_AUDIO;
uint64_t id;
@ -50,7 +49,7 @@ twrap_producer_proxy_audio_t;
static int twrap_producer_proxy_audio_set(tmedia_producer_t* _self, const tmedia_param_t* param)
{
twrap_producer_proxy_audio_t* self = (twrap_producer_proxy_audio_t*)_self;
if(param->plugin_type == tmedia_ppt_producer){
if(param->plugin_type == tmedia_ppt_producer) {
// specific proxy producer
}
return tdav_producer_audio_set(TDAV_PRODUCER_AUDIO(self), param);
@ -60,9 +59,9 @@ static int twrap_producer_proxy_audio_prepare(tmedia_producer_t* self, const tme
{
ProxyPluginMgr* manager;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
if(codec && (manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()) {
self->audio.channels = TMEDIA_CODEC_CHANNELS_AUDIO_ENCODING(codec);
self->audio.rate = TMEDIA_CODEC_RATE_ENCODING(codec);
self->audio.ptime = TMEDIA_CODEC_PTIME_AUDIO_ENCODING(codec);
@ -76,9 +75,9 @@ static int twrap_producer_proxy_audio_start(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()) {
const_cast<ProxyAudioProducer*>(audioProducer)->startPushCallback();
ret = audioProducer->getCallback()->start();
}
@ -92,9 +91,9 @@ static int twrap_producer_proxy_audio_pause(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()) {
ret = audioProducer->getCallback()->pause();
}
}
@ -105,9 +104,9 @@ static int twrap_producer_proxy_audio_stop(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyAudioProducer* audioProducer;
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()){
if((audioProducer = manager->findAudioProducer(TWRAP_PRODUCER_PROXY_AUDIO(self)->id)) && audioProducer->getCallback()) {
const_cast<ProxyAudioProducer*>(audioProducer)->stopPushCallback();
ret = audioProducer->getCallback()->stop();
}
@ -124,14 +123,14 @@ static int twrap_producer_proxy_audio_stop(tmedia_producer_t* self)
static tsk_object_t* twrap_producer_proxy_audio_ctor(tsk_object_t * self, va_list * app)
{
twrap_producer_proxy_audio_t *producer = (twrap_producer_proxy_audio_t *)self;
if(producer){
if(producer) {
/* init base */
tdav_producer_audio_init(TDAV_PRODUCER_AUDIO(producer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
ProxyPlugin* proxyProducer = new ProxyAudioProducer(producer);
uint64_t id = proxyProducer->getId();
manager->addPlugin(&proxyProducer);
@ -144,10 +143,10 @@ static tsk_object_t* twrap_producer_proxy_audio_ctor(tsk_object_t * self, va_lis
static tsk_object_t* twrap_producer_proxy_audio_dtor(tsk_object_t * self)
{
twrap_producer_proxy_audio_t *producer = (twrap_producer_proxy_audio_t *)self;
if(producer){
if(producer) {
/* stop */
if(producer->started){
if(producer->started) {
twrap_producer_proxy_audio_stop(TMEDIA_PRODUCER(producer));
}
@ -157,7 +156,7 @@ static tsk_object_t* twrap_producer_proxy_audio_dtor(tsk_object_t * self)
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
manager->getCallback()->OnPluginDestroyed(producer->id, twrap_proxy_plugin_audio_producer);
manager->removePlugin(producer->id);
}
@ -166,16 +165,14 @@ static tsk_object_t* twrap_producer_proxy_audio_dtor(tsk_object_t * self)
return self;
}
/* object definition */
static const tsk_object_def_t twrap_producer_proxy_audio_def_s =
{
static const tsk_object_def_t twrap_producer_proxy_audio_def_s = {
sizeof(twrap_producer_proxy_audio_t),
twrap_producer_proxy_audio_ctor,
twrap_producer_proxy_audio_dtor,
tdav_producer_audio_cmp,
};
/* plugin definition*/
static const tmedia_producer_plugin_def_t twrap_producer_proxy_audio_plugin_def_s =
{
static const tmedia_producer_plugin_def_t twrap_producer_proxy_audio_plugin_def_s = {
&twrap_producer_proxy_audio_def_s,
tmedia_audio,
@ -194,7 +191,7 @@ static const tmedia_producer_plugin_def_t twrap_producer_proxy_audio_plugin_def_
/* ============ ProxyAudioProducer Class ================= */
ProxyAudioProducer::ProxyAudioProducer(twrap_producer_proxy_audio_t* pProducer)
:m_pCallback(tsk_null), m_pWrappedPlugin(pProducer), m_bUsePushCallback(false), m_hPushTimerMgr(tsk_null), ProxyPlugin(twrap_proxy_plugin_audio_producer)
:m_pCallback(tsk_null), m_pWrappedPlugin(pProducer), m_bUsePushCallback(false), m_hPushTimerMgr(tsk_null), ProxyPlugin(twrap_proxy_plugin_audio_producer)
{
m_pWrappedPlugin->id = this->getId();
m_PushBuffer.pPushBufferPtr = tsk_null;
@ -209,14 +206,14 @@ ProxyAudioProducer::~ProxyAudioProducer()
// Use this function to request resampling when your sound card can't honor negotaited record parameters
bool ProxyAudioProducer::setActualSndCardRecordParams(int nPtime, int nRate, int nChannels)
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
TSK_DEBUG_INFO("setActualSndCardRecordParams(ptime=%d, rate=%d, channels=%d)", nPtime, nRate, nChannels);
TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.ptime = nPtime;
TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.rate = nRate;
TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.channels = nChannels;
return true;
}
else{
else {
TSK_DEBUG_ERROR("Invalid state");
return false;
}
@ -228,10 +225,10 @@ bool ProxyAudioProducer::setPushBuffer(const void* pPushBufferPtr, unsigned nPus
m_PushBuffer.nPushBufferSize = nPushBufferSize;
m_bUsePushCallback = bUsePushCallback;
if(!pPushBufferPtr || !nPushBufferSize || !bUsePushCallback){
if(!pPushBufferPtr || !nPushBufferSize || !bUsePushCallback) {
return stopPushCallback();
}
else if(m_bUsePushCallback && m_pWrappedPlugin && m_pWrappedPlugin->started){
else if(m_bUsePushCallback && m_pWrappedPlugin && m_pWrappedPlugin->started) {
return startPushCallback();
}
return true;
@ -239,13 +236,13 @@ bool ProxyAudioProducer::setPushBuffer(const void* pPushBufferPtr, unsigned nPus
int ProxyAudioProducer::push(const void* _pBuffer/*=tsk_null*/, unsigned _nSize/*=0*/)
{
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback){
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback) {
const void* pBuffer;
unsigned nSize;
if(_pBuffer && _nSize){
if(_pBuffer && _nSize) {
pBuffer = _pBuffer, nSize = _nSize;
}
else{
else {
pBuffer = m_PushBuffer.pPushBufferPtr, nSize = m_PushBuffer.nPushBufferSize;
}
return TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback(TMEDIA_PRODUCER(m_pWrappedPlugin)->enc_cb.callback_data, pBuffer, nSize);
@ -255,7 +252,7 @@ int ProxyAudioProducer::push(const void* _pBuffer/*=tsk_null*/, unsigned _nSize/
bool ProxyAudioProducer::setGain(unsigned nGain)
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
// see also: MediaSessionMgr.producerSetInt32(org.doubango.tinyWRAP.twrap_media_type_t.twrap_media_audio, "gain", nGain);
TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.gain = TSK_MIN(nGain,14);
return true;
@ -265,7 +262,7 @@ bool ProxyAudioProducer::setGain(unsigned nGain)
unsigned ProxyAudioProducer::getGain()
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
return TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.gain;
}
return 0;
@ -273,27 +270,27 @@ unsigned ProxyAudioProducer::getGain()
bool ProxyAudioProducer::startPushCallback()
{
if(!m_bUsePushCallback){
if(!m_bUsePushCallback) {
return true;
}
if(!m_pWrappedPlugin){
if(!m_pWrappedPlugin) {
TSK_DEBUG_ERROR("Not wrapping plugin");
return false;
}
if(!m_hPushTimerMgr){
if(!(m_hPushTimerMgr = tsk_timer_manager_create())){
if(!m_hPushTimerMgr) {
if(!(m_hPushTimerMgr = tsk_timer_manager_create())) {
TSK_DEBUG_ERROR("Failed to create timer manager");
return false;
}
}
if(!TSK_RUNNABLE(m_hPushTimerMgr)->started){
if((tsk_timer_manager_start(m_hPushTimerMgr)) == 0){
if(!TSK_RUNNABLE(m_hPushTimerMgr)->started) {
if((tsk_timer_manager_start(m_hPushTimerMgr)) == 0) {
m_uPushTimer = tsk_timer_manager_schedule(m_hPushTimerMgr, TMEDIA_PRODUCER(m_pWrappedPlugin)->audio.ptime, &ProxyAudioProducer::pushTimerCallback, this);
}
else{
else {
TSK_DEBUG_ERROR("Failed to start timer");
return false;
}
@ -303,7 +300,7 @@ bool ProxyAudioProducer::startPushCallback()
bool ProxyAudioProducer::stopPushCallback()
{
if(m_hPushTimerMgr){
if(m_hPushTimerMgr) {
tsk_timer_manager_destroy(&m_hPushTimerMgr);
}
return true;
@ -315,8 +312,8 @@ int ProxyAudioProducer::pushTimerCallback(const void* arg, tsk_timer_id_t timer_
This->m_uPushTimer = tsk_timer_manager_schedule(This->m_hPushTimerMgr, TMEDIA_PRODUCER(This->m_pWrappedPlugin)->audio.ptime, &ProxyAudioProducer::pushTimerCallback, This);
if(This->m_pCallback){
if(This->m_pCallback->fillPushBuffer() == 0){
if(This->m_pCallback) {
if(This->m_pCallback->fillPushBuffer() == 0) {
return This->push();
}
}
@ -354,8 +351,7 @@ bool ProxyAudioProducer::registerPlugin()
/* ============ Video Media Producer Interface ================= */
typedef struct twrap_producer_proxy_video_s
{
typedef struct twrap_producer_proxy_video_s {
TMEDIA_DECLARE_PRODUCER;
int rotation;
@ -380,9 +376,9 @@ int twrap_producer_proxy_video_prepare(tmedia_producer_t* self, const tmedia_cod
{
ProxyPluginMgr* manager;
int ret = -1;
if(codec && (manager = ProxyPluginMgr::getInstance())){
if(codec && (manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()) {
self->video.chroma = videoProducer->getChroma();
self->video.rotation = videoProducer->getRotation();
ret = videoProducer->getCallback()->prepare(TMEDIA_CODEC_VIDEO(codec)->out.width, TMEDIA_CODEC_VIDEO(codec)->out.height, TMEDIA_CODEC_VIDEO(codec)->out.fps);
@ -396,9 +392,9 @@ int twrap_producer_proxy_video_start(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()) {
ret = videoProducer->getCallback()->start();
TWRAP_PRODUCER_PROXY_VIDEO(self)->started = (ret == 0);
}
@ -411,9 +407,9 @@ int twrap_producer_proxy_video_pause(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()) {
ret = videoProducer->getCallback()->pause();
}
}
@ -425,9 +421,9 @@ int twrap_producer_proxy_video_stop(tmedia_producer_t* self)
{
ProxyPluginMgr* manager;
int ret = -1;
if((manager = ProxyPluginMgr::getInstance())){
if((manager = ProxyPluginMgr::getInstance())) {
const ProxyVideoProducer* videoProducer;
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()){
if((videoProducer = manager->findVideoProducer(TWRAP_PRODUCER_PROXY_VIDEO(self)->id)) && videoProducer->getCallback()) {
ret = videoProducer->getCallback()->stop();
TWRAP_PRODUCER_PROXY_VIDEO(self)->started = ((ret == 0) ? tsk_false : tsk_true);
}
@ -444,14 +440,14 @@ int twrap_producer_proxy_video_stop(tmedia_producer_t* self)
static tsk_object_t* twrap_producer_proxy_video_ctor(tsk_object_t * self, va_list * app)
{
twrap_producer_proxy_video_t *producer = (twrap_producer_proxy_video_t *)self;
if(producer){
if(producer) {
/* init base */
tmedia_producer_init(TMEDIA_PRODUCER(producer));
/* init self */
/* Add the plugin to the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
ProxyPlugin* proxyProducer = new ProxyVideoProducer(ProxyVideoProducer::getDefaultChroma(), producer);
uint64_t id = proxyProducer->getId();
manager->addPlugin(&proxyProducer);
@ -464,10 +460,10 @@ static tsk_object_t* twrap_producer_proxy_video_ctor(tsk_object_t * self, va_lis
static tsk_object_t* twrap_producer_proxy_video_dtor(tsk_object_t * self)
{
twrap_producer_proxy_video_t *producer = (twrap_producer_proxy_video_t *)self;
if(producer){
if(producer) {
TSK_DEBUG_INFO("twrap_producer_proxy_video_dtor()");
/* stop */
if(producer->started){
if(producer->started) {
twrap_producer_proxy_video_stop(TMEDIA_PRODUCER(producer));
}
@ -477,7 +473,7 @@ static tsk_object_t* twrap_producer_proxy_video_dtor(tsk_object_t * self)
/* Remove plugin from the manager */
ProxyPluginMgr* manager = ProxyPluginMgr::getInstance();
if(manager){
if(manager) {
manager->getCallback()->OnPluginDestroyed(producer->id, twrap_proxy_plugin_video_producer);
manager->removePlugin(producer->id);
}
@ -486,16 +482,14 @@ static tsk_object_t* twrap_producer_proxy_video_dtor(tsk_object_t * self)
return self;
}
/* object definition */
static const tsk_object_def_t twrap_producer_proxy_video_def_s =
{
static const tsk_object_def_t twrap_producer_proxy_video_def_s = {
sizeof(twrap_producer_proxy_video_t),
twrap_producer_proxy_video_ctor,
twrap_producer_proxy_video_dtor,
tsk_null,
};
/* plugin definition*/
static const tmedia_producer_plugin_def_t twrap_producer_proxy_video_plugin_def_s =
{
static const tmedia_producer_plugin_def_t twrap_producer_proxy_video_plugin_def_s = {
&twrap_producer_proxy_video_def_s,
tmedia_video,
@ -516,9 +510,9 @@ static const tmedia_producer_plugin_def_t twrap_producer_proxy_video_plugin_def_
tmedia_chroma_t ProxyVideoProducer::s_eDefaultChroma = tmedia_chroma_nv21;
ProxyVideoProducer::ProxyVideoProducer(tmedia_chroma_t eChroma, struct twrap_producer_proxy_video_s* pProducer)
:m_pCallback(tsk_null), m_eChroma(eChroma), m_nRotation(0), m_bMirror(false), m_pWrappedPlugin(pProducer), ProxyPlugin(twrap_proxy_plugin_video_producer)
:m_pCallback(tsk_null), m_eChroma(eChroma), m_nRotation(0), m_bMirror(false), m_pWrappedPlugin(pProducer), ProxyPlugin(twrap_proxy_plugin_video_producer)
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
m_pWrappedPlugin->id = this->getId();
}
}
@ -562,7 +556,7 @@ bool ProxyVideoProducer::setMirror(bool bMirror)
// this function is only needed if the actual size (output from your camera) is different than the negociated one
bool ProxyVideoProducer::setActualCameraOutputSize(unsigned nWidth, unsigned nHeight)
{
if(m_pWrappedPlugin){
if(m_pWrappedPlugin) {
TMEDIA_PRODUCER(m_pWrappedPlugin)->video.width = nWidth;
TMEDIA_PRODUCER(m_pWrappedPlugin)->video.height = nHeight;
return true;
@ -587,7 +581,7 @@ int ProxyVideoProducer::push(const void* pBuffer, unsigned nSize)
// only used by telepresence system with a H.264 SVC hardaware encoder
int ProxyVideoProducer::sendRaw(const void* pBuffer, unsigned nSize, unsigned nDuration, bool bMarker)
{
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.callback){
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.callback) {
//tmedia_video_encode_result_reset(&TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.chunck_curr);
TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.chunck_curr.buffer.ptr = pBuffer;
@ -601,7 +595,7 @@ int ProxyVideoProducer::sendRaw(const void* pBuffer, unsigned nSize, unsigned nD
int ProxyVideoProducer::sendRaw(const void* pBuffer, unsigned nSize, const void* proto_hdr)
{
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.callback){
if(m_pWrappedPlugin && TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.callback) {
//tmedia_video_encode_result_reset(&TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.chunck_curr);
TMEDIA_PRODUCER(m_pWrappedPlugin)->raw_cb.chunck_curr.buffer.ptr = pBuffer;

View File

@ -42,14 +42,24 @@ class ProxyAudioProducerCallback
{
public:
ProxyAudioProducerCallback() { }
virtual ~ProxyAudioProducerCallback(){ }
virtual ~ProxyAudioProducerCallback() { }
virtual int prepare(int ptime, int rate, int channels) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
virtual int prepare(int ptime, int rate, int channels) {
return -1;
}
virtual int start() {
return -1;
}
virtual int pause() {
return -1;
}
virtual int stop() {
return -1;
}
// this function is called to signal that it's time to copy push data
virtual int fillPushBuffer(){ return -1; }
virtual int fillPushBuffer() {
return -1;
}
};
@ -67,15 +77,21 @@ public:
int push(const void* pBuffer=tsk_null, unsigned nSize=0);
bool setGain(unsigned nGain);
unsigned getGain();
void setCallback(ProxyAudioProducerCallback* pCallback) { m_pCallback = pCallback; }
void setCallback(ProxyAudioProducerCallback* pCallback) {
m_pCallback = pCallback;
}
#if !defined(SWIG)
inline bool usePushCallback(){ return m_bUsePushCallback; }
inline ProxyAudioProducerCallback* getCallback()const { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* pWrappedPlugin){
inline bool usePushCallback() {
return m_bUsePushCallback;
}
inline ProxyAudioProducerCallback* getCallback()const {
return m_pCallback;
}
virtual inline bool isWrapping(tsk_object_t* pWrappedPlugin) {
return m_pWrappedPlugin == pWrappedPlugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
virtual inline uint64_t getMediaSessionId() {
return m_pWrappedPlugin ? TMEDIA_PRODUCER(m_pWrappedPlugin)->session_id : 0;
}
@ -93,7 +109,7 @@ public:
private:
struct twrap_producer_proxy_audio_s* m_pWrappedPlugin;
ProxyAudioProducerCallback* m_pCallback;
struct{
struct {
const void* pPushBufferPtr;
unsigned nPushBufferSize;
} m_PushBuffer;
@ -107,12 +123,20 @@ class ProxyVideoProducerCallback
{
public:
ProxyVideoProducerCallback() { }
virtual ~ProxyVideoProducerCallback(){ }
virtual ~ProxyVideoProducerCallback() { }
virtual int prepare(int width, int height, int fps) { return -1; }
virtual int start() { return -1; }
virtual int pause() { return -1; }
virtual int stop() { return -1; }
virtual int prepare(int width, int height, int fps) {
return -1;
}
virtual int start() {
return -1;
}
virtual int pause() {
return -1;
}
virtual int stop() {
return -1;
}
};
/* ============ ProxyVideoProducer Class ================= */
@ -130,29 +154,37 @@ public:
bool setMirror(bool bMirror);
bool setActualCameraOutputSize(unsigned nWidth, unsigned nHeight);
int push(const void* pBuffer, unsigned nSize);
void setCallback(ProxyVideoProducerCallback* pCallback) { m_pCallback = pCallback; }
void setCallback(ProxyVideoProducerCallback* pCallback) {
m_pCallback = pCallback;
}
#if !defined(SWIG)
int sendRaw(const void* pBuffer, unsigned nSize, unsigned nDuration, bool bMarker);
int sendRaw(const void* pBuffer, unsigned nSize, const void* proto_hdr);
inline ProxyVideoProducerCallback* getCallback()const { return m_pCallback; }
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin){
inline ProxyVideoProducerCallback* getCallback()const {
return m_pCallback;
}
virtual inline bool isWrapping(tsk_object_t* wrapped_plugin) {
return m_pWrappedPlugin == wrapped_plugin;
}
virtual inline const tmedia_producer_t* getWrappedPlugin()const{
virtual inline const tmedia_producer_t* getWrappedPlugin()const {
return (tmedia_producer_t*)m_pWrappedPlugin;
}
#endif
virtual inline uint64_t getMediaSessionId(){
virtual inline uint64_t getMediaSessionId() {
return m_pWrappedPlugin ? TMEDIA_PRODUCER(m_pWrappedPlugin)->session_id : 0;
}
public:
static bool registerPlugin();
static void setDefaultChroma(tmedia_chroma_t eChroma){ s_eDefaultChroma = eChroma; }
static void setDefaultChroma(tmedia_chroma_t eChroma) {
s_eDefaultChroma = eChroma;
}
#if !defined(SWIG)
tmedia_chroma_t getChroma()const;
static tmedia_chroma_t getDefaultChroma() { return s_eDefaultChroma; }
static tmedia_chroma_t getDefaultChroma() {
return s_eDefaultChroma;
}
#endif
private:

View File

@ -45,8 +45,8 @@ twrap_rpmessage_type_t RPMessage::getType()
unsigned RPMessage::getPayloadLength()
{
if(!this->tmpBuffer){
if((this->tmpBuffer = tsk_buffer_create_null())){
if(!this->tmpBuffer) {
if((this->tmpBuffer = tsk_buffer_create_null())) {
tsms_rpdu_data_serialize(this->rp_message, this->tmpBuffer);
}
}
@ -57,13 +57,13 @@ unsigned RPMessage::getPayload(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(!this->tmpBuffer){
if((this->tmpBuffer = tsk_buffer_create_null())){
if(!this->tmpBuffer) {
if((this->tmpBuffer = tsk_buffer_create_null())) {
tsms_rpdu_message_serialize(this->rp_message, this->tmpBuffer);
}
}
if(output && maxsize && this->tmpBuffer && this->tmpBuffer->data){
if(output && maxsize && this->tmpBuffer && this->tmpBuffer->data) {
retsize = (this->tmpBuffer->size > maxsize) ? maxsize : this->tmpBuffer->size;
memcpy(output, this->tmpBuffer->data, retsize);
}
@ -81,12 +81,12 @@ SMSData::SMSData(twrap_sms_type_t _type, int _mr, const void* _ascii, tsk_size_t
{
this->type = _type;
this->mr = _mr;
if((this->size = _size)){
if((this->ascii = tsk_calloc(size+1, 1))){
if((this->size = _size)) {
if((this->ascii = tsk_calloc(size+1, 1))) {
memcpy(this->ascii, _ascii, _size);
}
}
else{
else {
this->ascii = tsk_null;
}
}
@ -125,7 +125,7 @@ unsigned SMSData::getPayload(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(output && maxsize && this->ascii){
if(output && maxsize && this->ascii) {
retsize = (this->size > maxsize) ? maxsize : this->size;
memcpy(output, this->ascii, retsize);
}
@ -165,36 +165,36 @@ RPMessage* SMSEncoder::encodeSubmit(int mr, const char *smsc, const char *destin
RPMessage* encodedData = tsk_null;
if(!smsc || ! destination || !ascii){
if(!smsc || ! destination || !ascii) {
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
if(mr<0 || mr>0xFF){
if(mr<0 || mr>0xFF) {
TSK_DEBUG_WARN("Invalid Message Reference");
mr &= 0xFF;
}
// create SMS-SUBMIT message
if(!(sms_submit = tsms_tpdu_submit_create(mr, (const uint8_t*)smsc, (const uint8_t*)destination))){
if(!(sms_submit = tsms_tpdu_submit_create(mr, (const uint8_t*)smsc, (const uint8_t*)destination))) {
TSK_DEBUG_ERROR("Failed to create the TPDU SMS-SUBMIT message");
goto bail;
}
// Set content for SMS-SUBMIT
if((buffer = tsms_pack_to_7bit(ascii))){
if((buffer = tsms_pack_to_7bit(ascii))) {
ret = tsms_tpdu_submit_set_userdata(sms_submit, buffer, tsms_alpha_7bit);
TSK_OBJECT_SAFE_FREE(buffer);
}
else{
else {
TSK_DEBUG_ERROR("Failed to encode the TPDU SMS-SUBMIT message");
goto bail;
}
// create RP-DATA(SMS-SUBMIT)
if((rp_data = tsms_rpdu_data_create_mo(mr, (const uint8_t*)smsc, TSMS_TPDU_MESSAGE(sms_submit)))){
if((rp_data = tsms_rpdu_data_create_mo(mr, (const uint8_t*)smsc, TSMS_TPDU_MESSAGE(sms_submit)))) {
encodedData = new RPMessage(twrap_rpmessage_type_sms_submit, TSMS_RPDU_MESSAGE(rp_data));
}
else{
else {
TSK_DEBUG_ERROR("Failed to create the RP-DATA(SMS-SUBMIT) message");
goto bail;
}
@ -217,12 +217,12 @@ RPMessage* SMSEncoder::encodeDeliver(int mr, const char* smsc, const char* origi
RPMessage* encodedData = tsk_null;
if(!smsc || ! originator || !ascii){
if(!smsc || ! originator || !ascii) {
TSK_DEBUG_ERROR("Invalid parameter");
return tsk_null;
}
if(mr<0 || mr>0xFF){
if(mr<0 || mr>0xFF) {
TSK_DEBUG_WARN("Invalid Message Reference");
mr &= 0xFF;
}
@ -230,15 +230,15 @@ RPMessage* SMSEncoder::encodeDeliver(int mr, const char* smsc, const char* origi
// create SMS-DELIVER message
sms_deliver = tsms_tpdu_deliver_create((const uint8_t*)smsc, (const uint8_t*)originator);
// Set content for SMS-DELIVER
if((buffer = tsms_pack_to_7bit(ascii))){
if((buffer = tsms_pack_to_7bit(ascii))) {
ret = tsms_tpdu_deliver_set_userdata(sms_deliver, buffer, tsms_alpha_7bit);
TSK_OBJECT_SAFE_FREE(buffer);
}
// create RP-DATA message
if((rp_data = tsms_rpdu_data_create_mt(mr, (const uint8_t*)smsc, TSMS_TPDU_MESSAGE(sms_deliver)))){
if((rp_data = tsms_rpdu_data_create_mt(mr, (const uint8_t*)smsc, TSMS_TPDU_MESSAGE(sms_deliver)))) {
encodedData = new RPMessage(twrap_rpmessage_type_sms_deliver, TSMS_RPDU_MESSAGE(rp_data));
}
else{
else {
TSK_DEBUG_ERROR("Failed to create the RP-DATA(SMS-DELIVER) message");
goto bail;
}
@ -263,7 +263,7 @@ RPMessage* SMSEncoder::encodeACK(int mr, const char* smsc, const char* destinati
// create SMS-DELIVER(or SUBMIT)-REPORT message
sms_report = tsms_tpdu_report_create((const uint8_t*)smsc, isSUBMIT, isERROR);
// create RP-ACK message (From MS to SC)
if((rp_ack = tsms_rpdu_ack_create_mo(mr, TSMS_TPDU_MESSAGE(sms_report)))){
if((rp_ack = tsms_rpdu_ack_create_mo(mr, TSMS_TPDU_MESSAGE(sms_report)))) {
encodedData = new RPMessage(twrap_rpmessage_type_sms_ack, TSMS_RPDU_MESSAGE(rp_ack));
}
@ -285,7 +285,7 @@ RPMessage* SMSEncoder::encodeError(int mr, const char* smsc, const char* destina
// create SMS-DELIVER-REPORT message
sms_report = tsms_tpdu_report_create((const uint8_t*)smsc, isSUBMIT, isERROR);
// create RP-ERROR message
if((rp_error = tsms_rpdu_error_create_mo(mr, TSMS_TPDU_MESSAGE(sms_report), 0x0A/*call barred*/))){
if((rp_error = tsms_rpdu_error_create_mo(mr, TSMS_TPDU_MESSAGE(sms_report), 0x0A/*call barred*/))) {
encodedData = new RPMessage(twrap_rpmessage_type_sms_error, TSMS_RPDU_MESSAGE(rp_error));
}
@ -302,23 +302,22 @@ SMSData* SMSEncoder::decode(const void* data, unsigned size, bool MobOrig)
SMSData* decodedData = tsk_null;
if(!(rp_message = tsms_rpdu_message_deserialize(data, size))){
if(!(rp_message = tsms_rpdu_message_deserialize(data, size))) {
TSK_DEBUG_ERROR("Failed to deserialize the RP-MESSAGE");
goto bail;
}
switch(rp_message->mti){
switch(rp_message->mti) {
case tsms_rpdu_type_data_mo:
case tsms_rpdu_type_data_mt:
{
case tsms_rpdu_type_data_mt: {
char* ascii = tsk_null;
tsms_rpdu_data_t* rp_data = TSMS_RPDU_DATA(rp_message);
if((tpdu = tsms_tpdu_message_deserialize(rp_data->udata->data, rp_data->udata->size, MobOrig))){
if(tpdu->mti == tsms_tpdu_mti_deliver_mt || tpdu->mti == tsms_tpdu_mti_submit_mo){ /* SMS-SUBMIT or SMS-DELIVER? */
if((tpdu = tsms_tpdu_message_deserialize(rp_data->udata->data, rp_data->udata->size, MobOrig))) {
if(tpdu->mti == tsms_tpdu_mti_deliver_mt || tpdu->mti == tsms_tpdu_mti_submit_mo) { /* SMS-SUBMIT or SMS-DELIVER? */
ascii = tsms_tpdu_message_get_payload(tpdu);
decodedData = new SMSData(twrap_sms_type_rpdata, rp_message->mr, ascii, (tsk_size_t)tsk_strlen(ascii));
if(tpdu->mti == tsms_tpdu_mti_deliver_mt){
if(tpdu->mti == tsms_tpdu_mti_deliver_mt) {
tsms_tpdu_deliver_t* tpdu_deliver = (tsms_tpdu_deliver_t*)tpdu;
decodedData->setOA(tpdu_deliver->oa ? tpdu_deliver->oa->digits : tsk_null);
}
@ -333,36 +332,32 @@ SMSData* SMSEncoder::decode(const void* data, unsigned size, bool MobOrig)
break;
}
case tsms_rpdu_type_ack_mo:
case tsms_rpdu_type_ack_mt:
{
case tsms_rpdu_type_ack_mt: {
tsms_rpdu_ack_t* rp_ack = TSMS_RPDU_ACK(rp_message);
// ...do whatever you want
if(rp_ack->udata && (tpdu = tsms_tpdu_message_deserialize(rp_ack->udata->data, rp_ack->udata->size, MobOrig))){
if(rp_ack->udata && (tpdu = tsms_tpdu_message_deserialize(rp_ack->udata->data, rp_ack->udata->size, MobOrig))) {
// ...do whatever you want
}
decodedData = new SMSData(twrap_sms_type_ack, rp_message->mr, tsk_null, 0);
break;
}
case tsms_rpdu_type_error_mo:
case tsms_rpdu_type_error_mt:
{
case tsms_rpdu_type_error_mt: {
tsms_rpdu_error_t* rp_error = TSMS_RPDU_ERROR(rp_message);
// ...do whatever you want
if(rp_error->udata && (tpdu = tsms_tpdu_message_deserialize(rp_error->udata->data, rp_error->udata->size, MobOrig))){
if(rp_error->udata && (tpdu = tsms_tpdu_message_deserialize(rp_error->udata->data, rp_error->udata->size, MobOrig))) {
// ...do whatever you want
}
decodedData = new SMSData(twrap_sms_type_error, rp_message->mr, tsk_null, 0);
break;
}
case tsms_rpdu_type_smma_mo:
{
case tsms_rpdu_type_smma_mo: {
// tsms_rpdu_smma_t* rp_smma = TSMS_RPDU_SMMA(rp_message);
// ...do whatever you want
decodedData = new SMSData(twrap_sms_type_smma, rp_message->mr, tsk_null, 0);
break;
}
default:
{
default: {
TSK_DEBUG_INFO("Unknown RP-Message type (%u).", rp_message->mti);
break;
}

View File

@ -27,8 +27,7 @@
#include "tinysip.h" /* SIP/IMS */
#include "tinysms.h" /* Binary SMS API*/
typedef enum twrap_rpmessage_type_e
{
typedef enum twrap_rpmessage_type_e {
twrap_rpmessage_type_sms_none,
twrap_rpmessage_type_sms_submit,
twrap_rpmessage_type_sms_deliver,
@ -37,8 +36,7 @@ typedef enum twrap_rpmessage_type_e
}
twrap_rpmessage_type_t;
typedef enum twrap_sms_type_e
{
typedef enum twrap_sms_type_e {
twrap_sms_type_none,
twrap_sms_type_rpdata,
twrap_sms_type_smma,

View File

@ -32,7 +32,7 @@ public:
SafeObject();
virtual ~SafeObject();
/* protected: */
/* protected: */
int Lock()const;
int UnLock()const;

View File

@ -38,16 +38,34 @@ class SipCallback
public:
SipCallback() { }
virtual ~SipCallback() {}
virtual int OnDialogEvent(const DialogEvent* e) { return -1; }
virtual int OnStackEvent(const StackEvent* e) { return -1; }
virtual int OnDialogEvent(const DialogEvent* e) {
return -1;
}
virtual int OnStackEvent(const StackEvent* e) {
return -1;
}
virtual int OnInviteEvent(const InviteEvent* e) { return -1; }
virtual int OnMessagingEvent(const MessagingEvent* e) { return -1; }
virtual int OnInfoEvent(const InfoEvent* e) { return -1; }
virtual int OnOptionsEvent(const OptionsEvent* e) { return -1; }
virtual int OnPublicationEvent(const PublicationEvent* e) { return -1; }
virtual int OnRegistrationEvent(const RegistrationEvent* e) { return -1; }
virtual int OnSubscriptionEvent(const SubscriptionEvent* e) { return -1; }
virtual int OnInviteEvent(const InviteEvent* e) {
return -1;
}
virtual int OnMessagingEvent(const MessagingEvent* e) {
return -1;
}
virtual int OnInfoEvent(const InfoEvent* e) {
return -1;
}
virtual int OnOptionsEvent(const OptionsEvent* e) {
return -1;
}
virtual int OnPublicationEvent(const PublicationEvent* e) {
return -1;
}
virtual int OnRegistrationEvent(const RegistrationEvent* e) {
return -1;
}
virtual int OnSubscriptionEvent(const SubscriptionEvent* e) {
return -1;
}
private:

View File

@ -43,17 +43,17 @@ name##Session* cls##Event::take##session##Ownership() const \
SipEvent::SipEvent(const tsip_event_t *_sipevent)
{
this->sipevent = _sipevent;
if(_sipevent){
if(_sipevent) {
this->sipmessage = new SipMessage(_sipevent->sipmessage);
}
else{
else {
this->sipmessage = tsk_null;
}
}
SipEvent::~SipEvent()
{
if(this->sipmessage){
if(this->sipmessage) {
delete this->sipmessage;
}
}
@ -71,7 +71,7 @@ const char* SipEvent::getPhrase() const
const SipSession* SipEvent::getBaseSession() const
{
const void* userdata = tsip_ssession_get_userdata(this->sipevent->ss);
if(userdata){
if(userdata) {
return dyn_cast<const SipSession*>((const SipSession*)userdata);
}
return tsk_null;
@ -86,7 +86,7 @@ SipStack* SipEvent::getStack()const
{
const tsip_stack_handle_t* stack_handle = tsip_ssession_get_stack(sipevent->ss);
const void* userdata;
if(stack_handle && (userdata = tsip_stack_get_userdata(stack_handle))){
if(stack_handle && (userdata = tsip_stack_get_userdata(stack_handle))) {
return dyn_cast<SipStack*>((SipStack*)userdata);
}
return tsk_null;
@ -95,21 +95,21 @@ SipStack* SipEvent::getStack()const
/* ======================== DialogEvent ========================*/
DialogEvent::DialogEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent){ }
:SipEvent(_sipevent) { }
DialogEvent::~DialogEvent(){ }
DialogEvent::~DialogEvent() { }
/* ======================== DialogEvent ========================*/
StackEvent::StackEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent){ }
:SipEvent(_sipevent) { }
StackEvent::~StackEvent(){ }
StackEvent::~StackEvent() { }
/* ======================== InviteEvent ========================*/
InviteEvent::InviteEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
:SipEvent(_sipevent)
{
}
@ -147,7 +147,7 @@ takeOwnership_Implement(Invite, Msrp, MsrpSession);
/* ======================== MessagingEvent ========================*/
MessagingEvent::MessagingEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
:SipEvent(_sipevent)
{
}
@ -170,7 +170,7 @@ takeOwnership_Implement(Messaging, Messaging, Session);
/* ======================== InfoEvent ========================*/
InfoEvent::InfoEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
:SipEvent(_sipevent)
{
}
@ -194,7 +194,7 @@ takeOwnership_Implement(Info, Info, Session);
/* ======================== OptionsEvent ========================*/
OptionsEvent::OptionsEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
:SipEvent(_sipevent)
{
}
@ -217,7 +217,7 @@ takeOwnership_Implement(Options, Options, Session);
/* ======================== PublicationEvent ========================*/
PublicationEvent::PublicationEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
:SipEvent(_sipevent)
{
}
@ -240,7 +240,7 @@ takeOwnership_Implement(Publication, Publication, Session);
/* ======================== RegistrationEvent ========================*/
RegistrationEvent::RegistrationEvent(const tsip_event_t *_sipevent)
:SipEvent(_sipevent)
:SipEvent(_sipevent)
{
}
@ -263,7 +263,7 @@ takeOwnership_Implement(Registration, Registration, Session);
/* ======================== SubscriptionEvent ========================*/
SubscriptionEvent::SubscriptionEvent(const tsip_event_t *sipevent)
:SipEvent(sipevent)
:SipEvent(sipevent)
{
}

View File

@ -58,7 +58,9 @@ public:
const SipSession* getBaseSession() const;
const SipMessage* getSipMessage() const;
#if !defined(SWIG)
const tsip_event_t * getWrappedEvent(){ return sipevent; }
const tsip_event_t * getWrappedEvent() {
return sipevent;
}
#endif
#if !defined(SWIG)
SipStack* getStack()const;

View File

@ -23,7 +23,7 @@
SdpMessage::SdpMessage()
:m_pSdpMessage(tsk_null)
:m_pSdpMessage(tsk_null)
{
}
@ -41,30 +41,60 @@ char* SdpMessage::getSdpHeaderValue(const char* media, char name, unsigned index
{
const tsdp_header_M_t* M;
if((M = (const tsdp_header_M_t*)tsdp_message_get_header(m_pSdpMessage, tsdp_htype_M))){
if((M = (const tsdp_header_M_t*)tsdp_message_get_header(m_pSdpMessage, tsdp_htype_M))) {
tsdp_header_type_t type = tsdp_htype_Dummy;
const tsdp_header_t* header;
switch(name){
case 'a': type = tsdp_htype_A; break;
case 'b': type = tsdp_htype_B; break;
case 'c': type = tsdp_htype_C; break;
case 'e': type = tsdp_htype_E; break;
case 'i': type = tsdp_htype_I; break;
case 'k': type = tsdp_htype_K; break;
case 'm': type = tsdp_htype_M; break;
case 'o': type = tsdp_htype_O; break;
switch(name) {
case 'a':
type = tsdp_htype_A;
break;
case 'b':
type = tsdp_htype_B;
break;
case 'c':
type = tsdp_htype_C;
break;
case 'e':
type = tsdp_htype_E;
break;
case 'i':
type = tsdp_htype_I;
break;
case 'k':
type = tsdp_htype_K;
break;
case 'm':
type = tsdp_htype_M;
break;
case 'o':
type = tsdp_htype_O;
break;
case 'p': type = tsdp_htype_P; break;
case 'r': type = tsdp_htype_R; break;
case 's': type = tsdp_htype_S; break;
case 't': type = tsdp_htype_T; break;
case 'u': type = tsdp_htype_U; break;
case 'v': type = tsdp_htype_V; break;
case 'z': type = tsdp_htype_Z; break;
case 'p':
type = tsdp_htype_P;
break;
case 'r':
type = tsdp_htype_R;
break;
case 's':
type = tsdp_htype_S;
break;
case 't':
type = tsdp_htype_T;
break;
case 'u':
type = tsdp_htype_U;
break;
case 'v':
type = tsdp_htype_V;
break;
case 'z':
type = tsdp_htype_Z;
break;
}
if((header = tsdp_message_get_headerAt(m_pSdpMessage, type, index))){
if((header = tsdp_message_get_headerAt(m_pSdpMessage, type, index))) {
return tsdp_header_tostring(header);
}
}
@ -77,10 +107,10 @@ char* SdpMessage::getSdpHeaderAValue(const char* media, const char* attributeNam
const tsdp_header_M_t* M;
tsk_size_t i;
for(i = 0; (M = (const tsdp_header_M_t*)tsdp_message_get_headerAt(m_pSdpMessage, tsdp_htype_M, i)); i++){
if(tsk_striequals(M->media, media)){
for(i = 0; (M = (const tsdp_header_M_t*)tsdp_message_get_headerAt(m_pSdpMessage, tsdp_htype_M, i)); i++) {
if(tsk_striequals(M->media, media)) {
const tsdp_header_A_t* A;
if((A = tsdp_header_M_findA(M, attributeName))){
if((A = tsdp_header_M_findA(M, attributeName))) {
return tsk_strdup(A->value);
}
}
@ -91,12 +121,12 @@ char* SdpMessage::getSdpHeaderAValue(const char* media, const char* attributeNam
SipMessage::SipMessage()
:m_pSipMessage(tsk_null), m_pSdpMessage(tsk_null)
:m_pSipMessage(tsk_null), m_pSdpMessage(tsk_null)
{
}
SipMessage::SipMessage(tsip_message_t *_sipmessage)
: m_pSdpMessage(tsk_null)
: m_pSdpMessage(tsk_null)
{
m_pSipMessage = (tsip_message_t *)tsk_object_ref(_sipmessage);
}
@ -104,7 +134,7 @@ SipMessage::SipMessage(tsip_message_t *_sipmessage)
SipMessage::~SipMessage()
{
TSK_OBJECT_SAFE_FREE(m_pSipMessage);
if(m_pSdpMessage){
if(m_pSdpMessage) {
delete m_pSdpMessage;
}
}
@ -116,7 +146,7 @@ bool SipMessage::isResponse()
tsip_request_type_t SipMessage::getRequestType()
{
if(TSIP_MESSAGE_IS_REQUEST(m_pSipMessage)){
if(TSIP_MESSAGE_IS_REQUEST(m_pSipMessage)) {
return (m_pSipMessage)->line.request.request_type;
}
return tsip_NONE;
@ -141,60 +171,96 @@ const tsip_header_t* SipMessage::getSipHeader(const char* name, unsigned index /
tsk_size_t pos = 0;
const tsk_list_item_t *item;
const tsip_header_t* hdr = tsk_null;
if(!m_pSipMessage || !name){
if(!m_pSipMessage || !name) {
return tsk_null;
}
if(tsk_striequals(name, "v") || tsk_striequals(name, "via")){
if(index == 0){
if(tsk_striequals(name, "v") || tsk_striequals(name, "via")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->firstVia;
goto bail;
}else pos++; }
if(tsk_striequals(name, "f") || tsk_striequals(name, "from")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "f") || tsk_striequals(name, "from")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->From;
goto bail;
}else pos++; }
if(tsk_striequals(name, "t") || tsk_striequals(name, "to")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "t") || tsk_striequals(name, "to")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->To;
goto bail;
}else pos++; }
if(tsk_striequals(name, "m") || tsk_striequals(name, "contact")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "m") || tsk_striequals(name, "contact")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->Contact;
goto bail;
}else pos++; }
if(tsk_striequals(name, "i") || tsk_striequals(name, "call-id")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "i") || tsk_striequals(name, "call-id")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->Call_ID;
goto bail;
}else pos++; }
if(tsk_striequals(name, "cseq")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "cseq")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->CSeq;
goto bail;
}else pos++; }
if(tsk_striequals(name, "expires")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "expires")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->Expires;
goto bail;
}else pos++; }
if(tsk_striequals(name, "c") || tsk_striequals(name, "content-type")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "c") || tsk_striequals(name, "content-type")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->Content_Type;
goto bail;
}else pos++; }
if(tsk_striequals(name, "l") || tsk_striequals(name, "content-length")){
if(index == 0){
}
else {
pos++;
}
}
if(tsk_striequals(name, "l") || tsk_striequals(name, "content-length")) {
if(index == 0) {
hdr = (const tsip_header_t*)m_pSipMessage->Content_Length;
goto bail;
}else pos++; }
}
else {
pos++;
}
}
tsk_list_foreach(item, m_pSipMessage->headers){
if(tsk_striequals(tsip_header_get_name_2(TSIP_HEADER(item->data)), name)){
if(pos++ >= index){
tsk_list_foreach(item, m_pSipMessage->headers) {
if(tsk_striequals(tsip_header_get_name_2(TSIP_HEADER(item->data)), name)) {
if(pos++ >= index) {
hdr = (const tsip_header_t*)item->data;
break;
}
@ -210,9 +276,9 @@ bail:
char* SipMessage::getSipHeaderValue(const char* name, unsigned index /* = 0*/)
{
const tsip_header_t* header;
if((header = this->getSipHeader(name, index))){
if((header = this->getSipHeader(name, index))) {
switch(header->type){
switch(header->type) {
case tsip_htype_From:
return tsip_uri_tostring(((const tsip_header_From_t*)header)->uri, tsk_false, tsk_false);
case tsip_htype_To:
@ -235,7 +301,7 @@ char* SipMessage::getSipHeaderParamValue(const char* name, const char* param, un
{
const tsip_header_t* header;
if((header = this->getSipHeader(name, index))){
if((header = this->getSipHeader(name, index))) {
return tsip_header_get_param_value(header, param);
}
@ -260,7 +326,7 @@ unsigned SipMessage::getSipContentLength()
unsigned SipMessage::getSipContent(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(output && maxsize && TSIP_MESSAGE_HAS_CONTENT(m_pSipMessage)){
if(output && maxsize && TSIP_MESSAGE_HAS_CONTENT(m_pSipMessage)) {
retsize = (m_pSipMessage->Content->size > maxsize) ? maxsize : m_pSipMessage->Content->size;
memcpy(output, m_pSipMessage->Content->data, retsize);
}
@ -269,7 +335,7 @@ unsigned SipMessage::getSipContent(void* output, unsigned maxsize)
const void* SipMessage::getSipContentPtr()
{
if(m_pSipMessage && m_pSipMessage->Content){
if(m_pSipMessage && m_pSipMessage->Content) {
return m_pSipMessage->Content->data;
}
return tsk_null;
@ -277,9 +343,9 @@ const void* SipMessage::getSipContentPtr()
const SdpMessage* SipMessage::getSdpMessage()
{
if(!m_pSdpMessage && TSIP_MESSAGE_HAS_CONTENT(m_pSipMessage)){
if(!m_pSdpMessage && TSIP_MESSAGE_HAS_CONTENT(m_pSipMessage)) {
tsdp_message_t* sdp = tsdp_message_parse(m_pSipMessage->Content->data, m_pSipMessage->Content->size);
if(sdp){
if(sdp) {
m_pSdpMessage = new SdpMessage(sdp);
TSK_OBJECT_SAFE_FREE(sdp);
}

View File

@ -37,7 +37,9 @@ public:
char* getSdpHeaderValue(const char* media, char name, unsigned index = 0);
char* getSdpHeaderAValue(const char* media, const char* attributeName);
#if !defined(SWIG)
const tsdp_message_t * getWrappedSdpMessage(){ return m_pSdpMessage; }
const tsdp_message_t * getWrappedSdpMessage() {
return m_pSdpMessage;
}
#endif
private:
@ -63,7 +65,9 @@ public:
unsigned getSipContent(void* output, unsigned maxsize);
#if !defined(SWIG)
const void* getSipContentPtr();
const tsip_message_t* getWrappedSipMessage()const{ return m_pSipMessage; }
const tsip_message_t* getWrappedSipMessage()const {
return m_pSipMessage;
}
#endif
const SdpMessage* getSdpMessage();

View File

@ -26,8 +26,7 @@
#include "Msrp.h"
/* ======================== AsyncAction ========================*/
typedef struct twrap_async_action_s
{
typedef struct twrap_async_action_s {
const tsip_ssession_handle_t *session;
const ActionConfig* config;
}
@ -57,18 +56,18 @@ SipSession::~SipSession()
void SipSession::init(SipStack* pStack, tsip_ssession_handle_t* pHandle/*=tsk_null*/)
{
if(pHandle){
if(pHandle) {
/* "server-side-session" */
if(tsip_ssession_have_ownership(pHandle)){
if(tsip_ssession_have_ownership(pHandle)) {
tsk_object_ref(pHandle);
}
else if(tsip_ssession_take_ownership(pHandle) != 0){ /* should never happen */
else if(tsip_ssession_take_ownership(pHandle) != 0) { /* should never happen */
TSK_DEBUG_ERROR("Failed to take ownership");
return;
}
m_pHandle = pHandle;
}
else{
else {
/* "client-side-session" */
m_pHandle = tsip_ssession_create(pStack->getHandle(),
TSIP_SSESSION_SET_USERDATA(this),
@ -208,19 +207,19 @@ const SipStack* SipSession::getStack()const
/* ======================== InviteSession ========================*/
InviteSession::InviteSession(SipStack* pStack)
: SipSession(pStack), m_pMediaMgr(tsk_null)
: SipSession(pStack), m_pMediaMgr(tsk_null)
{
}
InviteSession::InviteSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle), m_pMediaMgr(tsk_null)
: SipSession(pStack, pHandle), m_pMediaMgr(tsk_null)
{
}
InviteSession::~InviteSession()
{
if(m_pMediaMgr){
if(m_pMediaMgr) {
delete m_pMediaMgr, m_pMediaMgr = tsk_null;
}
}
@ -256,13 +255,13 @@ bool InviteSession::sendInfo(const void* payload, unsigned len, ActionConfig* co
{
int ret;
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
if(payload && len){
if(payload && len) {
ret = tsip_api_invite_send_info(m_pHandle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
}
else{
else {
ret = tsip_api_invite_send_info(m_pHandle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
@ -272,13 +271,13 @@ bool InviteSession::sendInfo(const void* payload, unsigned len, ActionConfig* co
const MediaSessionMgr* InviteSession::getMediaMgr()
{
if(!m_pMediaMgr && m_pHandle){
if(!m_pMediaMgr && m_pHandle) {
tmedia_session_mgr_t* mgr = tsip_session_get_mediamgr(m_pHandle);
if(mgr){
if(mgr) {
m_pMediaMgr = new MediaSessionMgr(mgr); // new() it's not yours: see "m_pMediaMgr" which is destroy in the destructor()
tsk_object_unref(mgr);
}
else{
else {
TSK_DEBUG_WARN("No media session associated to this session");
}
}
@ -288,14 +287,14 @@ const MediaSessionMgr* InviteSession::getMediaMgr()
/* ======================== CallSession ========================*/
CallSession::CallSession(SipStack* Stack)
: InviteSession(Stack)
: InviteSession(Stack)
{
}
CallSession::CallSession(SipStack* Stack, tsip_ssession_handle_t* handle)
: InviteSession(Stack, handle)
, m_pT140Callback(tsk_null)
, m_pRtcpCallback(tsk_null)
: InviteSession(Stack, handle)
, m_pT140Callback(tsk_null)
, m_pRtcpCallback(tsk_null)
{
}
@ -343,7 +342,7 @@ bool CallSession::call(const char* remoteUriString, twrap_media_type_t media, Ac
{
SipUri sipUri(remoteUriString);
if(sipUri.isValid()){
if(sipUri.isValid()) {
return call(&sipUri, media, config);
}
TSK_DEBUG_ERROR("Failed to parse sip uri=%s", remoteUriString);
@ -352,7 +351,7 @@ bool CallSession::call(const char* remoteUriString, twrap_media_type_t media, Ac
bool CallSession::call(const SipUri* remoteUri, twrap_media_type_t media, ActionConfig* config/*=tsk_null*/)
{
if(!remoteUri){
if(!remoteUri) {
TSK_DEBUG_ERROR("Invalid parameter");
return false;
}
@ -573,7 +572,7 @@ bool CallSession::resume(ActionConfig* config/*=tsk_null*/)
bool CallSession::transfer(const char* referToUriString, ActionConfig* config/*=tsk_null*/)
{
if(tsk_strnullORempty(referToUriString)){
if(tsk_strnullORempty(referToUriString)) {
TSK_DEBUG_ERROR("Invalid parameter");
return false;
}
@ -615,7 +614,7 @@ bool CallSession::sendT140Data(enum tmedia_t140_data_type_e data_type, const voi
{
const tmedia_session_mgr_t* pWrappedMgr;
const MediaSessionMgr* pMgr;
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())){
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())) {
return (tmedia_session_mgr_send_t140_data((tmedia_session_mgr_t*)pWrappedMgr, data_type, data_ptr, data_size) == 0);
}
return false;
@ -625,11 +624,11 @@ bool CallSession::setT140Callback(const T140Callback* pT140Callback)
{
const tmedia_session_mgr_t* pWrappedMgr;
const MediaSessionMgr* pMgr;
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())){
if((m_pT140Callback = pT140Callback)){
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())) {
if((m_pT140Callback = pT140Callback)) {
return (tmedia_session_mgr_set_t140_ondata_cbfn((tmedia_session_mgr_t*)pWrappedMgr, this, &CallSession::t140OnDataCallback) == 0);
}
else{
else {
return (tmedia_session_mgr_set_t140_ondata_cbfn((tmedia_session_mgr_t*)pWrappedMgr, this, tsk_null) == 0);
}
}
@ -640,7 +639,7 @@ bool CallSession::sendRtcpEvent(enum tmedia_rtcp_event_type_e event_type, twrap_
{
const tmedia_session_mgr_t* pWrappedMgr;
const MediaSessionMgr* pMgr;
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())){
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())) {
return (tmedia_session_mgr_send_rtcp_event((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_native_media_type(media_type), event_type, ssrc_media) == 0);
}
TSK_DEBUG_ERROR("No media manager");
@ -651,11 +650,11 @@ bool CallSession::setRtcpCallback(const RtcpCallback* pRtcpCallback, twrap_media
{
const tmedia_session_mgr_t* pWrappedMgr;
const MediaSessionMgr* pMgr;
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())){
if((m_pRtcpCallback = pRtcpCallback)){
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())) {
if((m_pRtcpCallback = pRtcpCallback)) {
return (tmedia_session_mgr_set_onrtcp_cbfn((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_native_media_type(media_type), this, &CallSession::rtcpOnCallback) == 0);
}
else{
else {
return (tmedia_session_mgr_set_onrtcp_cbfn((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_native_media_type(media_type), this, tsk_null) == 0);
}
}
@ -670,9 +669,9 @@ const T140Callback* CallSession::getT140Callback() const
int CallSession::t140OnDataCallback(const void* context, enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size)
{
const CallSession* session = dyn_cast<const CallSession*>((const CallSession*)context);
if(session && session->getT140Callback()){
if(session && session->getT140Callback()) {
T140CallbackData* dataObj = new T140CallbackData(data_type, data_ptr, data_size);
if(dataObj){
if(dataObj) {
int ret = const_cast<T140Callback*>(session->getT140Callback())->ondata(dataObj);
delete dataObj;
return ret;
@ -689,9 +688,9 @@ const RtcpCallback* CallSession::getRtcpCallback() const
int CallSession::rtcpOnCallback(const void* context, enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media)
{
const CallSession* session = dyn_cast<const CallSession*>((const CallSession*)context);
if(session && session->getRtcpCallback()){
if(session && session->getRtcpCallback()) {
RtcpCallbackData* dataObj = new RtcpCallbackData(event_type, ssrc_media);
if(dataObj){
if(dataObj) {
int ret = const_cast<RtcpCallback*>(session->getRtcpCallback())->onevent(dataObj);
delete dataObj;
return ret;
@ -704,7 +703,7 @@ int CallSession::rtcpOnCallback(const void* context, enum tmedia_rtcp_event_type
/* ======================== MsrpSession ========================*/
MsrpSession::MsrpSession(SipStack* pStack, MsrpCallback* pCallback)
: InviteSession(pStack), m_pCallback(pCallback)
: InviteSession(pStack), m_pCallback(pCallback)
{
tsip_ssession_set(m_pHandle,
TSIP_SSESSION_SET_MEDIA(
@ -715,7 +714,7 @@ MsrpSession::MsrpSession(SipStack* pStack, MsrpCallback* pCallback)
}
MsrpSession::MsrpSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: InviteSession(pStack, pHandle), m_pCallback(tsk_null)
: InviteSession(pStack, pHandle), m_pCallback(tsk_null)
{
tsip_ssession_set(m_pHandle,
TSIP_SSESSION_SET_MEDIA(
@ -737,7 +736,7 @@ bool MsrpSession::setCallback(MsrpCallback* pCallback)
bool MsrpSession::callMsrp(const SipUri* remoteUri, ActionConfig* config/*=tsk_null*/)
{
if(!remoteUri){
if(!remoteUri) {
TSK_DEBUG_ERROR("Invalid parameter");
return false;
}
@ -755,7 +754,7 @@ bool MsrpSession::callMsrp(const SipUri* remoteUri, ActionConfig* config/*=tsk_n
bool MsrpSession::callMsrp(const char* remoteUriString, ActionConfig* config/*=tsk_null*/)
{
SipUri sipUri(remoteUriString);
if(sipUri.isValid()){
if(sipUri.isValid()) {
return callMsrp(&sipUri, config);
}
TSK_DEBUG_ERROR("Failed to parse sip uri=%s", remoteUriString);
@ -779,12 +778,12 @@ bool MsrpSession::sendFile(ActionConfig* config/*=tsk_null*/)
/* ======================== MessagingSession ========================*/
MessagingSession::MessagingSession(SipStack* pStack)
: SipSession(pStack)
: SipSession(pStack)
{
}
MessagingSession::MessagingSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle)
: SipSession(pStack, pHandle)
{
}
@ -796,13 +795,13 @@ bool MessagingSession::send(const void* payload, unsigned len, ActionConfig* con
{
int ret;
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
if(payload && len){
if(payload && len) {
ret = tsip_api_message_send_message(m_pHandle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
}
else{
else {
ret = tsip_api_message_send_message(m_pHandle,
TSIP_ACTION_SET_NULL());
}
@ -829,12 +828,12 @@ bool MessagingSession::reject(ActionConfig* config/*=tsk_null*/)
/* ======================== InfoSession ========================*/
InfoSession::InfoSession(SipStack* pStack)
: SipSession(pStack)
: SipSession(pStack)
{
}
InfoSession::InfoSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle)
: SipSession(pStack, pHandle)
{
}
@ -846,13 +845,13 @@ bool InfoSession::send(const void* payload, unsigned len, ActionConfig* config/*
{
int ret;
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
if(payload && len){
if(payload && len) {
ret = tsip_api_info_send_info(m_pHandle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
}
else{
else {
ret = tsip_api_info_send_info(m_pHandle,
TSIP_ACTION_SET_NULL());
}
@ -880,12 +879,12 @@ bool InfoSession::reject(ActionConfig* config/*=tsk_null*/)
/* ======================== OptionsSession ========================*/
OptionsSession::OptionsSession(SipStack* pStack)
: SipSession(pStack)
: SipSession(pStack)
{
}
OptionsSession::OptionsSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle)
: SipSession(pStack, pHandle)
{
}
@ -922,12 +921,12 @@ bool OptionsSession::reject(ActionConfig* config/*=tsk_null*/)
/* ======================== PublicationSession ========================*/
PublicationSession::PublicationSession(SipStack* Stack)
: SipSession(Stack)
: SipSession(Stack)
{
}
PublicationSession::PublicationSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle)
: SipSession(pStack, pHandle)
{
}
@ -940,12 +939,12 @@ bool PublicationSession::publish(const void* payload, unsigned len, ActionConfig
{
int ret;
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
if(payload && len){
if(payload && len) {
ret = tsip_api_publish_send_publish(m_pHandle,
TSIP_ACTION_SET_PAYLOAD(payload, len),
TSIP_ACTION_SET_NULL());
}
else{
else {
ret = tsip_api_publish_send_publish(m_pHandle,
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL());
@ -965,12 +964,12 @@ bool PublicationSession::unPublish(ActionConfig* config/*=tsk_null*/)
/* ======================== RegistrationSession ========================*/
RegistrationSession::RegistrationSession(SipStack* pStack)
: SipSession(pStack)
: SipSession(pStack)
{
}
RegistrationSession::RegistrationSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle)
: SipSession(pStack, pHandle)
{
}
@ -1016,12 +1015,12 @@ bool RegistrationSession::reject(ActionConfig* config/*=tsk_null*/)
/* ======================== SubscriptionSession ========================*/
SubscriptionSession::SubscriptionSession(SipStack* pStack)
: SipSession(pStack)
: SipSession(pStack)
{
}
SubscriptionSession::SubscriptionSession(SipStack* pStack, tsip_ssession_handle_t* pHandle)
: SipSession(pStack, pHandle)
: SipSession(pStack, pHandle)
{
}

View File

@ -34,29 +34,34 @@ class MsrpCallback;
class MediaSessionMgr;
/* ======================== T140Callback ========================*/
class TINYWRAP_API T140CallbackData{
public:
class TINYWRAP_API T140CallbackData
{
public:
#if !defined(SWIG)
T140CallbackData(enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size){
T140CallbackData(enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size) {
m_eType = data_type;
m_pPtr = data_ptr;
m_nSize = data_size;
}
#endif
virtual ~T140CallbackData(){}
virtual ~T140CallbackData() {}
inline enum tmedia_t140_data_type_e getType()const{ return m_eType; }
inline unsigned getSize()const{ return m_nSize; }
inline unsigned getData(void* pOutput, unsigned nMaxsize)const{
inline enum tmedia_t140_data_type_e getType()const {
return m_eType;
}
inline unsigned getSize()const {
return m_nSize;
}
inline unsigned getData(void* pOutput, unsigned nMaxsize)const {
unsigned nRetsize = 0;
if(pOutput && nMaxsize && m_pPtr){
if(pOutput && nMaxsize && m_pPtr) {
nRetsize = (m_nSize > nMaxsize) ? nMaxsize : m_nSize;
memcpy(pOutput, m_pPtr, nRetsize);
}
return nRetsize;
}
private:
private:
enum tmedia_t140_data_type_e m_eType;
const void* m_pPtr;
unsigned m_nSize;
@ -66,21 +71,28 @@ class TINYWRAP_API T140Callback
{
public:
T140Callback() {}
virtual ~T140Callback(){}
virtual int ondata(const T140CallbackData* pData){ return 0; }
virtual ~T140Callback() {}
virtual int ondata(const T140CallbackData* pData) {
return 0;
}
};
#if !defined(SWIG)
class RtcpCallbackData{
public:
RtcpCallbackData(enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media){
class RtcpCallbackData
{
public:
RtcpCallbackData(enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media) {
m_eType = event_type;
m_nSSRC = ssrc_media;
}
virtual ~RtcpCallbackData(){}
inline enum tmedia_rtcp_event_type_e getType()const{ return m_eType; }
inline uint32_t getSSRC()const{ return m_nSSRC; }
private:
virtual ~RtcpCallbackData() {}
inline enum tmedia_rtcp_event_type_e getType()const {
return m_eType;
}
inline uint32_t getSSRC()const {
return m_nSSRC;
}
private:
enum tmedia_rtcp_event_type_e m_eType;
uint32_t m_nSSRC;
};
@ -89,8 +101,10 @@ class TINYWRAP_API RtcpCallback
{
public:
RtcpCallback() {}
virtual ~RtcpCallback(){}
virtual int onevent(const RtcpCallbackData* e){ return 0; }
virtual ~RtcpCallback() {}
virtual int onevent(const RtcpCallbackData* e) {
return 0;
}
};
#endif /* #if !defined(SWIG) */
@ -129,7 +143,9 @@ public:
#if !defined(SWIG)
bool setWebSocketSrc(const char* host, int32_t port, const char* proto);
const SipStack* getStack() const;
const tsip_ssession_handle_t* getWrappedSession() { return m_pHandle; }
const tsip_ssession_handle_t* getWrappedSession() {
return m_pHandle;
}
#endif
private:
@ -243,9 +259,9 @@ public: /* Public functions */
bool sendMessage(const void* payload, unsigned len, ActionConfig* config=tsk_null);
bool sendFile(ActionConfig* config=tsk_null);
public: /* Public helper function */
public: /* Public helper function */
#if !defined(SWIG)
inline MsrpCallback* getCallback()const{
inline MsrpCallback* getCallback()const {
return m_pCallback;
}
#endif

View File

@ -36,13 +36,13 @@ static int stack_callback(const tsip_event_t *sipevent);
static int session_handle_event(const tsip_event_t *sipevent);
SipStack::SipStack(SipCallback* pCallback, const char* realm_uri, const char* impi_uri, const char* impu_uri)
:SafeObject()
:SafeObject()
{
m_pDebugCallback = tsk_null;
m_pCallback = pCallback;
/* Initialize network and media layers */
if(!SipStack::initialize()){
if(!SipStack::initialize()) {
return;// isValid() will be false
}
@ -68,7 +68,7 @@ bool SipStack::start()
bool SipStack::setDebugCallback(DDebugCallback* pCallback)
{
if(this && pCallback){
if(this && pCallback) {
m_pDebugCallback = pCallback;
tsk_debug_set_arg_data(this);
tsk_debug_set_info_cb(DDebugCallback::debug_info_cb);
@ -76,7 +76,7 @@ bool SipStack::setDebugCallback(DDebugCallback* pCallback)
tsk_debug_set_error_cb(DDebugCallback::debug_error_cb);
tsk_debug_set_fatal_cb(DDebugCallback::debug_fatal_cb);
}
else if(this){
else if(this) {
m_pDebugCallback = tsk_null;
tsk_debug_set_arg_data(tsk_null);
tsk_debug_set_info_cb(tsk_null);
@ -163,7 +163,8 @@ bool SipStack::setLocalPort(unsigned short port, const char* transport/*=tsk_nul
TSIP_STACK_SET_NULL()) == 0);
}
bool SipStack::setEarlyIMS(bool enabled){
bool SipStack::setEarlyIMS(bool enabled)
{
return (tsip_stack_set(m_pHandle,
TSIP_STACK_SET_EARLY_IMS(enabled? tsk_true : tsk_false),
TSIP_STACK_SET_NULL()) == 0);
@ -234,7 +235,7 @@ bool SipStack::removeSigCompCompartment(const char* compId)
TSIP_STACK_SET_NULL()) == 0);
}
// @deprecated
// @deprecated
bool SipStack::setSTUNEnabledForICE(bool enabled)
{
#if 0
@ -249,7 +250,7 @@ bool SipStack::setSTUNEnabledForICE(bool enabled)
#endif
}
// @deprecated
// @deprecated
bool SipStack::setSTUNServer(const char* hostname, unsigned short port)
{
#if 0
@ -264,7 +265,7 @@ bool SipStack::setSTUNServer(const char* hostname, unsigned short port)
#endif
}
// @deprecated
// @deprecated
bool SipStack::setSTUNCred(const char* login, const char* password)
{
#if 0
@ -327,14 +328,14 @@ char* SipStack::dnsENUM(const char* service, const char* e164num, const char* do
tnet_dns_ctx_t* dnsctx = tsip_stack_get_dnsctx(m_pHandle);
char* uri = tsk_null;
if(dnsctx){
if(!(uri = tnet_dns_enum_2(dnsctx, service, e164num, domain))){
if(dnsctx) {
if(!(uri = tnet_dns_enum_2(dnsctx, service, e164num, domain))) {
TSK_DEBUG_ERROR("ENUM(%s) failed", e164num);
}
tsk_object_unref(dnsctx);
return uri;
}
else{
else {
TSK_DEBUG_ERROR("No DNS Context could be found");
return tsk_null;
}
@ -348,14 +349,14 @@ char* SipStack::dnsNaptrSrv(const char* domain, const char* service, unsigned sh
*OUTPUT = 0;
if(dnsctx){
if(!tnet_dns_query_naptr_srv(dnsctx, domain, service, &ip, &port)){
if(dnsctx) {
if(!tnet_dns_query_naptr_srv(dnsctx, domain, service, &ip, &port)) {
*OUTPUT = port;
}
tsk_object_unref(dnsctx);
return ip;
}
else{
else {
TSK_DEBUG_ERROR("No DNS Context could be found");
return tsk_null;
}
@ -368,14 +369,14 @@ char* SipStack::dnsSrv(const char* service, unsigned short* OUTPUT)
tnet_port_t port = 0;
*OUTPUT = 0;
if(dnsctx){
if(!tnet_dns_query_srv(dnsctx, service, &ip, &port)){
if(dnsctx) {
if(!tnet_dns_query_srv(dnsctx, service, &ip, &port)) {
*OUTPUT = port;
}
tsk_object_unref(dnsctx);
return ip;
}
else{
else {
TSK_DEBUG_ERROR("No DNS Context could be found");
return tsk_null;
}
@ -394,12 +395,12 @@ char* SipStack::getLocalIPnPort(const char* protocol, unsigned short* OUTPUT)
tnet_port_t port;
int ret;
if(!OUTPUT || !protocol){
if(!OUTPUT || !protocol) {
TSK_DEBUG_ERROR("invalid parameter");
return tsk_null;
}
if((ret = tsip_stack_get_local_ip_n_port(m_pHandle, protocol, &port, &ip))){
if((ret = tsip_stack_get_local_ip_n_port(m_pHandle, protocol, &port, &ip))) {
TSK_DEBUG_ERROR("Failed to get local ip and port with error code=%d", ret);
return tsk_null;
}
@ -412,7 +413,7 @@ char* SipStack::getPreferredIdentity()
{
tsip_uri_t* ppid = tsip_stack_get_preferred_id(m_pHandle);
char* str_ppid = tsk_null;
if(ppid){
if(ppid) {
str_ppid = tsip_uri_tostring(ppid, tsk_false, tsk_false);
TSK_OBJECT_SAFE_FREE(ppid);
}
@ -435,15 +436,15 @@ bool SipStack::initialize()
if (!g_bInitialized) {
int ret;
if((ret = tnet_startup())){
if((ret = tnet_startup())) {
TSK_DEBUG_ERROR("tnet_startup failed with error code=%d", ret);
return false;
}
if((ret = thttp_startup())){
if((ret = thttp_startup())) {
TSK_DEBUG_ERROR("thttp_startup failed with error code=%d", ret);
return false;
}
if((ret = tdav_init())){
if((ret = tdav_init())) {
TSK_DEBUG_ERROR("tdav_init failed with error code=%d", ret);
return false;
}
@ -499,12 +500,12 @@ static int stack_callback(const tsip_event_t *sipevent)
const SipStack* sipStack = tsk_null;
SipEvent* e = tsk_null;
if(!sipevent){ /* should never happen ...but who know? */
if(!sipevent) { /* should never happen ...but who know? */
TSK_DEBUG_WARN("Null SIP event.");
return -1;
}
else {
if(sipevent->type == tsip_event_stack && sipevent->userdata){
if(sipevent->type == tsip_event_stack && sipevent->userdata) {
/* sessionless event */
sipStack = dyn_cast<const SipStack*>((const SipStack*)sipevent->userdata);
}
@ -512,97 +513,97 @@ static int stack_callback(const tsip_event_t *sipevent)
const void* userdata;
/* gets the stack from the session */
const tsip_stack_handle_t* stack_handle = tsip_ssession_get_stack(sipevent->ss);
if(stack_handle && (userdata = tsip_stack_get_userdata(stack_handle))){
if(stack_handle && (userdata = tsip_stack_get_userdata(stack_handle))) {
sipStack = dyn_cast<const SipStack*>((const SipStack*)userdata);
}
}
}
if(!sipStack){
if(!sipStack) {
TSK_DEBUG_WARN("Invalid SIP event (Stack is Null).");
return -2;
}
sipStack->Lock();
switch(sipevent->type){
case tsip_event_register:
{ /* REGISTER */
if(sipStack->getCallback()){
switch(sipevent->type) {
case tsip_event_register: {
/* REGISTER */
if(sipStack->getCallback()) {
e = new RegistrationEvent(sipevent);
sipStack->getCallback()->OnRegistrationEvent((const RegistrationEvent*)e);
}
break;
}
case tsip_event_invite:
{ /* INVITE */
if(sipStack->getCallback()){
case tsip_event_invite: {
/* INVITE */
if(sipStack->getCallback()) {
e = new InviteEvent(sipevent);
sipStack->getCallback()->OnInviteEvent((const InviteEvent*)e);
}
break;
}
case tsip_event_message:
{ /* MESSAGE */
if(sipStack->getCallback()){
case tsip_event_message: {
/* MESSAGE */
if(sipStack->getCallback()) {
e = new MessagingEvent(sipevent);
sipStack->getCallback()->OnMessagingEvent((const MessagingEvent*)e);
}
break;
}
case tsip_event_info:
{ /* INFO */
if(sipStack->getCallback()){
case tsip_event_info: {
/* INFO */
if(sipStack->getCallback()) {
e = new InfoEvent(sipevent);
sipStack->getCallback()->OnInfoEvent((const InfoEvent*)e);
}
break;
}
case tsip_event_options:
{ /* OPTIONS */
if(sipStack->getCallback()){
case tsip_event_options: {
/* OPTIONS */
if(sipStack->getCallback()) {
e = new OptionsEvent(sipevent);
sipStack->getCallback()->OnOptionsEvent((const OptionsEvent*)e);
}
break;
}
case tsip_event_publish:
{ /* PUBLISH */
if(sipStack->getCallback()){
case tsip_event_publish: {
/* PUBLISH */
if(sipStack->getCallback()) {
e = new PublicationEvent(sipevent);
sipStack->getCallback()->OnPublicationEvent((const PublicationEvent*)e);
}
break;
}
case tsip_event_subscribe:
{ /* SUBSCRIBE */
if(sipStack->getCallback()){
case tsip_event_subscribe: {
/* SUBSCRIBE */
if(sipStack->getCallback()) {
e = new SubscriptionEvent(sipevent);
sipStack->getCallback()->OnSubscriptionEvent((const SubscriptionEvent*)e);
}
break;
}
case tsip_event_dialog:
{ /* Common to all dialogs */
if(sipStack->getCallback()){
case tsip_event_dialog: {
/* Common to all dialogs */
if(sipStack->getCallback()) {
e = new DialogEvent(sipevent);
sipStack->getCallback()->OnDialogEvent((const DialogEvent*)e);
}
break;
}
case tsip_event_stack:
{ /* Stack event */
if(sipStack->getCallback()){
case tsip_event_stack: {
/* Stack event */
if(sipStack->getCallback()) {
e = new StackEvent(sipevent);
sipStack->getCallback()->OnStackEvent((const StackEvent*)e);
}
break;
}
default:
{ /* Unsupported */
default: {
/* Unsupported */
TSK_DEBUG_WARN("%d not supported as SIP event.", sipevent->type);
ret = -3;
break;
@ -611,7 +612,7 @@ static int stack_callback(const tsip_event_t *sipevent)
sipStack->UnLock();
if(e){
if(e) {
delete e;
}

View File

@ -101,13 +101,13 @@ public: /* API functions */
public: /* Public helper function */
#if !defined(SWIG)
inline tsip_stack_handle_t* getHandle()const{
inline tsip_stack_handle_t* getHandle()const {
return m_pHandle;
}
inline SipCallback* getCallback()const{
inline SipCallback* getCallback()const {
return m_pCallback;
}
inline DDebugCallback* getDebugCallback() const{
inline DDebugCallback* getDebugCallback() const {
return m_pDebugCallback;
}
#endif

View File

@ -23,7 +23,7 @@
SipUri::SipUri(const char* uriString, const char* displayName/*=tsk_null*/)
{
if((m_pUri = tsip_uri_parse(uriString, (tsk_size_t)tsk_strlen(uriString))) && displayName){
if((m_pUri = tsip_uri_parse(uriString, (tsk_size_t)tsk_strlen(uriString))) && displayName) {
m_pUri->display_name = tsk_strdup(displayName);
}
}
@ -38,7 +38,7 @@ bool SipUri::isValid(const char* uriString)
tsip_uri_t* uri;
bool ret = false;
if((uri = tsip_uri_parse(uriString, (tsk_size_t)tsk_strlen(uriString)))){
if((uri = tsip_uri_parse(uriString, (tsk_size_t)tsk_strlen(uriString)))) {
ret = (uri->type != uri_unknown)
&& (!tsk_strnullORempty(uri->host));
TSK_OBJECT_SAFE_FREE(uri);
@ -53,7 +53,7 @@ bool SipUri::isValid()
const char* SipUri::getScheme()
{
if(m_pUri){
if(m_pUri) {
return m_pUri->scheme;
}
return tsk_null;
@ -86,14 +86,14 @@ const char* SipUri::getDisplayName()
void SipUri::setDisplayName(const char* displayName)
{
if(m_pUri){
if(m_pUri) {
tsk_strupdate(&m_pUri->display_name, displayName);
}
}
const char* SipUri::getParamValue(const char* pname)
{
if(m_pUri && m_pUri->params){
if(m_pUri && m_pUri->params) {
const char* pvalue = tsk_params_get_param_value(m_pUri->params, pname);
return pvalue;
}

View File

@ -45,7 +45,7 @@ public:
const char* getParamValue(const char* pname);
void setDisplayName(const char* displayName);
#if !defined(SWIG)
inline const tsip_uri_t* getWrappedUri()const{
inline const tsip_uri_t* getWrappedUri()const {
return m_pUri;
}
#endif

View File

@ -29,8 +29,7 @@ unsigned XcapStack::count = 0;
static int stack_callback(const thttp_event_t *httpevent);
/* =================================== XCAP Event ==================================== */
typedef enum twrap_xcap_step_type_e
{
typedef enum twrap_xcap_step_type_e {
txst_name,
txst_pos,
txst_att,
@ -39,8 +38,7 @@ typedef enum twrap_xcap_step_type_e
}
twrap_xcap_step_type_t;
typedef struct twrap_xcap_step_s
{
typedef struct twrap_xcap_step_s {
TSK_DECLARE_OBJECT;
twrap_xcap_step_type_t type;
@ -48,7 +46,7 @@ typedef struct twrap_xcap_step_s
char* att_qname;
char* att_value;
unsigned pos;
struct{
struct {
char* prefix;
char* value;
} ns;
@ -58,7 +56,7 @@ twrap_xcap_step_t;
static tsk_object_t* twrap_xcap_step_ctor(tsk_object_t * self, va_list * app)
{
twrap_xcap_step_t *step = (twrap_xcap_step_t *)self;
if(step){
if(step) {
}
return self;
}
@ -66,7 +64,7 @@ static tsk_object_t* twrap_xcap_step_ctor(tsk_object_t * self, va_list * app)
static tsk_object_t* twrap_xcap_step_dtor(tsk_object_t * self)
{
twrap_xcap_step_t *step = (twrap_xcap_step_t *)self;
if(step){
if(step) {
TSK_FREE(step->qname);
TSK_FREE(step->att_qname);
TSK_FREE(step->att_value);
@ -77,8 +75,7 @@ static tsk_object_t* twrap_xcap_step_dtor(tsk_object_t * self)
return self;
}
static const tsk_object_def_t twrap_xcap_step_def_s =
{
static const tsk_object_def_t twrap_xcap_step_def_s = {
sizeof(twrap_xcap_step_t),
twrap_xcap_step_ctor,
twrap_xcap_step_dtor,
@ -86,18 +83,19 @@ static const tsk_object_def_t twrap_xcap_step_def_s =
};
const tsk_object_def_t *twrap_xcap_step_def_t = &twrap_xcap_step_def_s;
twrap_xcap_step_t* twrap_xcap_step_create(twrap_xcap_step_type_t type){
twrap_xcap_step_t* twrap_xcap_step_create(twrap_xcap_step_type_t type)
{
twrap_xcap_step_t* step;
if((step = (twrap_xcap_step_t*)tsk_object_new(twrap_xcap_step_def_t))){
if((step = (twrap_xcap_step_t*)tsk_object_new(twrap_xcap_step_def_t))) {
step->type = type;
}
return step;
}
XcapSelector::XcapSelector(XcapStack* stack)
: auid(tsk_null)
: auid(tsk_null)
{
if(stack){
if(stack) {
this->stack_handle = tsk_object_ref(stack->getHandle());
}
this->steps = tsk_list_create();
@ -113,7 +111,7 @@ XcapSelector* XcapSelector::setAUID(const char* auid)
XcapSelector* XcapSelector::setName(const char* qname)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_name))){
if((step = twrap_xcap_step_create(txst_name))) {
step->qname = tsk_strdup(qname);
tsk_list_push_back_data(this->steps, (void**)&step);
}
@ -123,7 +121,7 @@ XcapSelector* XcapSelector::setName(const char* qname)
XcapSelector* XcapSelector::setAttribute(const char* qname, const char* att_qname, const char* att_value)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_att))){
if((step = twrap_xcap_step_create(txst_att))) {
step->qname = tsk_strdup(qname);
step->att_qname = tsk_strdup(att_qname);
step->att_value = tsk_strdup(att_value);
@ -135,7 +133,7 @@ XcapSelector* XcapSelector::setAttribute(const char* qname, const char* att_qnam
XcapSelector* XcapSelector::setPos(const char* qname, unsigned pos)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_pos))){
if((step = twrap_xcap_step_create(txst_pos))) {
step->qname = tsk_strdup(qname);
step->pos = pos;
tsk_list_push_back_data(this->steps, (void**)&step);
@ -146,7 +144,7 @@ XcapSelector* XcapSelector::setPos(const char* qname, unsigned pos)
XcapSelector* XcapSelector::setPosAttribute(const char* qname, unsigned pos, const char* att_qname, const char* att_value)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_pos))){
if((step = twrap_xcap_step_create(txst_pos))) {
step->qname = tsk_strdup(qname);
step->pos = pos;
step->att_qname = tsk_strdup(att_qname);
@ -159,7 +157,7 @@ XcapSelector* XcapSelector::setPosAttribute(const char* qname, unsigned pos, con
XcapSelector* XcapSelector::setNamespace(const char* prefix, const char* value)
{
twrap_xcap_step_t* step;
if((step = twrap_xcap_step_create(txst_ns))){
if((step = twrap_xcap_step_create(txst_ns))) {
step->ns.prefix = tsk_strdup(prefix);
step->ns.value = tsk_strdup(value);
tsk_list_push_back_data(this->steps, (void**)&step);
@ -178,11 +176,11 @@ char* XcapSelector::getString()
const twrap_xcap_step_t* step;
/* Node */
tsk_list_foreach(item, this->steps){
tsk_list_foreach(item, this->steps) {
step = (twrap_xcap_step_t*)item->data;
switch(step->type){
switch(step->type) {
case txst_name:
if(tsk_buffer_append_2(buffer, "/%s", step->qname)){
if(tsk_buffer_append_2(buffer, "/%s", step->qname)) {
goto bail;
}
break;
@ -214,23 +212,23 @@ char* XcapSelector::getString()
} /* for */
/* append the namespace */
if(_namespace){
if(_namespace) {
tsk_buffer_append(buffer, _namespace, (tsk_size_t)tsk_strlen(_namespace));
TSK_FREE(_namespace);
}
bail:
if(TSK_BUFFER_DATA(buffer) && TSK_BUFFER_SIZE(buffer)){
if(TSK_BUFFER_DATA(buffer) && TSK_BUFFER_SIZE(buffer)) {
node = tsk_strndup((const char*)TSK_BUFFER_DATA(buffer), TSK_BUFFER_SIZE(buffer));
}
TSK_OBJECT_SAFE_FREE(buffer);
/* Document */
if(this->auid){
if(this->auid) {
char* document;
if((document = txcap_selector_get_document(this->stack_handle, this->auid))){
if(node){
if((document = txcap_selector_get_document(this->stack_handle, this->auid))) {
if(node) {
tsk_strcat_2(&document, "/~~/%s%s", this->auid, node);
TSK_FREE(node);
}
@ -257,7 +255,7 @@ XcapSelector::~XcapSelector()
/* =================================== XCAP Message ==================================== */
XcapMessage::XcapMessage() :
httpmessage(tsk_null)
httpmessage(tsk_null)
{
}
@ -272,7 +270,7 @@ XcapMessage::~XcapMessage()
short XcapMessage::getCode() const
{
if(this->httpmessage){
if(this->httpmessage) {
return this->httpmessage->line.response.status_code;
}
return 0;
@ -280,7 +278,7 @@ short XcapMessage::getCode() const
const char* XcapMessage::getPhrase() const
{
if(this->httpmessage){
if(this->httpmessage) {
return this->httpmessage->line.response.reason_phrase;
}
return tsk_null;
@ -289,7 +287,7 @@ const char* XcapMessage::getPhrase() const
char* XcapMessage::getXcapHeaderValue(const char* name, unsigned index /*= 0*/)
{
const thttp_header_t* header;
if((header = thttp_message_get_headerByName(this->httpmessage, name))){
if((header = thttp_message_get_headerByName(this->httpmessage, name))) {
return thttp_header_value_tostring(header);
}
return tsk_null;
@ -298,9 +296,9 @@ char* XcapMessage::getXcapHeaderValue(const char* name, unsigned index /*= 0*/)
char* XcapMessage::getXcapHeaderParamValue(const char* name, const char* pname, unsigned index /*= 0*/)
{
const thttp_header_t* header;
if((header = thttp_message_get_headerByName(this->httpmessage, name))){
if((header = thttp_message_get_headerByName(this->httpmessage, name))) {
const tsk_param_t* param;
if((param = tsk_params_get_param_by_name(header->params, pname))){
if((param = tsk_params_get_param_by_name(header->params, pname))) {
return tsk_strdup(param->value);
}
}
@ -309,7 +307,7 @@ char* XcapMessage::getXcapHeaderParamValue(const char* name, const char* pname,
unsigned XcapMessage::getXcapContentLength()
{
if(this->httpmessage && this->httpmessage->Content){
if(this->httpmessage && this->httpmessage->Content) {
return this->httpmessage->Content->size;
}
return 0;
@ -318,7 +316,7 @@ unsigned XcapMessage::getXcapContentLength()
unsigned XcapMessage::getXcapContent(void* output, unsigned maxsize)
{
unsigned retsize = 0;
if(output && maxsize && this->httpmessage->Content){
if(output && maxsize && this->httpmessage->Content) {
retsize = (this->httpmessage->Content->size > maxsize) ? maxsize : this->httpmessage->Content->size;
memcpy(output, this->httpmessage->Content->data, retsize);
}
@ -330,17 +328,17 @@ unsigned XcapMessage::getXcapContent(void* output, unsigned maxsize)
XcapEvent::XcapEvent(const thttp_event_t *_httpevent)
{
this->httpevent = _httpevent;
if(_httpevent){
if(_httpevent) {
this->httpmessage = new XcapMessage(_httpevent->message);
}
else{
else {
this->httpmessage = tsk_null;
}
}
XcapEvent::~XcapEvent()
{
if(this->httpmessage){
if(this->httpmessage) {
delete this->httpmessage;
}
}
@ -375,7 +373,7 @@ XcapCallback::~XcapCallback()
XcapStack::XcapStack(XcapCallback* _callback, const char* xui, const char* password, const char* xcap_root)
{
/* Initialize network layer */
if(XcapStack::count == 0){
if(XcapStack::count == 0) {
tnet_startup();
}
@ -390,7 +388,7 @@ XcapStack::~XcapStack()
TSK_OBJECT_SAFE_FREE(this->handle);
/* DeInitialize the network layer (only if last stack) */
if(--XcapStack::count == 0){
if(--XcapStack::count == 0) {
tnet_cleanup();
}
}
@ -398,7 +396,7 @@ XcapStack::~XcapStack()
bool XcapStack::registerAUID(const char* id, const char* mime_type, const char* ns, const char* document_name, bool is_global)
{
txcap_stack_t* stack = (txcap_stack_t*)this->handle;
if(stack){
if(stack) {
tsk_bool_t _global = is_global?tsk_true:tsk_false; // 32bit <-> 64bit workaround
return (txcap_auid_register(stack->auids, id, mime_type, ns, document_name, _global) == 0);
}
@ -545,13 +543,13 @@ int stack_callback(const thttp_event_t *httpevent)
XcapEvent* e = tsk_null;
const txcap_stack_handle_t* stack_handle = thttp_session_get_userdata(httpevent->session);
if(!stack_handle || !(stack = dyn_cast<const XcapStack*>((const XcapStack*)stack_handle))){
if(!stack_handle || !(stack = dyn_cast<const XcapStack*>((const XcapStack*)stack_handle))) {
TSK_DEBUG_ERROR("Invalid user data");
return -1;
}
if(stack->getCallback()){
if((e = new XcapEvent(httpevent))){
if(stack->getCallback()) {
if((e = new XcapEvent(httpevent))) {
stack->getCallback()->onEvent(e);
delete e;
}

View File

@ -106,7 +106,9 @@ public:
XcapCallback();
virtual ~XcapCallback();
virtual int onEvent(const XcapEvent* e)const { return -1; }
virtual int onEvent(const XcapEvent* e)const {
return -1;
}
};
@ -146,10 +148,10 @@ public: /* API functions */
public: /* Public helper function */
#if !defined(SWIG)
txcap_stack_handle_t* getHandle(){
txcap_stack_handle_t* getHandle() {
return this->handle;
}
XcapCallback* getCallback()const{
XcapCallback* getCallback()const {
return this->callback;
}
#endif

View File

@ -33,6 +33,7 @@
%newobject SipStack::getPreferredIdentity;
%newobject SipStack::getLocalIPnPort;
%newobject MediaSessionMgr::producerGetCodec;
%newobject MediaSessionMgr::sessionGetQoS;
%newobject MessagingEvent::takeSessionOwnership;
%newobject InviteEvent::takeCallSessionOwnership;

View File

@ -66,7 +66,7 @@
#if HAVE_CONFIG_H
#include "../config.h"
#include "../config.h"
#endif
#endif // TINYWRAP_CONFIG_H

View File

@ -51,6 +51,12 @@ public class MediaSessionMgr : IDisposable {
return ret;
}
public QoS sessionGetQoS(twrap_media_type_t media) {
IntPtr cPtr = tinyWRAPPINVOKE.MediaSessionMgr_sessionGetQoS(swigCPtr, (int)media);
QoS ret = (cPtr == IntPtr.Zero) ? null : new QoS(cPtr, true);
return ret;
}
public bool consumerSetInt32(twrap_media_type_t media, string key, int value) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_consumerSetInt32(swigCPtr, (int)media, key, value);
return ret;
@ -149,6 +155,16 @@ public class MediaSessionMgr : IDisposable {
return ret;
}
public static bool defaultsSetPrefVideoSizeOutRange(tmedia_pref_video_size_t min, tmedia_pref_video_size_t max) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange((int)min, (int)max);
return ret;
}
public static bool defaultsSetAdaptativeVideoSizeOutEnabled(bool enabled) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(enabled);
return ret;
}
public static bool defaultsSetJbMargin(uint jb_margin_ms) {
bool ret = tinyWRAPPINVOKE.MediaSessionMgr_defaultsSetJbMargin(jb_margin_ms);
return ret;

121
bindings/csharp/QoS.cs Normal file
View File

@ -0,0 +1,121 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.9
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace org.doubango.tinyWRAP {
using System;
using System.Runtime.InteropServices;
public class QoS : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal QoS(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(QoS obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
~QoS() {
Dispose();
}
public virtual void Dispose() {
lock(this) {
if (swigCPtr.Handle != IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPPINVOKE.delete_QoS(swigCPtr);
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
GC.SuppressFinalize(this);
}
}
public float getQavg() {
float ret = tinyWRAPPINVOKE.QoS_getQavg(swigCPtr);
return ret;
}
public float getQ1() {
float ret = tinyWRAPPINVOKE.QoS_getQ1(swigCPtr);
return ret;
}
public float getQ2() {
float ret = tinyWRAPPINVOKE.QoS_getQ2(swigCPtr);
return ret;
}
public float getQ3() {
float ret = tinyWRAPPINVOKE.QoS_getQ3(swigCPtr);
return ret;
}
public float getQ4() {
float ret = tinyWRAPPINVOKE.QoS_getQ4(swigCPtr);
return ret;
}
public float getQ5() {
float ret = tinyWRAPPINVOKE.QoS_getQ5(swigCPtr);
return ret;
}
public uint getVideoInWidth() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoInWidth(swigCPtr);
return ret;
}
public uint getVideoOutWidth() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoOutWidth(swigCPtr);
return ret;
}
public uint getVideoInHeight() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoInHeight(swigCPtr);
return ret;
}
public uint getVideoOutHeight() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoOutHeight(swigCPtr);
return ret;
}
public uint getBandwidthDownKbps() {
uint ret = tinyWRAPPINVOKE.QoS_getBandwidthDownKbps(swigCPtr);
return ret;
}
public uint getBandwidthUpKbps() {
uint ret = tinyWRAPPINVOKE.QoS_getBandwidthUpKbps(swigCPtr);
return ret;
}
public uint getVideoInAvgFps() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoInAvgFps(swigCPtr);
return ret;
}
public uint getVideoDecAvgTime() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoDecAvgTime(swigCPtr);
return ret;
}
public uint getVideoEncAvgTime() {
uint ret = tinyWRAPPINVOKE.QoS_getVideoEncAvgTime(swigCPtr);
return ret;
}
}
}

View File

@ -264,6 +264,54 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_ActionConfig_setMediaInt")]
public static extern IntPtr ActionConfig_setMediaInt(HandleRef jarg1, int jarg2, string jarg3, int jarg4);
[DllImport("tinyWRAP", EntryPoint="CSharp_delete_QoS")]
public static extern void delete_QoS(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getQavg")]
public static extern float QoS_getQavg(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getQ1")]
public static extern float QoS_getQ1(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getQ2")]
public static extern float QoS_getQ2(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getQ3")]
public static extern float QoS_getQ3(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getQ4")]
public static extern float QoS_getQ4(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getQ5")]
public static extern float QoS_getQ5(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoInWidth")]
public static extern uint QoS_getVideoInWidth(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoOutWidth")]
public static extern uint QoS_getVideoOutWidth(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoInHeight")]
public static extern uint QoS_getVideoInHeight(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoOutHeight")]
public static extern uint QoS_getVideoOutHeight(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getBandwidthDownKbps")]
public static extern uint QoS_getBandwidthDownKbps(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getBandwidthUpKbps")]
public static extern uint QoS_getBandwidthUpKbps(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoInAvgFps")]
public static extern uint QoS_getVideoInAvgFps(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoDecAvgTime")]
public static extern uint QoS_getVideoDecAvgTime(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_QoS_getVideoEncAvgTime")]
public static extern uint QoS_getVideoEncAvgTime(HandleRef jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_delete_Codec")]
public static extern void delete_Codec(HandleRef jarg1);
@ -297,6 +345,9 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_sessionGetInt32")]
public static extern int MediaSessionMgr_sessionGetInt32(HandleRef jarg1, int jarg2, string jarg3);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_sessionGetQoS")]
public static extern IntPtr MediaSessionMgr_sessionGetQoS(HandleRef jarg1, int jarg2);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_consumerSetInt32")]
public static extern bool MediaSessionMgr_consumerSetInt32(HandleRef jarg1, int jarg2, string jarg3, int jarg4);
@ -354,6 +405,12 @@ class tinyWRAPPINVOKE {
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetPrefVideoSize")]
public static extern bool MediaSessionMgr_defaultsSetPrefVideoSize(int jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetPrefVideoSizeOutRange")]
public static extern bool MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(int jarg1, int jarg2);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled")]
public static extern bool MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(bool jarg1);
[DllImport("tinyWRAP", EntryPoint="CSharp_MediaSessionMgr_defaultsSetJbMargin")]
public static extern bool MediaSessionMgr_defaultsSetJbMargin(uint jarg1);

View File

@ -1488,6 +1488,194 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_ActionConfig_setMediaInt(void * jarg1, int
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_QoS(void * jarg1) {
QoS *arg1 = (QoS *) 0 ;
arg1 = (QoS *)jarg1;
delete arg1;
}
SWIGEXPORT float SWIGSTDCALL CSharp_QoS_getQavg(void * jarg1) {
float jresult ;
QoS *arg1 = (QoS *) 0 ;
float result;
arg1 = (QoS *)jarg1;
result = (float)(arg1)->getQavg();
jresult = result;
return jresult;
}
SWIGEXPORT float SWIGSTDCALL CSharp_QoS_getQ1(void * jarg1) {
float jresult ;
QoS *arg1 = (QoS *) 0 ;
float result;
arg1 = (QoS *)jarg1;
result = (float)(arg1)->getQ1();
jresult = result;
return jresult;
}
SWIGEXPORT float SWIGSTDCALL CSharp_QoS_getQ2(void * jarg1) {
float jresult ;
QoS *arg1 = (QoS *) 0 ;
float result;
arg1 = (QoS *)jarg1;
result = (float)(arg1)->getQ2();
jresult = result;
return jresult;
}
SWIGEXPORT float SWIGSTDCALL CSharp_QoS_getQ3(void * jarg1) {
float jresult ;
QoS *arg1 = (QoS *) 0 ;
float result;
arg1 = (QoS *)jarg1;
result = (float)(arg1)->getQ3();
jresult = result;
return jresult;
}
SWIGEXPORT float SWIGSTDCALL CSharp_QoS_getQ4(void * jarg1) {
float jresult ;
QoS *arg1 = (QoS *) 0 ;
float result;
arg1 = (QoS *)jarg1;
result = (float)(arg1)->getQ4();
jresult = result;
return jresult;
}
SWIGEXPORT float SWIGSTDCALL CSharp_QoS_getQ5(void * jarg1) {
float jresult ;
QoS *arg1 = (QoS *) 0 ;
float result;
arg1 = (QoS *)jarg1;
result = (float)(arg1)->getQ5();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoInWidth(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoInWidth();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoOutWidth(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoOutWidth();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoInHeight(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoInHeight();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoOutHeight(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoOutHeight();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getBandwidthDownKbps(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getBandwidthDownKbps();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getBandwidthUpKbps(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getBandwidthUpKbps();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoInAvgFps(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoInAvgFps();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoDecAvgTime(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoDecAvgTime();
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_QoS_getVideoEncAvgTime(void * jarg1) {
unsigned int jresult ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
arg1 = (QoS *)jarg1;
result = (unsigned int)(arg1)->getVideoEncAvgTime();
jresult = result;
return jresult;
}
SWIGEXPORT void SWIGSTDCALL CSharp_delete_Codec(void * jarg1) {
Codec *arg1 = (Codec *) 0 ;
@ -1622,6 +1810,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_MediaSessionMgr_sessionGetInt32(void * jarg1,
}
SWIGEXPORT void * SWIGSTDCALL CSharp_MediaSessionMgr_sessionGetQoS(void * jarg1, int jarg2) {
void * jresult ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
QoS *result = 0 ;
arg1 = (MediaSessionMgr *)jarg1;
arg2 = (twrap_media_type_t)jarg2;
result = (QoS *)(arg1)->sessionGetQoS(arg2);
jresult = (void *)result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_consumerSetInt32(void * jarg1, int jarg2, char * jarg3, int jarg4) {
unsigned int jresult ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
@ -1878,6 +2080,32 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetPrefVideoS
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(int jarg1, int jarg2) {
unsigned int jresult ;
tmedia_pref_video_size_t arg1 ;
tmedia_pref_video_size_t arg2 ;
bool result;
arg1 = (tmedia_pref_video_size_t)jarg1;
arg2 = (tmedia_pref_video_size_t)jarg2;
result = (bool)MediaSessionMgr::defaultsSetPrefVideoSizeOutRange(arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(unsigned int jarg1) {
unsigned int jresult ;
bool arg1 ;
bool result;
arg1 = jarg1 ? true : false;
result = (bool)MediaSessionMgr::defaultsSetAdaptativeVideoSizeOutEnabled(arg1);
jresult = result;
return jresult;
}
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_MediaSessionMgr_defaultsSetJbMargin(unsigned int jarg1) {
unsigned int jresult ;
uint32_t arg1 ;

View File

@ -43,6 +43,11 @@ public class MediaSessionMgr {
return tinyWRAPJNI.MediaSessionMgr_sessionGetInt32(swigCPtr, this, media.swigValue(), key);
}
public QoS sessionGetQoS(twrap_media_type_t media) {
long cPtr = tinyWRAPJNI.MediaSessionMgr_sessionGetQoS(swigCPtr, this, media.swigValue());
return (cPtr == 0) ? null : new QoS(cPtr, true);
}
public boolean consumerSetInt32(twrap_media_type_t media, String key, int value) {
return tinyWRAPJNI.MediaSessionMgr_consumerSetInt32(swigCPtr, this, media.swigValue(), key, value);
}
@ -122,6 +127,14 @@ public class MediaSessionMgr {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetPrefVideoSize(pref_video_size.swigValue());
}
public static boolean defaultsSetPrefVideoSizeOutRange(tmedia_pref_video_size_t min, tmedia_pref_video_size_t max) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(min.swigValue(), max.swigValue());
}
public static boolean defaultsSetAdaptativeVideoSizeOutEnabled(boolean enabled) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(enabled);
}
public static boolean defaultsSetJbMargin(long jb_margin_ms) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetJbMargin(jb_margin_ms);
}

98
bindings/java/QoS.java Normal file
View File

@ -0,0 +1,98 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.9
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package org.doubango.tinyWRAP;
public class QoS {
private long swigCPtr;
protected boolean swigCMemOwn;
protected QoS(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(QoS obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPJNI.delete_QoS(swigCPtr);
}
swigCPtr = 0;
}
}
public float getQavg() {
return tinyWRAPJNI.QoS_getQavg(swigCPtr, this);
}
public float getQ1() {
return tinyWRAPJNI.QoS_getQ1(swigCPtr, this);
}
public float getQ2() {
return tinyWRAPJNI.QoS_getQ2(swigCPtr, this);
}
public float getQ3() {
return tinyWRAPJNI.QoS_getQ3(swigCPtr, this);
}
public float getQ4() {
return tinyWRAPJNI.QoS_getQ4(swigCPtr, this);
}
public float getQ5() {
return tinyWRAPJNI.QoS_getQ5(swigCPtr, this);
}
public long getVideoInWidth() {
return tinyWRAPJNI.QoS_getVideoInWidth(swigCPtr, this);
}
public long getVideoOutWidth() {
return tinyWRAPJNI.QoS_getVideoOutWidth(swigCPtr, this);
}
public long getVideoInHeight() {
return tinyWRAPJNI.QoS_getVideoInHeight(swigCPtr, this);
}
public long getVideoOutHeight() {
return tinyWRAPJNI.QoS_getVideoOutHeight(swigCPtr, this);
}
public long getBandwidthDownKbps() {
return tinyWRAPJNI.QoS_getBandwidthDownKbps(swigCPtr, this);
}
public long getBandwidthUpKbps() {
return tinyWRAPJNI.QoS_getBandwidthUpKbps(swigCPtr, this);
}
public long getVideoInAvgFps() {
return tinyWRAPJNI.QoS_getVideoInAvgFps(swigCPtr, this);
}
public long getVideoDecAvgTime() {
return tinyWRAPJNI.QoS_getVideoDecAvgTime(swigCPtr, this);
}
public long getVideoEncAvgTime() {
return tinyWRAPJNI.QoS_getVideoEncAvgTime(swigCPtr, this);
}
}

View File

@ -43,6 +43,11 @@ public class MediaSessionMgr {
return tinyWRAPJNI.MediaSessionMgr_sessionGetInt32(swigCPtr, this, media.swigValue(), key);
}
public QoS sessionGetQoS(twrap_media_type_t media) {
long cPtr = tinyWRAPJNI.MediaSessionMgr_sessionGetQoS(swigCPtr, this, media.swigValue());
return (cPtr == 0) ? null : new QoS(cPtr, true);
}
public boolean consumerSetInt32(twrap_media_type_t media, String key, int value) {
return tinyWRAPJNI.MediaSessionMgr_consumerSetInt32(swigCPtr, this, media.swigValue(), key, value);
}
@ -122,6 +127,14 @@ public class MediaSessionMgr {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetPrefVideoSize(pref_video_size.swigValue());
}
public static boolean defaultsSetPrefVideoSizeOutRange(tmedia_pref_video_size_t min, tmedia_pref_video_size_t max) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(min.swigValue(), max.swigValue());
}
public static boolean defaultsSetAdaptativeVideoSizeOutEnabled(boolean enabled) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(enabled);
}
public static boolean defaultsSetJbMargin(long jb_margin_ms) {
return tinyWRAPJNI.MediaSessionMgr_defaultsSetJbMargin(jb_margin_ms);
}

View File

@ -0,0 +1,98 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.9
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package org.doubango.tinyWRAP;
public class QoS {
private long swigCPtr;
protected boolean swigCMemOwn;
protected QoS(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(QoS obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
tinyWRAPJNI.delete_QoS(swigCPtr);
}
swigCPtr = 0;
}
}
public float getQavg() {
return tinyWRAPJNI.QoS_getQavg(swigCPtr, this);
}
public float getQ1() {
return tinyWRAPJNI.QoS_getQ1(swigCPtr, this);
}
public float getQ2() {
return tinyWRAPJNI.QoS_getQ2(swigCPtr, this);
}
public float getQ3() {
return tinyWRAPJNI.QoS_getQ3(swigCPtr, this);
}
public float getQ4() {
return tinyWRAPJNI.QoS_getQ4(swigCPtr, this);
}
public float getQ5() {
return tinyWRAPJNI.QoS_getQ5(swigCPtr, this);
}
public long getVideoInWidth() {
return tinyWRAPJNI.QoS_getVideoInWidth(swigCPtr, this);
}
public long getVideoOutWidth() {
return tinyWRAPJNI.QoS_getVideoOutWidth(swigCPtr, this);
}
public long getVideoInHeight() {
return tinyWRAPJNI.QoS_getVideoInHeight(swigCPtr, this);
}
public long getVideoOutHeight() {
return tinyWRAPJNI.QoS_getVideoOutHeight(swigCPtr, this);
}
public long getBandwidthDownKbps() {
return tinyWRAPJNI.QoS_getBandwidthDownKbps(swigCPtr, this);
}
public long getBandwidthUpKbps() {
return tinyWRAPJNI.QoS_getBandwidthUpKbps(swigCPtr, this);
}
public long getVideoInAvgFps() {
return tinyWRAPJNI.QoS_getVideoInAvgFps(swigCPtr, this);
}
public long getVideoDecAvgTime() {
return tinyWRAPJNI.QoS_getVideoDecAvgTime(swigCPtr, this);
}
public long getVideoEncAvgTime() {
return tinyWRAPJNI.QoS_getVideoEncAvgTime(swigCPtr, this);
}
}

View File

@ -35,6 +35,22 @@ public class tinyWRAPJNI {
public final static native long ActionConfig_setResponseLine(long jarg1, ActionConfig jarg1_, short jarg2, String jarg3);
public final static native long ActionConfig_setMediaString(long jarg1, ActionConfig jarg1_, int jarg2, String jarg3, String jarg4);
public final static native long ActionConfig_setMediaInt(long jarg1, ActionConfig jarg1_, int jarg2, String jarg3, int jarg4);
public final static native void delete_QoS(long jarg1);
public final static native float QoS_getQavg(long jarg1, QoS jarg1_);
public final static native float QoS_getQ1(long jarg1, QoS jarg1_);
public final static native float QoS_getQ2(long jarg1, QoS jarg1_);
public final static native float QoS_getQ3(long jarg1, QoS jarg1_);
public final static native float QoS_getQ4(long jarg1, QoS jarg1_);
public final static native float QoS_getQ5(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoInWidth(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoOutWidth(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoInHeight(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoOutHeight(long jarg1, QoS jarg1_);
public final static native long QoS_getBandwidthDownKbps(long jarg1, QoS jarg1_);
public final static native long QoS_getBandwidthUpKbps(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoInAvgFps(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoDecAvgTime(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoEncAvgTime(long jarg1, QoS jarg1_);
public final static native void delete_Codec(long jarg1);
public final static native int Codec_getMediaType(long jarg1, Codec jarg1_);
public final static native String Codec_getName(long jarg1, Codec jarg1_);
@ -46,6 +62,7 @@ public class tinyWRAPJNI {
public final static native void delete_MediaSessionMgr(long jarg1);
public final static native boolean MediaSessionMgr_sessionSetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, int jarg4);
public final static native int MediaSessionMgr_sessionGetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3);
public final static native long MediaSessionMgr_sessionGetQoS(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native boolean MediaSessionMgr_consumerSetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, int jarg4);
public final static native boolean MediaSessionMgr_consumerSetInt64(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, long jarg4);
public final static native boolean MediaSessionMgr_producerSetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, int jarg4);
@ -65,6 +82,8 @@ public class tinyWRAPJNI {
public final static native boolean MediaSessionMgr_defaultsSetBandwidthVideoUploadMax(int jarg1);
public final static native boolean MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax(int jarg1);
public final static native boolean MediaSessionMgr_defaultsSetPrefVideoSize(int jarg1);
public final static native boolean MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(int jarg1, int jarg2);
public final static native boolean MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(boolean jarg1);
public final static native boolean MediaSessionMgr_defaultsSetJbMargin(long jarg1);
public final static native boolean MediaSessionMgr_defaultsSetJbMaxLateRate(long jarg1);
public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1);

View File

@ -2407,6 +2407,241 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ActionConfig_1se
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1QoS(JNIEnv *jenv, jclass jcls, jlong jarg1) {
QoS *arg1 = (QoS *) 0 ;
(void)jenv;
(void)jcls;
arg1 = *(QoS **)&jarg1;
delete arg1;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQavg(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQavg();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ1();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ2(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ2();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ3(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ3();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ4(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ4();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ5(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ5();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoInWidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoInWidth();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoOutWidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoOutWidth();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoInHeight(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoInHeight();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoOutHeight(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoOutHeight();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getBandwidthDownKbps(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getBandwidthDownKbps();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getBandwidthUpKbps(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getBandwidthUpKbps();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoInAvgFps(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoInAvgFps();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoDecAvgTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoDecAvgTime();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoEncAvgTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoEncAvgTime();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1Codec(JNIEnv *jenv, jclass jcls, jlong jarg1) {
Codec *arg1 = (Codec *) 0 ;
@ -2582,6 +2817,23 @@ SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1sessionGetQoS(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jlong jresult = 0 ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
QoS *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(MediaSessionMgr **)&jarg1;
arg2 = (twrap_media_type_t)jarg2;
result = (QoS *)(arg1)->sessionGetQoS(arg2);
*(QoS **)&jresult = result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1consumerSetInt32(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4) {
jboolean jresult = 0 ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
@ -2925,6 +3177,36 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionM
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetPrefVideoSizeOutRange(JNIEnv *jenv, jclass jcls, jint jarg1, jint jarg2) {
jboolean jresult = 0 ;
tmedia_pref_video_size_t arg1 ;
tmedia_pref_video_size_t arg2 ;
bool result;
(void)jenv;
(void)jcls;
arg1 = (tmedia_pref_video_size_t)jarg1;
arg2 = (tmedia_pref_video_size_t)jarg2;
result = (bool)MediaSessionMgr::defaultsSetPrefVideoSizeOutRange(arg1,arg2);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetAdaptativeVideoSizeOutEnabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
jboolean jresult = 0 ;
bool arg1 ;
bool result;
(void)jenv;
(void)jcls;
arg1 = jarg1 ? true : false;
result = (bool)MediaSessionMgr::defaultsSetAdaptativeVideoSizeOutEnabled(arg1);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetJbMargin(JNIEnv *jenv, jclass jcls, jlong jarg1) {
jboolean jresult = 0 ;
uint32_t arg1 ;

View File

@ -35,6 +35,22 @@ public class tinyWRAPJNI {
public final static native long ActionConfig_setResponseLine(long jarg1, ActionConfig jarg1_, short jarg2, String jarg3);
public final static native long ActionConfig_setMediaString(long jarg1, ActionConfig jarg1_, int jarg2, String jarg3, String jarg4);
public final static native long ActionConfig_setMediaInt(long jarg1, ActionConfig jarg1_, int jarg2, String jarg3, int jarg4);
public final static native void delete_QoS(long jarg1);
public final static native float QoS_getQavg(long jarg1, QoS jarg1_);
public final static native float QoS_getQ1(long jarg1, QoS jarg1_);
public final static native float QoS_getQ2(long jarg1, QoS jarg1_);
public final static native float QoS_getQ3(long jarg1, QoS jarg1_);
public final static native float QoS_getQ4(long jarg1, QoS jarg1_);
public final static native float QoS_getQ5(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoInWidth(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoOutWidth(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoInHeight(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoOutHeight(long jarg1, QoS jarg1_);
public final static native long QoS_getBandwidthDownKbps(long jarg1, QoS jarg1_);
public final static native long QoS_getBandwidthUpKbps(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoInAvgFps(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoDecAvgTime(long jarg1, QoS jarg1_);
public final static native long QoS_getVideoEncAvgTime(long jarg1, QoS jarg1_);
public final static native void delete_Codec(long jarg1);
public final static native int Codec_getMediaType(long jarg1, Codec jarg1_);
public final static native String Codec_getName(long jarg1, Codec jarg1_);
@ -46,6 +62,7 @@ public class tinyWRAPJNI {
public final static native void delete_MediaSessionMgr(long jarg1);
public final static native boolean MediaSessionMgr_sessionSetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, int jarg4);
public final static native int MediaSessionMgr_sessionGetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3);
public final static native long MediaSessionMgr_sessionGetQoS(long jarg1, MediaSessionMgr jarg1_, int jarg2);
public final static native boolean MediaSessionMgr_consumerSetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, int jarg4);
public final static native boolean MediaSessionMgr_consumerSetInt64(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, long jarg4);
public final static native boolean MediaSessionMgr_producerSetInt32(long jarg1, MediaSessionMgr jarg1_, int jarg2, String jarg3, int jarg4);
@ -65,6 +82,8 @@ public class tinyWRAPJNI {
public final static native boolean MediaSessionMgr_defaultsSetBandwidthVideoUploadMax(int jarg1);
public final static native boolean MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax(int jarg1);
public final static native boolean MediaSessionMgr_defaultsSetPrefVideoSize(int jarg1);
public final static native boolean MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(int jarg1, int jarg2);
public final static native boolean MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(boolean jarg1);
public final static native boolean MediaSessionMgr_defaultsSetJbMargin(long jarg1);
public final static native boolean MediaSessionMgr_defaultsSetJbMaxLateRate(long jarg1);
public final static native boolean MediaSessionMgr_defaultsSetEchoTail(long jarg1);

View File

@ -2407,6 +2407,241 @@ SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_ActionConfig_1se
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1QoS(JNIEnv *jenv, jclass jcls, jlong jarg1) {
QoS *arg1 = (QoS *) 0 ;
(void)jenv;
(void)jcls;
arg1 = *(QoS **)&jarg1;
delete arg1;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQavg(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQavg();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ1(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ1();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ2(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ2();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ3(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ3();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ4(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ4();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jfloat JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getQ5(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jfloat jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
float result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (float)(arg1)->getQ5();
jresult = (jfloat)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoInWidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoInWidth();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoOutWidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoOutWidth();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoInHeight(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoInHeight();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoOutHeight(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoOutHeight();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getBandwidthDownKbps(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getBandwidthDownKbps();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getBandwidthUpKbps(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getBandwidthUpKbps();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoInAvgFps(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoInAvgFps();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoDecAvgTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoDecAvgTime();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_QoS_1getVideoEncAvgTime(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
jlong jresult = 0 ;
QoS *arg1 = (QoS *) 0 ;
unsigned int result;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(QoS **)&jarg1;
result = (unsigned int)(arg1)->getVideoEncAvgTime();
jresult = (jlong)result;
return jresult;
}
SWIGEXPORT void JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_delete_1Codec(JNIEnv *jenv, jclass jcls, jlong jarg1) {
Codec *arg1 = (Codec *) 0 ;
@ -2582,6 +2817,23 @@ SWIGEXPORT jint JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1
}
SWIGEXPORT jlong JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1sessionGetQoS(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2) {
jlong jresult = 0 ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
QoS *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(MediaSessionMgr **)&jarg1;
arg2 = (twrap_media_type_t)jarg2;
result = (QoS *)(arg1)->sessionGetQoS(arg2);
*(QoS **)&jresult = result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1consumerSetInt32(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4) {
jboolean jresult = 0 ;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
@ -2925,6 +3177,36 @@ SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionM
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetPrefVideoSizeOutRange(JNIEnv *jenv, jclass jcls, jint jarg1, jint jarg2) {
jboolean jresult = 0 ;
tmedia_pref_video_size_t arg1 ;
tmedia_pref_video_size_t arg2 ;
bool result;
(void)jenv;
(void)jcls;
arg1 = (tmedia_pref_video_size_t)jarg1;
arg2 = (tmedia_pref_video_size_t)jarg2;
result = (bool)MediaSessionMgr::defaultsSetPrefVideoSizeOutRange(arg1,arg2);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetAdaptativeVideoSizeOutEnabled(JNIEnv *jenv, jclass jcls, jboolean jarg1) {
jboolean jresult = 0 ;
bool arg1 ;
bool result;
(void)jenv;
(void)jcls;
arg1 = jarg1 ? true : false;
result = (bool)MediaSessionMgr::defaultsSetAdaptativeVideoSizeOutEnabled(arg1);
jresult = (jboolean)result;
return jresult;
}
SWIGEXPORT jboolean JNICALL Java_org_doubango_tinyWRAP_tinyWRAPJNI_MediaSessionMgr_1defaultsSetJbMargin(JNIEnv *jenv, jclass jcls, jlong jarg1) {
jboolean jresult = 0 ;
uint32_t arg1 ;

View File

@ -175,6 +175,52 @@ sub ACQUIRE {
}
############# Class : tinyWRAP::QoS ##############
package tinyWRAP::QoS;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( tinyWRAP );
%OWNER = ();
%ITERATORS = ();
sub DESTROY {
return unless $_[0]->isa('HASH');
my $self = tied(%{$_[0]});
return unless defined $self;
delete $ITERATORS{$self};
if (exists $OWNER{$self}) {
tinyWRAPc::delete_QoS($self);
delete $OWNER{$self};
}
}
*getQavg = *tinyWRAPc::QoS_getQavg;
*getQ1 = *tinyWRAPc::QoS_getQ1;
*getQ2 = *tinyWRAPc::QoS_getQ2;
*getQ3 = *tinyWRAPc::QoS_getQ3;
*getQ4 = *tinyWRAPc::QoS_getQ4;
*getQ5 = *tinyWRAPc::QoS_getQ5;
*getVideoInWidth = *tinyWRAPc::QoS_getVideoInWidth;
*getVideoOutWidth = *tinyWRAPc::QoS_getVideoOutWidth;
*getVideoInHeight = *tinyWRAPc::QoS_getVideoInHeight;
*getVideoOutHeight = *tinyWRAPc::QoS_getVideoOutHeight;
*getBandwidthDownKbps = *tinyWRAPc::QoS_getBandwidthDownKbps;
*getBandwidthUpKbps = *tinyWRAPc::QoS_getBandwidthUpKbps;
*getVideoInAvgFps = *tinyWRAPc::QoS_getVideoInAvgFps;
*getVideoDecAvgTime = *tinyWRAPc::QoS_getVideoDecAvgTime;
*getVideoEncAvgTime = *tinyWRAPc::QoS_getVideoEncAvgTime;
sub DISOWN {
my $self = shift;
my $ptr = tied(%$self);
delete $OWNER{$ptr};
}
sub ACQUIRE {
my $self = shift;
my $ptr = tied(%$self);
$OWNER{$ptr} = 1;
}
############# Class : tinyWRAP::Codec ##############
package tinyWRAP::Codec;
@ -233,6 +279,7 @@ sub DESTROY {
*sessionSetInt32 = *tinyWRAPc::MediaSessionMgr_sessionSetInt32;
*sessionGetInt32 = *tinyWRAPc::MediaSessionMgr_sessionGetInt32;
*sessionGetQoS = *tinyWRAPc::MediaSessionMgr_sessionGetQoS;
*consumerSetInt32 = *tinyWRAPc::MediaSessionMgr_consumerSetInt32;
*consumerSetInt64 = *tinyWRAPc::MediaSessionMgr_consumerSetInt64;
*producerSetInt32 = *tinyWRAPc::MediaSessionMgr_producerSetInt32;
@ -252,6 +299,8 @@ sub DESTROY {
*defaultsSetBandwidthVideoUploadMax = *tinyWRAPc::MediaSessionMgr_defaultsSetBandwidthVideoUploadMax;
*defaultsSetBandwidthVideoDownloadMax = *tinyWRAPc::MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax;
*defaultsSetPrefVideoSize = *tinyWRAPc::MediaSessionMgr_defaultsSetPrefVideoSize;
*defaultsSetPrefVideoSizeOutRange = *tinyWRAPc::MediaSessionMgr_defaultsSetPrefVideoSizeOutRange;
*defaultsSetAdaptativeVideoSizeOutEnabled = *tinyWRAPc::MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled;
*defaultsSetJbMargin = *tinyWRAPc::MediaSessionMgr_defaultsSetJbMargin;
*defaultsSetJbMaxLateRate = *tinyWRAPc::MediaSessionMgr_defaultsSetJbMaxLateRate;
*defaultsSetEchoTail = *tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail;

View File

@ -1549,70 +1549,71 @@ SWIG_Perl_SetModule(swig_module_info *module) {
#define SWIGTYPE_p_ProxyVideoProducerCallback swig_types[32]
#define SWIGTYPE_p_PublicationEvent swig_types[33]
#define SWIGTYPE_p_PublicationSession swig_types[34]
#define SWIGTYPE_p_RPMessage swig_types[35]
#define SWIGTYPE_p_RegistrationEvent swig_types[36]
#define SWIGTYPE_p_RegistrationSession swig_types[37]
#define SWIGTYPE_p_SMSData swig_types[38]
#define SWIGTYPE_p_SMSEncoder swig_types[39]
#define SWIGTYPE_p_SafeObject swig_types[40]
#define SWIGTYPE_p_SdpMessage swig_types[41]
#define SWIGTYPE_p_SipCallback swig_types[42]
#define SWIGTYPE_p_SipEvent swig_types[43]
#define SWIGTYPE_p_SipMessage swig_types[44]
#define SWIGTYPE_p_SipSession swig_types[45]
#define SWIGTYPE_p_SipStack swig_types[46]
#define SWIGTYPE_p_SipUri swig_types[47]
#define SWIGTYPE_p_StackEvent swig_types[48]
#define SWIGTYPE_p_SubscriptionEvent swig_types[49]
#define SWIGTYPE_p_SubscriptionSession swig_types[50]
#define SWIGTYPE_p_T140Callback swig_types[51]
#define SWIGTYPE_p_T140CallbackData swig_types[52]
#define SWIGTYPE_p_XcapCallback swig_types[53]
#define SWIGTYPE_p_XcapEvent swig_types[54]
#define SWIGTYPE_p_XcapMessage swig_types[55]
#define SWIGTYPE_p_XcapSelector swig_types[56]
#define SWIGTYPE_p_XcapStack swig_types[57]
#define SWIGTYPE_p_char swig_types[58]
#define SWIGTYPE_p_int swig_types[59]
#define SWIGTYPE_p_long_long swig_types[60]
#define SWIGTYPE_p_short swig_types[61]
#define SWIGTYPE_p_signed_char swig_types[62]
#define SWIGTYPE_p_tdav_codec_id_e swig_types[63]
#define SWIGTYPE_p_thttp_event_type_e swig_types[64]
#define SWIGTYPE_p_tmedia_bandwidth_level_e swig_types[65]
#define SWIGTYPE_p_tmedia_chroma_e swig_types[66]
#define SWIGTYPE_p_tmedia_codec_id_e swig_types[67]
#define SWIGTYPE_p_tmedia_mode_e swig_types[68]
#define SWIGTYPE_p_tmedia_pref_video_size_s swig_types[69]
#define SWIGTYPE_p_tmedia_profile_e swig_types[70]
#define SWIGTYPE_p_tmedia_qos_strength_e swig_types[71]
#define SWIGTYPE_p_tmedia_qos_stype_e swig_types[72]
#define SWIGTYPE_p_tmedia_srtp_mode_e swig_types[73]
#define SWIGTYPE_p_tmedia_srtp_type_e swig_types[74]
#define SWIGTYPE_p_tmedia_t140_data_type_e swig_types[75]
#define SWIGTYPE_p_tmsrp_event_type_e swig_types[76]
#define SWIGTYPE_p_tmsrp_request_type_e swig_types[77]
#define SWIGTYPE_p_tsip_event_type_e swig_types[78]
#define SWIGTYPE_p_tsip_info_event_type_e swig_types[79]
#define SWIGTYPE_p_tsip_invite_event_type_e swig_types[80]
#define SWIGTYPE_p_tsip_message_event_type_e swig_types[81]
#define SWIGTYPE_p_tsip_options_event_type_e swig_types[82]
#define SWIGTYPE_p_tsip_publish_event_type_e swig_types[83]
#define SWIGTYPE_p_tsip_register_event_type_e swig_types[84]
#define SWIGTYPE_p_tsip_request_type_e swig_types[85]
#define SWIGTYPE_p_tsip_stack_mode_e swig_types[86]
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[87]
#define SWIGTYPE_p_tsk_list_t swig_types[88]
#define SWIGTYPE_p_twrap_media_type_e swig_types[89]
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[90]
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[91]
#define SWIGTYPE_p_twrap_sms_type_e swig_types[92]
#define SWIGTYPE_p_unsigned_char swig_types[93]
#define SWIGTYPE_p_unsigned_int swig_types[94]
#define SWIGTYPE_p_unsigned_long_long swig_types[95]
#define SWIGTYPE_p_unsigned_short swig_types[96]
static swig_type_info *swig_types[98];
static swig_module_info swig_module = {swig_types, 97, 0, 0, 0, 0};
#define SWIGTYPE_p_QoS swig_types[35]
#define SWIGTYPE_p_RPMessage swig_types[36]
#define SWIGTYPE_p_RegistrationEvent swig_types[37]
#define SWIGTYPE_p_RegistrationSession swig_types[38]
#define SWIGTYPE_p_SMSData swig_types[39]
#define SWIGTYPE_p_SMSEncoder swig_types[40]
#define SWIGTYPE_p_SafeObject swig_types[41]
#define SWIGTYPE_p_SdpMessage swig_types[42]
#define SWIGTYPE_p_SipCallback swig_types[43]
#define SWIGTYPE_p_SipEvent swig_types[44]
#define SWIGTYPE_p_SipMessage swig_types[45]
#define SWIGTYPE_p_SipSession swig_types[46]
#define SWIGTYPE_p_SipStack swig_types[47]
#define SWIGTYPE_p_SipUri swig_types[48]
#define SWIGTYPE_p_StackEvent swig_types[49]
#define SWIGTYPE_p_SubscriptionEvent swig_types[50]
#define SWIGTYPE_p_SubscriptionSession swig_types[51]
#define SWIGTYPE_p_T140Callback swig_types[52]
#define SWIGTYPE_p_T140CallbackData swig_types[53]
#define SWIGTYPE_p_XcapCallback swig_types[54]
#define SWIGTYPE_p_XcapEvent swig_types[55]
#define SWIGTYPE_p_XcapMessage swig_types[56]
#define SWIGTYPE_p_XcapSelector swig_types[57]
#define SWIGTYPE_p_XcapStack swig_types[58]
#define SWIGTYPE_p_char swig_types[59]
#define SWIGTYPE_p_int swig_types[60]
#define SWIGTYPE_p_long_long swig_types[61]
#define SWIGTYPE_p_short swig_types[62]
#define SWIGTYPE_p_signed_char swig_types[63]
#define SWIGTYPE_p_tdav_codec_id_e swig_types[64]
#define SWIGTYPE_p_thttp_event_type_e swig_types[65]
#define SWIGTYPE_p_tmedia_bandwidth_level_e swig_types[66]
#define SWIGTYPE_p_tmedia_chroma_e swig_types[67]
#define SWIGTYPE_p_tmedia_codec_id_e swig_types[68]
#define SWIGTYPE_p_tmedia_mode_e swig_types[69]
#define SWIGTYPE_p_tmedia_pref_video_size_s swig_types[70]
#define SWIGTYPE_p_tmedia_profile_e swig_types[71]
#define SWIGTYPE_p_tmedia_qos_strength_e swig_types[72]
#define SWIGTYPE_p_tmedia_qos_stype_e swig_types[73]
#define SWIGTYPE_p_tmedia_srtp_mode_e swig_types[74]
#define SWIGTYPE_p_tmedia_srtp_type_e swig_types[75]
#define SWIGTYPE_p_tmedia_t140_data_type_e swig_types[76]
#define SWIGTYPE_p_tmsrp_event_type_e swig_types[77]
#define SWIGTYPE_p_tmsrp_request_type_e swig_types[78]
#define SWIGTYPE_p_tsip_event_type_e swig_types[79]
#define SWIGTYPE_p_tsip_info_event_type_e swig_types[80]
#define SWIGTYPE_p_tsip_invite_event_type_e swig_types[81]
#define SWIGTYPE_p_tsip_message_event_type_e swig_types[82]
#define SWIGTYPE_p_tsip_options_event_type_e swig_types[83]
#define SWIGTYPE_p_tsip_publish_event_type_e swig_types[84]
#define SWIGTYPE_p_tsip_register_event_type_e swig_types[85]
#define SWIGTYPE_p_tsip_request_type_e swig_types[86]
#define SWIGTYPE_p_tsip_stack_mode_e swig_types[87]
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[88]
#define SWIGTYPE_p_tsk_list_t swig_types[89]
#define SWIGTYPE_p_twrap_media_type_e swig_types[90]
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[91]
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[92]
#define SWIGTYPE_p_twrap_sms_type_e swig_types[93]
#define SWIGTYPE_p_unsigned_char swig_types[94]
#define SWIGTYPE_p_unsigned_int swig_types[95]
#define SWIGTYPE_p_unsigned_long_long swig_types[96]
#define SWIGTYPE_p_unsigned_short swig_types[97]
static swig_type_info *swig_types[99];
static swig_module_info swig_module = {swig_types, 98, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -1995,6 +1996,20 @@ SWIG_AsVal_short SWIG_PERL_DECL_ARGS_2(SV * obj, short *val)
}
SWIGINTERNINLINE SV *
SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value)
{
return sv_2mortal(newSVnv(value));
}
SWIGINTERNINLINE SV *
SWIG_From_float SWIG_PERL_DECL_ARGS_1(float value)
{
return SWIG_From_double SWIG_PERL_CALL_ARGS_1(value);
}
SWIGINTERNINLINE SV *
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
@ -2149,20 +2164,6 @@ SWIG_AsVal_float SWIG_PERL_DECL_ARGS_2(SV * obj, float *val)
}
SWIGINTERNINLINE SV *
SWIG_From_double SWIG_PERL_DECL_ARGS_1(double value)
{
return sv_2mortal(newSVnv(value));
}
SWIGINTERNINLINE SV *
SWIG_From_float SWIG_PERL_DECL_ARGS_1(float value)
{
return SWIG_From_double SWIG_PERL_CALL_ARGS_1(value);
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_short SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned short *val)
{
@ -3110,6 +3111,453 @@ XS(_wrap_ActionConfig_setMediaInt) {
}
XS(_wrap_delete_QoS) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: delete_QoS(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_QoS" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
delete arg1;
ST(argvi) = sv_newmortal();
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getQavg) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
float result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getQavg(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQavg" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQavg();
ST(argvi) = SWIG_From_float SWIG_PERL_CALL_ARGS_1(static_cast< float >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getQ1) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
float result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getQ1(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ1" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ1();
ST(argvi) = SWIG_From_float SWIG_PERL_CALL_ARGS_1(static_cast< float >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getQ2) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
float result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getQ2(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ2" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ2();
ST(argvi) = SWIG_From_float SWIG_PERL_CALL_ARGS_1(static_cast< float >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getQ3) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
float result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getQ3(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ3" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ3();
ST(argvi) = SWIG_From_float SWIG_PERL_CALL_ARGS_1(static_cast< float >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getQ4) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
float result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getQ4(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ4" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ4();
ST(argvi) = SWIG_From_float SWIG_PERL_CALL_ARGS_1(static_cast< float >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getQ5) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
float result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getQ5(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ5" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ5();
ST(argvi) = SWIG_From_float SWIG_PERL_CALL_ARGS_1(static_cast< float >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoInWidth) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoInWidth(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoInWidth" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoInWidth();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoOutWidth) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoOutWidth(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoOutWidth" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoOutWidth();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoInHeight) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoInHeight(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoInHeight" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoInHeight();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoOutHeight) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoOutHeight(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoOutHeight" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoOutHeight();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getBandwidthDownKbps) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getBandwidthDownKbps(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getBandwidthDownKbps" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getBandwidthDownKbps();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getBandwidthUpKbps) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getBandwidthUpKbps(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getBandwidthUpKbps" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getBandwidthUpKbps();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoInAvgFps) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoInAvgFps(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoInAvgFps" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoInAvgFps();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoDecAvgTime) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoDecAvgTime(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoDecAvgTime" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoDecAvgTime();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_QoS_getVideoEncAvgTime) {
{
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int argvi = 0;
unsigned int result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: QoS_getVideoEncAvgTime(self);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoEncAvgTime" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoEncAvgTime();
ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_delete_Codec) {
{
Codec *arg1 = (Codec *) 0 ;
@ -3468,6 +3916,44 @@ XS(_wrap_MediaSessionMgr_sessionGetInt32) {
}
XS(_wrap_MediaSessionMgr_sessionGetQoS) {
{
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int argvi = 0;
QoS *result = 0 ;
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: MediaSessionMgr_sessionGetQoS(self,media);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_MediaSessionMgr, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MediaSessionMgr_sessionGetQoS" "', argument " "1"" of type '" "MediaSessionMgr *""'");
}
arg1 = reinterpret_cast< MediaSessionMgr * >(argp1);
ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MediaSessionMgr_sessionGetQoS" "', argument " "2"" of type '" "twrap_media_type_t""'");
}
arg2 = static_cast< twrap_media_type_t >(val2);
result = (QoS *)(arg1)->sessionGetQoS(arg2);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_QoS, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_MediaSessionMgr_consumerSetInt32) {
{
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
@ -4145,6 +4631,72 @@ XS(_wrap_MediaSessionMgr_defaultsSetPrefVideoSize) {
}
XS(_wrap_MediaSessionMgr_defaultsSetPrefVideoSizeOutRange) {
{
tmedia_pref_video_size_t arg1 ;
tmedia_pref_video_size_t arg2 ;
int val1 ;
int ecode1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int argvi = 0;
bool result;
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(min,max);");
}
ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetPrefVideoSizeOutRange" "', argument " "1"" of type '" "tmedia_pref_video_size_t""'");
}
arg1 = static_cast< tmedia_pref_video_size_t >(val1);
ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MediaSessionMgr_defaultsSetPrefVideoSizeOutRange" "', argument " "2"" of type '" "tmedia_pref_video_size_t""'");
}
arg2 = static_cast< tmedia_pref_video_size_t >(val2);
result = (bool)MediaSessionMgr::defaultsSetPrefVideoSizeOutRange(arg1,arg2);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled) {
{
bool arg1 ;
bool val1 ;
int ecode1 = 0 ;
int argvi = 0;
bool result;
dXSARGS;
if ((items < 1) || (items > 1)) {
SWIG_croak("Usage: MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(enabled);");
}
ecode1 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled" "', argument " "1"" of type '" "bool""'");
}
arg1 = static_cast< bool >(val1);
result = (bool)MediaSessionMgr::defaultsSetAdaptativeVideoSizeOutEnabled(arg1);
ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
XSRETURN(argvi);
fail:
SWIG_croak_null();
}
}
XS(_wrap_MediaSessionMgr_defaultsSetJbMargin) {
{
uint32_t arg1 ;
@ -27523,6 +28075,7 @@ static swig_type_info _swigt__p_ProxyVideoProducer = {"_p_ProxyVideoProducer", "
static swig_type_info _swigt__p_ProxyVideoProducerCallback = {"_p_ProxyVideoProducerCallback", "ProxyVideoProducerCallback *", 0, 0, (void*)"tinyWRAP::ProxyVideoProducerCallback", 0};
static swig_type_info _swigt__p_PublicationEvent = {"_p_PublicationEvent", "PublicationEvent *", 0, 0, (void*)"tinyWRAP::PublicationEvent", 0};
static swig_type_info _swigt__p_PublicationSession = {"_p_PublicationSession", "PublicationSession *", 0, 0, (void*)"tinyWRAP::PublicationSession", 0};
static swig_type_info _swigt__p_QoS = {"_p_QoS", "QoS *", 0, 0, (void*)"tinyWRAP::QoS", 0};
static swig_type_info _swigt__p_RPMessage = {"_p_RPMessage", "RPMessage *", 0, 0, (void*)"tinyWRAP::RPMessage", 0};
static swig_type_info _swigt__p_RegistrationEvent = {"_p_RegistrationEvent", "RegistrationEvent *", 0, 0, (void*)"tinyWRAP::RegistrationEvent", 0};
static swig_type_info _swigt__p_RegistrationSession = {"_p_RegistrationSession", "RegistrationSession *", 0, 0, (void*)"tinyWRAP::RegistrationSession", 0};
@ -27622,6 +28175,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_ProxyVideoProducerCallback,
&_swigt__p_PublicationEvent,
&_swigt__p_PublicationSession,
&_swigt__p_QoS,
&_swigt__p_RPMessage,
&_swigt__p_RegistrationEvent,
&_swigt__p_RegistrationSession,
@ -27721,6 +28275,7 @@ static swig_cast_info _swigc__p_ProxyVideoProducer[] = { {&_swigt__p_ProxyVideo
static swig_cast_info _swigc__p_ProxyVideoProducerCallback[] = { {&_swigt__p_ProxyVideoProducerCallback, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PublicationEvent[] = { {&_swigt__p_PublicationEvent, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PublicationSession[] = { {&_swigt__p_PublicationSession, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_QoS[] = { {&_swigt__p_QoS, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RPMessage[] = { {&_swigt__p_RPMessage, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RegistrationEvent[] = { {&_swigt__p_RegistrationEvent, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RegistrationSession[] = { {&_swigt__p_RegistrationSession, 0, 0, 0},{0, 0, 0, 0}};
@ -27820,6 +28375,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_ProxyVideoProducerCallback,
_swigc__p_PublicationEvent,
_swigc__p_PublicationSession,
_swigc__p_QoS,
_swigc__p_RPMessage,
_swigc__p_RegistrationEvent,
_swigc__p_RegistrationSession,
@ -27917,6 +28473,22 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::ActionConfig_setResponseLine", _wrap_ActionConfig_setResponseLine},
{"tinyWRAPc::ActionConfig_setMediaString", _wrap_ActionConfig_setMediaString},
{"tinyWRAPc::ActionConfig_setMediaInt", _wrap_ActionConfig_setMediaInt},
{"tinyWRAPc::delete_QoS", _wrap_delete_QoS},
{"tinyWRAPc::QoS_getQavg", _wrap_QoS_getQavg},
{"tinyWRAPc::QoS_getQ1", _wrap_QoS_getQ1},
{"tinyWRAPc::QoS_getQ2", _wrap_QoS_getQ2},
{"tinyWRAPc::QoS_getQ3", _wrap_QoS_getQ3},
{"tinyWRAPc::QoS_getQ4", _wrap_QoS_getQ4},
{"tinyWRAPc::QoS_getQ5", _wrap_QoS_getQ5},
{"tinyWRAPc::QoS_getVideoInWidth", _wrap_QoS_getVideoInWidth},
{"tinyWRAPc::QoS_getVideoOutWidth", _wrap_QoS_getVideoOutWidth},
{"tinyWRAPc::QoS_getVideoInHeight", _wrap_QoS_getVideoInHeight},
{"tinyWRAPc::QoS_getVideoOutHeight", _wrap_QoS_getVideoOutHeight},
{"tinyWRAPc::QoS_getBandwidthDownKbps", _wrap_QoS_getBandwidthDownKbps},
{"tinyWRAPc::QoS_getBandwidthUpKbps", _wrap_QoS_getBandwidthUpKbps},
{"tinyWRAPc::QoS_getVideoInAvgFps", _wrap_QoS_getVideoInAvgFps},
{"tinyWRAPc::QoS_getVideoDecAvgTime", _wrap_QoS_getVideoDecAvgTime},
{"tinyWRAPc::QoS_getVideoEncAvgTime", _wrap_QoS_getVideoEncAvgTime},
{"tinyWRAPc::delete_Codec", _wrap_delete_Codec},
{"tinyWRAPc::Codec_getMediaType", _wrap_Codec_getMediaType},
{"tinyWRAPc::Codec_getName", _wrap_Codec_getName},
@ -27928,6 +28500,7 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::delete_MediaSessionMgr", _wrap_delete_MediaSessionMgr},
{"tinyWRAPc::MediaSessionMgr_sessionSetInt32", _wrap_MediaSessionMgr_sessionSetInt32},
{"tinyWRAPc::MediaSessionMgr_sessionGetInt32", _wrap_MediaSessionMgr_sessionGetInt32},
{"tinyWRAPc::MediaSessionMgr_sessionGetQoS", _wrap_MediaSessionMgr_sessionGetQoS},
{"tinyWRAPc::MediaSessionMgr_consumerSetInt32", _wrap_MediaSessionMgr_consumerSetInt32},
{"tinyWRAPc::MediaSessionMgr_consumerSetInt64", _wrap_MediaSessionMgr_consumerSetInt64},
{"tinyWRAPc::MediaSessionMgr_producerSetInt32", _wrap_MediaSessionMgr_producerSetInt32},
@ -27947,6 +28520,8 @@ static swig_command_info swig_commands[] = {
{"tinyWRAPc::MediaSessionMgr_defaultsSetBandwidthVideoUploadMax", _wrap_MediaSessionMgr_defaultsSetBandwidthVideoUploadMax},
{"tinyWRAPc::MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax", _wrap_MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax},
{"tinyWRAPc::MediaSessionMgr_defaultsSetPrefVideoSize", _wrap_MediaSessionMgr_defaultsSetPrefVideoSize},
{"tinyWRAPc::MediaSessionMgr_defaultsSetPrefVideoSizeOutRange", _wrap_MediaSessionMgr_defaultsSetPrefVideoSizeOutRange},
{"tinyWRAPc::MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled", _wrap_MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled},
{"tinyWRAPc::MediaSessionMgr_defaultsSetJbMargin", _wrap_MediaSessionMgr_defaultsSetJbMargin},
{"tinyWRAPc::MediaSessionMgr_defaultsSetJbMaxLateRate", _wrap_MediaSessionMgr_defaultsSetJbMaxLateRate},
{"tinyWRAPc::MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail},
@ -28765,6 +29340,7 @@ XS(SWIG_init) {
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
SWIG_TypeClientData(SWIGTYPE_p_ActionConfig, (void*) "tinyWRAP::ActionConfig");
SWIG_TypeClientData(SWIGTYPE_p_QoS, (void*) "tinyWRAP::QoS");
SWIG_TypeClientData(SWIGTYPE_p_Codec, (void*) "tinyWRAP::Codec");
SWIG_TypeClientData(SWIGTYPE_p_MediaSessionMgr, (void*) "tinyWRAP::MediaSessionMgr");
SWIG_TypeClientData(SWIGTYPE_p_MediaContent, (void*) "tinyWRAP::MediaContent");

View File

@ -151,6 +151,33 @@ class ActionConfig(_object):
ActionConfig_swigregister = _tinyWRAP.ActionConfig_swigregister
ActionConfig_swigregister(ActionConfig)
class QoS(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, QoS, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, QoS, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_destroy__ = _tinyWRAP.delete_QoS
__del__ = lambda self : None;
def getQavg(self): return _tinyWRAP.QoS_getQavg(self)
def getQ1(self): return _tinyWRAP.QoS_getQ1(self)
def getQ2(self): return _tinyWRAP.QoS_getQ2(self)
def getQ3(self): return _tinyWRAP.QoS_getQ3(self)
def getQ4(self): return _tinyWRAP.QoS_getQ4(self)
def getQ5(self): return _tinyWRAP.QoS_getQ5(self)
def getVideoInWidth(self): return _tinyWRAP.QoS_getVideoInWidth(self)
def getVideoOutWidth(self): return _tinyWRAP.QoS_getVideoOutWidth(self)
def getVideoInHeight(self): return _tinyWRAP.QoS_getVideoInHeight(self)
def getVideoOutHeight(self): return _tinyWRAP.QoS_getVideoOutHeight(self)
def getBandwidthDownKbps(self): return _tinyWRAP.QoS_getBandwidthDownKbps(self)
def getBandwidthUpKbps(self): return _tinyWRAP.QoS_getBandwidthUpKbps(self)
def getVideoInAvgFps(self): return _tinyWRAP.QoS_getVideoInAvgFps(self)
def getVideoDecAvgTime(self): return _tinyWRAP.QoS_getVideoDecAvgTime(self)
def getVideoEncAvgTime(self): return _tinyWRAP.QoS_getVideoEncAvgTime(self)
QoS_swigregister = _tinyWRAP.QoS_swigregister
QoS_swigregister(QoS)
class Codec(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Codec, name, value)
@ -181,6 +208,7 @@ class MediaSessionMgr(_object):
__del__ = lambda self : None;
def sessionSetInt32(self, *args): return _tinyWRAP.MediaSessionMgr_sessionSetInt32(self, *args)
def sessionGetInt32(self, *args): return _tinyWRAP.MediaSessionMgr_sessionGetInt32(self, *args)
def sessionGetQoS(self, *args): return _tinyWRAP.MediaSessionMgr_sessionGetQoS(self, *args)
def consumerSetInt32(self, *args): return _tinyWRAP.MediaSessionMgr_consumerSetInt32(self, *args)
def consumerSetInt64(self, *args): return _tinyWRAP.MediaSessionMgr_consumerSetInt64(self, *args)
def producerSetInt32(self, *args): return _tinyWRAP.MediaSessionMgr_producerSetInt32(self, *args)
@ -211,6 +239,10 @@ class MediaSessionMgr(_object):
if _newclass:defaultsSetBandwidthVideoDownloadMax = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax)
__swig_getmethods__["defaultsSetPrefVideoSize"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSize
if _newclass:defaultsSetPrefVideoSize = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSize)
__swig_getmethods__["defaultsSetPrefVideoSizeOutRange"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange
if _newclass:defaultsSetPrefVideoSizeOutRange = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange)
__swig_getmethods__["defaultsSetAdaptativeVideoSizeOutEnabled"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled
if _newclass:defaultsSetAdaptativeVideoSizeOutEnabled = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled)
__swig_getmethods__["defaultsSetJbMargin"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetJbMargin
if _newclass:defaultsSetJbMargin = staticmethod(_tinyWRAP.MediaSessionMgr_defaultsSetJbMargin)
__swig_getmethods__["defaultsSetJbMaxLateRate"] = lambda x: _tinyWRAP.MediaSessionMgr_defaultsSetJbMaxLateRate
@ -374,6 +406,14 @@ def MediaSessionMgr_defaultsSetPrefVideoSize(*args):
return _tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSize(*args)
MediaSessionMgr_defaultsSetPrefVideoSize = _tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSize
def MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(*args):
return _tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(*args)
MediaSessionMgr_defaultsSetPrefVideoSizeOutRange = _tinyWRAP.MediaSessionMgr_defaultsSetPrefVideoSizeOutRange
def MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(*args):
return _tinyWRAP.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(*args)
MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled = _tinyWRAP.MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled
def MediaSessionMgr_defaultsSetJbMargin(*args):
return _tinyWRAP.MediaSessionMgr_defaultsSetJbMargin(*args)
MediaSessionMgr_defaultsSetJbMargin = _tinyWRAP.MediaSessionMgr_defaultsSetJbMargin

View File

@ -3480,70 +3480,71 @@ namespace Swig {
#define SWIGTYPE_p_ProxyVideoProducerCallback swig_types[32]
#define SWIGTYPE_p_PublicationEvent swig_types[33]
#define SWIGTYPE_p_PublicationSession swig_types[34]
#define SWIGTYPE_p_RPMessage swig_types[35]
#define SWIGTYPE_p_RegistrationEvent swig_types[36]
#define SWIGTYPE_p_RegistrationSession swig_types[37]
#define SWIGTYPE_p_SMSData swig_types[38]
#define SWIGTYPE_p_SMSEncoder swig_types[39]
#define SWIGTYPE_p_SafeObject swig_types[40]
#define SWIGTYPE_p_SdpMessage swig_types[41]
#define SWIGTYPE_p_SipCallback swig_types[42]
#define SWIGTYPE_p_SipEvent swig_types[43]
#define SWIGTYPE_p_SipMessage swig_types[44]
#define SWIGTYPE_p_SipSession swig_types[45]
#define SWIGTYPE_p_SipStack swig_types[46]
#define SWIGTYPE_p_SipUri swig_types[47]
#define SWIGTYPE_p_StackEvent swig_types[48]
#define SWIGTYPE_p_SubscriptionEvent swig_types[49]
#define SWIGTYPE_p_SubscriptionSession swig_types[50]
#define SWIGTYPE_p_T140Callback swig_types[51]
#define SWIGTYPE_p_T140CallbackData swig_types[52]
#define SWIGTYPE_p_XcapCallback swig_types[53]
#define SWIGTYPE_p_XcapEvent swig_types[54]
#define SWIGTYPE_p_XcapMessage swig_types[55]
#define SWIGTYPE_p_XcapSelector swig_types[56]
#define SWIGTYPE_p_XcapStack swig_types[57]
#define SWIGTYPE_p_char swig_types[58]
#define SWIGTYPE_p_int swig_types[59]
#define SWIGTYPE_p_long_long swig_types[60]
#define SWIGTYPE_p_short swig_types[61]
#define SWIGTYPE_p_signed_char swig_types[62]
#define SWIGTYPE_p_tdav_codec_id_e swig_types[63]
#define SWIGTYPE_p_thttp_event_type_e swig_types[64]
#define SWIGTYPE_p_tmedia_bandwidth_level_e swig_types[65]
#define SWIGTYPE_p_tmedia_chroma_e swig_types[66]
#define SWIGTYPE_p_tmedia_codec_id_e swig_types[67]
#define SWIGTYPE_p_tmedia_mode_e swig_types[68]
#define SWIGTYPE_p_tmedia_pref_video_size_s swig_types[69]
#define SWIGTYPE_p_tmedia_profile_e swig_types[70]
#define SWIGTYPE_p_tmedia_qos_strength_e swig_types[71]
#define SWIGTYPE_p_tmedia_qos_stype_e swig_types[72]
#define SWIGTYPE_p_tmedia_srtp_mode_e swig_types[73]
#define SWIGTYPE_p_tmedia_srtp_type_e swig_types[74]
#define SWIGTYPE_p_tmedia_t140_data_type_e swig_types[75]
#define SWIGTYPE_p_tmsrp_event_type_e swig_types[76]
#define SWIGTYPE_p_tmsrp_request_type_e swig_types[77]
#define SWIGTYPE_p_tsip_event_type_e swig_types[78]
#define SWIGTYPE_p_tsip_info_event_type_e swig_types[79]
#define SWIGTYPE_p_tsip_invite_event_type_e swig_types[80]
#define SWIGTYPE_p_tsip_message_event_type_e swig_types[81]
#define SWIGTYPE_p_tsip_options_event_type_e swig_types[82]
#define SWIGTYPE_p_tsip_publish_event_type_e swig_types[83]
#define SWIGTYPE_p_tsip_register_event_type_e swig_types[84]
#define SWIGTYPE_p_tsip_request_type_e swig_types[85]
#define SWIGTYPE_p_tsip_stack_mode_e swig_types[86]
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[87]
#define SWIGTYPE_p_tsk_list_t swig_types[88]
#define SWIGTYPE_p_twrap_media_type_e swig_types[89]
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[90]
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[91]
#define SWIGTYPE_p_twrap_sms_type_e swig_types[92]
#define SWIGTYPE_p_unsigned_char swig_types[93]
#define SWIGTYPE_p_unsigned_int swig_types[94]
#define SWIGTYPE_p_unsigned_long_long swig_types[95]
#define SWIGTYPE_p_unsigned_short swig_types[96]
static swig_type_info *swig_types[98];
static swig_module_info swig_module = {swig_types, 97, 0, 0, 0, 0};
#define SWIGTYPE_p_QoS swig_types[35]
#define SWIGTYPE_p_RPMessage swig_types[36]
#define SWIGTYPE_p_RegistrationEvent swig_types[37]
#define SWIGTYPE_p_RegistrationSession swig_types[38]
#define SWIGTYPE_p_SMSData swig_types[39]
#define SWIGTYPE_p_SMSEncoder swig_types[40]
#define SWIGTYPE_p_SafeObject swig_types[41]
#define SWIGTYPE_p_SdpMessage swig_types[42]
#define SWIGTYPE_p_SipCallback swig_types[43]
#define SWIGTYPE_p_SipEvent swig_types[44]
#define SWIGTYPE_p_SipMessage swig_types[45]
#define SWIGTYPE_p_SipSession swig_types[46]
#define SWIGTYPE_p_SipStack swig_types[47]
#define SWIGTYPE_p_SipUri swig_types[48]
#define SWIGTYPE_p_StackEvent swig_types[49]
#define SWIGTYPE_p_SubscriptionEvent swig_types[50]
#define SWIGTYPE_p_SubscriptionSession swig_types[51]
#define SWIGTYPE_p_T140Callback swig_types[52]
#define SWIGTYPE_p_T140CallbackData swig_types[53]
#define SWIGTYPE_p_XcapCallback swig_types[54]
#define SWIGTYPE_p_XcapEvent swig_types[55]
#define SWIGTYPE_p_XcapMessage swig_types[56]
#define SWIGTYPE_p_XcapSelector swig_types[57]
#define SWIGTYPE_p_XcapStack swig_types[58]
#define SWIGTYPE_p_char swig_types[59]
#define SWIGTYPE_p_int swig_types[60]
#define SWIGTYPE_p_long_long swig_types[61]
#define SWIGTYPE_p_short swig_types[62]
#define SWIGTYPE_p_signed_char swig_types[63]
#define SWIGTYPE_p_tdav_codec_id_e swig_types[64]
#define SWIGTYPE_p_thttp_event_type_e swig_types[65]
#define SWIGTYPE_p_tmedia_bandwidth_level_e swig_types[66]
#define SWIGTYPE_p_tmedia_chroma_e swig_types[67]
#define SWIGTYPE_p_tmedia_codec_id_e swig_types[68]
#define SWIGTYPE_p_tmedia_mode_e swig_types[69]
#define SWIGTYPE_p_tmedia_pref_video_size_s swig_types[70]
#define SWIGTYPE_p_tmedia_profile_e swig_types[71]
#define SWIGTYPE_p_tmedia_qos_strength_e swig_types[72]
#define SWIGTYPE_p_tmedia_qos_stype_e swig_types[73]
#define SWIGTYPE_p_tmedia_srtp_mode_e swig_types[74]
#define SWIGTYPE_p_tmedia_srtp_type_e swig_types[75]
#define SWIGTYPE_p_tmedia_t140_data_type_e swig_types[76]
#define SWIGTYPE_p_tmsrp_event_type_e swig_types[77]
#define SWIGTYPE_p_tmsrp_request_type_e swig_types[78]
#define SWIGTYPE_p_tsip_event_type_e swig_types[79]
#define SWIGTYPE_p_tsip_info_event_type_e swig_types[80]
#define SWIGTYPE_p_tsip_invite_event_type_e swig_types[81]
#define SWIGTYPE_p_tsip_message_event_type_e swig_types[82]
#define SWIGTYPE_p_tsip_options_event_type_e swig_types[83]
#define SWIGTYPE_p_tsip_publish_event_type_e swig_types[84]
#define SWIGTYPE_p_tsip_register_event_type_e swig_types[85]
#define SWIGTYPE_p_tsip_request_type_e swig_types[86]
#define SWIGTYPE_p_tsip_stack_mode_e swig_types[87]
#define SWIGTYPE_p_tsip_subscribe_event_type_e swig_types[88]
#define SWIGTYPE_p_tsk_list_t swig_types[89]
#define SWIGTYPE_p_twrap_media_type_e swig_types[90]
#define SWIGTYPE_p_twrap_proxy_plugin_type_e swig_types[91]
#define SWIGTYPE_p_twrap_rpmessage_type_e swig_types[92]
#define SWIGTYPE_p_twrap_sms_type_e swig_types[93]
#define SWIGTYPE_p_unsigned_char swig_types[94]
#define SWIGTYPE_p_unsigned_int swig_types[95]
#define SWIGTYPE_p_unsigned_long_long swig_types[96]
#define SWIGTYPE_p_unsigned_short swig_types[97]
static swig_type_info *swig_types[99];
static swig_module_info swig_module = {swig_types, 98, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -4030,6 +4031,16 @@ SWIG_AsVal_short (PyObject * obj, short *val)
}
#define SWIG_From_double PyFloat_FromDouble
SWIGINTERNINLINE PyObject *
SWIG_From_float (float value)
{
return SWIG_From_double (value);
}
SWIGINTERN int
SWIG_AsVal_long_SS_long (PyObject *obj, long long *val)
{
@ -4113,16 +4124,6 @@ SWIG_AsVal_float (PyObject * obj, float *val)
}
#define SWIG_From_double PyFloat_FromDouble
SWIGINTERNINLINE PyObject *
SWIG_From_float (float value)
{
return SWIG_From_double (value);
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val)
{
@ -6273,6 +6274,364 @@ SWIGINTERN PyObject *ActionConfig_swigregister(PyObject *SWIGUNUSEDPARM(self), P
return SWIG_Py_Void();
}
SWIGINTERN PyObject *_wrap_delete_QoS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:delete_QoS",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_QoS" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
delete arg1;
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getQavg(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
float result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getQavg",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQavg" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQavg();
resultobj = SWIG_From_float(static_cast< float >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getQ1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
float result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getQ1",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ1" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ1();
resultobj = SWIG_From_float(static_cast< float >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getQ2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
float result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getQ2",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ2" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ2();
resultobj = SWIG_From_float(static_cast< float >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getQ3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
float result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getQ3",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ3" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ3();
resultobj = SWIG_From_float(static_cast< float >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getQ4(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
float result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getQ4",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ4" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ4();
resultobj = SWIG_From_float(static_cast< float >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getQ5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
float result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getQ5",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getQ5" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (float)(arg1)->getQ5();
resultobj = SWIG_From_float(static_cast< float >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoInWidth(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoInWidth",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoInWidth" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoInWidth();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoOutWidth(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoOutWidth",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoOutWidth" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoOutWidth();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoInHeight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoInHeight",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoInHeight" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoInHeight();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoOutHeight(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoOutHeight",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoOutHeight" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoOutHeight();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getBandwidthDownKbps(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getBandwidthDownKbps",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getBandwidthDownKbps" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getBandwidthDownKbps();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getBandwidthUpKbps(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getBandwidthUpKbps",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getBandwidthUpKbps" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getBandwidthUpKbps();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoInAvgFps(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoInAvgFps",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoInAvgFps" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoInAvgFps();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoDecAvgTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoDecAvgTime",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoDecAvgTime" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoDecAvgTime();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_QoS_getVideoEncAvgTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
QoS *arg1 = (QoS *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
unsigned int result;
if (!PyArg_ParseTuple(args,(char *)"O:QoS_getVideoEncAvgTime",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_QoS, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "QoS_getVideoEncAvgTime" "', argument " "1"" of type '" "QoS *""'");
}
arg1 = reinterpret_cast< QoS * >(argp1);
result = (unsigned int)(arg1)->getVideoEncAvgTime();
resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *QoS_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_QoS, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
SWIGINTERN PyObject *_wrap_delete_Codec(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Codec *arg1 = (Codec *) 0 ;
@ -6571,6 +6930,37 @@ fail:
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_sessionGetQoS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
twrap_media_type_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
QoS *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:MediaSessionMgr_sessionGetQoS",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_MediaSessionMgr, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MediaSessionMgr_sessionGetQoS" "', argument " "1"" of type '" "MediaSessionMgr *""'");
}
arg1 = reinterpret_cast< MediaSessionMgr * >(argp1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MediaSessionMgr_sessionGetQoS" "', argument " "2"" of type '" "twrap_media_type_t""'");
}
arg2 = static_cast< twrap_media_type_t >(val2);
result = (QoS *)(arg1)->sessionGetQoS(arg2);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_QoS, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_consumerSetInt32(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
MediaSessionMgr *arg1 = (MediaSessionMgr *) 0 ;
@ -7130,6 +7520,59 @@ fail:
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetPrefVideoSizeOutRange(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
tmedia_pref_video_size_t arg1 ;
tmedia_pref_video_size_t arg2 ;
int val1 ;
int ecode1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"OO:MediaSessionMgr_defaultsSetPrefVideoSizeOutRange",&obj0,&obj1)) SWIG_fail;
ecode1 = SWIG_AsVal_int(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetPrefVideoSizeOutRange" "', argument " "1"" of type '" "tmedia_pref_video_size_t""'");
}
arg1 = static_cast< tmedia_pref_video_size_t >(val1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MediaSessionMgr_defaultsSetPrefVideoSizeOutRange" "', argument " "2"" of type '" "tmedia_pref_video_size_t""'");
}
arg2 = static_cast< tmedia_pref_video_size_t >(val2);
result = (bool)MediaSessionMgr::defaultsSetPrefVideoSizeOutRange(arg1,arg2);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
bool arg1 ;
bool val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"O:MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled",&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_bool(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled" "', argument " "1"" of type '" "bool""'");
}
arg1 = static_cast< bool >(val1);
result = (bool)MediaSessionMgr::defaultsSetAdaptativeVideoSizeOutEnabled(arg1);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_MediaSessionMgr_defaultsSetJbMargin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
uint32_t arg1 ;
@ -26276,6 +26719,23 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"ActionConfig_setMediaString", _wrap_ActionConfig_setMediaString, METH_VARARGS, NULL},
{ (char *)"ActionConfig_setMediaInt", _wrap_ActionConfig_setMediaInt, METH_VARARGS, NULL},
{ (char *)"ActionConfig_swigregister", ActionConfig_swigregister, METH_VARARGS, NULL},
{ (char *)"delete_QoS", _wrap_delete_QoS, METH_VARARGS, NULL},
{ (char *)"QoS_getQavg", _wrap_QoS_getQavg, METH_VARARGS, NULL},
{ (char *)"QoS_getQ1", _wrap_QoS_getQ1, METH_VARARGS, NULL},
{ (char *)"QoS_getQ2", _wrap_QoS_getQ2, METH_VARARGS, NULL},
{ (char *)"QoS_getQ3", _wrap_QoS_getQ3, METH_VARARGS, NULL},
{ (char *)"QoS_getQ4", _wrap_QoS_getQ4, METH_VARARGS, NULL},
{ (char *)"QoS_getQ5", _wrap_QoS_getQ5, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoInWidth", _wrap_QoS_getVideoInWidth, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoOutWidth", _wrap_QoS_getVideoOutWidth, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoInHeight", _wrap_QoS_getVideoInHeight, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoOutHeight", _wrap_QoS_getVideoOutHeight, METH_VARARGS, NULL},
{ (char *)"QoS_getBandwidthDownKbps", _wrap_QoS_getBandwidthDownKbps, METH_VARARGS, NULL},
{ (char *)"QoS_getBandwidthUpKbps", _wrap_QoS_getBandwidthUpKbps, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoInAvgFps", _wrap_QoS_getVideoInAvgFps, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoDecAvgTime", _wrap_QoS_getVideoDecAvgTime, METH_VARARGS, NULL},
{ (char *)"QoS_getVideoEncAvgTime", _wrap_QoS_getVideoEncAvgTime, METH_VARARGS, NULL},
{ (char *)"QoS_swigregister", QoS_swigregister, METH_VARARGS, NULL},
{ (char *)"delete_Codec", _wrap_delete_Codec, METH_VARARGS, NULL},
{ (char *)"Codec_getMediaType", _wrap_Codec_getMediaType, METH_VARARGS, NULL},
{ (char *)"Codec_getName", _wrap_Codec_getName, METH_VARARGS, NULL},
@ -26288,6 +26748,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"delete_MediaSessionMgr", _wrap_delete_MediaSessionMgr, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_sessionSetInt32", _wrap_MediaSessionMgr_sessionSetInt32, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_sessionGetInt32", _wrap_MediaSessionMgr_sessionGetInt32, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_sessionGetQoS", _wrap_MediaSessionMgr_sessionGetQoS, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_consumerSetInt32", _wrap_MediaSessionMgr_consumerSetInt32, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_consumerSetInt64", _wrap_MediaSessionMgr_consumerSetInt64, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_producerSetInt32", _wrap_MediaSessionMgr_producerSetInt32, METH_VARARGS, NULL},
@ -26307,6 +26768,8 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"MediaSessionMgr_defaultsSetBandwidthVideoUploadMax", _wrap_MediaSessionMgr_defaultsSetBandwidthVideoUploadMax, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax", _wrap_MediaSessionMgr_defaultsSetBandwidthVideoDownloadMax, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetPrefVideoSize", _wrap_MediaSessionMgr_defaultsSetPrefVideoSize, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetPrefVideoSizeOutRange", _wrap_MediaSessionMgr_defaultsSetPrefVideoSizeOutRange, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled", _wrap_MediaSessionMgr_defaultsSetAdaptativeVideoSizeOutEnabled, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetJbMargin", _wrap_MediaSessionMgr_defaultsSetJbMargin, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetJbMaxLateRate", _wrap_MediaSessionMgr_defaultsSetJbMaxLateRate, METH_VARARGS, NULL},
{ (char *)"MediaSessionMgr_defaultsSetEchoTail", _wrap_MediaSessionMgr_defaultsSetEchoTail, METH_VARARGS, NULL},
@ -26957,6 +27420,7 @@ static swig_type_info _swigt__p_ProxyVideoProducer = {"_p_ProxyVideoProducer", "
static swig_type_info _swigt__p_ProxyVideoProducerCallback = {"_p_ProxyVideoProducerCallback", "ProxyVideoProducerCallback *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PublicationEvent = {"_p_PublicationEvent", "PublicationEvent *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PublicationSession = {"_p_PublicationSession", "PublicationSession *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_QoS = {"_p_QoS", "QoS *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RPMessage = {"_p_RPMessage", "RPMessage *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RegistrationEvent = {"_p_RegistrationEvent", "RegistrationEvent *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_RegistrationSession = {"_p_RegistrationSession", "RegistrationSession *", 0, 0, (void*)0, 0};
@ -27056,6 +27520,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_ProxyVideoProducerCallback,
&_swigt__p_PublicationEvent,
&_swigt__p_PublicationSession,
&_swigt__p_QoS,
&_swigt__p_RPMessage,
&_swigt__p_RegistrationEvent,
&_swigt__p_RegistrationSession,
@ -27155,6 +27620,7 @@ static swig_cast_info _swigc__p_ProxyVideoProducer[] = { {&_swigt__p_ProxyVideo
static swig_cast_info _swigc__p_ProxyVideoProducerCallback[] = { {&_swigt__p_ProxyVideoProducerCallback, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PublicationEvent[] = { {&_swigt__p_PublicationEvent, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PublicationSession[] = { {&_swigt__p_PublicationSession, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_QoS[] = { {&_swigt__p_QoS, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RPMessage[] = { {&_swigt__p_RPMessage, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RegistrationEvent[] = { {&_swigt__p_RegistrationEvent, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_RegistrationSession[] = { {&_swigt__p_RegistrationSession, 0, 0, 0},{0, 0, 0, 0}};
@ -27254,6 +27720,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_ProxyVideoProducerCallback,
_swigc__p_PublicationEvent,
_swigc__p_PublicationSession,
_swigc__p_QoS,
_swigc__p_RPMessage,
_swigc__p_RegistrationEvent,
_swigc__p_RegistrationSession,

File diff suppressed because it is too large Load Diff

View File

@ -11,12 +11,14 @@
#ifndef SWIG_TinyWRAP_WRAP_H_
#define SWIG_TinyWRAP_WRAP_H_
namespace Swig {
class Director;
namespace Swig
{
class Director;
}
class SwigDirector_SipCallback : public SipCallback, public Swig::Director {
class SwigDirector_SipCallback : public SipCallback, public Swig::Director
{
public:
SwigDirector_SipCallback(VALUE self);

View File

@ -23,11 +23,11 @@ class ActionConfig;
namespace doubango_rt
{
namespace BackEnd
{
public ref class rtActionConfig sealed
{
public:
namespace BackEnd
{
public ref class rtActionConfig sealed
{
public:
rtActionConfig();
virtual ~rtActionConfig();
@ -43,11 +43,13 @@ namespace doubango_rt
rtActionConfig^ setMediaString(rt_twrap_media_type_t type, Platform::String^ key, Platform::String^ value);
rtActionConfig^ setMediaInt(rt_twrap_media_type_t type, Platform::String^ key, int value);
internal:
ActionConfig* getWrappedActionConfig(){ return m_pActionConfig; }
private:
ActionConfig* m_pActionConfig;
};
internal:
ActionConfig* getWrappedActionConfig() {
return m_pActionConfig;
}
private:
ActionConfig* m_pActionConfig;
};
}
}

View File

@ -28,4 +28,3 @@
# define VISIBLE_VOID_PTR Platform::IntPtr
# define VISIBLE_VOID_PTR_2_VOID_PTR(ptr) (void*)((ptr))
#endif

View File

@ -24,30 +24,30 @@ class DDebugCallbackProxy;
namespace doubango_rt
{
namespace BackEnd
{
public interface class rtIDDebugCallback
{
namespace BackEnd
{
public interface class rtIDDebugCallback
{
virtual int OnDebugInfo(Platform::String^ message);
virtual int OnDebugWarn(Platform::String^ message);
virtual int OnDebugError(Platform::String^ message);
virtual int OnDebugFatal(Platform::String^ message);
};
};
public ref class rtDDebugCallback sealed
{
internal:
public ref class rtDDebugCallback sealed
{
internal:
rtDDebugCallback(rtIDDebugCallback^ pI);
public:
public:
virtual ~rtDDebugCallback();
friend class DDebugCallbackProxy;
internal:
internal:
const DDebugCallback* getWrappedCallback();
private:
private:
rtIDDebugCallback^ m_pI;
DDebugCallbackProxy* m_pCallback;
};
}
};
}
}

View File

@ -27,10 +27,10 @@
namespace doubango_rt
{
namespace BackEnd
{
public enum class rtConstants
{
namespace BackEnd
{
public enum class rtConstants
{
rt_tsip_event_code_dialog_transport_error = tsip_event_code_dialog_transport_error,
rt_tsip_event_code_dialog_global_error = tsip_event_code_dialog_global_error,
rt_tsip_event_code_dialog_message_error = tsip_event_code_dialog_message_error,
@ -52,10 +52,10 @@ namespace doubango_rt
rt_tsip_event_code_stack_stopped = tsip_event_code_stack_stopped,
rt_tsip_event_code_stack_failed_to_start = tsip_event_code_stack_failed_to_start,
rt_tsip_event_code_stack_failed_to_stop = tsip_event_code_stack_failed_to_stop
};
};
public enum class rt_twrap_media_type_t
{
public enum class rt_twrap_media_type_t
{
twrap_media_none = twrap_media_none,
twrap_media_audio = twrap_media_audio,
@ -68,18 +68,19 @@ namespace doubango_rt
twrap_media_audiovideo = twrap_media_audiovideo, /* @deprecated */
twrap_media_audio_video = twrap_media_audio_video,
};
};
public enum class rt_tmedia_bandwidth_level_t
{
public enum class rt_tmedia_bandwidth_level_t
{
tmedia_bl_low = tmedia_bl_low,
tmedia_bl_medium = tmedia_bl_medium,
tmedia_bl_hight = tmedia_bl_hight,
tmedia_bl_unrestricted = tmedia_bl_unrestricted
};
};
public enum class rt_tmedia_pref_video_size_t
{/* must be sorted like this */
public enum class rt_tmedia_pref_video_size_t
{
/* must be sorted like this */
tmedia_pref_video_size_sqcif = tmedia_pref_video_size_sqcif, // 128 x 98
tmedia_pref_video_size_qcif = tmedia_pref_video_size_qcif, // 176 x 144
tmedia_pref_video_size_qvga = tmedia_pref_video_size_qvga, // 320 x 240
@ -94,48 +95,48 @@ namespace doubango_rt
tmedia_pref_video_size_720p = tmedia_pref_video_size_720p, // 1280 x 720
tmedia_pref_video_size_16cif = tmedia_pref_video_size_16cif, // 1408 x 1152
tmedia_pref_video_size_1080p = tmedia_pref_video_size_1080p, // 1920 x 1080
};
};
public enum class rt_tmedia_profile_t
{
public enum class rt_tmedia_profile_t
{
tmedia_profile_default = tmedia_profile_default,
tmedia_profile_rtcweb = tmedia_profile_rtcweb
};
};
public enum class rt_tmedia_qos_strength_t
{
public enum class rt_tmedia_qos_strength_t
{
tmedia_qos_strength_none = tmedia_qos_strength_none,
tmedia_qos_strength_failure = tmedia_qos_strength_failure,
tmedia_qos_strength_unknown = tmedia_qos_strength_unknown,
tmedia_qos_strength_optional = tmedia_qos_strength_optional,
tmedia_qos_strength_mandatory = tmedia_qos_strength_mandatory
};
};
public enum class rt_tmedia_qos_stype_t
{
public enum class rt_tmedia_qos_stype_t
{
tmedia_qos_stype_none = tmedia_qos_stype_none,
tmedia_qos_stype_segmented = tmedia_qos_stype_segmented,
tmedia_qos_stype_e2e = tmedia_qos_stype_e2e,
};
};
public enum class rt_tmedia_srtp_mode_t
{
public enum class rt_tmedia_srtp_mode_t
{
tmedia_srtp_mode_none = tmedia_srtp_mode_none,
tmedia_srtp_mode_optional = tmedia_srtp_mode_optional,
tmedia_srtp_mode_mandatory = tmedia_srtp_mode_mandatory
};
};
public enum class rt_tmedia_srtp_type_t
{
public enum class rt_tmedia_srtp_type_t
{
tmedia_srtp_type_none = tmedia_srtp_type_none,
tmedia_srtp_type_sdes = tmedia_srtp_type_sdes,
tmedia_srtp_type_dtls = tmedia_srtp_type_dtls,
tmedia_srtp_type_sdes_dtls = tmedia_srtp_type_sdes_dtls
};
};
public enum class rt_tmedia_t140_data_type_t
{
public enum class rt_tmedia_t140_data_type_t
{
tmedia_t140_data_type_utf8 = tmedia_t140_data_type_utf8,
tmedia_t140_data_type_zero_width_no_break_space = tmedia_t140_data_type_zero_width_no_break_space,
tmedia_t140_data_type_backspace = tmedia_t140_data_type_backspace,
@ -150,10 +151,10 @@ namespace doubango_rt
tmedia_t140_data_type_graphic_end = tmedia_t140_data_type_graphic_end,
tmedia_t140_data_type_loss_char_char = tmedia_t140_data_type_loss_char_char,
tmedia_t140_data_type_loss_utf8 = tmedia_t140_data_type_loss_utf8,
};
};
public enum class rt_tmedia_type_t
{
public enum class rt_tmedia_type_t
{
tmedia_none = tmedia_none,
tmedia_ghost = tmedia_ghost,
@ -168,33 +169,33 @@ namespace doubango_rt
tmedia_audiovideo = tmedia_audiovideo,
tmedia_all = tmedia_all
};
};
public enum class rt_tmsrp_event_type_t
{
public enum class rt_tmsrp_event_type_t
{
tmsrp_event_type_none = tmsrp_event_type_none,
tmsrp_event_type_connected = tmsrp_event_type_connected,
tmsrp_event_type_disconnected = tmsrp_event_type_disconnected,
tmsrp_event_type_message = tmsrp_event_type_message,
};
};
public enum class rt_tmsrp_request_type_t
{
public enum class rt_tmsrp_request_type_t
{
tmsrp_NONE = tmsrp_NONE,
tmsrp_SEND = tmsrp_SEND,
tmsrp_REPORT = tmsrp_REPORT,
tmsrp_AUTH = tmsrp_AUTH
};
};
public enum class rt_tsip_info_event_type_t
{
public enum class rt_tsip_info_event_type_t
{
tsip_i_info = tsip_i_info,
tsip_ao_info = tsip_ao_info,
};
};
public enum class rt_tsip_invite_event_type_t
{
public enum class rt_tsip_invite_event_type_t
{
tsip_i_newcall = tsip_i_newcall,
tsip_i_request = tsip_i_request,
@ -221,31 +222,31 @@ namespace doubango_rt
tsip_m_local_resume_nok = tsip_m_local_resume_nok,
tsip_m_remote_hold = tsip_m_remote_hold,
tsip_m_remote_resume = tsip_m_remote_resume,
};
};
public enum class rt_tsip_message_event_type_t
{
public enum class rt_tsip_message_event_type_t
{
tsip_i_message = tsip_i_message,
tsip_ao_message = tsip_ao_message,
};
};
public enum class rt_tsip_options_event_type_t
{
public enum class rt_tsip_options_event_type_t
{
tsip_i_options = tsip_i_options,
tsip_ao_options = tsip_ao_options,
};
};
public enum class rt_tsip_publish_event_type_t
{
public enum class rt_tsip_publish_event_type_t
{
tsip_i_publish = tsip_i_publish,
tsip_ao_publish = tsip_ao_publish,
tsip_i_unpublish = tsip_i_unpublish,
tsip_ao_unpublish = tsip_ao_unpublish
};
};
public enum class rt_tsip_register_event_type_t
{
public enum class rt_tsip_register_event_type_t
{
tsip_i_newreg = tsip_i_newreg,
tsip_i_register = tsip_i_register,
@ -253,10 +254,10 @@ namespace doubango_rt
tsip_i_unregister = tsip_i_unregister,
tsip_ao_unregister = tsip_ao_unregister,
};
};
public enum class rt_tsip_request_type_t
{
public enum class rt_tsip_request_type_t
{
tsip_NONE = tsip_NONE,
tsip_ACK = tsip_ACK,
@ -273,10 +274,10 @@ namespace doubango_rt
tsip_MESSAGE = tsip_MESSAGE,
tsip_PUBLISH = tsip_PUBLISH,
tsip_PRACK = tsip_PRACK
};
};
public enum class rt_tsip_subscribe_event_type_t
{
public enum class rt_tsip_subscribe_event_type_t
{
tsip_i_subscribe = tsip_i_subscribe,
tsip_ao_subscribe = tsip_ao_subscribe,
@ -285,10 +286,10 @@ namespace doubango_rt
tsip_i_notify = tsip_i_notify,
tsip_ao_notify = tsip_ao_notify
};
};
public enum class rt_tdav_codec_id_t
{
public enum class rt_tdav_codec_id_t
{
tdav_codec_id_none = tmedia_codec_id_none,
tdav_codec_id_amr_nb_oa = tmedia_codec_id_amr_nb_oa,
@ -328,6 +329,6 @@ namespace doubango_rt
tdav_codec_id_red = tmedia_codec_id_red,
#endif
tdav_codec_id_all = tmedia_codec_id_all,
};
}
};
}
}

View File

@ -25,20 +25,20 @@ struct tmedia_session_mgr_s;
namespace doubango_rt
{
namespace BackEnd
{
enum class rt_twrap_media_type_t;
enum class rt_tmedia_profile_t;
enum class rt_tmedia_srtp_mode_t;
enum class rt_tmedia_srtp_type_t;
enum class rt_tmedia_profile_t;
enum class rt_tmedia_pref_video_size_t;
namespace BackEnd
{
enum class rt_twrap_media_type_t;
enum class rt_tmedia_profile_t;
enum class rt_tmedia_srtp_mode_t;
enum class rt_tmedia_srtp_type_t;
enum class rt_tmedia_profile_t;
enum class rt_tmedia_pref_video_size_t;
public ref class rtCodec sealed
{
internal:
public ref class rtCodec sealed
{
internal:
rtCodec(struct tmedia_codec_s* pCodec);
public:
public:
virtual ~rtCodec();
enum class rt_twrap_media_type_t getMediaType();
Platform::String^ getName();
@ -48,16 +48,16 @@ namespace doubango_rt
int getAudioChannels();
int getAudioPTime();
private:
private:
Codec* m_pCodec;
};
};
public ref class rtMediaSessionMgr sealed
{
internal:
public ref class rtMediaSessionMgr sealed
{
internal:
rtMediaSessionMgr(struct tmedia_session_mgr_s* pWrappedMgr);
public:
public:
virtual ~rtMediaSessionMgr();
bool sessionSetInt32(rt_twrap_media_type_t media, Platform::String^ key, int32 value);
int32 sessionGetInt32(rt_twrap_media_type_t media, Platform::String^ key);
@ -73,7 +73,7 @@ namespace doubango_rt
uint64 getSessionId(rt_twrap_media_type_t media);
internal: // Must be from SIP service to share same global memory space
internal: // Must be from SIP service to share same global memory space
static bool defaultsSetProfile(rt_tmedia_profile_t profile);
static rt_tmedia_profile_t defaultsGetProfile();
static bool defaultsSetPrefVideoSize(enum class rt_tmedia_pref_video_size_t pref_video_size);
@ -123,8 +123,8 @@ namespace doubango_rt
static unsigned defaultsGetRtpBuffSize();
static bool defaultsSetAvpfTail(unsigned tail_min, unsigned tail_max);
private:
private:
MediaSessionMgr* m_pMediaSessionMgr;
};
}
};
}
}

View File

@ -25,30 +25,39 @@ class MsrpEvent;
namespace doubango_rt
{
namespace BackEnd
{
ref class rtMsrpSession;
namespace BackEnd
{
ref class rtMsrpSession;
public ref class rtMsrpByteRange sealed
{
internal:
rtMsrpByteRange(int64 start, int64 end, int64 total):_start(start),_end(end),_total(total){}
public:
property int64 Start{ int64 get() { return _start; }; }
property int64 End{ int64 get() { return _end; }; }
property int64 Total{ int64 get() { return _total; }; }
private:
int64 _start, _end, _total;
public ref class rtMsrpByteRange sealed
{
internal:
rtMsrpByteRange(int64 start, int64 end, int64 total):_start(start),_end(end),_total(total) {}
public:
property int64 Start { int64 get() {
return _start;
};
}
property int64 End { int64 get() {
return _end;
};
}
property int64 Total { int64 get() {
return _total;
};
}
private:
int64 _start, _end, _total;
};
public ref class rtMsrpMessage sealed
{
public:
public ref class rtMsrpMessage sealed
{
public:
virtual ~rtMsrpMessage();
internal:
internal:
rtMsrpMessage(struct tmsrp_message_s *message);
public:
public:
bool isRequest();
short getCode();
Platform::String^ getPhrase();
@ -70,40 +79,42 @@ namespace doubango_rt
unsigned getMsrpContent(Platform::IntPtr output, unsigned maxsize);
#endif
private:
private:
MsrpMessage* m_pMsrpMessage;
};
};
public ref class rtMsrpEvent sealed
{
internal:
public ref class rtMsrpEvent sealed
{
internal:
rtMsrpEvent(const struct tmsrp_event_s *event);
public:
public:
virtual ~rtMsrpEvent();
rt_tmsrp_event_type_t getType();
rtMsrpSession^ getSipSession();
rtMsrpMessage^ getMessage();
private:
private:
MsrpEvent* m_pMsrpEvent;
};
};
public interface class rtIMsrpCallback
{
public interface class rtIMsrpCallback
{
virtual int OnEvent(rtMsrpEvent^ pEvent);
};
public ref class rtMsrpCallback sealed
{
internal:
};
public ref class rtMsrpCallback sealed
{
internal:
rtMsrpCallback(rtIMsrpCallback^ pI);
const MsrpCallback* getWrappedCallback(){ return m_pCallback; }
public:
const MsrpCallback* getWrappedCallback() {
return m_pCallback;
}
public:
virtual ~rtMsrpCallback();
private:
private:
MsrpCallback* m_pCallback;
rtIMsrpCallback^ m_pI;
};
}
};
}
}

View File

@ -22,21 +22,21 @@ class SipCallbackProxy;
namespace doubango_rt
{
namespace BackEnd
{
ref class rtDialogEvent;
ref class rtStackEvent;
namespace BackEnd
{
ref class rtDialogEvent;
ref class rtStackEvent;
ref class rtInviteEvent;
ref class rtMessagingEvent;
ref class rtInfoEvent;
ref class rtOptionsEvent;
ref class rtPublicationEvent;
ref class rtRegistrationEvent;
ref class rtSubscriptionEvent;
ref class rtInviteEvent;
ref class rtMessagingEvent;
ref class rtInfoEvent;
ref class rtOptionsEvent;
ref class rtPublicationEvent;
ref class rtRegistrationEvent;
ref class rtSubscriptionEvent;
public interface class rtISipCallback
{
public interface class rtISipCallback
{
virtual int OnDialogEvent(rtDialogEvent^ e);
virtual int OnStackEvent(rtStackEvent^ e);
@ -47,24 +47,24 @@ namespace doubango_rt
virtual int OnPublicationEvent(rtPublicationEvent^ e);
virtual int OnRegistrationEvent(rtRegistrationEvent^ e);
virtual int OnSubscriptionEvent(rtSubscriptionEvent^ e);
};
};
public ref class rtSipCallback sealed
{
internal:
public ref class rtSipCallback sealed
{
internal:
rtSipCallback(rtISipCallback^ pI);
public:
public:
virtual ~rtSipCallback();
friend class SipCallbackProxy;
internal:
internal:
const SipCallback* getWrappedCallback();
private:
private:
rtISipCallback^ m_pI;
SipCallbackProxy* m_pCallback;
};
}
};
}
}

View File

@ -57,67 +57,67 @@ rtSipMessage^ cls##::getSipMessage(){ \
namespace doubango_rt
{
namespace BackEnd
{
interface class rtISipSession;
ref class rtSipMessage;
ref class rtInviteSession;
ref class rtMsrpSession;
ref class rtCallSession;
ref class rtMessagingSession;
ref class rtInfoSession;
ref class rtOptionsSession;
ref class rtPublicationSession;
ref class rtRegistrationSession;
ref class rtSubscriptionSession;
namespace BackEnd
{
interface class rtISipSession;
ref class rtSipMessage;
ref class rtInviteSession;
ref class rtMsrpSession;
ref class rtCallSession;
ref class rtMessagingSession;
ref class rtInfoSession;
ref class rtOptionsSession;
ref class rtPublicationSession;
ref class rtRegistrationSession;
ref class rtSubscriptionSession;
/* ======================== rtISipEvent ========================*/
public interface class rtISipEvent
{
/* ======================== rtISipEvent ========================*/
public interface class rtISipEvent
{
short getCode();
Platform::String^ getPhrase();
rtISipSession^ getBaseSession();
rtSipMessage^ getSipMessage();
};
};
/* ======================== rtDialogEvent ========================*/
public ref class rtDialogEvent sealed : rtISipEvent
{
internal:
/* ======================== rtDialogEvent ========================*/
public ref class rtDialogEvent sealed : rtISipEvent
{
internal:
rtDialogEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtDialogEvent();
rtISipEvent_Declare();
private:
private:
DialogEvent* m_pEvent;
};
};
/* ======================== rtStackEvent ========================*/
public ref class rtStackEvent sealed : rtISipEvent
{
internal:
/* ======================== rtStackEvent ========================*/
public ref class rtStackEvent sealed : rtISipEvent
{
internal:
rtStackEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtStackEvent();
rtISipEvent_Declare();
private:
private:
StackEvent* m_pEvent;
};
};
/* ======================== rtInviteEvent ========================*/
public ref class rtInviteEvent sealed : rtISipEvent
{
internal:
/* ======================== rtInviteEvent ========================*/
public ref class rtInviteEvent sealed : rtISipEvent
{
internal:
rtInviteEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtInviteEvent();
rtISipEvent_Declare();
@ -127,17 +127,17 @@ namespace doubango_rt
rtCallSession^ takeCallSessionOwnership();
rtMsrpSession^ takeMsrpSessionOwnership();
private:
private:
InviteEvent* m_pEvent;
};
};
/* ======================== rtMessagingEvent ========================*/
public ref class rtMessagingEvent sealed : rtISipEvent
{
internal:
/* ======================== rtMessagingEvent ========================*/
public ref class rtMessagingEvent sealed : rtISipEvent
{
internal:
rtMessagingEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtMessagingEvent();
rtISipEvent_Declare();
@ -145,18 +145,18 @@ namespace doubango_rt
rtMessagingSession^ getSession();
rtMessagingSession^ takeSessionOwnership();
private:
private:
MessagingEvent* m_pEvent;
};
};
/* ======================== rtInfoEvent ========================*/
public ref class rtInfoEvent sealed : rtISipEvent
{
internal:
/* ======================== rtInfoEvent ========================*/
public ref class rtInfoEvent sealed : rtISipEvent
{
internal:
rtInfoEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtInfoEvent();
rtISipEvent_Declare();
@ -164,18 +164,18 @@ namespace doubango_rt
rtInfoSession^ getSession();
rtInfoSession^ takeSessionOwnership();
private:
private:
InfoEvent* m_pEvent;
};
};
/* ======================== rtOptionsEvent ========================*/
public ref class rtOptionsEvent sealed : rtISipEvent
{
internal:
/* ======================== rtOptionsEvent ========================*/
public ref class rtOptionsEvent sealed : rtISipEvent
{
internal:
rtOptionsEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtOptionsEvent();
rtISipEvent_Declare();
@ -183,17 +183,17 @@ namespace doubango_rt
rtOptionsSession^ getSession();
rtOptionsSession^ takeSessionOwnership();
private:
private:
OptionsEvent* m_pEvent;
};
};
/* ======================== rtPublicationEvent ========================*/
public ref class rtPublicationEvent sealed : rtISipEvent
{
internal:
/* ======================== rtPublicationEvent ========================*/
public ref class rtPublicationEvent sealed : rtISipEvent
{
internal:
rtPublicationEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtPublicationEvent();
rtISipEvent_Declare();
@ -201,17 +201,17 @@ namespace doubango_rt
rtPublicationSession^ getSession();
rtPublicationSession^ takeSessionOwnership();
private:
private:
PublicationEvent* m_pEvent;
};
};
/* ======================== rtRegistrationEvent ========================*/
public ref class rtRegistrationEvent sealed : rtISipEvent
{
internal:
/* ======================== rtRegistrationEvent ========================*/
public ref class rtRegistrationEvent sealed : rtISipEvent
{
internal:
rtRegistrationEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtRegistrationEvent();
rtISipEvent_Declare();
@ -219,17 +219,17 @@ namespace doubango_rt
rtRegistrationSession^ getSession();
rtRegistrationSession^ takeSessionOwnership();
private:
private:
RegistrationEvent* m_pEvent;
};
};
/* ======================== rtSubscriptionEvent ========================*/
public ref class rtSubscriptionEvent sealed : rtISipEvent
{
internal:
/* ======================== rtSubscriptionEvent ========================*/
public ref class rtSubscriptionEvent sealed : rtISipEvent
{
internal:
rtSubscriptionEvent(const struct tsip_event_s *e);
public:
public:
virtual ~rtSubscriptionEvent();
rtISipEvent_Declare();
@ -237,8 +237,8 @@ namespace doubango_rt
rtSubscriptionSession^ getSession();
rtSubscriptionSession^ takeSessionOwnership();
private:
private:
SubscriptionEvent* m_pEvent;
};
}
};
}
}

View File

@ -27,34 +27,34 @@ struct tsip_message_s;
namespace doubango_rt
{
namespace BackEnd
{
public ref class rtSdpMessage sealed
{
internal:
namespace BackEnd
{
public ref class rtSdpMessage sealed
{
internal:
rtSdpMessage();
rtSdpMessage(struct tsdp_message_s *message);
public:
public:
virtual ~rtSdpMessage();
public:
public:
Platform::String^ getSdpHeaderValue(Platform::String^ media, Platform::String^ name, unsigned index);
Platform::String^ getSdpHeaderValue(Platform::String^ media, Platform::String^ name);
Platform::String^ getSdpHeaderAValue(Platform::String^ media, Platform::String^ attributeName);
private:
private:
SdpMessage* m_pSdpMessage;
};
};
public ref class rtSipMessage sealed
{
internal:
public ref class rtSipMessage sealed
{
internal:
rtSipMessage();
rtSipMessage(struct tsip_message_s* message);
public:
public:
virtual ~rtSipMessage();
public:
public:
bool isResponse();
rt_tsip_request_type_t getRequestType();
short getResponseCode();
@ -71,8 +71,8 @@ namespace doubango_rt
#endif
rtSdpMessage^ getSdpMessage();
private:
private:
SipMessage* m_pSipMessage;
};
}
};
}
}

View File

@ -159,116 +159,122 @@ rtMediaSessionMgr^ cls##::getMediaMgr(){ \
namespace doubango_rt
{
namespace BackEnd
{
ref class rtMsrpCallback;
interface class rtIMsrpCallback;
namespace BackEnd
{
ref class rtMsrpCallback;
interface class rtIMsrpCallback;
/* ======================== rtT140CallbackData ========================*/
public ref class rtT140CallbackData sealed
{
internal:
/* ======================== rtT140CallbackData ========================*/
public ref class rtT140CallbackData sealed
{
internal:
rtT140CallbackData(enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size);
public:
public:
virtual ~rtT140CallbackData();
private:
private:
T140CallbackData* m_pData;
};
};
/* ======================== rtT140Callback ========================*/
public interface class rtIT140Callback
{
/* ======================== rtT140Callback ========================*/
public interface class rtIT140Callback
{
virtual int ondata(rtT140CallbackData^ pData);
};
public ref class rtT140Callback sealed
{
internal:
};
public ref class rtT140Callback sealed
{
internal:
rtT140Callback();
const T140Callback* getWrappedCallback(){ return m_pCallback; }
const T140Callback* getWrappedCallback() {
return m_pCallback;
}
public:
rtT140Callback(rtIT140Callback^ pI)
{
public:
rtT140Callback(rtIT140Callback^ pI) {
m_pI = pI;
}
virtual ~rtT140Callback();
protected:
virtual int ondata(rtT140CallbackData^ pData){
if(m_pI)
{
protected:
virtual int ondata(rtT140CallbackData^ pData) {
if(m_pI) {
return m_pI->ondata(pData);
}
return 0;
}
private:
private:
T140Callback* m_pCallback;
rtIT140Callback^ m_pI;
};
};
/* ======================== rtISipSession ========================*/
public interface class rtISipSession
{
/* ======================== rtISipSession ========================*/
public interface class rtISipSession
{
rtISession_Declare();
};
};
/* ======================== rtIInviteSession ========================*/
public interface class rtIInviteSession : rtISipSession
{
/* ======================== rtIInviteSession ========================*/
public interface class rtIInviteSession : rtISipSession
{
rtIInviteSession_Declare();
};
};
/* ======================== rtSipSession ========================*/
public ref class rtSipSession sealed: rtISipSession
{
public:
/* ======================== rtSipSession ========================*/
public ref class rtSipSession sealed: rtISipSession
{
public:
rtSipSession(rtSipStack^ pStack);
virtual ~rtSipSession();
internal:
internal:
rtSipSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
SipSession* getWrappedSession(){ return m_pSipSession; }
SipSession* getWrappedSession() {
return m_pSipSession;
}
public:
public:
rtISession_Declare();
private:
private:
SipSession* m_pSipSession;
};
};
/* ======================== rtInviteSession ========================*/
public ref class rtInviteSession sealed: rtIInviteSession
{
public:
/* ======================== rtInviteSession ========================*/
public ref class rtInviteSession sealed: rtIInviteSession
{
public:
rtInviteSession(rtSipStack^ pStack);
virtual ~rtInviteSession();
internal:
internal:
rtInviteSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
InviteSession* getWrappedSession(){ return m_pSipSession; }
InviteSession* getWrappedSession() {
return m_pSipSession;
}
public:
public:
rtISession_Declare();
rtIInviteSession_Declare();
private:
private:
InviteSession* m_pSipSession;
};
};
/* ======================== CallSession ========================*/
public ref class rtCallSession sealed : rtIInviteSession
{
public:
/* ======================== CallSession ========================*/
public ref class rtCallSession sealed : rtIInviteSession
{
public:
rtCallSession(rtSipStack^ pStack);
virtual ~rtCallSession();
internal:
internal:
rtCallSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
CallSession* getWrappedSession(){ return m_pSipSession; }
CallSession* getWrappedSession() {
return m_pSipSession;
}
public:
public:
rtISession_Declare();
rtIInviteSession_Declare();
@ -309,23 +315,25 @@ namespace doubango_rt
bool sendT140Data(rt_tmedia_t140_data_type_t data_type);
bool setT140Callback(rtT140Callback^ pT140Callback);
private:
private:
CallSession* m_pSipSession;
};
};
/* ======================== rtMsrpSession ========================*/
public ref class rtMsrpSession sealed : rtIInviteSession
{
public:
/* ======================== rtMsrpSession ========================*/
public ref class rtMsrpSession sealed : rtIInviteSession
{
public:
rtMsrpSession(rtSipStack^ pStack, rtIMsrpCallback^ pCallback);
virtual ~rtMsrpSession();
internal:
internal:
rtMsrpSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
MsrpSession* getWrappedSession(){ return m_pSipSession; }
MsrpSession* getWrappedSession() {
return m_pSipSession;
}
public:
public:
rtISession_Declare();
rtIInviteSession_Declare();
@ -344,17 +352,17 @@ namespace doubango_rt
bool sendMessage(Platform::IntPtr payload, unsigned len);
#endif
private:
private:
MsrpSession* m_pSipSession;
rtMsrpCallback^ m_pCallback;
};
};
/* ======================== rtMessagingSession ========================*/
public ref class rtMessagingSession sealed : rtISipSession
{
internal:
/* ======================== rtMessagingSession ========================*/
public ref class rtMessagingSession sealed : rtISipSession
{
internal:
rtMessagingSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
public:
public:
rtMessagingSession(rtSipStack^ pStack);
virtual ~rtMessagingSession();
@ -375,17 +383,17 @@ namespace doubango_rt
bool reject(rtActionConfig^ config);
bool reject();
private:
private:
MessagingSession* m_pSipSession;
};
};
/* ======================== rtInfoSession ========================*/
public ref class rtInfoSession sealed : rtISipSession
{
internal:
/* ======================== rtInfoSession ========================*/
public ref class rtInfoSession sealed : rtISipSession
{
internal:
rtInfoSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
public:
public:
rtInfoSession(rtSipStack^ pStack);
virtual ~rtInfoSession();
@ -406,17 +414,17 @@ namespace doubango_rt
bool reject(rtActionConfig^ config);
bool reject();
private:
private:
InfoSession* m_pSipSession;
};
};
/* ======================== rtOptionsSession ========================*/
public ref class rtOptionsSession sealed : rtISipSession
{
internal:
/* ======================== rtOptionsSession ========================*/
public ref class rtOptionsSession sealed : rtISipSession
{
internal:
rtOptionsSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
public:
public:
rtOptionsSession(rtSipStack^ pStack);
virtual ~rtOptionsSession();
@ -432,17 +440,17 @@ namespace doubango_rt
bool reject(rtActionConfig^ config);
bool reject();
private:
private:
OptionsSession* m_pSipSession;
};
};
/* ======================== rtPublicationSession ========================*/
public ref class rtPublicationSession sealed : rtISipSession
{
internal:
/* ======================== rtPublicationSession ========================*/
public ref class rtPublicationSession sealed : rtISipSession
{
internal:
rtPublicationSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
public:
public:
rtPublicationSession(rtSipStack^ pStack);
virtual ~rtPublicationSession();
@ -460,17 +468,17 @@ namespace doubango_rt
bool unPublish(rtActionConfig^ config);
bool unPublish();
private:
private:
PublicationSession* m_pSipSession;
};
};
/* ======================== rtRegistrationSession ========================*/
public ref class rtRegistrationSession sealed : rtISipSession
{
internal:
/* ======================== rtRegistrationSession ========================*/
public ref class rtRegistrationSession sealed : rtISipSession
{
internal:
rtRegistrationSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
public:
public:
rtRegistrationSession(rtSipStack^ pStack);
virtual ~rtRegistrationSession();
@ -485,16 +493,16 @@ namespace doubango_rt
bool reject(rtActionConfig^ config);
bool reject();
private:
private:
RegistrationSession* m_pSipSession;
};
};
/* ======================== rtSubscriptionSession ========================*/
public ref class rtSubscriptionSession sealed : rtISipSession
{
internal:
/* ======================== rtSubscriptionSession ========================*/
public ref class rtSubscriptionSession sealed : rtISipSession
{
internal:
rtSubscriptionSession(SipStack* pStack, tsip_ssession_handle_t* pHandle);
public:
public:
rtSubscriptionSession(rtSipStack^ pStack);
virtual ~rtSubscriptionSession();
@ -503,8 +511,8 @@ namespace doubango_rt
bool subscribe();
bool unSubscribe();
private:
private:
SubscriptionSession* m_pSipSession;
};
}
};
}
}

View File

@ -23,37 +23,45 @@ class SipStack;
namespace doubango_rt
{
namespace BackEnd
{
ref class rtSipCallback;
interface class rtISipCallback;
ref class rtDDebugCallback;
interface class rtIDDebugCallback;
namespace BackEnd
{
ref class rtSipCallback;
interface class rtISipCallback;
ref class rtDDebugCallback;
interface class rtIDDebugCallback;
enum class rt_tdav_codec_id_t;
enum class rt_tdav_codec_id_t;
public ref class rtDnsResult sealed
{
internal:
rtDnsResult(uint16 port, Platform::String^ address):_port(port), _address(address){}
public:
property uint16 Port{ uint16 get() { return _port; }; }
property Platform::String^ Address{ Platform::String^ get() { return _address; }; }
private:
public ref class rtDnsResult sealed
{
internal:
rtDnsResult(uint16 port, Platform::String^ address):_port(port), _address(address) {}
public:
property uint16 Port { uint16 get() {
return _port;
};
}
property Platform::String^ Address { Platform::String^ get() {
return _address;
};
}
private:
uint16 _port;
Platform::String^ _address;
};
};
public ref class rtSipStack sealed
{
public:
public ref class rtSipStack sealed
{
public:
virtual ~rtSipStack();
internal:
internal:
rtSipStack(rtISipCallback^ callback, Platform::String^ realmUri, Platform::String^ impiString, Platform::String^ impuUri);
const SipStack* getWrappedStack() { return m_pSipStack; }
const SipStack* getWrappedStack() {
return m_pSipStack;
}
public:
public:
bool start();
bool setDebugCallback(rtIDDebugCallback^ pCallback);
bool setDisplayName(Platform::String^ display_name);
@ -110,11 +118,11 @@ namespace doubango_rt
static bool setCodecPriority(enum class rt_tdav_codec_id_t codec_id, int priority);
static bool isCodecSupported(enum class rt_tdav_codec_id_t codec_id);
private:
private:
SipStack* m_pSipStack;
rtSipCallback^ m_pSipCallback;
rtDDebugCallback^ m_pDebugCallback;
std::recursive_mutex mLock;
};
}
};
}
}

View File

@ -23,17 +23,17 @@ class SipUri;
namespace doubango_rt
{
namespace BackEnd
{
public ref class rtSipUri sealed
{
public:
namespace BackEnd
{
public ref class rtSipUri sealed
{
public:
virtual ~rtSipUri();
rtSipUri(Platform::String^ uriString, Platform::String^ displayName);
rtSipUri(Platform::String^ uriString);
public:
public:
static bool isValid(Platform::String^ uri);
#if COM_VISIBLE
@ -50,11 +50,13 @@ namespace doubango_rt
Platform::String^ getParamValue(Platform::String^ name);
void setDisplayName(Platform::String^ displayName);
internal:
const SipUri* getWrappedUri(){ return m_pSipUri; }
private:
SipUri* m_pSipUri;
};
internal:
const SipUri* getWrappedUri() {
return m_pSipUri;
}
private:
SipUri* m_pSipUri;
};
}
}

View File

@ -21,13 +21,13 @@
namespace doubango_rt
{
namespace BackEnd
{
ref class rtString sealed
{
internal:
namespace BackEnd
{
ref class rtString sealed
{
internal:
static std::vector<char> toUtf8(Platform::String^ str);
static Platform::String^ toString(char const* str);
};
}
};
}
}

View File

@ -27,33 +27,27 @@ using namespace std;
class DDebugCallbackProxy : public DDebugCallback
{
public:
DDebugCallbackProxy(rtDDebugCallback^ pCallback)
{
DDebugCallbackProxy(rtDDebugCallback^ pCallback) {
m_pCallback = pCallback;
}
~DDebugCallbackProxy()
{
~DDebugCallbackProxy() {
}
virtual int OnDebugInfo(const char* message)
{
virtual int OnDebugInfo(const char* message) {
return m_pCallback->m_pI->OnDebugInfo(rtString::toString(message));
}
virtual int OnDebugWarn(const char* message)
{
virtual int OnDebugWarn(const char* message) {
return m_pCallback->m_pI->OnDebugWarn(rtString::toString(message));
}
virtual int OnDebugError(const char* message)
{
virtual int OnDebugError(const char* message) {
return m_pCallback->m_pI->OnDebugError(rtString::toString(message));
}
virtual int OnDebugFatal(const char* message)
{
virtual int OnDebugFatal(const char* message) {
return m_pCallback->m_pI->OnDebugFatal(rtString::toString(message));
}

View File

@ -114,8 +114,7 @@ bool rtMediaSessionMgr::producerSetInt64(rt_twrap_media_type_t media, Platform::
rtCodec^ rtMediaSessionMgr::producerGetCodec(rt_twrap_media_type_t media)
{
Codec* c = m_pMediaSessionMgr->producerGetCodec((twrap_media_type_t)media);
if(c)
{
if(c) {
rtCodec^ codec = ref new rtCodec(const_cast<struct tmedia_codec_s*>(c->getWrappedCodec()));
rtSafeDelete(c);
return codec;

View File

@ -115,11 +115,9 @@ unsigned rtMsrpMessage::getMsrpContentLength()
#if COM_VISIBLE
String^ rtMsrpMessage::getMsrpContent(unsigned maxsize)
{
if(maxsize)
{
if(maxsize) {
void* _s = calloc(maxsize + 1, 1);
if(_s)
{
if(_s) {
unsigned len = m_pMsrpMessage->getMsrpContent(_s, maxsize);
String^ s = rtString::toString((const char*)_s);
free(_s);
@ -157,8 +155,7 @@ rt_tmsrp_event_type_t rtMsrpEvent::getType()
rtMsrpSession^ rtMsrpEvent::getSipSession()
{
if(m_pMsrpEvent->getSipSession())
{
if(m_pMsrpEvent->getSipSession()) {
assert(0); // FIXME: Not implemented
return nullptr;
// return ref new rtMsrpSession(m_pMsrpEvent->getSipSession()->getWrappedSession());
@ -168,8 +165,7 @@ rtMsrpSession^ rtMsrpEvent::getSipSession()
rtMsrpMessage^ rtMsrpEvent::getMessage()
{
if(m_pMsrpEvent->getMessage())
{
if(m_pMsrpEvent->getMessage()) {
return ref new rtMsrpMessage(const_cast<struct tmsrp_message_s *>(const_cast<MsrpMessage*>(m_pMsrpEvent->getMessage())->getWrappedMsrpMessage()));
}
return nullptr;
@ -191,4 +187,3 @@ rtMsrpCallback::~rtMsrpCallback()
}

View File

@ -28,87 +28,68 @@ using namespace std;
class SipCallbackProxy : public SipCallback
{
public:
SipCallbackProxy(rtSipCallback^ rtCallback)
{
SipCallbackProxy(rtSipCallback^ rtCallback) {
m_pCallback = rtCallback;
}
virtual int OnDialogEvent(const DialogEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnDialogEvent(const DialogEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnDialogEvent(ref new rtDialogEvent(const_cast<tsip_event_t*>(const_cast<DialogEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnStackEvent(const StackEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnStackEvent(const StackEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnStackEvent(ref new rtStackEvent(const_cast<tsip_event_t*>(const_cast<StackEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnInviteEvent(const InviteEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnInviteEvent(const InviteEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnInviteEvent(ref new rtInviteEvent(const_cast<tsip_event_t*>(const_cast<InviteEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnMessagingEvent(const MessagingEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnMessagingEvent(const MessagingEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnMessagingEvent(ref new rtMessagingEvent(const_cast<tsip_event_t*>(const_cast<MessagingEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnInfoEvent(const InfoEvent* e) override
{
if(m_pCallback && m_pCallback->m_pI)
{
virtual int OnInfoEvent(const InfoEvent* e) override {
if(m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnInfoEvent(ref new rtInfoEvent(const_cast<tsip_event_t*>(const_cast<InfoEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnOptionsEvent(const OptionsEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnOptionsEvent(const OptionsEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnOptionsEvent(ref new rtOptionsEvent(const_cast<tsip_event_t*>(const_cast<OptionsEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnPublicationEvent(const PublicationEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnPublicationEvent(const PublicationEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnPublicationEvent(ref new rtPublicationEvent(const_cast<tsip_event_t*>(const_cast<PublicationEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnRegistrationEvent(const RegistrationEvent* e) override
{
if(m_pCallback && m_pCallback->m_pI)
{
virtual int OnRegistrationEvent(const RegistrationEvent* e) override {
if(m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnRegistrationEvent(ref new rtRegistrationEvent(const_cast<tsip_event_t*>(const_cast<RegistrationEvent*>(e)->getWrappedEvent())));
}
return 0;
}
virtual int OnSubscriptionEvent(const SubscriptionEvent* e) override
{
if(e && m_pCallback && m_pCallback->m_pI)
{
virtual int OnSubscriptionEvent(const SubscriptionEvent* e) override {
if(e && m_pCallback && m_pCallback->m_pI) {
return m_pCallback->m_pI->OnSubscriptionEvent(ref new rtSubscriptionEvent(const_cast<tsip_event_t*>(const_cast<SubscriptionEvent*>(e)->getWrappedEvent())));
}
return 0;

View File

@ -78,7 +78,7 @@ rtStackEvent::~rtStackEvent()
}
/* ======================== rtInviteEvent ========================*/
/* ======================== rtInviteEvent ========================*/
rtISipEvent_Implement(rtInviteEvent);
rtInviteEvent::rtInviteEvent(const struct tsip_event_s *e)

View File

@ -45,8 +45,7 @@ rtSdpMessage::~rtSdpMessage()
String^ rtSdpMessage::getSdpHeaderValue(String^ media, String^ name, unsigned index)
{
if(m_pSdpMessage)
{
if(m_pSdpMessage) {
char * _str = m_pSdpMessage->getSdpHeaderValue
(rtString::toUtf8(media).data(),
rtString::toUtf8(media).data()[0],
@ -65,8 +64,7 @@ String^ rtSdpMessage::getSdpHeaderValue(String^ media, String^ name)
String^ rtSdpMessage::getSdpHeaderAValue(String^ media, String^ attributeName)
{
if(m_pSdpMessage)
{
if(m_pSdpMessage) {
char * _str = m_pSdpMessage->getSdpHeaderAValue
(rtString::toUtf8(media).data(),
rtString::toUtf8(attributeName).data());
@ -145,11 +143,9 @@ unsigned rtSipMessage::getSipContentLength()
String^ rtSipMessage::getSipContent()
{
unsigned len = getSipContentLength();
if(len > 0)
{
if(len > 0) {
void* data_ptr = calloc(len, 1);
if(data_ptr)
{
if(data_ptr) {
m_pSipMessage->getSipContent(data_ptr, len);
String^ s = rtString::toString((const char*)data_ptr);
free(data_ptr);

View File

@ -294,8 +294,7 @@ rtMsrpSession::~rtMsrpSession()
bool rtMsrpSession::setCallback(rtIMsrpCallback^ pCallback)
{
rtSafeDelete(m_pCallback);
if(!pCallback)
{
if(!pCallback) {
return m_pSipSession->setCallback(tsk_null);
return true;
}

View File

@ -61,8 +61,7 @@ bool rtSipStack::setDebugCallback(rtIDDebugCallback^ pCallback)
m_pSipStack->setDebugCallback(tsk_null);
rtSafeDelete(m_pDebugCallback);
if(!pCallback)
{
if(!pCallback) {
return true;
}

View File

@ -95,8 +95,7 @@ Platform::String^ rtSipUri::getParamValue(Platform::String^ name)
void rtSipUri::setDisplayName(Platform::String^ displayName)
{
if(m_pSipUri)
{
if(m_pSipUri) {
m_pSipUri->setDisplayName(rtString::toUtf8(displayName).data());
}
}

View File

@ -25,14 +25,11 @@ using namespace std;
vector<char> rtString::toUtf8(String^ str)
{
if(str != nullptr && !str->IsEmpty())
{
if(str != nullptr && !str->IsEmpty()) {
int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, str->Data(), str->Length(), nullptr, 0, nullptr, nullptr);
if (len > 0)
{
if (len > 0) {
vector<char> vec(len + 1);
if (WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, str->Data(), str->Length(), vec.data(), len, nullptr, nullptr) == len)
{
if (WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, str->Data(), str->Length(), vec.data(), len, nullptr, nullptr) == len) {
return std::move(vec);
}
}
@ -42,14 +39,11 @@ vector<char> rtString::toUtf8(String^ str)
String^ rtString::toString(char const* str)
{
if(str)
{
if(str) {
int len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, nullptr, 0);
if (len > 0)
{
if (len > 0) {
vector<wchar_t> vec(len);
if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, vec.data(), len) == len)
{
if (MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, vec.data(), len) == len) {
return ref new String(vec.data());
}
}

View File

@ -29,8 +29,7 @@
#include "tsk_safeobj.h"
#include "tsk_debug.h"
typedef enum PLUGIN_INDEX_E
{
typedef enum PLUGIN_INDEX_E {
PLUGIN_INDEX_AUDIO_CONSUMER,
PLUGIN_INDEX_AUDIO_PRODUCER,
PLUGIN_INDEX_COUNT
@ -45,11 +44,12 @@ int __plugin_get_def_count()
tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
{
switch(index){
case PLUGIN_INDEX_AUDIO_CONSUMER: return tsk_plugin_def_type_consumer;
case PLUGIN_INDEX_AUDIO_PRODUCER: return tsk_plugin_def_type_producer;
default:
{
switch(index) {
case PLUGIN_INDEX_AUDIO_CONSUMER:
return tsk_plugin_def_type_consumer;
case PLUGIN_INDEX_AUDIO_PRODUCER:
return tsk_plugin_def_type_producer;
default: {
AUDIO_OPENSLES_DEBUG_ERROR("No plugin at index %d", index);
return tsk_plugin_def_type_none;
}
@ -58,14 +58,12 @@ tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
{
switch(index){
switch(index) {
case PLUGIN_INDEX_AUDIO_CONSUMER:
case PLUGIN_INDEX_AUDIO_PRODUCER:
{
case PLUGIN_INDEX_AUDIO_PRODUCER: {
return tsk_plugin_def_media_type_audio;
}
default:
{
default: {
AUDIO_OPENSLES_DEBUG_ERROR("No plugin at index %d", index);
return tsk_plugin_def_media_type_none;
}
@ -74,17 +72,14 @@ tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
{
switch(index){
case PLUGIN_INDEX_AUDIO_CONSUMER:
{
switch(index) {
case PLUGIN_INDEX_AUDIO_CONSUMER: {
return audio_consumer_opensles_plugin_def_t;
}
case PLUGIN_INDEX_AUDIO_PRODUCER:
{
case PLUGIN_INDEX_AUDIO_PRODUCER: {
return audio_producer_opensles_plugin_def_t;
}
default:
{
default: {
AUDIO_OPENSLES_DEBUG_ERROR("No plugin at index %d", index);
return tsk_null;
}
@ -95,8 +90,7 @@ tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
// SLES AudioInstance
//
typedef struct audio_opensles_instance_s
{
typedef struct audio_opensles_instance_s {
TSK_DECLARE_OBJECT;
uint64_t sessionId;
@ -125,7 +119,7 @@ static audio_opensles_instances_L_t* __audioInstances = tsk_null;
static tsk_object_t* audio_opensles_instance_ctor(tsk_object_t * self, va_list * app)
{
audio_opensles_instance_t* audioInstance = (audio_opensles_instance_t*)self;
if(audioInstance){
if(audioInstance) {
tsk_safeobj_init(audioInstance);
}
return self;
@ -134,15 +128,15 @@ static tsk_object_t* audio_opensles_instance_dtor(tsk_object_t * self)
{
AUDIO_OPENSLES_DEBUG_INFO("Audio Instance destroyed");
audio_opensles_instance_t* audioInstance = (audio_opensles_instance_t*)self;
if(audioInstance){
if(audioInstance) {
tsk_safeobj_lock(audioInstance);
if(audioInstance->device){
if(audioInstance->device) {
audioInstance->device->SetCallback(NULL);
audioInstance->device->Terminate();
delete audioInstance->device;
audioInstance->device = tsk_null;
}
if(audioInstance->callback){
if(audioInstance->callback) {
delete audioInstance->callback;
audioInstance->callback = tsk_null;
}
@ -156,8 +150,7 @@ static int audio_opensles_instance_cmp(const tsk_object_t *_ai1, const tsk_objec
{
return ((int)_ai1 - (int)_ai2);
}
static const tsk_object_def_t audio_opensles_instance_def_s =
{
static const tsk_object_def_t audio_opensles_instance_def_s = {
sizeof(audio_opensles_instance_t),
audio_opensles_instance_ctor,
audio_opensles_instance_dtor,
@ -171,7 +164,7 @@ audio_opensles_instance_handle_t* audio_opensles_instance_create(uint64_t sessio
audio_opensles_instance_t* audioInstance = tsk_null;
// create list used to hold instances
if(!__audioInstances && !(__audioInstances = tsk_list_create())){
if(!__audioInstances && !(__audioInstances = tsk_list_create())) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create new list");
return tsk_null;
}
@ -181,38 +174,38 @@ audio_opensles_instance_handle_t* audio_opensles_instance_create(uint64_t sessio
// find the instance from the list
const tsk_list_item_t* item;
tsk_list_foreach(item, __audioInstances){
if(((audio_opensles_instance_t*)item->data)->sessionId == sessionId){
tsk_list_foreach(item, __audioInstances) {
if(((audio_opensles_instance_t*)item->data)->sessionId == sessionId) {
audioInstance = (audio_opensles_instance_t*)tsk_object_ref(item->data);
break;
}
}
if(!audioInstance){
if(!audioInstance) {
audio_opensles_instance_t* _audioInstance;
if(!(_audioInstance = (audio_opensles_instance_t*)tsk_object_new(&audio_opensles_instance_def_s))){
if(!(_audioInstance = (audio_opensles_instance_t*)tsk_object_new(&audio_opensles_instance_def_s))) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create new audio instance");
goto done;
}
if(!(_audioInstance->device = new SLAudioDevice())){
if(!(_audioInstance->device = new SLAudioDevice())) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create audio device");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
}
if(!(_audioInstance->callback = new SLAudioDeviceCallbackImpl())){
if(!(_audioInstance->callback = new SLAudioDeviceCallbackImpl())) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create audio transport");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
}
if((_audioInstance->device->SetCallback(_audioInstance->callback))){
if((_audioInstance->device->SetCallback(_audioInstance->callback))) {
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::RegisterAudioCallback() failed");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
}
if((_audioInstance->device->Init())){
if((_audioInstance->device->Init())) {
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::Init() failed");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
@ -234,12 +227,12 @@ int audio_opensles_instance_prepare_consumer(audio_opensles_instance_handle_t* _
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
const struct audio_consumer_opensles_s* consumer = (const struct audio_consumer_opensles_s*)*_consumer;
if(!self || !self->device || !self->callback || !_consumer || !*_consumer){
if(!self || !self->device || !self->callback || !_consumer || !*_consumer) {
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
return -1;
}
if(self->isConsumerPrepared){
if(self->isConsumerPrepared) {
AUDIO_OPENSLES_DEBUG_WARN("Consumer already prepared");
return 0;
}
@ -251,34 +244,34 @@ int audio_opensles_instance_prepare_consumer(audio_opensles_instance_handle_t* _
self->callback->SetConsumer(consumer);
if((ret = self->device->SpeakerIsAvailable(&_bool))){
if((ret = self->device->SpeakerIsAvailable(&_bool))) {
AUDIO_OPENSLES_DEBUG_ERROR("SpeakerIsAvailable() failed with error code=%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
AUDIO_OPENSLES_DEBUG_ERROR("SpeakerIsAvailable() returned false");
}
self->isSpeakerAvailable = _bool;
}
if((ret = self->device->InitSpeaker())){
if((ret = self->device->InitSpeaker())) {
AUDIO_OPENSLES_DEBUG_ERROR("InitSpeaker() failed with error code=%d", ret);
}
else if((ret = self->device->SetSpeakerOn(audio_consumer_opensles_is_speakerOn(consumer)))){
else if((ret = self->device->SetSpeakerOn(audio_consumer_opensles_is_speakerOn(consumer)))) {
AUDIO_OPENSLES_DEBUG_ERROR("SetSpeakerOn() failed with error code=%d", ret);
}
if((ret = self->device->PlayoutIsAvailable(&_bool))){
if((ret = self->device->PlayoutIsAvailable(&_bool))) {
AUDIO_OPENSLES_DEBUG_ERROR("PlayoutIsAvailable() failed with error code =%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
AUDIO_OPENSLES_DEBUG_ERROR("PlayoutIsAvailable() returned false");
}
self->isPlayoutAvailable = _bool;
}
if((ret = self->device->SetStereoPlayout(((*_consumer)->audio.in.channels == 2)))){
if((ret = self->device->SetStereoPlayout(((*_consumer)->audio.in.channels == 2)))) {
AUDIO_OPENSLES_DEBUG_ERROR("SetStereoPlayout(%d==2) failed with error code=%d", (*_consumer)->audio.in.channels, ret);
}
@ -286,31 +279,31 @@ int audio_opensles_instance_prepare_consumer(audio_opensles_instance_handle_t* _
// AUDIO_OPENSLES_DEBUG_ERROR("SetPlayoutBuffer(%d ms) failed with error code=%d", (*_consumer)->audio.ptime, ret);
//}
// always request 10ms buffers
if((ret = self->device->SetPlayoutBuffer(10))){
if((ret = self->device->SetPlayoutBuffer(10))) {
AUDIO_OPENSLES_DEBUG_ERROR("SetPlayoutBuffer(%d ms) failed with error code=%d", 10, ret);
}
int playoutSampleRate = (*_consumer)->audio.out.rate ? (*_consumer)->audio.out.rate : (*_consumer)->audio.in.rate;
if((ret = self->device->SetPlayoutSampleRate(playoutSampleRate))){
if((ret = self->device->SetPlayoutSampleRate(playoutSampleRate))) {
AUDIO_OPENSLES_DEBUG_ERROR("SetPlayoutSampleRate(%d) failed with error code=%d", playoutSampleRate, ret);
}
if((ret = self->device->InitPlayout())){
if((ret = self->device->InitPlayout())) {
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::InitPlayout() failed with error code = %d", ret);
goto done;
}
// init output parameters
if((ret = self->device->StereoPlayout(&_bool))){
if((ret = self->device->StereoPlayout(&_bool))) {
AUDIO_OPENSLES_DEBUG_ERROR("StereoPlayout() failed with error code=%d", ret);
}
else{
else {
(*_consumer)->audio.out.channels = (_bool ? 2 : 1);
}
if((ret = self->device->PlayoutSampleRate(&playoutSampleRate))){
if((ret = self->device->PlayoutSampleRate(&playoutSampleRate))) {
AUDIO_OPENSLES_DEBUG_ERROR("PlayoutSampleRate() failed with error code=%d", ret);
}
else{
else {
(*_consumer)->audio.out.rate = playoutSampleRate;
}
@ -325,12 +318,12 @@ done:
int audio_opensles_instance_prepare_producer(audio_opensles_instance_handle_t* _self, tmedia_producer_t** _producer)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device || !self->callback || !_producer || !*_producer){
if(!self || !self->device || !self->callback || !_producer || !*_producer) {
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
return -1;
}
if(self->isProducerPrepared){
if(self->isProducerPrepared) {
AUDIO_OPENSLES_DEBUG_WARN("Producer already prepared");
return 0;
}
@ -342,55 +335,55 @@ int audio_opensles_instance_prepare_producer(audio_opensles_instance_handle_t* _
self->callback->SetProducer((const struct audio_producer_opensles_s*)*_producer);
if((ret = self->device->RecordingIsAvailable(&_bool))){
if((ret = self->device->RecordingIsAvailable(&_bool))) {
AUDIO_OPENSLES_DEBUG_ERROR("RecordingIsAvailable() failed with error code =%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
AUDIO_OPENSLES_DEBUG_ERROR("RecordingIsAvailable() returned false");
}
self->isRecordingAvailable = _bool;
}
if((ret = self->device->MicrophoneIsAvailable(&_bool))){
if((ret = self->device->MicrophoneIsAvailable(&_bool))) {
AUDIO_OPENSLES_DEBUG_ERROR("MicrophoneIsAvailable() failed with error code =%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
AUDIO_OPENSLES_DEBUG_ERROR("MicrophoneIsAvailable() returned false");
}
else{
if((ret = self->device->InitMicrophone())){
else {
if((ret = self->device->InitMicrophone())) {
AUDIO_OPENSLES_DEBUG_ERROR("InitMicrophone() failed with error code =%d", ret);
}
}
}
if((ret = self->device->SetStereoRecording(((*_producer)->audio.channels == 2)))){
if((ret = self->device->SetStereoRecording(((*_producer)->audio.channels == 2)))) {
AUDIO_OPENSLES_DEBUG_ERROR("SetStereoRecording(%d==2) failed with error code=%d", (*_producer)->audio.channels, ret);
}
int recordingSampleRate = (*_producer)->audio.rate;
if((ret = self->device->SetRecordingSampleRate(recordingSampleRate))){
if((ret = self->device->SetRecordingSampleRate(recordingSampleRate))) {
AUDIO_OPENSLES_DEBUG_ERROR("SetRecordingSampleRate(%d) failed with error code=%d", recordingSampleRate, ret);
}
if((ret = self->device->InitRecording())){
if((ret = self->device->InitRecording())) {
AUDIO_OPENSLES_DEBUG_ERROR("AudioDeviceModule::InitRecording() failed with error code = %d", ret);
goto done;
}
// init output parameters
if((ret = self->device->StereoRecording(&_bool))){
if((ret = self->device->StereoRecording(&_bool))) {
AUDIO_OPENSLES_DEBUG_ERROR("StereoRecording() failed with error code=%d", ret);
}
else{
else {
(*_producer)->audio.channels = (_bool ? 2 : 1);
}
if((ret = self->device->RecordingSampleRate(&recordingSampleRate))){
if((ret = self->device->RecordingSampleRate(&recordingSampleRate))) {
AUDIO_OPENSLES_DEBUG_ERROR("RecordingSampleRate() failed with error code=%d", ret);
}
else{
else {
(*_producer)->audio.rate = recordingSampleRate;
}
@ -405,25 +398,25 @@ done:
int audio_opensles_instance_start_consumer(audio_opensles_instance_handle_t* _self)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device || !self->callback){
if(!self || !self->device || !self->callback) {
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isConsumerPrepared){
if(!self->isConsumerPrepared) {
AUDIO_OPENSLES_DEBUG_ERROR("Consumer not prepared");
goto done;
}
if(self->isConsumerStarted){
if(self->isConsumerStarted) {
AUDIO_OPENSLES_DEBUG_WARN("Consumer already started");
goto done;
}
if(self->isPlayoutAvailable){
if(self->isPlayoutAvailable) {
int ret;
if((ret = self->device->StartPlayout())){
if((ret = self->device->StartPlayout())) {
AUDIO_OPENSLES_DEBUG_ERROR("StartPlayout() failed with error code = %d", ret);
}
@ -439,25 +432,25 @@ done:
int audio_opensles_instance_start_producer(audio_opensles_instance_handle_t* _self)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device || !self->callback){
if(!self || !self->device || !self->callback) {
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isProducerPrepared){
if(!self->isProducerPrepared) {
AUDIO_OPENSLES_DEBUG_ERROR("Producer not prepared");
goto done;
}
if(self->isProducerStarted){
if(self->isProducerStarted) {
AUDIO_OPENSLES_DEBUG_WARN("Consumer already started");
goto done;
}
if(self->isRecordingAvailable){
if(self->isRecordingAvailable) {
int ret;
if((ret = self->device->StartRecording())){
if((ret = self->device->StartRecording())) {
AUDIO_OPENSLES_DEBUG_ERROR("StartRecording() failed with error code = %d", ret);
}
@ -473,22 +466,22 @@ done:
int audio_opensles_instance_stop_consumer(audio_opensles_instance_handle_t* _self)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device || !self->callback){
if(!self || !self->device || !self->callback) {
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isConsumerStarted){
if(!self->isConsumerStarted) {
goto done;
}
int ret;
if((ret = self->device->StopPlayout())){
if((ret = self->device->StopPlayout())) {
AUDIO_OPENSLES_DEBUG_ERROR("StopPlayout() failed with error code = %d", ret);
}
else{
else {
self->isConsumerStarted = self->device->Playing();
self->isConsumerPrepared = false;
}
@ -501,22 +494,22 @@ done:
int audio_opensles_instance_stop_producer(audio_opensles_instance_handle_t* _self)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device || !self->callback){
if(!self || !self->device || !self->callback) {
AUDIO_OPENSLES_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isProducerStarted){
if(!self->isProducerStarted) {
goto done;
}
int ret;
if((ret = self->device->StopRecording())){
if((ret = self->device->StopRecording())) {
AUDIO_OPENSLES_DEBUG_ERROR("StopRecording() failed with error code = %d", ret);
}
else{
else {
self->isProducerStarted = self->device->Recording();
self->isProducerPrepared = false;
}
@ -529,7 +522,7 @@ done:
int audio_opensles_instance_set_speakerOn(audio_opensles_instance_handle_t* _self, bool speakerOn)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device ){
if(!self || !self->device ) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -539,20 +532,21 @@ int audio_opensles_instance_set_speakerOn(audio_opensles_instance_handle_t* _sel
int audio_opensles_instance_set_microphone_volume(audio_opensles_instance_handle_t* _self, int32_t volume)
{
audio_opensles_instance_t* self = (audio_opensles_instance_t*)_self;
if(!self || !self->device ){
if(!self || !self->device ) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
return self->device->SetMicrophoneVolume(volume);
}
int audio_opensles_instance_destroy(audio_opensles_instance_handle_t** _self){
if(!_self || !*_self){
int audio_opensles_instance_destroy(audio_opensles_instance_handle_t** _self)
{
if(!_self || !*_self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
tsk_list_lock(__audioInstances);
if(tsk_object_get_refcount(*_self)==1){
if(tsk_object_get_refcount(*_self)==1) {
tsk_list_remove_item_by_data(__audioInstances, *_self);
}
else {

View File

@ -94,7 +94,7 @@
#endif
#if HAVE_CONFIG_H
#include "../config.h"
#include "../config.h"
#endif
#if AUDIO_OPENSLES_UNDER_ANDROID

View File

@ -25,12 +25,11 @@
#include "tsk_memory.h"
#include "tsk_debug.h"
typedef struct audio_consumer_opensles_s
{
typedef struct audio_consumer_opensles_s {
TDAV_DECLARE_CONSUMER_AUDIO;
audio_opensles_instance_handle_t* audioInstHandle;
bool isSpeakerOn;
struct{
struct {
void* ptr;
bool isFull;
int size;
@ -42,27 +41,27 @@ audio_consumer_opensles_t;
int audio_consumer_opensles_get_data_10ms(const audio_consumer_opensles_t* _self, void* audioSamples, int nSamples, int nBytesPerSample, int nChannels, int samplesPerSec, uint32_t &nSamplesOut)
{
nSamplesOut = 0;
if(!_self || !audioSamples || !nSamples){
if(!_self || !audioSamples || !nSamples) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
if((nSamples != (samplesPerSec / 100))){
if((nSamples != (samplesPerSec / 100))) {
AUDIO_OPENSLES_DEBUG_ERROR("Not producing 10ms samples (nSamples=%d, samplesPerSec=%d)", nSamples, samplesPerSec);
return -2;
}
if((nBytesPerSample != (TMEDIA_CONSUMER(_self)->audio.bits_per_sample >> 3))){
if((nBytesPerSample != (TMEDIA_CONSUMER(_self)->audio.bits_per_sample >> 3))) {
AUDIO_OPENSLES_DEBUG_ERROR("%d not valid bytes/samples", nBytesPerSample);
return -3;
}
if((nChannels != TMEDIA_CONSUMER(_self)->audio.out.channels)){
if((nChannels != TMEDIA_CONSUMER(_self)->audio.out.channels)) {
AUDIO_OPENSLES_DEBUG_ERROR("Playout - %d not the expected number of channels but should be %d", nChannels, TMEDIA_CONSUMER(_self)->audio.out.channels);
return -4;
}
audio_consumer_opensles_t* self = const_cast<audio_consumer_opensles_t*>(_self);
if(self->buffer.index == self->buffer.size){
if((tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(self), self->buffer.ptr, self->buffer.size)) != self->buffer.size){
if(self->buffer.index == self->buffer.size) {
if((tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(self), self->buffer.ptr, self->buffer.size)) != self->buffer.size) {
nSamplesOut = 0;
self->buffer.index = self->buffer.size;
return 0;
@ -72,7 +71,7 @@ int audio_consumer_opensles_get_data_10ms(const audio_consumer_opensles_t* _self
}
int nSamplesInBits = (nSamples * nBytesPerSample);
if(_self->buffer.index + nSamplesInBits <= _self->buffer.size){
if(_self->buffer.index + nSamplesInBits <= _self->buffer.size) {
memcpy(audioSamples, (((uint8_t*)self->buffer.ptr) + self->buffer.index), nSamplesInBits);
}
self->buffer.index += nSamplesInBits;
@ -84,7 +83,7 @@ int audio_consumer_opensles_get_data_10ms(const audio_consumer_opensles_t* _self
bool audio_consumer_opensles_is_speakerOn(const audio_consumer_opensles_t* self)
{
if(!self){
if(!self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return false;
}
@ -98,16 +97,18 @@ static int audio_consumer_opensles_set(tmedia_consumer_t* _self, const tmedia_pa
audio_consumer_opensles_t* self = (audio_consumer_opensles_t*)_self;
int ret = tdav_consumer_audio_set(TDAV_CONSUMER_AUDIO(self), param);
if(ret == 0){
if(tsk_striequals(param->key, "volume")){
if(ret == 0) {
if(tsk_striequals(param->key, "volume")) {
}
else if(tsk_striequals(param->key, "speaker-on")){
else if(tsk_striequals(param->key, "speaker-on")) {
self->isSpeakerOn = (TSK_TO_INT32((uint8_t*)param->value) != 0);
if(self->audioInstHandle){
if(self->audioInstHandle) {
return audio_opensles_instance_set_speakerOn(self->audioInstHandle, self->isSpeakerOn);
}
else return 0; // will be set when instance is initialized
else {
return 0; // will be set when instance is initialized
}
}
}
@ -117,13 +118,13 @@ static int audio_consumer_opensles_set(tmedia_consumer_t* _self, const tmedia_pa
static int audio_consumer_opensles_prepare(tmedia_consumer_t* _self, const tmedia_codec_t* codec)
{
audio_consumer_opensles_t* self = (audio_consumer_opensles_t*)_self;
if(!self){
if(!self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
// create audio instance
if(!(self->audioInstHandle = audio_opensles_instance_create(TMEDIA_CONSUMER(self)->session_id))){
if(!(self->audioInstHandle = audio_opensles_instance_create(TMEDIA_CONSUMER(self)->session_id))) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create audio instance handle");
return -1;
}
@ -139,10 +140,10 @@ static int audio_consumer_opensles_prepare(tmedia_consumer_t* _self, const tmedi
int ret = audio_opensles_instance_prepare_consumer(self->audioInstHandle, &_self);
// now that the producer is prepared we can initialize internal buffer using device caps
if(ret == 0){
if(ret == 0) {
// allocate buffer
int xsize = ((TMEDIA_CONSUMER(self)->audio.ptime * TMEDIA_CONSUMER(self)->audio.out.rate) / 1000) * (TMEDIA_CONSUMER(self)->audio.bits_per_sample >> 3);
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))){
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to allocate buffer with size = %d", xsize);
self->buffer.size = 0;
return -1;
@ -158,7 +159,7 @@ static int audio_consumer_opensles_prepare(tmedia_consumer_t* _self, const tmedi
static int audio_consumer_opensles_start(tmedia_consumer_t* _self)
{
audio_consumer_opensles_t* self = (audio_consumer_opensles_t*)_self;
if(!self){
if(!self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -169,7 +170,7 @@ static int audio_consumer_opensles_start(tmedia_consumer_t* _self)
static int audio_consumer_opensles_consume(tmedia_consumer_t* _self, const void* data, tsk_size_t data_size, const tsk_object_t* proto_hdr)
{
audio_consumer_opensles_t* self = (audio_consumer_opensles_t*)_self;
if(!self || !data || !data_size){
if(!self || !data || !data_size) {
AUDIO_OPENSLES_DEBUG_ERROR("1Invalid parameter");
return -1;
}
@ -185,7 +186,7 @@ static int audio_consumer_opensles_pause(tmedia_consumer_t* self)
static int audio_consumer_opensles_stop(tmedia_consumer_t* _self)
{
audio_consumer_opensles_t* self = (audio_consumer_opensles_t*)_self;
if(!self){
if(!self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -201,7 +202,7 @@ static int audio_consumer_opensles_stop(tmedia_consumer_t* _self)
static tsk_object_t* audio_consumer_opensles_ctor(tsk_object_t *_self, va_list * app)
{
audio_consumer_opensles_t *self = (audio_consumer_opensles_t *)_self;
if(self){
if(self) {
/* init base */
tdav_consumer_audio_init(TDAV_CONSUMER_AUDIO(self));
/* init self */
@ -213,11 +214,11 @@ static tsk_object_t* audio_consumer_opensles_ctor(tsk_object_t *_self, va_list *
static tsk_object_t* audio_consumer_opensles_dtor(tsk_object_t *_self)
{
audio_consumer_opensles_t *self = (audio_consumer_opensles_t *)_self;
if(self){
if(self) {
/* stop */
audio_consumer_opensles_stop(TMEDIA_CONSUMER(self));
/* deinit self */
if(self->audioInstHandle){
if(self->audioInstHandle) {
audio_opensles_instance_destroy(&self->audioInstHandle);
}
TSK_FREE(self->buffer.ptr);
@ -228,16 +229,14 @@ static tsk_object_t* audio_consumer_opensles_dtor(tsk_object_t *_self)
return self;
}
/* object definition */
static const tsk_object_def_t audio_consumer_opensles_def_s =
{
static const tsk_object_def_t audio_consumer_opensles_def_s = {
sizeof(audio_consumer_opensles_t),
audio_consumer_opensles_ctor,
audio_consumer_opensles_dtor,
tdav_consumer_audio_cmp,
};
/* plugin definition*/
static const tmedia_consumer_plugin_def_t audio_consumer_opensles_plugin_def_s =
{
static const tmedia_consumer_plugin_def_t audio_consumer_opensles_plugin_def_s = {
&audio_consumer_opensles_def_s,
tmedia_audio,

View File

@ -23,61 +23,74 @@
#define CHECK_MICROPHONE_NOT_INITIALIZED() CHECK_FALSE(m_bMicrophoneInitialized, "Microphone initialized")
#if AUDIO_OPENSLES_UNDER_ANDROID
static inline SLuint32 SL_SAMPLING_RATE(int RATE_INT){
switch(RATE_INT){
case 8000: return SL_SAMPLINGRATE_8;
case 11025: return SL_SAMPLINGRATE_11_025;
default:case 16000: return SL_SAMPLINGRATE_16;
case 22050: return SL_SAMPLINGRATE_22_05;
case 24000: return SL_SAMPLINGRATE_24;
case 32000: return SL_SAMPLINGRATE_32;
case 44100: return SL_SAMPLINGRATE_44_1;
case 64000: return SL_SAMPLINGRATE_64;
case 88200: return SL_SAMPLINGRATE_88_2;
case 96000: return SL_SAMPLINGRATE_96;
case 192000: return SL_SAMPLINGRATE_192;
static inline SLuint32 SL_SAMPLING_RATE(int RATE_INT)
{
switch(RATE_INT) {
case 8000:
return SL_SAMPLINGRATE_8;
case 11025:
return SL_SAMPLINGRATE_11_025;
default:
case 16000:
return SL_SAMPLINGRATE_16;
case 22050:
return SL_SAMPLINGRATE_22_05;
case 24000:
return SL_SAMPLINGRATE_24;
case 32000:
return SL_SAMPLINGRATE_32;
case 44100:
return SL_SAMPLINGRATE_44_1;
case 64000:
return SL_SAMPLINGRATE_64;
case 88200:
return SL_SAMPLINGRATE_88_2;
case 96000:
return SL_SAMPLINGRATE_96;
case 192000:
return SL_SAMPLINGRATE_192;
}
}
#endif
SLAudioDevice::SLAudioDevice(const SLAudioDeviceCallback* pCallback):
#if AUDIO_OPENSLES_UNDER_ANDROID
m_slEngineObject(NULL),
m_slPlayer(NULL),
m_slEngine(NULL),
m_slPlayerPlay(NULL),
m_slPlayerSimpleBufferQueue(NULL),
m_slOutputMixObject(NULL),
m_slSpeakerVolume(NULL),
m_slRecorder(NULL),
m_slRecorderRecord(NULL),
m_slAudioIODeviceCapabilities(NULL),
m_slRecorderSimpleBufferQueue(NULL),
m_slMicVolume(NULL),
_playQueueSeq(0),
_recCurrentSeq(0),
_recBufferTotalSize(0),
_recQueueSeq(0),
m_slEngineObject(NULL),
m_slPlayer(NULL),
m_slEngine(NULL),
m_slPlayerPlay(NULL),
m_slPlayerSimpleBufferQueue(NULL),
m_slOutputMixObject(NULL),
m_slSpeakerVolume(NULL),
m_slRecorder(NULL),
m_slRecorderRecord(NULL),
m_slAudioIODeviceCapabilities(NULL),
m_slRecorderSimpleBufferQueue(NULL),
m_slMicVolume(NULL),
_playQueueSeq(0),
_recCurrentSeq(0),
_recBufferTotalSize(0),
_recQueueSeq(0),
#endif
m_nMicDeviceId(0),
m_pCallback(pCallback),
m_bInitialized(false),
m_bSpeakerInitialized(false),
m_bSpeakerOn(false),
m_bPlayoutInitialized(false),
m_bRecordingInitialized(false),
m_bMicrophoneInitialized(false),
m_bStereoPlayout(false),
m_bStereoRecording(false),
m_nPlayoutSampleRate(PLAYOUT_SAMPLE_RATE),
m_nRecordingSampleRate(RECORDING_SAMPLE_RATE),
m_nRecordingBufferSize(RECORDING_BUFFER_SIZE),
m_nPlayoutBufferSize(PLAYOUT_BUFFER_SIZE),
m_bPlaying(false),
m_bRecording(false),
m_nSpeakerVolume(0),
m_nMinSpeakerVolume(0),
m_nMaxSpeakerVolume(0)
m_nMicDeviceId(0),
m_pCallback(pCallback),
m_bInitialized(false),
m_bSpeakerInitialized(false),
m_bSpeakerOn(false),
m_bPlayoutInitialized(false),
m_bRecordingInitialized(false),
m_bMicrophoneInitialized(false),
m_bStereoPlayout(false),
m_bStereoRecording(false),
m_nPlayoutSampleRate(PLAYOUT_SAMPLE_RATE),
m_nRecordingSampleRate(RECORDING_SAMPLE_RATE),
m_nRecordingBufferSize(RECORDING_BUFFER_SIZE),
m_nPlayoutBufferSize(PLAYOUT_BUFFER_SIZE),
m_bPlaying(false),
m_bRecording(false),
m_nSpeakerVolume(0),
m_nMinSpeakerVolume(0),
m_nMaxSpeakerVolume(0)
{
#if AUDIO_OPENSLES_UNDER_ANDROID
memset(_playQueueBuffer, 0, sizeof(_playQueueBuffer));
@ -140,7 +153,7 @@ int SLAudioDevice::SpeakerIsAvailable(bool *pAvailable)
{
CHECK_TRUE(m_bInitialized, "Not initialized");
if(!pAvailable){
if(!pAvailable) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -155,7 +168,7 @@ int SLAudioDevice::InitSpeaker()
CHECK_TRUE(m_bInitialized, "Not initialized");
if(m_bSpeakerInitialized){
if(m_bSpeakerInitialized) {
return 0;
}
@ -195,11 +208,11 @@ int SLAudioDevice::SetSpeakerOn(bool bSpeakerOn)
int ret = 0;
bool oldValue = m_bSpeakerOn;
m_bSpeakerOn = bSpeakerOn; // update value beacause use in PlayoutApplyNewConfig();
if(m_bPlayoutInitialized && (oldValue != bSpeakerOn)){
if(m_bPlayoutInitialized && (oldValue != bSpeakerOn)) {
ret = PlayoutApplyNewConfig();
}
if(ret != 0){
if(ret != 0) {
m_bSpeakerOn = oldValue;
}
@ -211,7 +224,7 @@ int SLAudioDevice::PlayoutIsAvailable(bool *pAvailable)
CHECK_TRUE(m_bInitialized, "Not initialized");
CHECK_PLAYOUT_NOT_INITIALIZED();
if(!pAvailable){
if(!pAvailable) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -233,7 +246,7 @@ int SLAudioDevice::SetPlayoutBuffer(int nPlayoutBufferSize)
CHECK_TRUE(m_bInitialized, "Not initialized");
CHECK_PLAYOUT_NOT_INITIALIZED();
if(PLAYOUT_BUFFER_SIZE != nPlayoutBufferSize){
if(PLAYOUT_BUFFER_SIZE != nPlayoutBufferSize) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -249,14 +262,22 @@ int SLAudioDevice::SetPlayoutSampleRate(int nPlayoutSampleRate)
AUDIO_OPENSLES_DEBUG_INFO("SetPlayoutSampleRate(%d)", nPlayoutSampleRate);
switch(nPlayoutSampleRate){
case 8000: case 11025: case 16000: case 22050: case 24000: case 32000: case 44100: case 64000: case 88200: case 96000: case 192000:
{
switch(nPlayoutSampleRate) {
case 8000:
case 11025:
case 16000:
case 22050:
case 24000:
case 32000:
case 44100:
case 64000:
case 88200:
case 96000:
case 192000: {
m_nPlayoutSampleRate = nPlayoutSampleRate;
return 0;
}
default:
{
default: {
AUDIO_OPENSLES_DEBUG_ERROR("%d not valid sampling rate", nPlayoutSampleRate);
return -1;
}
@ -269,7 +290,7 @@ int SLAudioDevice::InitPlayout()
AUDIO_OPENSLES_DEBUG_INFO("SLAudioDevice::InitPlayout()");
if(m_bPlayoutInitialized){
if(m_bPlayoutInitialized) {
return 0;
}
@ -351,17 +372,17 @@ int SLAudioDevice::InitPlayout()
}
// set stream type
if(!m_bSpeakerOn){ // only set if speaker OFF, otherwise default is ON. "SL_ANDROID_STREAM_MEDIA" doen't look to work on all devices
if(!m_bSpeakerOn) { // only set if speaker OFF, otherwise default is ON. "SL_ANDROID_STREAM_MEDIA" doen't look to work on all devices
static SLAndroidConfigurationItf _playerStreamConfig;
if((slResult = (*m_slPlayer)->GetInterface(m_slPlayer, SL_IID_ANDROIDCONFIGURATION, &_playerStreamConfig)) != SL_RESULT_SUCCESS){
if((slResult = (*m_slPlayer)->GetInterface(m_slPlayer, SL_IID_ANDROIDCONFIGURATION, &_playerStreamConfig)) != SL_RESULT_SUCCESS) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to get player configuration with error code = %d", slResult);
return -1;
}
else{
else {
static SLint32 _playerStreamType = m_bSpeakerOn ? SL_ANDROID_STREAM_MEDIA : SL_ANDROID_STREAM_VOICE;
static SLint32 _playerStreamTypeSize = sizeof(SLint32);
AUDIO_OPENSLES_DEBUG_INFO("_playerStreamType=%d", _playerStreamType);
if((slResult = (*_playerStreamConfig)->SetConfiguration(_playerStreamConfig, SL_ANDROID_KEY_STREAM_TYPE, &_playerStreamType, _playerStreamTypeSize))){
if((slResult = (*_playerStreamConfig)->SetConfiguration(_playerStreamConfig, SL_ANDROID_KEY_STREAM_TYPE, &_playerStreamType, _playerStreamTypeSize))) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to set player stream type with error code = %d", slResult);
return -2;
}
@ -402,7 +423,7 @@ int SLAudioDevice::StereoPlayout(bool *pEnabled)
CHECK_TRUE(m_bInitialized, "Not initialized");
CHECK_PLAYOUT_INITIALIZED();
if(!pEnabled){
if(!pEnabled) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -416,7 +437,7 @@ int SLAudioDevice::PlayoutSampleRate(int *pPlayoutSampleRate)
CHECK_TRUE(m_bInitialized, "Not initialized");
CHECK_PLAYOUT_INITIALIZED();
if(!pPlayoutSampleRate){
if(!pPlayoutSampleRate) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -456,12 +477,12 @@ int SLAudioDevice::StartPlayout()
{
// get data from jitter buffer
noSamplesOut = SLAudioDevice::PullPlayoutData(playBuffer, nSample10ms);
if(noSamplesOut != nSample10ms){
if(noSamplesOut != nSample10ms) {
AUDIO_OPENSLES_DEBUG_WARN("%d not expected as samples output count value", noSamplesOut);
noSamplesOut = nSample10ms;
memset(_playQueueBuffer[_playQueueSeq], 0, (noSamplesOut << BYTES_PER_SAMPLE_LOG2));
}
else{
else {
memcpy(_playQueueBuffer[_playQueueSeq], playBuffer, (noSamplesOut << BYTES_PER_SAMPLE_LOG2));
}
@ -497,7 +518,7 @@ int SLAudioDevice::StopPlayout()
{
AUDIO_OPENSLES_DEBUG_INFO("SLAudioDevice::StopPlayout()");
if(!m_bPlaying){
if(!m_bPlaying) {
return 0;
}
#if AUDIO_OPENSLES_UNDER_ANDROID
@ -536,7 +557,7 @@ int SLAudioDevice::RecordingIsAvailable(bool *pAvailable)
CHECK_TRUE(m_bInitialized, "Device not initialized");
CHECK_RECORDING_NOT_INITIALIZED();
if(!pAvailable){
if(!pAvailable) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -550,7 +571,7 @@ int SLAudioDevice::MicrophoneIsAvailable(bool *pAvailable)
CHECK_TRUE(m_bInitialized, "Device not initialized");
CHECK_RECORDING_NOT_INITIALIZED();
if(!pAvailable){
if(!pAvailable) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -564,7 +585,7 @@ int SLAudioDevice::InitMicrophone()
AUDIO_OPENSLES_DEBUG_INFO("SLAudioDevice::InitMicrophone()");
CHECK_TRUE(m_bInitialized, "Device not initialized");
if(m_bMicrophoneInitialized){
if(m_bMicrophoneInitialized) {
return 0;
}
@ -617,14 +638,22 @@ int SLAudioDevice::SetRecordingSampleRate(int nRecordingSampleRate)
AUDIO_OPENSLES_DEBUG_INFO("SetRecordingSampleRate(%d)", nRecordingSampleRate);
switch(nRecordingSampleRate){
case 8000: case 11025: case 16000: case 22050: case 24000: case 32000: case 44100: case 64000: case 88200: case 96000: case 192000:
{
switch(nRecordingSampleRate) {
case 8000:
case 11025:
case 16000:
case 22050:
case 24000:
case 32000:
case 44100:
case 64000:
case 88200:
case 96000:
case 192000: {
m_nRecordingSampleRate = nRecordingSampleRate;
return 0;
}
default:
{
default: {
AUDIO_OPENSLES_DEBUG_ERROR("%d not valid sampling rate", nRecordingSampleRate);
return -1;
}
@ -754,7 +783,7 @@ int SLAudioDevice::StereoRecording(bool *pEnabled)
CHECK_TRUE(m_bInitialized, "Not initialized");
CHECK_RECORDING_INITIALIZED();
if(!pEnabled){
if(!pEnabled) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -768,7 +797,7 @@ int SLAudioDevice::RecordingSampleRate(int *pRecordingSampleRate)
CHECK_TRUE(m_bInitialized, "Not initialized");
CHECK_RECORDING_INITIALIZED();
if(!pRecordingSampleRate){
if(!pRecordingSampleRate) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -882,24 +911,24 @@ int SLAudioDevice::Terminate()
return 0;
}
if(Recording()){
if(Recording()) {
StopRecording();
}
if(Playing()){
if(Playing()) {
StopPlayout();
}
#if AUDIO_OPENSLES_UNDER_ANDROID
if(m_slPlayer){
if(m_slPlayer) {
(*m_slPlayer)->Destroy(m_slPlayer);
m_slPlayer = NULL;
m_slPlayerPlay = NULL;
m_slPlayerSimpleBufferQueue = NULL;
}
if(m_slRecorder){
if(m_slRecorder) {
(*m_slRecorder)->Destroy(m_slRecorder);
m_slRecorder = NULL;
m_slRecorderRecord = NULL;
@ -907,7 +936,7 @@ int SLAudioDevice::Terminate()
m_slAudioIODeviceCapabilities = NULL;
}
if(m_slOutputMixObject){
if(m_slOutputMixObject) {
(*m_slOutputMixObject)->Destroy(m_slOutputMixObject);
m_slOutputMixObject = NULL;
}
@ -931,24 +960,24 @@ int SLAudioDevice::PlayoutApplyNewConfig()
{
AUDIO_OPENSLES_DEBUG_INFO("SLAudioDevice::PlayoutApplyNewConfig()");
#if AUDIO_OPENSLES_UNDER_ANDROID
if(m_slPlayer){
if(m_slPlayer) {
SLresult slResult;
int ret;
bool wasPlaying = Playing();
if(wasPlaying){
if ((ret = StopPlayout())){
if(wasPlaying) {
if ((ret = StopPlayout())) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to stop playout for reconf");
return ret;
}
if((ret = InitPlayout())){
if((ret = InitPlayout())) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to init() playout after reconf");
return ret;
}
}
if(wasPlaying){
if((ret = StartPlayout())){
if(wasPlaying) {
if((ret = StartPlayout())) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to start() playout after reconf");
return ret;
}
@ -962,12 +991,12 @@ int SLAudioDevice::PlayoutApplyNewConfig()
uint32_t SLAudioDevice::PullPlayoutData(void* pAudioSamples, const uint32_t nSamples)
{
if(!pAudioSamples || !nSamples){
if(!pAudioSamples || !nSamples) {
AUDIO_OPENSLES_DEBUG_ERROR("PullPlayoutData() - Invalid parameter");
return 0;
}
if(!m_pCallback){
if(!m_pCallback) {
memset(pAudioSamples, 0, (nSamples << BYTES_PER_SAMPLE_LOG2));
return nSamples;
}
@ -984,12 +1013,12 @@ uint32_t SLAudioDevice::PullPlayoutData(void* pAudioSamples, const uint32_t nSam
void SLAudioDevice::PushRecordingData(void* pAudioSamples, const uint32_t nSamples)
{
if(!pAudioSamples || !nSamples){
if(!pAudioSamples || !nSamples) {
AUDIO_OPENSLES_DEBUG_ERROR("PushRecordingData() - Invalid parameter");
return;
}
if(m_pCallback){
if(m_pCallback) {
const_cast<SLAudioDeviceCallback*>(m_pCallback)->RecordedDataIsAvailable(pAudioSamples,
nSamples,
BYTES_PER_SAMPLE,
@ -1012,13 +1041,13 @@ void SLAudioDevice::PlayerSimpleBufferQueueCallback(SLAndroidSimpleBufferQueueIt
uint32_t noSamplesOut = This->PullPlayoutData(playBuffer, noSamp10ms);
if (noSamp10ms != noSamplesOut) {
if(noSamplesOut){ // (noSamplesOut==0) -> jitter buffer cannot provide data
if(noSamplesOut) { // (noSamplesOut==0) -> jitter buffer cannot provide data
AUDIO_OPENSLES_DEBUG_ERROR("noSamp10ms (%u) != noSamplesOut (%d)", noSamp10ms, noSamplesOut);
}
noSamplesOut = noSamp10ms;
memset(This->_playQueueBuffer[This->_playQueueSeq], 0, (noSamplesOut << BYTES_PER_SAMPLE_LOG2));
}
else{
else {
memcpy(This->_playQueueBuffer[This->_playQueueSeq], playBuffer, (noSamplesOut << BYTES_PER_SAMPLE_LOG2));
}
@ -1059,8 +1088,7 @@ void SLAudioDevice::RecorderSimpleBufferQueueCallback(SLAndroidSimpleBufferQueue
int16_t insertPos = -1;
unsigned int nCopy = 0; // Number of samples to copy
while (dataPos < noSamp10ms)
{
while (dataPos < noSamp10ms) {
// Loop over all recording buffers or until we find the partially
// full buffer
// First choice is to insert into partially full buffer,
@ -1068,24 +1096,20 @@ void SLAudioDevice::RecorderSimpleBufferQueueCallback(SLAndroidSimpleBufferQueue
bufPos = 0;
insertPos = -1;
nCopy = 0;
while (bufPos < N_REC_BUFFERS)
{
if ((This->_recLength[bufPos] > 0) && (This->_recLength[bufPos] < noSamp10ms))
{
while (bufPos < N_REC_BUFFERS) {
if ((This->_recLength[bufPos] > 0) && (This->_recLength[bufPos] < noSamp10ms)) {
// Found the partially full buffer
insertPos = static_cast<int16_t> (bufPos);
bufPos = N_REC_BUFFERS; // Don't need to search more
}
else if ((-1 == insertPos) && (0 == This->_recLength[bufPos]))
{
else if ((-1 == insertPos) && (0 == This->_recLength[bufPos])) {
// Found an empty buffer
insertPos = static_cast<int16_t> (bufPos);
}
++bufPos;
}
if (insertPos > -1)
{
if (insertPos > -1) {
// We found a non-full buffer, copy data from the buffer queue
// o recBuffer
unsigned int dataToCopy = noSamp10ms - dataPos;
@ -1093,8 +1117,7 @@ void SLAudioDevice::RecorderSimpleBufferQueueCallback(SLAndroidSimpleBufferQueue
unsigned int roomInBuffer = noSamp10ms - currentRecLen;
nCopy = (dataToCopy < roomInBuffer ? dataToCopy : roomInBuffer);
memcpy(&This->_recBuffer[insertPos][currentRecLen], &This->_recQueueBuffer[This->_recQueueSeq][dataPos], nCopy * sizeof(short));
if (0 == currentRecLen)
{
if (0 == currentRecLen) {
_recSeqNumber[insertPos] = This->_recCurrentSeq;
++_recCurrentSeq;
}
@ -1104,8 +1127,7 @@ void SLAudioDevice::RecorderSimpleBufferQueueCallback(SLAndroidSimpleBufferQueue
This->_recLength[insertPos] += nCopy;
dataPos += nCopy;
}
else
{
else {
// Didn't find a non-full buffer
AUDIO_OPENSLES_DEBUG_WARN("Could not insert into recording buffer");
dataPos = noSamp10ms; // Don't try to insert more

View File

@ -21,7 +21,7 @@
#include "audio_opensles_consumer.h"
SLAudioDeviceCallbackImpl::SLAudioDeviceCallbackImpl():
SLAudioDeviceCallback()
SLAudioDeviceCallback()
{
}
@ -35,7 +35,7 @@ int32_t SLAudioDeviceCallbackImpl::RecordedDataIsAvailable(const void* audioSamp
const uint8_t nChannels,
const uint32_t samplesPerSec)
{
if(!m_pProducer){
if(!m_pProducer) {
AUDIO_OPENSLES_DEBUG_WARN("No wrapped producer");
return 0;
}
@ -50,7 +50,7 @@ int32_t SLAudioDeviceCallbackImpl::NeedMorePlayData(const uint32_t nSamples,
void* audioSamples,
uint32_t& nSamplesOut)
{
if(!m_pConsumer){
if(!m_pConsumer) {
AUDIO_OPENSLES_DEBUG_WARN("No wrapped consumer");
return 0;
}

View File

@ -40,8 +40,12 @@ public:
void* audioSamples,
uint32_t& nSamplesOut);
inline void SetConsumer(const struct audio_consumer_opensles_s* pConsumer){ m_pConsumer = pConsumer; }
inline void SetProducer(const struct audio_producer_opensles_s* pProducer){ m_pProducer = pProducer; }
inline void SetConsumer(const struct audio_consumer_opensles_s* pConsumer) {
m_pConsumer = pConsumer;
}
inline void SetProducer(const struct audio_producer_opensles_s* pProducer) {
m_pProducer = pProducer;
}
private:
const struct audio_consumer_opensles_s* m_pConsumer; // mut be const and must not take reference

View File

@ -24,13 +24,12 @@
#include "tsk_memory.h"
#include "tsk_debug.h"
typedef struct audio_producer_opensles_s
{
typedef struct audio_producer_opensles_s {
TDAV_DECLARE_PRODUCER_AUDIO;
bool isMuted;
audio_opensles_instance_handle_t* audioInstHandle;
struct{
struct {
void* ptr;
int size;
int index;
@ -40,44 +39,44 @@ audio_producer_opensles_t;
int audio_producer_opensles_handle_data_10ms(const audio_producer_opensles_t* _self, const void* audioSamples, int nSamples, int nBytesPerSample, int samplesPerSec, int nChannels)
{
if(!_self || !audioSamples || !nSamples){
if(!_self || !audioSamples || !nSamples) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
if(!TMEDIA_PRODUCER(_self)->enc_cb.callback){
if(!TMEDIA_PRODUCER(_self)->enc_cb.callback) {
AUDIO_OPENSLES_DEBUG_WARN("No callback function is registered for the producer");
return 0;
}
if((nSamples != (samplesPerSec / 100))){
if((nSamples != (samplesPerSec / 100))) {
AUDIO_OPENSLES_DEBUG_ERROR("Not producing 10ms samples (nSamples=%d, samplesPerSec=%d)", nSamples, samplesPerSec);
return -2;
}
if((nBytesPerSample != (TMEDIA_PRODUCER(_self)->audio.bits_per_sample >> 3))){
if((nBytesPerSample != (TMEDIA_PRODUCER(_self)->audio.bits_per_sample >> 3))) {
AUDIO_OPENSLES_DEBUG_ERROR("%d not valid bytes/samples", nBytesPerSample);
return -3;
}
if((nChannels != TMEDIA_PRODUCER(_self)->audio.channels)){
if((nChannels != TMEDIA_PRODUCER(_self)->audio.channels)) {
AUDIO_OPENSLES_DEBUG_ERROR("Recording - %d not the expected number of channels but should be %d", nChannels, TMEDIA_PRODUCER(_self)->audio.channels);
return -4;
}
int nSamplesInBits = (nSamples * nBytesPerSample);
if(_self->buffer.index + nSamplesInBits > _self->buffer.size){
if(_self->buffer.index + nSamplesInBits > _self->buffer.size) {
AUDIO_OPENSLES_DEBUG_ERROR("Buffer overflow");
return -5;
}
audio_producer_opensles_t* self = const_cast<audio_producer_opensles_t*>(_self);
if(self->isMuted){
if(self->isMuted) {
memset((((uint8_t*)self->buffer.ptr) + self->buffer.index), 0, nSamplesInBits);
}
else{
else {
memcpy((((uint8_t*)self->buffer.ptr) + self->buffer.index), audioSamples, nSamplesInBits);
}
self->buffer.index += nSamplesInBits;
if(self->buffer.index == self->buffer.size){
if(self->buffer.index == self->buffer.size) {
self->buffer.index = 0;
TMEDIA_PRODUCER(self)->enc_cb.callback(TMEDIA_PRODUCER(self)->enc_cb.callback_data, self->buffer.ptr, self->buffer.size);
}
@ -90,14 +89,14 @@ int audio_producer_opensles_handle_data_10ms(const audio_producer_opensles_t* _s
static int audio_producer_opensles_set(tmedia_producer_t* _self, const tmedia_param_t* param)
{
audio_producer_opensles_t* self = (audio_producer_opensles_t*)_self;
if(param->plugin_type == tmedia_ppt_producer){
if(param->value_type == tmedia_pvt_int32){
if(tsk_striequals(param->key, "mute")){
if(param->plugin_type == tmedia_ppt_producer) {
if(param->value_type == tmedia_pvt_int32) {
if(tsk_striequals(param->key, "mute")) {
self->isMuted = (*((int32_t*)param->value) != 0);
// Mute not supported on android -> send silence when needed
return 0;
}
else if(tsk_striequals(param->key, "volume")){
else if(tsk_striequals(param->key, "volume")) {
return audio_opensles_instance_set_microphone_volume(self->audioInstHandle, *((int32_t*)param->value));
}
}
@ -107,19 +106,19 @@ static int audio_producer_opensles_set(tmedia_producer_t* _self, const tmedia_pa
static int audio_producer_opensles_prepare(tmedia_producer_t* _self, const tmedia_codec_t* codec)
{
audio_producer_opensles_t* self = (audio_producer_opensles_t*)_self;
if(!self || !codec){
if(!self || !codec) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
// create audio instance
if(!(self->audioInstHandle = audio_opensles_instance_create(TMEDIA_PRODUCER(self)->session_id))){
if(!(self->audioInstHandle = audio_opensles_instance_create(TMEDIA_PRODUCER(self)->session_id))) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to create audio instance handle");
return -2;
}
// check that ptime is mutiple of 10
if((codec->plugin->audio.ptime % 10)){
if((codec->plugin->audio.ptime % 10)) {
AUDIO_OPENSLES_DEBUG_ERROR("ptime=%d not multiple of 10", codec->plugin->audio.ptime);
return -3;
}
@ -136,11 +135,11 @@ static int audio_producer_opensles_prepare(tmedia_producer_t* _self, const tmedi
ret = audio_opensles_instance_prepare_producer(self->audioInstHandle, &_self);
// now that the producer is prepared we can initialize internal buffer using device caps
if(ret == 0){
if(ret == 0) {
// allocate buffer
int xsize = ((TMEDIA_PRODUCER(self)->audio.ptime * TMEDIA_PRODUCER(self)->audio.rate) / 1000) * (TMEDIA_PRODUCER(self)->audio.bits_per_sample >> 3);
AUDIO_OPENSLES_DEBUG_INFO("producer buffer xsize = %d", xsize);
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))){
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))) {
AUDIO_OPENSLES_DEBUG_ERROR("Failed to allocate buffer with size = %d", xsize);
self->buffer.size = 0;
return -1;
@ -154,7 +153,7 @@ static int audio_producer_opensles_prepare(tmedia_producer_t* _self, const tmedi
static int audio_producer_opensles_start(tmedia_producer_t* _self)
{
audio_producer_opensles_t* self = (audio_producer_opensles_t*)_self;
if(!self){
if(!self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -171,7 +170,7 @@ static int audio_producer_opensles_pause(tmedia_producer_t* self)
static int audio_producer_opensles_stop(tmedia_producer_t* _self)
{
audio_producer_opensles_t* self = (audio_producer_opensles_t*)_self;
if(!self){
if(!self) {
AUDIO_OPENSLES_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -187,7 +186,7 @@ static int audio_producer_opensles_stop(tmedia_producer_t* _self)
static tsk_object_t* audio_producer_opensles_ctor(tsk_object_t *_self, va_list * app)
{
audio_producer_opensles_t *self = (audio_producer_opensles_t *)_self;
if(self){
if(self) {
/* init base */
tdav_producer_audio_init(TDAV_PRODUCER_AUDIO(self));
/* init self */
@ -199,11 +198,11 @@ static tsk_object_t* audio_producer_opensles_ctor(tsk_object_t *_self, va_list *
static tsk_object_t* audio_producer_opensles_dtor(tsk_object_t *_self)
{
audio_producer_opensles_t *self = (audio_producer_opensles_t *)_self;
if(self){
if(self) {
/* stop */
audio_producer_opensles_stop(TMEDIA_PRODUCER(self));
/* deinit self */
if(self->audioInstHandle){
if(self->audioInstHandle) {
audio_opensles_instance_destroy(&self->audioInstHandle);
}
TSK_FREE(self->buffer.ptr);
@ -215,16 +214,14 @@ static tsk_object_t* audio_producer_opensles_dtor(tsk_object_t *_self)
return self;
}
/* object definition */
static const tsk_object_def_t audio_producer_opensles_def_s =
{
static const tsk_object_def_t audio_producer_opensles_def_s = {
sizeof(audio_producer_opensles_t),
audio_producer_opensles_ctor,
audio_producer_opensles_dtor,
tdav_producer_audio_cmp,
};
/* plugin definition*/
static const tmedia_producer_plugin_def_t audio_producer_opensles_plugin_def_s =
{
static const tmedia_producer_plugin_def_t audio_producer_opensles_plugin_def_s = {
&audio_producer_opensles_def_s,
tmedia_audio,

View File

@ -22,8 +22,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:

View File

@ -43,8 +43,7 @@ extern "C"
}
#endif
typedef enum PLUGIN_INDEX_E
{
typedef enum PLUGIN_INDEX_E {
PLUGIN_INDEX_AUDIO_CONSUMER,
PLUGIN_INDEX_AUDIO_PRODUCER,
PLUGIN_INDEX_COUNT
@ -59,11 +58,12 @@ int __plugin_get_def_count()
tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
{
switch(index){
case PLUGIN_INDEX_AUDIO_CONSUMER: return tsk_plugin_def_type_consumer;
case PLUGIN_INDEX_AUDIO_PRODUCER: return tsk_plugin_def_type_producer;
default:
{
switch(index) {
case PLUGIN_INDEX_AUDIO_CONSUMER:
return tsk_plugin_def_type_consumer;
case PLUGIN_INDEX_AUDIO_PRODUCER:
return tsk_plugin_def_type_producer;
default: {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("No plugin at index %d", index);
return tsk_plugin_def_type_none;
}
@ -72,14 +72,12 @@ tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
{
switch(index){
switch(index) {
case PLUGIN_INDEX_AUDIO_CONSUMER:
case PLUGIN_INDEX_AUDIO_PRODUCER:
{
case PLUGIN_INDEX_AUDIO_PRODUCER: {
return tsk_plugin_def_media_type_audio;
}
default:
{
default: {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("No plugin at index %d", index);
return tsk_plugin_def_media_type_none;
}
@ -88,17 +86,14 @@ tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
{
switch(index){
case PLUGIN_INDEX_AUDIO_CONSUMER:
{
switch(index) {
case PLUGIN_INDEX_AUDIO_CONSUMER: {
return audio_consumer_webrtc_plugin_def_t;
}
case PLUGIN_INDEX_AUDIO_PRODUCER:
{
case PLUGIN_INDEX_AUDIO_PRODUCER: {
return audio_producer_webrtc_plugin_def_t;
}
default:
{
default: {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("No plugin at index %d", index);
return tsk_null;
}
@ -109,8 +104,7 @@ tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
// WebRTC AudioInstance
//
typedef struct audio_webrtc_instance_s
{
typedef struct audio_webrtc_instance_s {
TSK_DECLARE_OBJECT;
uint64_t sessionId;
@ -139,7 +133,7 @@ static audio_webrtc_instances_L_t* __audioInstances = tsk_null;
static tsk_object_t* audio_webrtc_instance_ctor(tsk_object_t * self, va_list * app)
{
audio_webrtc_instance_t* audioInstance = (audio_webrtc_instance_t*)self;
if(audioInstance){
if(audioInstance) {
tsk_safeobj_init(audioInstance);
}
return self;
@ -148,15 +142,15 @@ static tsk_object_t* audio_webrtc_instance_dtor(tsk_object_t * self)
{
DOUBANGO_AUDIO_WEBRTC_DEBUG_INFO("Audio Instance destroyed");
audio_webrtc_instance_t* audioInstance = (audio_webrtc_instance_t*)self;
if(audioInstance){
if(audioInstance) {
tsk_safeobj_lock(audioInstance);
if(audioInstance->device){
if(audioInstance->device) {
audioInstance->device->RegisterAudioCallback(tsk_null);
audioInstance->device->Terminate();
audioInstance->device->Release();//FIXME: must be deleted?
audioInstance->device = tsk_null;
}
if(audioInstance->transport){
if(audioInstance->transport) {
delete audioInstance->transport;
audioInstance->transport = tsk_null;
}
@ -170,8 +164,7 @@ static int audio_webrtc_instance_cmp(const tsk_object_t *_ai1, const tsk_object_
{
return ((int)_ai1 - (int)_ai2);
}
static const tsk_object_def_t audio_webrtc_instance_def_s =
{
static const tsk_object_def_t audio_webrtc_instance_def_s = {
sizeof(audio_webrtc_instance_t),
audio_webrtc_instance_ctor,
audio_webrtc_instance_dtor,
@ -185,7 +178,7 @@ audio_webrtc_instance_handle_t* audio_webrtc_instance_create(uint64_t sessionId)
audio_webrtc_instance_t* audioInstance = tsk_null;
// create list used to hold instances
if(!__audioInstances && !(__audioInstances = tsk_list_create())){
if(!__audioInstances && !(__audioInstances = tsk_list_create())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to create new list");
return tsk_null;
}
@ -195,39 +188,39 @@ audio_webrtc_instance_handle_t* audio_webrtc_instance_create(uint64_t sessionId)
// find the instance from the list
const tsk_list_item_t* item;
tsk_list_foreach(item, __audioInstances){
if(((audio_webrtc_instance_t*)item->data)->sessionId == sessionId){
tsk_list_foreach(item, __audioInstances) {
if(((audio_webrtc_instance_t*)item->data)->sessionId == sessionId) {
audioInstance = (audio_webrtc_instance_t*)tsk_object_ref(item->data);
break;
}
}
if(!audioInstance){
if(!audioInstance) {
audio_webrtc_instance_t* _audioInstance;
if(!(_audioInstance = (audio_webrtc_instance_t*)tsk_object_new(&audio_webrtc_instance_def_s))){
if(!(_audioInstance = (audio_webrtc_instance_t*)tsk_object_new(&audio_webrtc_instance_def_s))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to create new audio instance");
goto done;
}
if(!(_audioInstance->device = AudioDeviceModuleImpl::Create(kAudioDeviceModuleId))){
if(!(_audioInstance->device = AudioDeviceModuleImpl::Create(kAudioDeviceModuleId))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to create audio device");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
}
_audioInstance->device->AddRef();
if(!(_audioInstance->transport = new AudioTransportImpl(_audioInstance->device))){
if(!(_audioInstance->transport = new AudioTransportImpl(_audioInstance->device))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to create audio transport");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
}
if((_audioInstance->device->RegisterAudioCallback(_audioInstance->transport))){
if((_audioInstance->device->RegisterAudioCallback(_audioInstance->transport))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("AudioDeviceModule::RegisterAudioCallback() failed");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
}
if((_audioInstance->device->Init())){
if((_audioInstance->device->Init())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("AudioDeviceModule::Init() failed");
TSK_OBJECT_SAFE_FREE(_audioInstance);
goto done;
@ -248,12 +241,12 @@ done:
int audio_webrtc_instance_prepare_consumer(audio_webrtc_instance_handle_t* _self, tmedia_consumer_t** _consumer)
{
audio_webrtc_instance_t* self = (audio_webrtc_instance_t*)_self;
if(!self || !self->device || !self->transport || !_consumer || !*_consumer){
if(!self || !self->device || !self->transport || !_consumer || !*_consumer) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("invalid parameter");
return -1;
}
if(self->isConsumerPrepared){
if(self->isConsumerPrepared) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_WARN("Consumer already prepared");
return 0;
}
@ -265,35 +258,35 @@ int audio_webrtc_instance_prepare_consumer(audio_webrtc_instance_handle_t* _self
self->transport->SetConsumer((const struct audio_consumer_webrtc_s*)*_consumer);
if((ret = self->device->SetPlayoutDevice(DOUBANGO_AUDIO_WEBRTC_DEVICE_DEFAULT))){
if((ret = self->device->SetPlayoutDevice(DOUBANGO_AUDIO_WEBRTC_DEVICE_DEFAULT))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("AudioDeviceModule->SetPlayoutDevice(%d) failed", DOUBANGO_AUDIO_WEBRTC_DEVICE_DEFAULT);
}
if((ret = self->device->SpeakerIsAvailable(&_bool))){
if((ret = self->device->SpeakerIsAvailable(&_bool))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SpeakerIsAvailable() failed with error code=%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SpeakerIsAvailable() returned false");
}
self->isSpeakerAvailable = _bool;
}
if((ret = self->device->InitSpeaker())){
if((ret = self->device->InitSpeaker())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("InitSpeaker() failed with error code=%d", ret);
}
if((ret = self->device->PlayoutIsAvailable(&_bool))){
if((ret = self->device->PlayoutIsAvailable(&_bool))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("PlayoutIsAvailable() failed with error code =%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("PlayoutIsAvailable() returned false");
}
self->isPlayoutAvailable = _bool;
}
if((ret = self->device->SetStereoPlayout(((*_consumer)->audio.in.channels == 2)))){
if((ret = self->device->SetStereoPlayout(((*_consumer)->audio.in.channels == 2)))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SetStereoPlayout(%d==2) failed with error code=%d", (*_consumer)->audio.in.channels, ret);
}
@ -301,31 +294,31 @@ int audio_webrtc_instance_prepare_consumer(audio_webrtc_instance_handle_t* _self
// DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SetPlayoutBuffer(%d ms) failed with error code=%d", (*_consumer)->audio.ptime, ret);
//}
// always request 10ms buffers. In all cases WebRTC don't support anything else
if((ret = self->device->SetPlayoutBuffer(AudioDeviceModule::kFixedBufferSize, 10))){
if((ret = self->device->SetPlayoutBuffer(AudioDeviceModule::kFixedBufferSize, 10))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SetPlayoutBuffer(%d ms) failed with error code=%d", 10, ret);
}
uint32_t playoutSampleRate = (*_consumer)->audio.out.rate ? (*_consumer)->audio.out.rate : (*_consumer)->audio.in.rate;
if((ret = self->device->SetPlayoutSampleRate(playoutSampleRate))){
if((ret = self->device->SetPlayoutSampleRate(playoutSampleRate))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SetPlayoutSampleRate(%d) failed with error code=%d", playoutSampleRate, ret);
}
if((ret = self->device->InitPlayout())){
if((ret = self->device->InitPlayout())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("AudioDeviceModule::InitPlayout() failed with error code = %d", ret);
goto done;
}
// init output parameters
if((ret = self->device->StereoPlayout(&_bool))){
if((ret = self->device->StereoPlayout(&_bool))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("StereoPlayout() failed with error code=%d", ret);
}
else{
else {
(*_consumer)->audio.out.channels = (_bool ? 2 : 1);
}
if((ret = self->device->PlayoutSampleRate(&playoutSampleRate))){
if((ret = self->device->PlayoutSampleRate(&playoutSampleRate))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("PlayoutSampleRate() failed with error code=%d", ret);
}
else{
else {
(*_consumer)->audio.out.rate = playoutSampleRate;
}
@ -340,12 +333,12 @@ done:
int audio_webrtc_instance_prepare_producer(audio_webrtc_instance_handle_t* _self, tmedia_producer_t** _producer)
{
audio_webrtc_instance_t* self = (audio_webrtc_instance_t*)_self;
if(!self || !self->device || !self->transport || !_producer || !*_producer){
if(!self || !self->device || !self->transport || !_producer || !*_producer) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("invalid parameter");
return -1;
}
if(self->isProducerPrepared){
if(self->isProducerPrepared) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_WARN("Producer already prepared");
return 0;
}
@ -357,59 +350,59 @@ int audio_webrtc_instance_prepare_producer(audio_webrtc_instance_handle_t* _self
self->transport->SetProducer((const struct audio_producer_webrtc_s*)*_producer);
if((ret = self->device->SetRecordingDevice(DOUBANGO_AUDIO_WEBRTC_DEVICE_DEFAULT))){
if((ret = self->device->SetRecordingDevice(DOUBANGO_AUDIO_WEBRTC_DEVICE_DEFAULT))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("AudioDeviceModule->SetRecordingDevice(%d) failed", DOUBANGO_AUDIO_WEBRTC_DEVICE_DEFAULT);
}
if((ret = self->device->RecordingIsAvailable(&_bool))){
if((ret = self->device->RecordingIsAvailable(&_bool))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("RecordingIsAvailable() failed with error code =%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("RecordingIsAvailable() returned false");
}
self->isRecordingAvailable = _bool;
}
if((ret = self->device->MicrophoneIsAvailable(&_bool))){
if((ret = self->device->MicrophoneIsAvailable(&_bool))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("MicrophoneIsAvailable() failed with error code =%d", ret);
}
else{
if(!_bool){
else {
if(!_bool) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("MicrophoneIsAvailable() returned false");
}
else{
if((ret = self->device->InitMicrophone())){
else {
if((ret = self->device->InitMicrophone())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("InitMicrophone() failed with error code =%d", ret);
}
}
}
if((ret = self->device->SetStereoRecording(((*_producer)->audio.channels == 2)))){
if((ret = self->device->SetStereoRecording(((*_producer)->audio.channels == 2)))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SetStereoRecording(%d==2) failed with error code=%d", (*_producer)->audio.channels, ret);
}
uint32_t recordingSampleRate = (*_producer)->audio.rate;
if((ret = self->device->SetRecordingSampleRate(recordingSampleRate))){
if((ret = self->device->SetRecordingSampleRate(recordingSampleRate))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("SetRecordingSampleRate(%d) failed with error code=%d", recordingSampleRate, ret);
}
if((ret = self->device->InitRecording())){
if((ret = self->device->InitRecording())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("AudioDeviceModule::InitRecording() failed with error code = %d", ret);
goto done;
}
// init output parameters
if((ret = self->device->StereoRecording(&_bool))){
if((ret = self->device->StereoRecording(&_bool))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("StereoRecording() failed with error code=%d", ret);
}
else{
else {
(*_producer)->audio.channels = (_bool ? 2 : 1);
}
if((ret = self->device->RecordingSampleRate(&recordingSampleRate))){
if((ret = self->device->RecordingSampleRate(&recordingSampleRate))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("RecordingSampleRate() failed with error code=%d", ret);
}
else{
else {
(*_producer)->audio.rate = recordingSampleRate;
}
@ -424,25 +417,25 @@ done:
int audio_webrtc_instance_start_consumer(audio_webrtc_instance_handle_t* _self)
{
audio_webrtc_instance_t* self = (audio_webrtc_instance_t*)_self;
if(!self || !self->device || !self->transport){
if(!self || !self->device || !self->transport) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isConsumerPrepared){
if(!self->isConsumerPrepared) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Consumer not prepared");
goto done;
}
if(self->isConsumerStarted){
if(self->isConsumerStarted) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_WARN("Consumer already started");
goto done;
}
if(self->isPlayoutAvailable){
if(self->isPlayoutAvailable) {
int ret;
if((ret = self->device->StartPlayout())){
if((ret = self->device->StartPlayout())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("StartPlayout() failed with error code = %d", ret);
}
@ -458,25 +451,25 @@ done:
int audio_webrtc_instance_start_producer(audio_webrtc_instance_handle_t* _self)
{
audio_webrtc_instance_t* self = (audio_webrtc_instance_t*)_self;
if(!self || !self->device || !self->transport){
if(!self || !self->device || !self->transport) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isProducerPrepared){
if(!self->isProducerPrepared) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Producer not prepared");
goto done;
}
if(self->isProducerStarted){
if(self->isProducerStarted) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_WARN("Consumer already started");
goto done;
}
if(self->isRecordingAvailable){
if(self->isRecordingAvailable) {
int ret;
if((ret = self->device->StartRecording())){
if((ret = self->device->StartRecording())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("StartRecording() failed with error code = %d", ret);
}
@ -493,22 +486,22 @@ done:
int audio_webrtc_instance_stop_consumer(audio_webrtc_instance_handle_t* _self)
{
audio_webrtc_instance_t* self = (audio_webrtc_instance_t*)_self;
if(!self || !self->device || !self->transport){
if(!self || !self->device || !self->transport) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isConsumerStarted){
if(!self->isConsumerStarted) {
goto done;
}
int ret;
if((ret = self->device->StopPlayout())){
if((ret = self->device->StopPlayout())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("StopPlayout() failed with error code = %d", ret);
}
else{
else {
self->isConsumerStarted = self->device->Playing();
}
@ -520,22 +513,22 @@ done:
int audio_webrtc_instance_stop_producer(audio_webrtc_instance_handle_t* _self)
{
audio_webrtc_instance_t* self = (audio_webrtc_instance_t*)_self;
if(!self || !self->device || !self->transport){
if(!self || !self->device || !self->transport) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("invalid parameter");
return -1;
}
tsk_safeobj_lock(self);
if(!self->isProducerStarted){
if(!self->isProducerStarted) {
goto done;
}
int ret;
if((ret = self->device->StopRecording())){
if((ret = self->device->StopRecording())) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("StopRecording() failed with error code = %d", ret);
}
else{
else {
self->isProducerStarted = self->device->Recording();
}
@ -544,13 +537,14 @@ done:
return (self->isProducerStarted ? -1 : 0);
}
int audio_webrtc_instance_destroy(audio_webrtc_instance_handle_t** _self){
if(!_self || !*_self){
int audio_webrtc_instance_destroy(audio_webrtc_instance_handle_t** _self)
{
if(!_self || !*_self) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
tsk_list_lock(__audioInstances);
if(tsk_object_get_refcount(*_self)==1){
if(tsk_object_get_refcount(*_self)==1) {
tsk_list_remove_item_by_data(__audioInstances, *_self);
}
else {

View File

@ -96,7 +96,7 @@
#endif
#if HAVE_CONFIG_H
#include "../config.h"
#include "../config.h"
#endif
#if DOUBANGO_AUDIO_WEBRTC_UNDER_WINDOWS
@ -118,12 +118,20 @@ static void DOUBANGO_AUDIO_WEBRTC_DEBUG_ANY(int level, const char* fmt, ...)
va_start(ap, fmt);
tsk_sprintf_2(&message, fmt, &ap);
if(message){
switch(level){
case DEBUG_LEVEL_INFO: __android_log_write(ANDROID_LOG_INFO, ANDROID_DEBUG_TAG, message); break;
case DEBUG_LEVEL_WARN: __android_log_write(ANDROID_LOG_WARN, ANDROID_DEBUG_TAG, message); break;
case DEBUG_LEVEL_ERROR: __android_log_write(ANDROID_LOG_ERROR, ANDROID_DEBUG_TAG, message); break;
case DEBUG_LEVEL_FATAL: __android_log_write(ANDROID_LOG_FATAL, ANDROID_DEBUG_TAG, message); break;
if(message) {
switch(level) {
case DEBUG_LEVEL_INFO:
__android_log_write(ANDROID_LOG_INFO, ANDROID_DEBUG_TAG, message);
break;
case DEBUG_LEVEL_WARN:
__android_log_write(ANDROID_LOG_WARN, ANDROID_DEBUG_TAG, message);
break;
case DEBUG_LEVEL_ERROR:
__android_log_write(ANDROID_LOG_ERROR, ANDROID_DEBUG_TAG, message);
break;
case DEBUG_LEVEL_FATAL:
__android_log_write(ANDROID_LOG_FATAL, ANDROID_DEBUG_TAG, message);
break;
}
TSK_FREE(message);
}

View File

@ -24,11 +24,10 @@
#include "tsk_memory.h"
#include "tsk_debug.h"
typedef struct audio_consumer_webrtc_s
{
typedef struct audio_consumer_webrtc_s {
TDAV_DECLARE_CONSUMER_AUDIO;
audio_webrtc_instance_handle_t* audioInstHandle;
struct{
struct {
void* ptr;
bool isFull;
int size;
@ -40,36 +39,36 @@ audio_consumer_webrtc_t;
int audio_consumer_webrtc_get_data_10ms(const audio_consumer_webrtc_t* _self, void* audioSamples, int nSamples, int nBytesPerSample, int nChannels, int samplesPerSec, uint32_t &nSamplesOut)
{
nSamplesOut = 0;
if(!_self || !audioSamples || !nSamples){
if(!_self || !audioSamples || !nSamples) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
if((nSamples != (samplesPerSec / 100))){
if((nSamples != (samplesPerSec / 100))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Not producing 10ms samples (nSamples=%d, samplesPerSec=%d)", nSamples, samplesPerSec);
return -2;
}
if((nBytesPerSample != (TMEDIA_CONSUMER(_self)->audio.bits_per_sample >> 3))){
if((nBytesPerSample != (TMEDIA_CONSUMER(_self)->audio.bits_per_sample >> 3))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("%d not valid bytes/samples", nBytesPerSample);
return -3;
}
if((nChannels != TMEDIA_CONSUMER(_self)->audio.out.channels)){
if((nChannels != TMEDIA_CONSUMER(_self)->audio.out.channels)) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("%d not the expected number of channels", nChannels);
return -4;
}
audio_consumer_webrtc_t* self = const_cast<audio_consumer_webrtc_t*>(_self);
if(self->buffer.index == self->buffer.size){
if(self->buffer.index == self->buffer.size) {
tdav_consumer_audio_tick(TDAV_CONSUMER_AUDIO(self));
self->buffer.index = 0;
if((tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(self), self->buffer.ptr, self->buffer.size)) != self->buffer.size){
if((tdav_consumer_audio_get(TDAV_CONSUMER_AUDIO(self), self->buffer.ptr, self->buffer.size)) != self->buffer.size) {
nSamplesOut = 0;
return 0;
}
}
int nSamplesInBits = (nSamples * nBytesPerSample);
if(_self->buffer.index + nSamplesInBits <= _self->buffer.size){
if(_self->buffer.index + nSamplesInBits <= _self->buffer.size) {
memcpy(audioSamples, (((uint8_t*)self->buffer.ptr) + self->buffer.index), nSamplesInBits);
}
self->buffer.index += nSamplesInBits;
@ -86,8 +85,8 @@ static int audio_consumer_webrtc_set(tmedia_consumer_t* self, const tmedia_param
audio_consumer_webrtc_t* webrtc = (audio_consumer_webrtc_t*)self;
int ret = tdav_consumer_audio_set(TDAV_CONSUMER_AUDIO(self), param);
if(ret == 0){
if(tsk_striequals(param->key, "volume")){
if(ret == 0) {
if(tsk_striequals(param->key, "volume")) {
}
}
@ -98,13 +97,13 @@ static int audio_consumer_webrtc_set(tmedia_consumer_t* self, const tmedia_param
static int audio_consumer_webrtc_prepare(tmedia_consumer_t* _self, const tmedia_codec_t* codec)
{
audio_consumer_webrtc_t* self = (audio_consumer_webrtc_t*)_self;
if(!self){
if(!self) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
// create audio instance
if(!(self->audioInstHandle = audio_webrtc_instance_create(TMEDIA_CONSUMER(self)->session_id))){
if(!(self->audioInstHandle = audio_webrtc_instance_create(TMEDIA_CONSUMER(self)->session_id))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to create audio instance handle");
return -1;
}
@ -118,10 +117,10 @@ static int audio_consumer_webrtc_prepare(tmedia_consumer_t* _self, const tmedia_
int ret = audio_webrtc_instance_prepare_consumer(self->audioInstHandle, &_self);
// now that the producer is prepared we can initialize internal buffer using device caps
if(ret == 0){
if(ret == 0) {
// allocate buffer
int xsize = ((TMEDIA_CONSUMER(self)->audio.ptime * TMEDIA_CONSUMER(self)->audio.out.rate) / 1000) * (TMEDIA_CONSUMER(self)->audio.bits_per_sample >> 3);
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))){
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to allocate buffer with size = %d", xsize);
self->buffer.size = 0;
return -1;
@ -137,7 +136,7 @@ static int audio_consumer_webrtc_prepare(tmedia_consumer_t* _self, const tmedia_
static int audio_consumer_webrtc_start(tmedia_consumer_t* _self)
{
audio_consumer_webrtc_t* self = (audio_consumer_webrtc_t*)_self;
if(!self){
if(!self) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -149,7 +148,7 @@ static int audio_consumer_webrtc_start(tmedia_consumer_t* _self)
static int audio_consumer_webrtc_consume(tmedia_consumer_t* _self, const void* buffer, tsk_size_t size, const tsk_object_t* proto_hdr)
{
audio_consumer_webrtc_t* self = (audio_consumer_webrtc_t*)_self;
if(!self || !buffer || !size){
if(!self || !buffer || !size) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("1Invalid parameter");
return -1;
}
@ -165,7 +164,7 @@ static int audio_consumer_webrtc_pause(tmedia_consumer_t* self)
static int audio_consumer_webrtc_stop(tmedia_consumer_t* _self)
{
audio_consumer_webrtc_t* self = (audio_consumer_webrtc_t*)_self;
if(!self){
if(!self) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -181,7 +180,7 @@ static int audio_consumer_webrtc_stop(tmedia_consumer_t* _self)
static tsk_object_t* audio_consumer_webrtc_ctor(tsk_object_t *_self, va_list * app)
{
audio_consumer_webrtc_t *self = (audio_consumer_webrtc_t *)_self;
if(self){
if(self) {
/* init base */
tdav_consumer_audio_init(TDAV_CONSUMER_AUDIO(self));
/* init self */
@ -193,11 +192,11 @@ static tsk_object_t* audio_consumer_webrtc_ctor(tsk_object_t *_self, va_list * a
static tsk_object_t* audio_consumer_webrtc_dtor(tsk_object_t *_self)
{
audio_consumer_webrtc_t *self = (audio_consumer_webrtc_t *)_self;
if(self){
if(self) {
/* stop */
audio_consumer_webrtc_stop(TMEDIA_CONSUMER(self));
/* deinit self */
if(self->audioInstHandle){
if(self->audioInstHandle) {
audio_webrtc_instance_destroy(&self->audioInstHandle);
}
TSK_FREE(self->buffer.ptr);
@ -208,16 +207,14 @@ static tsk_object_t* audio_consumer_webrtc_dtor(tsk_object_t *_self)
return self;
}
/* object definition */
static const tsk_object_def_t audio_consumer_webrtc_def_s =
{
static const tsk_object_def_t audio_consumer_webrtc_def_s = {
sizeof(audio_consumer_webrtc_t),
audio_consumer_webrtc_ctor,
audio_consumer_webrtc_dtor,
tdav_consumer_audio_cmp,
};
/* plugin definition*/
static const tmedia_consumer_plugin_def_t audio_consumer_webrtc_plugin_def_s =
{
static const tmedia_consumer_plugin_def_t audio_consumer_webrtc_plugin_def_s = {
&audio_consumer_webrtc_def_s,
tmedia_audio,

View File

@ -24,13 +24,12 @@
#include "tsk_memory.h"
#include "tsk_debug.h"
typedef struct audio_producer_webrtc_s
{
typedef struct audio_producer_webrtc_s {
TDAV_DECLARE_PRODUCER_AUDIO;
bool isMuted;
audio_webrtc_instance_handle_t* audioInstHandle;
struct{
struct {
void* ptr;
int size;
int index;
@ -40,25 +39,25 @@ audio_producer_webrtc_t;
int audio_producer_webrtc_handle_data_10ms(const audio_producer_webrtc_t* _self, const void* audioSamples, int nSamples, int nBytesPerSample, int samplesPerSec, int nChannels)
{
if(!_self || !audioSamples || !nSamples){
if(!_self || !audioSamples || !nSamples) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
if((nSamples != (samplesPerSec / 100))){
if((nSamples != (samplesPerSec / 100))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Not producing 10ms samples (nSamples=%d, samplesPerSec=%d)", nSamples, samplesPerSec);
return -2;
}
if((nBytesPerSample != (TMEDIA_PRODUCER(_self)->audio.bits_per_sample >> 3))){
if((nBytesPerSample != (TMEDIA_PRODUCER(_self)->audio.bits_per_sample >> 3))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("%d not valid bytes/samples", nBytesPerSample);
return -3;
}
if((nChannels != TMEDIA_PRODUCER(_self)->audio.channels)){
if((nChannels != TMEDIA_PRODUCER(_self)->audio.channels)) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("%d not the expected number of channels", nChannels);
return -4;
}
int nSamplesInBits = (nSamples * nBytesPerSample);
if(_self->buffer.index + nSamplesInBits > _self->buffer.size){
if(_self->buffer.index + nSamplesInBits > _self->buffer.size) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Buffer overflow");
return -5;
}
@ -68,10 +67,10 @@ int audio_producer_webrtc_handle_data_10ms(const audio_producer_webrtc_t* _self,
memcpy((((uint8_t*)self->buffer.ptr) + self->buffer.index), audioSamples, nSamplesInBits);
self->buffer.index += nSamplesInBits;
if(self->buffer.index == self->buffer.size){
if(self->buffer.index == self->buffer.size) {
self->buffer.index = 0;
if(TMEDIA_PRODUCER(self)->enc_cb.callback){
if(self->isMuted){
if(TMEDIA_PRODUCER(self)->enc_cb.callback) {
if(self->isMuted) {
memset(self->buffer.ptr, 0, self->buffer.size);
}
TMEDIA_PRODUCER(self)->enc_cb.callback(TMEDIA_PRODUCER(self)->enc_cb.callback_data, self->buffer.ptr, self->buffer.size);
@ -86,9 +85,9 @@ int audio_producer_webrtc_handle_data_10ms(const audio_producer_webrtc_t* _self,
static int audio_producer_webrtc_set(tmedia_producer_t* _self, const tmedia_param_t* param)
{
audio_producer_webrtc_t* self = (audio_producer_webrtc_t*)_self;
if(param->plugin_type == tmedia_ppt_producer){
if(param->value_type == tmedia_pvt_int32){
if(tsk_striequals(param->key, "mute")){
if(param->plugin_type == tmedia_ppt_producer) {
if(param->value_type == tmedia_pvt_int32) {
if(tsk_striequals(param->key, "mute")) {
self->isMuted = (TSK_TO_INT32((uint8_t*)param->value) != 0);
return 0;
}
@ -99,19 +98,19 @@ static int audio_producer_webrtc_set(tmedia_producer_t* _self, const tmedia_para
static int audio_producer_webrtc_prepare(tmedia_producer_t* _self, const tmedia_codec_t* codec)
{
audio_producer_webrtc_t* self = (audio_producer_webrtc_t*)_self;
if(!self || !codec){
if(!self || !codec) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
// create audio instance
if(!(self->audioInstHandle = audio_webrtc_instance_create(TMEDIA_PRODUCER(self)->session_id))){
if(!(self->audioInstHandle = audio_webrtc_instance_create(TMEDIA_PRODUCER(self)->session_id))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to create audio instance handle");
return -2;
}
// check that ptime is mutiple of 10
if((codec->plugin->audio.ptime % 10)){
if((codec->plugin->audio.ptime % 10)) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("ptime=%d not multiple of 10", codec->plugin->audio.ptime);
return -3;
}
@ -126,10 +125,10 @@ static int audio_producer_webrtc_prepare(tmedia_producer_t* _self, const tmedia_
ret = audio_webrtc_instance_prepare_producer(self->audioInstHandle, &_self);
// now that the producer is prepared we can initialize internal buffer using device caps
if(ret == 0){
if(ret == 0) {
// allocate buffer
int xsize = ((TMEDIA_PRODUCER(self)->audio.ptime * TMEDIA_PRODUCER(self)->audio.rate) / 1000) * (TMEDIA_PRODUCER(self)->audio.bits_per_sample >> 3);
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))){
if(!(self->buffer.ptr = tsk_realloc(self->buffer.ptr, xsize))) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Failed to allocate buffer with size = %d", xsize);
self->buffer.size = 0;
return -1;
@ -143,7 +142,7 @@ static int audio_producer_webrtc_prepare(tmedia_producer_t* _self, const tmedia_
static int audio_producer_webrtc_start(tmedia_producer_t* _self)
{
audio_producer_webrtc_t* self = (audio_producer_webrtc_t*)_self;
if(!self){
if(!self) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -159,7 +158,7 @@ static int audio_producer_webrtc_pause(tmedia_producer_t* self)
static int audio_producer_webrtc_stop(tmedia_producer_t* _self)
{
audio_producer_webrtc_t* self = (audio_producer_webrtc_t*)_self;
if(!self){
if(!self) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("Invalid parameter");
return -1;
}
@ -175,7 +174,7 @@ static int audio_producer_webrtc_stop(tmedia_producer_t* _self)
static tsk_object_t* audio_producer_webrtc_ctor(tsk_object_t *_self, va_list * app)
{
audio_producer_webrtc_t *self = (audio_producer_webrtc_t *)_self;
if(self){
if(self) {
/* init base */
tdav_producer_audio_init(TDAV_PRODUCER_AUDIO(self));
/* init self */
@ -187,11 +186,11 @@ static tsk_object_t* audio_producer_webrtc_ctor(tsk_object_t *_self, va_list * a
static tsk_object_t* audio_producer_webrtc_dtor(tsk_object_t *_self)
{
audio_producer_webrtc_t *self = (audio_producer_webrtc_t *)_self;
if(self){
if(self) {
/* stop */
audio_producer_webrtc_stop(TMEDIA_PRODUCER(self));
/* deinit self */
if(self->audioInstHandle){
if(self->audioInstHandle) {
audio_webrtc_instance_destroy(&self->audioInstHandle);
}
TSK_FREE(self->buffer.ptr);
@ -203,16 +202,14 @@ static tsk_object_t* audio_producer_webrtc_dtor(tsk_object_t *_self)
return self;
}
/* object definition */
static const tsk_object_def_t audio_producer_webrtc_def_s =
{
static const tsk_object_def_t audio_producer_webrtc_def_s = {
sizeof(audio_producer_webrtc_t),
audio_producer_webrtc_ctor,
audio_producer_webrtc_dtor,
tdav_producer_audio_cmp,
};
/* plugin definition*/
static const tmedia_producer_plugin_def_t audio_producer_webrtc_plugin_def_s =
{
static const tmedia_producer_plugin_def_t audio_producer_webrtc_plugin_def_s = {
&audio_producer_webrtc_def_s,
tmedia_audio,

View File

@ -60,7 +60,7 @@ WebRtc_Word32 AudioTransportImpl::RecordedDataIsAvailable(
const WebRtc_UWord32 currentMicLevel,
WebRtc_UWord32& newMicLevel)
{
if(!_producer){
if(!_producer) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("No wrapped producer");
return 0;
}
@ -76,7 +76,7 @@ WebRtc_Word32 AudioTransportImpl::NeedMorePlayData(
void* audioSamples,
WebRtc_UWord32& nSamplesOut)
{
if(!_consumer){
if(!_consumer) {
DOUBANGO_AUDIO_WEBRTC_DEBUG_ERROR("No wrapped consumer");
return 0;
}

View File

@ -48,50 +48,41 @@ public:
public:
void SetFullDuplex(bool enable);
void SetSpeakerVolume(bool enable)
{
void SetSpeakerVolume(bool enable) {
_speakerVolume = enable;
}
;
void SetSpeakerMute(bool enable)
{
void SetSpeakerMute(bool enable) {
_speakerMute = enable;
}
;
void SetMicrophoneMute(bool enable)
{
void SetMicrophoneMute(bool enable) {
_microphoneMute = enable;
}
;
void SetMicrophoneVolume(bool enable)
{
void SetMicrophoneVolume(bool enable) {
_microphoneVolume = enable;
}
;
void SetMicrophoneBoost(bool enable)
{
void SetMicrophoneBoost(bool enable) {
_microphoneBoost = enable;
}
;
void SetLoopbackMeasurements(bool enable)
{
void SetLoopbackMeasurements(bool enable) {
_loopBackMeasurements = enable;
}
;
void SetMicrophoneAGC(bool enable)
{
void SetMicrophoneAGC(bool enable) {
_microphoneAGC = enable;
}
;
void SetConsumer(const struct audio_consumer_webrtc_s* consumer)
{
void SetConsumer(const struct audio_consumer_webrtc_s* consumer) {
_consumer = consumer;
}
;
void SetProducer(const struct audio_producer_webrtc_s* producer)
{
void SetProducer(const struct audio_producer_webrtc_s* producer) {
_producer = producer;
}
;

View File

@ -26,8 +26,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:

View File

@ -56,8 +56,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
@ -71,8 +70,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
}
typedef enum PLUGIN_INDEX_E
{
typedef enum PLUGIN_INDEX_E {
#if PLUGIN_CUDA_H264_ENABLE
PLUGIN_INDEX_CODEC_H264_MAIN,
PLUGIN_INDEX_CODEC_H264_BASE,
@ -91,10 +89,9 @@ int __plugin_get_def_count()
tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
{
#if PLUGIN_CUDA_H264_ENABLE
switch(index){
switch(index) {
case PLUGIN_INDEX_CODEC_H264_MAIN:
case PLUGIN_INDEX_CODEC_H264_BASE:
{
case PLUGIN_INDEX_CODEC_H264_BASE: {
return CudaUtils::IsH264Supported() ? tsk_plugin_def_type_codec : tsk_plugin_def_type_none;
}
}
@ -106,10 +103,9 @@ tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
{
#if PLUGIN_CUDA_H264_ENABLE
switch(index){
switch(index) {
case PLUGIN_INDEX_CODEC_H264_MAIN:
case PLUGIN_INDEX_CODEC_H264_BASE:
{
case PLUGIN_INDEX_CODEC_H264_BASE: {
return CudaUtils::IsH264Supported() ? tsk_plugin_def_media_type_video : tsk_plugin_def_media_type_none;
}
}
@ -121,13 +117,11 @@ tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
{
#if PLUGIN_CUDA_H264_ENABLE
switch(index){
case PLUGIN_INDEX_CODEC_H264_MAIN:
{
switch(index) {
case PLUGIN_INDEX_CODEC_H264_MAIN: {
return CudaUtils::IsH264Supported() ? cuda_codec_h264_main_plugin_def_t : tsk_null;
}
case PLUGIN_INDEX_CODEC_H264_BASE:
{
case PLUGIN_INDEX_CODEC_H264_BASE: {
return CudaUtils::IsH264Supported() ? cuda_codec_h264_base_plugin_def_t : tsk_null;
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More