/* * rtsp_setup_redirect() * Sets up URLs, does the connect for redirects. Need to handle * 300 case (multiple choices). Imagine that if we had that, we'd just * loop through the body until we found a server that we could connect * with. */ int rtsp_setup_redirect (rtsp_client_t *info) { rtsp_decode_t *decode; int ret; if (info->decode_response == NULL) return (-1); info->redirect_count++; if (info->redirect_count > 5) return (-1); decode = info->decode_response; if (decode->location == NULL) return (-1); if (info->orig_url == NULL) { info->orig_url = info->url; info->url = NULL; } else { CHECK_AND_FREE(info->url); } CHECK_AND_FREE(info->server_name); rtsp_close_socket(info); ret = rtsp_dissect_url(info, decode->location); if (ret != 0) return (ret); return (rtsp_create_socket(info)); }
static void rtsp_launch_socket_loop(void) { int ret; rtsp_init_socket(); //rtsp_send_OPTIONS(); rtsp_send_DESCRIBE(); rtsp_send_SETUP(); rtsp_send_PLAY(); rtsp_send_TEARDOWN(); rtsp_close_socket(); return; }
/* * free_rtsp_client() * frees all memory associated with rtsp client information */ void free_rtsp_client (rtsp_client_t *rptr) { /*if (rptr->thread != NULL) { rtsp_close_thread(rptr); } else*/ { rtsp_close_socket(rptr); #ifdef _WINDOWS WSACleanup(); #endif } CHECK_AND_FREE(rptr->orig_url); CHECK_AND_FREE(rptr->url); CHECK_AND_FREE(rptr->server_name); CHECK_AND_FREE(rptr->cookie); free_decode_response(rptr->decode_response); rptr->decode_response = NULL; free(rptr); }
static void catcher(int sig) { rtsp_close_socket(); rtsp_close_file(); exit(1); }