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 <morphological.a...@gmail.com>
> ---
>  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 <string.h>
> +

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-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to