[FFmpeg-cvslog] ffserver: don't hardcode RTSP status codes

Reynaldo H. Verdejo Pinochet git at videolan.org
Mon Apr 7 05:24:37 CEST 2014


ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <r.verdejo at sisa.samsung.com> | Sun Apr  6 23:21:42 2014 -0300| [02497a5dc8c9db79ab0f0be6f97f3df917862d7a] | committer: Reynaldo H. Verdejo Pinochet

ffserver: don't hardcode RTSP status codes

Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo at sisa.samsung.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02497a5dc8c9db79ab0f0be6f97f3df917862d7a
---

 ffserver.c |   40 +++-------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index f116c44..48d8808 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -38,6 +38,7 @@
 #include "libavformat/rtpdec.h"
 #include "libavformat/rtpproto.h"
 #include "libavformat/rtsp.h"
+#include "libavformat/rtspcodes.h"
 #include "libavformat/avio_internal.h"
 #include "libavformat/internal.h"
 #include "libavformat/url.h"
@@ -2836,44 +2837,9 @@ static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number)
     struct tm *tm;
     char buf2[32];
 
-    switch(error_number) {
-    case RTSP_STATUS_OK:
-        str = "OK";
-        break;
-    case RTSP_STATUS_METHOD:
-        str = "Method Not Allowed";
-        break;
-    case RTSP_STATUS_BANDWIDTH:
-        str = "Not Enough Bandwidth";
-        break;
-    case RTSP_STATUS_SESSION:
-        str = "Session Not Found";
-        break;
-    case RTSP_STATUS_STATE:
-        str = "Method Not Valid in This State";
-        break;
-    case RTSP_STATUS_AGGREGATE:
-        str = "Aggregate operation not allowed";
-        break;
-    case RTSP_STATUS_ONLY_AGGREGATE:
-        str = "Only aggregate operation allowed";
-        break;
-    case RTSP_STATUS_TRANSPORT:
-        str = "Unsupported transport";
-        break;
-    case RTSP_STATUS_INTERNAL:
-        str = "Internal Server Error";
-        break;
-    case RTSP_STATUS_SERVICE:
-        str = "Service Unavailable";
-        break;
-    case RTSP_STATUS_VERSION:
-        str = "RTSP Version not supported";
-        break;
-    default:
+    str = RTSP_STATUS_CODE2STRING(error_number);
+    if (!str)
         str = "Unknown Error";
-        break;
-    }
 
     avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str);
     avio_printf(c->pb, "CSeq: %d\r\n", c->seq);



More information about the ffmpeg-cvslog mailing list