[FFmpeg-devel] [PATCH] avformat/hlsenc: Allow setting master_pl_publish_rate to a negative value to have it write immediately
Dave Johansen
davejohansen at gmail.com
Fri Nov 3 19:33:32 EET 2023
---
libavformat/hlsenc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4ef84c05c1..76d8094de6 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -245,7 +245,7 @@ typedef struct HLSContext {
char *var_stream_map; /* user specified variant stream map string */
char *cc_stream_map; /* user specified closed caption streams map string */
char *master_pl_name;
- unsigned int master_publish_rate;
+ int master_publish_rate;
int http_persistent;
AVIOContext *m3u8_out;
AVIOContext *sub_m3u8_out;
@@ -1388,7 +1388,9 @@ static int create_master_playlist(AVFormatContext *s,
char temp_filename[MAX_URL_SIZE];
input_vs->m3u8_created = 1;
- if (!hls->master_m3u8_created) {
+ if (hls->master_publish_rate < 0) {
+ hls->master_publish_rate = 0;
+ } else if (!hls->master_m3u8_created) {
/* For the first time, wait until all the media playlists are created */
for (i = 0; i < hls->nb_varstreams; i++)
if (!hls->var_streams[i].m3u8_created)
@@ -3162,7 +3164,7 @@ static const AVOption options[] = {
{"var_stream_map", "Variant stream map string", OFFSET(var_stream_map), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
{"cc_stream_map", "Closed captions stream map string", OFFSET(cc_stream_map), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
{"master_pl_name", "Create HLS master playlist with this name", OFFSET(master_pl_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
- {"master_pl_publish_rate", "Publish master play list every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, E},
+ {"master_pl_publish_rate", "Publish master play list every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, E},
{"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
{"timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E },
{"ignore_io_errors", "Ignore IO errors for stable long-duration runs with network output", OFFSET(ignore_io_errors), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
--
2.39.2 (Apple Git-143)
More information about the ffmpeg-devel
mailing list