OSDN Git Service

Preserve status reason
authorLuca Barbato <lu_zero@gentoo.org>
Fri, 6 Aug 2010 10:26:30 +0000 (10:26 +0000)
committerLuca Barbato <lu_zero@gentoo.org>
Fri, 6 Aug 2010 10:26:30 +0000 (10:26 +0000)
It is used to provide meaningful error messages.

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

libavformat/rtsp.c
libavformat/rtsp.h

index 689ad29..2b244d8 100644 (file)
@@ -824,6 +824,7 @@ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
             get_word(buf1, sizeof(buf1), &p);
             get_word(buf1, sizeof(buf1), &p);
             reply->status_code = atoi(buf1);
+            av_strlcpy(reply->reason, p, sizeof(reply->reason));
         } else {
             ff_rtsp_parse_line(reply, p, &rt->auth_state);
             av_strlcat(rt->last_reply, p,    sizeof(rt->last_reply));
@@ -961,9 +962,10 @@ retry:
         goto retry;
 
     if (reply->status_code > 400){
-        av_log(s, AV_LOG_ERROR, "method %s failed, %d\n",
+        av_log(s, AV_LOG_ERROR, "method %s failed: %d%s\n",
                method,
-               reply->status_code);
+               reply->status_code,
+               reply->reason);
         av_log(s, AV_LOG_DEBUG, "%s\n", rt->last_reply);
     }
 
index 2853253..1dba996 100644 (file)
@@ -159,6 +159,11 @@ typedef struct RTSPMessageHeader {
      * http://tools.ietf.org/html/draft-stiemerling-rtsp-announce-00
      * for a complete list of supported values. */
     int notice;
+
+    /** The "reason" is meant to specify better the meaning of the error code
+     * returned
+     */
+    char reason[256];
 } RTSPMessageHeader;
 
 /**