History

avformat/hlsenc: use AV_OPT_TYPE_DURATION

Limin Wang committed 5 years ago

Commit 38caef31 parent 3c41d0b2 files · +20 −13Browse files

Showing the changes to libavformat (1 of 2 files). Show all

Unified · Split

libavformat/hlsenc.c+9−9
@@ -196,8 +196,8 @@ typedef struct HLSContext { · 195 unmodified lines
196 int64_t start_sequence;196 int64_t start_sequence;
197 uint32_t start_sequence_source_type; // enum StartSequenceSourceType197 uint32_t start_sequence_source_type; // enum StartSequenceSourceType
198 198
199 float time; // Set by a private option.199 int64_t time; // Set by a private option.
200 float init_time; // Set by a private option.200 int64_t init_time; // Set by a private option.
201 int max_nb_segments; // Set by a private option.201 int max_nb_segments; // Set by a private option.
202 int hls_delete_threshold; // Set by a private option.202 int hls_delete_threshold; // Set by a private option.
203#if FF_API_HLS_WRAP203#if FF_API_HLS_WRAP
@@ -2458,9 +2458,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) · 2254 unmodified lines
2458 2458
2459 if (vs->sequence - vs->nb_entries > hls->start_sequence && hls->init_time > 0) {2459 if (vs->sequence - vs->nb_entries > hls->start_sequence && hls->init_time > 0) {
2460 /* reset end_pts, hls->recording_time at end of the init hls list */2460 /* reset end_pts, hls->recording_time at end of the init hls list */
2461 int64_t init_list_dur = hls->init_time * vs->nb_entries * AV_TIME_BASE;2461 int64_t init_list_dur = hls->init_time * vs->nb_entries;
2462 int64_t after_init_list_dur = (vs->sequence - hls->start_sequence - vs->nb_entries) * (hls->time * AV_TIME_BASE);2462 int64_t after_init_list_dur = (vs->sequence - hls->start_sequence - vs->nb_entries) * hls->time;
2463 hls->recording_time = hls->time * AV_TIME_BASE;2463 hls->recording_time = hls->time;
2464 end_pts = init_list_dur + after_init_list_dur ;2464 end_pts = init_list_dur + after_init_list_dur ;
2465 }2465 }
2466 2466
@@ -2945,7 +2945,7 @@ static int hls_init(AVFormatContext *s) · 478 unmodified lines
2945 av_log(hls, AV_LOG_DEBUG, "start_number evaluated to %"PRId64"\n", hls->start_sequence);2945 av_log(hls, AV_LOG_DEBUG, "start_number evaluated to %"PRId64"\n", hls->start_sequence);
2946 }2946 }
2947 2947
2948 hls->recording_time = (hls->init_time ? hls->init_time : hls->time) * AV_TIME_BASE;2948 hls->recording_time = hls->init_time ? hls->init_time : hls->time;
2949 2949
2950 if (hls->flags & HLS_SPLIT_BY_TIME && hls->flags & HLS_INDEPENDENT_SEGMENTS) {2950 if (hls->flags & HLS_SPLIT_BY_TIME && hls->flags & HLS_INDEPENDENT_SEGMENTS) {
2951 // Independent segments cannot be guaranteed when splitting by time2951 // Independent segments cannot be guaranteed when splitting by time
@@ -3098,7 +3098,7 @@ static int hls_init(AVFormatContext *s) · 146 unmodified lines
3098 av_log(s, AV_LOG_WARNING, "append_list mode does not support hls_init_time,"3098 av_log(s, AV_LOG_WARNING, "append_list mode does not support hls_init_time,"
3099 " hls_init_time value will have no effect\n");3099 " hls_init_time value will have no effect\n");
3100 hls->init_time = 0;3100 hls->init_time = 0;
3101 hls->recording_time = hls->time * AV_TIME_BASE;3101 hls->recording_time = hls->time;
3102 }3102 }
3103 }3103 }
3104 3104
@@ -3114,8 +3114,8 @@ static int hls_init(AVFormatContext *s) · 9 unmodified lines
3114#define E AV_OPT_FLAG_ENCODING_PARAM3114#define E AV_OPT_FLAG_ENCODING_PARAM
3115static const AVOption options[] = {3115static const AVOption options[] = {
3116 {"start_number", "set first number in the sequence", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, E},3116 {"start_number", "set first number in the sequence", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, E},
3117 {"hls_time", "set segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E},3117 {"hls_time", "set segment length", OFFSET(time), AV_OPT_TYPE_DURATION, {.i64 = 2000000}, 0, INT64_MAX, E},
3118 {"hls_init_time", "set segment length in seconds at init list", OFFSET(init_time), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0, FLT_MAX, E},3118 {"hls_init_time", "set segment length at init list", OFFSET(init_time), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, E},
3119 {"hls_list_size", "set maximum number of playlist entries", OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E},3119 {"hls_list_size", "set maximum number of playlist entries", OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E},
3120 {"hls_delete_threshold", "set number of unreferenced segments to keep before deleting", OFFSET(hls_delete_threshold), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, E},3120 {"hls_delete_threshold", "set number of unreferenced segments to keep before deleting", OFFSET(hls_delete_threshold), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, E},
3121 {"hls_ts_options","set hls mpegts list of options for the container format used for hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, E},3121 {"hls_ts_options","set hls mpegts list of options for the container format used for hls", OFFSET(format_options), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, E},

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t