Mercurial > libavformat.hg
comparison rtsp.c @ 5692:87b26ad577c5 libavformat
Add declarations and doxygen documentation of generic rtsp support functions
to rtsp.h, and make the functions non-static
author | mstorsjo |
---|---|
date | Mon, 22 Feb 2010 19:44:08 +0000 |
parents | 60cbd9b4abea |
children | bb370e798845 |
comparison
equal
deleted
inserted
replaced
5691:60cbd9b4abea | 5692:87b26ad577c5 |
---|---|
570 } | 570 } |
571 return 0; | 571 return 0; |
572 } | 572 } |
573 | 573 |
574 /* close and free RTSP streams */ | 574 /* close and free RTSP streams */ |
575 static void rtsp_close_streams(AVFormatContext *s) | 575 void rtsp_close_streams(AVFormatContext *s) |
576 { | 576 { |
577 RTSPState *rt = s->priv_data; | 577 RTSPState *rt = s->priv_data; |
578 int i; | 578 int i; |
579 RTSPStream *rtsp_st; | 579 RTSPStream *rtsp_st; |
580 | 580 |
877 return; | 877 return; |
878 len -= len1; | 878 len -= len1; |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 /** | 882 int rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, |
883 * Read a RTSP message from the server, or prepare to read data | |
884 * packets if we're reading data interleaved over the TCP/RTSP | |
885 * connection as well. | |
886 * | |
887 * @param s RTSP demuxer context | |
888 * @param reply pointer where the RTSP message header will be stored | |
889 * @param content_ptr pointer where the RTSP message body, if any, will | |
890 * be stored (length is in reply) | |
891 * @param return_on_interleaved_data whether the function may return if we | |
892 * encounter a data marker ('$'), which precedes data | |
893 * packets over interleaved TCP/RTSP connections. If this | |
894 * is set, this function will return 1 after encountering | |
895 * a '$'. If it is not set, the function will skip any | |
896 * data packets (if they are encountered), until a reply | |
897 * has been fully parsed. If no more data is available | |
898 * without parsing a reply, it will return an error. | |
899 * | |
900 * @returns 1 if a data packets is ready to be received, -1 on error, | |
901 * and 0 on success. | |
902 */ | |
903 static int rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, | |
904 unsigned char **content_ptr, | 883 unsigned char **content_ptr, |
905 int return_on_interleaved_data) | 884 int return_on_interleaved_data) |
906 { | 885 { |
907 RTSPState *rt = s->priv_data; | 886 RTSPState *rt = s->priv_data; |
908 char buf[4096], buf1[1024], *q; | 887 char buf[4096], buf1[1024], *q; |
985 return AVERROR(EPERM); | 964 return AVERROR(EPERM); |
986 | 965 |
987 return 0; | 966 return 0; |
988 } | 967 } |
989 | 968 |
990 static void rtsp_send_cmd_with_content_async(AVFormatContext *s, | 969 void rtsp_send_cmd_with_content_async(AVFormatContext *s, |
991 const char *cmd, | 970 const char *cmd, |
992 const unsigned char *send_content, | 971 const unsigned char *send_content, |
993 int send_content_length) | 972 int send_content_length) |
994 { | 973 { |
995 RTSPState *rt = s->priv_data; | 974 RTSPState *rt = s->priv_data; |
1017 if (send_content_length > 0 && send_content) | 996 if (send_content_length > 0 && send_content) |
1018 url_write(rt->rtsp_hd, send_content, send_content_length); | 997 url_write(rt->rtsp_hd, send_content, send_content_length); |
1019 rt->last_cmd_time = av_gettime(); | 998 rt->last_cmd_time = av_gettime(); |
1020 } | 999 } |
1021 | 1000 |
1022 static void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd) | 1001 void rtsp_send_cmd_async(AVFormatContext *s, const char *cmd) |
1023 { | 1002 { |
1024 rtsp_send_cmd_with_content_async(s, cmd, NULL, 0); | 1003 rtsp_send_cmd_with_content_async(s, cmd, NULL, 0); |
1025 } | 1004 } |
1026 | 1005 |
1027 static void rtsp_send_cmd(AVFormatContext *s, | 1006 void rtsp_send_cmd(AVFormatContext *s, |
1028 const char *cmd, RTSPMessageHeader *reply, | 1007 const char *cmd, RTSPMessageHeader *reply, |
1029 unsigned char **content_ptr) | 1008 unsigned char **content_ptr) |
1030 { | 1009 { |
1031 rtsp_send_cmd_async(s, cmd); | 1010 rtsp_send_cmd_async(s, cmd); |
1032 | 1011 |
1033 rtsp_read_reply(s, reply, content_ptr, 0); | 1012 rtsp_read_reply(s, reply, content_ptr, 0); |
1034 } | 1013 } |
1035 | 1014 |
1036 static void rtsp_send_cmd_with_content(AVFormatContext *s, | 1015 void rtsp_send_cmd_with_content(AVFormatContext *s, |
1037 const char *cmd, | 1016 const char *cmd, |
1038 RTSPMessageHeader *reply, | 1017 RTSPMessageHeader *reply, |
1039 unsigned char **content_ptr, | 1018 unsigned char **content_ptr, |
1040 const unsigned char *send_content, | 1019 const unsigned char *send_content, |
1041 int send_content_length) | 1020 int send_content_length) |
1395 } | 1374 } |
1396 | 1375 |
1397 return 0; | 1376 return 0; |
1398 } | 1377 } |
1399 | 1378 |
1400 static int rtsp_connect(AVFormatContext *s) | 1379 int rtsp_connect(AVFormatContext *s) |
1401 { | 1380 { |
1402 RTSPState *rt = s->priv_data; | 1381 RTSPState *rt = s->priv_data; |
1403 char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128]; | 1382 char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128]; |
1404 char *option_list, *option, *filename; | 1383 char *option_list, *option, *filename; |
1405 URLContext *rtsp_hd; | 1384 URLContext *rtsp_hd; |