BFCP episode #5

This commit is contained in:
bossiel 2014-04-28 21:16:53 +00:00
parent f3083c889c
commit a602f6a440
80 changed files with 999 additions and 422 deletions

View File

@ -9,6 +9,7 @@ SUBDIRS = tinySAK \
tinySMS \
tinySIGCOMP \
tinySDP \
tinyBFCP \
tinyMSRP \
tinyMEDIA \
tinyRTP \

View File

@ -48,7 +48,7 @@ bool ActionConfig::addPayload(const void* payload, unsigned len)
bool ActionConfig::setActiveMedia(twrap_media_type_t type)
{
tmedia_type_t media_type = twrap_get_media_type(type);
tmedia_type_t media_type = twrap_get_native_media_type(type);
return (tsip_action_set(m_pHandle,
TSIP_ACTION_SET_MEDIA_TYPE(media_type),
TSIP_ACTION_SET_NULL()) == 0);
@ -65,7 +65,7 @@ ActionConfig* ActionConfig::setResponseLine(short code, const char* phrase)
ActionConfig* ActionConfig::setMediaString(twrap_media_type_t type, const char* key, const char* value)
{
tmedia_type_t media_type = twrap_get_media_type(type);
tmedia_type_t media_type = twrap_get_native_media_type(type);
tsip_action_set(m_pHandle,
TSIP_ACTION_SET_MEDIA(
TMEDIA_SESSION_SET_STR(media_type, key, value),
@ -77,7 +77,7 @@ ActionConfig* ActionConfig::setMediaString(twrap_media_type_t type, const char*
ActionConfig* ActionConfig::setMediaInt(twrap_media_type_t type, const char* key, int value)
{
tmedia_type_t media_type = twrap_get_media_type(type);
tmedia_type_t media_type = twrap_get_native_media_type(type);
tsip_action_set(m_pHandle,
TSIP_ACTION_SET_MEDIA(
TMEDIA_SESSION_SET_INT32(media_type, key, value),

View File

@ -37,53 +37,70 @@ typedef enum twrap_media_type_e
// because of Java don't use OR
twrap_media_none = 0x00,
twrap_media_audio = 0x01,
twrap_media_video = 0x02,
twrap_media_msrp = 0x04,
twrap_media_t140 = 0x08,
twrap_media_audio = 0x01, // (0x01 << 0)
twrap_media_video = 0x02, // (0x01 << 1)
twrap_media_msrp = 0x04, // (0x01 << 2)
twrap_media_t140 = 0x08, // (0x01 << 3)
twrap_media_bfcp = 0x10, // (0x01 << 4)
twrap_media_bfcp_audio = 0x30, // (0x01 << 5) | twrap_media_bfcp;
twrap_media_bfcp_video = 0x50, // (0x01 << 6) | twrap_media_bfcp;
twrap_media_audio_t140 = 0x09,
twrap_media_video_t140 = 0x0a,
twrap_media_audiovideo = 0x03, /* @deprecated */
twrap_media_audio_video = twrap_media_audiovideo,
twrap_media_audio_video_t140 = 0x0b
twrap_media_audio_video_t140 = 0x0b,
twrap_media_audio_video_bfcpvideo = 0x53, // twrap_media_audio | twrap_media_video | twrap_media_bfcp_video
twrap_media_audio_bfcpvideo = 0x51, // twrap_media_audio | twrap_media_bfcp_video
twrap_media_video_bfcpvideo = 0x52, // twrap_media_video | twrap_media_bfcp_video
}
twrap_media_type_t;
#if !defined(SWIG)
#include "tinymedia/tmedia_common.h"
static tmedia_type_t twrap_get_media_type(twrap_media_type_t type)
struct media_type_bind_s
{
int media_type = tmedia_none; // Use int because | operator not defined for enumerators
switch(type){
case twrap_media_msrp:
media_type |= tmedia_msrp;
break;
case twrap_media_audio:
media_type |= tmedia_audio;
break;
case twrap_media_video:
media_type |= tmedia_video;
break;
case twrap_media_audio_video:
media_type |= (tmedia_audio | tmedia_video);
break;
case twrap_media_t140:
media_type |= tmedia_t140;
break;
case twrap_media_audio_t140:
media_type |= (tmedia_audio | tmedia_t140);
break;
case twrap_media_video_t140:
media_type |= (tmedia_video | tmedia_t140);
break;
case twrap_media_audio_video_t140:
media_type |= (tmedia_audio | tmedia_video | tmedia_t140);
break;
default:
break;
twrap_media_type_t twrap;
tmedia_type_t tnative;
};
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 },
{ twrap_media_audio_video, (tmedia_type_t)(tmedia_audio | tmedia_video) },
{ twrap_media_t140, tmedia_t140 },
{ twrap_media_bfcp, tmedia_bfcp },
{ twrap_media_bfcp_audio, tmedia_bfcp_audio },
{ twrap_media_bfcp_video, tmedia_bfcp_video },
{ twrap_media_audio_video_bfcpvideo, (tmedia_type_t)(tmedia_audio | tmedia_video | tmedia_bfcp_video) },
{ twrap_media_audio_bfcpvideo, (tmedia_type_t)(tmedia_audio | tmedia_bfcp_video) },
{ twrap_media_video_bfcpvideo, (tmedia_type_t)(tmedia_video | tmedia_bfcp_video) },
{ twrap_media_audio_t140, (tmedia_type_t)(tmedia_audio | tmedia_t140) },
{ twrap_media_video_t140, (tmedia_type_t)(tmedia_video | tmedia_t140) },
{ twrap_media_audio_video_t140, (tmedia_type_t)(tmedia_audio | tmedia_video | tmedia_t140) }
};
static const tsk_size_t __media_type_binds_count = sizeof(__media_type_binds)/sizeof(__media_type_binds[0]);
static tmedia_type_t twrap_get_native_media_type(twrap_media_type_t type)
{
tsk_size_t u;
for (u = 0; u < __media_type_binds_count; ++u) {
if (__media_type_binds[u].twrap == type) {
return __media_type_binds[u].tnative;
}
}
return (tmedia_type_t)media_type;
return tmedia_none;
}
static twrap_media_type_t twrap_get_wrapped_media_type(tmedia_type_t type)
{
tsk_size_t u;
for (u = 0; u < __media_type_binds_count; ++u) {
if (__media_type_binds[u].tnative == type) {
return __media_type_binds[u].twrap;
}
}
return twrap_media_none;
}
#endif

View File

@ -110,7 +110,7 @@ MediaSessionMgr::~MediaSessionMgr()
bool MediaSessionMgr::sessionSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
@ -119,7 +119,7 @@ bool MediaSessionMgr::sessionSetInt32(twrap_media_type_t media, const char* key,
int32_t MediaSessionMgr::sessionGetInt32(twrap_media_type_t media, const char* key)
{
int32_t value = 0;
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
(tmedia_session_mgr_get(m_pWrappedMgr,
TMEDIA_SESSION_GET_INT32(_media, key, &value),
TMEDIA_SESSION_GET_NULL()));
@ -128,7 +128,7 @@ int32_t MediaSessionMgr::sessionGetInt32(twrap_media_type_t media, const char* k
bool MediaSessionMgr::consumerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_CONSUMER_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
@ -136,7 +136,7 @@ bool MediaSessionMgr::consumerSetInt32(twrap_media_type_t media, const char* key
bool MediaSessionMgr::consumerSetInt64(twrap_media_type_t media, const char* key, int64_t value)
{
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_CONSUMER_SET_INT64(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
@ -144,7 +144,7 @@ bool MediaSessionMgr::consumerSetInt64(twrap_media_type_t media, const char* key
bool MediaSessionMgr::producerSetInt32(twrap_media_type_t media, const char* key, int32_t value)
{
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_PRODUCER_SET_INT32(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
@ -152,7 +152,7 @@ bool MediaSessionMgr::producerSetInt32(twrap_media_type_t media, const char* key
bool MediaSessionMgr::producerSetInt64(twrap_media_type_t media, const char* key, int64_t value)
{
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
return (tmedia_session_mgr_set(m_pWrappedMgr,
TMEDIA_SESSION_PRODUCER_SET_INT64(_media, key, value),
TMEDIA_SESSION_SET_NULL()) == 0);
@ -161,7 +161,7 @@ bool MediaSessionMgr::producerSetInt64(twrap_media_type_t media, const char* key
Codec* MediaSessionMgr::producerGetCodec(twrap_media_type_t media)
{
tmedia_codec_t* _codec = tsk_null;
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
(tmedia_session_mgr_get(m_pWrappedMgr,
TMEDIA_SESSION_PRODUCER_GET_POBJECT(_media, "codec", &_codec),
TMEDIA_SESSION_GET_NULL()));
@ -190,7 +190,7 @@ const ProxyPlugin* MediaSessionMgr::findProxyPlugin(twrap_media_type_t media, bo
}
if(manager && m_pWrappedMgr){
tmedia_type_t _media = twrap_get_media_type(media);
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){
@ -261,7 +261,7 @@ uint64_t MediaSessionMgr::getSessionId(twrap_media_type_t media)const
}
if(manager && m_pWrappedMgr){
tmedia_type_t _media = twrap_get_media_type(media);
tmedia_type_t _media = twrap_get_native_media_type(media);
tmedia_session_t* session = tmedia_session_mgr_find(m_pWrappedMgr, _media);
if(session){
id = session->id;
@ -437,7 +437,7 @@ bool MediaSessionMgr::defaultsSetRtpSymetricEnabled(bool enabled){
bool MediaSessionMgr::defaultsSetMediaType(twrap_media_type_t media_type)
{
return (tmedia_defaults_set_media_type(twrap_get_media_type(media_type)) == 0);
return (tmedia_defaults_set_media_type(twrap_get_native_media_type(media_type)) == 0);
}
bool MediaSessionMgr::defaultsSetVolume(int32_t volume)

View File

@ -125,17 +125,13 @@ tsip_invite_event_type_t InviteEvent::getType() const
twrap_media_type_t InviteEvent::getMediaType() const
{
// Ignore Mixed session (both audio/video and MSRP) as specified by GSMA RCS.
if(this->sipevent && this->sipevent->ss){
if (this->sipevent && this->sipevent->ss) {
tmedia_type_t type = tsip_ssession_get_mediatype(this->sipevent->ss);
if(type & tmedia_msrp){
if ((type & tmedia_msrp) == tmedia_msrp) {
return twrap_media_msrp;
}
else{
twrap_media_type_t ret = twrap_media_none;
if(type & tmedia_audio) ret = (twrap_media_type_t)(ret | twrap_media_audio);
if(type & tmedia_video) ret = (twrap_media_type_t)(ret | twrap_media_video);
if(type & tmedia_t140) ret = (twrap_media_type_t)(ret | twrap_media_t140);
return ret;
else {
return twrap_get_wrapped_media_type(type);
}
}
return twrap_media_none;

View File

@ -361,7 +361,7 @@ bool CallSession::call(const SipUri* remoteUri, twrap_media_type_t media, Action
TSIP_SSESSION_SET_NULL());
const tsip_action_handle_t* action_cfg = config ? config->getHandle() : tsk_null;
return (tsip_api_invite_send_invite(m_pHandle, twrap_get_media_type(media),
return (tsip_api_invite_send_invite(m_pHandle, twrap_get_native_media_type(media),
TSIP_ACTION_SET_CONFIG(action_cfg),
TSIP_ACTION_SET_NULL()) == 0);
}
@ -386,7 +386,7 @@ bool CallSession::setMediaSSRC(twrap_media_type_t media, uint32_t ssrc)
{
return (tsip_ssession_set(m_pHandle,
TSIP_SSESSION_SET_MEDIA(
TSIP_MSESSION_SET_RTP_SSRC(twrap_get_media_type(media), ssrc),
TSIP_MSESSION_SET_RTP_SSRC(twrap_get_native_media_type(media), ssrc),
TSIP_MSESSION_SET_NULL()
),
TSIP_SSESSION_SET_NULL()) == 0);
@ -561,7 +561,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())){
return (tmedia_session_mgr_send_rtcp_event((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_media_type(media_type), event_type, ssrc_media) == 0);
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");
return false;
@ -573,10 +573,10 @@ bool CallSession::setRtcpCallback(const RtcpCallback* pRtcpCallback, twrap_media
const MediaSessionMgr* pMgr;
if((pMgr = getMediaMgr()) && (pWrappedMgr = pMgr->getWrappedMgr())){
if((m_pRtcpCallback = pRtcpCallback)){
return (tmedia_session_mgr_set_onrtcp_cbfn((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_media_type(media_type), this, &CallSession::rtcpOnCallback) == 0);
return (tmedia_session_mgr_set_onrtcp_cbfn((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_native_media_type(media_type), this, &CallSession::rtcpOnCallback) == 0);
}
else{
return (tmedia_session_mgr_set_onrtcp_cbfn((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_media_type(media_type), this, tsk_null) == 0);
return (tmedia_session_mgr_set_onrtcp_cbfn((tmedia_session_mgr_t*)pWrappedMgr, twrap_get_native_media_type(media_type), this, tsk_null) == 0);
}
}
return false;

View File

@ -14,11 +14,17 @@ public enum twrap_media_type_t {
twrap_media_video = 0x02,
twrap_media_msrp = 0x04,
twrap_media_t140 = 0x08,
twrap_media_bfcp = 0x10,
twrap_media_bfcp_audio = 0x30,
twrap_media_bfcp_video = 0x50,
twrap_media_audio_t140 = 0x09,
twrap_media_video_t140 = 0x0a,
twrap_media_audiovideo = 0x03,
twrap_media_audio_video = twrap_media_audiovideo,
twrap_media_audio_video_t140 = 0x0b
twrap_media_audio_video_t140 = 0x0b,
twrap_media_audio_video_bfcpvideo = 0x53,
twrap_media_audio_bfcpvideo = 0x51,
twrap_media_video_bfcpvideo = 0x52
}
}

View File

@ -14,11 +14,17 @@ public enum twrap_media_type_t {
twrap_media_video(0x02),
twrap_media_msrp(0x04),
twrap_media_t140(0x08),
twrap_media_bfcp(0x10),
twrap_media_bfcp_audio(0x30),
twrap_media_bfcp_video(0x50),
twrap_media_audio_t140(0x09),
twrap_media_video_t140(0x0a),
twrap_media_audiovideo(0x03),
twrap_media_audio_video(twrap_media_audiovideo),
twrap_media_audio_video_t140(0x0b);
twrap_media_audio_video_t140(0x0b),
twrap_media_audio_video_bfcpvideo(0x53),
twrap_media_audio_bfcpvideo(0x51),
twrap_media_video_bfcpvideo(0x52);
public final int swigValue() {
return swigValue;

View File

@ -14,11 +14,17 @@ public enum twrap_media_type_t {
twrap_media_video(0x02),
twrap_media_msrp(0x04),
twrap_media_t140(0x08),
twrap_media_bfcp(0x10),
twrap_media_bfcp_audio(0x30),
twrap_media_bfcp_video(0x50),
twrap_media_audio_t140(0x09),
twrap_media_video_t140(0x0a),
twrap_media_audiovideo(0x03),
twrap_media_audio_video(twrap_media_audiovideo),
twrap_media_audio_video_t140(0x0b);
twrap_media_audio_video_t140(0x0b),
twrap_media_audio_video_bfcpvideo(0x53),
twrap_media_audio_bfcpvideo(0x51),
twrap_media_video_bfcpvideo(0x52);
public final int swigValue() {
return swigValue;

View File

@ -2470,11 +2470,17 @@ package tinyWRAP;
*twrap_media_video = *tinyWRAPc::twrap_media_video;
*twrap_media_msrp = *tinyWRAPc::twrap_media_msrp;
*twrap_media_t140 = *tinyWRAPc::twrap_media_t140;
*twrap_media_bfcp = *tinyWRAPc::twrap_media_bfcp;
*twrap_media_bfcp_audio = *tinyWRAPc::twrap_media_bfcp_audio;
*twrap_media_bfcp_video = *tinyWRAPc::twrap_media_bfcp_video;
*twrap_media_audio_t140 = *tinyWRAPc::twrap_media_audio_t140;
*twrap_media_video_t140 = *tinyWRAPc::twrap_media_video_t140;
*twrap_media_audiovideo = *tinyWRAPc::twrap_media_audiovideo;
*twrap_media_audio_video = *tinyWRAPc::twrap_media_audio_video;
*twrap_media_audio_video_t140 = *tinyWRAPc::twrap_media_audio_video_t140;
*twrap_media_audio_video_bfcpvideo = *tinyWRAPc::twrap_media_audio_video_bfcpvideo;
*twrap_media_audio_bfcpvideo = *tinyWRAPc::twrap_media_audio_bfcpvideo;
*twrap_media_video_bfcpvideo = *tinyWRAPc::twrap_media_video_bfcpvideo;
*twrap_proxy_plugin_audio_producer = *tinyWRAPc::twrap_proxy_plugin_audio_producer;
*twrap_proxy_plugin_video_producer = *tinyWRAPc::twrap_proxy_plugin_video_producer;
*twrap_proxy_plugin_audio_consumer = *tinyWRAPc::twrap_proxy_plugin_audio_consumer;

View File

@ -28513,6 +28513,21 @@ XS(SWIG_init) {
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_t140)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_bfcp", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_bfcp)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_bfcp_audio", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_bfcp_audio)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_bfcp_video", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_bfcp_video)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_audio_t140", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_audio_t140)));
@ -28538,6 +28553,21 @@ XS(SWIG_init) {
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_audio_video_t140)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_audio_video_bfcpvideo", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_audio_video_bfcpvideo)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_audio_bfcpvideo", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_audio_bfcpvideo)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/2.0.9/perl5/perltypemaps.swg,65,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "twrap_media_video_bfcpvideo", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(twrap_media_video_bfcpvideo)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
SWIG_TypeClientData(SWIGTYPE_p_ActionConfig, (void*) "tinyWRAP::ActionConfig");
SWIG_TypeClientData(SWIGTYPE_p_Codec, (void*) "tinyWRAP::Codec");
SWIG_TypeClientData(SWIGTYPE_p_MediaSessionMgr, (void*) "tinyWRAP::MediaSessionMgr");

View File

@ -125,11 +125,17 @@ twrap_media_audio = _tinyWRAP.twrap_media_audio
twrap_media_video = _tinyWRAP.twrap_media_video
twrap_media_msrp = _tinyWRAP.twrap_media_msrp
twrap_media_t140 = _tinyWRAP.twrap_media_t140
twrap_media_bfcp = _tinyWRAP.twrap_media_bfcp
twrap_media_bfcp_audio = _tinyWRAP.twrap_media_bfcp_audio
twrap_media_bfcp_video = _tinyWRAP.twrap_media_bfcp_video
twrap_media_audio_t140 = _tinyWRAP.twrap_media_audio_t140
twrap_media_video_t140 = _tinyWRAP.twrap_media_video_t140
twrap_media_audiovideo = _tinyWRAP.twrap_media_audiovideo
twrap_media_audio_video = _tinyWRAP.twrap_media_audio_video
twrap_media_audio_video_t140 = _tinyWRAP.twrap_media_audio_video_t140
twrap_media_audio_video_bfcpvideo = _tinyWRAP.twrap_media_audio_video_bfcpvideo
twrap_media_audio_bfcpvideo = _tinyWRAP.twrap_media_audio_bfcpvideo
twrap_media_video_bfcpvideo = _tinyWRAP.twrap_media_video_bfcpvideo
class ActionConfig(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, ActionConfig, name, value)

View File

@ -27781,11 +27781,17 @@ SWIG_init(void) {
SWIG_Python_SetConstant(d, "twrap_media_video",SWIG_From_int(static_cast< int >(twrap_media_video)));
SWIG_Python_SetConstant(d, "twrap_media_msrp",SWIG_From_int(static_cast< int >(twrap_media_msrp)));
SWIG_Python_SetConstant(d, "twrap_media_t140",SWIG_From_int(static_cast< int >(twrap_media_t140)));
SWIG_Python_SetConstant(d, "twrap_media_bfcp",SWIG_From_int(static_cast< int >(twrap_media_bfcp)));
SWIG_Python_SetConstant(d, "twrap_media_bfcp_audio",SWIG_From_int(static_cast< int >(twrap_media_bfcp_audio)));
SWIG_Python_SetConstant(d, "twrap_media_bfcp_video",SWIG_From_int(static_cast< int >(twrap_media_bfcp_video)));
SWIG_Python_SetConstant(d, "twrap_media_audio_t140",SWIG_From_int(static_cast< int >(twrap_media_audio_t140)));
SWIG_Python_SetConstant(d, "twrap_media_video_t140",SWIG_From_int(static_cast< int >(twrap_media_video_t140)));
SWIG_Python_SetConstant(d, "twrap_media_audiovideo",SWIG_From_int(static_cast< int >(twrap_media_audiovideo)));
SWIG_Python_SetConstant(d, "twrap_media_audio_video",SWIG_From_int(static_cast< int >(twrap_media_audio_video)));
SWIG_Python_SetConstant(d, "twrap_media_audio_video_t140",SWIG_From_int(static_cast< int >(twrap_media_audio_video_t140)));
SWIG_Python_SetConstant(d, "twrap_media_audio_video_bfcpvideo",SWIG_From_int(static_cast< int >(twrap_media_audio_video_bfcpvideo)));
SWIG_Python_SetConstant(d, "twrap_media_audio_bfcpvideo",SWIG_From_int(static_cast< int >(twrap_media_audio_bfcpvideo)));
SWIG_Python_SetConstant(d, "twrap_media_video_bfcpvideo",SWIG_From_int(static_cast< int >(twrap_media_video_bfcpvideo)));
SWIG_Python_SetConstant(d, "twrap_proxy_plugin_audio_producer",SWIG_From_int(static_cast< int >(twrap_proxy_plugin_audio_producer)));
SWIG_Python_SetConstant(d, "twrap_proxy_plugin_video_producer",SWIG_From_int(static_cast< int >(twrap_proxy_plugin_video_producer)));
SWIG_Python_SetConstant(d, "twrap_proxy_plugin_audio_consumer",SWIG_From_int(static_cast< int >(twrap_proxy_plugin_audio_consumer)));

View File

@ -6,7 +6,7 @@
#
AC_PREREQ([2.0])
AC_INIT(libdoubango, 2.0.1050, doubango(at)googlegroups(dot)com)
AC_INIT(libdoubango, 2.0.1062, doubango(at)googlegroups(dot)com)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
@ -861,6 +861,9 @@ tinySIGCOMP/tinySIGCOMP.pc
tinySDP/Makefile
tinySDP/tinySDP.pc
tinyBFCP/Makefile
tinyBFCP/tinyBFCP.pc
tinyRTP/Makefile
tinyRTP/tinyRTP.pc

View File

@ -7,7 +7,7 @@ Name : libdoubango
Description : Doubango Telecom VoIP framework
Version : @PACKAGE_VERSION@
Requires:
Requires.private: tinySAK = @PACKAGE_VERSION@ tinyNET = @PACKAGE_VERSION@ tinyDAV = @PACKAGE_VERSION@ tinyHTTP = @PACKAGE_VERSION@ tinyIPSec = @PACKAGE_VERSION@ tinyMEDIA = @PACKAGE_VERSION@ tinyMSRP = @PACKAGE_VERSION@ tinyRTP = @PACKAGE_VERSION@ tinySDP = @PACKAGE_VERSION@ tinySIGCOMP = @PACKAGE_VERSION@ tinySIP = @PACKAGE_VERSION@ tinySMS = @PACKAGE_VERSION@ tinyXCAP = @PACKAGE_VERSION@
Requires.private: tinySAK = @PACKAGE_VERSION@ tinyNET = @PACKAGE_VERSION@ tinyDAV = @PACKAGE_VERSION@ tinyHTTP = @PACKAGE_VERSION@ tinyIPSec = @PACKAGE_VERSION@ tinyMEDIA = @PACKAGE_VERSION@ tinyMSRP = @PACKAGE_VERSION@ tinyRTP = @PACKAGE_VERSION@ tinySDP = @PACKAGE_VERSION@ tinyBFCP = @PACKAGE_VERSION@ tinySIGCOMP = @PACKAGE_VERSION@ tinySIP = @PACKAGE_VERSION@ tinySMS = @PACKAGE_VERSION@ tinyXCAP = @PACKAGE_VERSION@
Conflicts:
Cflags : -I${includedir} -I${includedir}/tinydav
Libs : -L${libdir} -ltinySAK

View File

@ -23,7 +23,11 @@
#include "tsk_plugin.h"
#include "tsk_debug.h"
#include <windows.h>
#include <streams.h>
#if !defined(ENABLE_SCREENCAST)
# define ENABLE_SCREENCAST 0
#endif /* ENABLE_SCREENCAST */
PLUGIN_DSHOW_BEGIN_DECLS /* BEGIN */
PLUGIN_DSHOW_API int __plugin_get_def_count();
@ -34,6 +38,17 @@ PLUGIN_DSHOW_END_DECLS /* END */
extern const tmedia_consumer_plugin_def_t *plugin_video_dshow_consumer_plugin_def_t;
extern const tmedia_producer_plugin_def_t *plugin_video_dshow_producer_plugin_def_t;
extern const tmedia_producer_plugin_def_t *plugin_screencast_dshow_producer_plugin_def_t;
CFactoryTemplate g_Templates[]=
{ { L""
, NULL
, NULL
, NULL
, NULL
}
};
int g_cTemplates = sizeof(g_Templates)/sizeof(g_Templates[0]);
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
@ -55,6 +70,9 @@ typedef enum PLUGIN_INDEX_E
{
PLUGIN_INDEX_VIDEO_CONSUMER,
PLUGIN_INDEX_VIDEO_PRODUCER,
#if 0
PLUGIN_INDEX_SCREENCAST_PRODUCER,
#endif
PLUGIN_INDEX_COUNT
}
PLUGIN_INDEX_T;
@ -68,8 +86,13 @@ int __plugin_get_def_count()
tsk_plugin_def_type_t __plugin_get_def_type_at(int index)
{
switch(index){
case PLUGIN_INDEX_VIDEO_CONSUMER: return tsk_plugin_def_type_consumer;
case PLUGIN_INDEX_VIDEO_PRODUCER: return tsk_plugin_def_type_producer;
case PLUGIN_INDEX_VIDEO_CONSUMER:
return tsk_plugin_def_type_consumer;
case PLUGIN_INDEX_VIDEO_PRODUCER:
#if ENABLE_SCREENCAST
case PLUGIN_INDEX_SCREENCAST_PRODUCER:
#endif
return tsk_plugin_def_type_producer;
default:
{
TSK_DEBUG_ERROR("No plugin at index %d", index);
@ -86,6 +109,12 @@ tsk_plugin_def_media_type_t __plugin_get_def_media_type_at(int index)
{
return tsk_plugin_def_media_type_video;
}
#if ENABLE_SCREENCAST
case PLUGIN_INDEX_SCREENCAST_PRODUCER:
{
return tsk_plugin_def_media_type_screencast;
}
#endif
default:
{
TSK_DEBUG_ERROR("No plugin at index %d", index);
@ -105,6 +134,12 @@ tsk_plugin_def_ptr_const_t __plugin_get_def_at(int index)
{
return plugin_video_dshow_producer_plugin_def_t;
}
#if ENABLE_SCREENCAST
case PLUGIN_INDEX_SCREENCAST_PRODUCER:
{
return plugin_screencast_dshow_producer_plugin_def_t;
}
#endif
default:
{
TSK_DEBUG_ERROR("No plugin at index %d", index);

View File

@ -29,6 +29,7 @@ using namespace std;
DSCaptureGraph::DSCaptureGraph(InxbISampleGrabberCB* callback, HRESULT *hr)
#else
DSCaptureGraph::DSCaptureGraph(ISampleGrabberCB* callback, HRESULT *hr)
: DSBaseCaptureGraph(callback, hr)
#endif
{
this->grabberCallback = callback;
@ -286,6 +287,7 @@ HRESULT DSCaptureGraph::start()
//assert(1==15);
#endif
TSK_DEBUG_ERROR("DSCaptureGraph::mediaController->Run() has failed with %ld", hr);
return hr;
}
this->running = true;
return hr;

View File

@ -21,7 +21,7 @@
#include "plugin_dshow_config.h"
#include <vector>
#include <control.h>
#include "internals/DSCaptureFormat.h"
#include "internals/DSBaseCaptureGraph.h"
#include "internals/DSFrameRateFilter.h"
#ifdef _WIN32_WCE
@ -33,7 +33,7 @@
#endif
class DSCaptureGraph
class DSCaptureGraph : public DSBaseCaptureGraph
{
public:
#ifdef _WIN32_WCE

View File

@ -21,23 +21,26 @@
#include "internals/DSCaptureUtils.h"
#include "internals/Resizer.h"
#include "internals/DSUtils.h"
#include "internals/DSCaptureGraph.h"
#include "internals/DSScreenCastGraph.h"
#include "tsk_debug.h"
using namespace std;
DSGrabber::DSGrabber(HRESULT *hr)
DSGrabber::DSGrabber(HRESULT *hr, BOOL _screenCast)
: mutex_buffer(NULL), preview(NULL)
, screenCast(_screenCast)
{
#ifdef _WIN32_WCE
this->graph = new DSCaptureGraph(this, hr);
#else
this->graph = new DSCaptureGraph(this, hr);
if(!FAILED(*hr)){
this->graph = screenCast ? dynamic_cast<DSBaseCaptureGraph*>(new DSScreenCastGraph(this, hr)) : dynamic_cast<DSBaseCaptureGraph*>(new DSCaptureGraph(this, hr));
if (SUCCEEDED(*hr)) {
this->preview = new DSDisplay(hr);
}
#endif
if (FAILED(*hr)){
if (FAILED(*hr)) {
TSK_DEBUG_ERROR("Failed to create Grabber");
return;
}
@ -184,6 +187,14 @@ int DSGrabber::getFramerate()
return this->fps;
}
HRESULT DSGrabber::getConnectedMediaType(AM_MEDIA_TYPE *mediaType)
{
if (!this->graph || !mediaType) {
return E_INVALIDARG;
}
return this->graph->getConnectedMediaType(mediaType);
}
HRESULT DSGrabber::SampleCB(double SampleTime, IMediaSample *pSample)
{
return S_OK;

View File

@ -20,7 +20,7 @@
#include "plugin_dshow_config.h"
#include "internals/DSCaptureGraph.h"
#include "internals/DSBaseCaptureGraph.h"
#include "internals/VideoFrame.h"
#include "tinymedia/tmedia_producer.h"
@ -42,7 +42,7 @@ class DSGrabber : public
#endif
{
public:
DSGrabber(HRESULT *hr);
DSGrabber(HRESULT *hr, BOOL screenCast);
virtual ~DSGrabber();
void setCallback(tmedia_producer_enc_cb_f callback, const void* callback_data);
@ -58,6 +58,7 @@ public:
virtual void setPluginFirefox(bool value);
virtual int getFramerate();
virtual HRESULT getConnectedMediaType(AM_MEDIA_TYPE *mediaType);
virtual HRESULT STDMETHODCALLTYPE SampleCB(double SampleTime, IMediaSample *pSample);
virtual HRESULT STDMETHODCALLTYPE BufferCB(double SampleTime, BYTE *pBuffer, long BufferLen);
@ -73,7 +74,7 @@ private:
int height;
int fps;
DSCaptureGraph *graph;
DSBaseCaptureGraph *graph;
//VideoFrame *currentFrame;
BITMAPINFOHEADER bitmapInfo;
@ -82,6 +83,7 @@ private:
tsk_mutex_handle_t *mutex_buffer;
bool first_buffer;
bool screenCast;
const void* plugin_cb_data;
tmedia_producer_enc_cb_f plugin_cb;

View File

@ -1,7 +1,5 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
* Copyright (C) 2010-2011 Mamadou DIOP.
*
* This file is part of Open Source Doubango Framework.
*

View File

@ -23,17 +23,6 @@
#include "internals/DSBufferWriter.h"
#include <streams.h>
// TODO: do it only once
#if !defined(TDSHOW_DEFINE_GUID) && !defined(_WIN32_WCE)
#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID DECLSPEC_SELECTANY name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#elif !defined(TDSHOW_DEFINE_GUID) && defined(_WIN32_WCE)
#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID __declspec(selectany) name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#endif
class DSOutputStream;
// {17D9D5CB-850D-4339-B72A-F72D084D8D64}

View File

@ -174,6 +174,7 @@ bool RemoveAllFilters(IGraphBuilder *graphBuilder)
static LRESULT CALLBACK __create__WndProcWindow(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HANDLE* event = reinterpret_cast<HANDLE*>(wParam);
BOOL* isScreenCast = reinterpret_cast<BOOL*>(GetPropA(hWnd, "screnCast"));
if(event && lParam){
switch(uMsg){
@ -189,7 +190,7 @@ static LRESULT CALLBACK __create__WndProcWindow(HWND hWnd, UINT uMsg, WPARAM wPa
{
HRESULT hr;
DSGrabber** ppGrabber = reinterpret_cast<DSGrabber**>(lParam);
*ppGrabber = new DSGrabber(&hr);
*ppGrabber = new DSGrabber(&hr, *isScreenCast);
SetEvent(event);
break;
}
@ -198,11 +199,11 @@ static LRESULT CALLBACK __create__WndProcWindow(HWND hWnd, UINT uMsg, WPARAM wPa
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
int createOnCurrentThead(HWND hWnd, void** ppRet, bool display)
int createOnCurrentThead(HWND hWnd, void** ppRet, BOOL display, BOOL screnCast)
{
HRESULT hr;
if(display) *ppRet = new DSDisplay(&hr);
else *ppRet = new DSGrabber(&hr);
else *ppRet = new DSGrabber(&hr, screnCast);
if(FAILED(hr)){
TSK_DEBUG_ERROR("Failed to created DirectShow %s", display ? "Display" : "Grabber");
SAFE_DELETE_PTR(*ppRet);
@ -211,15 +212,17 @@ int createOnCurrentThead(HWND hWnd, void** ppRet, bool display)
return 0;
}
int createOnUIThead(HWND hWnd, void** ppRet, bool display)
int createOnUIThead(HWND hWnd, void** ppRet, BOOL display, BOOL screnCast)
{
static BOOL __isScreenCastFalse = FALSE;
static BOOL __isScreenCastTrue = TRUE;
if(!ppRet){
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
if(IsMainThread()){
return createOnCurrentThead(hWnd, ppRet, display);
if (IsMainThread()) {
return createOnCurrentThead(hWnd, ppRet, display, screnCast);
}
else{
TSK_DEBUG_INFO("Create DirectShow element on worker thread");
@ -237,32 +240,32 @@ int createOnUIThead(HWND hWnd, void** ppRet, bool display)
}
WNDPROC wndProc = (WNDPROC) SetWindowLongPtr(hWnd, GWL_WNDPROC, (LONG) __create__WndProcWindow);
if(!wndProc){
if (!wndProc) {
TSK_DEBUG_ERROR("SetWindowLongPtr() failed with errcode=%d", GetLastError());
return createOnCurrentThead(hWnd, ppRet, display);
return createOnCurrentThead(hWnd, ppRet, display, screnCast);
}
if(!(event = CreateEvent(NULL, TRUE, FALSE, NULL))){
if (!(event = CreateEvent(NULL, TRUE, FALSE, NULL))) {
TSK_DEBUG_ERROR("Failed to create new event");
ret = -4; goto bail;
}
if(!PostMessageA(hWnd, display ? WM_CREATE_DISPLAY_ON_UI_THREAD : WM_CREATE_GRABBER_ON_UI_THREAD, reinterpret_cast<WPARAM>(event), reinterpret_cast<LPARAM>(ppRet))){
SetPropA(hWnd, "screnCast", screnCast ? &__isScreenCastTrue : &__isScreenCastFalse);
if (!PostMessageA(hWnd, display ? WM_CREATE_DISPLAY_ON_UI_THREAD : WM_CREATE_GRABBER_ON_UI_THREAD, reinterpret_cast<WPARAM>(event), reinterpret_cast<LPARAM>(ppRet))) {
TSK_DEBUG_ERROR("PostMessageA() failed");
ret = -5; goto bail;
}
do{
do {
retWait = WaitForSingleObject(event, WM_CREATE_ON_UI_THREAD_TIMEOUT);
}
while(retryCount-- > 0 && (retWait == WAIT_TIMEOUT));
while (retryCount-- > 0 && (retWait == WAIT_TIMEOUT));
bail:
// restore
if(hWnd && wndProc){
if (hWnd && wndProc) {
SetWindowLongPtr(hWnd, GWL_WNDPROC, (LONG)wndProc);
}
if(event){
if (event) {
CloseHandle(event);
}

View File

@ -46,6 +46,7 @@
#define FILTER_WEBCAM _T("WEBCAM")
#define FILTER_SCREENCAST _T("SCREENCAST")
#define FILTER_FRAMERATE _T("TDSHOW_FRAMERATE")
#define FILTER_OUTPUT _T("TDSHOW_OUTPUT")
#define FITLER_SAMPLE_GRABBER _T("SAMPLE_GRABBER")
@ -73,8 +74,8 @@ bool DisconnectAllFilters(IGraphBuilder *graphBuilder);
bool RemoveAllFilters(IGraphBuilder *graphBuilder);
int createOnCurrentThead(HWND hWnd, void** ppRet, bool display);
int createOnCurrentThead(HWND hWnd, void** ppRet, BOOL display, BOOL screnCast);
int createOnUIThead(HWND hWnd, void** ppRet, bool display);
int createOnUIThead(HWND hWnd, void** ppRet, BOOL display, BOOL screnCast);
#endif /* PLUGIN_DSHOW_DUTILS_H */

View File

@ -18,7 +18,106 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
*/
#if !defined(RESIZER_DO_NOT_INCLUDE_HEADER)
#include "internals/Resizer.h"
#endif /* DO_NOT_INCLUDE_HEADER */
/* stretch proportions */
#define STRETCH_1_1 1
#define STRETCH_1_2 2
#define STRETCH_1_4 3
#define STRETCH_1_N 4
#define STRETCH_N_1 5
#define STRETCH_4_1 6
#define STRETCH_2_1 7
void __stdcall StretchDIB(
LPBITMAPINFOHEADER biDst, // --> BITMAPINFO of destination
LPVOID lpvDst, // --> to destination bits
int DstX, // Destination origin - x coordinate
int DstY, // Destination origin - y coordinate
int DstXE, // x extent of the BLT
int DstYE, // y extent of the BLT
LPBITMAPINFOHEADER biSrc, // --> BITMAPINFO of source
LPVOID lpvSrc, // --> to source bits
int SrcX, // Source origin - x coordinate
int SrcY, // Source origin - y coordinate
int SrcXE, // x extent of the BLT
int SrcYE // y extent of the BLT
);
/*
* an X_FUNC is a function that copies one scanline, stretching or shrinking it
* to fit a destination scanline. Pick an X_FUNC depending on
* bitdepth and stretch ratio (1:1, 1:2, 1:4, 1:N, N:1, 4:1, 2:1)
*
* the x_fract argument is the delta fraction: it is a representation
* of the smaller extent (whichever that is) as a fraction of the larger,
* and is used when stretching or shrinking to advance the pointer to the
* smaller scanline every (fract) pixels of the larger.
* Thus if we are expanding 1:8, x_fract will be 1/8, we will advance the
* source pointer once every 8 pixels, and thus copy each source pixel to
* 8 dest pixels. Note that if shrinking 8:1, x_fract will still be 1/8
* and we will use it to control advancement of the dest pointer.
* the fraction is multiplied by 65536.
*/
typedef void (*X_FUNC) (LPBYTE lpSrc,
LPBYTE lpDst,
int SrcXE,
int DstXE,
int x_fract);
void X_Stretch_1_1_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_2_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_4_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_1_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_2_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_1_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_1_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
/*
* Y_Stretch_* functions copy DstYE scanlines (using
* an X_FUNC to copy each scanline) omitting or duplicating scanlines to
* fit the destination extent. Pick a Y_ depending on the ratio
* (1:N, N:1...)
*/
void Y_Stretch_1_N(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract,
X_FUNC x_func, int nBits);
void Y_Stretch_N_1(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract,
X_FUNC x_func);
/*
* special case y-stretch functions for 1:2 in both dimensions for 8 and 16 bits
* takes no X_FUNC arg. Will do entire stretch.
*/
void Stretch_1_2_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract);
void Stretch_1_2_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract);
/* straight copy of one scanline of count bytes */
void X_CopyScanline(LPBYTE lpSrc, LPBYTE lpDst, int count);
//
// Resize function

View File

@ -65,29 +65,6 @@
#include <streams.h>
/* stretch proportions */
#define STRETCH_1_1 1
#define STRETCH_1_2 2
#define STRETCH_1_4 3
#define STRETCH_1_N 4
#define STRETCH_N_1 5
#define STRETCH_4_1 6
#define STRETCH_2_1 7
void __stdcall StretchDIB(
LPBITMAPINFOHEADER biDst, // --> BITMAPINFO of destination
LPVOID lpvDst, // --> to destination bits
int DstX, // Destination origin - x coordinate
int DstY, // Destination origin - y coordinate
int DstXE, // x extent of the BLT
int DstYE, // y extent of the BLT
LPBITMAPINFOHEADER biSrc, // --> BITMAPINFO of source
LPVOID lpvSrc, // --> to source bits
int SrcX, // Source origin - x coordinate
int SrcY, // Source origin - y coordinate
int SrcXE, // x extent of the BLT
int SrcYE // y extent of the BLT
);
void ResizeRGB( BITMAPINFOHEADER *pbiIn, //Src's BitMapInFoHeader
const unsigned char * dibBits, //Src bits
@ -96,75 +73,4 @@ void ResizeRGB( BITMAPINFOHEADER *pbiIn, //Src's BitMapInFoHeader
int iNewWidth, //new W in pixel
int iNewHeight); //new H in pixel
/*
* an X_FUNC is a function that copies one scanline, stretching or shrinking it
* to fit a destination scanline. Pick an X_FUNC depending on
* bitdepth and stretch ratio (1:1, 1:2, 1:4, 1:N, N:1, 4:1, 2:1)
*
* the x_fract argument is the delta fraction: it is a representation
* of the smaller extent (whichever that is) as a fraction of the larger,
* and is used when stretching or shrinking to advance the pointer to the
* smaller scanline every (fract) pixels of the larger.
* Thus if we are expanding 1:8, x_fract will be 1/8, we will advance the
* source pointer once every 8 pixels, and thus copy each source pixel to
* 8 dest pixels. Note that if shrinking 8:1, x_fract will still be 1/8
* and we will use it to control advancement of the dest pointer.
* the fraction is multiplied by 65536.
*/
typedef void (*X_FUNC) (LPBYTE lpSrc,
LPBYTE lpDst,
int SrcXE,
int DstXE,
int x_fract);
void X_Stretch_1_1_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_2_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_4_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_1_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_2_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_1_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_24Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_1_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_1_N_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
void X_Stretch_N_1_32Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE, int DstXE, int x_fract);
/*
* Y_Stretch_* functions copy DstYE scanlines (using
* an X_FUNC to copy each scanline) omitting or duplicating scanlines to
* fit the destination extent. Pick a Y_ depending on the ratio
* (1:N, N:1...)
*/
void Y_Stretch_1_N(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract,
X_FUNC x_func, int nBits);
void Y_Stretch_N_1(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract,
X_FUNC x_func);
/*
* special case y-stretch functions for 1:2 in both dimensions for 8 and 16 bits
* takes no X_FUNC arg. Will do entire stretch.
*/
void Stretch_1_2_8Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract);
void Stretch_1_2_16Bits(LPBYTE lpSrc, LPBYTE lpDst, int SrcXE,int SrcYE, int DstXE,
int DstYE, int SrcWidth, int DstWidth, int x_fract);
/* straight copy of one scanline of count bytes */
void X_CopyScanline(LPBYTE lpSrc, LPBYTE lpDst, int count);
#endif //RESIZER_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="pluginDirectShow"
ProjectGUID="{6A69773C-0C70-4BD4-8362-C274CAFD58F2}"
RootNamespace="pluginDirectShow"
@ -178,6 +178,10 @@
RelativePath=".\dllmain_dshow.cxx"
>
</File>
<File
RelativePath=".\plugin_screencast_dshow_producer.cxx"
>
</File>
<File
RelativePath=".\plugin_video_dshow_consumer.cxx"
>
@ -201,6 +205,10 @@
RelativePath=".\internals\DSCaptureUtils.cxx"
>
</File>
<File
RelativePath=".\internals\DSDibHelper.cxx"
>
</File>
<File
RelativePath=".\internals\DSDisplay.cxx"
>
@ -237,6 +245,14 @@
RelativePath=".\internals\DSOutputStream.cxx"
>
</File>
<File
RelativePath=".\internals\DSPushSourceDesktop.cxx"
>
</File>
<File
RelativePath=".\internals\DSScreenCastGraph.cxx"
>
</File>
<File
RelativePath=".\internals\DSUtils.cxx"
>
@ -267,6 +283,10 @@
<Filter
Name="internals"
>
<File
RelativePath=".\internals\DSBaseCaptureGraph.h"
>
</File>
<File
RelativePath=".\internals\DSBufferWriter.h"
>
@ -283,6 +303,10 @@
RelativePath=".\internals\DSCaptureUtils.h"
>
</File>
<File
RelativePath=".\internals\DSDibHelper.h"
>
</File>
<File
RelativePath=".\internals\DSDisplay.h"
>
@ -311,6 +335,14 @@
RelativePath=".\internals\DSOutputStream.h"
>
</File>
<File
RelativePath=".\internals\DSPushSource.h"
>
</File>
<File
RelativePath=".\internals\DSScreenCastGraph.h"
>
</File>
<File
RelativePath=".\internals\DSUtils.h"
>

View File

@ -82,4 +82,14 @@
#include <config.h>
#endif
#if !defined(TDSHOW_DEFINE_GUID) && !defined(_WIN32_WCE)
#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID DECLSPEC_SELECTANY name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#elif !defined(TDSHOW_DEFINE_GUID) && defined(_WIN32_WCE)
#define TDSHOW_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID __declspec(selectany) name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#endif
#endif // PLUGIN_DSHOW_CONFIG_H

View File

@ -511,8 +511,6 @@ static int _plugin_video_dshow_consumer_unprepare(plugin_video_dshow_consumer_t*
/* constructor */
static tsk_object_t* plugin_video_dshow_consumer_ctor(tsk_object_t * self, va_list * app)
{
CoInitialize(NULL);
plugin_video_dshow_consumer_t *pSelf = (plugin_video_dshow_consumer_t *)self;
if(pSelf)
{
@ -1199,7 +1197,7 @@ static int plugin_video_dshow_consumer_stop(tmedia_consumer_t* self)
/* constructor */
static tsk_object_t* plugin_video_dshow_consumer_ctor(tsk_object_t * self, va_list * app)
{
CoInitialize(NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
plugin_video_dshow_consumer_t *consumer = (plugin_video_dshow_consumer_t *)self;
if(consumer){

View File

@ -123,15 +123,17 @@ static int plugin_video_dshow_producer_start(tmedia_producer_t* self)
return -1;
}
if(producer->started){
if (producer->started) {
return 0;
}
// create grabber on UI thread
if(!producer->grabber){
if(producer->create_on_ui_thread) createOnUIThead(reinterpret_cast<HWND>((void*)DSPRODUCER(producer)->previewHwnd), (void**)&producer->grabber, false);
else createOnCurrentThead(reinterpret_cast<HWND>((void*)DSPRODUCER(producer)->previewHwnd), (void**)&producer->grabber, false);
if(!producer->grabber){
if (!producer->grabber) {
static BOOL __isDisplayFalse = FALSE;
static BOOL __isScreenCastFalse = FALSE;
if(producer->create_on_ui_thread) createOnUIThead(reinterpret_cast<HWND>((void*)DSPRODUCER(producer)->previewHwnd), (void**)&producer->grabber, __isDisplayFalse, __isScreenCastFalse);
else createOnCurrentThead(reinterpret_cast<HWND>((void*)DSPRODUCER(producer)->previewHwnd), (void**)&producer->grabber, __isDisplayFalse, __isScreenCastFalse);
if (!producer->grabber) {
TSK_DEBUG_ERROR("Failed to create grabber");
return -2;
}
@ -213,11 +215,8 @@ static int plugin_video_dshow_producer_stop(tmedia_producer_t* self)
//
/* constructor */
static tsk_object_t* plugin_video_dshow_producer_ctor(tsk_object_t * self, va_list * app)
{
CoInitialize(NULL);
plugin_video_dshow_producer_t *producer = (plugin_video_dshow_producer_t *)self;
if(producer){
{ plugin_video_dshow_producer_t *producer = (plugin_video_dshow_producer_t *)self;
if (producer) {
/* init base */
tmedia_producer_init(TMEDIA_PRODUCER(producer));
TMEDIA_PRODUCER(producer)->video.chroma = tmedia_chroma_bgr24; // RGB24 on x86 (little endians) stored as BGR24

View File

@ -0,0 +1,22 @@
lib_LTLIBRARIES = libtinyBFCP.la
libtinyBFCP_la_LIBADD = ../tinySAK/libtinySAK.la ../tinyNET/libtinyNET.la
libtinyBFCP_la_CPPFLAGS = -Iinclude -I../tinySAK/src -I../tinyNET/src
libtinyBFCP_la_SOURCES = \
src/tbfcp_attr.c\
src/tbfcp_pkt.c\
src/tbfcp_session.c\
src/tbfcp_utils.c
libtinyBFCP_la_LDFLAGS = $LDFLAGS -no-undefined
if TARGET_OS_IS_ANDROID
libtinyBFCP_la_LDFLAGS += -static
endif
_includedir = $(includedir)/tinybfcp
_include_HEADERS = include/*.h
__includedir = $(includedir)/tinybfcp/tinybfcp
__include_HEADERS = include/tinybfcp/*.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = tinyBFCP.pc

View File

@ -26,6 +26,9 @@
TBFCP_BEGIN_DECLS
struct tbfcp_session_s;
enum tbfcp_role_e;
enum tbfcp_setup_e;
struct tbfcp_pkt_s;
TINYBFCP_API int tbfcp_session_create(enum tnet_socket_type_e e_socket_type, const char* pc_local_ip, struct tbfcp_session_s** pp_self);
TINYBFCP_API int tbfcp_session_create_2(struct tnet_ice_ctx_s* p_ice_ctx, struct tbfcp_session_s** pp_self);

View File

@ -24,6 +24,10 @@
#include "tsk_common.h"
enum tnet_socket_type_e;
enum tbfcp_role_e e_role;
enum tbfcp_setup_e;
TBFCP_BEGIN_DECLS
TINYBFCP_API int tbfcp_utils_get_profile(enum tnet_socket_type_e e_socket_type, const char** ppc_profile);

View File

@ -193,7 +193,7 @@ int tbfcp_session_prepare(tbfcp_session_t* p_self)
}
else {
// create transport
if (!(p_self->p_transport = tnet_transport_create(p_self->p_local_ip, p_self->u_local_port, p_self->e_socket_type, kBfcpTransportFriendlyName))) {
if (!p_self->p_transport && !(p_self->p_transport = tnet_transport_create(p_self->p_local_ip, p_self->u_local_port, p_self->e_socket_type, kBfcpTransportFriendlyName))) {
TSK_DEBUG_ERROR("Failed to create %s Transport", kBfcpTransportFriendlyName);
return -3;
}
@ -318,6 +318,8 @@ int tbfcp_session_stop(tbfcp_session_t* p_self)
return -1;
}
// FIXME: send FloorRelease if a FloorRequest is pending
// lock()
tsk_safeobj_lock(p_self);
@ -350,6 +352,7 @@ int tbfcp_session_stop(tbfcp_session_t* p_self)
p_self->b_started = tsk_false;
p_self->b_stopping = tsk_false;
p_self->b_prepared = tsk_false;
bail:
// unlock()

View File

@ -0,0 +1,15 @@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
Name : libtinyBFCP
Description : Doubango Telecom tinyBFCP (BFCP protocol) library
Version : @PACKAGE_VERSION@
Requires:
Requires.private: tinySAK = @PACKAGE_VERSION@ tinyNET = @PACKAGE_VERSION@
Conflicts:
Cflags : -I${includedir}/tinybfcp
Libs : -L${libdir} -ltinyBFCP
Libs.private:

View File

@ -3,6 +3,7 @@ libtinyDAV_la_LIBADD = \
../tinySAK/libtinySAK.la\
../tinyNET/libtinyNET.la\
../tinySDP/libtinySDP.la\
../tinyBFCP/libtinyBFCP.la\
../tinyRTP/libtinyRTP.la\
../tinyMEDIA/libtinyMEDIA.la\
../tinyMSRP/libtinyMSRP.la\
@ -12,6 +13,7 @@ libtinyDAV_la_CPPFLAGS = -I../tinySAK/src\
-I../tinyNET/src\
-I../tinyIPSec/src\
-I../tinySDP/include\
-I../tinyBFCP/include\
-I../tinyRTP/include\
-I../tinyMEDIA/include\
-I../tinyMSRP/include\
@ -86,6 +88,8 @@ libtinyDAV_la_SOURCES += src/video/tdav_consumer_video.c \
src/video/tdav_session_video.c \
src/video/jb/tdav_video_frame.c \
src/video/jb/tdav_video_jb.c
libtinyDAV_la_SOURCES += src/bfcp/tdav_session_bfcp.c
libtinyDAV_la_SOURCES += src/t140/tdav_consumer_t140.c \
src/t140/tdav_producer_t140.c \
@ -97,6 +101,8 @@ libtinyDAV_la_SOURCES += src/msrp/tdav_consumer_msrp.c \
libtinyDAV_la_SOURCES += src/codecs/amr/tdav_codec_amr.c
libtinyDAV_la_SOURCES += src/codecs/bfcp/tdav_codec_bfcp.c
libtinyDAV_la_SOURCES += src/codecs/opus/tdav_codec_opus.c
libtinyDAV_la_SOURCES += src/codecs/g711/g711.c \

View File

@ -89,6 +89,7 @@ tdav_session_audio_t;
#define TDAV_SESSION_AUDIO(self) ((tdav_session_audio_t*)(self))
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_audio_plugin_def_t;
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcpaudio_plugin_def_t;
TDAV_END_DECLS

View File

@ -99,6 +99,7 @@ typedef struct tdav_codec_h264_common_s
profile_idc_t profile;
level_idc_t level;
unsigned maxFS;
packetization_mode_t pack_mode;
@ -128,9 +129,9 @@ static const tdav_codec_h264_common_level_size_xt tdav_codec_h264_common_level_s
{level_idc_1_2, 320, 240, 396},
{level_idc_1_3, 352, 288, 396},
{level_idc_2_0, 352, 288, 396},
{level_idc_2_1, 352, 480, 792},
{level_idc_2_2, 352, 480, 1620},
{level_idc_3_0, 720, 480, 1620},
{level_idc_2_1, 480, 352, 792}, // Swap(352x480)
{level_idc_2_2, 720, 480, 1620},
{level_idc_3_0, 720, 576, 1620},
{level_idc_3_1, 1280, 720, 3600},
{level_idc_3_2, 1280, 720, 5120},
{level_idc_4_0, 2048, 1024, 8192},
@ -154,6 +155,23 @@ static int tdav_codec_h264_common_size_from_level(level_idc_t level, unsigned *w
return -1;
}
static int tdav_codec_h264_common_size_from_fs(unsigned maxFS, unsigned *width, unsigned *height)
{
tsk_size_t i;
int ret = -1;
for (i = 0; i < sizeof(tdav_codec_h264_common_level_sizes)/sizeof(tdav_codec_h264_common_level_sizes[0]); ++i){
if (tdav_codec_h264_common_level_sizes[i].maxFS <= maxFS){
*width = tdav_codec_h264_common_level_sizes[i].width;
*height = tdav_codec_h264_common_level_sizes[i].height;
ret = 0;
}
else {
break;
}
}
return ret;
}
static int tdav_codec_h264_common_level_from_size(unsigned width, unsigned height, level_idc_t *level)
{
tsk_size_t i;
@ -173,16 +191,22 @@ static int tdav_codec_h264_common_level_from_size(unsigned width, unsigned heigh
static int tdav_codec_h264_common_init(tdav_codec_h264_common_t * h264)
{
if(h264){
if (h264) {
level_idc_t level;
// because at this step 'tmedia_codec_init()' is not called yet and we need default size to compute the H.264 level
if(TMEDIA_CODEC_VIDEO(h264)->out.width == 0 || TMEDIA_CODEC_VIDEO(h264)->in.width == 0){
if (TMEDIA_CODEC_VIDEO(h264)->out.width == 0 || TMEDIA_CODEC_VIDEO(h264)->in.width == 0) {
unsigned width, height;
tmedia_pref_video_size_t pref_size = tmedia_defaults_get_pref_video_size();
if(tmedia_video_get_size(pref_size, &width, &height) == 0){
if (tmedia_video_get_size(pref_size, &width, &height) == 0) {
TMEDIA_CODEC_VIDEO(h264)->out.width = TMEDIA_CODEC_VIDEO(h264)->in.width = width;
TMEDIA_CODEC_VIDEO(h264)->out.height = TMEDIA_CODEC_VIDEO(h264)->in.height = height;
}
}
h264->maxFS = (((TMEDIA_CODEC_VIDEO(h264)->out.width + 15) >> 4) * ((TMEDIA_CODEC_VIDEO(h264)->out.height + 15) >> 4));
if ((tdav_codec_h264_common_level_from_size(TMEDIA_CODEC_VIDEO(h264)->out.width, TMEDIA_CODEC_VIDEO(h264)->out.height, &level)) == 0){
h264->maxFS = TSK_MIN((int32_t)h264->maxFS, MaxFS[H264_LEVEL_TO_ZERO_BASED_INDEX[level]]);
h264->level = level;
}
}
return 0;
}
@ -260,18 +284,18 @@ static tsk_bool_t tdav_codec_h264_common_sdp_att_match(tdav_codec_h264_common_t*
tsk_params_L_t* params;
/* Check whether the profile match (If the profile is missing, then we consider that it's ok) */
if(tdav_codec_h264_common_get_profile_and_level(att_value, &profile, &level) != 0){
if (tdav_codec_h264_common_get_profile_and_level(att_value, &profile, &level) != 0) {
TSK_DEBUG_ERROR("Not valid profile-level: %s", att_value);
return tsk_false;
}
if(h264->profile != profile){
if (h264->profile != profile) {
return tsk_false;
}
else{
if(h264->level != level){
if (h264->level != level) {
unsigned width, height;
h264->level = TSK_MIN(h264->level, level);
if(tdav_codec_h264_common_size_from_level(h264->level, &width, &height) != 0){
if (tdav_codec_h264_common_size_from_level(h264->level, &width, &height) != 0) {
return tsk_false;
}
// Set "out" size. We must not send more than "MaxFS".
@ -290,23 +314,33 @@ static tsk_bool_t tdav_codec_h264_common_sdp_att_match(tdav_codec_h264_common_t*
if((params = tsk_params_fromstring(att_value, ";", tsk_true))){
/* === max-br ===*/
if((val_int = tsk_params_get_param_value_as_int(params, "max-br")) != -1){
if ((val_int = tsk_params_get_param_value_as_int(params, "max-br")) != -1) {
// should compare "max-br"?
TMEDIA_CODEC_VIDEO(h264)->out.max_br = val_int*1000;
}
/* === max-fs ===*/
if ((val_int = tsk_params_get_param_value_as_int(params, "max-fs")) != -1) {
unsigned width_max, height_max, maxFS;
maxFS = TSK_MIN(h264->maxFS/*preferred*/, (unsigned)val_int/*proposed*/); // make sure we'll never send more than we advertised
if (tdav_codec_h264_common_size_from_fs(maxFS, &width_max, &height_max) == 0) {
TMEDIA_CODEC_VIDEO(h264)->out.width = TMEDIA_CODEC_VIDEO(h264)->in.width = width_max;
TMEDIA_CODEC_VIDEO(h264)->out.height = TMEDIA_CODEC_VIDEO(h264)->in.height = height_max;
}
}
/* === max-mbps ===*/
if((val_int = tsk_params_get_param_value_as_int(params, "max-mbps")) != -1){
if ((val_int = tsk_params_get_param_value_as_int(params, "max-mbps")) != -1) {
// should compare "max-mbps"?
TMEDIA_CODEC_VIDEO(h264)->out.max_mbps = val_int*1000;
}
/* === packetization-mode ===*/
if((val_int = tsk_params_get_param_value_as_int(params, "packetization-mode")) != -1){
if ((val_int = tsk_params_get_param_value_as_int(params, "packetization-mode")) != -1) {
if((packetization_mode_t)val_int == Single_NAL_Unit_Mode || (packetization_mode_t)val_int == Non_Interleaved_Mode){
TDAV_CODEC_H264_COMMON(h264)->pack_mode = (packetization_mode_t)val_int;
}
else{
else {
TSK_DEBUG_INFO("packetization-mode not matching");
ret = tsk_false;
goto bail;
@ -350,14 +384,11 @@ static char* tdav_codec_h264_common_sdp_att_get(const tdav_codec_h264_common_t*
if(tsk_striequals(att_name, "fmtp")){
char* fmtp = tsk_null;
#if 1
// Required by "TANDBERG/4120 (X7.2.2)" and CISCO TelePresence
int32_t maxFS = (((TMEDIA_CODEC_VIDEO(h264)->out.width + 15) >> 4) * ((TMEDIA_CODEC_VIDEO(h264)->out.height + 15) >> 4));
maxFS = TSK_MAX(maxFS, MaxFS[H264_LEVEL_TO_ZERO_BASED_INDEX[h264->level]]);
// Required by "TANDBERG/4120 (X7.2.2)" and CISCO TelePresence
tsk_sprintf(&fmtp, "profile-level-id=%x;max-mbps=%d;max-fs=%d;packetization-mode=%d",
((h264->profile << 16) | h264->level),
MaxMBPS[H264_LEVEL_TO_ZERO_BASED_INDEX[h264->level]],
maxFS,
h264->maxFS,
h264->pack_mode
);
#else

View File

@ -1,7 +1,5 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
* Copyright (C) 2010-2011 Mamadou DIOP.
*
* This file is part of Open Source Doubango Framework.
*
@ -23,10 +21,6 @@
/**@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>
*
*/
#ifndef TINYDAV_CODEC_MSRP_H
#define TINYDAV_CODEC_MSRP_H

View File

@ -1,7 +1,5 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*

View File

@ -1,7 +1,5 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
@ -23,10 +21,6 @@
/**@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>
*
*/
#ifndef TINYDAV_SESSION_MSRP_H

View File

@ -122,6 +122,7 @@ tdav_session_video_t;
#define TDAV_SESSION_VIDEO(self) ((tdav_session_video_t*)(self))
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t;
TINYDAV_GEXTERN const tmedia_session_plugin_def_t *tdav_session_bfcpvideo_plugin_def_t;
TDAV_END_DECLS

View File

@ -888,6 +888,29 @@ static const tmedia_session_plugin_def_t tdav_session_audio_plugin_def_s =
tdav_session_audio_set_ro
};
const tmedia_session_plugin_def_t *tdav_session_audio_plugin_def_t = &tdav_session_audio_plugin_def_s;
static const tmedia_session_plugin_def_t tdav_session_bfcpaudio_plugin_def_s =
{
&tdav_session_audio_def_s,
tmedia_bfcp_audio,
"audio",
tdav_session_audio_set,
tdav_session_audio_get,
tdav_session_audio_prepare,
tdav_session_audio_start,
tdav_session_audio_pause,
tdav_session_audio_stop,
/* Audio part */
{
tdav_session_audio_send_dtmf
},
tdav_session_audio_get_lo,
tdav_session_audio_set_ro
};
const tmedia_session_plugin_def_t *tdav_session_bfcpaudio_plugin_def_t = &tdav_session_bfcpaudio_plugin_def_s;

View File

@ -417,13 +417,13 @@ int tdav_codec_amr_parse_fmtp(tdav_codec_amr_t* self, const char* fmtp)
/* === mode-set ===*/
if((val_str = tsk_params_get_param_value(params, "mode-set"))){
char* modes = tsk_strdup(val_str);
char* pch;
char *pch, *saveptr;
int mode_int;
pch = strtok(modes, ", ");
pch = tsk_strtok_r(modes, ", ", &saveptr);
while(pch){
mode_int = atoi(pch);
self->modes |= 0x0001 << mode_int;
pch = strtok(tsk_null, ", ");
pch = tsk_strtok_r(tsk_null, ", ", &saveptr);
}
TSK_FREE(modes);

View File

@ -282,6 +282,7 @@ static tsk_size_t tdav_codec_h264_encode(tmedia_codec_t* self, const void* in_da
#else
h264->encoder.picture->pict_type = send_idr ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_NONE;
#endif
h264->encoder.picture->key_frame = send_idr ? 1 : 0;
h264->encoder.picture->pts = AV_NOPTS_VALUE;
h264->encoder.picture->quality = h264->encoder.context->global_quality;
// h264->encoder.picture->pts = h264->encoder.frame_count; MUST NOT

View File

@ -1,7 +1,6 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
@ -24,9 +23,6 @@
* @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>
*
*/
#include "tinydav/codecs/msrp/tdav_codec_msrp.h"

View File

@ -32,8 +32,6 @@
#include "tsk_memory.h" /* TSK_FREE */
#include <string.h> /* strtok() */
#define TDAV_MSRP_CONNECT_TIMEOUT 2000
static void send_pending_file(tdav_session_msrp_t *session);
@ -214,18 +212,19 @@ static int init_neg_types(tdav_session_msrp_t* msrp, const tsdp_header_M_t* m)
const tsdp_header_A_t* A;
if((A = tsdp_header_M_findA(m, "accept-types"))){
char* atype = strtok((char*)A->value, " ");
char *saveptr;
char* atype = tsk_strtok_r((char*)A->value, " ", &saveptr);
const char* default_atype = atype;
while(atype){
if(tsk_striequals(atype, "message/CPIM")){
tsk_strupdate(&msrp->neg_accept_type, atype);
if((A = tsdp_header_M_findA(m, "accept-wrapped-types"))){
char* awtype = strtok((char*)A->value, " ");
char* awtype = tsk_strtok_r((char*)A->value, " ", &saveptr);
tsk_strupdate(&msrp->neg_accept_w_type, awtype); // first
}
break;
}
atype = strtok(tsk_null, " ");
atype = tsk_strtok_r(tsk_null, " ", &saveptr);
}
if(!msrp->neg_accept_type){

View File

@ -70,6 +70,7 @@ static const tsk_size_t __codec_plugins_all_count = sizeof(__codec_plugins_all)/
#include "tinydav/audio/tdav_session_audio.h"
#include "tinydav/video/tdav_session_video.h"
#include "tinydav/msrp/tdav_session_msrp.h"
#include "tinydav/bfcp/tdav_session_bfcp.h"
#include "tinydav/t140/tdav_session_t140.h"
// Codecs
@ -78,6 +79,7 @@ static const tsk_size_t __codec_plugins_all_count = sizeof(__codec_plugins_all)/
#include "tinydav/codecs/fec/tdav_codec_ulpfec.h"
#include "tinydav/codecs/fec/tdav_codec_red.h"
#include "tinydav/codecs/msrp/tdav_codec_msrp.h"
#include "tinydav/codecs/bfcp/tdav_codec_bfcp.h"
#include "tinydav/codecs/amr/tdav_codec_amr.h"
#include "tinydav/codecs/bv/tdav_codec_bv16.h"
#include "tinydav/codecs/g711/tdav_codec_g711.h"
@ -108,6 +110,7 @@ static const tsk_size_t __codec_plugins_all_count = sizeof(__codec_plugins_all)/
// Producers
#include "tinydav/audio/waveapi/tdav_producer_waveapi.h"
#include "tinydav/audio/directsound/tdav_producer_dsound.h"
#include "tinydav/video/gdi/tdav_producer_screencast_gdi.h"
#include "tinydav/audio/coreaudio/tdav_producer_audioqueue.h"
#include "tinydav/audio/coreaudio/tdav_producer_audiounit.h"
#include "tinydav/audio/wasapi/tdav_producer_wasapi.h"
@ -248,6 +251,9 @@ int tdav_init()
tmedia_session_plugin_register(tdav_session_video_plugin_def_t);
tmedia_session_plugin_register(tdav_session_msrp_plugin_def_t);
tmedia_session_plugin_register(tdav_session_t140_plugin_def_t);
tmedia_session_plugin_register(tdav_session_bfcp_plugin_def_t);
tmedia_session_plugin_register(tdav_session_bfcpaudio_plugin_def_t);
tmedia_session_plugin_register(tdav_session_bfcpvideo_plugin_def_t);
/* === Register codecs === */
#if HAVE_FFMPEG
@ -256,6 +262,7 @@ int tdav_init()
tmedia_codec_plugin_register(tdav_codec_msrp_plugin_def_t);
tmedia_codec_plugin_register(tdav_codec_t140_plugin_def_t);
tmedia_codec_plugin_register(tdav_codec_bfcp_plugin_def_t);
tmedia_codec_plugin_register(tdav_codec_red_plugin_def_t);
tmedia_codec_plugin_register(tdav_codec_g711a_plugin_def_t);
tmedia_codec_plugin_register(tdav_codec_g711u_plugin_def_t);
@ -366,7 +373,9 @@ int tdav_init()
#elif HAVE_WASAPI // WASAPI
tmedia_producer_plugin_register(tdav_producer_wasapi_plugin_def_t);
#endif
#if TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT // Windows GDI
tmedia_producer_plugin_register(tdav_producer_screencast_gdi_plugin_def_t);
#endif
#if HAVE_WINM // Windows Media (WP8)
tmedia_producer_plugin_register(tdav_producer_winm_plugin_def_t);
#endif
@ -547,6 +556,9 @@ int tdav_deinit()
tmedia_session_plugin_unregister(tdav_session_video_plugin_def_t);
tmedia_session_plugin_unregister(tdav_session_msrp_plugin_def_t);
tmedia_session_plugin_unregister(tdav_session_t140_plugin_def_t);
tmedia_session_plugin_unregister(tdav_session_bfcp_plugin_def_t);
tmedia_session_plugin_unregister(tdav_session_bfcpaudio_plugin_def_t);
tmedia_session_plugin_unregister(tdav_session_bfcpvideo_plugin_def_t);
/* === UnRegister codecs === */
tmedia_codec_plugin_unregister_all();
@ -592,6 +604,9 @@ int tdav_deinit()
#if HAVE_WASAPI // WASAPI
tmedia_producer_plugin_unregister(tdav_producer_wasapi_plugin_def_t);
#endif
#if TDAV_UNDER_WINDOWS && !TDAV_UNDER_WINDOWS_RT // Windows GDI
tmedia_producer_plugin_unregister(tdav_producer_screencast_gdi_plugin_def_t);
#endif
#if HAVE_WINM // Windows Media (WP8)
tmedia_producer_plugin_unregister(tdav_producer_winm_plugin_def_t);
#endif

View File

@ -62,7 +62,7 @@ static const tsk_bool_t __have_libsrtp = tsk_false;
#define TDAV_IS_DTMF_CODEC(codec) (codec && TMEDIA_CODEC((codec))->plugin == tdav_codec_dtmf_plugin_def_t)
#define TDAV_IS_ULPFEC_CODEC(codec) (codec && TMEDIA_CODEC((codec))->plugin == tdav_codec_ulpfec_plugin_def_t)
#define TDAV_IS_RED_CODEC(codec) (codec && TMEDIA_CODEC((codec))->plugin == tdav_codec_red_plugin_def_t)
#define TDAV_IS_VIDEO_CODEC(codec) (codec && TMEDIA_CODEC((codec))->plugin->type == tmedia_video)
#define TDAV_IS_VIDEO_CODEC(codec) (codec && TMEDIA_CODEC((codec))->plugin->type & tmedia_video)
#if !defined(TDAV_DFAULT_FP_HASH)
#define TDAV_DFAULT_FP_HASH tnet_dtls_hash_type_sha256
@ -218,8 +218,8 @@ int tdav_session_av_init(tdav_session_av_t* self, tmedia_type_t media_type)
self->use_rtcp = tmedia_defaults_get_rtcp_enabled();
self->use_rtcpmux = tmedia_defaults_get_rtcpmux_enabled();
self->avpf_mode_set = self->avpf_mode_neg = tmedia_defaults_get_avpf_mode();
self->bandwidth_max_upload_kbps = (media_type == tmedia_video ? tmedia_defaults_get_bandwidth_video_upload_max() : INT_MAX); // INT_MAX or <=0 means undefined
self->bandwidth_max_download_kbps = (media_type == tmedia_video ? tmedia_defaults_get_bandwidth_video_download_max() : INT_MAX); // INT_MAX or <=0 means undefined
self->bandwidth_max_upload_kbps = ((media_type & tmedia_video || (media_type & tmedia_bfcp_video) == tmedia_bfcp_video) ? tmedia_defaults_get_bandwidth_video_upload_max() : INT_MAX); // INT_MAX or <=0 means undefined
self->bandwidth_max_download_kbps = ((media_type & tmedia_video || (media_type & tmedia_bfcp_video) == tmedia_bfcp_video) ? tmedia_defaults_get_bandwidth_video_download_max() : INT_MAX); // INT_MAX or <=0 means undefined
self->congestion_ctrl_enabled = tmedia_defaults_get_congestion_ctrl_enabled(); // whether to enable draft-alvestrand-rtcweb-congestion-03 and draft-alvestrand-rmcat-remb-01
#if HAVE_SRTP
// this is the default value and can be updated by the user using "session_set('srtp-mode', mode_e)"
@ -246,7 +246,7 @@ int tdav_session_av_init(tdav_session_av_t* self, tmedia_type_t media_type)
}
// consumer
TSK_OBJECT_SAFE_FREE(self->consumer);
if(!(self->consumer = tmedia_consumer_create(self->media_type, session_id))){
if(!(self->consumer = tmedia_consumer_create((self->media_type & tmedia_video || (self->media_type & tmedia_bfcp_video) == tmedia_bfcp_video) ? tmedia_video : tmedia_audio, session_id))){ // get an audio (or video) consumer and ignore "bfcp" part
TSK_DEBUG_ERROR("Failed to create consumer for media type = %d", self->media_type);
}
// producer
@ -529,7 +529,7 @@ int tdav_session_av_start(tdav_session_av_t* self, const tmedia_codec_t* best_co
{
int32_t bandwidth_max_upload_kbps = self->bandwidth_max_upload_kbps;
int32_t bandwidth_max_download_kbps = self->bandwidth_max_download_kbps;
if(self->media_type == tmedia_video){
if((self->media_type & tmedia_video || (self->media_type & tmedia_bfcp_video) == tmedia_bfcp_video)){
if(self->congestion_ctrl_enabled){
const tmedia_codec_t* best_codec = tdav_session_av_get_best_neg_codec(self); // use for encoding for sure and probably for decoding
if(TDAV_IS_VIDEO_CODEC(best_codec)){
@ -541,7 +541,7 @@ int tdav_session_av_start(tdav_session_av_t* self, const tmedia_codec_t* best_co
tmedia_get_video_bandwidth_kbps_2(TMEDIA_CODEC_VIDEO(best_codec)->out.width, TMEDIA_CODEC_VIDEO(best_codec)->out.height, TMEDIA_CODEC_VIDEO(best_codec)->out.fps),
bandwidth_max_upload_kbps);
}
else if(self->media_type == tmedia_video){
else if((self->media_type & tmedia_video || (self->media_type & tmedia_bfcp_video) == tmedia_bfcp_video)){
bandwidth_max_download_kbps = TSK_MIN(tmedia_get_video_bandwidth_kbps_3(), bandwidth_max_download_kbps);
bandwidth_max_upload_kbps = TSK_MIN(tmedia_get_video_bandwidth_kbps_3(), bandwidth_max_upload_kbps);
}
@ -769,7 +769,7 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
The UE shall include the MIME subtype "telephone-event" in the "m=" media descriptor in the SDP for audio media
flows that support both audio codec and DTMF payloads in RTP packets as described in RFC 4733 [23].
*/
if(self->media_type == tmedia_audio){
if(self->media_type & tmedia_audio){
tsk_istr_t ptime;
tsk_itoa(tmedia_defaults_get_audio_ptime(), &ptime);
tsdp_header_M_add_headers(base->M.lo,
@ -781,7 +781,8 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
tsk_null);
// the "telephone-event" fmt/rtpmap is added below
}
else if(self->media_type == tmedia_video){
else if((self->media_type & tmedia_video || (self->media_type & tmedia_bfcp_video) == tmedia_bfcp_video)){
tsk_istr_t session_id;
// https://code.google.com/p/webrtc2sip/issues/detail?id=81
// goog-remb: https://groups.google.com/group/discuss-webrtc/browse_thread/thread/c61ad3487e2acd52
// rfc5104 - 7.1. Extension of the rtcp-fb Attribute
@ -790,13 +791,20 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
TSDP_HEADER_A_VA_ARGS("rtcp-fb", "* nack"),
TSDP_HEADER_A_VA_ARGS("rtcp-fb", "* goog-remb"),
tsk_null);
// https://tools.ietf.org/html/rfc4574
// http://tools.ietf.org/html/rfc4796
tsk_itoa(base->id, &session_id);
tsdp_header_M_add_headers(base->M.lo,
TSDP_HEADER_A_VA_ARGS("label", session_id),
TSDP_HEADER_A_VA_ARGS("content", (self->media_type & tmedia_bfcp) ? "slides" : "main"),
tsk_null);
// http://tools.ietf.org/html/rfc3556
if(self->bandwidth_max_download_kbps > 0 && self->bandwidth_max_download_kbps != INT_MAX){ // INT_MAX or <=0 means undefined
tsdp_header_M_add_headers(base->M.lo,
TSDP_HEADER_B_VA_ARGS("AS", self->bandwidth_max_download_kbps),
tsk_null);
}
}
}
}
else{
TSK_DEBUG_ERROR("Failed to create lo");
@ -1132,13 +1140,13 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
}
// draft-lennox-mmusic-sdp-source-attributes-01
if(self->media_type == tmedia_audio || self->media_type == tmedia_video){
if((self->media_type & tmedia_audio) || (self->media_type & tmedia_video) || ((self->media_type & tmedia_bfcp_video) == tmedia_bfcp_video)){
char* str = tsk_null;
tsk_sprintf(&str, "%u cname:%s", self->rtp_manager->rtp.ssrc.local, self->rtp_manager->rtcp.cname); // also defined in RTCP session
tsdp_header_M_add_headers(base->M.lo, TSDP_HEADER_A_VA_ARGS("ssrc", str), tsk_null);
tsk_sprintf(&str, "%u mslabel:%s", self->rtp_manager->rtp.ssrc.local, "6994f7d1-6ce9-4fbd-acfd-84e5131ca2e2");
tsdp_header_M_add_headers(base->M.lo, TSDP_HEADER_A_VA_ARGS("ssrc", str), tsk_null);
tsk_sprintf(&str, "%u label:%s", self->rtp_manager->rtp.ssrc.local, (self->media_type == tmedia_audio) ? "doubango@audio" : "doubango@video"); /* https://groups.google.com/group/discuss-webrtc/browse_thread/thread/6c44106c8ce7d6dc */
tsk_sprintf(&str, "%u label:%s", self->rtp_manager->rtp.ssrc.local, (self->media_type & tmedia_audio) ? ((base->type & tmedia_bfcp) ? "doubango@bfcpaudio" : "doubango@audio") : ((base->type & tmedia_bfcp) ? "doubango@bfcpvideo" : "doubango@video")); /* https://groups.google.com/group/discuss-webrtc/browse_thread/thread/6c44106c8ce7d6dc */
tsdp_header_M_add_headers(base->M.lo, TSDP_HEADER_A_VA_ARGS("ssrc", str), tsk_null);
TSK_FREE(str);
}
@ -1166,7 +1174,7 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
// RTCWeb
// "mid:" must not added without BUNDLE
// tsdp_header_M_add_headers(base->M.lo,
// TSDP_HEADER_A_VA_ARGS("mid", self->media_type == tmedia_audio ? "audio" : "video"),
// TSDP_HEADER_A_VA_ARGS("mid", self->media_type & tmedia_audio ? "audio" : "video"),
// tsk_null);
while((candidate = tnet_ice_ctx_get_local_candidate_at(self->ice_ctx, index++))){
@ -1187,7 +1195,7 @@ const tsdp_header_M_t* tdav_session_av_get_lo(tdav_session_av_t* self, tsk_bool_
base->M.lo->port = self->rtp_manager->rtp.public_port;
}
if(self->media_type == tmedia_audio){
if(self->media_type & tmedia_audio){
///* 3GPP TS 24.229 - 6.1.1 General
// The UE shall include the MIME subtype "telephone-event" in the "m=" media descriptor in the SDP for audio media
// flows that support both audio codec and DTMF payloads in RTP packets as described in RFC 4733 [23].
@ -2116,12 +2124,12 @@ static int _sdp_pcfgs_from_sdp(const sdp_headerM_Or_Message* sdp, sdp_acap_xt (*
}
else{
if(_sdp_str_starts_with(&A->value[index], "a=") && sscanf(pcfg, "a=%255s", a) != EOF){
char a_copy[sizeof(a)], *pch;
char a_copy[sizeof(a)], *pch, *saveptr;
tsk_size_t pcfg_acfgs_count = 0;
sdp_acap_xt* acap;
memcpy(a_copy, a, sizeof(a));
pch = strtok (a, ",[]|");
pch = tsk_strtok_r (a, ",[]|", &saveptr);
while(pch){
a_tag = atoi(pch);
if(a_tag <= 0 || a_tag + 1 >= SDP_CAPS_COUNT_MAX){
@ -2137,7 +2145,7 @@ static int _sdp_pcfgs_from_sdp(const sdp_headerM_Or_Message* sdp, sdp_acap_xt (*
acap->optional = (pch != a && a_copy[pch - a - 1] == '[') ? 1 : 0;
acap->or = (pch != a && a_copy[pch - a - 1] == '|') ? 1 : 0;
next_a:
pch = strtok (NULL, ",[]|");
pch = tsk_strtok_r(tsk_null, ",[]|", &saveptr);
}
}
tcap_curr = tsk_null;

View File

@ -63,6 +63,8 @@ int tdav_win32_init()
{
#if !TDAV_UNDER_WINDOWS_RT
MMRESULT result;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
// Timers accuracy
result = timeBeginPeriod(1);

View File

@ -1261,6 +1261,52 @@ static int _tdav_session_video_set_callbacks(tmedia_session_t* self)
return 0;
}
static int _tdav_session_video_init(tdav_session_video_t *p_self, tmedia_type_t e_media_type)
{
int ret;
tdav_session_av_t *p_base = TDAV_SESSION_AV(p_self);
if (!p_self) {
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
/* init() base */
if ((ret = tdav_session_av_init(p_base, e_media_type)) != 0) {
TSK_DEBUG_ERROR("tdav_session_av_init(video) failed");
return ret;
}
/* init() self */
p_self->jb_enabled = tmedia_defaults_get_videojb_enabled();
p_self->zero_artifacts = tmedia_defaults_get_video_zeroartifacts_enabled();
TSK_DEBUG_INFO("Video 'zero-artifacts' option = %s", p_self->zero_artifacts ? "yes" : "no");
if (!(p_self->encoder.h_mutex = tsk_mutex_create())) {
TSK_DEBUG_ERROR("Failed to create encode mutex");
return -4;
}
if (!(p_self->avpf.packets = tsk_list_create())) {
TSK_DEBUG_ERROR("Failed to create list");
return -2;
}
if (p_self->jb_enabled) {
if(!(p_self->jb = tdav_video_jb_create())) {
TSK_DEBUG_ERROR("Failed to create jitter buffer");
return -3;
}
tdav_video_jb_set_callback(p_self->jb, _tdav_session_video_jb_cb, p_self);
}
if (p_base->producer) {
tmedia_producer_set_enc_callback(p_base->producer, tdav_session_video_producer_enc_cb, p_self);
tmedia_producer_set_raw_callback(p_base->producer, tdav_session_video_raw_cb, p_self);
}
p_self->avpf.max = tmedia_defaults_get_avpf_tail_min();
p_self->encoder.pkt_loss_level = tdav_session_video_pkt_loss_level_low;
p_self->encoder.pkt_loss_prob_bad = 0; // honor first report
p_self->encoder.pkt_loss_prob_good = TDAV_SESSION_VIDEO_PKT_LOSS_PROB_GOOD;
return 0;
}
//=================================================================================================
@ -1271,43 +1317,9 @@ static tsk_object_t* tdav_session_video_ctor(tsk_object_t * self, va_list * app)
{
tdav_session_video_t *video = self;
if(video){
int ret;
tdav_session_av_t *base = TDAV_SESSION_AV(self);
/* init() base */
if((ret = tdav_session_av_init(base, tmedia_video)) != 0){
TSK_DEBUG_ERROR("tdav_session_av_init(video) failed");
if (_tdav_session_video_init(video, tmedia_video)) {
return tsk_null;
}
/* init() self */
video->jb_enabled = tmedia_defaults_get_videojb_enabled();
video->zero_artifacts = tmedia_defaults_get_video_zeroartifacts_enabled();
TSK_DEBUG_INFO("Video 'zero-artifacts' option = %s", video->zero_artifacts ? "yes" : "no");
if(!(video->encoder.h_mutex = tsk_mutex_create())){
TSK_DEBUG_ERROR("Failed to create encode mutex");
return tsk_null;
}
if(!(video->avpf.packets = tsk_list_create())){
TSK_DEBUG_ERROR("Failed to create list");
return tsk_null;
}
if(video->jb_enabled){
if(!(video->jb = tdav_video_jb_create())){
TSK_DEBUG_ERROR("Failed to create jitter buffer");
return tsk_null;
}
tdav_video_jb_set_callback(video->jb, _tdav_session_video_jb_cb, video);
}
if(base->producer){
tmedia_producer_set_enc_callback(base->producer, tdav_session_video_producer_enc_cb, self);
tmedia_producer_set_raw_callback(base->producer, tdav_session_video_raw_cb, self);
}
video->avpf.max = tmedia_defaults_get_avpf_tail_min();
video->encoder.pkt_loss_level = tdav_session_video_pkt_loss_level_low;
video->encoder.pkt_loss_prob_bad = 0; // honor first report
video->encoder.pkt_loss_prob_good = TDAV_SESSION_VIDEO_PKT_LOSS_PROB_GOOD;
}
return self;
}
@ -1385,4 +1397,58 @@ static const tmedia_session_plugin_def_t tdav_session_video_plugin_def_s =
tdav_session_video_rtcp_recv_event
}
};
const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t = &tdav_session_video_plugin_def_s;
const tmedia_session_plugin_def_t *tdav_session_video_plugin_def_t = &tdav_session_video_plugin_def_s;
//=================================================================================================
// Session BfcpVideo Plugin object definition
//
/* constructor */
static tsk_object_t* tdav_session_bfcpvideo_ctor(tsk_object_t * self, va_list * app)
{
tdav_session_video_t *video = self;
if(video){
if (_tdav_session_video_init(video, tmedia_bfcp_video)) {
return tsk_null;
}
}
return self;
}
/* object definition */
static const tsk_object_def_t tdav_session_bfcpvideo_def_s =
{
sizeof(tdav_session_video_t),
tdav_session_bfcpvideo_ctor,
tdav_session_video_dtor,
tmedia_session_cmp,
};
static const tmedia_session_plugin_def_t tdav_session_bfcpvideo_plugin_def_s =
{
&tdav_session_bfcpvideo_def_s,
tmedia_bfcp_video,
"video",
tdav_session_video_set,
tdav_session_video_get,
tdav_session_video_prepare,
tdav_session_video_start,
tdav_session_video_pause,
tdav_session_video_stop,
/* Audio part */
{ tsk_null },
tdav_session_video_get_lo,
tdav_session_video_set_ro,
/* T.140 */
{ tsk_null },
/* Rtcp */
{
tdav_session_video_rtcp_set_onevent_cbfn,
tdav_session_video_rtcp_send_event,
tdav_session_video_rtcp_recv_event
}
};
const tmedia_session_plugin_def_t *tdav_session_bfcpvideo_plugin_def_t = &tdav_session_bfcpvideo_plugin_def_s;

View File

@ -7,7 +7,7 @@ Name : libtinyDAV
Description : Doubango Telecom tinyDAV (Audio/Video) library
Version : @PACKAGE_VERSION@
Requires:
Requires.private: tinySAK = @PACKAGE_VERSION@ tinyNET = @PACKAGE_VERSION@ tinySDP = @PACKAGE_VERSION@ tinyRTP = @PACKAGE_VERSION@ tinyMEDIA = @PACKAGE_VERSION@ tinyMSRP = @PACKAGE_VERSION@
Requires.private: tinySAK = @PACKAGE_VERSION@ tinyNET = @PACKAGE_VERSION@ tinySDP = @PACKAGE_VERSION@ tinyBFCP = @PACKAGE_VERSION@ tinyRTP = @PACKAGE_VERSION@ tinyMEDIA = @PACKAGE_VERSION@ tinyMSRP = @PACKAGE_VERSION@
Conflicts:
Cflags : -I${includedir}/tinydav
Libs : -L${libdir} -ltinyDAV

View File

@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\thirdparties\common\include;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinySDP\include;..\tinyIPSec\src;..\tinyNET\src;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16"
AdditionalIncludeDirectories="..\thirdparties\common\include;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinyBFCP\include;..\tinySDP\include;..\tinyIPSec\src;..\tinyNET\src;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16"
PreprocessorDefinitions="HAVE_SRTP=1;HAVE_G729=0;HAVE_BV16=0;HAVE_OPENCORE_AMR=1;HAVE_H264=1;HAVE_ILBC=0;HAVE_LIBGSM=1;HAVE_LIBOPUS=1;HAVE_DSOUND_H=1;HAVE_WAVE_API=1;HAVE_FFMPEG=1;HAVE_SPEEX_DSP=1;HAVE_WEBRTC=1;HAVE_SPEEX_JB=1;HAVE_LIB_SPEEX=1;HAVE_LIBVPX=1;HAVE_LIBYUV=1;G192BITSTREAM=0;DEBUG_LEVEL=DEBUG_LEVEL_INFO;GOTHAM_CITY = 0;WIN32;_DEBUG;_WINDOWS;_USRDLL;_WIN32_WINNT=0x0501;TINYDAV_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -64,7 +64,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib Shlwapi.lib &quot;$(OutDir)\tinySAK.lib&quot; &quot;$(OutDir)\tinyIPSec.lib&quot; &quot;$(OutDir)\tinyNET.lib&quot; &quot;$(OutDir)\tinyRTP.lib&quot; &quot;$(OutDir)\tinyMSRP.lib&quot; &quot;$(OutDir)\tinySDP.lib&quot; &quot;$(OutDir)\tinyMEDIA.lib&quot; &quot;..\thirdparties\win32\lib\opus\libopus.a&quot; &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\libgcc.a&quot; &quot;..\thirdparties\win32\lib\libmingwex.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\webrtc\aec.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\aec_sse2.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\apm_util.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\system_wrappers.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\spl.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\ns.lib&quot; &quot;..\thirdparties\win32\lib\libyuv\libyuv.lib&quot; &quot;..\thirdparties\win32\lib\vpx\vpxmt.lib&quot;"
AdditionalDependencies="Winmm.lib Shlwapi.lib &quot;$(OutDir)\tinySAK.lib&quot; &quot;$(OutDir)\tinyIPSec.lib&quot; &quot;$(OutDir)\tinyNET.lib&quot; &quot;$(OutDir)\tinyRTP.lib&quot; &quot;$(OutDir)\tinyMSRP.lib&quot; &quot;$(OutDir)\tinySDP.lib&quot; &quot;$(OutDir)\tinyBFCP.lib&quot; &quot;$(OutDir)\tinyMEDIA.lib&quot; &quot;..\thirdparties\win32\lib\opus\libopus.a&quot; &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\libgcc.a&quot; &quot;..\thirdparties\win32\lib\libmingwex.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\webrtc\aec.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\aec_sse2.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\apm_util.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\system_wrappers.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\spl.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\ns.lib&quot; &quot;..\thirdparties\win32\lib\libyuv\libyuv.lib&quot; &quot;..\thirdparties\win32\lib\vpx\vpxmt.lib&quot;"
LinkIncremental="2"
IgnoreDefaultLibraryNames="MSVCRT;LIBCMTD;LIBCMT"
GenerateDebugInformation="true"
@ -122,7 +122,7 @@
Name="VCCLCompilerTool"
Optimization="3"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\thirdparties\common\include;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinySDP\include;..\tinyIPSec\src;..\tinyNET\src;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16"
AdditionalIncludeDirectories="..\thirdparties\common\include;..\thirdparties\win32\include;include;..\tinyMSRP\include;..\tinyRTP\include;..\tinyMEDIA\include;..\tinyBFCP\include;..\tinySDP\include;..\tinyIPSec\src;..\tinyNET\src;..\tinySAK\src;..\thirdparties\win32\include\BroadVoice16\bvcommon;..\thirdparties\win32\include\BroadVoice16\bv16"
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_WARN;WIN32;NDEBUG;_WINDOWS;_USRDLL;TINYDAV_EXPORTS;HAVE_SRTP=1;HAVE_G729=0;HAVE_BV16=0;HAVE_H264=1;HAVE_OPENCORE_AMR=1;HAVE_ILBC=0;HAVE_LIBGSM=1;HAVE_LIBOPUS=1;HAVE_DSOUND_H=1;HAVE_WAVE_API=1;HAVE_FFMPEG=1;HAVE_WEBRTC=1;HAVE_SPEEX_DSP=1;HAVE_SPEEX_JB=1;HAVE_LIB_SPEEX=1;HAVE_LIBVPX=1;HAVE_LIBYUV=1;G192BITSTREAM=0;_WIN32_WINNT=0x0501"
RuntimeLibrary="2"
EnableFunctionLevelLinking="false"
@ -144,7 +144,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib Shlwapi.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyIPSec.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinyMSRP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyMEDIA.lib &quot;..\thirdparties\win32\lib\opus\libopus.a&quot; &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; ..\thirdparties\win32\lib\libgcc.a ..\thirdparties\win32\lib\libmingwex.a &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\BroadVoice16\libbv16.a&quot; &quot;..\thirdparties\win32\lib\webrtc\aec.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\aec_sse2.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\apm_util.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\system_wrappers.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\spl.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\ns.lib&quot; &quot;..\thirdparties\win32\lib\libyuv\libyuv.lib&quot; &quot;..\thirdparties\win32\lib\vpx\vpxmt.lib&quot;"
AdditionalDependencies="Winmm.lib Shlwapi.lib $(OutDir)\tinySAK.lib $(OutDir)\tinyIPSec.lib $(OutDir)\tinyNET.lib $(OutDir)\tinyRTP.lib $(OutDir)\tinyMSRP.lib $(OutDir)\tinySDP.lib $(OutDir)\tinyBFCP.lib $(OutDir)\tinyMEDIA.lib &quot;..\thirdparties\win32\lib\opus\libopus.a&quot; &quot;..\thirdparties\win32\lib\gsm\libgsm.a&quot; &quot;..\thirdparties\win32\lib\ilbc\libiLBC.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeex.a&quot; &quot;..\thirdparties\win32\lib\speex\libspeexdsp.a&quot; ..\thirdparties\win32\lib\libgcc.a ..\thirdparties\win32\lib\libmingwex.a &quot;..\thirdparties\win32\lib\ffmpeg\libavcodec.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libavutil.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libswscale.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libx264.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libtheora.a&quot; &quot;..\thirdparties\win32\lib\ffmpeg\libogg.a&quot; &quot;..\thirdparties\win32\lib\BroadVoice16\libbv16.a&quot; &quot;..\thirdparties\win32\lib\webrtc\aec.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\aec_sse2.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\apm_util.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\system_wrappers.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\spl.lib&quot; &quot;..\thirdparties\win32\lib\webrtc\ns.lib&quot; &quot;..\thirdparties\win32\lib\libyuv\libyuv.lib&quot; &quot;..\thirdparties\win32\lib\vpx\vpxmt.lib&quot;"
LinkIncremental="1"
IgnoreDefaultLibraryNames="MSVCRTD;LIBCMT"
GenerateDebugInformation="false"
@ -391,6 +391,14 @@
>
</File>
</Filter>
<Filter
Name="bfcp"
>
<File
RelativePath=".\include\tinydav\codecs\bfcp\tdav_codec_bfcp.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="audio"
@ -512,8 +520,12 @@
>
</Filter>
<Filter
Name="directshow"
Name="gdi"
>
<File
RelativePath=".\include\tinydav\video\gdi\tdav_producer_screencast_gdi.h"
>
</File>
</Filter>
<Filter
Name="v4linux"
@ -564,6 +576,14 @@
>
</File>
</Filter>
<Filter
Name="bfcp"
>
<File
RelativePath=".\include\tinydav\bfcp\tdav_session_bfcp.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="source(*.c)"
@ -767,6 +787,14 @@
>
</File>
</Filter>
<Filter
Name="bfcp"
>
<File
RelativePath=".\src\codecs\bfcp\tdav_codec_bfcp.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="audio"
@ -888,8 +916,12 @@
>
</Filter>
<Filter
Name="directshow"
Name="gdi"
>
<File
RelativePath=".\src\video\gdi\tdav_producer_screencast_gdi.c"
>
</File>
</Filter>
<Filter
Name="v4linux"
@ -940,6 +972,14 @@
>
</File>
</Filter>
<Filter
Name="bfcp"
>
<File
RelativePath=".\src\bfcp\tdav_session_bfcp.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="resources(*.rc)"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="tinyHTTP"
ProjectGUID="{B3E45009-C7C3-4090-837C-2D30C9058443}"
RootNamespace="tinyHTTP"

View File

@ -114,6 +114,7 @@ Must starts at 96 to be conform to RFC 5761 (rtcp-mux)
#define TMEDIA_CODEC_FORMAT_MSRP "*"
#define TMEDIA_CODEC_FORMAT_BFCP "*"
@ -451,6 +452,18 @@ tmedia_codec_msrp_t;
#define tmedia_codec_msrp_init(self, name, desc) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_msrp, name, desc, "*")
#define tmedia_codec_msrp_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self))
/** BFCP codec */
typedef struct tmedia_codec_bfcp_s
{
TMEDIA_DECLARE_CODEC;
}
tmedia_codec_bfcp_t;
#define TMEDIA_DECLARE_CODEC_BFCP tmedia_codec_bfcp_t __bfcp__
#define TMEDIA_CODEC_BFCP(self) ((tmedia_codec_bfcp_t*)(self))
#define tmedia_codec_bfcp_init(self, name, desc) tmedia_codec_init(TMEDIA_CODEC(self), tmedia_bfcp, name, desc, "*")
#define tmedia_codec_bfcp_deinit(self) tmedia_codec_deinit(TMEDIA_CODEC(self))
TMEDIA_END_DECLS
#endif /* TINYMEDIA_CODEC_H */

View File

@ -52,6 +52,9 @@ typedef enum tmedia_type_e
tmedia_file = (0x01 << 4),
tmedia_t38 = (0x01 << 5),
tmedia_t140 = (0x01 << 6),
tmedia_bfcp = (0x01 << 7),
tmedia_bfcp_audio = (0x01 << 8)/*must*/ | tmedia_bfcp, /* do not add "| audio". Otherwise it will be impossible to start an "video+bfcp-audio" session. */
tmedia_bfcp_video = (0x01 << 9)/*must*/ | tmedia_bfcp, /* do not add "| video". Otherwise it will be impossible to start an "audio+bfcp-video" session. */
tmedia_msrp = (tmedia_chat | tmedia_file),
tmedia_audiovideo = (tmedia_audio | tmedia_video),

View File

@ -198,7 +198,7 @@ tmedia_session_audio_t;
#define tmedia_session_audio_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmedia_audio)
TINYMEDIA_API int tmedia_session_audio_send_dtmf(tmedia_session_audio_t* self, uint8_t event);
#define tmedia_session_audio_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self))
#define tmedia_session_audio_create() tmedia_session_create(tmed_sess_type_audio)
#define tmedia_session_audio_create() tmedia_session_create(tmedia_audio)
#define TMEDIA_DECLARE_SESSION_AUDIO tmedia_session_audio_t __session_audio__
/** Video Session */
@ -209,10 +209,10 @@ typedef struct tmedia_session_video_s
tmedia_session_video_t;
#define tmedia_session_video_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmedia_video)
#define tmedia_session_video_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self))
#define tmedia_session_video_create() tmedia_session_create(tmed_sess_type_video)
#define tmedia_session_video_create() tmedia_session_create(tmedia_video)
#define TMEDIA_DECLARE_SESSION_VIDEO tmedia_session_video_t __session_video__
/** Msrp Session */
/** MSRP Session */
struct tmedia_session_msrp_s;
struct tmsrp_event_s;
// use "struct tmsrp_event_s" instead of "tmsrp_event_t" to avoid linking aginst tinyMSRP
@ -232,9 +232,32 @@ typedef struct tmedia_session_msrp_s
tmedia_session_msrp_t;
#define tmedia_session_msrp_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmedia_msrp)
#define tmedia_session_msrp_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self))
#define tmedia_session_msrp_create() tmedia_session_create(tmed_sess_type_msrp)
#define tmedia_session_msrp_create() tmedia_session_create(tmedia_msrp)
#define TMEDIA_DECLARE_SESSION_MSRP tmedia_session_msrp_t __session_msrp__
/** BFCP Session */
struct tmedia_session_bfcp_s;
struct tbfcp_event_s;
// use "struct tbfcp_event_s" instead of "tbfcp_event_t" to avoid linking aginst tinyBFCP
typedef int (*tmedia_session_bfcp_cb_f)(const struct tbfcp_event_s* event);
typedef struct tmedia_session_bfcp_s
{
TMEDIA_DECLARE_SESSION;
struct {
tmedia_session_bfcp_cb_f func;
const void* data;
} callback;
// int (* share_file) (struct tmedia_session_bfcp_s*, const char* path, va_list *app);
// int (* share_screen) (struct tmedia_session_bfcp_s*, const tmedia_params_L_t *params);
}
tmedia_session_bfcp_t;
#define tmedia_session_bfcp_init(self) tmedia_session_init(TMEDIA_SESSION(self), tmedia_bfcp)
#define tmedia_session_bfcp_deinit(self) tmedia_session_deinit(TMEDIA_SESSION(self))
#define tmedia_session_bfcp_create() tmedia_session_create(tmedia_bfcp)
#define TMEDIA_DECLARE_SESSION_BFCP tmedia_session_bfcp_t __session_bfcp__
/** T.140 session */
int tmedia_session_t140_set_ondata_cbfn(tmedia_session_t* self, const void* context, tmedia_session_t140_ondata_cb_f func);
int tmedia_session_t140_send_data(tmedia_session_t* self, enum tmedia_t140_data_type_e data_type, const void* data_ptr, unsigned data_size);
@ -331,7 +354,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_MANAGER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_MANAGER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_MANAGER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(tmedia_none, tmedia_ppt_manager, tmedia_pvt_int64, KEY_STR, VALUE_PINT64)
/* Any Session */
/* ANY Session */
#define TMEDIA_SESSION_SET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_int32, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_SET_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pobject, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_SET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pchar, KEY_STR, VALUE_STR)
@ -340,7 +363,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_GET_PVOID(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_GET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_GET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_session, tmedia_pvt_int64, KEY_STR, VALUE_PINT64)
/* Audio Session */
/* AUDIO Session */
#define TMEDIA_SESSION_AUDIO_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_audio, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_AUDIO_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_audio, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_AUDIO_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_audio, KEY_STR, VALUE_STR)
@ -349,7 +372,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_AUDIO_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_audio, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_AUDIO_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_audio, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_AUDIO_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_audio, KEY_STR, VALUE_PINT64)
/* Video Session */
/* VIDEO Session */
#define TMEDIA_SESSION_VIDEO_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_video, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_VIDEO_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_video, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_VIDEO_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_video, KEY_STR, VALUE_STR)
@ -358,7 +381,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_VIDEO_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_video, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_VIDEO_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_video, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_VIDEO_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_video, KEY_STR, VALUE_PINT64)
/* Msrp Session */
/* MSRP Session */
#define TMEDIA_SESSION_MSRP_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_msrp, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_MSRP_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_msrp, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_MSRP_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_msrp, KEY_STR, VALUE_STR)
@ -367,7 +390,16 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_MSRP_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_msrp, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_MSRP_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_msrp, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_MSRP_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_msrp, KEY_STR, VALUE_PINT64)
/* Any Consumer */
/* BFCP Session */
#define TMEDIA_SESSION_BFCP_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_INT32(tmedia_bfcp, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_BFCP_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_POBJECT(tmedia_bfcp, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_BFCP_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_STR(tmedia_bfcp, KEY_STR, VALUE_STR)
#define TMEDIA_SESSION_BFCP_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_SET_INT64(tmedia_bfcp, KEY_STR, VALUE_INT64)
#define TMEDIA_SESSION_BFCP_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_GET_INT32(tmedia_bfcp, KEY_STR, VALUE_PINT32)
//#define TMEDIA_SESSION_BFCP_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PVOID(tmedia_bfcp, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_BFCP_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_STR(tmedia_bfcp, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_BFCP_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_INT64(tmedia_bfcp, KEY_STR, VALUE_PINT64)
/* ANY Consumer */
#define TMEDIA_SESSION_CONSUMER_SET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_int32, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_CONSUMER_SET_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pobject, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_CONSUMER_SET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pchar, KEY_STR, VALUE_STR)
@ -376,7 +408,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_CONSUMER_GET_PVOID(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_CONSUMER_GET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_CONSUMER_GET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_consumer, tmedia_pvt_int64, KEY_STR, VALUE_PINT64)
/* Audio Consumer */
/* AUDIO Consumer */
#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_audio, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_audio, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_AUDIO_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_audio, KEY_STR, VALUE_STR)
@ -385,7 +417,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_audio, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_audio, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_AUDIO_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_audio, KEY_STR, VALUE_PINT64)
/* Video Consumer */
/* VIDEO Consumer */
#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_video, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_video, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_VIDEO_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_video, KEY_STR, VALUE_STR)
@ -394,7 +426,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_video, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_video, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_VIDEO_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_video, KEY_STR, VALUE_PINT64)
/* Msrp Consumer */
/* MSRP Consumer */
#define TMEDIA_SESSION_MSRP_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_msrp, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_MSRP_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_msrp, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_MSRP_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_msrp, KEY_STR, VALUE_STR)
@ -403,7 +435,17 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_msrp, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_msrp, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_MSRP_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_msrp, KEY_STR, VALUE_PINT64)
/* Any Producer */
/* BFCP Consumer */
#define TMEDIA_SESSION_BFCP_CONSUMER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_CONSUMER_SET_INT32(tmedia_bfcp, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_BFCP_CONSUMER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_CONSUMER_SET_POBJECT(tmedia_bfcp, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_BFCP_CONSUMER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_CONSUMER_SET_STR(tmedia_bfcp, KEY_STR, VALUE_STR)
#define TMEDIA_SESSION_BFCP_CONSUMER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_CONSUMER_SET_INT64(tmedia_bfcp, KEY_STR, VALUE_INT64)
#define TMEDIA_SESSION_BFCP_CONSUMER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_CONSUMER_GET_INT32(tmedia_bfcp, KEY_STR, VALUE_PINT32)
//#define TMEDIA_SESSION_BFCP_CONSUMER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_CONSUMER_GET_PVOID(tmedia_bfcp, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_BFCP_CONSUMER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_CONSUMER_GET_STR(tmedia_bfcp, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_BFCP_CONSUMER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_CONSUMER_GET_INT64(tmedia_bfcp, KEY_STR, VALUE_PINT64)
/* ANY Producer */
#define TMEDIA_SESSION_PRODUCER_SET_INT32(MEDIA_TYPE_ENUM, KEY_STR, VALUE_INT32) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_int32, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_PRODUCER_SET_POBJECT(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PTR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pobject, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_PRODUCER_SET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_STR) TMEDIA_SESSION_SET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pchar, KEY_STR, VALUE_STR)
@ -413,7 +455,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_PRODUCER_GET_PVOID(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PPTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pobject, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_PRODUCER_GET_STR(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PSTR) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_pchar, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_PRODUCER_GET_INT64(MEDIA_TYPE_ENUM, KEY_STR, VALUE_PINT64) TMEDIA_SESSION_GET_PARAM(MEDIA_TYPE_ENUM, tmedia_ppt_producer, tmedia_pvt_int64, KEY_STR, VALUE_PINT64)
/* Audio Producer */
/* AUDIO Producer */
#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_audio, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_audio, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_audio, KEY_STR, VALUE_STR)
@ -431,7 +473,7 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_video, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_video, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_VIDEO_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_video, KEY_STR, VALUE_PINT64)
/* Msrp Producer */
/* MSRP Producer */
#define TMEDIA_SESSION_MSRP_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_msrp, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_MSRP_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_msrp, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_MSRP_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_msrp, KEY_STR, VALUE_STR)
@ -440,6 +482,15 @@ tmedia_session_param_type_t;
//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_msrp, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_msrp, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_msrp, KEY_STR, VALUE_PINT64)
/* BFCP Producer */
#define TMEDIA_SESSION_BFCP_PRODUCER_SET_INT32(KEY_STR, VALUE_INT32) TMEDIA_SESSION_PRODUCER_SET_INT32(tmedia_bfcp, KEY_STR, VALUE_INT32)
#define TMEDIA_SESSION_BFCP_PRODUCER_SET_POBJECT(KEY_STR, VALUE_PTR) TMEDIA_SESSION_PRODUCER_SET_POBJECT(tmedia_bfcp, KEY_STR, VALUE_PTR)
#define TMEDIA_SESSION_BFCP_PRODUCER_SET_STR(KEY_STR, VALUE_STR) TMEDIA_SESSION_AUDIO_PRODUCER_SET_STR(tmedia_bfcp, KEY_STR, VALUE_STR)
#define TMEDIA_SESSION_BFCP_PRODUCER_SET_INT64(KEY_STR, VALUE_INT64) TMEDIA_SESSION_PRODUCER_SET_INT64(tmedia_bfcp, KEY_STR, VALUE_INT64)
#define TMEDIA_SESSION_BFCP_PRODUCER_GET_INT32(KEY_STR, VALUE_PINT32) TMEDIA_SESSION_PRODUCER_GET_INT32(tmedia_bfcp, KEY_STR, VALUE_PINT32)
//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_PVOID(KEY_STR, VALUE_PPTR) TMEDIA_SESSION_PRODUCER_GET_PVOID(tmedia_bfcp, KEY_STR, VALUE_PPTR)
//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_STR(KEY_STR, VALUE_PSTR) TMEDIA_SESSION_AUDIO_PRODUCER_GET_STR(tmedia_bfcp, KEY_STR, VALUE_PSTR)
//#define TMEDIA_SESSION_MSRP_PRODUCER_GET_INT64(KEY_STR, VALUE_PINT64) TMEDIA_SESSION_PRODUCER_GET_INT64(tmedia_bfcp, KEY_STR, VALUE_PINT64)
#define TMEDIA_SESSION_SET_NULL() tmedia_sptype_null
@ -481,6 +532,7 @@ TINYMEDIA_API int tmedia_session_mgr_send_t140_data(tmedia_session_mgr_t* self,
TINYMEDIA_API int tmedia_session_mgr_set_onrtcp_cbfn(tmedia_session_mgr_t* self, tmedia_type_t media_type, const void* context, tmedia_session_rtcp_onevent_cb_f fun);
TINYMEDIA_API int tmedia_session_mgr_send_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, enum tmedia_rtcp_event_type_e event_type, uint32_t ssrc_media);
TINYMEDIA_API int tmedia_session_mgr_recv_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media);
TINYMEDIA_API int tmedia_session_mgr_recv_rtcp_event_2(tmedia_session_mgr_t* self, tmedia_rtcp_event_type_t event_type, uint64_t session_id);
TINYMEDIA_API int tmedia_session_mgr_send_file(tmedia_session_mgr_t* self, const char* path, ...);
TINYMEDIA_API int tmedia_session_mgr_send_message(tmedia_session_mgr_t* self, const void* data, tsk_size_t size, const tmedia_params_L_t *params);
TINYMEDIA_API int tmedia_session_mgr_set_msrp_cb(tmedia_session_mgr_t* self, const void* usrdata, tmedia_session_msrp_cb_f func);

View File

@ -689,7 +689,7 @@ tmedia_codec_t* tmedia_codec_find_by_format(tmedia_codecs_L_t* codecs, const cha
*/
int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, unsigned* fps, unsigned *width, unsigned *height)
{
char *copy, *pch;
char *copy, *pch, *saveptr;
tsk_bool_t found = tsk_false;
if(tsk_strnullORempty(fmtp)){
@ -698,7 +698,7 @@ int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, unsigned* fps, un
}
copy = tsk_strdup(fmtp);
pch = strtok(copy, "; /");
pch = tsk_strtok_r(copy, "; /", &saveptr);
while(pch){
unsigned div = 0;
@ -731,13 +731,13 @@ int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, unsigned* fps, un
if(found){
//found = tsk_false;
pch = strtok(tsk_null, "; ");
pch = tsk_strtok_r(tsk_null, "; ", &saveptr);
while(pch){
if(sscanf(pch, "MaxBR=%u", maxbr) == 1){
//found = tsk_true;
break;
}
pch = strtok(tsk_null, "; /");
pch = tsk_strtok_r(tsk_null, "; /", &saveptr);
}
}
@ -745,7 +745,7 @@ int tmedia_codec_parse_fmtp(const char* fmtp, unsigned* maxbr, unsigned* fps, un
break;
}
pch = strtok(tsk_null, "; /");
pch = tsk_strtok_r(tsk_null, "; /", &saveptr);
}
TSK_FREE(copy);

View File

@ -93,7 +93,8 @@ static const tsk_size_t __plugin_def_types_count = sizeof(__plugin_def_types)/si
static const tsk_plugin_def_media_type_t __plugin_def_media_types[] =
{
tsk_plugin_def_media_type_audio,
tsk_plugin_def_media_type_video
tsk_plugin_def_media_type_video,
tsk_plugin_def_media_type_screencast
};
static const tsk_size_t __plugin_def_media_types_count = sizeof(__plugin_def_media_types)/sizeof(__plugin_def_media_types[0]);
@ -135,16 +136,25 @@ tmedia_type_t tmedia_type_from_sdp(const tsdp_message_t* sdp)
{
tmedia_type_t type = tmedia_none;
const tsdp_header_M_t* M;
const tsdp_header_A_t* A;
tsk_size_t index = 0;
const tmedia_session_plugin_def_t* plugin;
if(!sdp){
if (!sdp) {
TSK_DEBUG_ERROR("Invalid parameter");
return tmedia_none;
}
while((M = (const tsdp_header_M_t*)tsdp_message_get_headerAt(sdp, tsdp_htype_M, index++))){
if(M->port && (plugin = tmedia_session_plugin_find_by_media(M->media))){
while ((M = (const tsdp_header_M_t*)tsdp_message_get_headerAt(sdp, tsdp_htype_M, index++))) {
if (M->port && (plugin = tmedia_session_plugin_find_by_media(M->media))) {
if (plugin->type == tmedia_audio || plugin->type == tmedia_video) {
// check if it's BFCP audio/video session
// content attribute described in http://tools.ietf.org/html/rfc4796
if ((A = tsdp_header_M_findA(M, "content")) && (!tsk_striequals(A->value, "main"))) {
type |= plugin->type == tmedia_audio ? tmedia_bfcp_audio : tmedia_bfcp_video;
continue;
}
}
type |= plugin->type;
}
}

View File

@ -77,7 +77,7 @@ static tsk_bool_t __bypass_encoding_enabled = tsk_false;
static tsk_bool_t __bypass_decoding_enabled = tsk_false;
static tsk_bool_t __videojb_enabled = tsk_true;
static tsk_bool_t __video_zeroartifacts_enabled = tsk_false; // Requires from remote parties to support AVPF (RTCP-FIR/NACK/PLI)
static tsk_size_t __rtpbuff_size = 0x1FFFE; // Network buffer size use for RTP (SO_RCVBUF, SO_SNDBUF)
static tsk_size_t __rtpbuff_size = 0x1FFFE; // Network buffer size used for RTP (SO_RCVBUF, SO_SNDBUF)
static tsk_size_t __avpf_tail_min = 20; // Min size for tail used to honor RTCP-NACK requests
static tsk_size_t __avpf_tail_max = 160; // Max size for tail used to honor RTCP-NACK requests
static tmedia_mode_t __avpf_mode = tmedia_mode_optional; // Whether to use AVPF instead of AVP or negotiate. FIXME

View File

@ -1,7 +1,5 @@
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
* Copyright (C) 2010-2011 Mamadou DIOP.
*
* This file is part of Open Source Doubango Framework.
*
@ -23,9 +21,6 @@
/**@file tmedia_session.h
* @brief Base session object.
*
* @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
*
*/
#include "tinymedia/tmedia_session.h"
@ -53,7 +48,9 @@ extern const tmedia_codec_plugin_def_t* __tmedia_codec_plugins[TMED_CODEC_MAX_PL
const tmedia_session_plugin_def_t* __tmedia_session_plugins[TMED_SESSION_MAX_PLUGINS] = {0};
/* === local functions === */
static int _tmedia_session_mgr_recv_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media, uint64_t session_id);
static int _tmedia_session_mgr_load_sessions(tmedia_session_mgr_t* self);
static const tmedia_session_t* _tmedia_session_mgr_find_session_at_index(tmedia_session_mgr_t* self, tsk_size_t index);
static int _tmedia_session_mgr_clear_sessions(tmedia_session_mgr_t* self);
static int _tmedia_session_mgr_apply_params(tmedia_session_mgr_t* self);
static int _tmedia_session_prepare(tmedia_session_t* self);
@ -662,6 +659,7 @@ int _tmedia_session_load_codecs(tmedia_session_t* self)
tmedia_codec_t* codec;
const tmedia_codec_plugin_def_t* plugin;
const tsk_list_item_t* item;
tmedia_type_t type;
if(!self){
TSK_DEBUG_ERROR("Invalid parameter");
@ -678,10 +676,22 @@ int _tmedia_session_load_codecs(tmedia_session_t* self)
/* remove old codecs */
tsk_list_clear_items(self->codecs);
type = self->type;
if ((type & tmedia_bfcp_video) == tmedia_bfcp_video) {
type |= tmedia_video;
}
if ((type & tmedia_bfcp_audio) == tmedia_bfcp_audio) {
type |= tmedia_audio;
}
/* for each registered plugin create a session instance */
while((i < TMED_CODEC_MAX_PLUGINS) && (plugin = __tmedia_codec_plugins[i++])){
/* 'tmedia_codec_id_none' is used for fake codecs (e.g. dtmf or msrp) and should not be filtered beacuse of backward compatibility*/
if((plugin->type & self->type) && (plugin->codec_id == tmedia_codec_id_none || (plugin->codec_id & self->codecs_allowed))){
/* 'tmedia_codec_id_none' is used for fake codecs (e.g. dtmf, bfcp or msrp) and should not be filtered beacuse of backward compatibility*/
if((plugin->type & type) && (plugin->codec_id == tmedia_codec_id_none || (plugin->codec_id & self->codecs_allowed))){
// do not load bfcp codec for "audiobfcp" and "videobfcp" session
if ((plugin->type == tmedia_bfcp) && (type != tmedia_bfcp)) {
continue;
}
if((codec = tmedia_codec_create(plugin->format))){
if(!self->codecs){
self->codecs = tsk_list_create();
@ -1111,7 +1121,7 @@ const tsdp_message_t* tmedia_session_mgr_get_lo(tmedia_session_mgr_t* self)
else if((self->sdp.lo = tsdp_message_create_empty(self->public_addr ? self->public_addr : self->addr, self->ipv6, self->sdp.lo_ver++))){
/* Set connection "c=" */
tsdp_message_add_headers(self->sdp.lo,
TSDP_HEADER_C_VA_ARGS("IN", self->ipv6 ? "IP6" : "IP4", self->public_addr ? self->public_addr : self->addr),//FIXME
TSDP_HEADER_C_VA_ARGS("IN", self->ipv6 ? "IP6" : "IP4", self->public_addr ? self->public_addr : self->addr),
tsk_null);
}else{
self->sdp.lo_ver--;
@ -1158,6 +1168,41 @@ const tsdp_message_t* tmedia_session_mgr_get_lo(tmedia_session_mgr_t* self)
TSK_DEBUG_ERROR("Failed to get m= line for [%s] media", ms->plugin->media);
}
}
// FIXME
#if 0
{
tsdp_header_M_t* M;
M = tsdp_header_M_create("application", 49318, "RTP/AVP");
tsdp_header_M_add_headers(M,
TSDP_FMT_VA_ARGS("100"),
TSDP_HEADER_A_VA_ARGS("rtpmap", "100 H224/4800"),
TSDP_HEADER_A_VA_ARGS("sendrecv", tsk_null),
tsk_null);
tsdp_message_add_header(self->sdp.lo, TSDP_HEADER(M));
TSK_OBJECT_SAFE_FREE(M);
M = tsdp_header_M_create("application", 35313, "UDP/BFCP");
tsdp_header_M_add_headers(M,
TSDP_FMT_VA_ARGS("*"),
TSDP_HEADER_A_VA_ARGS("floorctrl", "c-s"),
TSDP_HEADER_A_VA_ARGS("setup", "actpass"),
TSDP_HEADER_A_VA_ARGS("connection", "new"),
tsk_null);
tsdp_message_add_header(self->sdp.lo, TSDP_HEADER(M));
TSK_OBJECT_SAFE_FREE(M);
M = tsdp_header_M_create("video", 49316, "RTP/AVP");
tsdp_header_M_add_headers(M,
TSDP_FMT_VA_ARGS("109"),
TSDP_HEADER_A_VA_ARGS("rtpmap", "109 H264/90000"),
TSDP_HEADER_A_VA_ARGS("fmtp", "109 profile-level-id=42801f; max-mbps=112640; max-fs=5120; sar=13"),
TSDP_HEADER_A_VA_ARGS("label", "1983"),
TSDP_HEADER_A_VA_ARGS("content", "slides"),
TSDP_HEADER_A_VA_ARGS("sendrecv", tsk_null),
tsk_null);
tsdp_message_add_header(self->sdp.lo, TSDP_HEADER(M));
TSK_OBJECT_SAFE_FREE(M);
}
#endif
ret = self->sdp.lo;
@ -1407,8 +1452,8 @@ int tmedia_session_mgr_set_ro(tmedia_session_mgr_t* self, const tsdp_message_t*
index = 0;
while((M = (const tsdp_header_M_t*)tsdp_message_get_headerAt(sdp, tsdp_htype_M, index++))){
found = tsk_false;
/* Find session by media */
if((ms = tsk_list_find_object_by_pred(self->sessions, __pred_find_session_by_media, M->media))){
/* Find session by index (must). */
if((ms = _tmedia_session_mgr_find_session_at_index(self, (index - 1))) && (tsk_striequals(tmedia_session_get_media(ms), M->media))) {
/* prepare the media session */
if(!self->started){
if(!ms->prepared && (_tmedia_session_prepare(TMEDIA_SESSION(ms)))){
@ -1436,7 +1481,7 @@ int tmedia_session_mgr_set_ro(tmedia_session_mgr_t* self, const tsdp_message_t*
}
}
if(!found && (self->sdp.lo == tsk_null)){
if(!found /*&& (self->sdp.lo == tsk_null)*/){
/* Session not supported and we are not the initial offerer ==> add ghost session */
/*
An offered stream MAY be rejected in the answer, for any reason. If
@ -1863,24 +1908,15 @@ int tmedia_session_mgr_send_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t
int tmedia_session_mgr_recv_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media)
{
tmedia_session_t* session;
tsk_list_item_t *item;
static const uint64_t __fake_session_id = 0;
return _tmedia_session_mgr_recv_rtcp_event(self, media_type, event_type, ssrc_media, __fake_session_id);
}
if(!self){
TSK_DEBUG_ERROR("Invlid parameter");
return -1;
}
tsk_list_lock(self->sessions);
tsk_list_foreach(item, self->sessions){
if(!(session = item->data) || !(session->type & media_type)){
continue;
}
tmedia_session_recv_rtcp_event(session, event_type, ssrc_media);
}
tsk_list_unlock(self->sessions);
return 0;
int tmedia_session_mgr_recv_rtcp_event_2(tmedia_session_mgr_t* self, tmedia_rtcp_event_type_t event_type, uint64_t session_id)
{
static const uint32_t __fake_ssrc_media = 0;
static const tmedia_type_t __fake_media_type = tmedia_none;
return _tmedia_session_mgr_recv_rtcp_event(self, __fake_media_type, event_type, __fake_ssrc_media, session_id);
}
int tmedia_session_mgr_send_file(tmedia_session_mgr_t* self, const char* path, ...)
@ -2003,12 +2039,36 @@ int tmedia_session_mgr_set_rfc5168_cbfn(tmedia_session_mgr_t* self, const void*
return 0;
}
static int _tmedia_session_mgr_recv_rtcp_event(tmedia_session_mgr_t* self, tmedia_type_t media_type, tmedia_rtcp_event_type_t event_type, uint32_t ssrc_media, uint64_t session_id)
{
tmedia_session_t* session;
tsk_list_item_t *item;
if(!self){
TSK_DEBUG_ERROR("Invlid parameter");
return -1;
}
tsk_list_lock(self->sessions);
tsk_list_foreach(item, self->sessions) {
if (!(session = item->data) || !((session->type & media_type) || (session->id == session_id))) {
continue;
}
tmedia_session_recv_rtcp_event(session, event_type, ssrc_media);
}
tsk_list_unlock(self->sessions);
return 0;
}
/** internal function used to load sessions */
static int _tmedia_session_mgr_load_sessions(tmedia_session_mgr_t* self)
{
tsk_size_t i = 0;
tmedia_session_t* session;
const tmedia_session_plugin_def_t* plugin;
tsk_list_lock(self->sessions);
#define has_media(media_type) (tsk_list_find_object_by_pred(self->sessions, __pred_find_session_by_type, &(media_type)))
@ -2043,9 +2103,27 @@ static int _tmedia_session_mgr_load_sessions(tmedia_session_mgr_t* self)
TMEDIA_SESSION_SET_NULL());
}
#undef has_media
tsk_list_unlock(self->sessions);
return 0;
}
static const tmedia_session_t* _tmedia_session_mgr_find_session_at_index(tmedia_session_mgr_t* self, tsk_size_t index)
{
const tmedia_session_t* ms = tsk_null;
const tsk_list_item_t *item;
tsk_size_t u = 0;
tsk_list_lock(self->sessions);
tsk_list_foreach(item, self->sessions) {
if (u++ == index) {
ms = (const tmedia_session_t*)item->data;
break;
}
}
tsk_list_unlock(self->sessions);
return ms;
}
/* internal function */
static int _tmedia_session_mgr_clear_sessions(tmedia_session_mgr_t* self)
{

View File

@ -47,7 +47,7 @@
#include "tsk_debug.h"
#include "tsk_string.h"
#include <string.h> /* strtok, strlen ... */
#include <string.h> /* strlen ... */
/** Creates a new DNS RR.
@ -217,15 +217,16 @@ int tnet_dns_rr_qname_serialize(const char* qname, tsk_buffer_t* output)
static uint8_t null = 0;
if(qname){
char* saveptr;
char* _qname = tsk_strdup(qname);
char* label = strtok(_qname, ".");
char* label = tsk_strtok_r(_qname, ".", &saveptr);
while(label){
uint8_t length = tsk_strlen(label);
tsk_buffer_append(output, &length, 1);
tsk_buffer_append(output, label, tsk_strlen(label));
label = strtok (tsk_null, ".");
label = tsk_strtok_r(tsk_null, ".", &saveptr);
}
TSK_FREE(_qname);

View File

@ -137,7 +137,7 @@ tnet_ice_candidate_t* tnet_ice_candidate_create(tnet_ice_cand_type_t type_e, tne
// @param str e.g. "1 1 udp 1 192.168.196.1 57806 typ host name video_rtcp network_name {0C0137CC-DB78-46B6-9B6C-7E097FFA79FE} username StFEVThMK2DHThkv password qkhKUDr4WqKRwZTo generation 0"
tnet_ice_candidate_t* tnet_ice_candidate_parse(const char* str)
{
char *v, *copy;
char *v, *copy, *saveptr;
int32_t k;
tnet_ice_candidate_t* candidate;
@ -153,7 +153,7 @@ tnet_ice_candidate_t* tnet_ice_candidate_parse(const char* str)
k = 0;
copy = tsk_strdup(str);
v = strtok(copy, " ");
v = tsk_strtok_r(copy, " ", &saveptr);
while(v){
switch(k){
@ -192,7 +192,7 @@ tnet_ice_candidate_t* tnet_ice_candidate_parse(const char* str)
}
case 6:
{
v = strtok(tsk_null, " ");
v = tsk_strtok_r(tsk_null, " ", &saveptr);
tsk_strupdate(&candidate->cand_type_str, v);
candidate->type_e = _tnet_ice_candtype_get_transport_type(v);
break;
@ -200,7 +200,7 @@ tnet_ice_candidate_t* tnet_ice_candidate_parse(const char* str)
default:
{
const char* name = v;
const char* value = (v = strtok(tsk_null, " "));
const char* value = (v = tsk_strtok_r(tsk_null, " ", &saveptr));
tsk_param_t* param = tsk_param_create(name, value);
if(param){
tsk_list_push_back_data(candidate->extension_att_list, (void**)&param);
@ -210,7 +210,7 @@ tnet_ice_candidate_t* tnet_ice_candidate_parse(const char* str)
}
++k;
v = strtok(tsk_null, " ");
v = tsk_strtok_r(tsk_null, " ", &saveptr);
}
if(k < 6){

View File

@ -503,7 +503,7 @@ int tnet_ice_ctx_set_concheck_timeout(tnet_ice_ctx_t* self, int64_t timeout)
int tnet_ice_ctx_set_remote_candidates(tnet_ice_ctx_t* self, const char* candidates, const char* ufrag, const char* pwd, tsk_bool_t is_controlling, tsk_bool_t is_ice_jingle)
{
int ret = 0;
char *v, *copy;
char *v, *copy, *saveptr;
tsk_size_t size, idx = 0;
tnet_ice_candidate_t* candidate;
if(!self){
@ -539,7 +539,7 @@ int tnet_ice_ctx_set_remote_candidates(tnet_ice_ctx_t* self, const char* candida
copy = tsk_strdup(candidates);
size = tsk_strlen(copy);
do{
v = strtok(&copy[idx], "\r\n");
v = tsk_strtok_r(&copy[idx], "\r\n", &saveptr);
idx += tsk_strlen(v) + 2;
if(v && (candidate = tnet_ice_candidate_parse(v))){
if(ufrag && pwd){

View File

@ -366,17 +366,13 @@ int tnet_transport_get_ip_n_port_2(const tnet_transport_handle_t *handle, tnet_i
int tnet_transport_set_natt_ctx(tnet_transport_handle_t *handle, tnet_nat_context_handle_t* natt_ctx)
{
tnet_transport_t *transport = handle;
if(transport && natt_ctx){
TSK_OBJECT_SAFE_FREE(transport->natt_ctx); // delete old
transport->natt_ctx = tsk_object_ref(natt_ctx);
return 0;
}
else{
if (!handle) {
TSK_DEBUG_ERROR("Invalid parameter");
return -1;
}
TSK_OBJECT_SAFE_FREE(((tnet_transport_t *)handle)->natt_ctx);
((tnet_transport_t *)handle)->natt_ctx = tsk_object_ref(natt_ctx);
return 0;
}
int tnet_transport_get_public_ip_n_port(const tnet_transport_handle_t *handle, tnet_fd_t fd, tnet_ip_t *ip, tnet_port_t *port)

View File

@ -1265,6 +1265,7 @@ int trtp_manager_start(trtp_manager_t* self)
}
if((ret = tnet_sockaddr_init(self->rtp.remote_ip, self->rtp.remote_port, self->transport->master->type, &self->rtp.remote_addr))){
tnet_transport_shutdown(self->transport);
TSK_OBJECT_SAFE_FREE(self->transport);
TSK_DEBUG_ERROR("Invalid RTP host:port [%s:%u]", self->rtp.remote_ip, self->rtp.remote_port);
goto bail;
}

View File

@ -120,7 +120,8 @@ int trtp_srtp_ctx_deinit(trtp_srtp_ctx_xt* ctx)
int trtp_srtp_match_line(const char* crypto_line, int32_t* tag, int32_t* crypto_type, char* key, tsk_size_t key_size)
{
char* v = strtok((char*)crypto_line, " :|;");
char* saveptr;
char* v = tsk_strtok_r((char*)crypto_line, " :|;", &saveptr);
int32_t k = 0;
while(v){
switch(k){
@ -165,7 +166,7 @@ int trtp_srtp_match_line(const char* crypto_line, int32_t* tag, int32_t* crypto_
}
}
++k;
v = strtok(tsk_null, " :|;");
v = tsk_strtok_r(tsk_null, " :|;", &saveptr);
}
return -0xF0;

View File

@ -41,7 +41,7 @@ static int tsk_objects_count = 0;
# define TSK_DEBUG_OBJECTS 0
#endif
#ifdef __GNUC__
#if defined(__GNUC__)
# define tsk_atomic_inc(_ptr_) __sync_fetch_and_add((_ptr_), 1)
# define tsk_atomic_dec(_ptr_) __sync_fetch_and_sub((_ptr_), 1)
#elif defined(_MSC_VER)

View File

@ -46,6 +46,7 @@ typedef enum tsk_plugin_def_media_type_e
tsk_plugin_def_media_type_none = 0,
tsk_plugin_def_media_type_audio = (1 << 0),
tsk_plugin_def_media_type_video = (1 << 1),
tsk_plugin_def_media_type_screencast = (1 << 2),
tsk_plugin_def_media_type_all = (~0)
}
tsk_plugin_def_media_type_t;

View File

@ -103,6 +103,19 @@ TINYSAK_API void tsk_str_to_hex(const char *str, tsk_size_t size, uint8_t* hex);
#define tsk_strequals(s1, s2) (tsk_strcmp((const char*)(s1), (const char*)(s2)) ? tsk_false : tsk_true)
#define tsk_strnequals(s1, s2, n) (tsk_strncmp((const char*)(s1), (const char*)(s2), n) ? tsk_false : tsk_true)
#define tsk_strlen(s) ((s) ? strlen((s)) : 0)
#if defined(_MSC_VER) || HAVE_STRTOK_S
# define tsk_strtok_r(str, delim, saveptr) strtok_s((str), (delim), (saveptr))
#elif HAVE_STRTOK_R
# define tsk_strtok_r strtok_r
#else
# define tsk_strtok_r(str, delim, saveptr) strtok(str, delim)
#endif
#if defined(_MSC_VER)
# define tsk_atoi64 _atoi64
#else
# define tsk_atoi64 atoll
#endif
/**@ingroup tsk_string_group
* String object.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="tinySAK"
ProjectGUID="{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}"
RootNamespace="tinySAK"

View File

@ -54,7 +54,7 @@ extern tsip_request_type_t tsip_request_get_type(const char* method);
}
action parse_seq{
TSK_PARSER_SET_INTEGER(hdr_cseq->seq);
TSK_PARSER_SET_UINT(hdr_cseq->seq);
}
action eob{

View File

@ -51,11 +51,11 @@
}
action parse_seq{
TSK_PARSER_SET_INTEGER(hdr_rack->seq);
TSK_PARSER_SET_UINT(hdr_rack->seq);
}
action parse_cseq{
TSK_PARSER_SET_INTEGER(hdr_rack->cseq);
TSK_PARSER_SET_UINT(hdr_rack->cseq);
}
action parse_method{

View File

@ -51,7 +51,7 @@
}
action parse_seq{
TSK_PARSER_SET_INTEGER(hdr_rseq->seq);
TSK_PARSER_SET_UINT(hdr_rseq->seq);
}
action eob{

View File

@ -965,18 +965,19 @@ int x0000_Any_2_Any_X_iINFO(va_list *app)
if (self->msession_mgr && TSIP_MESSAGE_HAS_CONTENT(rINFO)){
if (tsk_striequals("application/media_control+xml", TSIP_MESSAGE_CONTENT_TYPE(rINFO))){ /* rfc5168: XML Schema for Media Control */
static uint32_t __ssrc_media_fake = 0;
static tmedia_type_t __tmedia_type_video = tmedia_video;
static tmedia_type_t __tmedia_type_video = tmedia_video; // TODO: add bfcpvideo?
const char* content_ptr = (const char*)TSIP_MESSAGE_CONTENT_DATA(rINFO);
tsk_size_t content_size = (tsk_size_t)TSIP_MESSAGE_CONTENT_DATA_LENGTH(rINFO);
tsk_bool_t is_fir = tsk_false;
uint64_t sessionId = 0;
#if HAVE_LIBXML2
{
xmlDoc *pDoc;
xmlNode *pRootElement;
xmlXPathContext *pPathCtx;
xmlXPathObject *pPathObj;
static const xmlChar* __xpath_expr = (const xmlChar*)"/media_control/vc_primitive/to_encoder/picture_fast_update";
static const xmlChar* __xpath_expr_picture_fast_update = (const xmlChar*)"/media_control/vc_primitive/to_encoder/picture_fast_update";
static const xmlChar* __xpath_expr_stream_id = (const xmlChar*)"/media_control/vc_primitive/stream_id";
if (!(pDoc = xmlParseDoc(content_ptr))) {
TSK_DEBUG_ERROR("Failed to parse XML content [%s]", content_ptr);
@ -987,22 +988,31 @@ int x0000_Any_2_Any_X_iINFO(va_list *app)
xmlFreeDoc(pDoc);
return 0;
}
;
if (!(pPathCtx = xmlXPathNewContext(pDoc))) {
TSK_DEBUG_ERROR("Failed to create path context from XML content [%s]", content_ptr);
xmlFreeDoc(pDoc);
return 0;
}
if (!(pPathObj = xmlXPathEvalExpression(__xpath_expr, pPathCtx))) {
TSK_DEBUG_ERROR("Error: unable to evaluate xpath expression: %s", __xpath_expr);
xmlXPathFreeContext(pPathCtx);
// picture_fast_update
if (!(pPathObj = xmlXPathEvalExpression(__xpath_expr_picture_fast_update, pPathCtx))) {
TSK_DEBUG_ERROR("Error: unable to evaluate xpath expression: %s", __xpath_expr_picture_fast_update);
xmlXPathFreeContext(pPathCtx);
xmlFreeDoc(pDoc);
return 0;
}
is_fir = (pPathObj->type == XPATH_NODESET && pPathObj->nodesetval->nodeNr > 0);
xmlXPathFreeObject(pPathObj);
// stream_id
if (!(pPathObj = xmlXPathEvalExpression(__xpath_expr_stream_id, pPathCtx))) {
TSK_DEBUG_ERROR("Error: unable to evaluate xpath expression: %s", __xpath_expr_stream_id);
xmlXPathFreeContext(pPathCtx);
xmlFreeDoc(pDoc);
}
else if (pPathObj->type == XPATH_NODESET && pPathObj->nodesetval->nodeNr > 0 && pPathObj->nodesetval->nodeTab[0]->children && pPathObj->nodesetval->nodeTab[0]->children->content) {
sessionId = tsk_atoi64((const char*)pPathObj->nodesetval->nodeTab[0]->children->content);
}
xmlXPathFreeObject(pPathObj);
xmlXPathFreeContext(pPathCtx);
xmlFreeDoc(pDoc);
}
@ -1011,7 +1021,9 @@ int x0000_Any_2_Any_X_iINFO(va_list *app)
#endif
if (is_fir) {
TSK_DEBUG_INFO("Incoming SIP INFO(picture_fast_update)");
ret = tmedia_session_mgr_recv_rtcp_event(self->msession_mgr, __tmedia_type_video, tmedia_rtcp_event_type_fir, __ssrc_media_fake);
ret = sessionId
? tmedia_session_mgr_recv_rtcp_event_2(self->msession_mgr, tmedia_rtcp_event_type_fir, sessionId)
: tmedia_session_mgr_recv_rtcp_event(self->msession_mgr, __tmedia_type_video, tmedia_rtcp_event_type_fir, __ssrc_media_fake);
}
else {
TSK_DEBUG_INFO("Incoming SIP INFO(unknown)");
@ -1778,8 +1790,9 @@ static int tsip_dialog_invite_msession_rfc5168_cb(const void* usrdata, const str
if (self) {
if (command == tmedia_session_rfc5168_cmd_picture_fast_update) {
char* content_ptr = tsk_null;
static const char* __content_type = "application/media_control+xml";
static const void* __content_ptr =
static const void* __content_format =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"
" <media_control>\r\n"
" <vc_primitive>\r\n"
@ -1787,10 +1800,12 @@ static int tsip_dialog_invite_msession_rfc5168_cb(const void* usrdata, const str
" <picture_fast_update>\r\n"
" </picture_fast_update>\r\n"
" </to_encoder>\r\n"
" <stream_id>%llu</stream_id>\r\n"
" </vc_primitive>\r\n"
" </media_control>\r\n";
TSK_DEBUG_INFO("Media session is asking the sigaling layer to send SIP INFO('picture_fast_update')");
return send_INFO(self, __content_type, __content_ptr, tsk_strlen(__content_ptr));
tsk_sprintf(&content_ptr, __content_format, session->id);
return send_INFO(self, __content_type, content_ptr, tsk_strlen(content_ptr));
}
}
return 0;

View File

@ -203,7 +203,9 @@ int tsip_dialog_layer_shutdownAll(tsip_dialog_layer_t *self)
if(!self->shutdown.inprogress){
self->shutdown.inprogress = tsk_true;
self->shutdown.condwait = tsk_condwait_create();
if (!self->shutdown.condwait) {
self->shutdown.condwait = tsk_condwait_create();
}
}
tsk_safeobj_lock(self);

View File

@ -249,7 +249,7 @@ _match:
case 2:
/* #line 56 "./ragel/tsip_parser_header_CSeq.rl" */
{
TSK_PARSER_SET_INTEGER(hdr_cseq->seq);
TSK_PARSER_SET_UINT(hdr_cseq->seq);
}
break;
case 3:

View File

@ -256,13 +256,13 @@ _match:
case 1:
/* #line 53 "./ragel/tsip_parser_header_RAck.rl" */
{
TSK_PARSER_SET_INTEGER(hdr_rack->seq);
TSK_PARSER_SET_UINT(hdr_rack->seq);
}
break;
case 2:
/* #line 57 "./ragel/tsip_parser_header_RAck.rl" */
{
TSK_PARSER_SET_INTEGER(hdr_rack->cseq);
TSK_PARSER_SET_UINT(hdr_rack->cseq);
}
break;
case 3:

View File

@ -230,7 +230,7 @@ _match:
case 1:
/* #line 53 "./ragel/tsip_parser_header_RSeq.rl" */
{
TSK_PARSER_SET_INTEGER(hdr_rseq->seq);
TSK_PARSER_SET_UINT(hdr_rseq->seq);
}
break;
case 2:

View File

@ -21,6 +21,7 @@ UpdateVersion()
#sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\(.*)?/$VERSION_MAJOR\.$VERSION_MINOR\.$VERSION_MICRO\.$SVN_VERSION/g" $1
}
UpdateVersion tinyBFCP/version.rc
UpdateVersion tinyDAV/version.rc
UpdateVersion tinyHTTP/version.rc
UpdateVersion tinyIPSec/version.rc