@ -414,6 +414,33 @@ static void add_if_from_config(const char *name, charp_ht ht, struct interface_c
die ( " Failed to parse interface information '%s' from config file " , orig_name ) ;
}
struct transcode_config_callback_arg {
transcode_config_q q ;
} ;
static void do_transcode_config ( const char * name , charp_ht ht , struct transcode_config_callback_arg * a ) {
char * src = t_hash_table_lookup ( ht , " source " ) ;
if ( ! src )
die ( " Transcode config '%s' has no 'source' set " , name ) ;
char * dst = t_hash_table_lookup ( ht , " destination " ) ;
if ( ! dst )
die ( " Transcode config '%s' has no 'destination' set " , name ) ;
__auto_type tc = g_new0 ( struct transcode_config , 1 ) ;
tc - > name = g_strdup ( name ) ;
t_queue_push_tail ( & a - > q , tc ) ;
tc - > src = g_strdup ( src ) ;
tc - > dst = g_strdup ( dst ) ;
if ( ! codec_parse_payload_type ( & tc - > i . src , STR_PTR ( tc - > src ) ) )
die ( " Failed to parse source codec '%s' in transcode config '%s' " , src , name ) ;
if ( ! codec_parse_payload_type ( & tc - > i . dst , STR_PTR ( tc - > dst ) ) )
die ( " Failed to parse source codec '%s' in transcode config '%s' " , src , name ) ;
die ( " Transcode config '%s' has no verdict " , name ) ;
}
static bool if_addr_parse ( intf_config_q * q , char * s , struct ifaddrs * ifas ) {
str name ;
char * c ;
@ -622,6 +649,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
g_autoptr ( char ) redis_format = NULL ;
g_autoptr ( char ) templates_section = NULL ;
g_autoptr ( char ) interfaces_config = NULL ;
g_autoptr ( char ) transcode_config = NULL ;
GOptionEntry e [ ] = {
{ " table " , ' t ' , 0 , G_OPTION_ARG_INT , & rtpe_config . kernel_table , " Kernel table to use " , " INT " } ,
@ -772,6 +800,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
{ " audio-buffer-length " , 0 , 0 , G_OPTION_ARG_INT , & rtpe_config . audio_buffer_length , " Length in milliseconds of audio buffer " , " INT " } ,
{ " audio-buffer-delay " , 0 , 0 , G_OPTION_ARG_INT , & rtpe_config . audio_buffer_delay , " Initial delay in milliseconds for buffered audio " , " INT " } ,
{ " audio-player " , 0 , 0 , G_OPTION_ARG_STRING , & use_audio_player , " When to enable the internal audio player " , " on-demand|play-media|transcoding|always " } ,
{ " transcode-config " , 0 , 0 , G_OPTION_ARG_STRING , & transcode_config , " Config section to use for transcoding rules " , " STR " } ,
# endif
# ifdef HAVE_MQTT
{ " mqtt-host " , 0 , 0 , G_OPTION_ARG_STRING , & rtpe_config . mqtt_host , " Mosquitto broker host or address " , " HOST|IP " } ,
@ -824,6 +853,8 @@ static void options(int *argc, char ***argv, charp_ht templates) {
// global port-min/max may not be set yet.
intf_config_q icq = TYPED_GQUEUE_INIT ;
struct transcode_config_callback_arg tcca = { . q = TYPED_GQUEUE_INIT } ;
config_load_ext ( argc , argv , e , " - next-generation media proxy " ,
" /etc/rtpengine/rtpengine.conf " , " rtpengine " , & rtpe_config . common ,
( struct rtpenging_config_callback [ ] ) {
@ -846,6 +877,14 @@ static void options(int *argc, char ***argv, charp_ht templates) {
. callback = add_if_from_config ,
} ,
} ,
{
. type = RCC_FILE_GROUPS ,
. arg . tcca = & tcca ,
. file_groups = {
. prefix = & transcode_config ,
. callback = do_transcode_config ,
} ,
} ,
{ 0 } ,
} ) ;
@ -1297,8 +1336,9 @@ static void options(int *argc, char ***argv, charp_ht templates) {
if ( rtpe_config . ng_client_retries < = 0 )
die ( " Invalid value for 'ng-client-retries' " ) ;
// everything OK, do post-processing
rtpe_config . transcode_config = tcca . q ;
// everything OK, do post-processing
}
static void fill_initial_rtpe_cfg ( struct rtpengine_config * ini_rtpe_cfg ) {