MENU_STATE_AUTOPLUG_PLAYING_MENU,
MENU_STATE_STATIC_LINK_PLAYING_MENU,
MENU_STATE_VIDEO_TEST_MENU,
+ MENU_STATE_WEBRTC_MENU,
MENU_STATE_PRESET_MENU,
MENU_STATE_ADAPTIVE_MENU,
} menu_state_e;
typedef enum {
SUBMENU_STATE_UNKNOWN,
+ SUBMENU_STATE_GETTING_PEER_ID,
+ SUBMENU_STATE_GETTING_PROXY_ADDR,
SUBMENU_STATE_GETTING_IP,
SUBMENU_STATE_GETTING_SEEK_POS,
SUBMENU_STATE_GETTING_FILE_URI,
SUBMENU_STATE_AUTOPLUG_PLAYING_SCENARIO,
SUBMENU_STATE_STATIC_LINK_PLAYING_SCENARIO,
SUBMENU_STATE_VIDEO_TEST_SCENARIO,
+ SUBMENU_STATE_WEBRTC_SCENARIO,
SUBMENU_STATE_FORMAT,
SUBMENU_STATE_ADAPTIVE_SCENARIO,
} submenu_state_e;
SCENARIO_MODE_FILE_PLAY_MP3_AUDIO,
SCENARIO_MODE_FILE_PLAY_MP4_VIDEO,
SCENARIO_MODE_VIDEOTESTSRC_VIDEOSINK,
- SCENARIO_MODE_VIDEOTESTSRC_CAPSFILTER_VIDEOSINK
+ SCENARIO_MODE_VIDEOTESTSRC_CAPSFILTER_VIDEOSINK,
+ SCENARIO_MODE_WEBRTC_SENDRECV_VIDEO_AUDIO,
} scenario_mode_e;
#define PACKAGE "media_streamer_test"
-#define MAX_STRING_LEN 2048
-#define DEFAULT_IP_ADDR "127.0.0.1"
+#define MAX_STRING_LEN 2048
+#define DEFAULT_IP_ADDR "127.0.0.1"
#define DEFAULT_SEEK_POS 0
-#define MSEC_MULTIPLIER 1000
-#define MAX_NODES_COUNT 50
+#define MSEC_MULTIPLIER 1000
+#define MAX_NODES_COUNT 50
#define VIDEO_PORT 5000
#define AUDIO_PORT 6000
#define APPEND_NODE(x) {g_nodes[g_node_counter++] = x; }
gchar *g_broadcast_address = NULL;
+gchar *g_proxy_address = NULL;
int g_seek_pos = 0;
int g_time = 0;
+int g_peer_id = 0;
gchar *g_uri = NULL;
gchar *g_sub_uri = NULL;
gboolean g_autoplug_mode = FALSE;
gboolean g_video_is_on = FALSE;
gboolean g_audio_is_on = FALSE;
+gboolean g_use_proxy = FALSE;
+media_format_h vfmt_vp8 = NULL;
media_format_h vfmt_i420 = NULL;
media_format_h vfmt_encoded = NULL;
media_format_h vfmt_h264 = NULL;
media_format_set_video_avg_bps(vfmt_encoded, VIDEO_AVG_BPS);
media_format_set_video_max_bps(vfmt_encoded, VIDEO_MAX_BPS);
+ media_format_create(&vfmt_vp8);
+ if (media_format_set_video_mime(vfmt_vp8, MEDIA_FORMAT_VP8) != MEDIA_FORMAT_ERROR_NONE)
+ g_print("media_format_set_video_mime failed!");
+
+ media_format_set_video_width(vfmt_vp8, VIDEO_WIDTH);
+ media_format_set_video_height(vfmt_vp8, VIDEO_HIGHT);
+ media_format_set_video_avg_bps(vfmt_vp8, VIDEO_AVG_BPS);
+ media_format_set_video_max_bps(vfmt_vp8, VIDEO_MAX_BPS);
+
/* Define encoded video format for adaptive stream */
media_format_create(&vfmt_h264);
if (media_format_set_video_mime(vfmt_h264, MEDIA_FORMAT_H264_SP) != MEDIA_FORMAT_ERROR_NONE)
media_streamer_node_link(videoconverter, "src", video_sink, "sink");
}
+static void _create_webrtc_sendrec_video_audio(void)
+{
+
+}
+
static void _create_file_sub_playing(void)
{
media_streamer_node_h file_sub_src = NULL;
g_broadcast_address = NULL;
}
+ if (g_proxy_address != NULL) {
+ g_free(g_proxy_address);
+ g_proxy_address = NULL;
+ }
+
if (g_uri != NULL) {
g_free(g_uri);
g_uri = NULL;
elm_exit();
}
+static void display_getting_proxy_addr_menu(void)
+{
+ g_print("\n");
+ g_print("====================================================\n");
+ g_print("Please input your proxy address\n");
+ g_print("If you don't use proxy address, please input '0'\n");
+ g_print("0: skip\n");
+ g_print("----------------------------------------------------\n");
+}
+
+static void display_getting_peer_id_menu(void)
+{
+ g_print("\n");
+ g_print("====================================================\n");
+ g_print("If your are an offer, please input peer id\n");
+ g_print("If your are an answer, please input '0'\n");
+ g_print("0: skip\n");
+ g_print("----------------------------------------------------\n");
+}
+
static void display_getting_ip_menu(void)
{
g_print("\n");
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: Playing(Autoplug) menu v0.3\n");
+ g_print(" media streamer test: Playing(Autoplug) menu\n");
g_print("----------------------------------------------------\n");
g_print("\n");
g_print("Please select Playing Scenario mode\n");
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: Playing(static link) menu v0.3\n");
+ g_print(" media streamer test: Playing(static link) menu\n");
g_print("----------------------------------------------------\n");
g_print("\n");
g_print("Please select Playing Scenario mode\n");
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: Adaptive menu v0.3\n");
+ g_print(" media streamer test: Adaptive menu\n");
g_print("----------------------------------------------------\n");
g_print("\n");
g_print("Please select Adaptive Scenario mode\n");
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: Video test menu v0.3\n");
+ g_print(" media streamer test: Video test menu\n");
g_print("----------------------------------------------------\n");
g_print("\n");
g_print("Please select Videotest Scenario mode\n");
g_print("====================================================\n");
}
+static void display_webrtc_scenario_select_menu(void)
+{
+ g_print("\n");
+ g_print("====================================================\n");
+ g_print(" media streamer test: WebRTC menu\n");
+ g_print("----------------------------------------------------\n");
+ g_print("Please select WebRTC Scenario mode\n");
+ g_print("1. sendrecv audio and video\n");
+ g_print("b. back \n");
+ g_print("----------------------------------------------------\n");
+ g_print("====================================================\n");
+}
+
static void display_preset_menu(void)
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: Preset menu v0.3\n");
+ g_print(" media streamer test: Preset menu\n");
g_print("----------------------------------------------------\n");
g_print("1. create media streamer \n");
g_print("2. set up current preset \n");
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: VoIP menu v0.3\n");
+ g_print(" media streamer test: VoIP menu\n");
g_print("----------------------------------------------------\n");
g_print("1. one streamer VoIP 1 \n");
g_print("2. one streamer VoIP 2 \n");
{
g_print("\n");
g_print("====================================================\n");
- g_print(" media streamer test: Broadcast menu v0.3\n");
+ g_print(" media streamer test: Broadcast menu\n");
g_print("----------------------------------------------------\n");
g_print("1. Broadcast client \n");
g_print("2. Broadcast streamer \n");
{
g_print("\n");
g_print("===========================================================================\n");
- g_print(" media streamer test: Main menu v0.3\n");
+ g_print(" media streamer test: Main menu\n");
g_print("---------------------------------------------------------------------------\n");
g_print("1. Broadcast \n");
g_print("2. VOIP \n");
g_print("4. Local Playing (link: static) \n");
g_print("5. Adaptive \n");
g_print("6. Video test \n");
+ g_print("7. WebRTC \n");
g_print("t. Use TBM (select to test 3 and 4 with TBM, change ini to use H/W codec.)\n");
g_print("q. quit \n");
g_print("---------------------------------------------------------------------------\n");
case MENU_STATE_PRESET_MENU:
case MENU_STATE_ADAPTIVE_MENU:
case MENU_STATE_VIDEO_TEST_MENU:
+ case MENU_STATE_WEBRTC_MENU:
display_preset_menu();
break;
default:
}
} else {
switch (g_sub_menu_state) {
+ case SUBMENU_STATE_GETTING_PEER_ID:
+ display_getting_peer_id_menu();
+ break;
+ case SUBMENU_STATE_GETTING_PROXY_ADDR:
+ display_getting_proxy_addr_menu();
+ break;
case SUBMENU_STATE_GETTING_IP:
display_getting_ip_menu();
break;
case SUBMENU_STATE_VIDEO_TEST_SCENARIO:
display_video_test_scenario_select_menu();
break;
+ case SUBMENU_STATE_WEBRTC_SCENARIO:
+ display_webrtc_scenario_select_menu();
+ break;
default:
g_print("*** Unknown Submenu state.\n");
break;
}
}
+void run_webrtc_preset(void)
+{
+ if ((g_scenario_mode == SCENARIO_MODE_WEBRTC_SENDRECV_VIDEO_AUDIO)) {
+ create_formats();
+ _create_webrtc_sendrec_video_audio();
+ } else {
+ g_print("Invalid scenario menu preset was selected!");
+ }
+}
+
void run_video_test_preset(void)
{
if ((g_scenario_mode == SCENARIO_MODE_VIDEOTESTSRC_VIDEOSINK)) {
g_menu_state = MENU_STATE_ADAPTIVE_MENU;
else if (!strncmp(cmd, "6", len))
g_menu_state = MENU_STATE_VIDEO_TEST_MENU;
+ else if (!strncmp(cmd, "7", len))
+ g_menu_state = MENU_STATE_WEBRTC_MENU;
else if (!strncmp(cmd, "t", len)) {
use_tbm = TRUE;
g_menu_state = MENU_STATE_MAIN_MENU;
g_sub_menu_state = SUBMENU_STATE_UNKNOWN;
}
+void _interpret_webrtc_scenario_menu(char *cmd)
+{
+ int len = strlen(cmd);
+
+ if (len == 1) {
+ if (!strncmp(cmd, "1", len)) {
+ g_scenario_mode = SCENARIO_MODE_WEBRTC_SENDRECV_VIDEO_AUDIO;
+ g_printf("g_sub_menu_state (%d)\n", g_sub_menu_state);
+ }
+ }
+ g_sub_menu_state = SUBMENU_STATE_GETTING_PROXY_ADDR;
+}
+
void _interpret_scenario_menu(char *cmd)
{
int len = strlen(cmd);
}
}
+void _interpret_getting_proxy_addr_menu(char *cmd)
+{
+ int min_len = strlen("0.0.0.0");
+ int cmd_len = strlen(cmd);
+ if (g_proxy_address != NULL)
+ g_free(g_proxy_address);
+
+ if (cmd_len == 1) {
+ if (cmd[0] == '0') {
+ g_use_proxy = FALSE;
+ }
+ } else if (cmd_len > min_len) {
+ g_proxy_address = g_strdup(cmd);
+ g_print("User set proxy address set to [%s]\n", g_proxy_address);
+ } else {
+ g_print("Invalid value\n");
+ }
+ g_sub_menu_state = SUBMENU_STATE_GETTING_PEER_ID;
+}
+
+void _interpret_getting_peer_id_menu(char *cmd)
+{
+ if (strlen(cmd) ==1 && cmd[0] == 0) {
+ g_peer_id = 0;
+ g_print("WebRTC operates in answer mode.\n");
+ } else {
+ g_peer_id = strtol(cmd, NULL, 10);
+ if (g_peer_id < 0) {
+ printf("Invalid ID\n");
+ }
+ g_print("Peer id set to [%d]\n", g_peer_id);
+ g_print("WebRTC operate in offer mode.\n");
+ }
+
+ run_webrtc_preset();
+ g_sub_menu_state = SUBMENU_STATE_UNKNOWN;
+}
+
void _interpret_getting_ip_menu(char *cmd)
{
int min_len = strlen("0.0.0.0");
g_sub_menu_state = SUBMENU_STATE_ADAPTIVE_SCENARIO;
else if (g_menu_state == MENU_STATE_VIDEO_TEST_MENU)
g_sub_menu_state = SUBMENU_STATE_VIDEO_TEST_SCENARIO;
+ else if (g_menu_state == MENU_STATE_WEBRTC_MENU)
+ g_sub_menu_state = SUBMENU_STATE_WEBRTC_SCENARIO;
else
g_sub_menu_state = SUBMENU_STATE_AUTOPLUG;
} else if (!strncmp(cmd, "3", len)) {
case MENU_STATE_VIDEO_TEST_MENU:
case MENU_STATE_PRESET_MENU:
case MENU_STATE_ADAPTIVE_MENU:
+ case MENU_STATE_WEBRTC_MENU:
_interpret_preset_menu(cmd);
break;
default:
}
} else {
switch (g_sub_menu_state) {
+ case SUBMENU_STATE_GETTING_PROXY_ADDR:
+ _interpret_getting_proxy_addr_menu(cmd);
+ break;
+ case SUBMENU_STATE_GETTING_PEER_ID:
+ _interpret_getting_peer_id_menu(cmd);
+ break;
case SUBMENU_STATE_GETTING_IP:
_interpret_getting_ip_menu(cmd);
break;
case SUBMENU_STATE_VIDEO_TEST_SCENARIO:
_interpret_video_test_scenario_menu(cmd);
break;
+ case SUBMENU_STATE_WEBRTC_SCENARIO:
+ _interpret_webrtc_scenario_menu(cmd);
+ break;
default:
g_print("*** Unknown Submenu state.\n");
break;