From patchwork Mon Oct 11 11:25:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 31045 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp3582463ioa; Mon, 11 Oct 2021 04:25:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYrIckkLorKnokAf5VxHm3PX5GSTA+pALQySMoe1jhklxLsHYNuinWci8mfXGv9dmZoKkR X-Received: by 2002:a05:6402:1e8e:: with SMTP id f14mr3707210edf.27.1633951551960; Mon, 11 Oct 2021 04:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633951551; cv=none; d=google.com; s=arc-20160816; b=XTBS3YacwNzCTJkwjCCQTtFt89CpcNCT3+FQb5zyGb3fmBxKPBEak75fBiuavGRRbo 7bkGDIKAFbkwJkHjjN3DM2Xsbnpj/XAcaKgaNNi1otAU3nl0takenZfZl2y9472yuAOY afKVmwWM7C+DupRIxZeUcc9VbBrNOMg6idLBPfAmOr0cmXkp+Zyv5jDEBfFecS7UePx2 zCDdgJuqqaFSO/mRe6aGDLZ4GN0C3L1Wr9+IjQ8xz2isCeQEtqKysNpZcebqh2XAFT62 8MHTZ5ENW+l4ErEM4cjAk9LlhgELIOiZ4NfwcEBE36CaUocJ6/d6rnDuEhCDSKYz8J3j vijQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=f8KXTrUmeMvvVacyB2WeSwdDv3TXTAcEAyb0pfdFyHY=; b=N6+OpDEnMfRAhDhO5hgrUVOQWOxhGJd+/aY2guxDTrijPhF3Y+Y7dHmQ5fPz/1xnGg D/jeKEguvkc7hmFGIEFydPhWfI2kCO4Nly52r/iEIq3e7ljRgtPKmveiDJxnBq8IRaRq Xdfte13CUsvfDJ1gpTeBx7SHH7t+7DiI5X1gquf26MD3HA2bCCt2yc2GTZbnjmJroMzI q8nyr1Csn7hjt5hhN0GNYDPERycoxJ+IwWTXXcQD8IlFgUPj95XL9mXLzM7+qcRhXNtV z0DID0Jf6P7RBwb6EJ/xyE/6Ce89BzHekFnCfyoL07IJpa3WV3LANEfvYBWR5lfLGKJW JiwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zanevaniperen.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h11si10336899edf.416.2021.10.11.04.25.50; Mon, 11 Oct 2021 04:25:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zanevaniperen.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2AC0168A863; Mon, 11 Oct 2021 14:25:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 214C9689F94 for ; Mon, 11 Oct 2021 14:25:39 +0300 (EEST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zane van Iperen To: ffmpeg-devel@ffmpeg.org Date: Mon, 11 Oct 2021 21:25:32 +1000 Message-Id: <20211011112533.173814-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: noreply-caprica@cadance.vs49688.net Subject: [FFmpeg-devel] [PATCH 1/2] avformat/argo_asf: pass name through as metadata 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 Cc: Zane van Iperen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mypj4wNOqDGd Signed-off-by: Zane van Iperen --- libavformat/argo_asf.c | 5 +++++ libavformat/argo_asf.h | 3 ++- tests/ref/acodec/adpcm-argo | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 7e759c7c0c..f729a393ad 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -181,6 +181,7 @@ static int argo_asf_read_header(AVFormatContext *s) AVStream *st; ArgoASFDemuxContext *asf = s->priv_data; uint8_t buf[ASF_MIN_BUFFER_SIZE]; + char namebuf[ASF_MAX_NAME_SIZE + 1]; if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); @@ -209,6 +210,10 @@ static int argo_asf_read_header(AVFormatContext *s) ff_argo_asf_parse_chunk_header(&asf->ckhdr, buf); + memcpy(namebuf, asf->fhdr.name, ASF_MAX_NAME_SIZE); + namebuf[ASF_MAX_NAME_SIZE] = '\0'; + av_dict_set(&s->metadata, "title", namebuf, 0); + return ff_argo_asf_fill_stream(s, st, &asf->fhdr, &asf->ckhdr); } diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h index e65125fb79..f0607c7859 100644 --- a/libavformat/argo_asf.h +++ b/libavformat/argo_asf.h @@ -33,6 +33,7 @@ #define ASF_CHUNK_HEADER_SIZE 20 #define ASF_SAMPLE_COUNT 32 #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, ASF_CHUNK_HEADER_SIZE) +#define ASF_MAX_NAME_SIZE 8 typedef struct ArgoASFFileHeader { uint32_t magic; /*< Magic Number, {'A', 'S', 'F', '\0'} */ @@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader { uint16_t version_minor; /*< File Minor Version. */ uint32_t num_chunks; /*< No. chunks in the file. */ uint32_t chunk_offset; /*< Offset to the first chunk from the start of the file. */ - int8_t name[8]; /*< Name. */ + int8_t name[ASF_MAX_NAME_SIZE]; /*< Name. */ } ArgoASFFileHeader; typedef struct ArgoASFChunkHeader { diff --git a/tests/ref/acodec/adpcm-argo b/tests/ref/acodec/adpcm-argo index 127153c081..4032a8f1fe 100644 --- a/tests/ref/acodec/adpcm-argo +++ b/tests/ref/acodec/adpcm-argo @@ -1,4 +1,4 @@ 14b2507d14e95c20bb7ae49b4fcbcbf1 *tests/data/fate/acodec-adpcm-argo.argo_asf 281190 tests/data/fate/acodec-adpcm-argo.argo_asf -cc5e5c695adeaebaa2b1f0df5ebd59ee *tests/data/fate/acodec-adpcm-argo.out.wav +446f28460bdb7ff4361cf7d82ac22c3e *tests/data/fate/acodec-adpcm-argo.out.wav stddev: 1542.05 PSNR: 32.57 MAXDIFF:59667 bytes: 1058400/ 1058432