| @@ -101,7 +101,9 @@ typedef struct HLSContext { · 100 unmodified lines |
| 101 | 101 | float time; // Set by a private option. |
| 102 | 102 | float init_time; // Set by a private option. |
| 103 | 103 | int max_nb_segments; // Set by a private option. |
| 104 | +#if FF_API_HLS_WRAP |
| 104 | 105 | int wrap; // Set by a private option. |
| 106 | +#endif |
| 105 | 107 | uint32_t flags; // enum HLSFlags |
| 106 | 108 | uint32_t pl_type; // enum PlaylistType |
| 107 | 109 | char *segment_filename; |
| @@ -566,7 +568,11 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double · 458 unmodified lines |
| 566 | 568 | hls->initial_prog_date_time += en->duration; |
| 567 | 569 | hls->segments = en->next; |
| 568 | 570 | if (en && hls->flags & HLS_DELETE_SEGMENTS && |
| 571 | +#if FF_API_HLS_WRAP |
| 569 | 572 | !(hls->flags & HLS_SINGLE_FILE || hls->wrap)) { |
| 573 | +#else |
| 574 | + !(hls->flags & HLS_SINGLE_FILE)) { |
| 575 | +#endif |
| 570 | 576 | en->next = hls->old_segments; |
| 571 | 577 | hls->old_segments = en; |
| 572 | 578 | if ((ret = hls_delete_old_segments(hls)) < 0) |
| @@ -834,7 +840,11 @@ static int hls_start(AVFormatContext *s) · 261 unmodified lines |
| 834 | 840 | sizeof(vtt_oc->filename)); |
| 835 | 841 | } else if (c->max_seg_size > 0) { |
| 836 | 842 | if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), |
| 843 | +#if FF_API_HLS_WRAP |
| 837 | 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 | 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 | 849 | return AVERROR(EINVAL); |
| 840 | 850 | } |
| @@ -853,7 +863,11 @@ static int hls_start(AVFormatContext *s) · 12 unmodified lines |
| 853 | 863 | if (!filename) |
| 854 | 864 | return AVERROR(ENOMEM); |
| 855 | 865 | if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), |
| 866 | +#if FF_API_HLS_WRAP |
| 856 | 867 | filename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { |
| 868 | +#else |
| 869 | + filename, 'd', c->sequence) < 1) { |
| 870 | +#endif |
| 857 | 871 | av_log(c, AV_LOG_ERROR, |
| 858 | 872 | "Invalid second level segment filename template '%s', " |
| 859 | 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 | 924 | av_free(fn_copy); |
| 911 | 925 | } |
| 912 | 926 | } else if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), |
| 927 | +#if FF_API_HLS_WRAP |
| 913 | 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 | 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 | 933 | return AVERROR(EINVAL); |
| 916 | 934 | } |
| 917 | 935 | if( c->vtt_basename) { |
| 918 | 936 | if (replace_int_data_in_filename(vtt_oc->filename, sizeof(vtt_oc->filename), |
| 937 | +#if FF_API_HLS_WRAP |
| 919 | 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 | 942 | av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->vtt_basename); |
| 921 | 943 | return AVERROR(EINVAL); |
| 922 | 944 | } |
| @@ -1421,7 +1443,9 @@ static const AVOption options[] = { · 498 unmodified lines |
| 1421 | 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 | 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 | 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 | 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 | 1450 | {"hls_base_url", "url to prepend to each playlist entry", OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, |
| 1427 | 1451 | {"hls_segment_filename", "filename template for segment files", OFFSET(segment_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, |