[FFmpeg-devel] [PATCH] document rtsp.h

Ronald S. Bultje rsbultje
Wed Feb 18 04:28:43 CET 2009


Hi,

On Mon, Feb 16, 2009 at 11:32 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> On Fri, Feb 6, 2009 at 7:34 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Thu, Feb 05, 2009 at 05:41:38PM -0500, Ronald S. Bultje wrote:
>>> On Thu, Feb 5, 2009 at 12:27 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>>> > On Thu, Feb 05, 2009 at 09:24:21AM -0500, Ronald S. Bultje wrote:
>>> >> +/**
>>> >> + * This describes the server response to each RTSP command.
>>> >> + */
>>> >
>>> >>  typedef struct RTSPHeader {
>>> >
>>> > poor name ...
>>>
>>> I can rename it if you suggest something better. :-).
>>
>> ServerResponse assuming your comment is correct
>> an alternative would be ReceivedRTSPHHeader
>
> RTSPServerResponse seems good to me. Then the status_code inside it
> can stay what it is since it's contained structure makes it more than
> clear that it's part of a "server_response" already.

See attached.

Ronald
-------------- next part --------------
Index: ffmpeg-svn/ffserver.c
===================================================================
--- ffmpeg-svn.orig/ffserver.c	2009-02-16 11:14:57.000000000 -0500
+++ ffmpeg-svn/ffserver.c	2009-02-17 22:26:24.000000000 -0500
@@ -273,10 +273,10 @@
 static int rtsp_parse_request(HTTPContext *c);
 static void rtsp_cmd_describe(HTTPContext *c, const char *url);
 static void rtsp_cmd_options(HTTPContext *c, const char *url);
-static void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPHeader *h);
-static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h);
-static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPHeader *h);
-static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h);
+static void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPServerResponse *h);
+static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPServerResponse *h);
+static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPServerResponse *h);
+static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPServerResponse *h);
 
 /* SDP handling */
 static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
@@ -2628,7 +2628,7 @@
     char protocol[32];
     char line[1024];
     int len;
-    RTSPHeader header1, *header = &header1;
+    RTSPServerResponse header1, *header = &header1;
 
     c->buffer_ptr[0] = '\0';
     p = c->buffer;
@@ -2654,7 +2654,7 @@
     }
 
     /* parse each header line */
-    memset(header, 0, sizeof(RTSPHeader));
+    memset(header, 0, sizeof(RTSPServerResponse));
     /* skip to next line */
     while (*p != '\n' && *p != '\0')
         p++;
@@ -2811,7 +2811,7 @@
     return NULL;
 }
 
-static RTSPTransportField *find_transport(RTSPHeader *h, enum RTSPLowerTransport lower_transport)
+static RTSPTransportField *find_transport(RTSPServerResponse *h, enum RTSPLowerTransport lower_transport)
 {
     RTSPTransportField *th;
     int i;
@@ -2825,7 +2825,7 @@
 }
 
 static void rtsp_cmd_setup(HTTPContext *c, const char *url,
-                           RTSPHeader *h)
+                           RTSPServerResponse *h)
 {
     FFStream *stream;
     int stream_index, port;
@@ -2996,7 +2996,7 @@
     return NULL;
 }
 
-static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h)
+static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPServerResponse *h)
 {
     HTTPContext *rtp_c;
 
@@ -3030,7 +3030,7 @@
     url_fprintf(c->pb, "\r\n");
 }
 
-static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPHeader *h)
+static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPServerResponse *h)
 {
     HTTPContext *rtp_c;
 
@@ -3055,7 +3055,7 @@
     url_fprintf(c->pb, "\r\n");
 }
 
-static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h)
+static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPServerResponse *h)
 {
     HTTPContext *rtp_c;
     char session_id[32];
Index: ffmpeg-svn/libavformat/rtsp.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.c	2009-02-16 11:23:59.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.c	2009-02-17 22:26:10.000000000 -0500
@@ -570,7 +570,7 @@
 }
 
 /* XXX: only one transport specification is parsed */
-static void rtsp_parse_transport(RTSPHeader *reply, const char *p)
+static void rtsp_parse_transport(RTSPServerResponse *reply, const char *p)
 {
     char transport_protocol[16];
     char profile[16];
@@ -672,7 +672,7 @@
     }
 }
 
-void rtsp_parse_line(RTSPHeader *reply, const char *buf)
+void rtsp_parse_line(RTSPServerResponse *reply, const char *buf)
 {
     const char *p;
 
@@ -738,7 +738,7 @@
 }
 
 static void rtsp_send_cmd(AVFormatContext *s,
-                          const char *cmd, RTSPHeader *reply,
+                          const char *cmd, RTSPServerResponse *reply,
                           unsigned char **content_ptr)
 {
     RTSPState *rt = s->priv_data;
@@ -748,7 +748,7 @@
     int content_length, line_count;
     unsigned char *content = NULL;
 
-    memset(reply, 0, sizeof(RTSPHeader));
+    memset(reply, 0, sizeof(RTSPServerResponse));
 
     rt->seq++;
     av_strlcpy(buf, cmd, sizeof(buf));
@@ -888,7 +888,7 @@
     RTSPState *rt = s->priv_data;
     int j, i, err, interleave = 0;
     RTSPStream *rtsp_st;
-    RTSPHeader reply1, *reply = &reply1;
+    RTSPServerResponse reply1, *reply = &reply1;
     char cmd[2048];
     const char *trans_pref;
 
@@ -1064,7 +1064,7 @@
     char host[1024], path[1024], tcpname[1024], cmd[2048], *option_list, *option;
     URLContext *rtsp_hd;
     int port, ret, err;
-    RTSPHeader reply1, *reply = &reply1;
+    RTSPServerResponse reply1, *reply = &reply1;
     unsigned char *content = NULL;
     int lower_transport_mask = 0;
     char real_challenge[64];
@@ -1313,7 +1313,7 @@
 
     if (rt->server_type == RTSP_SERVER_REAL) {
         int i;
-        RTSPHeader reply1, *reply = &reply1;
+        RTSPServerResponse reply1, *reply = &reply1;
         enum AVDiscard cache[MAX_STREAMS];
         char cmd[1024];
 
@@ -1421,7 +1421,7 @@
 static int rtsp_read_play(AVFormatContext *s)
 {
     RTSPState *rt = s->priv_data;
-    RTSPHeader reply1, *reply = &reply1;
+    RTSPServerResponse reply1, *reply = &reply1;
     char cmd[1024];
 
     av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state);
@@ -1451,7 +1451,7 @@
 static int rtsp_read_pause(AVFormatContext *s)
 {
     RTSPState *rt = s->priv_data;
-    RTSPHeader reply1, *reply = &reply1;
+    RTSPServerResponse reply1, *reply = &reply1;
     char cmd[1024];
 
     rt = s->priv_data;
@@ -1495,7 +1495,7 @@
 static int rtsp_read_close(AVFormatContext *s)
 {
     RTSPState *rt = s->priv_data;
-    RTSPHeader reply1, *reply = &reply1;
+    RTSPServerResponse reply1, *reply = &reply1;
     char cmd[1024];
 
 #if 0
Index: ffmpeg-svn/libavformat/rtsp.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.h	2009-02-16 11:30:09.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.h	2009-02-17 22:25:57.000000000 -0500
@@ -59,7 +59,7 @@
     enum RTSPLowerTransport lower_transport;
 } RTSPTransportField;
 
-typedef struct RTSPHeader {
+typedef struct RTSPServerResponse {
     int content_length;
     enum RTSPStatusCode status_code; /**< response code from server */
     int nb_transports;
@@ -70,7 +70,7 @@
     char session_id[512];
     char real_challenge[64]; /**< the RealChallenge1 field from the server */
     char server[64];
-} RTSPHeader;
+} RTSPServerResponse;
 
 enum RTSPClientState {
     RTSP_STATE_IDLE,
@@ -126,7 +126,7 @@
 } RTSPStream;
 
 int rtsp_init(void);
-void rtsp_parse_line(RTSPHeader *reply, const char *buf);
+void rtsp_parse_line(RTSPServerResponse *reply, const char *buf);
 
 #if LIBAVFORMAT_VERSION_INT < (53 << 16)
 extern int rtsp_default_protocols;



More information about the ffmpeg-devel mailing list