[FFmpeg-devel] [PATCH] RTSP-MS 10/15: ASF header parsing

Ronald S. Bultje rsbultje
Wed Feb 4 03:43:49 CET 2009


Hi,

On Tue, Feb 3, 2009 at 1:35 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Feb 03, 2009 at 12:15:47PM -0500, Ronald S. Bultje wrote:
>> Hi,
>>
>> On Tue, Feb 3, 2009 at 8:31 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > to be honest i really think the rtp/rtsp code needs MUCH more cleanup
>> > and documentation done before any new additions not less and later /
>> > a promise to do 1 of 100 cleanups afterwards
>>
>> You want documentation of struct members, or cleanup of code?
>
> i want them documented then when i understand the code i can say if it
> needs a cleanup.

Attached are 3 patches that (in rtsp.h):
- add comments
- reindent a few comments
- group a few comments so they are not completely useless

Any other files that need comments? rtp.h seems pretty good so far,
and rdt.h is fully documented already. Can you tell me what code you'd
like documented?

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.h	2009-02-03 16:14:46.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.h	2009-02-03 21:12:56.000000000 -0500
@@ -52,8 +52,8 @@
     int server_port_min, server_port_max; /**< RTP ports */
     int ttl; /**< ttl value */
     uint32_t destination; /**< destination IP address */
-    int transport;
-    enum RTSPLowerTransport lower_transport;
+    int transport;                           /**< RTP or RDT (Real) */
+    enum RTSPLowerTransport lower_transport; /**< TCP/UDP uni-/multicast */
 } RTSPTransportField;
 
 typedef struct RTSPHeader {
@@ -66,7 +66,7 @@
     int seq; /**< sequence number */
     char session_id[512];
     char real_challenge[64]; /**< the RealChallenge1 field from the server */
-    char server[64];
+    char server[64];                 /**< the Server field, to identify WMS */
 } RTSPHeader;
 
 enum RTSPClientState {
@@ -83,15 +83,15 @@
 };
 
 enum RTSPTransport {
-    RTSP_TRANSPORT_RTP,
-    RTSP_TRANSPORT_RDT,
+    RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP packets */
+    RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport (RDT) packets */
     RTSP_TRANSPORT_LAST
 };
 
 typedef struct RTSPState {
     URLContext *rtsp_hd; /* RTSP TCP connexion handle */
     int nb_rtsp_streams;
-    struct RTSPStream **rtsp_streams;
+    struct RTSPStream **rtsp_streams; /**< for each m= line in the SDP */
 
     enum RTSPClientState state;
     int64_t seek_timestamp;
@@ -100,11 +100,11 @@
     //    ByteIOContext rtsp_gb;
     int seq;        /* RTSP command sequence number */
     char session_id[512];
-    enum RTSPTransport transport;
-    enum RTSPLowerTransport lower_transport;
-    enum RTSPServerType server_type;
+    enum RTSPTransport transport;     /**< RTP or RDT */
+    enum RTSPLowerTransport lower_transport; /**< TCP/UDP uni-/multicast */
+    enum RTSPServerType server_type;  /**< brand of server (MS, RM, other) */
     char last_reply[2048]; /* XXX: allocate ? */
-    void *cur_tx;
+    void *cur_tx;                     /**< stream for last packet */
     int need_subscription;
     enum AVDiscard real_setup_cache[MAX_STREAMS];
     char last_subscription[1024];
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.h	2009-02-03 21:12:56.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.h	2009-02-03 21:25:07.000000000 -0500
@@ -46,12 +46,12 @@
 #define RTSP_RTP_PORT_MAX 10000
 
 typedef struct RTSPTransportField {
-    int interleaved_min, interleaved_max;  /**< interleave ids, if TCP transport */
-    int port_min, port_max; /**< RTP ports */
-    int client_port_min, client_port_max; /**< RTP ports */
-    int server_port_min, server_port_max; /**< RTP ports */
-    int ttl; /**< ttl value */
-    uint32_t destination; /**< destination IP address */
+    int interleaved_min, interleaved_max;    /**< interleave ids, if TCP transport */
+    int port_min, port_max;                  /**< RTP ports */
+    int client_port_min, client_port_max;    /**< RTP ports */
+    int server_port_min, server_port_max;    /**< RTP ports */
+    int ttl;                                 /**< ttl value */
+    uint32_t destination;                    /**< destination IP address */
     int transport;                           /**< RTP or RDT (Real) */
     enum RTSPLowerTransport lower_transport; /**< TCP/UDP uni-/multicast */
 } RTSPTransportField;
@@ -63,9 +63,9 @@
     /** in AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */
     int64_t range_start, range_end;
     RTSPTransportField transports[RTSP_MAX_TRANSPORTS];
-    int seq; /**< sequence number */
+    int seq;                         /**< sequence number */
     char session_id[512];
-    char real_challenge[64]; /**< the RealChallenge1 field from the server */
+    char real_challenge[64];         /**< the RealChallenge1 field from the server */
     char server[64];                 /**< the Server field, to identify WMS */
 } RTSPHeader;
 
@@ -89,7 +89,7 @@
 };
 
 typedef struct RTSPState {
-    URLContext *rtsp_hd; /* RTSP TCP connexion handle */
+    URLContext *rtsp_hd;              /**< RTSP TCP connection handle */
     int nb_rtsp_streams;
     struct RTSPStream **rtsp_streams; /**< for each m= line in the SDP */
 
@@ -98,12 +98,12 @@
 
     /* XXX: currently we use unbuffered input */
     //    ByteIOContext rtsp_gb;
-    int seq;        /* RTSP command sequence number */
+    int seq;                          /**< RTSP command sequence number */
     char session_id[512];
     enum RTSPTransport transport;     /**< RTP or RDT */
     enum RTSPLowerTransport lower_transport; /**< TCP/UDP uni-/multicast */
     enum RTSPServerType server_type;  /**< brand of server (MS, RM, other) */
-    char last_reply[2048]; /* XXX: allocate ? */
+    char last_reply[2048];            /* XXX: allocate ? */
     void *cur_tx;                     /**< stream for last packet */
     int need_subscription;
     enum AVDiscard real_setup_cache[MAX_STREAMS];
@@ -111,12 +111,13 @@
 } RTSPState;
 
 typedef struct RTSPStream {
-    URLContext *rtp_handle; /* RTP stream handle */
-    void *tx_ctx; /* RTP/RDT parse context */
+    URLContext *rtp_handle;                /**< RTP stream handle */
+    void *tx_ctx;                          /**< RTP/RDT parse context */
 
-    int stream_index; /* corresponding stream index, if any. -1 if none (MPEG2TS case) */
-    int interleaved_min, interleaved_max;  /* interleave ids, if TCP transport */
-    char control_url[1024]; /* url for this stream (from SDP) */
+    int stream_index;                      /**< corresponding stream index,
+                                            * -1 if none (MPEG2TS case) */
+    int interleaved_min, interleaved_max;  /**< interleave ids (TCP) */
+    char control_url[1024];                /**< stream url (from SDP) */
 
     int sdp_port; /* port (from SDP content - not used in RTSP) */
     struct in_addr sdp_ip; /* IP address  (from SDP content - not used in RTSP) */
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.h
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.h	2009-02-03 21:40:19.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.h	2009-02-03 21:40:19.000000000 -0500
@@ -119,14 +119,21 @@
     int interleaved_min, interleaved_max;  /**< interleave ids (TCP) */
     char control_url[1024];                /**< stream url (from SDP) */
 
-    int sdp_port; /* port (from SDP content - not used in RTSP) */
-    struct in_addr sdp_ip; /* IP address  (from SDP content - not used in RTSP) */
-    int sdp_ttl;  /* IP TTL (from SDP content - not used in RTSP) */
-    int sdp_payload_type; /* payload type - only used in SDP */
-    RTPPayloadData rtp_payload_data; /* rtp payload parsing infos from SDP */
-
-    RTPDynamicProtocolHandler *dynamic_handler; ///< Only valid if it's a dynamic protocol. (This is the handler structure)
-    PayloadContext *dynamic_protocol_context; ///< Only valid if it's a dynamic protocol. (This is any private data associated with the dynamic protocol)
+    /** The following are used only in SDP, not in RTSP */
+    //@{
+    int sdp_port;
+    struct in_addr sdp_ip;
+    int sdp_ttl;
+    int sdp_payload_type;
+    //@}
+    RTPPayloadData rtp_payload_data;       /**< rtp payload parsing infos
+                                            * from SDP */
+
+    /** The following are only valid for dynamic protocols */
+    //@{
+    RTPDynamicProtocolHandler *dynamic_handler;
+    PayloadContext *dynamic_protocol_context;
+    //@}
 } RTSPStream;
 
 /** the callback can be used to extend the connection setup/teardown step */



More information about the ffmpeg-devel mailing list