From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B257347312 for ; Tue, 5 Sep 2023 09:46:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1797B68C687; Tue, 5 Sep 2023 12:46:04 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D93F268C4DB for ; Tue, 5 Sep 2023 12:45:57 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9B87024018E for ; Tue, 5 Sep 2023 11:45:57 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id LTI7ZyhplexH for ; Tue, 5 Sep 2023 11:45:56 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id C407E240177 for ; Tue, 5 Sep 2023 11:45:56 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 9D72E1601B9; Tue, 5 Sep 2023 11:45:56 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <143d82a2-e523-189c-a16a-07271ac0da78@gmail.com> References: <143d82a2-e523-189c-a16a-07271ac0da78@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 05 Sep 2023 11:45:56 +0200 Message-ID: <169390715661.20400.16526535502391466715@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v2] libavformat/data_uri: export mime_type of data urls X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting David Lou (2023-07-03 21:17:40) > Fix the fact that ffprobe no longer detects m3u8 in a data url correctly. > > For example, > > ffprobe data:application/vnd.apple.mpegurl;base64,I0VYVE0zVQojRVhULVgtVkVSU0lPTjozCiNFWFQtWC1UQVJHRVREVVJBVElPTjozMAojRVhUSU5GOjMwLApodHRwczovL2Rvd25sb2FkLnNhbXBsZWxpYi5jb20vbXA0L3NhbXBsZS0zMHMubXA0 > > This provides the mime_type hls detection requires. > > Thank you. > > Hopefully this patch doesn't get truncated by email again. > > Signed-off-by: David Lou > --- > libavformat/data_uri.c | 37 ++++++++++++++++++++++++++++++------- > 1 file changed, 30 insertions(+), 7 deletions(-) > > diff --git a/libavformat/data_uri.c b/libavformat/data_uri.c > index 28eb2b9e08..fdc1a2eef9 100644 > --- a/libavformat/data_uri.c > +++ b/libavformat/data_uri.c > @@ -19,18 +19,24 @@ > */ > > #include > + Spurious extra line. Same below DataContext. > #include "libavutil/avstring.h" > #include "libavutil/avutil.h" > #include "libavutil/base64.h" > +#include "libavutil/opt.h" > + > #include "url.h" > > typedef struct { > + const AVClass *class; > const uint8_t *data; > void *tofree; > size_t size; > size_t pos; > + char *mime_type; > } DataContext; > > + > static av_cold int data_open(URLContext *h, const char *uri, int flags) > { > DataContext *dc = h->priv_data; > @@ -56,8 +62,10 @@ static av_cold int data_open(URLContext *h, const char *uri, int flags) > (int)(next - opt), opt); > return AVERROR(EINVAL); > } > - av_log(h, AV_LOG_VERBOSE, "Content-type: %.*s\n", > - (int)(next - opt), opt); > + av_free(dc->mime_type); > + dc->mime_type = av_strndup(opt, (int)(next - opt)); You need to check the result for NULL and return AVERROR(ENOMEM) on failure. A FATE test would be very nice. -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".