Skip to content

Commit 8e7c445

Browse files
committed
Use av_log for writing to console
1 parent 237f6ce commit 8e7c445

File tree

2 files changed

+60
-28
lines changed

2 files changed

+60
-28
lines changed

contrib/ffmpeg-hls.patch

+30-17
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
From 4609c8356bfbb063a6111aac4c7fa090099aa05b Mon Sep 17 00:00:00 2001
1+
From cd9b080dde5028233b8b827493b973c95896f267 Mon Sep 17 00:00:00 2001
22
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)
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

1212
diff --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`.
6666
diff --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

contrib/ffmpeg-jsonstats.patch

+30-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 63a700576177b1207db038af4b47eac07491be27 Mon Sep 17 00:00:00 2001
1+
From 70ca589dd67895bb87b403d97f899d08f9999b08 Mon Sep 17 00:00:00 2001
22
From: Ingo Oppermann <[email protected]>
3-
Date: Wed, 16 Oct 2024 14:49:25 +0200
4-
Subject: [PATCH v1] progress (7.1.0)
3+
Date: Wed, 8 Jan 2025 13:29:22 +0100
4+
Subject: [PATCH v2] progress (7.1.0)
55

66
---
77
README.PROGRESS.md | 759 ++++++++++++++++++++++++++++++++++++++++
@@ -11,12 +11,12 @@ Subject: [PATCH v1] progress (7.1.0)
1111
fftools/ffmpeg_demux.c | 149 +++-----
1212
fftools/ffmpeg_demux.h | 163 +++++++++
1313
fftools/ffmpeg_filter.c | 10 +-
14-
fftools/ffmpeg_json.c | 649 ++++++++++++++++++++++++++++++++++
14+
fftools/ffmpeg_json.c | 668 +++++++++++++++++++++++++++++++++++
1515
fftools/ffmpeg_json.h | 16 +
1616
fftools/ffmpeg_mux.c | 50 ++-
1717
fftools/ffmpeg_mux.h | 19 +-
1818
fftools/ffmpeg_opt.c | 6 +
19-
12 files changed, 1744 insertions(+), 114 deletions(-)
19+
12 files changed, 1763 insertions(+), 114 deletions(-)
2020
create mode 100644 README.PROGRESS.md
2121
create mode 100644 fftools/ffmpeg_demux.h
2222
create mode 100644 fftools/ffmpeg_json.c
@@ -1296,10 +1296,10 @@ index 7ec328e0..814b5761 100644
12961296
}
12971297
diff --git a/fftools/ffmpeg_json.c b/fftools/ffmpeg_json.c
12981298
new file mode 100644
1299-
index 00000000..3ff956c1
1299+
index 00000000..b63110e1
13001300
--- /dev/null
13011301
+++ b/fftools/ffmpeg_json.c
1302-
@@ -0,0 +1,649 @@
1302+
@@ -0,0 +1,668 @@
13031303
+#include <stdint.h>
13041304
+#include <stdlib.h>
13051305
+#include <string.h>
@@ -1313,6 +1313,7 @@ index 00000000..3ff956c1
13131313
+#include "libavutil/bprint.h"
13141314
+#include "libavutil/channel_layout.h"
13151315
+#include "libavutil/dict.h"
1316+
+#include "libavutil/log.h"
13161317
+#include "libavutil/mem.h"
13171318
+#include "libavutil/opt.h"
13181319
+#include "libavutil/pixdesc.h"
@@ -1411,7 +1412,12 @@ index 00000000..3ff956c1
14111412
+
14121413
+ av_bprintf(&buf, "]");
14131414
+
1414-
+ fprintf(stderr, "%s\n", buf.str);
1415+
+ if (AV_LOG_INFO > av_log_get_level()) {
1416+
+ fprintf(stderr, "%s\n", buf.str);
1417+
+ } else {
1418+
+ av_log(NULL, AV_LOG_INFO, "%s\n", buf.str);
1419+
+ }
1420+
+
14151421
+ fflush(stderr);
14161422
+
14171423
+ av_bprint_finalize(&buf, NULL);
@@ -1502,7 +1508,12 @@ index 00000000..3ff956c1
15021508
+
15031509
+ av_bprintf(&buf, "]");
15041510
+
1505-
+ fprintf(stderr, "%s\n", buf.str);
1511+
+ if (AV_LOG_INFO > av_log_get_level()) {
1512+
+ fprintf(stderr, "%s\n", buf.str);
1513+
+ } else {
1514+
+ av_log(NULL, AV_LOG_INFO, "%s\n", buf.str);
1515+
+ }
1516+
+
15061517
+ fflush(stderr);
15071518
+
15081519
+ av_bprint_finalize(&buf, NULL);
@@ -1669,7 +1680,11 @@ index 00000000..3ff956c1
16691680
+ av_bprintf(&buf, "}");
16701681
+
16711682
+ if(print_jsonstats || is_last_report) {
1672-
+ fprintf(stderr, "%s\n", buf.str);
1683+
+ if (AV_LOG_INFO > av_log_get_level()) {
1684+
+ fprintf(stderr, "%s\n", buf.str);
1685+
+ } else {
1686+
+ av_log(NULL, AV_LOG_INFO, "%s\n", buf.str);
1687+
+ }
16731688
+ fflush(stderr);
16741689
+ }
16751690
+
@@ -1940,7 +1955,11 @@ index 00000000..3ff956c1
19401955
+
19411956
+ av_bprintf(&buf, "]}");
19421957
+
1943-
+ fprintf(stderr, "%s\n", buf.str);
1958+
+ if (AV_LOG_INFO > av_log_get_level()) {
1959+
+ fprintf(stderr, "%s\n", buf.str);
1960+
+ } else {
1961+
+ av_log(NULL, AV_LOG_INFO, "%s\n", buf.str);
1962+
+ }
19441963
+ fflush(stderr);
19451964
+
19461965
+ av_bprint_finalize(&buf, NULL);

0 commit comments

Comments
 (0)