In order to configure HRN, Mbus, RAT and VIC is needed.
void rx_video_codec_bps(char *srce, char *args, MBusHandler *mb);
void rx_video_codec_fps(char *srce, char *args, MBusHandler *mb);
void rx_rtp_query(char *srce, char *args, MBusHandler *mb);
void rx_video_query(char *srce, char *args, MBusHandler *mb);
void rx_video_codec(char *srce, char *args, MBusHandler *mb);
static struct mbus_cmnd_to_func mbus_cmnd_to_func_table[] = {
{"rtp.source.playout", &MBusEngine::rx_source_playout},
{"rtp.source.cname", &MBusEngine::rx_source_cname},
{"rtp.source.active", &MBusEngine::rx_source_active},
{"audio.output.powermeter", &MBusEngine::rx_powermeter},
{"audio.input.powermeter", &MBusEngine::rx_powermeter},
{"mbus.hello", &MBusEngine::rx_mbus_hello},
{"rtp.query", &MBusEngine::rx_rtp_query},
{"video.query", &MBusEngine::rx_video_query},
{"tool.vic.codec", &MBusEngine::rx_video_codec},
{"tool.vic.codec.bps", &MBusEngine::rx_video_codec_bps},
{"tool.vic.codec.fps", &MBusEngine::rx_video_codec_fps},
{NULL,NULL}
};
// This is for rtp.query command
void MBusEngine::rx_rtp_query(char *srce, char *args, MBusHandler *mb)
{
Tcl& tcl = Tcl::instance();
// This is for rtp.tool.source
tcl.evalf("rtp_source_tool {%s}", srce);
char *tool = strdup(tcl.result());
mb->send(srce, "rtp.source.tool", tool, 0);
// This is for rtp.addr
tcl.evalf("rtp_addr {%s}", srce);
char *addr = strdup(tcl.result());
mb->send(srce, "rtp.addr", addr, 0);
}
// for video.query command
void MBusEngine::rx_video_query(char *srce, char *args, MBusHandler *mb)
{
Tcl& tcl = Tcl::instance();
// This is for rtp.tool.source
tcl.evalf("video_bps {%s}", srce);
char *bps = strdup(tcl.result());
mb->send(srce, "tool.vic.codec.bps", bps, 0);
}
// for video.codec command
void MBusEngine::rx_video_codec(char *srce, char *args, MBusHandler *mb)
{
struct mbus_parser *mp;
char *codec;
mp = mbus_parse_init(args);
mbus_parse_done(mp);
}
// for tool.vic.codec.bps command
void MBusEngine::rx_video_codec_bps(char *srce, char *args, MBusHandler *mb)
{
struct mbus_parser *mp;
char *bandwidth;
char *bps;
mp = mbus_parse_init(args);
if(mbus_parse_str(mp, &bps)) {
bandwidth = strdup(mbus_decode_str(bps));
Tcl::instance().evalf("adapt_bps {%s}", bandwidth);
}
mbus_parse_done(mp);
}
// for tool.vic.codec.fps command
void MBusEngine::rx_video_codec_fps(char *srce, char *args, MBusHandler *mb)
{
struct mbus_parser *mp;
char *framerate;
char *fps;
mp = mbus_parse_init(args);
if(mbus_parse_str(mp, &fps)) {
framerate = strdup(mbus_decode_str(fps));
Tcl::instance().evalf("adapt_fps {%s}", framerate);
}
mbus_parse_done(mp);
}
# To process rtp.addr command
# It returns ip-address and port number
proc rtp_addr value {
set ret ""
global V
set net $V(data-net)
append ret [$net addr] " " [$net port] " " [$net ttl]
return $ret
}
# To process tool.vic.codec.fps command
# It gets frame rate information
proc video_bps value {
set ret [.menu.cb.frame.right.bps.scale get]
return $ret
}
# To process tool.vic.codec.bps command
# It gets bandwidth information
proc adapt_bps value {
.menu.cb.frame.right.bps.scale set $value
set_bps .menu.cb.frame.right.bps.value $value
}
# To process tool.vic.codec.fps command
# It sets frame rate information
proc adapt_fps value {
.menu.cb.frame.right.fps.scale set $value
set_fps .menu.cb.frame.right.fps.value $value
}
# To process tool.vic.codec.bps command
# It sets bandwidth information
proc set_bps { w value } {
if [have grabber] {
grabber bps $value
session data-bandwidth $value
}
$w configure -text "$value kbps"
}
# To process tool.vic.codec.fps command
# It sets frame rate information
proc set_fps { w value } {
grabber fps $value
$w configure -text "$value fps"
}
KyungTae Kim (kk521@columbia.edu)