From patchwork Wed Sep 9 06:02:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rcombs X-Patchwork-Id: 22217 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 4ECD744BC6F for ; Wed, 9 Sep 2020 09:02:37 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2EE6968B81F; Wed, 9 Sep 2020 09:02:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 83D5F68B73E for ; Wed, 9 Sep 2020 09:02:34 +0300 (EEST) Received: by mail-io1-f47.google.com with SMTP id d190so1945200iof.3 for ; Tue, 08 Sep 2020 23:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rcombs.me; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=VaCL2GiuD3oMb2yCyYRb1pEOgFEjljqrNQRtReKA3bQ=; b=DFU3BUKOk+WSpOpgwbml7y0G/kxy3v3kjTTILR+zfzHTgECzItIV6Kde4ObMy1ZaBf EKdp8Yxy81eUH7ApQjzJ3vGLMrfbgJx4Edc2IgAG9xZQqLk1YODmtgPA5TPN5gjS8utd jMCuOLZxqvUTFov97pxnt8NyC+8w72gG+ve9pKdFmtySowciGAo1gBYvu4mJPwp2ZV6S Z8tnNbIHywxTQwCt3LfJd4BJqp7jz+8YJMxwUOJr8gXWMIpBlJU7L2GN/FttHNs/aYaa pqI2aE4jLd80bnlUSUsf7/UT0ZELWLajbT1kFxXFJOvNLhbUvrbDk/gmeFAkkrIqG/UO afIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VaCL2GiuD3oMb2yCyYRb1pEOgFEjljqrNQRtReKA3bQ=; b=ssRP6SXECpA7vryR1ISdgTvqVjbcfr5OMqFCCuY7jtELUXiZGE4vp0/JZzRq6itkZ9 8MxanXkYr2PDHdpRHn651IxkYSlyTON3YYwqQ0A9snvpPtbfN+qmicLuK6mUxHZPbyWr AOPB6lkqvxz6eZDLwdif0l/4uuPWiuCjb52WuoLQDaCe9FcNAYmTVMPHcpm+FQLuVtm6 1QJ1GhquVB3LNiHxMePAsoHfGpUjAyQSjHaxB74KEl0KzF8uBRkLmP6W4gCLzHVA5Nre jz/5aVp+t+6kLV84inj8bY9xWCHE5IMCioKTTwLfoRyx6zZeGlll05RgdhRfzmXn2lSy 1/YA== X-Gm-Message-State: AOAM530cvavMIDU/hM1jFrHNcp3szc0/ppJZwXA2qx1lHQr4daclM8/J DLiCysOMt9b0cJgT2Ag2Xp5g9HtXguAO X-Google-Smtp-Source: ABdhPJxJwqWVAlNIXeDcySMTcYY3hBLUwWU8vuqg5tOGSr/TcQKLQVtpYez+Mq6Cnzl/ZcipeilS9Q== X-Received: by 2002:a6b:c997:: with SMTP id z145mr2152882iof.136.1599631352906; Tue, 08 Sep 2020 23:02:32 -0700 (PDT) Received: from rcombs-mbp.localdomain (c-73-50-128-8.hsd1.il.comcast.net. [73.50.128.8]) by smtp.gmail.com with ESMTPSA id j20sm864575ilq.6.2020.09.08.23.02.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2020 23:02:32 -0700 (PDT) From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Wed, 9 Sep 2020 01:02:15 -0500 Message-Id: <20200909060217.25794-13-rcombs@rcombs.me> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200909060217.25794-1-rcombs@rcombs.me> References: <20200909060217.25794-1-rcombs@rcombs.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 13/15] lavf/asfdec: use avcodec_descriptor_get_by_mime_type X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/asfdec_f.c | 11 +++-------- libavformat/asfdec_o.c | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index e9ddca7151..c35b81550b 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -218,7 +218,7 @@ static int get_value(AVIOContext *pb, int type, int type2_size) static int asf_read_picture(AVFormatContext *s, int len) { AVPacket pkt = { 0 }; - const CodecMime *mime = ff_id3v2_mime_tags; + const AVCodecDescriptor *cdesc; enum AVCodecID id = AV_CODEC_ID_NONE; char mimetype[64]; uint8_t *desc = NULL; @@ -245,13 +245,8 @@ static int asf_read_picture(AVFormatContext *s, int len) /* picture MIME type */ len -= avio_get_str16le(s->pb, len, mimetype, sizeof(mimetype)); - while (mime->id != AV_CODEC_ID_NONE) { - if (!strncmp(mime->str, mimetype, sizeof(mimetype))) { - id = mime->id; - break; - } - mime++; - } + if ((cdesc = avcodec_descriptor_get_by_mime_type(mimetype, "image"))) + id = cdesc->id; if (id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n", mimetype); diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index 1b10e47907..970748c6cf 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.c @@ -359,7 +359,7 @@ static int asf_read_picture(AVFormatContext *s, int len) { ASFContext *asf = s->priv_data; AVPacket pkt = { 0 }; - const CodecMime *mime = ff_id3v2_mime_tags; + const AVCodecDescriptor *cdesc; enum AVCodecID id = AV_CODEC_ID_NONE; char mimetype[64]; uint8_t *desc = NULL; @@ -387,13 +387,8 @@ static int asf_read_picture(AVFormatContext *s, int len) /* picture MIME type */ len -= avio_get_str16le(s->pb, len, mimetype, sizeof(mimetype)); - while (mime->id != AV_CODEC_ID_NONE) { - if (!strncmp(mime->str, mimetype, sizeof(mimetype))) { - id = mime->id; - break; - } - mime++; - } + if ((cdesc = avcodec_descriptor_get_by_mime_type(mimetype, "image"))) + id = cdesc->id; if (id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n", mimetype);