This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit e7610ce8b3be7370cd4f71c30320ba19e59c5b5f Author: Romain Beauxis <[email protected]> AuthorDate: Tue Aug 18 16:58:13 2026 -0500 Commit: Romain Beauxis <[email protected]> CommitDate: Fri Sep 25 16:04:08 2026 +0000 avformat/http: move the ICY packet parser to http.h The libcurl protocol needs the same "Key='Value';" splitting, and http.h is already the seam it shares ff_http_averror() through. --- libavformat/http.c | 30 +----------------------------- libavformat/http.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 7f44450ca0..cb7cab1357 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -2037,34 +2037,6 @@ static int http_read_stream_all(URLContext *h, uint8_t *buf, int size) return pos; } -static void update_metadata(URLContext *h, char *data) -{ - char *key; - char *val; - char *end; - char *next = data; - HTTPContext *s = h->priv_data; - - while (*next) { - key = next; - val = strstr(key, "='"); - if (!val) - break; - end = strstr(val, "';"); - if (!end) - break; - - *val = '\0'; - *end = '\0'; - val += 2; - - av_dict_set(&s->metadata, key, val, 0); - av_log(h, AV_LOG_VERBOSE, "Metadata update for %s: %s\n", key, val); - - next = end + 2; - } -} - static int store_icy(URLContext *h, int size) { HTTPContext *s = h->priv_data; @@ -2094,7 +2066,7 @@ static int store_icy(URLContext *h, int size) data[len] = 0; if ((ret = av_opt_set(s, "icy_metadata_packet", data, 0)) < 0) return ret; - update_metadata(h, data); + ff_http_parse_icy_packet(h, &s->metadata, data); } s->icy_data_read = 0; remaining = s->icy_metaint; diff --git a/libavformat/http.h b/libavformat/http.h index dd2c15789e..42979c910c 100644 --- a/libavformat/http.h +++ b/libavformat/http.h @@ -22,7 +22,11 @@ #ifndef AVFORMAT_HTTP_H #define AVFORMAT_HTTP_H +#include <string.h> + +#include "libavutil/dict.h" #include "libavutil/error.h" +#include "libavutil/log.h" #include "url.h" #define HTTP_HEADERS_SIZE 4096 @@ -48,6 +52,35 @@ typedef struct HTTPStatusLine { int ff_http_parse_status_line(void *logctx, const char *line, HTTPStatusLine *st); +/** + * Split an in-band ICY metadata packet into its "Key='Value';" pairs. + * + * @param logctx context used for logging, may be NULL + * @param metadata dictionary the pairs are stored in + * @param data NUL terminated packet, split in place + */ +static inline void ff_http_parse_icy_packet(void *logctx, + AVDictionary **metadata, char *data) +{ + char *next = data; + + while (*next) { + char *key = next, *val, *end; + + if (!(val = strstr(key, "='")) || !(end = strstr(val, "';"))) + break; + + *val = '\0'; + *end = '\0'; + val += 2; + + av_dict_set(metadata, key, val, 0); + av_log(logctx, AV_LOG_VERBOSE, "Metadata update for %s: %s\n", key, val); + + next = end + 2; + } +} + /** * Initialize the authentication state based on another HTTP URLContext. * This can be used to pre-initialize the authentication parameters if -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
