| @@ -101,7 +101,9 @@ typedef struct HLSContext { · 100 unmodified lines |
| 101 | float time; // Set by a private option. | 101 | float time; // Set by a private option. |
| 102 | float init_time; // Set by a private option. | 102 | float init_time; // Set by a private option. |
| 103 | int max_nb_segments; // Set by a private option. | 103 | int max_nb_segments; // Set by a private option. |
| | 104 | #if FF_API_HLS_WRAP |
| 104 | int wrap; // Set by a private option. | 105 | int wrap; // Set by a private option. |
| | 106 | #endif |
| 105 | uint32_t flags; // enum HLSFlags | 107 | uint32_t flags; // enum HLSFlags |
| 106 | uint32_t pl_type; // enum PlaylistType | 108 | uint32_t pl_type; // enum PlaylistType |
| 107 | char *segment_filename; | 109 | char *segment_filename; |
| @@ -566,7 +568,11 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double · 458 unmodified lines |
| 566 | hls->initial_prog_date_time += en->duration; | 568 | hls->initial_prog_date_time += en->duration; |
| 567 | hls->segments = en->next; | 569 | hls->segments = en->next; |
| 568 | if (en && hls->flags & HLS_DELETE_SEGMENTS && | 570 | if (en && hls->flags & HLS_DELETE_SEGMENTS && |
| | 571 | #if FF_API_HLS_WRAP |
| 569 | !(hls->flags & HLS_SINGLE_FILE || hls->wrap)) { | 572 | !(hls->flags & HLS_SINGLE_FILE || hls->wrap)) { |
| | 573 | #else |
| | 574 | !(hls->flags & HLS_SINGLE_FILE)) { |
| | 575 | #endif |
| 570 | en->next = hls->old_segments; | 576 | en->next = hls->old_segments; |
| 571 | hls->old_segments = en; | 577 | hls->old_segments = en; |
| 572 | if ((ret = hls_delete_old_segments(hls)) < 0) | 578 | if ((ret = hls_delete_old_segments(hls)) < 0) |
| @@ -834,7 +840,11 @@ static int hls_start(AVFormatContext *s) · 261 unmodified lines |
| 834 | sizeof(vtt_oc->filename)); | 840 | sizeof(vtt_oc->filename)); |
| 835 | } else if (c->max_seg_size > 0) { | 841 | } else if (c->max_seg_size > 0) { |
| 836 | if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), | 842 | if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), |
| | 843 | #if FF_API_HLS_WRAP |
| 837 | c->basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { | 844 | c->basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { |
| | 845 | #else |
| | 846 | c->basename, 'd', c->sequence) < 1) { |
| | 847 | #endif |
| 838 | av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -use_localtime 1 with it\n", c->basename); | 848 | av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -use_localtime 1 with it\n", c->basename); |
| 839 | return AVERROR(EINVAL); | 849 | return AVERROR(EINVAL); |
| 840 | } | 850 | } |
| @@ -853,7 +863,11 @@ static int hls_start(AVFormatContext *s) · 12 unmodified lines |
| 853 | if (!filename) | 863 | if (!filename) |
| 854 | return AVERROR(ENOMEM); | 864 | return AVERROR(ENOMEM); |
| 855 | if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), | 865 | if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), |
| | 866 | #if FF_API_HLS_WRAP |
| 856 | filename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { | 867 | filename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { |
| | 868 | #else |
| | 869 | filename, 'd', c->sequence) < 1) { |
| | 870 | #endif |
| 857 | av_log(c, AV_LOG_ERROR, | 871 | av_log(c, AV_LOG_ERROR, |
| 858 | "Invalid second level segment filename template '%s', " | 872 | "Invalid second level segment filename template '%s', " |
| 859 | "you can try to remove second_level_segment_index flag\n", | 873 | "you can try to remove second_level_segment_index flag\n", |
| @@ -910,13 +924,21 @@ static int hls_start(AVFormatContext *s) · 50 unmodified lines |
| 910 | av_free(fn_copy); | 924 | av_free(fn_copy); |
| 911 | } | 925 | } |
| 912 | } else if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), | 926 | } else if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), |
| | 927 | #if FF_API_HLS_WRAP |
| 913 | c->basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { | 928 | c->basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { |
| | 929 | #else |
| | 930 | c->basename, 'd', c->sequence) < 1) { |
| | 931 | #endif |
| 914 | av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -use_localtime 1 with it\n", c->basename); | 932 | av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -use_localtime 1 with it\n", c->basename); |
| 915 | return AVERROR(EINVAL); | 933 | return AVERROR(EINVAL); |
| 916 | } | 934 | } |
| 917 | if( c->vtt_basename) { | 935 | if( c->vtt_basename) { |
| 918 | if (replace_int_data_in_filename(vtt_oc->filename, sizeof(vtt_oc->filename), | 936 | if (replace_int_data_in_filename(vtt_oc->filename, sizeof(vtt_oc->filename), |
| | 937 | #if FF_API_HLS_WRAP |
| 919 | c->vtt_basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { | 938 | c->vtt_basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { |
| | 939 | #else |
| | 940 | c->vtt_basename, 'd', c->sequence) < 1) { |
| | 941 | #endif |
| 920 | av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->vtt_basename); | 942 | av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->vtt_basename); |
| 921 | return AVERROR(EINVAL); | 943 | return AVERROR(EINVAL); |
| 922 | } | 944 | } |
| @@ -1421,7 +1443,9 @@ static const AVOption options[] = { · 498 unmodified lines |
| 1421 | {"hls_list_size", "set maximum number of playlist entries", OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E}, | 1443 | {"hls_list_size", "set maximum number of playlist entries", OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E}, |
| 1422 | {"hls_ts_options","set hls mpegts list of options for the container format used for hls", OFFSET(format_options_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, | 1444 | {"hls_ts_options","set hls mpegts list of options for the container format used for hls", OFFSET(format_options_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, |
| 1423 | {"hls_vtt_options","set hls vtt list of options for the container format used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, | 1445 | {"hls_vtt_options","set hls vtt list of options for the container format used for hls", OFFSET(vtt_format_options_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, |
| 1424 | {"hls_wrap", "set number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E}, | 1446 | #if FF_API_HLS_WRAP |
| | 1447 | {"hls_wrap", "set number after which the index wraps (will be deprecated)", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E}, |
| | 1448 | #endif |
| 1425 | {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, E}, | 1449 | {"hls_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, E}, |
| 1426 | {"hls_base_url", "url to prepend to each playlist entry", OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, | 1450 | {"hls_base_url", "url to prepend to each playlist entry", OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, |
| 1427 | {"hls_segment_filename", "filename template for segment files", OFFSET(segment_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, | 1451 | {"hls_segment_filename", "filename template for segment files", OFFSET(segment_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, |