1- From 4609c8356bfbb063a6111aac4c7fa090099aa05b Mon Sep 17 00:00:00 2001
1+ From cd9b080dde5028233b8b827493b973c95896f267 Mon Sep 17 00:00:00 2001
22From: Ingo Oppermann <
[email protected] >
3- Date: Wed, 16 Oct 2024 14:47:06 +0200
4- Subject: [PATCH v1 ] hls (7.1.0)
3+ Date: Wed, 8 Jan 2025 13:29:31 +0100
4+ Subject: [PATCH v2 ] hls (7.1.0)
55
66---
7- README.HLS.md | 48 ++++++++++++++++++++++++++++++++++
8- libavformat/hlsenc.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
9- 2 files changed, 110 insertions(+)
7+ README.HLS.md | 48 ++++++++++++++++++++++++++++
8+ libavformat/hlsenc.c | 75 ++++++++++++++++++++++++++++++++++++++++++++
9+ 2 files changed, 123 insertions(+)
1010 create mode 100644 README.HLS.md
1111
1212diff --git a/README.HLS.md b/README.HLS.md
@@ -64,7 +64,7 @@ index 00000000..5462338b
6464+
6565+ In the command, the `-var_stream_map` option had the value `v:0,a:0 v:1,a:1`.
6666diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
67- index 1e932b7b..7b76a227 100644
67+ index 1e932b7b..c53b2f18 100644
6868--- a/libavformat/hlsenc.c
6969+++ b/libavformat/hlsenc.c
7070@@ -125,6 +125,7 @@ typedef struct VariantStream {
@@ -129,7 +129,7 @@ index 1e932b7b..7b76a227 100644
129129 if (oc->pb) {
130130 ret = ff_write_chained(oc, stream_index, pkt, s, 0);
131131 vs->video_keyframe_size += pkt->size;
132- @@ -2888,6 +2915,36 @@ failed:
132+ @@ -2888,6 +2915,49 @@ failed:
133133 return 0;
134134 }
135135
@@ -138,35 +138,48 @@ index 1e932b7b..7b76a227 100644
138138+ HLSContext *hls = s->priv_data;
139139+ VariantStream *vs = NULL;
140140+ AVStream *avs = NULL;
141+ + AVBPrint buf;
141142+
142- + fprintf(stderr, "hls.streammap:{\"address\":\"%s\",\"variants\":[", s->url);
143+ + av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
144+ +
145+ + av_bprintf(&buf, "hls.streammap:{\"address\":\"%s\",\"variants\":[", s->url);
143146+ for (i = 0; i < hls->nb_varstreams; i++) {
144147+ vs = &hls->var_streams[i];
145148+
146- + fprintf(stderr , "{\"variant\":%d,\"address\":\"%s\",\"streams\":[", i, vs->m3u8_name);
149+ + av_bprintf(&buf , "{\"variant\":%d,\"address\":\"%s\",\"streams\":[", i, vs->m3u8_name);
147150+ for (j = 0; j < vs->nb_streams; j++) {
148151+ avs = vs->streams[j];
149152+
150- + fprintf(stderr , "%d", avs->index);
153+ + av_bprintf(&buf , "%d", avs->index);
151154+
152155+ if (j != vs->nb_streams-1) {
153- + fprintf(stderr , ",");
156+ + av_bprintf(&buf , ",");
154157+ }
155158+ }
156- + fprintf(stderr , "]}");
159+ + av_bprintf(&buf , "]}");
157160+
158161+ if (i != hls->nb_varstreams-1) {
159- + fprintf(stderr , ",");
162+ + av_bprintf(&buf , ",");
160163+ }
161164+ }
162- + fprintf(stderr, "]}\n");
165+ + av_bprintf(&buf, "]}\n");
166+ +
167+ + if (AV_LOG_INFO > av_log_get_level()) {
168+ + fprintf(stderr, "%s\n", buf.str);
169+ + } else {
170+ + av_log(NULL, AV_LOG_INFO, "%s\n", buf.str);
171+ + }
172+ +
173+ + fflush(stderr);
174+ +
175+ + av_bprint_finalize(&buf, NULL);
163176+
164177+ return;
165178+ }
166179
167180 static int hls_init(AVFormatContext *s)
168181 {
169- @@ -2995,6 +3052 ,8 @@ static int hls_init(AVFormatContext *s)
182+ @@ -2995,6 +3065 ,8 @@ static int hls_init(AVFormatContext *s)
170183 vs->sequence = hls->start_sequence;
171184 vs->start_pts = AV_NOPTS_VALUE;
172185 vs->end_pts = AV_NOPTS_VALUE;
@@ -175,7 +188,7 @@ index 1e932b7b..7b76a227 100644
175188 vs->current_segment_final_filename_fmt[0] = '\0';
176189 vs->initial_prog_date_time = initial_program_date_time;
177190
178- @@ -3137,6 +3196 ,9 @@ static int hls_init(AVFormatContext *s)
191+ @@ -3137,6 +3209 ,9 @@ static int hls_init(AVFormatContext *s)
179192 vs->number++;
180193 }
181194
0 commit comments