diff options
author | Martin Storsjö <martin@martin.st> | 2010-10-21 12:13:02 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-10-21 12:13:02 +0000 |
commit | 8bf0f969547ec694a314764e7ca3d883bf416b21 (patch) | |
tree | fba81fcd29f2a8d0383d264e24180621d1982d36 /libavformat/rtsp.c | |
parent | b4a6c8fb50ac60d2d80b9208a9d60a7dbf1ec031 (diff) | |
download | ffmpeg-8bf0f969547ec694a314764e7ca3d883bf416b21.tar.gz |
rtsp: Reorder functions
Originally committed as revision 25534 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index aff745a370..f82fe3d62d 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -87,6 +87,44 @@ static void get_word(char *buf, int buf_size, const char **pp) get_word_until_chars(buf, buf_size, SPACE_CHARS, pp); } +/** Parse a string p in the form of Range:npt=xx-xx, and determine the start + * and end time. + * Used for seeking in the rtp stream. + */ +static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) +{ + char buf[256]; + + p += strspn(p, SPACE_CHARS); + if (!av_stristart(p, "npt=", &p)) + return; + + *start = AV_NOPTS_VALUE; + *end = AV_NOPTS_VALUE; + + get_word_sep(buf, sizeof(buf), "-", &p); + *start = parse_date(buf, 1); + if (*p == '-') { + p++; + get_word_sep(buf, sizeof(buf), "-", &p); + *end = parse_date(buf, 1); + } +// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); +// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); +} + +static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) +{ + struct addrinfo hints, *ai = NULL; + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + if (getaddrinfo(buf, NULL, &hints, &ai)) + return -1; + memcpy(sock, ai->ai_addr, FFMIN(sizeof(*sock), ai->ai_addrlen)); + freeaddrinfo(ai); + return 0; +} + /* parse the rtpmap description: <codec_name>/<clock_rate>[/<other params>] */ static int sdp_parse_rtpmap(AVFormatContext *s, AVCodecContext *codec, RTSPStream *rtsp_st, @@ -186,44 +224,6 @@ int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, return 0; } -/** Parse a string p in the form of Range:npt=xx-xx, and determine the start - * and end time. - * Used for seeking in the rtp stream. - */ -static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end) -{ - char buf[256]; - - p += strspn(p, SPACE_CHARS); - if (!av_stristart(p, "npt=", &p)) - return; - - *start = AV_NOPTS_VALUE; - *end = AV_NOPTS_VALUE; - - get_word_sep(buf, sizeof(buf), "-", &p); - *start = parse_date(buf, 1); - if (*p == '-') { - p++; - get_word_sep(buf, sizeof(buf), "-", &p); - *end = parse_date(buf, 1); - } -// av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start); -// av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end); -} - -static int get_sockaddr(const char *buf, struct sockaddr_storage *sock) -{ - struct addrinfo hints, *ai = NULL; - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_NUMERICHOST; - if (getaddrinfo(buf, NULL, &hints, &ai)) - return -1; - memcpy(sock, ai->ai_addr, FFMIN(sizeof(*sock), ai->ai_addrlen)); - freeaddrinfo(ai); - return 0; -} - typedef struct SDPParseState { /* SDP only */ struct sockaddr_storage default_ip; |