-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
From 08e17b69f354c31976e344ed92f5c1ebe68759b8 Mon Sep 17 00:00:00 2001 | ||
From 13602d643bd910ff987c51f0a594d81c4354324f Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Sun, 29 Sep 2024 15:59:13 +0800 | ||
Subject: [PATCH 29/33] hls: support segments pretend to be gif & png | ||
|
||
--- | ||
libavformat/hls.c | 28 +++++++++++++++++++++++++++- | ||
1 file changed, 27 insertions(+), 1 deletion(-) | ||
libavformat/hls.c | 29 ++++++++++++++++++++++++++++- | ||
1 file changed, 28 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/libavformat/hls.c b/libavformat/hls.c | ||
index 045741c3b4..525ca999dc 100644 | ||
index 3bdc1bc848..4ab3f2027a 100644 | ||
--- a/libavformat/hls.c | ||
+++ b/libavformat/hls.c | ||
@@ -222,6 +222,7 @@ typedef struct HLSContext { | ||
|
@@ -17,13 +17,14 @@ index 045741c3b4..525ca999dc 100644 | |
AVDictionary *seg_format_opts; | ||
+ int seg_allow_img; | ||
char *allowed_extensions; | ||
int extension_picky; | ||
int max_reload; | ||
int http_persistent; | ||
@@ -2113,7 +2114,30 @@ static int hls_read_header(AVFormatContext *s) | ||
@@ -2162,7 +2163,31 @@ static int hls_read_header(AVFormatContext *s) | ||
pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE; | ||
pls->ctx->interrupt_callback = s->interrupt_callback; | ||
url = av_strdup(pls->segments[0]->url); | ||
- ret = av_probe_input_buffer(&pls->pb.pub, &in_fmt, url, NULL, 0, 0); | ||
+ | ||
+ unsigned skip = 0; | ||
+ if (!c->seg_allow_img) { | ||
+ uint8_t b[10] = { 0 }; // probe at most 10 | ||
|
@@ -48,10 +49,10 @@ index 045741c3b4..525ca999dc 100644 | |
+ } | ||
+ | ||
+ ret = av_probe_input_buffer(&pls->pb.pub, &in_fmt, url, NULL, skip, 0); | ||
if (ret < 0) { | ||
/* Free the ctx - it isn't initialized properly at this point, | ||
* so avformat_close_input shouldn't be called. If | ||
@@ -2590,6 +2614,8 @@ static const AVOption hls_options[] = { | ||
|
||
for (int n = 0; n < pls->n_segments; n++) | ||
if (ret >= 0) | ||
@@ -2646,6 +2671,8 @@ static const AVOption hls_options[] = { | ||
OFFSET(seg_format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, | ||
{"seg_max_retry", "Maximum number of times to reload a segment on error.", | ||
OFFSET(seg_max_retry), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS}, | ||
|