Browse code

rtsp: Add a method parameter to ff_rtsp_read_reply

Originally committed as revision 26189 to svn://svn.ffmpeg.org/ffmpeg/trunk

Martin Storsjö authored on 2011/01/02 19:06:21
Showing 4 changed files
... ...
@@ -758,7 +758,7 @@ void ff_rtsp_skip_packet(AVFormatContext *s)
758 758
 
759 759
 int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
760 760
                        unsigned char **content_ptr,
761
-                       int return_on_interleaved_data)
761
+                       int return_on_interleaved_data, const char *method)
762 762
 {
763 763
     RTSPState *rt = s->priv_data;
764 764
     char buf[4096], buf1[1024], *q;
... ...
@@ -936,7 +936,7 @@ retry:
936 936
                                                    send_content_length)))
937 937
         return ret;
938 938
 
939
-    if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0) ) < 0)
939
+    if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0)
940 940
         return ret;
941 941
 
942 942
     if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE &&
... ...
@@ -1512,7 +1512,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
1512 1512
             if (tcp_fd != -1 && FD_ISSET(tcp_fd, &rfds)) {
1513 1513
                 RTSPMessageHeader reply;
1514 1514
 
1515
-                ret = ff_rtsp_read_reply(s, &reply, NULL, 0);
1515
+                ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL);
1516 1516
                 if (ret < 0)
1517 1517
                     return ret;
1518 1518
                 /* XXX: parse message */
... ...
@@ -434,13 +434,15 @@ int ff_rtsp_send_cmd(AVFormatContext *s, const char *method,
434 434
  *                   data packets (if they are encountered), until a reply
435 435
  *                   has been fully parsed. If no more data is available
436 436
  *                   without parsing a reply, it will return an error.
437
+ * @param method the RTSP method this is a reply to. This affects how
438
+ *               some response headers are acted upon. May be NULL.
437 439
  *
438 440
  * @return 1 if a data packets is ready to be received, -1 on error,
439 441
  *          and 0 on success.
440 442
  */
441 443
 int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
442 444
                        unsigned char **content_ptr,
443
-                       int return_on_interleaved_data);
445
+                       int return_on_interleaved_data, const char *method);
444 446
 
445 447
 /**
446 448
  * Skip a RTP/TCP interleaved packet.
... ...
@@ -170,7 +170,7 @@ redo:
170 170
     for (;;) {
171 171
         RTSPMessageHeader reply;
172 172
 
173
-        ret = ff_rtsp_read_reply(s, &reply, NULL, 1);
173
+        ret = ff_rtsp_read_reply(s, &reply, NULL, 1, NULL);
174 174
         if (ret < 0)
175 175
             return ret;
176 176
         if (ret == 1) /* received '$' */
... ...
@@ -195,7 +195,7 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
195 195
              * since it would block and wait for an RTSP reply on the socket
196 196
              * (which may not be coming any time soon) if it handles
197 197
              * interleaved packets internally. */
198
-            ret = ff_rtsp_read_reply(s, &reply, NULL, 1);
198
+            ret = ff_rtsp_read_reply(s, &reply, NULL, 1, NULL);
199 199
             if (ret < 0)
200 200
                 return AVERROR(EPIPE);
201 201
             if (ret == 1)