cURL / Mailing Lists / curl-library / Single Mail

curl-library

Issues while writing a RTSP client example program

From: debjyoti mukherjee <debukhra_at_gmail.com>
Date: Wed, 28 Apr 2010 13:57:08 +0530

Hi
i tried to write a RTSP client program . Code looks like this,

  curl_easy_setopt(csession, CURLOPT_URL, URL);
  curl_easy_setopt(csession, CURLOPT_RTSP_STREAM_URI, URL);
  curl_easy_setopt(csession, CURLOPT_FOLLOWLOCATION, 1);
  curl_easy_setopt(csession, CURLOPT_HEADER, 1);
  curl_easy_setopt(csession, CURLOPT_WRITEFUNCTION, write_data1);
  curl_easy_setopt(csession, CURLOPT_WRITEDATA, outfile);

    //curl_easy_setopt(csession, CURLOPT_WRITEFUNCTION, write_data1);
    //curl_easy_setopt(csession, CURLOPT_WRITEDATA, outfile);
  /** retrieve OPTIONS */
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
  res = curl_easy_perform(csession);

  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "OPTIONS Response Code: %ld\n\n", rc);
  }
  else
      return -1;

  /** send DESCRIBE */
  custom_msg = curl_slist_append(custom_msg, "Accept: application/x-rtsp-mh,
application/rtsl, application/sdp");
  curl_easy_setopt(csession, CURLOPT_RTSPHEADER, custom_msg);
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_DESCRIBE);
  res = curl_easy_perform(csession);

  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "DESCRIBE Response Code: %ld\n\n", rc);
  }
  else
      return -1;

  /** send SETUP */
   sprintf (request, "RTP/AVP/TCP;unicast;client_port=%d", port);
  curl_easy_setopt(csession, CURLOPT_RTSP_TRANSPORT, request);
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
  res = curl_easy_perform(csession);

  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "SETUP Response Code: %ld\n\n", rc);
  }
  else
      return -1;

  //for (;;)
  /** send PLAY */
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY);
  res = curl_easy_perform(csession);

  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "PLAY Response Code: %ld\n\n", rc);
  }
  else
      return -1;
  /** send GET_PARAMETER */
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST,
CURL_RTSPREQ_GET_PARAMETER);
  res = curl_easy_perform(csession);
  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "GET_PARAMETER Response Code: %ld\n\n", rc);
  }
  else
      return -1;
  res = curl_easy_perform(csession);

  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "SETUP Response Code: %ld\n\n", rc);
  }
  else
      return -1;

  //for (;;)
  /** send PLAY */
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY);
  res = curl_easy_perform(csession);

  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "PLAY Response Code: %ld\n\n", rc);
  }
  else
      return -1;
  /** send GET_PARAMETER */
  curl_easy_setopt(csession, CURLOPT_RTSP_REQUEST,
CURL_RTSPREQ_GET_PARAMETER);
  res = curl_easy_perform(csession);
  res = curl_easy_getinfo(csession, CURLINFO_RESPONSE_CODE, &rc);
  if((res == CURLE_OK) && rc)
  {
      fprintf(stderr, "GET_PARAMETER Response Code: %ld\n\n", rc);
  }
  else
      return -1;

I am using Live555 server. But How do i store the MIME data after i invoke
method "PLAY"?
Can anyone help me in this?

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-28