[FFmpeg-cvslog] r21968 - in trunk/libavformat: rtsp.c rtsp.h

mstorsjo subversion
Mon Feb 22 20:44:08 CET 2010


Author: mstorsjo
Date: Mon Feb 22 20:44:08 2010
New Revision: 21968

Log:
Add declarations and doxygen documentation of generic rtsp support functions
to rtsp.h, and make the functions non-static

Modified:
   trunk/libavformat/rtsp.c
   trunk/libavformat/rtsp.h

Modified: trunk/libavformat/rtsp.c
==============================================================================
--- trunk/libavformat/rtsp.c	Mon Feb 22 17:11:38 2010	(r21967)
+++ trunk/libavformat/rtsp.c	Mon Feb 22 20:44:08 2010	(r21968)
@@ -572,7 +572,7 @@ static int sdp_parse(AVFormatContext *s,
 }
 
 /* close and free RTSP streams */
-static void rtsp_close_streams(AVFormatContext *s)
+void rtsp_close_streams(AVFormatContext *s)
 {
     RTSPState *rt = s->priv_data;
     int i;
@@ -879,28 +879,7 @@ static void rtsp_skip_packet(AVFormatCon
     }
 }
 
-/**
- * Read a RTSP message from the server, or prepare to read data
- * packets if we're reading data interleaved over the TCP/RTSP
- * connection as well.
- *
- * @param s RTSP demuxer context
- * @param reply pointer where the RTSP message header will be stored
- * @param content_ptr pointer where the RTSP message body, if any, will
- *                    be stored (length is in reply)
- * @param return_on_interleaved_data whether the function may return if we
- *                   encounter a data marker ('$'), which precedes data
- *                   packets over interleaved TCP/RTSP connections. If this
- *                   is set, this function will return 1 after encountering
- *                   a '$'. If it is not set, the function will skip any
- *                   data packets (if they are encountered), until a reply
- *                   has been fully parsed. If no more data is available
- *                   without parsing a reply, it will return an error.
- *
- * @returns 1 if a data packets is ready to be received, -1 on error,
- *          and 0 on success.
- */
-static int rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
+int rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
                            unsigned char **content_ptr,
                            int return_on_interleaved_data)
 {
@@ -987,7 +966,7 @@ static int rtsp_read_reply(AVFormatConte
     return 0;
 }
 
-static void rtsp_send_cmd_with_content_async(AVFormatContext *s,
+void rtsp_send_cmd_with_content_async(AVFormatContext *s,
                                              const char *cmd,
                                              const unsigned char *send_content,
                                              int send_content_length)
@@ -1019,12 +998,12 @@ static void rtsp_send_cmd_with_content_a
     rt->last_cmd_time = av_gettime();
 }
 
-static void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd)
+void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd)
 {
     rtsp_send_cmd_with_content_async(s, cmd, NULL, 0);
 }
 
-static void rtsp_send_cmd(AVFormatContext *s,
+void rtsp_send_cmd(AVFormatContext *s,
                           const char *cmd, RTSPMessageHeader *reply,
                           unsigned char **content_ptr)
 {
@@ -1033,7 +1012,7 @@ static void rtsp_send_cmd(AVFormatContex
     rtsp_read_reply(s, reply, content_ptr, 0);
 }
 
-static void rtsp_send_cmd_with_content(AVFormatContext *s,
+void rtsp_send_cmd_with_content(AVFormatContext *s,
                                        const char *cmd,
                                        RTSPMessageHeader *reply,
                                        unsigned char **content_ptr,
@@ -1397,7 +1376,7 @@ static int rtsp_setup_output_streams(AVF
     return 0;
 }
 
-static int rtsp_connect(AVFormatContext *s)
+int rtsp_connect(AVFormatContext *s)
 {
     RTSPState *rt = s->priv_data;
     char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];

Modified: trunk/libavformat/rtsp.h
==============================================================================
--- trunk/libavformat/rtsp.h	Mon Feb 22 17:11:38 2010	(r21967)
+++ trunk/libavformat/rtsp.h	Mon Feb 22 20:44:08 2010	(r21968)
@@ -326,4 +326,94 @@ extern int rtsp_rtp_port_max;
 int rtsp_pause(AVFormatContext *s);
 int rtsp_resume(AVFormatContext *s);
 
+/**
+ * Send a command to the RTSP server without waiting for the reply.
+ *
+ * @param s RTSP (de)muxer context
+ * @param cmd the full first line of the request
+ * @param send_content if non-null, the data to send as request body content
+ * @param send_content_length the length of the send_content data, or 0 if
+ *                            send_content is null
+ */
+void rtsp_send_cmd_with_content_async(AVFormatContext *s,
+                                      const char *cmd,
+                                      const unsigned char *send_content,
+                                      int send_content_length);
+/**
+ * Send a command to the RTSP server without waiting for the reply.
+ *
+ * @see rtsp_send_cmd_with_content_async
+ */
+void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd);
+
+/**
+ * Send a command to the RTSP server and wait for the reply.
+ *
+ * @param s RTSP (de)muxer context
+ * @param cmd the full first line of the request
+ * @param reply pointer where the RTSP message header will be stored
+ * @param content_ptr pointer where the RTSP message body, if any, will
+ *                    be stored (length is in reply)
+ * @param send_content if non-null, the data to send as request body content
+ * @param send_content_length the length of the send_content data, or 0 if
+ *                            send_content is null
+ */
+void rtsp_send_cmd_with_content(AVFormatContext *s,
+                                const char *cmd,
+                                RTSPMessageHeader *reply,
+                                unsigned char **content_ptr,
+                                const unsigned char *send_content,
+                                int send_content_length);
+
+/**
+ * Send a command to the RTSP server and wait for the reply.
+ *
+ * @see rtsp_send_cmd_with_content
+ */
+void rtsp_send_cmd(AVFormatContext *s, const char *cmd,
+                   RTSPMessageHeader *reply, unsigned char **content_ptr);
+
+/**
+ * Read a RTSP message from the server, or prepare to read data
+ * packets if we're reading data interleaved over the TCP/RTSP
+ * connection as well.
+ *
+ * @param s RTSP (de)muxer context
+ * @param reply pointer where the RTSP message header will be stored
+ * @param content_ptr pointer where the RTSP message body, if any, will
+ *                    be stored (length is in reply)
+ * @param return_on_interleaved_data whether the function may return if we
+ *                   encounter a data marker ('$'), which precedes data
+ *                   packets over interleaved TCP/RTSP connections. If this
+ *                   is set, this function will return 1 after encountering
+ *                   a '$'. If it is not set, the function will skip any
+ *                   data packets (if they are encountered), until a reply
+ *                   has been fully parsed. If no more data is available
+ *                   without parsing a reply, it will return an error.
+ *
+ * @returns 1 if a data packets is ready to be received, -1 on error,
+ *          and 0 on success.
+ */
+int rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
+                    unsigned char **content_ptr,
+                    int return_on_interleaved_data);
+
+/**
+ * Connect to the RTSP server and set up the individual media streams.
+ * This can be used for both muxers and demuxers.
+ *
+ * @param s RTSP (de)muxer context
+ *
+ * @returns 0 on success, < 0 on error. Cleans up all allocations done
+ *          within the function on error.
+ */
+int rtsp_connect(AVFormatContext *s);
+
+/**
+ * Close and free all streams within the RTSP (de)muxer
+ *
+ * @param s RTSP (de)muxer context
+ */
+void rtsp_close_streams(AVFormatContext *s);
+
 #endif /* AVFORMAT_RTSP_H */



More information about the ffmpeg-cvslog mailing list