cURL / Mailing Lists / curl-library / Single Mail

curl-library

Could someone advise me if there is a mistake in my RTSP URL or libcurl RTSP DESCRIBE C++ function?

From: Frank Chang <frank_chang91_at_hotmail.com>
Date: Sun, 19 Jul 2015 22:24:50 -0400

 Daniel, Tors, Yang-Tse or members of the esteemed libcurl mailing list:
  I am obtaining a HTTP error 400 in response to the folowing RTSP URL being processed by the function shown below.
DESCRIBE rtsp://root:pass_at_192.168.1.47/axis-media/media.amp ?videocodec=h264/
The IP camera I am using is a recent AXIS H264 camera.
The libcurl version I am using is v7.43.0
bool CHttpClientCurl::Get()
{
 // initialize curl
 CURLcode res = CURLE_OK;
 if (m_curl == NULL)
 {
  m_sError = L"CURL handle is NULL.";
  return false;
 }
 m_sBuffer.clear();
 // initialize this curl session
 curl_easy_reset(m_curl);
 char sUrl[8192];
 wcstombs(sUrl, m_sUrl.c_str(), m_sUrl.length());
 sUrl[m_sUrl.length()] = '\0';
 curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
 printf(" cURL V%s loaded\n", data->version);
 if (m_curl != NULL) {
  curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(m_curl, CURLOPT_PROTOCOLS, CURLPROTO_RTSP);
  res = curl_easy_setopt(m_curl, CURLOPT_URL, sUrl);
  
  // request server options
  printf("\nRTSP: OPTIONS %s\n", sUrl);
  curl_easy_setopt(m_curl, CURLOPT_PROTOCOLS, CURLPROTO_RTSP);
  res = curl_easy_setopt(m_curl, CURLOPT_RTSP_STREAM_URI, sUrl);
  curl_easy_setopt(m_curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE);
  curl_easy_setopt(m_curl, CURLOPT_RTSP_TRANSPORT, "RTP/AVP;unicast;client_port=64378-64379");
 // curl_easy_setopt(m_curl, CURLOPT_RTSP_SESSION_ID, "56789");
  res = curl_easy_perform(m_curl);
  int64_t nHttpCode = 0;
  curl_easy_getinfo(m_curl, CURLINFO_RESPONSE_CODE, &nHttpCode);
  m_nStatusCode = nHttpCode;
  if (res != CURLE_OK)
  {
   std::wstringstream ss;
   ss << curl_easy_strerror(res);
   m_sError = L"Error occurred - " + std::wstring(ss.str());
   return false;
  }
  else if (nHttpCode != 200)
  {
   SetErrorString(nHttpCode);
   return false;
  }
 }
 return true;
}
Could someone advise me if there is a mistake in the URL or in the C++ function?
Thank you very much.

                                               

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-07-20