MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / hls_init

Function hls_init

libavformat/hlsenc.c:2852–3100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2850
2851
2852static int hls_init(AVFormatContext *s)
2853{
2854 int ret = 0;
2855 int i = 0;
2856 int j = 0;
2857 HLSContext *hls = s->priv_data;
2858 const char *pattern;
2859 VariantStream *vs = NULL;
2860 const char *vtt_pattern = hls->flags & HLS_SINGLE_FILE ? ".vtt" : "%d.vtt";
2861 char *p = NULL;
2862 int http_base_proto = ff_is_http_proto(s->url);
2863 int fmp4_init_filename_len = strlen(hls->fmp4_init_filename) + 1;
2864 double initial_program_date_time = av_gettime() / 1000000.0;
2865
2866 if (hls->use_localtime) {
2867 pattern = get_default_pattern_localtime_fmt(s);
2868 } else {
2869 pattern = hls->segment_type == SEGMENT_TYPE_FMP4 ? "%d.m4s" : "%d.ts";
2870 if (hls->flags & HLS_SINGLE_FILE)
2871 pattern += 2;
2872 }
2873
2874 hls->has_default_key = 0;
2875 hls->has_video_m3u8 = 0;
2876 ret = update_variant_stream_info(s);
2877 if (ret < 0) {
2878 av_log(s, AV_LOG_ERROR, "Variant stream info update failed with status %x\n",
2879 ret);
2880 return ret;
2881 }
2882
2883 if (!hls->method && http_base_proto) {
2884 av_log(hls, AV_LOG_WARNING, "No HTTP method set, hls muxer defaulting to method PUT.\n");
2885 }
2886
2887 ret = validate_name(hls->nb_varstreams, s->url);
2888 if (ret < 0)
2889 return ret;
2890
2891 if (hls->segment_filename) {
2892 ret = validate_name(hls->nb_varstreams, hls->segment_filename);
2893 if (ret < 0)
2894 return ret;
2895 }
2896
2897 if (av_strcasecmp(hls->fmp4_init_filename, "init.mp4")) {
2898 ret = validate_name(hls->nb_varstreams, hls->fmp4_init_filename);
2899 if (ret < 0)
2900 return ret;
2901 }
2902
2903 if (hls->subtitle_filename) {
2904 ret = validate_name(hls->nb_varstreams, hls->subtitle_filename);
2905 if (ret < 0)
2906 return ret;
2907 }
2908
2909 if (hls->master_pl_name) {

Callers

nothing calls this directly

Calls 15

ff_is_http_protoFunction · 0.85
av_gettimeFunction · 0.85
av_logFunction · 0.85
validate_nameFunction · 0.85
av_strcasecmpFunction · 0.85
update_master_pl_infoFunction · 0.85
format_nameFunction · 0.85
av_asprintfFunction · 0.85
av_strdupFunction · 0.85
av_strlcpyFunction · 0.85

Tested by

no test coverage detected