From patchwork Mon Mar 29 08:45:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26637 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 ADC1E448EB7 for ; Mon, 29 Mar 2021 11:46:01 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 808CE688179; Mon, 29 Mar 2021 11:46:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072088.outbound.protection.outlook.com [40.92.72.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8F32C680C76 for ; Mon, 29 Mar 2021 11:45:54 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SkK1YvpE83mETp9QBR37DC5una0i3mDSENcirQPh9iyUFpAhSltcXQ8tjf6SLKrJG3SO5W7uCIQZBRdFCqWsC7LCVtFU+WlEfc1Ipg8V82l4s6yofTE07AN1EhCoA6znxTrpIKTM2KzRNK8eL46M9e3XTU5ZlhZuHqjJG5uOvDeZboc6xeaGC60GmBoPsaU1INtZZ+NTmoilTplN323lilDFADHlgc1NxFru89AVB+/kpkQpN3KPeXIsq3k0ZJDrRj6CyjywkTgg9Hh0O/O95su1V9rkEr55aKj/GZ7im/iPXFPByjzTv9OegyH8MFZk9o1mpptQ8X/QDvC3NDDkOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HsTv1+436AeazzcEGxCfCf94HAqYU4TL/5lqiYkeW2E=; b=jI3NQ0eF29YPJOFR5LXuSBzgA9n/oN+C9ejC6qz1TnnYlciamx+dRIzX1NGx8sDR8+pxFGaxP2sfBwqK6+Ey11HwslcAa7uR/SwDEMnkrQ23tEitZeCG7GEoF4+PyCecHCmXzHMMO2BJ+JfFe+R/wjuddSiG/RPQLnzbU5IiP6eUcTsg8YbOu82d0LW50I3KpwifEVsGjyc9BY+hkG1vZ93lgXpzxzpkdfqTqmfp1rtWZN56wth3m//cnjlud/SVYPcWs0Yetll+Nz9neOSCG4SYAfWu4WWtZQNnGlc6TPWCC99fDXfHZsxSZAlH96sRMHQYgRbEA6+V0nmIQI221g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HsTv1+436AeazzcEGxCfCf94HAqYU4TL/5lqiYkeW2E=; b=YQJ+1avUM3s0gB1Eb5v8bAjUII8EnP1Q100IgaJXpkoNSsKsnGVd5ReRBUiqWcae+nuSUocl3elq0/yPv3pleozNX+xhAKgPwSOzOI6rwu8UY12HkO6BB3Iuss/tj2t3XC3F8CwfaUhCt46WgGw8OAKchX5sd348x3Koqg1sEW/6rfF3v9FJlpzWGtyDBDsGgN6jYgcJWdUqB+bLGEUWSXCeahfhufu2JdMHewPvcOMTurgRiw3wVEnh+BM9IIPGZRAP6+/KFw7llznG1S0sjK19C94MCcRneh3a/BUAnMeBbxO8JGwpQRvabWRR/awiQE977a+0xXcRnLARIZwHUg== Received: from VE1EUR03FT009.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::47) by VE1EUR03HT014.eop-EUR03.prod.protection.outlook.com (2a01:111:e400:7e09::123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Mon, 29 Mar 2021 08:45:53 +0000 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com (2a01:111:e400:7e09::49) by VE1EUR03FT009.mail.protection.outlook.com (2a01:111:e400:7e09::92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Mon, 29 Mar 2021 08:45:53 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:5DB10946FD7DEB2991CFCA09B6DCF14305A9792E0E5002A3BF3660A5C0C206E8; UpperCasedChecksum:B29642EE5F4280DAE1D88CF4EB7F5814282306263D2C093A826D66617B46F637; SizeAsReceived:7607; Count:48 Received: from HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21]) by HE1PR0301MB2154.eurprd03.prod.outlook.com ([fe80::8128:5de5:4e94:9a21%3]) with mapi id 15.20.3977.033; Mon, 29 Mar 2021 08:45:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Mar 2021 10:45:41 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [7Xlz7fGrCvy+qK+gAP3en9WY1m0UktoR] X-ClientProxiedBy: AM0PR04CA0030.eurprd04.prod.outlook.com (2603:10a6:208:122::43) To HE1PR0301MB2154.eurprd03.prod.outlook.com (2603:10a6:3:2a::22) X-Microsoft-Original-Message-ID: <20210329084541.402405-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.137.96) by AM0PR04CA0030.eurprd04.prod.outlook.com (2603:10a6:208:122::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.26 via Frontend Transport; Mon, 29 Mar 2021 08:45:53 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 5f99f2b7-651e-43ef-1810-08d8f28f0fdf X-MS-Exchange-SLBlob-MailProps: NS9Gj58uCj1xck0MJhTzH1vF95/KKvym4k8OiDyX94s/MjDVrv1qu0q5iP0PUoj989A8uYPlk0CrsZYUZmCTke+NLpb1FCcLyTzExntms4Hf7Sf1k4xbJIKiKQxWf7aAx8nWZTOSxqKJGW+SMJ40XkR50/vWr0JIhW7uocjQfxD2FrIVnvZ/lTHjt2NRjp2CdU/ZtYhGy9QER6X8pYbEwkUPTkpj4hPLit3/Js7jhVCVU6ztkUxyhE2/CL1dDlDtWPAJV/2uD6XeUn5mcxgvVFI+mWgXjpJtTIXETkxilxTig1rj1sQ9LxvFnN8TemEasrUtZ80R3Vanbt3IBwZnu7aY/7gque0ZvPqLKO4NBMYWd8RSd97HXWFeWHJu0FGI8qlFjpx8BtpTQdBEmzDcVmGJxotM7P60dYDlN5KOvfVSnJRRQkYtC6vOYtlwlhallLqUvQGBg8hcTE2IwgOOn/dKnVWHfxJ9vi3rkXXRiGNvCY6CN7+js5VHj8vbrICslQuGn11d/L60+3s+YNS51t1L4DiVfuSWr+8IMZOJ89rCMw+xk+WO/jOPLuZKsPPLcs7xzZ9+9cBsP2SZVI/kYyQUIiSPXTM4BWq57Dn095XzpEdA5BaRHsZZEdvhxyrfkjV9ytEdVXjupl23nugPFR/ZFPT6wh8GYBvadiIFt6LAok22iDPGdMInTPQgkqd8GiWpazAueW7YqKyi5z3ltg== X-MS-TrafficTypeDiagnostic: VE1EUR03HT014: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bKscopWqwUV1C9EzJ0xOCKH4pmBDngRC0Fc7XKUbf10s1747oQIfpQeN0YWqHNnfu7KRuhvFcSkQMWDZNbYkWZm0WKuP4PjKIdNeIHNYIAc8lToaUkrxKdFQ6I8H9HwUJeudcaJCwvHqIAAxTAm7auQwPmQ/PtnW+dOIYN0K0bII8EUdiwm0VIPSV1a5xsIppT4xDD6mI2ToElFBRYVPIw5iIb6slxopeb6uIBraGUnVZIR2DkiVZix/VV/Ew9Ipx6XUiD6qWooLYGSKA4iMs9OnGpeeWTLFB3YrcT55ZO87FUYF33LLShXxeXHc4nAX88UZ5mdOAtK/I3hEakMUZ6zf8Z98PPpjMfydjfk52+xS+nmW4ZDE/PWjcFHRzHEmBWfyKFQX4odwpOvJd2I/cQ== X-MS-Exchange-AntiSpam-MessageData: KY/mlqoYYqU8V1IcIz12+O04DNGrJAc+n7Iw9TJ2QG6dBBf26k+IUToZxRAfJ/4aiSPmjM+0qA5lOWbSZb3eJhDGZ4T+eMR0AvtucnriaL7W2svGCLLsOboGE2004DEe4rGrPiFpEdUjgjj9U/qLBQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f99f2b7-651e-43ef-1810-08d8f28f0fdf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2021 08:45:53.6257 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT014 Subject: [FFmpeg-devel] [PATCH 4/4] avformat/asf: Use ff_add_attached_pic() to read attached pics 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Also removes a stack packet. Signed-off-by: Andreas Rheinhardt --- libavformat/asf.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/libavformat/asf.c b/libavformat/asf.c index 204355abab..cef0f9f646 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -20,6 +20,7 @@ #include "asf.h" #include "id3v2.h" +#include "internal.h" const ff_asf_guid ff_asf_header = { 0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C @@ -176,7 +177,6 @@ const AVMetadataConv ff_asf_metadata_conv[] = { * but in reality this is only loosely similar */ static int asf_read_picture(AVFormatContext *s, int len) { - AVPacket pkt = { 0 }; const CodecMime *mime = ff_id3v2_mime_tags; enum AVCodecID id = AV_CODEC_ID_NONE; char mimetype[64]; @@ -230,22 +230,12 @@ static int asf_read_picture(AVFormatContext *s, int len) return AVERROR(ENOMEM); len -= avio_get_str16le(s->pb, len - picsize, desc, desc_len); - ret = av_get_packet(s->pb, &pkt, picsize); + ret = ff_add_attached_pic(s, NULL, s->pb, NULL, picsize); if (ret < 0) goto fail; + st = s->streams[s->nb_streams - 1]; - st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } - - st->disposition |= AV_DISPOSITION_ATTACHED_PIC; - st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_id = id; - st->attached_pic = pkt; - st->attached_pic.stream_index = st->index; - st->attached_pic.flags |= AV_PKT_FLAG_KEY; if (*desc) { if (av_dict_set(&st->metadata, "title", desc, AV_DICT_DONT_STRDUP_VAL) < 0) @@ -260,7 +250,6 @@ static int asf_read_picture(AVFormatContext *s, int len) fail: av_freep(&desc); - av_packet_unref(&pkt); return ret; }