From patchwork Wed Nov 6 02:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 16134 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 6D8474494FC for ; Wed, 6 Nov 2019 04:58:27 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 561B968B083; Wed, 6 Nov 2019 04:58:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 00DF168B081 for ; Wed, 6 Nov 2019 04:58:20 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id l10so23927797wrb.2 for ; Tue, 05 Nov 2019 18:58:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=73kj0pO6bmZZTe1GOtDhtsl5N57shpVHIRL1JrIRbb4=; b=s1XkPmQw4GWHV6tf3q9SocWH2xJIvmNyJorCHcxIUlb6B4tcm9rJG5EI+PyfFXZ79q 0awsxBQNg4hXNTp9R3SFzj8ZGbvIJwG0JbdGH3oxiLPkWt4Si7TgfLkVZDiZzKzxEFVH CsFrMDpbgLblhyCucHzTkXPUjDI4QAnsSyTdz6+yblh5iaUCga06Jdik1cP2CuzV+T/R FG3+ZZMK1ZDQD62NSJXGqvDTR7HeT9oCyLWacFNVWFC8hSq3bFDtu8MmH5t4+xL+b20J DsgSeQpriNK3L0bWX/cSQK8bI8gMCZoKPnqMxv3t47wTpxm7PmAZgpB+dA5s7m7vO4hi MYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=73kj0pO6bmZZTe1GOtDhtsl5N57shpVHIRL1JrIRbb4=; b=NoUtMkY3lFAeTBXmlj9/JEi5nQfykkjg/i0Cjh67ID9ZQPmeSlIny5Hj5lw8kdDzNe jTFAssLP18U71yHsA3bMc/+ieAHGp3YRq3UPnthfp/gOJW69NYNJoR/iMM5JwCPP3rQw x5g2spe4RUI9vekUvdfd4dty8XMpQftbpG4wHEW/sC9On0ODMR0o+gvRNLKgAtGkJCR8 XctSdriNBTG3QuNDiHMcZU1vAeSRaNbzSuoiY4l59MKYXlNgpLMW4X1ZgJUqVZV+eSEo nYI+HjIFtUi5/viJBsxWZ9x5zXzdm/YiLGazW+4iSvCaMjDue9whD0p8rjkgMVg1qRI0 bP4A== X-Gm-Message-State: APjAAAVHdxim8e1Xp45NoA4poSWDj3Y2eIPBHQDD5P4tDabgR7cBFTRI XWKspn17gEQzMNN4+FsSOun/8Fbc X-Google-Smtp-Source: APXvYqyI7rdgF7ueW1RCui71JvA9ajSUknPybJK6mL5wEHA0uDSrUG0i3auJQRJvy1avtM9XjY0K3g== X-Received: by 2002:a5d:5742:: with SMTP id q2mr373248wrw.311.1573008645877; Tue, 05 Nov 2019 18:50:45 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id l13sm1281710wmh.12.2019.11.05.18.50.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 18:50:45 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Nov 2019 03:49:07 +0100 Message-Id: <20191106024922.19228-8-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191106024922.19228-1-andreas.rheinhardt@gmail.com> References: <20191106024922.19228-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/23] avformat/matroskaenc: Remove useless AVIOContext 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" Write a few numbers directly via AV_WB32 instead of using an AVIOContext (that is initialized only for this very purpose) to write these numbers at known offsets into a fixed buffer. Signed-off-by: Andreas Rheinhardt --- libavformat/matroskaenc.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index fb9c38bf4b..15b5ec833f 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -894,7 +894,6 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb, AVStream *st) { - AVIOContext b; ebml_master projection; int side_data_size = 0; uint8_t private[20]; @@ -924,26 +923,24 @@ static int mkv_write_video_projection(AVFormatContext *s, AVIOContext *pb, MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR); break; case AV_SPHERICAL_EQUIRECTANGULAR_TILE: - ffio_init_context(&b, private, 20, 1, NULL, NULL, NULL, NULL); put_ebml_uint(pb, MATROSKA_ID_VIDEOPROJECTIONTYPE, MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR); - avio_wb32(&b, 0); // version + flags - avio_wb32(&b, spherical->bound_top); - avio_wb32(&b, spherical->bound_bottom); - avio_wb32(&b, spherical->bound_left); - avio_wb32(&b, spherical->bound_right); + AV_WB32(private , 0); // version + flags + AV_WB32(private + 4, spherical->bound_top); + AV_WB32(private + 8, spherical->bound_bottom); + AV_WB32(private + 12, spherical->bound_left); + AV_WB32(private + 16, spherical->bound_right); put_ebml_binary(pb, MATROSKA_ID_VIDEOPROJECTIONPRIVATE, - private, avio_tell(&b)); + private, 20); break; case AV_SPHERICAL_CUBEMAP: - ffio_init_context(&b, private, 12, 1, NULL, NULL, NULL, NULL); put_ebml_uint(pb, MATROSKA_ID_VIDEOPROJECTIONTYPE, MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP); - avio_wb32(&b, 0); // version + flags - avio_wb32(&b, 0); // layout - avio_wb32(&b, spherical->padding); + AV_WB32(private , 0); // version + flags + AV_WB32(private + 4, 0); // layout + AV_WB32(private + 8, spherical->padding); put_ebml_binary(pb, MATROSKA_ID_VIDEOPROJECTIONPRIVATE, - private, avio_tell(&b)); + private, 12); break; }