LCOV - code coverage report
Current view: top level - libavformat - protocols.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 32 59.4 %
Date: 2017-12-12 03:56:30 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*
       2             :  * This file is part of FFmpeg.
       3             :  *
       4             :  * FFmpeg is free software; you can redistribute it and/or
       5             :  * modify it under the terms of the GNU Lesser General Public
       6             :  * License as published by the Free Software Foundation; either
       7             :  * version 2.1 of the License, or (at your option) any later version.
       8             :  *
       9             :  * FFmpeg is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             :  * Lesser General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU Lesser General Public
      15             :  * License along with FFmpeg; if not, write to the Free Software
      16             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      17             :  */
      18             : 
      19             : #include "config.h"
      20             : 
      21             : #include "libavutil/avstring.h"
      22             : #include "libavutil/mem.h"
      23             : 
      24             : #include "url.h"
      25             : 
      26             : extern const URLProtocol ff_async_protocol;
      27             : extern const URLProtocol ff_bluray_protocol;
      28             : extern const URLProtocol ff_cache_protocol;
      29             : extern const URLProtocol ff_concat_protocol;
      30             : extern const URLProtocol ff_crypto_protocol;
      31             : extern const URLProtocol ff_data_protocol;
      32             : extern const URLProtocol ff_ffrtmpcrypt_protocol;
      33             : extern const URLProtocol ff_ffrtmphttp_protocol;
      34             : extern const URLProtocol ff_file_protocol;
      35             : extern const URLProtocol ff_ftp_protocol;
      36             : extern const URLProtocol ff_gopher_protocol;
      37             : extern const URLProtocol ff_hls_protocol;
      38             : extern const URLProtocol ff_http_protocol;
      39             : extern const URLProtocol ff_httpproxy_protocol;
      40             : extern const URLProtocol ff_https_protocol;
      41             : extern const URLProtocol ff_icecast_protocol;
      42             : extern const URLProtocol ff_mmsh_protocol;
      43             : extern const URLProtocol ff_mmst_protocol;
      44             : extern const URLProtocol ff_md5_protocol;
      45             : extern const URLProtocol ff_pipe_protocol;
      46             : extern const URLProtocol ff_prompeg_protocol;
      47             : extern const URLProtocol ff_rtmp_protocol;
      48             : extern const URLProtocol ff_rtmpe_protocol;
      49             : extern const URLProtocol ff_rtmps_protocol;
      50             : extern const URLProtocol ff_rtmpt_protocol;
      51             : extern const URLProtocol ff_rtmpte_protocol;
      52             : extern const URLProtocol ff_rtmpts_protocol;
      53             : extern const URLProtocol ff_rtp_protocol;
      54             : extern const URLProtocol ff_sctp_protocol;
      55             : extern const URLProtocol ff_srtp_protocol;
      56             : extern const URLProtocol ff_subfile_protocol;
      57             : extern const URLProtocol ff_tee_protocol;
      58             : extern const URLProtocol ff_tcp_protocol;
      59             : extern const URLProtocol ff_tls_protocol;
      60             : extern const URLProtocol ff_udp_protocol;
      61             : extern const URLProtocol ff_udplite_protocol;
      62             : extern const URLProtocol ff_unix_protocol;
      63             : extern const URLProtocol ff_librtmp_protocol;
      64             : extern const URLProtocol ff_librtmpe_protocol;
      65             : extern const URLProtocol ff_librtmps_protocol;
      66             : extern const URLProtocol ff_librtmpt_protocol;
      67             : extern const URLProtocol ff_librtmpte_protocol;
      68             : extern const URLProtocol ff_libssh_protocol;
      69             : extern const URLProtocol ff_libsmbclient_protocol;
      70             : 
      71             : #include "libavformat/protocol_list.c"
      72             : 
      73     1175192 : const AVClass *ff_urlcontext_child_class_next(const AVClass *prev)
      74             : {
      75             :     int i;
      76             : 
      77             :     /* find the protocol that corresponds to prev */
      78    18075447 :     for (i = 0; prev && url_protocols[i]; i++) {
      79    18019484 :         if (url_protocols[i]->priv_data_class == prev) {
      80     1119229 :             i++;
      81     1119229 :             break;
      82             :         }
      83             :     }
      84             : 
      85             :     /* find next protocol with priv options */
      86     1622886 :     for (; url_protocols[i]; i++)
      87     1566925 :         if (url_protocols[i]->priv_data_class)
      88     1119231 :             return url_protocols[i]->priv_data_class;
      89       55961 :     return NULL;
      90             : }
      91             : 
      92             : 
      93           0 : const char *avio_enum_protocols(void **opaque, int output)
      94             : {
      95           0 :     const URLProtocol **p = *opaque;
      96             : 
      97           0 :     p = p ? p + 1 : url_protocols;
      98           0 :     *opaque = p;
      99           0 :     if (!*p) {
     100           0 :         *opaque = NULL;
     101           0 :         return NULL;
     102             :     }
     103           0 :     if ((output && (*p)->url_write) || (!output && (*p)->url_read))
     104           0 :         return (*p)->name;
     105           0 :     return avio_enum_protocols(opaque, output);
     106             : }
     107             : 
     108      115417 : const URLProtocol **ffurl_get_protocols(const char *whitelist,
     109             :                                         const char *blacklist)
     110             : {
     111             :     const URLProtocol **ret;
     112      115417 :     int i, ret_idx = 0;
     113             : 
     114      115417 :     ret = av_mallocz_array(FF_ARRAY_ELEMS(url_protocols), sizeof(*ret));
     115      115417 :     if (!ret)
     116           0 :         return NULL;
     117             : 
     118     3347093 :     for (i = 0; url_protocols[i]; i++) {
     119     3231676 :         const URLProtocol *up = url_protocols[i];
     120             : 
     121     3231676 :         if (whitelist && *whitelist && !av_match_name(up->name, whitelist))
     122           0 :             continue;
     123     3231676 :         if (blacklist && *blacklist && av_match_name(up->name, blacklist))
     124           0 :             continue;
     125             : 
     126     3231676 :         ret[ret_idx++] = up;
     127             :     }
     128             : 
     129      115417 :     return ret;
     130             : }

Generated by: LCOV version 1.13