From patchwork Tue Oct 12 11:02:24 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: 31080 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp4645740ioa; Tue, 12 Oct 2021 04:02:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsoAsNeN5dA7hlHjC2Q6LzINs8itI0RmdVwW54qbmqnXADM6Oq07vlNEIX4QJkwfaspp2e X-Received: by 2002:a17:906:e098:: with SMTP id gh24mr32106408ejb.79.1634036578994; Tue, 12 Oct 2021 04:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634036578; cv=none; d=google.com; s=arc-20160816; b=nI4yXTSakngQ/et3T9RBhz3IzROt3Nuk0JtNXsjEa7RMlsu2/2TZgLz5RTgY8n0brP 4Gb4OElSvfH4LGDk2mkzQt4PAUZZuMOfEdMZbHvJcWO7OY2EVWoU8HjNjSsNRB1ffCDW HW+PdkzLmLEbT2RJpT0e+vlVgXE4Atz8/TeVNX/a+ZAXyfgW8gv5+/OMSLwEFuxFTJrH OlYR/IzHZucDtyTFwpG4HFrO2JHo28OD+gysdPQt0CL5IwUE7+pG3RsdneRAOKLaVRFn /mACTkE+Gcqv4ZRlPXbeCMYNM6v7EzPRco5ZSFk9sz/f4v1Xf+tL58vfyGBfkH8zWq22 UhUQ== 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:references:in-reply-to :message-id:date:to:from:delivered-to; bh=H3Fg9+vYiFnvueVa+9uneLQAHXDXt1/wa3WT791Gok4=; b=R/Jy0rHc23bjXH3Fa4s3FX074zASz/I8hEsTpwmI0nXfuVJ7RilZqUKKEPun/K/eaT Zj6vktgnP1XupHNCcqkoFb0/ocjv4uGmbCeGSXxNY4DsjlDbtAlmZmlqHMjmm8f5mLr1 65aoNK9WvJindOjU9r6FtuTvSkxdtJQoYpZ8QCd9hviZqDSMr8G3HOpKecJWhqV7ICxF sjkmSB2EZw9BQv5/NWNy2xL2RTlYjbNXANDX60VAemKC+kkfY2sbeviy5cb7WW4G2ejL fgDhamJxxDnaMpTt8TYhgZ6BVo2aLmWJ75MOYUTD2XWwKWQVNOpRRMIsgkr+ydy1piAF Sz3Q== 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 s29si14449087edi.373.2021.10.12.04.02.51; Tue, 12 Oct 2021 04:02:58 -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 AC4F568A4D2; Tue, 12 Oct 2021 14:02:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out10.migadu.com (out10.migadu.com [46.105.121.227]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D27EC68A54D for ; Tue, 12 Oct 2021 14:02:35 +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: Tue, 12 Oct 2021 21:02:24 +1000 Message-Id: <20211012110224.639056-3-zane@zanevaniperen.com> In-Reply-To: <20211012110224.639056-1-zane@zanevaniperen.com> References: <20211012110224.639056-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 v2 3/3] avformat/argo_asf: use title metadata when muxing 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: +qZcZ0fAd6lB Signed-off-by: Zane van Iperen --- libavformat/argo_asf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 740680ece1..2b3569ebc3 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -358,14 +358,22 @@ static int argo_asf_write_header(AVFormatContext *s) .num_chunks = 1, .chunk_offset = ASF_FILE_HEADER_SIZE }; - const char *name = ctx->name, *end; + AVDictionaryEntry *t; + const char *name, *end; size_t len; /* - * If the user specified a name, use it as is. Otherwise take the - * basename and lop off the extension (if any). + * If the user specified a name, use it as is. Otherwise, + * try to use metadata (if present), then fall back to the + * filename (minus extension). */ - if (name || !(end = strrchr((name = av_basename(s->url)), '.'))) { + if (ctx->name) { + name = ctx->name; + len = strlen(ctx->name); + } else if ((t = av_dict_get(s->metadata, "title", NULL, 0))) { + name = t->value; + len = strlen(t->value); + } else if (!(end = strrchr((name = av_basename(s->url)), '.'))) { len = strlen(name); } else { len = end - name;