curl-library
Re: How to get a frame of image data from rtsp stream
Date: Fri, 07 Feb 2014 16:35:40 +0000
On Fri, Feb 7, 2014, at 8:07, zy wu wrote:
> I used CURLOPT_INTERLEAVEDATA parameter to set the receive buffer, and
> used CURLOPT_INTERLEAVEFUNCTION parameter to set the callback function
The CURLOPT_INTERLEAVEFUNCTION is used for receiving RTP over RTSP. The
interleave function is called in response to performing a
CURL_RTSPREQ_RECEIVE. The perform request will usually return after RTP
over RTSP data is received. The interleave function will be given a
single RTP packet per CURL_RTSPREQ_RECEIVE perfom. So the first thing
you need to do is change a line in rtsp.c:
const char *transport = "RTP/AVP;unicast;client_port=1234-1235"; /* UDP */
to
const char *transport = "RTP/AVP/TCP;unicast;interleaved=0-1"; /* TCP */
Next add something like this after rtsp_play()
while(1)
{
my_curl_easy_setopt(curl, CURLOPT_INTERLEAVEFUNCTION, my_function);
my_curl_easy_setopt(curl, CURLOPT_INTERLEAVEDATA, my_data);
my_curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST,
(long)CURL_RTSPREQ_RECEIVE);
my_curl_easy_perform(curl);
if (res != CURLE_OK) break;
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-02-07