1
- From 4609c8356bfbb063a6111aac4c7fa090099aa05b Mon Sep 17 00:00:00 2001
1
+ From cd9b080dde5028233b8b827493b973c95896f267 Mon Sep 17 00:00:00 2001
2
2
From: 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)
5
5
6
6
---
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(+)
10
10
create mode 100644 README.HLS.md
11
11
12
12
diff --git a/README.HLS.md b/README.HLS.md
@@ -64,7 +64,7 @@ index 00000000..5462338b
64
64
+
65
65
+ In the command, the `-var_stream_map` option had the value `v:0,a:0 v:1,a:1`.
66
66
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
67
- index 1e932b7b..7b76a227 100644
67
+ index 1e932b7b..c53b2f18 100644
68
68
--- a/libavformat/hlsenc.c
69
69
+++ b/libavformat/hlsenc.c
70
70
@@ -125,6 +125,7 @@ typedef struct VariantStream {
@@ -129,7 +129,7 @@ index 1e932b7b..7b76a227 100644
129
129
if (oc->pb) {
130
130
ret = ff_write_chained(oc, stream_index, pkt, s, 0);
131
131
vs->video_keyframe_size += pkt->size;
132
- @@ -2888,6 +2915,36 @@ failed:
132
+ @@ -2888,6 +2915,49 @@ failed:
133
133
return 0;
134
134
}
135
135
@@ -138,35 +138,48 @@ index 1e932b7b..7b76a227 100644
138
138
+ HLSContext *hls = s->priv_data;
139
139
+ VariantStream *vs = NULL;
140
140
+ AVStream *avs = NULL;
141
+ + AVBPrint buf;
141
142
+
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);
143
146
+ for (i = 0; i < hls->nb_varstreams; i++) {
144
147
+ vs = &hls->var_streams[i];
145
148
+
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);
147
150
+ for (j = 0; j < vs->nb_streams; j++) {
148
151
+ avs = vs->streams[j];
149
152
+
150
- + fprintf(stderr , "%d", avs->index);
153
+ + av_bprintf(&buf , "%d", avs->index);
151
154
+
152
155
+ if (j != vs->nb_streams-1) {
153
- + fprintf(stderr , ",");
156
+ + av_bprintf(&buf , ",");
154
157
+ }
155
158
+ }
156
- + fprintf(stderr , "]}");
159
+ + av_bprintf(&buf , "]}");
157
160
+
158
161
+ if (i != hls->nb_varstreams-1) {
159
- + fprintf(stderr , ",");
162
+ + av_bprintf(&buf , ",");
160
163
+ }
161
164
+ }
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);
163
176
+
164
177
+ return;
165
178
+ }
166
179
167
180
static int hls_init(AVFormatContext *s)
168
181
{
169
- @@ -2995,6 +3052 ,8 @@ static int hls_init(AVFormatContext *s)
182
+ @@ -2995,6 +3065 ,8 @@ static int hls_init(AVFormatContext *s)
170
183
vs->sequence = hls->start_sequence;
171
184
vs->start_pts = AV_NOPTS_VALUE;
172
185
vs->end_pts = AV_NOPTS_VALUE;
@@ -175,7 +188,7 @@ index 1e932b7b..7b76a227 100644
175
188
vs->current_segment_final_filename_fmt[0] = '\0';
176
189
vs->initial_prog_date_time = initial_program_date_time;
177
190
178
- @@ -3137,6 +3196 ,9 @@ static int hls_init(AVFormatContext *s)
191
+ @@ -3137,6 +3209 ,9 @@ static int hls_init(AVFormatContext *s)
179
192
vs->number++;
180
193
}
181
194
0 commit comments