<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 9pt;
font-family:新細明體
}
</style>
</head>
<body class='hmmessage'>
Dear All:<BR>
&nbsp;&nbsp;&nbsp;&nbsp; I have port the rtsp test program on the Fedora 11,. The following is the code and it is modified from the test.c in the previous version of gst-plugins-base. I use live555 media server to do the rtsp server. <BR>
When I built and run it, it will stop when the "PLAY" finishs. I use the sniffer and I am sure the server start to sending the data. After a while, the gst_rtsp_connection_receive return -11. Do someone help me? Thanks!<BR>
&nbsp;<BR>
&nbsp;<BR>
gstream version:0.10.24-1.fc11<BR>
gst-plugin-base version:0.10.23-3.fc11<BR>
&nbsp;<BR>
//The console display<BR>
&nbsp;<BR>
[felix@Felix-NB test_rtsp]$ ./run<BR>parsing url "rtsp://192.168.11.167/sd.ts"...<BR>&nbsp; url host: 192.168.11.167<BR>&nbsp; url port: 0<BR>&nbsp; url path: /sd.ts<BR>creating connection...<BR>opening connection...<BR>RTSP request message 0xbfe22800<BR>&nbsp;request line:<BR>&nbsp;&nbsp; method: 'DESCRIBE'<BR>&nbsp;&nbsp; uri:&nbsp;&nbsp;&nbsp; 'rtsp://192.168.11.167/sd.ts'<BR>&nbsp;&nbsp; version: '1.0'<BR>&nbsp;headers:<BR>&nbsp;&nbsp; key: 'Accept', value: 'application/sdp'<BR>&nbsp;body:<BR>RTSP response message 0xbfe227e4<BR>&nbsp;status line:<BR>&nbsp;&nbsp; code:&nbsp;&nbsp; '200'<BR>&nbsp;&nbsp; reason: 'OK'<BR>&nbsp;&nbsp; version: '1.0'<BR>&nbsp;headers:<BR>&nbsp;&nbsp; key: 'CSeq', value: '1'<BR>&nbsp;&nbsp; key: 'Date', value: 'Thu, Aug 13 2009 09:38:43 GMT'<BR>&nbsp;&nbsp; key: 'Content-Base', value: 'rtsp://192.168.11.167/sd.ts/'<BR>&nbsp;&nbsp; key: 'Content-Type', value: 'application/sdp'<BR>&nbsp;&nbsp; key: 'Content-Length', value: '376'<BR>&nbsp;body: length 377<BR>00000000 (0x87608e0): 76 3d 30 0d 0a 6f 3d 2d 20 31 32 35 30 31 34 37&nbsp; v=0..o=- 1250147<BR>00000010 (0x87608f0): 39 39 39 36 39 38 31 34 32 20 31 20 49 4e 20 49&nbsp; 999698142 1 IN I<BR>00000020 (0x8760900): 50 34 20 31 30 2e 31 34 34 2e 32 34 2e 38 0d 0a&nbsp; P4 10.144.24.8..<BR>00000030 (0x8760910): 73 3d 4d 50 45 47 20 54 72 61 6e 73 70 6f 72 74&nbsp; s=MPEG Transport<BR>00000040 (0x8760920): 20 53 74 72 65 61 6d 2c 20 73 74 72 65 61 6d 65&nbsp;&nbsp; Stream, streame<BR>00000050 (0x8760930): 64 20 62 79 20 74 68 65 20 4c 49 56 45 35 35 35&nbsp; d by the LIVE555<BR>00000060 (0x8760940): 20 4d 65 64 69 61 20 53 65 72 76 65 72 0d 0a 69&nbsp;&nbsp; Media Server..i<BR>00000070 (0x8760950): 3d 73 64 2e 74 73 0d 0a 74 3d 30 20 30 0d 0a 61&nbsp; =sd.ts..t=0 0..a<BR>00000080 (0x8760960): 3d 74 6f 6f 6c 3a 4c 49 56 45 35 35 35 20 53 74&nbsp; =tool:LIVE555 St<BR>00000090 (0x8760970): 72 65 61 6d 69 6e 67 20 4d 65 64 69 61 20 76 32&nbsp; reaming Media v2<BR>000000a0 (0x8760980): 30 30 39 2e 30 37 2e 30 39 0d 0a 61 3d 74 79 70&nbsp; 009.07.09..a=typ<BR>000000b0 (0x8760990): 65 3a 62 72 6f 61 64 63 61 73 74 0d 0a 61 3d 63&nbsp; e:broadcast..a=c<BR>000000c0 (0x87609a0): 6f 6e 74 72 6f 6c 3a 2a 0d 0a 61 3d 72 61 6e 67&nbsp; ontrol:*..a=rang<BR>000000d0 (0x87609b0): 65 3a 6e 70 74 3d 30 2d 0d 0a 61 3d 78 2d 71 74&nbsp; e:npt=0-..a=x-qt<BR>000000e0 (0x87609c0): 2d 74 65 78 74 2d 6e 61 6d 3a 4d 50 45 47 20 54&nbsp; -text-nam:MPEG T<BR>000000f0 (0x87609d0): 72 61 6e 73 70 6f 72 74 20 53 74 72 65 61 6d 2c&nbsp; ransport Stream,<BR>00000100 (0x87609e0): 20 73 74 72 65 61 6d 65 64 20 62 79 20 74 68 65&nbsp;&nbsp; streamed by the<BR>00000110 (0x87609f0): 20 4c 49 56 45 35 35 35 20 4d 65 64 69 61 20 53&nbsp;&nbsp; LIVE555 Media S<BR>00000120 (0x8760a00): 65 72 76 65 72 0d 0a 61 3d 78 2d 71 74 2d 74 65&nbsp; erver..a=x-qt-te<BR>00000130 (0x8760a10): 78 74 2d 69 6e 66 3a 73 64 2e 74 73 0d 0a 6d 3d&nbsp; xt-inf:sd.ts..m=<BR>00000140 (0x8760a20): 76 69 64 65 6f 20 30 20 52 54 50 2f 41 56 50 20&nbsp; video 0 RTP/AVP<BR>00000150 (0x8760a30): 33 33 0d 0a 63 3d 49 4e 20 49 50 34 20 30 2e 30&nbsp; 33..c=IN IP4 0.0<BR>00000160 (0x8760a40): 2e 30 2e 30 0d 0a 61 3d 63 6f 6e 74 72 6f 6c 3a&nbsp; .0.0..a=control:<BR>00000170 (0x8760a50): 74 72 61 63 6b 31 0d 0a 00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; track1...<BR>sdp packet 0xbfe22784:<BR>&nbsp;version:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0'<BR>&nbsp;origin:<BR>&nbsp; username:&nbsp;&nbsp;&nbsp;&nbsp; '-'<BR>&nbsp; sess_id:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '1250147999698142'<BR>&nbsp; sess_version: '1'<BR>&nbsp; nettype:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'IN'<BR>&nbsp; addrtype:&nbsp;&nbsp;&nbsp;&nbsp; 'IP4'<BR>&nbsp; addr:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '10.144.24.8'<BR>&nbsp;session_name:&nbsp; 'MPEG Transport Stream, streamed by the LIVE555 Media Server'<BR>&nbsp;information:&nbsp;&nbsp; 'sd.ts'<BR>&nbsp;uri:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp;connection:<BR>&nbsp; nettype:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp; addrtype:&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp; address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp; ttl:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0'<BR>&nbsp; addr_number:&nbsp; '0'<BR>&nbsp;key:<BR>&nbsp; type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp; data:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp;attributes:<BR>&nbsp; attribute 'tool' : 'LIVE555 Streaming Media v2009.07.09'<BR>&nbsp; attribute 'type' : 'broadcast'<BR>&nbsp; attribute 'control' : '*'<BR>&nbsp; attribute 'range' : 'npt=0-'<BR>&nbsp; attribute 'x-qt-text-nam' : 'MPEG Transport Stream, streamed by the LIVE555 Media Server'<BR>&nbsp; attribute 'x-qt-text-inf' : 'sd.ts'<BR>&nbsp;medias:<BR>&nbsp; media 0:<BR>&nbsp;&nbsp; media:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'video'<BR>&nbsp;&nbsp; port:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0'<BR>&nbsp;&nbsp; num_ports:&nbsp;&nbsp; '4294967295'<BR>&nbsp;&nbsp; proto:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'RTP/AVP'<BR>&nbsp;&nbsp; formats:<BR>&nbsp;&nbsp;&nbsp; format&nbsp; '33'<BR>&nbsp;&nbsp; information: '(NULL)'<BR>&nbsp;&nbsp; connections:<BR>&nbsp;&nbsp;&nbsp; nettype:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'IN'<BR>&nbsp;&nbsp;&nbsp; addrtype:&nbsp;&nbsp;&nbsp;&nbsp; 'IP4'<BR>&nbsp;&nbsp;&nbsp; address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0.0.0.0'<BR>&nbsp;&nbsp;&nbsp; ttl:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '0'<BR>&nbsp;&nbsp;&nbsp; addr_number:&nbsp; '0'<BR>&nbsp;&nbsp; key:<BR>&nbsp;&nbsp;&nbsp; type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp;&nbsp;&nbsp; data:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '(NULL)'<BR>&nbsp;&nbsp; attributes:<BR>&nbsp;&nbsp;&nbsp; attribute 'control' : 'track1'<BR>setup media 0<BR>setup rtsp://192.168.11.167/sd.ts/track1<BR>RTSP request message 0xbfe22800<BR>&nbsp;request line:<BR>&nbsp;&nbsp; method: 'SETUP'<BR>&nbsp;&nbsp; uri:&nbsp;&nbsp;&nbsp; 'rtsp://192.168.11.167/sd.ts/track1'<BR>&nbsp;&nbsp; version: '1.0'<BR>&nbsp;headers:<BR>&nbsp;&nbsp; key: 'Transport', value: 'RTP/AVP/UDP;unicast;client_port=30000-30001,RTP/AVP/UDP;multicast,RTP/AVP/TCP'<BR>&nbsp;body:<BR>RTSP response message 0xbfe227e4<BR>&nbsp;status line:<BR>&nbsp;&nbsp; code:&nbsp;&nbsp; '200'<BR>&nbsp;&nbsp; reason: 'OK'<BR>&nbsp;&nbsp; version: '1.0'<BR>&nbsp;headers:<BR>&nbsp;&nbsp; key: 'CSeq', value: '2'<BR>&nbsp;&nbsp; key: 'Date', value: 'Thu, Aug 13 2009 09:38:43 GMT'<BR>&nbsp;&nbsp; key: 'Transport', value: 'RTP/AVP;unicast;destination=192.168.11.168;source=192.168.11.167;client_port=30000-30001;server_port=6972-6973'<BR>&nbsp;&nbsp; key: 'Session', value: '52'<BR>&nbsp;body: length 0<BR>RTSP request message 0xbfe22800<BR>&nbsp;request line:<BR>&nbsp;&nbsp; method: 'PLAY'<BR>&nbsp;&nbsp; uri:&nbsp;&nbsp;&nbsp; 'rtsp://192.168.11.167/sd.ts'<BR>&nbsp;&nbsp; version: '1.0'<BR>&nbsp;headers:<BR>&nbsp;&nbsp; key: 'Accept', value: 'npt=0-'<BR>&nbsp;body:<BR>RTSP response message 0xbfe227e4<BR>&nbsp;status line:<BR>&nbsp;&nbsp; code:&nbsp;&nbsp; '200'<BR>&nbsp;&nbsp; reason: 'OK'<BR>&nbsp;&nbsp; version: '1.0'<BR>&nbsp;headers:<BR>&nbsp;&nbsp; key: 'CSeq', value: '3'<BR>&nbsp;&nbsp; key: 'Date', value: 'Thu, Aug 13 2009 09:38:43 GMT'<BR>&nbsp;&nbsp; key: 'Session', value: '52'<BR>&nbsp;&nbsp; key: 'RTP-Info', value: 'url=rtsp://192.168.11.167/sd.ts/track1;seq=23957;rtptime=2147510730'<BR>&nbsp;body: length 0<BR>error receiving response -11<BR>[felix@Felix-NB test_rtsp]$<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
///The code<BR>
#include &lt;gst/gst.h&gt;<BR>#include &lt;gst/rtsp/gstrtspconnection.h&gt;<BR>#include &lt;gst/rtsp/gstrtspmessage.h&gt;<BR>#include &lt;gst/rtsp/gstrtspurl.h&gt;<BR>#include &lt;gst/sdp/gstsdpmessage.h&gt;<BR>#include &lt;gst/rtp/gstrtppayloads.h&gt;<BR>#include &lt;gst/rtsp/gstrtsprange.h&gt;<BR>#include &lt;gst/check/gstcheck.h&gt;<BR>#include &lt;gst/rtp/gstrtpbuffer.h&gt;<BR>#include &lt;gst/rtp/gstrtcpbuffer.h&gt;<BR>#include &lt;string.h&gt;<BR>
int main(int argc,char *argv[])<BR>{<BR>&nbsp;GstRTSPUrl &nbsp;&nbsp;&nbsp;&nbsp;*pURL;<BR>&nbsp;gchar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*pURLStr;<BR>&nbsp;GMainLoop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;*g_loop;<BR>&nbsp;GstRTSPConnection *pConn;<BR>&nbsp;GstRTSPResult&nbsp;&nbsp;&nbsp;nRes;&nbsp;<BR>&nbsp;GstRTSPMessage &nbsp;&nbsp;Request_t &nbsp;= { 0 };<BR>&nbsp; GstRTSPMessage &nbsp;&nbsp;Response_t &nbsp;= { 0 };<BR>&nbsp; GstSDPMessage &nbsp;&nbsp;SDP_t &nbsp;&nbsp;&nbsp;= { 0 };<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;gst_init(&amp;argc,&amp;argv);<BR>
&nbsp;g_loop = g_main_loop_new (NULL, FALSE);<BR>&nbsp;<BR>&nbsp;pURLStr="rtsp://192.168.11.167/sd.ts";<BR>&nbsp;//pURLStr="rtsp://thread:5454/south-rtsp.mp3"<BR>&nbsp;<BR>&nbsp;/*create url */&nbsp;<BR>&nbsp; g_print ("parsing url \"%s\"...\n", pURLStr);<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp; nRes = gst_rtsp_url_parse (pURLStr, &amp;pURL);<BR>&nbsp; if (nRes &lt;0) {<BR>&nbsp;&nbsp;&nbsp; g_print ("error parsing url \"%s\"\n", pURLStr);<BR>&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp; }<BR>&nbsp; g_print ("&nbsp; url host: %s\n", pURL-&gt;host);<BR>&nbsp; g_print ("&nbsp; url port: %d\n", pURL-&gt;port);<BR>&nbsp; g_print ("&nbsp; url path: %s\n", pURL-&gt;abspath);<BR>&nbsp; <BR>&nbsp;<BR>&nbsp; /* create and open connection */<BR>&nbsp; g_print ("creating connection...\n");<BR>&nbsp; nRes = gst_rtsp_connection_create (pURL, &amp;pConn);<BR>&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp; &nbsp;g_print ("error creating connection to \"%s\"\n", pURLStr);<BR>&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp; }<BR>&nbsp; <BR>&nbsp; /* open connection */<BR>&nbsp; g_print ("opening connection...\n");<BR>&nbsp; nRes = gst_rtsp_connection_connect (pConn, NULL);<BR>&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp; &nbsp;g_print ("error opening connection to \"%s\"\n", pURLStr);<BR>&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp; }<BR>
&nbsp;&nbsp; /* do describe */<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_message_init_request (&amp;Request_t, GST_RTSP_DESCRIBE, pURLStr);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error creating request\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; gst_rtsp_message_add_header (&amp;Request_t, GST_RTSP_HDR_ACCEPT, "application/sdp");<BR>
&nbsp;&nbsp;&nbsp; gst_rtsp_message_dump (&amp;Request_t);<BR>
&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_connection_send (pConn, &amp;Request_t, NULL);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error sending request\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_connection_receive (pConn, &amp;Response_t, NULL);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error receiving response\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; gst_rtsp_message_dump (&amp;Response_t);<BR>&nbsp; }<BR>
&nbsp; /* parse SDP */<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; guint8 *data;<BR>&nbsp;&nbsp;&nbsp; guint size;<BR>
&nbsp;&nbsp;&nbsp; gst_rtsp_message_get_body (&amp;Response_t, &amp;data, &amp;size);<BR>
&nbsp;&nbsp;&nbsp; gst_sdp_message_init (&amp;SDP_t);<BR>&nbsp;&nbsp;&nbsp; gst_sdp_message_parse_buffer (data, size, &amp;SDP_t);<BR>
&nbsp;&nbsp;&nbsp; gst_sdp_message_dump (&amp;SDP_t);<BR>&nbsp; }<BR>&nbsp; <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; /* do setup */<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; gint i;<BR>
&nbsp;&nbsp;&nbsp; for (i = 0; i &lt; gst_sdp_message_medias_len (&amp;SDP_t); i++)&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;GstSDPMedia *media;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar *pSetupURL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar *pControlURL;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; media = gst_sdp_message_get_media (&amp;SDP_t, i);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("setup media %d\n", i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pControlURL = gst_sdp_media_get_attribute_val (media, "control");<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pSetupURL = g_strdup_printf ("%s/%s", pURLStr, pControlURL);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("setup %s\n", pSetupURL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_message_init_request (&amp;Request_t, GST_RTSP_SETUP, pSetupURL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error creating request\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gst_rtsp_message_add_header (&amp;Request_t, GST_RTSP_HDR_TRANSPORT,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "RTP/AVP/UDP;unicast;client_port=30000-30001,RTP/AVP/UDP;multicast,RTP/AVP/TCP");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //"RTP/AVP;unicast;client_port=5000-5001");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // "RTP/AVP/TCP");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gst_rtsp_message_dump (&amp;Request_t);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_connection_send (pConn, &amp;Request_t, NULL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error sending request\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp; &nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp; &nbsp;nRes = gst_rtsp_connection_receive (pConn, &amp;Response_t, NULL);<BR>&nbsp;&nbsp;&nbsp; &nbsp;if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;g_print ("error receiving response\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;return (-1);<BR>&nbsp;&nbsp; &nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp; &nbsp;gst_rtsp_message_dump (&amp;Response_t);<BR>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; /* do play */<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_message_init_request (&amp;Request_t, GST_RTSP_PLAY, pURLStr);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error creating request\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; gst_rtsp_message_add_header (&amp;Request_t, GST_RTSP_HDR_ACCEPT, "npt=0-");<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; gst_rtsp_message_dump (&amp;Request_t);<BR>
&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_connection_send (pConn, &amp;Request_t, NULL);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error sending request\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_connection_receive (pConn, &amp;Response_t, NULL);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error receiving response\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; gst_rtsp_message_dump (&amp;Response_t);<BR>&nbsp; }<BR>
<BR>&nbsp; while (TRUE) {<BR>
&nbsp;&nbsp;&nbsp; nRes = gst_rtsp_connection_receive (pConn, &amp;Response_t, NULL);<BR>
&nbsp;&nbsp;g_print("%d\n",nRes);<BR>&nbsp;&nbsp;&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("error receiving response %d\n",nRes);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; gst_rtsp_message_dump (&amp;Response_t);<BR>&nbsp; }<BR>
&nbsp; /* close connection */<BR>&nbsp; g_print ("closing connection...\n");<BR>&nbsp; nRes = gst_rtsp_connection_close (pConn);<BR>&nbsp; if (nRes != GST_RTSP_OK) {<BR>&nbsp;&nbsp;&nbsp; g_print ("error closing connection to \"%s\"\n", pURLStr);<BR>&nbsp;&nbsp;&nbsp; return (-1);<BR>&nbsp; }<BR>&nbsp;return 0;<BR>}<BR><br /><hr />聰明搜尋和瀏覽網路的免費工具列 — <a href='http://download.live.com/toolbar' target='_new'>Windows Live 工具列</a></body>
</html>