Revision ab0287fc

View differences:

ffserver.c
2135 2135
        strcpy(input_filename, c->stream->feed->feed_filename);
2136 2136
        buf_size = FFM_PACKET_SIZE;
2137 2137
        /* compute position (absolute time) */
2138
        if (find_info_tag(buf, sizeof(buf), "date", info)) {
2138
        if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
2139 2139
            if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0)
2140 2140
                return ret;
2141
        } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
2141
        } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) {
2142 2142
            int prebuffer = strtol(buf, 0, 10);
2143 2143
            stream_pos = av_gettime() - prebuffer * (int64_t)1000000;
2144 2144
        } else
......
2147 2147
        strcpy(input_filename, c->stream->feed_filename);
2148 2148
        buf_size = 0;
2149 2149
        /* compute position (relative time) */
2150
        if (find_info_tag(buf, sizeof(buf), "date", info)) {
2150
        if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
2151 2151
            if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0)
2152 2152
                return ret;
2153 2153
        } else
libavformat/avformat.h
1501 1501
int ffm_write_write_index(int fd, int64_t pos);
1502 1502
void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
1503 1503

  
1504
#if FF_API_FIND_INFO_TAG
1504 1505
/**
1505
 * Attempt to find a specific tag in a URL.
1506
 *
1507
 * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
1508
 * Return 1 if found.
1506
 * @deprecated use av_find_info_tag in libavutil instead.
1509 1507
 */
1510
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
1508
attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
1509
#endif
1511 1510

  
1512 1511
/**
1513 1512
 * Return in 'buf' the path with '%d' replaced by a number.
libavformat/rtpproto.c
24 24
 * RTP protocol
25 25
 */
26 26

  
27
#include "libavutil/parseutils.h"
27 28
#include "libavutil/avstring.h"
28 29
#include "avformat.h"
29 30
#include "rtpdec.h"
......
161 162

  
162 163
    p = strchr(uri, '?');
163 164
    if (p) {
164
        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
165
        if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
165 166
            ttl = strtol(buf, NULL, 10);
166 167
        }
167
        if (find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
168
        if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
168 169
            rtcp_port = strtol(buf, NULL, 10);
169 170
        }
170
        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
171
        if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
171 172
            local_rtp_port = strtol(buf, NULL, 10);
172 173
        }
173
        if (find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
174
        if (av_find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
174 175
            local_rtp_port = strtol(buf, NULL, 10);
175 176
        }
176
        if (find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
177
        if (av_find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
177 178
            local_rtcp_port = strtol(buf, NULL, 10);
178 179
        }
179
        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
180
        if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
180 181
            max_packet_size = strtol(buf, NULL, 10);
181 182
        }
182
        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
183
        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
183 184
            connect = strtol(buf, NULL, 10);
184 185
        }
185 186
    }
libavformat/sapenc.c
20 20
 */
21 21

  
22 22
#include "avformat.h"
23
#include "libavutil/parseutils.h"
23 24
#include "libavutil/random_seed.h"
24 25
#include "libavutil/avstring.h"
25 26
#include "libavutil/intreadwrite.h"
......
87 88
    option_list = strrchr(path, '?');
88 89
    if (option_list) {
89 90
        char buf[50];
90
        if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
91
        if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
91 92
            port = strtol(buf, NULL, 10);
92 93
        }
93
        if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
94
        if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
94 95
            same_port = strtol(buf, NULL, 10);
95 96
        }
96
        if (find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
97
        if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
97 98
            ttl = strtol(buf, NULL, 10);
98 99
        }
99
        if (find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
100
        if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
100 101
            av_strlcpy(announce_addr, buf, sizeof(announce_addr));
101 102
        }
102 103
    }
libavformat/sdp.c
21 21
#include <string.h>
22 22
#include "libavutil/avstring.h"
23 23
#include "libavutil/base64.h"
24
#include "libavutil/parseutils.h"
24 25
#include "libavcodec/xiph.h"
25 26
#include "avformat.h"
26 27
#include "internal.h"
......
136 137
    if (p) {
137 138
        char buff[64];
138 139

  
139
        if (find_info_tag(buff, sizeof(buff), "ttl", p)) {
140
        if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) {
140 141
            *ttl = strtol(buff, NULL, 10);
141 142
        } else {
142 143
            *ttl = 5;
libavformat/udp.c
27 27
#define _BSD_SOURCE     /* Needed for using struct ip_mreq with recent glibc */
28 28
#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
29 29
#include "avformat.h"
30
#include "libavutil/parseutils.h"
30 31
#include <unistd.h>
31 32
#include "internal.h"
32 33
#include "network.h"
......
259 260
    s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr);
260 261
    p = strchr(uri, '?');
261 262
    if (p) {
262
        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
263
        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
263 264
            int was_connected = s->is_connected;
264 265
            s->is_connected = strtol(buf, NULL, 10);
265 266
            if (s->is_connected && !was_connected) {
......
330 331

  
331 332
    p = strchr(uri, '?');
332 333
    if (p) {
333
        if (find_info_tag(buf, sizeof(buf), "reuse", p)) {
334
        if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) {
334 335
            const char *endptr=NULL;
335 336
            s->reuse_socket = strtol(buf, &endptr, 10);
336 337
            /* assume if no digits were found it is a request to enable it */
......
338 339
                s->reuse_socket = 1;
339 340
            reuse_specified = 1;
340 341
        }
341
        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
342
        if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
342 343
            s->ttl = strtol(buf, NULL, 10);
343 344
        }
344
        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
345
        if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
345 346
            s->local_port = strtol(buf, NULL, 10);
346 347
        }
347
        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
348
        if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
348 349
            h->max_packet_size = strtol(buf, NULL, 10);
349 350
        }
350
        if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
351
        if (av_find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
351 352
            s->buffer_size = strtol(buf, NULL, 10);
352 353
        }
353
        if (find_info_tag(buf, sizeof(buf), "connect", p)) {
354
        if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
354 355
            s->is_connected = strtol(buf, NULL, 10);
355 356
        }
356 357
    }
libavformat/utils.c
3391 3391
}
3392 3392
#endif
3393 3393

  
3394
#if FF_API_FIND_INFO_TAG
3395
#include "libavutil/parseutils.h"
3396

  
3394 3397
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
3395 3398
{
3396
    const char *p;
3397
    char tag[128], *q;
3398

  
3399
    p = info;
3400
    if (*p == '?')
3401
        p++;
3402
    for(;;) {
3403
        q = tag;
3404
        while (*p != '\0' && *p != '=' && *p != '&') {
3405
            if ((q - tag) < sizeof(tag) - 1)
3406
                *q++ = *p;
3407
            p++;
3408
        }
3409
        *q = '\0';
3410
        q = arg;
3411
        if (*p == '=') {
3412
            p++;
3413
            while (*p != '&' && *p != '\0') {
3414
                if ((q - arg) < arg_size - 1) {
3415
                    if (*p == '+')
3416
                        *q++ = ' ';
3417
                    else
3418
                        *q++ = *p;
3419
                }
3420
                p++;
3421
            }
3422
        }
3423
        *q = '\0';
3424
        if (!strcmp(tag, tag1))
3425
            return 1;
3426
        if (*p != '&')
3427
            break;
3428
        p++;
3429
    }
3430
    return 0;
3399
    return av_find_info_tag(arg, arg_size, tag1, info);
3431 3400
}
3401
#endif
3432 3402

  
3433 3403
int av_get_frame_filename(char *buf, int buf_size,
3434 3404
                          const char *path, int number)
libavformat/version.h
98 98
#ifndef FF_API_PARSE_DATE
99 99
#define FF_API_PARSE_DATE              (LIBAVFORMAT_VERSION_MAJOR < 54)
100 100
#endif
101
#ifndef FF_API_FIND_INFO_TAG
102
#define FF_API_FIND_INFO_TAG           (LIBAVFORMAT_VERSION_MAJOR < 54)
103
#endif
101 104

  
102 105
#endif //AVFORMAT_VERSION_H
libavutil/parseutils.c
608 608
    return 0;
609 609
}
610 610

  
611
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
612
{
613
    const char *p;
614
    char tag[128], *q;
615

  
616
    p = info;
617
    if (*p == '?')
618
        p++;
619
    for(;;) {
620
        q = tag;
621
        while (*p != '\0' && *p != '=' && *p != '&') {
622
            if ((q - tag) < sizeof(tag) - 1)
623
                *q++ = *p;
624
            p++;
625
        }
626
        *q = '\0';
627
        q = arg;
628
        if (*p == '=') {
629
            p++;
630
            while (*p != '&' && *p != '\0') {
631
                if ((q - arg) < arg_size - 1) {
632
                    if (*p == '+')
633
                        *q++ = ' ';
634
                    else
635
                        *q++ = *p;
636
                }
637
                p++;
638
            }
639
        }
640
        *q = '\0';
641
        if (!strcmp(tag, tag1))
642
            return 1;
643
        if (*p != '&')
644
            break;
645
        p++;
646
    }
647
    return 0;
648
}
649

  
611 650
#ifdef TEST
612 651

  
613 652
#undef printf
libavutil/parseutils.h
106 106
 */
107 107
int av_parse_time(int64_t *timeval, const char *timestr, int duration);
108 108

  
109
/**
110
 * Attempt to find a specific tag in a URL.
111
 *
112
 * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
113
 * Return 1 if found.
114
 */
115
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
116

  
109 117
#endif /* AVUTIL_PARSEUTILS_H */

Also available in: Unified diff