parent
c2639cc8b7
commit
2098974cbd
|
@ -40,7 +40,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\_common;..\..\.;..\..\..\thirdparties\win32\include;..\..\..\tinySAK\src;..\..\..\tinyNET\src;..\..\..\tinyHTTP\include;..\..\..\tinySIP\include"
|
||||
AdditionalIncludeDirectories="..\..\_common;..\..\.;..\..\..\thirdparties\win32\include;..\..\..\tinySAK\src;..\..\..\tinyNET\src;..\..\..\tinyHTTP\include;..\..\..\tinySIP\include;..\..\..\tinyMEDIA\include;..\..\..\tinySDP\include;..\..\..\tinyDAV\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYWRAP_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
@ -61,7 +61,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinySIP.lib $(OutDir)\tinyNET.lib"
|
||||
AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinySIP.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyDAV.lib"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
|
@ -182,6 +182,14 @@
|
|||
RelativePath="..\..\_common\DDebug.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\ProxyConsumer.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\ProxyProducer.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\SafeObject.cxx"
|
||||
>
|
||||
|
@ -232,6 +240,14 @@
|
|||
RelativePath="..\..\_common\DDebug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\ProxyConsumer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\ProxyProducer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\SafeObject.h"
|
||||
>
|
||||
|
@ -260,6 +276,10 @@
|
|||
RelativePath="..\..\_common\SipUri.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\_common\tinyWRAP_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\csharp\tinyWRAP_wrap.h"
|
||||
>
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_codec_h263.h
|
||||
* @brief H.263-1996 and H.263-1998 codec plugins.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYDAV_CODEC_H263_H
|
||||
#define TINYDAV_CODEC_H263_H
|
||||
|
||||
#include "tinydav_config.h"
|
||||
|
||||
#include "tinymedia/tmedia_codec.h"
|
||||
|
||||
TDAV_BEGIN_DECLS
|
||||
|
||||
/** H.263-1996 codec */
|
||||
typedef struct tdav_codec_h263_s
|
||||
{
|
||||
TMEDIA_DECLARE_CODEC_VIDEO;
|
||||
}
|
||||
tdav_codec_h263_t;
|
||||
|
||||
/** H.263-1998 codec */
|
||||
typedef struct tdav_codec_h263p_s
|
||||
{
|
||||
TMEDIA_DECLARE_CODEC_VIDEO;
|
||||
}
|
||||
tdav_codec_h263p_t;
|
||||
|
||||
/** H.263-2000 codec */
|
||||
typedef struct tdav_codec_h263pp_s
|
||||
{
|
||||
TMEDIA_DECLARE_CODEC_VIDEO;
|
||||
}
|
||||
tdav_codec_h263pp_t;
|
||||
|
||||
TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h263_plugin_def_t;
|
||||
TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h263p_plugin_def_t;
|
||||
TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_h263pp_plugin_def_t;
|
||||
|
||||
TDAV_END_DECLS
|
||||
|
||||
#endif /* TINYDAV_CODEC_H263_H */
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_codec_msrp.h
|
||||
* @brief The Message Session Relay Protocol (MSRP) fake codec.
|
||||
* Used for both Message (RFC 4975) and file transfer (RFC 5547).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYDAV_CODEC_MSRP_H
|
||||
#define TINYDAV_CODEC_MSRP_H
|
||||
|
||||
#include "tinydav_config.h"
|
||||
|
||||
#include "tinymedia/tmedia_codec.h"
|
||||
|
||||
TDAV_BEGIN_DECLS
|
||||
|
||||
/** MSRP codec */
|
||||
typedef struct tdav_codec_msrp_s
|
||||
{
|
||||
TMEDIA_DECLARE_CODEC_MSRP;
|
||||
}
|
||||
tdav_codec_msrp_t;
|
||||
|
||||
TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_msrp_plugin_def_t;
|
||||
|
||||
TDAV_END_DECLS
|
||||
|
||||
#endif /* TINYDAV_CODEC_MSRP_H */
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_consumer_msrp.h
|
||||
* @brief The Message Session Relay Protocol (MSRP) consumer.
|
||||
* Used for both Message (RFC 4975) and file transfer (RFC 5547).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYDAV_CONSUMER_MSRP_H
|
||||
#define TINYDAV_CONSUMER_MSRP_H
|
||||
|
||||
#include "tinydav_config.h"
|
||||
|
||||
TDAV_BEGIN_DECLS
|
||||
|
||||
|
||||
#define TDAV_CONSUMER_MSRP(self) ((tdav_consumer_msrp_t*)(self))
|
||||
|
||||
|
||||
typedef struct tdav_consumer_msrp_s
|
||||
{
|
||||
TMEDIA_DECLARE_CONSUMER;
|
||||
}
|
||||
tdav_consumer_msrp_t;
|
||||
|
||||
|
||||
TDAV_END_DECLS
|
||||
|
||||
#endif /* TINYDAV_CONSUMER_MSRP_H */
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_producer_msrp.h
|
||||
* @brief The Message Session Relay Protocol (MSRP) producer.
|
||||
* Used for both Message (RFC 4975) and file transfer (RFC 5547).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYDAV_PRODUCER_MSRP_H
|
||||
#define TINYDAV_PRODUCER_MSRP_H
|
||||
|
||||
#include "tinydav_config.h"
|
||||
|
||||
TDAV_BEGIN_DECLS
|
||||
|
||||
|
||||
TDAV_END_DECLS
|
||||
|
||||
#endif /* TINYDAV_PRODUCER_MSRP_H */
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_session_msrp.h
|
||||
* @brief The Message Session Relay Protocol (MSRP) session.
|
||||
* Used for both Message (RFC 4975) and file transfer (RFC 5547).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#ifndef TINYDAV_SESSION_MSRP_H
|
||||
#define TINYDAV_SESSION_MSRP_H
|
||||
|
||||
#include "tinydav_config.h"
|
||||
|
||||
#include "tinymedia/tmedia_session.h"
|
||||
|
||||
TDAV_BEGIN_DECLS
|
||||
|
||||
// Forward declaration
|
||||
struct trtp_manager_s;
|
||||
struct tdav_consumer_msrp_s;
|
||||
|
||||
typedef struct tdav_session_msrp_s
|
||||
{
|
||||
TMEDIA_DECLARE_SESSION_MSRP;
|
||||
|
||||
tsk_bool_t useIPv6;
|
||||
|
||||
char* local_ip;
|
||||
|
||||
char* remote_ip;
|
||||
uint16_t remote_port;
|
||||
|
||||
struct tmedia_consumer_s* consumer;
|
||||
struct tmedia_producer_s* producer;
|
||||
}
|
||||
tdav_session_msrp_t;
|
||||
|
||||
|
||||
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_msrp_plugin_def_t;
|
||||
|
||||
TDAV_END_DECLS
|
||||
|
||||
#endif /* TINYDAV_SESSION_MSRP_H */
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_session_video.h
|
||||
* @brief Video Session plugin.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYDAV_SESSION_VIDEO_H
|
||||
#define TINYDAV_SESSION_VIDEO_H
|
||||
|
||||
#include "tinydav_config.h"
|
||||
|
||||
#include "tinymedia/tmedia_session.h"
|
||||
|
||||
TDAV_BEGIN_DECLS
|
||||
|
||||
// Forward declaration
|
||||
struct trtp_manager_s;
|
||||
struct tdav_consumer_video_s;
|
||||
|
||||
typedef struct tdav_session_video_s
|
||||
{
|
||||
TMEDIA_DECLARE_SESSION_VIDEO;
|
||||
|
||||
tsk_bool_t useIPv6;
|
||||
|
||||
char* local_ip;
|
||||
|
||||
char* remote_ip;
|
||||
uint16_t remote_port;
|
||||
|
||||
tsk_bool_t rtcp_enabled;
|
||||
|
||||
struct trtp_manager_s* rtp_manager;
|
||||
|
||||
struct tmedia_consumer_s* consumer;
|
||||
struct tmedia_producer_s* producer;
|
||||
}
|
||||
tdav_session_video_t;
|
||||
|
||||
|
||||
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t;
|
||||
|
||||
TDAV_END_DECLS
|
||||
|
||||
#endif /* TINYDAV_SESSION_VIDEO_H */
|
|
@ -151,6 +151,8 @@ static const tmedia_codec_plugin_def_t tdav_codec_g711u_plugin_def_s =
|
|||
/* video */
|
||||
{0},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tdav_codec_g711u_fmtp_encode,
|
||||
tdav_codec_g711u_fmtp_decode,
|
||||
tdav_codec_g711u_fmtp_match,
|
||||
|
@ -293,6 +295,8 @@ static const tmedia_codec_plugin_def_t tdav_codec_g711a_plugin_def_s =
|
|||
/* video */
|
||||
{0},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tdav_codec_g711a_fmtp_encode,
|
||||
tdav_codec_g711a_fmtp_decode,
|
||||
tdav_codec_g711a_fmtp_match,
|
||||
|
|
|
@ -0,0 +1,371 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_codec_h263.c
|
||||
* @brief H.263-1996 and H.263-1998 codec plugins.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinydav/codecs/h263/tdav_codec_h263.h"
|
||||
|
||||
#include "tsk_debug.h"
|
||||
|
||||
/* ============ H.263-1996 Plugin interface ================= */
|
||||
|
||||
//
|
||||
// H.263-1996 object definition
|
||||
//
|
||||
tsk_size_t tdav_codec_h263_open(tmedia_codec_t* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263_close(tmedia_codec_t* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_bool_t tdav_codec_h263_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
|
||||
{
|
||||
/* check whether we can match this fmtp with our local
|
||||
* check size, maxbr, fps ...*/
|
||||
return tsk_true;
|
||||
}
|
||||
|
||||
char* tdav_codec_h263_fmtp_get(const tmedia_codec_t* self)
|
||||
{
|
||||
return tsk_strdup("CIF=2/MaxBR=3840;QCIF=2/MaxBR=1920");
|
||||
}
|
||||
|
||||
int tdav_codec_h263_fmtp_set(tmedia_codec_t* self, const char* fmtp)
|
||||
{
|
||||
TSK_DEBUG_INFO("remote fmtp=%s", fmtp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* constructor */
|
||||
static tsk_object_t* tdav_codec_h263_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tdav_codec_h263_t *h263 = self;
|
||||
if(h263){
|
||||
/* init base: called by tmedia_codec_create() */
|
||||
/* init self */
|
||||
}
|
||||
return self;
|
||||
}
|
||||
/* destructor */
|
||||
static tsk_object_t* tdav_codec_h263_dtor(tsk_object_t * self)
|
||||
{
|
||||
tdav_codec_h263_t *h263 = self;
|
||||
if(h263){
|
||||
/* deinit base */
|
||||
tmedia_codec_video_deinit(h263);
|
||||
/* deinit self */
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
/* object definition */
|
||||
static const tsk_object_def_t tdav_codec_h263_def_s =
|
||||
{
|
||||
sizeof(tdav_codec_h263_t),
|
||||
tdav_codec_h263_ctor,
|
||||
tdav_codec_h263_dtor,
|
||||
tmedia_codec_cmp,
|
||||
};
|
||||
/* plugin definition*/
|
||||
static const tmedia_codec_plugin_def_t tdav_codec_h263_plugin_def_s =
|
||||
{
|
||||
&tdav_codec_h263_def_s,
|
||||
|
||||
tmedia_video,
|
||||
"H263",
|
||||
"H263-1996 codec",
|
||||
TMEDIA_CODEC_FORMAT_H263,
|
||||
tsk_false,
|
||||
90000, // rate
|
||||
|
||||
/* audio */
|
||||
{ 0 },
|
||||
|
||||
/* video */
|
||||
{176, 144},
|
||||
|
||||
tdav_codec_h263_open,
|
||||
tdav_codec_h263_close,
|
||||
tdav_codec_h263_fmtp_encode,
|
||||
tdav_codec_h263_fmtp_decode,
|
||||
tdav_codec_h263_fmtp_match,
|
||||
tdav_codec_h263_fmtp_get,
|
||||
tdav_codec_h263_fmtp_set
|
||||
};
|
||||
const tmedia_codec_plugin_def_t *tdav_codec_h263_plugin_def_t = &tdav_codec_h263_plugin_def_s;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ============ H.263-1998 Plugin interface ================= */
|
||||
|
||||
//
|
||||
// H.263-1998 object definition
|
||||
//
|
||||
|
||||
tsk_size_t tdav_codec_h263p_open(tmedia_codec_t* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263p_close(tmedia_codec_t* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263p_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263p_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_bool_t tdav_codec_h263p_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
|
||||
{
|
||||
/* check whether we can match this fmtp with our local
|
||||
* check size, maxbr, fps ...*/
|
||||
return tsk_true;
|
||||
}
|
||||
|
||||
char* tdav_codec_h263p_fmtp_get(const tmedia_codec_t* self)
|
||||
{
|
||||
return tsk_strdup("CIF=2/MaxBR=3840;QCIF=2/MaxBR=1920");
|
||||
}
|
||||
|
||||
int tdav_codec_h263p_fmtp_set(tmedia_codec_t* self, const char* fmtp)
|
||||
{
|
||||
TSK_DEBUG_INFO("remote fmtp=%s", fmtp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* constructor */
|
||||
static tsk_object_t* tdav_codec_h263p_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tdav_codec_h263p_t *h263p = self;
|
||||
if(h263p){
|
||||
/* init base: called by tmedia_codec_create() */
|
||||
/* init self */
|
||||
}
|
||||
return self;
|
||||
}
|
||||
/* destructor */
|
||||
static tsk_object_t* tdav_codec_h263p_dtor(tsk_object_t * self)
|
||||
{
|
||||
tdav_codec_h263p_t *h263p = self;
|
||||
if(h263p){
|
||||
/* deinit base */
|
||||
tmedia_codec_video_deinit(h263p);
|
||||
/* deinit self */
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
/* object definition */
|
||||
static const tsk_object_def_t tdav_codec_h263p_def_s =
|
||||
{
|
||||
sizeof(tdav_codec_h263p_t),
|
||||
tdav_codec_h263p_ctor,
|
||||
tdav_codec_h263p_dtor,
|
||||
tmedia_codec_cmp,
|
||||
};
|
||||
/* plugin definition*/
|
||||
static const tmedia_codec_plugin_def_t tdav_codec_h263p_plugin_def_s =
|
||||
{
|
||||
&tdav_codec_h263p_def_s,
|
||||
|
||||
tmedia_video,
|
||||
"H263-1998",
|
||||
"H263-1998 codec",
|
||||
TMEDIA_CODEC_FORMAT_H263_1998,
|
||||
tsk_true,
|
||||
90000, // rate
|
||||
|
||||
/* audio */
|
||||
{ 0 },
|
||||
|
||||
/* video */
|
||||
{176, 144},
|
||||
|
||||
tdav_codec_h263p_open,
|
||||
tdav_codec_h263p_close,
|
||||
tdav_codec_h263p_fmtp_encode,
|
||||
tdav_codec_h263p_fmtp_decode,
|
||||
tdav_codec_h263p_fmtp_match,
|
||||
tdav_codec_h263p_fmtp_get,
|
||||
tdav_codec_h263p_fmtp_set
|
||||
};
|
||||
const tmedia_codec_plugin_def_t *tdav_codec_h263p_plugin_def_t = &tdav_codec_h263p_plugin_def_s;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ============ H.263-2000 Plugin interface ================= */
|
||||
|
||||
//
|
||||
// H.263-2000 object definition
|
||||
//
|
||||
|
||||
tsk_size_t tdav_codec_h263pp_open(tmedia_codec_t* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263pp_close(tmedia_codec_t* self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263pp_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_h263pp_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_bool_t tdav_codec_h263pp_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
|
||||
{
|
||||
/* check whether we can match this fmtp with our local
|
||||
* check size, maxbr, fps ...*/
|
||||
return tsk_true;
|
||||
}
|
||||
|
||||
char* tdav_codec_h263pp_fmtp_get(const tmedia_codec_t* self)
|
||||
{
|
||||
return tsk_strdup("CIF=2/MaxBR=3840;QCIF=2/MaxBR=1920");
|
||||
}
|
||||
|
||||
int tdav_codec_h263pp_fmtp_set(tmedia_codec_t* self, const char* fmtp)
|
||||
{
|
||||
TSK_DEBUG_INFO("remote fmtp=%s", fmtp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* constructor */
|
||||
static tsk_object_t* tdav_codec_h263pp_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tdav_codec_h263pp_t *h263pp = self;
|
||||
if(h263pp){
|
||||
/* init base: called by tmedia_codec_create() */
|
||||
/* init self */
|
||||
}
|
||||
return self;
|
||||
}
|
||||
/* destructor */
|
||||
static tsk_object_t* tdav_codec_h263pp_dtor(tsk_object_t * self)
|
||||
{
|
||||
tdav_codec_h263pp_t *h263pp = self;
|
||||
if(h263pp){
|
||||
/* deinit base */
|
||||
tmedia_codec_video_deinit(h263pp);
|
||||
/* deinit self */
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
/* object definition */
|
||||
static const tsk_object_def_t tdav_codec_h263pp_def_s =
|
||||
{
|
||||
sizeof(tdav_codec_h263pp_t),
|
||||
tdav_codec_h263pp_ctor,
|
||||
tdav_codec_h263pp_dtor,
|
||||
tmedia_codec_cmp,
|
||||
};
|
||||
/* plugin definition*/
|
||||
static const tmedia_codec_plugin_def_t tdav_codec_h263pp_plugin_def_s =
|
||||
{
|
||||
&tdav_codec_h263pp_def_s,
|
||||
|
||||
tmedia_video,
|
||||
"H263-2000",
|
||||
"H263-2000 codec",
|
||||
TMEDIA_CODEC_FORMAT_H263_2000,
|
||||
tsk_true,
|
||||
90000, // rate
|
||||
|
||||
/* audio */
|
||||
{ 0 },
|
||||
|
||||
/* video */
|
||||
{176, 144},
|
||||
tdav_codec_h263pp_open,
|
||||
tdav_codec_h263pp_close,
|
||||
tdav_codec_h263pp_fmtp_encode,
|
||||
tdav_codec_h263pp_fmtp_decode,
|
||||
tdav_codec_h263pp_fmtp_match,
|
||||
tdav_codec_h263pp_fmtp_get,
|
||||
tdav_codec_h263pp_fmtp_set
|
||||
};
|
||||
const tmedia_codec_plugin_def_t *tdav_codec_h263pp_plugin_def_t = &tdav_codec_h263pp_plugin_def_s;
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_codec_msrp.c
|
||||
* @brief The Message Session Relay Protocol (MSRP) fake codec.
|
||||
* Used for both Message (RFC 4975) and file transfer (RFC 5547).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinydav/codecs/msrp/tdav_codec_msrp.h"
|
||||
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
/* ============ MSRP Plugin interface ================= */
|
||||
|
||||
#define tdav_codec_msrp_fmtp_get tsk_null
|
||||
#define tdav_codec_msrp_fmtp_set tsk_null
|
||||
|
||||
tsk_size_t tdav_codec_msrp_fmtp_encode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_size_t tdav_codec_msrp_fmtp_decode(tmedia_codec_t* self, const void* in_data, tsk_size_t in_size, void** out_data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
tsk_bool_t tdav_codec_msrp_fmtp_match(const tmedia_codec_t* codec, const char* fmtp)
|
||||
{ /* always match */
|
||||
return tsk_true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MSRP Plugin definition
|
||||
//
|
||||
|
||||
/* constructor */
|
||||
static tsk_object_t* tdav_codec_msrp_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tdav_codec_msrp_t *msrp = self;
|
||||
if(msrp){
|
||||
/* init base: called by tmedia_codec_create() */
|
||||
/* init self */
|
||||
}
|
||||
return self;
|
||||
}
|
||||
/* destructor */
|
||||
static tsk_object_t* tdav_codec_msrp_dtor(tsk_object_t * self)
|
||||
{
|
||||
tdav_codec_msrp_t *msrp = self;
|
||||
if(msrp){
|
||||
/* deinit base */
|
||||
tmedia_codec_msrp_deinit(msrp);
|
||||
/* deinit self */
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
/* object definition */
|
||||
static const tsk_object_def_t tdav_codec_msrp_def_s =
|
||||
{
|
||||
sizeof(tdav_codec_msrp_t),
|
||||
tdav_codec_msrp_ctor,
|
||||
tdav_codec_msrp_dtor,
|
||||
tmedia_codec_cmp,
|
||||
};
|
||||
/* plugin definition*/
|
||||
static const tmedia_codec_plugin_def_t tdav_codec_msrp_plugin_def_s =
|
||||
{
|
||||
&tdav_codec_msrp_def_s,
|
||||
|
||||
tmedia_msrp,
|
||||
"message",
|
||||
"MSRP fake codec",
|
||||
TMEDIA_CODEC_FORMAT_MSRP,
|
||||
tsk_false,
|
||||
0, // rate
|
||||
|
||||
/* audio */
|
||||
{0},
|
||||
|
||||
/* video */
|
||||
{0},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tdav_codec_msrp_fmtp_encode,
|
||||
tdav_codec_msrp_fmtp_decode,
|
||||
tdav_codec_msrp_fmtp_match,
|
||||
tdav_codec_msrp_fmtp_get,
|
||||
tdav_codec_msrp_fmtp_set
|
||||
};
|
||||
const tmedia_codec_plugin_def_t *tdav_codec_msrp_plugin_def_t = &tdav_codec_msrp_plugin_def_s;
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_session_msrp.c
|
||||
* @brief The Message Session Relay Protocol (MSRP) session.
|
||||
* Used for both Message (RFC 4975) and file transfer (RFC 5547).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinydav/msrp/tdav_session_msrp.h"
|
|
@ -31,9 +31,13 @@
|
|||
// Sessions
|
||||
#include "tinymedia/tmedia_session_ghost.h"
|
||||
#include "tinydav/audio/tdav_session_audio.h"
|
||||
#include "tinydav/video/tdav_session_video.h"
|
||||
|
||||
// Codecs
|
||||
#include "tinydav/codecs/msrp/tdav_codec_msrp.h"
|
||||
#include "tinydav/codecs/g711/tdav_codec_g711.h"
|
||||
#include "tinydav/codecs/h263/tdav_codec_h263.h"
|
||||
|
||||
|
||||
// Consumers
|
||||
#include "tinydav/audio/waveapi/tdav_consumer_waveapi.h"
|
||||
|
@ -62,14 +66,20 @@ int tdav_init()
|
|||
/* === Register sessions === */
|
||||
tmedia_session_plugin_register(tmedia_session_ghost_plugin_def_t);
|
||||
tmedia_session_plugin_register(tdav_session_audio_plugin_def_t);
|
||||
tmedia_session_plugin_register(tdav_session_video_plugin_def_t);
|
||||
|
||||
/* === Register codecs === */
|
||||
#if 0
|
||||
avcodec_register_all();
|
||||
#endif
|
||||
|
||||
|
||||
tmedia_codec_plugin_register(tdav_codec_msrp_plugin_def_t);
|
||||
tmedia_codec_plugin_register(tdav_codec_g711a_plugin_def_t);
|
||||
tmedia_codec_plugin_register(tdav_codec_g711u_plugin_def_t);
|
||||
tmedia_codec_plugin_register(tdav_codec_h263_plugin_def_t);
|
||||
tmedia_codec_plugin_register(tdav_codec_h263p_plugin_def_t);
|
||||
tmedia_codec_plugin_register(tdav_codec_h263pp_plugin_def_t);
|
||||
|
||||
|
||||
/* === Register consumers === */
|
||||
#if HAVE_DSOUND_H
|
||||
|
@ -111,12 +121,17 @@ int tdav_init()
|
|||
int tdav_deinit()
|
||||
{
|
||||
/* === UnRegister sessions === */
|
||||
tmedia_session_plugin_register(tmedia_session_ghost_plugin_def_t);
|
||||
tmedia_session_plugin_unregister(tmedia_session_ghost_plugin_def_t);
|
||||
tmedia_session_plugin_unregister(tdav_session_audio_plugin_def_t);
|
||||
tmedia_session_plugin_unregister(tdav_session_video_plugin_def_t);
|
||||
|
||||
/* === UnRegister codecs === */
|
||||
tmedia_codec_plugin_unregister(tdav_codec_msrp_plugin_def_t);
|
||||
tmedia_codec_plugin_unregister(tdav_codec_g711a_plugin_def_t);
|
||||
tmedia_codec_plugin_unregister(tdav_codec_g711u_plugin_def_t);
|
||||
tmedia_codec_plugin_unregister(tdav_codec_h263_plugin_def_t);
|
||||
tmedia_codec_plugin_unregister(tdav_codec_h263p_plugin_def_t);
|
||||
tmedia_codec_plugin_unregister(tdav_codec_h263pp_plugin_def_t);
|
||||
|
||||
/* === unRegister consumers === */
|
||||
#if HAVE_DSOUND_H
|
||||
|
|
|
@ -0,0 +1,464 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tdav_session_video.c
|
||||
* @brief Video Session plugin.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)doubango.org>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinydav/video/tdav_session_video.h"
|
||||
|
||||
#include "tinymedia/tmedia_consumer.h"
|
||||
#include "tinymedia/tmedia_producer.h"
|
||||
|
||||
#include "tinyrtp/trtp_manager.h"
|
||||
#include "tinyrtp/rtp/trtp_rtp_packet.h"
|
||||
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
// RTP/RTCP callback (From the network to the consumer)
|
||||
static int tdav_session_video_rtp_cb(const void* callback_data, const struct trtp_rtp_packet_s* packet)
|
||||
{
|
||||
tdav_session_video_t* video = (tdav_session_video_t*)callback_data;
|
||||
|
||||
if(!video || !packet){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(video->consumer){
|
||||
void* out_data = tsk_null;
|
||||
tsk_size_t out_size = 0;
|
||||
tmedia_codec_t* codec;
|
||||
tsk_istr_t format;
|
||||
|
||||
// Find the codec to use to decode the RTP payload
|
||||
tsk_itoa(packet->header->payload_type, &format);
|
||||
if(!(codec = tmedia_codec_find_by_format(TMEDIA_SESSION(video)->neg_codecs, format)) || !codec->plugin || !codec->plugin->decode){
|
||||
TSK_DEBUG_ERROR("%s is not a valid payload for this session", format);
|
||||
TSK_OBJECT_SAFE_FREE(codec);
|
||||
return -2;
|
||||
}
|
||||
// Decode data
|
||||
out_size = codec->plugin->decode(codec, packet->payload.data, packet->payload.size, &out_data);
|
||||
if(out_size){
|
||||
tmedia_consumer_consume(video->consumer, &out_data, out_size, packet->header);
|
||||
}
|
||||
TSK_FREE(out_data);
|
||||
TSK_OBJECT_SAFE_FREE(codec);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Producer callback (From the producer to the network)
|
||||
static int tdav_session_video_producer_cb(const void* callback_data, const void* buffer, tsk_size_t size)
|
||||
{
|
||||
tdav_session_video_t* video = (tdav_session_video_t*)callback_data;
|
||||
|
||||
if(video->rtp_manager){
|
||||
/* encode */
|
||||
void* out_data = tsk_null;
|
||||
tsk_size_t out_size = 0;
|
||||
tmedia_codec_t* codec = tsk_null;
|
||||
|
||||
// Use first codec to encode data
|
||||
if((codec = tsk_object_ref(TSK_LIST_FIRST_DATA(TMEDIA_SESSION(video)->neg_codecs)))){
|
||||
if(!codec->plugin || !codec->plugin->encode){
|
||||
TSK_OBJECT_SAFE_FREE(codec);
|
||||
TSK_DEBUG_ERROR("Invalid codec");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to find a valid codec");
|
||||
return -3;
|
||||
}
|
||||
|
||||
// Encode data
|
||||
out_size = codec->plugin->encode(codec, buffer, size, &out_data);
|
||||
if(out_size){
|
||||
trtp_manager_send_rtp(video->rtp_manager, out_data, out_size, 160/*FIXME*/, tsk_false);
|
||||
}
|
||||
TSK_FREE(out_data);
|
||||
TSK_OBJECT_SAFE_FREE(codec);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ============ Plugin interface ================= */
|
||||
|
||||
int tmedia_session_video_set(tmedia_session_t* self, const tmedia_param_t* param)
|
||||
{
|
||||
int ret = 0;
|
||||
tdav_session_video_t* video;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
TSK_DEBUG_INFO("tmedia_session_video_set");
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
if(param->value_type == tmedia_pvt_pchar){
|
||||
if(tsk_striequals(param->key, "remote-ip")){
|
||||
/* only if no ip associated to the "m=" line */
|
||||
if(param->value && !video->remote_ip){
|
||||
video->remote_ip = tsk_strdup(param->value);
|
||||
}
|
||||
}
|
||||
else if(tsk_striequals(param->key, "local-ip")){
|
||||
tsk_strupdate(&video->local_ip, param->value);
|
||||
}
|
||||
else if(tsk_striequals(param->key, "local-ipver")){
|
||||
video->useIPv6 = tsk_striequals(param->value, "ipv6");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tdav_session_video_prepare(tmedia_session_t* self)
|
||||
{
|
||||
tdav_session_video_t* video;
|
||||
int ret = 0;
|
||||
|
||||
TSK_DEBUG_INFO("tdav_session_video_prepare");
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
/* set local port */
|
||||
if(!video->rtp_manager){
|
||||
if((video->rtp_manager = trtp_manager_create(video->rtcp_enabled, video->local_ip, video->useIPv6))){
|
||||
|
||||
ret = trtp_manager_set_rtp_callback(video->rtp_manager, tdav_session_video_rtp_cb, video);
|
||||
ret = trtp_manager_prepare(video->rtp_manager);
|
||||
}
|
||||
}
|
||||
|
||||
/* Consumer will be prepared in tdav_session_video_start() */
|
||||
/* Producer will be prepared in tdav_session_video_start() */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tdav_session_video_start(tmedia_session_t* self)
|
||||
{
|
||||
tdav_session_video_t* video;
|
||||
|
||||
TSK_DEBUG_INFO("tdav_session_video_start");
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
if(video->rtp_manager && !TSK_LIST_IS_EMPTY(self->neg_codecs)){
|
||||
int ret;
|
||||
const tmedia_codec_t* codec = (const tmedia_codec_t*)TSK_LIST_FIRST_DATA(self->neg_codecs);
|
||||
/* RTP/RTCP manager: use latest information. */
|
||||
ret = trtp_manager_set_rtp_remote(video->rtp_manager, video->remote_ip, video->remote_port);
|
||||
trtp_manager_set_payload_type(video->rtp_manager, codec->neg_format ? atoi(codec->neg_format) : atoi(codec->format));
|
||||
ret = trtp_manager_start(video->rtp_manager);
|
||||
|
||||
/* Consumer */
|
||||
if(video->consumer){
|
||||
tmedia_consumer_prepare(video->consumer, codec);
|
||||
tmedia_consumer_start(video->consumer);
|
||||
}
|
||||
/* Producer */
|
||||
if(video->producer){
|
||||
tmedia_producer_prepare(video->producer, codec);
|
||||
tmedia_producer_start(video->producer);
|
||||
}
|
||||
|
||||
/* for test */
|
||||
//trtp_manager_send_rtp(video->rtp_manager, "test", 4, tsk_true);
|
||||
return ret;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Invalid RTP/RTCP manager or neg_codecs");
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tdav_session_video_stop(tmedia_session_t* self)
|
||||
{
|
||||
tdav_session_video_t* video;
|
||||
|
||||
TSK_DEBUG_INFO("tdav_session_video_stop");
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
/* RTP/RTCP manager */
|
||||
if(video->rtp_manager){
|
||||
trtp_manager_stop(video->rtp_manager);
|
||||
}
|
||||
|
||||
/* Consumer */
|
||||
if(video->consumer){
|
||||
tmedia_consumer_stop(video->consumer);
|
||||
}
|
||||
/* Producer */
|
||||
if(video->producer){
|
||||
tmedia_producer_stop(video->producer);
|
||||
}
|
||||
|
||||
/* very important */
|
||||
//video->local_port = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tdav_session_video_pause(tmedia_session_t* self)
|
||||
{
|
||||
tdav_session_video_t* video;
|
||||
|
||||
TSK_DEBUG_INFO("tdav_session_video_pause");
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Consumer */
|
||||
if(video->consumer){
|
||||
tmedia_consumer_pause(video->consumer);
|
||||
}
|
||||
/* Producer */
|
||||
if(video->producer){
|
||||
tmedia_producer_pause(video->producer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const tsdp_header_M_t* tdav_session_video_get_lo(tmedia_session_t* self)
|
||||
{
|
||||
tdav_session_video_t* video;
|
||||
tsk_bool_t changed = tsk_false;
|
||||
|
||||
TSK_DEBUG_INFO("tdav_session_video_get_lo");
|
||||
|
||||
if(!self || !self->plugin){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
if(!video->rtp_manager || !video->rtp_manager->transport){
|
||||
TSK_DEBUG_ERROR("RTP/RTCP manager in invalid");
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
if(self->ro_changed && self->M.lo){
|
||||
/* Codecs */
|
||||
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "fmtp");
|
||||
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "rtpmap");
|
||||
tsk_list_clear_items(self->M.lo->FMTs);
|
||||
|
||||
/* QoS */
|
||||
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "curr");
|
||||
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "des");
|
||||
tsdp_header_A_removeAll_by_field(self->M.lo->Attributes, "conf");
|
||||
}
|
||||
|
||||
changed = (self->ro_changed || !self->M.lo);
|
||||
|
||||
if(!self->M.lo){
|
||||
if((self->M.lo = tsdp_header_M_create(self->plugin->media, video->rtp_manager->transport->master->port, "RTP/AVP"))){
|
||||
/* Add common attributes */
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to create lo");
|
||||
return tsk_null;
|
||||
}
|
||||
}
|
||||
|
||||
/* from codecs to sdp */
|
||||
if(changed){
|
||||
tmedia_codecs_L_t* neg_codecs = tsk_null;
|
||||
|
||||
if(self->M.ro){
|
||||
/* update negociated codecs */
|
||||
if((neg_codecs = tmedia_session_match_codec(self, self->M.ro))){
|
||||
TSK_OBJECT_SAFE_FREE(self->neg_codecs);
|
||||
self->neg_codecs = neg_codecs;
|
||||
}
|
||||
}
|
||||
|
||||
/* from codecs to sdp */
|
||||
tmedia_codec_to_sdp(self->neg_codecs ? self->neg_codecs : self->codecs, self->M.lo);
|
||||
/* Hold/Resume */
|
||||
if(self->M.ro){
|
||||
if(tsdp_header_M_is_held(self->M.ro, tsk_false)){
|
||||
tsdp_header_M_hold(self->M.lo, tsk_false);
|
||||
}
|
||||
else{
|
||||
tsdp_header_M_resume(self->M.lo, tsk_false);
|
||||
}
|
||||
}
|
||||
|
||||
/* QoS */
|
||||
if(self->qos){
|
||||
tmedia_qos_tline_t* ro_tline;
|
||||
if(self->M.ro && (ro_tline = tmedia_qos_tline_from_sdp(self->M.ro))){
|
||||
tmedia_qos_tline_set_ro(self->qos, ro_tline);
|
||||
TSK_OBJECT_SAFE_FREE(ro_tline);
|
||||
}
|
||||
tmedia_qos_tline_to_sdp(self->qos, self->M.lo);
|
||||
}
|
||||
}
|
||||
|
||||
return self->M.lo;
|
||||
}
|
||||
|
||||
int tdav_session_video_set_ro(tmedia_session_t* self, const tsdp_header_M_t* m)
|
||||
{
|
||||
tdav_session_video_t* video;
|
||||
tmedia_codecs_L_t* neg_codecs;
|
||||
|
||||
TSK_DEBUG_INFO("tdav_session_video_set_ro");
|
||||
|
||||
if(!self || !m){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
video = (tdav_session_video_t*)self;
|
||||
|
||||
/* update remote offer */
|
||||
TSK_OBJECT_SAFE_FREE(self->M.ro);
|
||||
self->M.ro = tsk_object_ref((void*)m);
|
||||
|
||||
if(self->M.lo){
|
||||
if((neg_codecs = tmedia_session_match_codec(self, m))){
|
||||
/* update negociated codecs */
|
||||
TSK_OBJECT_SAFE_FREE(self->neg_codecs);
|
||||
self->neg_codecs = neg_codecs;
|
||||
}
|
||||
else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* get connection associated to this media line
|
||||
* If the connnection is global, then the manager will call tmedia_session_video_set() */
|
||||
if(m->C && m->C->addr){
|
||||
tsk_strupdate(&video->remote_ip, m->C->addr);
|
||||
video->useIPv6 = tsk_striequals(m->C->addrtype, "IP6");
|
||||
}
|
||||
/* set remote port */
|
||||
video->remote_port = m->port;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Session Video Plugin object definition
|
||||
//
|
||||
/* constructor */
|
||||
static tsk_object_t* tdav_session_video_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tdav_session_video_t *session = self;
|
||||
if(session){
|
||||
/* init base: called by tmedia_session_create() */
|
||||
/* init self */
|
||||
if(!(session->consumer = tmedia_consumer_create(tdav_session_video_plugin_def_t->type))){
|
||||
TSK_DEBUG_ERROR("Failed to create Video consumer");
|
||||
}
|
||||
if((session->producer = tmedia_producer_create(tdav_session_video_plugin_def_t->type))){
|
||||
tmedia_producer_set_callback(session->producer, tdav_session_video_producer_cb, self);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to create Video producer");
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
/* destructor */
|
||||
static tsk_object_t* tdav_session_video_dtor(tsk_object_t * self)
|
||||
{
|
||||
tdav_session_video_t *session = self;
|
||||
if(session){
|
||||
/* deinit base */
|
||||
tmedia_session_deinit(self);
|
||||
/* deinit self */
|
||||
TSK_OBJECT_SAFE_FREE(session->rtp_manager);
|
||||
TSK_OBJECT_SAFE_FREE(session->consumer);
|
||||
TSK_OBJECT_SAFE_FREE(session->producer);
|
||||
TSK_FREE(session->remote_ip);
|
||||
TSK_FREE(session->local_ip);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
/* object definition */
|
||||
static const tsk_object_def_t tdav_session_video_def_s =
|
||||
{
|
||||
sizeof(tdav_session_video_t),
|
||||
tdav_session_video_ctor,
|
||||
tdav_session_video_dtor,
|
||||
tmedia_session_cmp,
|
||||
};
|
||||
/* plugin definition*/
|
||||
static const tmedia_session_plugin_def_t tdav_session_video_plugin_def_s =
|
||||
{
|
||||
&tdav_session_video_def_s,
|
||||
|
||||
tmedia_video,
|
||||
"video",
|
||||
|
||||
tmedia_session_video_set,
|
||||
tdav_session_video_prepare,
|
||||
tdav_session_video_start,
|
||||
tdav_session_video_pause,
|
||||
tdav_session_video_stop,
|
||||
|
||||
|
||||
tdav_session_video_get_lo,
|
||||
tdav_session_video_set_ro
|
||||
};
|
||||
const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t = &tdav_session_video_plugin_def_s;
|
|
@ -47,10 +47,11 @@
|
|||
"a=rtpmap:97 iLBC/8000\r\n" \
|
||||
"a=rtpmap:98 AMR-WB/16000\r\n" \
|
||||
"a=fmtp:98 octet-align=1\r\n" \
|
||||
"m=video 51372 RTP/AVP 31 32 98\r\n" \
|
||||
"m=video 51372 RTP/AVP 34 31 32 98\r\n" \
|
||||
"i=Video line\r\n" \
|
||||
"b=A-YZ:92\r\n" \
|
||||
"b=B-YZ:256\r\n" \
|
||||
"a=rtpmap:34 H263/90000\r\n" \
|
||||
"a=rtpmap:31 H261/90000\r\n" \
|
||||
"a=rtpmap:32 MPV/90000\r\n" \
|
||||
"a=rtpmap:98 H264/90000\r\n" \
|
||||
|
@ -70,7 +71,7 @@ void test_sessions_client()
|
|||
const tsdp_message_t* sdp_lo;
|
||||
tsdp_message_t* sdp_ro;
|
||||
char* temp;
|
||||
tmedia_type_t type = tmedia_audio | tmedia_video | tmedia_msrp | tmedia_t38;
|
||||
tmedia_type_t type = tmedia_all;
|
||||
|
||||
mgr = tmedia_session_mgr_create(type,
|
||||
"0.0.0.0", tsk_false, tsk_true/* offerer */);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%%pwd mamadou
|
||||
%%proxy_ip 192.168.16.104 # IP address or FQDN
|
||||
%%proxy_port 5060
|
||||
%%proxy_trans tcp # udp, tcp, tls or sctp
|
||||
%%proxy_trans udp # udp, tcp, tls or sctp
|
||||
%%expires 100 # expires used by all dialogs
|
||||
%%sleep-sec 1.0 # number of seconds to wait before sending next sip message
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
# --pay hello world
|
||||
|
||||
#send INVITE
|
||||
++a --to sip:bob@$$(domain) \
|
||||
++av --to sip:bob@$$(domain) \
|
||||
--header Action-Header=Myheader-value @@action \
|
||||
>>(inv_audio_sid)
|
||||
++sleep --sec -1
|
||||
|
|
|
@ -139,9 +139,10 @@ tsip_ssession_id_t invite_handle_cmd(cmd_type_t cmd, const opts_L_t* opts)
|
|||
|
||||
switch(cmd){
|
||||
case cmd_audio:
|
||||
{ /* Make Audio call */
|
||||
case cmd_audiovideo:
|
||||
{ /* Make Audio/Video call */
|
||||
tsip_action_handle_t* action_config = action_get_config(opts);
|
||||
tsip_action_INVITE(session->handle, tmedia_audio,
|
||||
tsip_action_INVITE(session->handle, (cmd == cmd_audio) ? tmedia_audio : (tmedia_audio|tmedia_video),
|
||||
TSIP_ACTION_SET_CONFIG(action_config),
|
||||
/* Any other TSIP_ACTION_SET_*() macros */
|
||||
TSIP_ACTION_SET_NULL());
|
||||
|
|
|
@ -271,8 +271,9 @@ int execute(const cmd_t* cmd)
|
|||
|
||||
switch(cmd->type){
|
||||
case cmd_audio:
|
||||
case cmd_audiovideo:
|
||||
{
|
||||
TSK_DEBUG_INFO("command=audio");
|
||||
TSK_DEBUG_INFO("command=audio/video");
|
||||
if((sid = invite_handle_cmd(cmd->type, cmd->opts)) != TSIP_SSESSION_INVALID_ID){
|
||||
if(cmd->sidparam){
|
||||
tsk_itoa(sid, &istr);
|
||||
|
|
|
@ -120,6 +120,8 @@ typedef struct tmedia_codec_s
|
|||
|
||||
//! the type of the codec
|
||||
tmedia_type_t type;
|
||||
//! whether the codec is opened
|
||||
tsk_bool_t opened;
|
||||
//! whether the pay. type is dyn. or not
|
||||
tsk_bool_t dyn;
|
||||
//! the name of the codec. e.g. "G.711U" or "G.711A" etc used in the sdp
|
||||
|
@ -166,6 +168,10 @@ typedef struct tmedia_codec_plugin_def_s
|
|||
/* ...to be continued */
|
||||
} video;
|
||||
|
||||
//! open the codec
|
||||
int (*open) (tmedia_codec_t*);
|
||||
//! close the codec
|
||||
int (*close) (tmedia_codec_t*);
|
||||
//! encode data
|
||||
tsk_size_t (*encode) (tmedia_codec_t*, const void* in_data, tsk_size_t in_size, void** out_data);
|
||||
//! decode data
|
||||
|
@ -186,6 +192,8 @@ typedef tsk_list_t tmedia_codecs_L_t;
|
|||
#define TMEDIA_DECLARE_CODEC tmedia_codec_t __codec__
|
||||
|
||||
TINYMEDIA_API int tmedia_codec_init(tmedia_codec_t* self, tmedia_type_t type, const char* name, const char* desc, const char* format);
|
||||
TINYMEDIA_API int tmedia_codec_open(tmedia_codec_t* self);
|
||||
TINYMEDIA_API int tmedia_codec_close(tmedia_codec_t* self);
|
||||
TINYMEDIA_API int tmedia_codec_cmp(const tsk_object_t* codec1, const tsk_object_t* codec2);
|
||||
TINYMEDIA_API int tmedia_codec_plugin_register(const tmedia_codec_plugin_def_t* plugin);
|
||||
TINYMEDIA_API int tmedia_codec_plugin_unregister(const tmedia_codec_plugin_def_t* plugin);
|
||||
|
|
|
@ -81,6 +81,75 @@ int tmedia_codec_init(tmedia_codec_t* self, tmedia_type_t type, const char* name
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**@ingroup tmedia_codec_group
|
||||
* Prepares a codec by opening it.
|
||||
* @param self The codec to open.
|
||||
* @retval Zero if succeed and non-zero error code otherwise.
|
||||
* @sa @ref tmedia_codec_close()
|
||||
*/
|
||||
int tmedia_codec_open(tmedia_codec_t* self)
|
||||
{
|
||||
if(!self || !self->plugin){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
if(self->opened){
|
||||
TSK_DEBUG_WARN("Codec already opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(self->plugin->open){
|
||||
int ret;
|
||||
if((ret = self->plugin->open(self))){
|
||||
TSK_DEBUG_ERROR("Failed to open [%s] codec", self->plugin->desc);
|
||||
return ret;
|
||||
}
|
||||
else{
|
||||
self->opened = tsk_true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
self->opened = tsk_true;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**@ingroup tmedia_codec_group
|
||||
* UnPrepares a codec by closing it.
|
||||
* @param self The codec to close.
|
||||
* @retval Zero if succeed and non-zero error code otherwise.
|
||||
* @sa @ref tmedia_codec_open()
|
||||
*/
|
||||
int tmedia_codec_close(tmedia_codec_t* self)
|
||||
{
|
||||
if(!self || !self->plugin){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
if(!self->opened){
|
||||
TSK_DEBUG_WARN("Codec not opened");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(self->plugin->close){
|
||||
int ret;
|
||||
|
||||
if((ret = self->plugin->close(self))){
|
||||
TSK_DEBUG_ERROR("Failed to close [%s] codec", self->plugin->desc);
|
||||
return ret;
|
||||
}
|
||||
else{
|
||||
self->opened = tsk_false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
self->opened = tsk_false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**@ingroup tmedia_codec_group
|
||||
* Generic function to compare two codecs.
|
||||
* @param codec1 The first codec to compare.
|
||||
|
@ -432,6 +501,10 @@ int tmedia_codec_deinit(tmedia_codec_t* self)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if(self->opened){
|
||||
tmedia_codec_close(self);
|
||||
}
|
||||
|
||||
TSK_FREE(self->name);
|
||||
TSK_FREE(self->desc);
|
||||
TSK_FREE(self->format);
|
||||
|
|
|
@ -93,6 +93,9 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dpcmu_plugin_def_s =
|
|||
|
||||
/* video */
|
||||
{0},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tmedia_codec_dpcmu_fmtp_encode,
|
||||
tmedia_codec_dpcmu_fmtp_decode,
|
||||
tmedia_codec_dpcmu_fmtp_match,
|
||||
|
@ -164,6 +167,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dpcma_plugin_def_s =
|
|||
/* video */
|
||||
{0},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tmedia_codec_dpcma_fmtp_encode,
|
||||
tmedia_codec_dpcma_fmtp_decode,
|
||||
tmedia_codec_dpcma_fmtp_match,
|
||||
|
@ -254,6 +259,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dh263_plugin_def_s =
|
|||
/* video */
|
||||
{176, 144},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tmedia_codec_dh263_fmtp_encode,
|
||||
tmedia_codec_dh263_fmtp_decode,
|
||||
tmedia_codec_dh263_fmtp_match,
|
||||
|
@ -345,6 +352,8 @@ static const tmedia_codec_plugin_def_t tmedia_codec_dh264_plugin_def_s =
|
|||
/* video */
|
||||
{176, 144},
|
||||
|
||||
tsk_null, // open
|
||||
tsk_null, // close
|
||||
tmedia_codec_dh264_fmtp_encode,
|
||||
tmedia_codec_dh264_fmtp_decode,
|
||||
tmedia_codec_dh264_fmtp_match,
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
|
||||
TMSRP_BEGIN_DECLS
|
||||
|
||||
#define TMSRP_CONFIG_CREATE() tsk_object_new(tmsrp_config_def_t)
|
||||
|
||||
#define TMSRP_MAX_CHUNK_SIZE 2048
|
||||
|
||||
typedef struct tmsrp_config_s
|
||||
|
@ -56,6 +54,8 @@ typedef struct tmsrp_config_s
|
|||
}
|
||||
tmsrp_config_t;
|
||||
|
||||
tmsrp_config_t* tmsrp_config_create();
|
||||
|
||||
TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_config_def_t;
|
||||
|
||||
TMSRP_END_DECLS
|
||||
|
|
|
@ -41,12 +41,6 @@ TMSRP_BEGIN_DECLS
|
|||
#define TMSRP_DATA(self) ((tmsrp_data_t*)(self))
|
||||
#define TMSRP_DATA_IS_OUTGOING(self) (TMSRP_DATA(self)->outgoing)
|
||||
|
||||
#define TMSRP_DATA_IN_CREATE() tsk_object_new(tmsrp_data_in_def_t)
|
||||
|
||||
#define _TMSRP_DATA_OUT_CREATE(pdata, size, isfilepath) tsk_object_new(tmsrp_data_out_def_t, (const void*)pdata, (tsk_size_t)size, (tsk_bool_t)isfilepath)
|
||||
#define TMSRP_DATA_OUT_CREATE(pdata, size) _TMSRP_DATA_OUT_CREATE(pdata, size, tsk_false)
|
||||
#define TMSRP_DATA_OUT_FILE_CREATE(filepath) _TMSRP_DATA_OUT_CREATE(filepath, strlen(filepath), tsk_true)
|
||||
|
||||
|
||||
typedef struct tmsrp_data_s
|
||||
{
|
||||
|
@ -84,6 +78,10 @@ typedef struct tmsrp_data_out_s
|
|||
}
|
||||
tmsrp_data_out_t;
|
||||
|
||||
tmsrp_data_in_t* tmsrp_data_in_create();
|
||||
tmsrp_data_out_t* tmsrp_data_out_create(const void* pdata, tsk_size_t size);
|
||||
tmsrp_data_out_t* tmsrp_data_out_file_create(const char* filepath);
|
||||
|
||||
tsk_buffer_t* tmsrp_data_out_get(tmsrp_data_out_t* self);
|
||||
|
||||
TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_data_in_def_t;
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
|
||||
TMSRP_BEGIN_DECLS
|
||||
|
||||
#define TMSRP_RECEIVER_CREATE(config, fd) tsk_object_new(tmsrp_receiver_def_t, (tmsrp_config_t*)config, (tnet_fd_t) fd)
|
||||
|
||||
int tmsrp_transport_layer_stream_cb(const tnet_transport_event_t* e);
|
||||
|
||||
typedef struct tmsrp_receiver_s
|
||||
|
@ -54,6 +52,7 @@ typedef struct tmsrp_receiver_s
|
|||
}
|
||||
tmsrp_receiver_t;
|
||||
|
||||
tmsrp_receiver_t* tmsrp_receiver_create(tmsrp_config_t* config, tnet_fd_t fd);
|
||||
int tmsrp_receiver_start(tmsrp_receiver_t* self);
|
||||
int tmsrp_receiver_stop(tmsrp_receiver_t* self);
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
|
||||
TMSRP_BEGIN_DECLS
|
||||
|
||||
#define TMSRP_SENDER_CREATE(config, fd) tsk_object_new(tmsrp_sender_def_t, (tmsrp_config_t*)config, (tnet_fd_t) fd)
|
||||
|
||||
typedef struct tmsrp_sender_s
|
||||
{
|
||||
TSK_DECLARE_RUNNABLE;
|
||||
|
@ -53,6 +51,8 @@ typedef struct tmsrp_sender_s
|
|||
}
|
||||
tmsrp_sender_t;
|
||||
|
||||
tmsrp_sender_t* tmsrp_sender_create(tmsrp_config_t* config, tnet_fd_t fd);
|
||||
|
||||
int tmsrp_sender_start(tmsrp_sender_t* self);
|
||||
int tsmrp_sender_send_data(tmsrp_sender_t* self, const void* data, tsk_size_t size, const char* ctype);
|
||||
int tsmrp_sender_send_file(tmsrp_sender_t* self, const char* filepath);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#include "tinymsrp_config.h"
|
||||
|
||||
#include "tinymsrp/session/tmsrp_media.h"
|
||||
|
||||
#include "tnet_socket.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
|
@ -39,12 +41,6 @@
|
|||
TMSRP_BEGIN_DECLS
|
||||
|
||||
#define TMSRP_SESSION_VA_ARGS(setup, host, useIPv6, useTLS) tmsrp_session_def_t, (tmsrp_session_setup_t)setup, (const char*)host, (tsk_bool_t)useIPv6, (tsk_bool_t)useTLS
|
||||
#define TMSRP_SESSION_CREATE(setup, host, useIPv6, useTLS) tsk_object_new(TMSRP_SESSION_VA_ARGS(setup, host, useIPv6, useTLS))
|
||||
#define TMSRP_SESSION_ACTIVE_CREATE(host, useIPv6, useTLS) TMSRP_SESSION_CREATE(setup_active, host, useIPv6, useTLS)
|
||||
#define TMSRP_SESSION_PASSIVE_CREATE(host, useIPv6, useTLS) TMSRP_SESSION_CREATE(setup_passive, host, useIPv6, useTLS)
|
||||
#define TMSRP_SESSION_ACTPASS_CREATE(host, useIPv6, useTLS) TMSRP_SESSION_CREATE(setup_actpass, host, useIPv6, useTLS)
|
||||
#define TMSRP_SESSION_HOLDCONN_CREATE(host, useIPv6, useTLS) TMSRP_SESSION_CREATE(setup_holdconn, host, useIPv6, useTLS)
|
||||
#define TMSRP_SESSION_CREATE_NULL() TMSRP_SESSION_CREATE(setup_actpass, TNET_SOCKET_HOST_ANY, tsk_false, tsk_false)
|
||||
|
||||
#define TMSRP_SESSION(self) ((tmsrp_session_t*)(self))
|
||||
|
||||
|
|
|
@ -53,20 +53,6 @@ TMSRP_BEGIN_DECLS
|
|||
#define TMSRP_MESSAGE_AS_REQUEST(self) ((tmsrp_request_t*)(self))
|
||||
|
||||
|
||||
/**@def TMSRP_MESSAGE_CREATE
|
||||
* Creates new msrp messgae. Could be either a request or a response.
|
||||
* You must call @ref TSK_OBJECT_SAFE_FREE to free the message.
|
||||
* @sa TSK_OBJECT_SAFE_FREE.
|
||||
*/
|
||||
#define TMSRP_MESSAGE_CREATE(type, tid, method, status, comment)\
|
||||
tsk_object_new(tmsrp_message_def_t, (tmsrp_message_type_t)type, (const char*)tid, (const char*)method, (short)status, (const char*)comment)
|
||||
#define TMSRP_REQUEST_CREATE(tid, method)\
|
||||
TMSRP_MESSAGE_CREATE(tmsrp_request, tid, method, 0, tsk_null)
|
||||
#define TMSRP_RESPONSE_CREATE(tid, status, comment)\
|
||||
TMSRP_MESSAGE_CREATE(tmsrp_response, tid, tsk_null, status, comment)
|
||||
#define TMSRP_MESSAGE_CREATE_NULL()\
|
||||
TMSRP_MESSAGE_CREATE(tmsrp_unknown, tsk_null, tsk_null, 0, tsk_null)
|
||||
|
||||
#define TMSRP_RESPONSE_CODE(self) (TMSRP_MESSAGE_IS_RESPONSE((self)) ? (self)->status_code : 0)
|
||||
#define TMSRP_RESPONSE_PHRASE(self) ((self)->reason_phrase)
|
||||
|
||||
|
@ -157,6 +143,12 @@ tmsrp_message_t;
|
|||
typedef tmsrp_message_t tmsrp_request_t; /**< MSRP request message. */
|
||||
typedef tmsrp_message_t tmsrp_response_t; /**< MSRP response message. */
|
||||
|
||||
|
||||
TINYMSRP_API tmsrp_message_t* tmsrp_message_create(tmsrp_message_type_t type, const char* tid, const char* method, short status, const char* comment);
|
||||
TINYMSRP_API tmsrp_message_t* tmsrp_request_create(const char* tid, const char* method);
|
||||
TINYMSRP_API tmsrp_message_t* tmsrp_response_create(const char* tid, short status, const char* comment);
|
||||
TINYMSRP_API tmsrp_message_t* tmsrp_message_create_null();
|
||||
|
||||
TINYMSRP_API int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr);
|
||||
TINYMSRP_API int tmsrp_message_add_headers(tmsrp_message_t *self, ...);
|
||||
|
||||
|
|
|
@ -3423,7 +3423,7 @@ tmsrp_message_t* tmsrp_message_parse_2(const void *input, tsk_size_t size, tsk_s
|
|||
goto bail;
|
||||
}
|
||||
|
||||
if(!(msrp_msg = TMSRP_MESSAGE_CREATE_NULL())){
|
||||
if(!(msrp_msg = tmsrp_message_create_null())){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,10 @@
|
|||
#include "tsk_memory.h"
|
||||
|
||||
|
||||
|
||||
tmsrp_config_t* tmsrp_config_create()
|
||||
{
|
||||
return tsk_object_new(tmsrp_config_def_t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -48,7 +51,7 @@
|
|||
//=================================================================================================
|
||||
// MSRP Session config object definition
|
||||
//
|
||||
static void* tmsrp_config_create(void * self, va_list * app)
|
||||
static void* tmsrp_config_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tmsrp_config_t *config = self;
|
||||
if(config){
|
||||
|
@ -57,7 +60,7 @@ static void* tmsrp_config_create(void * self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_config_destroy(void * self)
|
||||
static void* tmsrp_config_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_config_t *config = self;
|
||||
if(config){
|
||||
|
@ -71,8 +74,8 @@ static void* tmsrp_config_destroy(void * self)
|
|||
static const tsk_object_def_t tmsrp_config_def_s =
|
||||
{
|
||||
sizeof(tmsrp_config_t),
|
||||
tmsrp_config_create,
|
||||
tmsrp_config_destroy,
|
||||
tmsrp_config_ctor,
|
||||
tmsrp_config_dtor,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_config_def_t = &tmsrp_config_def_s;
|
||||
|
|
|
@ -40,6 +40,28 @@
|
|||
#include <stdio.h> /* fopen, fclose ... */
|
||||
|
||||
#define TMSRP_DATA_IN_MAX_BUFFER 0xFFFF
|
||||
|
||||
tmsrp_data_in_t* tmsrp_data_in_create()
|
||||
{
|
||||
return tsk_object_new(tmsrp_data_in_def_t);
|
||||
}
|
||||
|
||||
tmsrp_data_out_t* _tmsrp_data_out_create(const void* pdata, tsk_size_t size, tsk_bool_t isfilepath)
|
||||
{
|
||||
return tsk_object_new(tmsrp_data_out_def_t, pdata, size, isfilepath);
|
||||
}
|
||||
|
||||
tmsrp_data_out_t* tmsrp_data_out_create(const void* pdata, tsk_size_t size)
|
||||
{
|
||||
return _tmsrp_data_out_create(pdata, size, tsk_false);
|
||||
}
|
||||
|
||||
tmsrp_data_out_t* tmsrp_data_out_file_create(const char* filepath)
|
||||
{
|
||||
return _tmsrp_data_out_create(filepath, tsk_strlen(filepath), tsk_true);
|
||||
}
|
||||
|
||||
|
||||
/* =========================== Common ============================= */
|
||||
|
||||
//int tmsrp_data_init(tmsrp_data_t* self, tsk_bool_t outgoing, const void* pdata, tsk_size_t size, tsk_bool_t isfilepath, const char* ctype)
|
||||
|
@ -103,6 +125,7 @@ int tmsrp_data_in_put(tmsrp_data_in_t* self, const void* pdata, tsk_size_t size)
|
|||
{
|
||||
int ret = -1;
|
||||
if(!self || !self->buffer || !pdata || !size){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -187,7 +210,7 @@ tsk_buffer_t* tmsrp_data_out_get(tmsrp_data_out_t* self)
|
|||
//=================================================================================================
|
||||
// MSRP incoming data object definition
|
||||
//
|
||||
static void* tmsrp_data_in_create(void * self, va_list * app)
|
||||
static void* tmsrp_data_in_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tmsrp_data_in_t *data_in = self;
|
||||
if(data_in){
|
||||
|
@ -196,7 +219,7 @@ static void* tmsrp_data_in_create(void * self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_data_in_destroy(void * self)
|
||||
static void* tmsrp_data_in_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_data_in_t *data_in = self;
|
||||
if(data_in){
|
||||
|
@ -212,8 +235,8 @@ static void* tmsrp_data_in_destroy(void * self)
|
|||
static const tsk_object_def_t tmsrp_data_in_def_s =
|
||||
{
|
||||
sizeof(tmsrp_data_in_t),
|
||||
tmsrp_data_in_create,
|
||||
tmsrp_data_in_destroy,
|
||||
tmsrp_data_in_ctor,
|
||||
tmsrp_data_in_dtor,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_data_in_def_t = &tmsrp_data_in_def_s;
|
||||
|
@ -221,7 +244,7 @@ const tsk_object_def_t *tmsrp_data_in_def_t = &tmsrp_data_in_def_s;
|
|||
//=================================================================================================
|
||||
// MSRP outgoing data object definition
|
||||
//
|
||||
static void* tmsrp_data_out_create(void * self, va_list * app)
|
||||
static void* tmsrp_data_out_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tmsrp_data_out_t *data_out = self;
|
||||
if(data_out){
|
||||
|
@ -269,7 +292,7 @@ static void* tmsrp_data_out_create(void * self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_data_out_destroy(void * self)
|
||||
static void* tmsrp_data_out_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_data_out_t *data_out = self;
|
||||
if(data_out){
|
||||
|
@ -289,8 +312,8 @@ static void* tmsrp_data_out_destroy(void * self)
|
|||
static const tsk_object_def_t tmsrp_data_out_def_s =
|
||||
{
|
||||
sizeof(tmsrp_data_out_t),
|
||||
tmsrp_data_out_create,
|
||||
tmsrp_data_out_destroy,
|
||||
tmsrp_data_out_ctor,
|
||||
tmsrp_data_out_dtor,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_data_out_def_t = &tmsrp_data_out_def_s;
|
||||
|
|
|
@ -146,7 +146,7 @@ int tmsrp_media_start(tmedia_t* self)
|
|||
|
||||
// create and start the receiver
|
||||
if(!msrp->receiver){
|
||||
if((msrp->receiver = TMSRP_RECEIVER_CREATE(msrp->config, msrp->connectedFD))){
|
||||
if((msrp->receiver = tmsrp_receiver_create(msrp->config, msrp->connectedFD))){
|
||||
tnet_transport_set_callback(msrp->transport, TNET_TRANSPORT_CB_F(tmsrp_transport_layer_stream_cb), msrp->receiver);
|
||||
if((ret = tmsrp_receiver_start(msrp->receiver))){
|
||||
goto bail;
|
||||
|
@ -156,7 +156,7 @@ int tmsrp_media_start(tmedia_t* self)
|
|||
|
||||
// create and start the sender
|
||||
if(!msrp->sender){
|
||||
if((msrp->sender = TMSRP_SENDER_CREATE(msrp->config, msrp->connectedFD))){
|
||||
if((msrp->sender = tmsrp_sender_create(msrp->config, msrp->connectedFD))){
|
||||
if((ret = tmsrp_sender_start(msrp->sender))){
|
||||
goto bail;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ tmsrp_send_data(tmsrp_media_t* self, const void* data, tsk_size_t size, const ch
|
|||
//========================================================
|
||||
// Dummy media object definition
|
||||
//
|
||||
static void* tmsrp_media_create(tsk_object_t *self, va_list * app)
|
||||
static void* tmsrp_media_ctor(tsk_object_t *self, va_list * app)
|
||||
{
|
||||
tmsrp_media_t *msrp = self;
|
||||
if(msrp)
|
||||
|
@ -504,7 +504,7 @@ static void* tmsrp_media_create(tsk_object_t *self, va_list * app)
|
|||
// init base
|
||||
tmedia_init(TMEDIA(msrp), name);
|
||||
|
||||
msrp->config = TMSRP_CONFIG_CREATE();
|
||||
msrp->config = tmsrp_config_create();
|
||||
msrp->setup = setup_actpass; // draft-denis-simple-msrp-comedia-02 - 4.1.1. Sending the offer
|
||||
TMEDIA(msrp)->protocol = tsk_strdup("TCP/MSRP");
|
||||
|
||||
|
@ -525,7 +525,7 @@ static void* tmsrp_media_create(tsk_object_t *self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_media_destroy(tsk_object_t *self)
|
||||
static void* tmsrp_media_dtor(tsk_object_t *self)
|
||||
{
|
||||
tmsrp_media_t *msrp = self;
|
||||
if(msrp){
|
||||
|
@ -561,8 +561,8 @@ static void* tmsrp_media_destroy(tsk_object_t *self)
|
|||
static const tsk_object_def_t tmsrp_media_def_s =
|
||||
{
|
||||
sizeof(tmsrp_media_t),
|
||||
tmsrp_media_create,
|
||||
tmsrp_media_destroy,
|
||||
tmsrp_media_ctor,
|
||||
tmsrp_media_dtor,
|
||||
tsk_null
|
||||
};
|
||||
|
||||
|
|
|
@ -37,6 +37,13 @@
|
|||
#include "tsk_string.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
|
||||
tmsrp_receiver_t* tmsrp_receiver_create(tmsrp_config_t* config, tnet_fd_t fd)
|
||||
{
|
||||
return tsk_object_new(tmsrp_receiver_def_t, config, fd);
|
||||
}
|
||||
|
||||
|
||||
int tmsrp_receiver_start(tmsrp_receiver_t* self)
|
||||
{
|
||||
return 0;
|
||||
|
@ -77,7 +84,7 @@ int tmsrp_transport_layer_stream_cb(const tnet_transport_event_t* e)
|
|||
char* str;
|
||||
|
||||
// send 200 OK
|
||||
if((r2xx = tmsrp_create_response(message, 200, "I got it"))){
|
||||
if((r2xx = tmsrp_create_response(message, 200, "OK"))){
|
||||
if((str = tmsrp_message_tostring(r2xx))){
|
||||
tnet_sockfd_send(receiver->fd, str, strlen(str), 0);
|
||||
TSK_FREE(str);
|
||||
|
@ -86,7 +93,7 @@ int tmsrp_transport_layer_stream_cb(const tnet_transport_event_t* e)
|
|||
}
|
||||
// send REPORT
|
||||
if(tmsrp_isReportRequired(message, tsk_false)){
|
||||
if((REPORT = tmsrp_create_report(message, 200, "I got it"))){
|
||||
if((REPORT = tmsrp_create_report(message, 200, "OK"))){
|
||||
if((str = tmsrp_message_tostring(REPORT))){
|
||||
tnet_sockfd_send(receiver->fd, str, strlen(str), 0);
|
||||
TSK_FREE(str);
|
||||
|
@ -109,19 +116,19 @@ int tmsrp_transport_layer_stream_cb(const tnet_transport_event_t* e)
|
|||
//=================================================================================================
|
||||
// MSRP receiver object definition
|
||||
//
|
||||
static void* tmsrp_receiver_create(void * self, va_list *app)
|
||||
static void* tmsrp_receiver_ctor(tsk_object_t * self, va_list *app)
|
||||
{
|
||||
tmsrp_receiver_t *receiver = self;
|
||||
if(receiver){
|
||||
receiver->config = tsk_object_ref(va_arg(*app, tmsrp_config_t*));
|
||||
receiver->fd = va_arg(*app, tnet_fd_t);
|
||||
|
||||
receiver->data_in = TMSRP_DATA_IN_CREATE();
|
||||
receiver->data_in = tmsrp_data_in_create();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_receiver_destroy(void * self)
|
||||
static void* tmsrp_receiver_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_receiver_t *receiver = self;
|
||||
if(receiver){
|
||||
|
@ -138,8 +145,8 @@ static void* tmsrp_receiver_destroy(void * self)
|
|||
static const tsk_object_def_t tmsrp_receiver_def_s =
|
||||
{
|
||||
sizeof(tmsrp_receiver_t),
|
||||
tmsrp_receiver_create,
|
||||
tmsrp_receiver_destroy,
|
||||
tmsrp_receiver_ctor,
|
||||
tmsrp_receiver_dtor,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_receiver_def_t = &tmsrp_receiver_def_s;
|
||||
|
|
|
@ -36,13 +36,20 @@
|
|||
#include "tsk_debug.h"
|
||||
|
||||
|
||||
void *run(void* self);
|
||||
static void *run(void* self);
|
||||
|
||||
|
||||
tmsrp_sender_t* tmsrp_sender_create(tmsrp_config_t* config, tnet_fd_t fd)
|
||||
{
|
||||
return tsk_object_new(tmsrp_sender_def_t, config, fd);
|
||||
}
|
||||
|
||||
int tmsrp_sender_start(tmsrp_sender_t* self)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
@ -60,10 +67,11 @@ int tsmrp_sender_send_data(tmsrp_sender_t* self, const void* pdata, tsk_size_t s
|
|||
tmsrp_data_out_t* data_out;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((data_out = TMSRP_DATA_OUT_CREATE(pdata, size))){
|
||||
if((data_out = tmsrp_data_out_create(pdata, size))){
|
||||
TSK_RUNNABLE_ENQUEUE_OBJECT(self, data_out);
|
||||
return 0;
|
||||
}
|
||||
|
@ -75,10 +83,11 @@ int tsmrp_sender_send_file(tmsrp_sender_t* self, const char* filepath)
|
|||
tmsrp_data_out_t* data_out;
|
||||
|
||||
if(!self || !filepath){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((data_out = TMSRP_DATA_OUT_FILE_CREATE(filepath))){
|
||||
if((data_out = tmsrp_data_out_file_create(filepath))){
|
||||
if(TMSRP_DATA(data_out)->isOK){
|
||||
TSK_RUNNABLE_ENQUEUE_OBJECT(self, data_out);
|
||||
return 0;
|
||||
|
@ -96,6 +105,7 @@ int tmsrp_sender_stop(tmsrp_sender_t* self)
|
|||
int ret = -1;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
@ -142,7 +152,7 @@ void *run(void* self)
|
|||
// compute new transaction id
|
||||
tsk_strrandom(&tid);
|
||||
// create SEND request
|
||||
SEND = TMSRP_REQUEST_CREATE(tid, "SEND");
|
||||
SEND = tmsrp_request_create(tid, "SEND");
|
||||
// T-Path and From-Path (because of otherURIs)
|
||||
SEND->To = tsk_object_ref(sender->config->To_Path);
|
||||
SEND->From = tsk_object_ref(sender->config->From_Path);
|
||||
|
@ -189,7 +199,7 @@ void *run(void* self)
|
|||
//=================================================================================================
|
||||
// MSRP sender object definition
|
||||
//
|
||||
static void* tmsrp_sender_create(void * self, va_list *app)
|
||||
static void* tmsrp_sender_ctor(tsk_object_t * self, va_list *app)
|
||||
{
|
||||
tmsrp_sender_t *sender = self;
|
||||
if(sender){
|
||||
|
@ -201,7 +211,7 @@ static void* tmsrp_sender_create(void * self, va_list *app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_sender_destroy(void * self)
|
||||
static void* tmsrp_sender_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_sender_t *sender = self;
|
||||
if(sender){
|
||||
|
@ -218,8 +228,8 @@ static void* tmsrp_sender_destroy(void * self)
|
|||
static const tsk_object_def_t tmsrp_sender_def_s =
|
||||
{
|
||||
sizeof(tmsrp_sender_t),
|
||||
tmsrp_sender_create,
|
||||
tmsrp_sender_destroy,
|
||||
tmsrp_sender_ctor,
|
||||
tmsrp_sender_dtor,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_sender_def_t = &tmsrp_sender_def_s;
|
||||
|
|
|
@ -31,6 +31,37 @@
|
|||
|
||||
#include "tnet_utils.h"
|
||||
|
||||
|
||||
tmsrp_session_t* tmsrp_session_create(tmsrp_session_setup_t setup, const char* host, tsk_bool_t useIPv6, tsk_bool_t useTLS)
|
||||
{
|
||||
return tsk_object_new(TMSRP_SESSION_VA_ARGS(setup, host, useIPv6, useTLS));
|
||||
}
|
||||
|
||||
tmsrp_session_t* tmsrp_session_active_create(const char* host, tsk_bool_t useIPv6, tsk_bool_t useTLS)
|
||||
{
|
||||
return tmsrp_session_create(setup_active, host, useIPv6, useTLS);
|
||||
}
|
||||
|
||||
tmsrp_session_t* tmsrp_session_passive_create(const char* host, tsk_bool_t useIPv6, tsk_bool_t useTLS)
|
||||
{
|
||||
return tmsrp_session_create(setup_passive, host, useIPv6, useTLS);
|
||||
}
|
||||
|
||||
tmsrp_session_t* tmsrp_session_actpass_create(const char* host, tsk_bool_t useIPv6, tsk_bool_t useTLS)
|
||||
{
|
||||
return tmsrp_session_create(setup_actpass, host, useIPv6, useTLS);
|
||||
}
|
||||
|
||||
tmsrp_session_t* tmsrp_session_holdconn_create(const char* host, tsk_bool_t useIPv6, tsk_bool_t useTLS)
|
||||
{
|
||||
return tmsrp_session_create(setup_holdconn, host, useIPv6, useTLS);
|
||||
}
|
||||
|
||||
tmsrp_session_t* tmsrp_session_create_null()
|
||||
{
|
||||
return tmsrp_session_create(setup_actpass, TNET_SOCKET_HOST_ANY, tsk_false, tsk_false);
|
||||
}
|
||||
|
||||
int tmsrp_session_start(tmsrp_session_t* self)
|
||||
{
|
||||
if(!self || !self->localSocket){
|
||||
|
@ -80,7 +111,7 @@ int tmsrp_session_stop(tmsrp_session_t* self)
|
|||
//=================================================================================================
|
||||
// MSRP session object definition
|
||||
//
|
||||
static void* tmsrp_session_create(tsk_object_t* self, va_list * app)
|
||||
static void* tmsrp_session_ctor(tsk_object_t* self, va_list * app)
|
||||
{
|
||||
tmsrp_session_t *session = self;
|
||||
if(session){
|
||||
|
@ -108,7 +139,7 @@ static void* tmsrp_session_create(tsk_object_t* self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_session_destroy(tsk_object_t * self)
|
||||
static void* tmsrp_session_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_session_t *session = self;
|
||||
if(session){
|
||||
|
@ -121,8 +152,8 @@ static void* tmsrp_session_destroy(tsk_object_t * self)
|
|||
static const tsk_object_def_t tmsrp_session_def_s =
|
||||
{
|
||||
sizeof(tmsrp_session_t),
|
||||
tmsrp_session_create,
|
||||
tmsrp_session_destroy,
|
||||
tmsrp_session_ctor,
|
||||
tmsrp_session_dtor,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_session_def_t = &tmsrp_session_def_s;
|
||||
|
|
|
@ -57,7 +57,7 @@ tmsrp_request_t* tmsrp_create_bodiless(const tmsrp_uri_t* To, const tmsrp_uri_t*
|
|||
tsk_strrandom(&tid);
|
||||
tsk_strrandom(&mid);
|
||||
|
||||
if(!(BODILESS = TMSRP_REQUEST_CREATE(tid, "SEND"))){
|
||||
if(!(BODILESS = tmsrp_request_create(tid, "SEND"))){
|
||||
goto bail;
|
||||
}
|
||||
// To-Path
|
||||
|
@ -82,7 +82,7 @@ tmsrp_response_t* tmsrp_create_response(const tmsrp_request_t* request, short st
|
|||
goto bail;
|
||||
}
|
||||
/* MSRP response will have the same tid ==> nothing to do */
|
||||
if(!(response = TMSRP_RESPONSE_CREATE(request->tid, status, comment))){
|
||||
if(!(response = tmsrp_response_create(request->tid, status, comment))){
|
||||
goto bail;
|
||||
}
|
||||
/* reverse To-Path and From-Path */
|
||||
|
@ -120,7 +120,7 @@ tmsrp_request_t* tmsrp_create_report(const tmsrp_request_t* SEND, short status,
|
|||
tsk_strrandom(&tid);
|
||||
|
||||
/* MSRP response will have the same tid ==> nothing to do */
|
||||
if(!(REPORT = TMSRP_REQUEST_CREATE(tid, "REPORT"))){
|
||||
if(!(REPORT = tmsrp_request_create(tid, "REPORT"))){
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
/*== Predicate function to find tmsrp_header_t object by type. */
|
||||
static int pred_find_header_by_type(const tsk_list_item_t *item, const void *tmsrp_htype)
|
||||
|
@ -57,6 +58,27 @@ static int pred_find_header_by_name(const tsk_list_item_t *item, const void *nam
|
|||
}
|
||||
|
||||
|
||||
tmsrp_message_t* tmsrp_message_create(tmsrp_message_type_t type, const char* tid, const char* method, short status, const char* comment)
|
||||
{
|
||||
return tsk_object_new(tmsrp_message_def_t, type, tid, method, status, comment);
|
||||
}
|
||||
|
||||
tmsrp_message_t* tmsrp_request_create(const char* tid, const char* method)
|
||||
{
|
||||
return tmsrp_message_create(tmsrp_request, tid, method, 0, tsk_null);
|
||||
}
|
||||
|
||||
tmsrp_message_t* tmsrp_response_create(const char* tid, short status, const char* comment)
|
||||
{
|
||||
return tmsrp_message_create(tmsrp_response, tid, tsk_null, status, comment);
|
||||
}
|
||||
|
||||
tmsrp_message_t* tmsrp_message_create_null()
|
||||
{
|
||||
return tmsrp_message_create(tmsrp_unknown, tsk_null, tsk_null, 0, tsk_null);
|
||||
}
|
||||
|
||||
|
||||
int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr)
|
||||
{
|
||||
#define ADD_HEADER(type, field) \
|
||||
|
@ -102,6 +124,7 @@ int tmsrp_message_add_headers(tmsrp_message_t *self, ...)
|
|||
va_list ap;
|
||||
|
||||
if(!self){
|
||||
TSK_DEBUG_ERROR("Invalid parameter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -187,8 +210,7 @@ const tmsrp_header_t *tmsrp_message_get_headerAt(const tmsrp_message_t *self, tm
|
|||
break;
|
||||
}
|
||||
|
||||
tsk_list_foreach(item, self->headers)
|
||||
{
|
||||
tsk_list_foreach(item, self->headers){
|
||||
if(!pred_find_header_by_type(item, &type)){
|
||||
if(pos++ >= index){
|
||||
hdr = item->data;
|
||||
|
@ -365,7 +387,7 @@ char* tmsrp_message_tostring(const tmsrp_message_t *self)
|
|||
//=================================================================================================
|
||||
// MSRP object definition
|
||||
//
|
||||
static void* tmsrp_message_create(tsk_object_t * self, va_list * app)
|
||||
static void* tmsrp_message_ctor(tsk_object_t * self, va_list * app)
|
||||
{
|
||||
tmsrp_message_t *message = self;
|
||||
if(message){
|
||||
|
@ -390,7 +412,7 @@ static void* tmsrp_message_create(tsk_object_t * self, va_list * app)
|
|||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_message_destroy(tsk_object_t * self)
|
||||
static void* tmsrp_message_dtor(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_message_t *message = self;
|
||||
if(message){
|
||||
|
@ -437,8 +459,8 @@ static int tmsrp_message_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
|||
static const tsk_object_def_t tmsrp_message_def_s =
|
||||
{
|
||||
sizeof(tmsrp_message_t),
|
||||
tmsrp_message_create,
|
||||
tmsrp_message_destroy,
|
||||
tmsrp_message_ctor,
|
||||
tmsrp_message_dtor,
|
||||
tmsrp_message_cmp,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_message_def_t = &tmsrp_message_def_s;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\thirdparties\win32\include;..\..\tinyMEDIA\include;..\..\tinySDP\include;..\..\tinyDAV\include;..\..\tinySAK\src;..\..\tinyNET\src"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\thirdparties\win32\include;..\..\tinyDAV\include;..\..\tinyMEDIA\include;..\..\tinyRTP\include;..\..\tinySDP\include;..\..\tinySAK\src;..\..\tinyNET\src"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYDAV_EXPORTS"
|
||||
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_WINDOWS;_USRDLL;TINYDAV_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -228,6 +228,10 @@
|
|||
<Filter
|
||||
Name="h263"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\codecs\h263\tdav_codec_h263.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="h264"
|
||||
|
@ -249,6 +253,14 @@
|
|||
Name="silk"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="msrp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\codecs\msrp\tdav_codec_msrp.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="audio"
|
||||
|
@ -313,19 +325,47 @@
|
|||
<Filter
|
||||
Name="video"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\video\tdav_session_video.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="android"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="directsound"
|
||||
Name="directshow"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\video\directshow\tdav_consumer_dshow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\video\directshow\tdav_producer_dshow.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="v4linux"
|
||||
>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="msrp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\msrp\tdav_consumer_msrp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\msrp\tdav_producer_msrp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\include\tinydav\msrp\tdav_session_msrp.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="source(*.c)"
|
||||
|
@ -372,6 +412,10 @@
|
|||
<Filter
|
||||
Name="h263"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\codecs\h263\tdav_codec_h263.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="h264"
|
||||
|
@ -393,6 +437,14 @@
|
|||
Name="theora"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="msrp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\codecs\msrp\tdav_codec_msrp.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="audio"
|
||||
|
@ -457,6 +509,10 @@
|
|||
<Filter
|
||||
Name="video"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\video\tdav_session_video.c"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="android"
|
||||
>
|
||||
|
@ -464,12 +520,36 @@
|
|||
<Filter
|
||||
Name="directshow"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\video\directshow\tdav_consumer_dshow.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\video\directshow\tdav_producer_dshow.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="v4linux"
|
||||
>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="msrp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\msrp\dav_session_msrp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\msrp\tdav_consumer_msrp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\tinyDAV\src\msrp\tdav_producer_msrp.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\thirdparties\win32\include";"$(DOUBANGO_HOME)\tinyMSRP\include";"$(DOUBANGO_HOME)\tinyNET\src";"$(DOUBANGO_HOME)\tinySAK\src";"$(DOUBANGO_HOME)\tinyMEDIA\include";"$(DOUBANGO_HOME)\tinySDP\include""
|
||||
AdditionalIncludeDirectories="..\..\thirdparties\win32\include;..\..\tinyMSRP\include;..\..\tinyNET\src;..\..\tinySAK\src;..\..\tinyMEDIA\include;..\..\tinySDP\include"
|
||||
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
|
Loading…
Reference in New Issue