From patchwork Sat Oct 17 07:37:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23035 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 D65B644A23D for ; Sat, 17 Oct 2020 10:38:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BCC0268BA7C; Sat, 17 Oct 2020 10:38:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA4B768B9A4 for ; Sat, 17 Oct 2020 10:38:27 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id b8so5962073wrn.0 for ; Sat, 17 Oct 2020 00:38:27 -0700 (PDT) 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=rI/YVRAHs3AopwFRHGbnnSlAJGd2gtkO+BYHCVvebks=; b=HMKvpqAdXGsIc5nAHTAyHFa1jhzIQ1M3sgviiD2g5NQj1Hp50PfY2h+NcPm522n2Yn VCKzP/P1ayn4nH5rWCJMPc5G4My4vOkRUvz3egU5KOiM733WeuUD67bT/bqgwcJQ56o8 3Ka+YVx4jl2qJheVJROreNOVSNkoeImXh7LTRMO6N9wXNo9iVy+owtVROK9AHBbATSHp G4w9tcGuZRzlCAttV8TSf70c1CKPF73mcsJo+nzHsIOstz1Qnq7ws9vAjusN3p25Bgnk fNOx949mV+GwO/n5WHkGTcc+M3ZdqdpdnMgz5YRG4lySfBThiV+JxzCxlwT5frFT7yiI AJqQ== 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=rI/YVRAHs3AopwFRHGbnnSlAJGd2gtkO+BYHCVvebks=; b=dwWtfvCVuXD070wSgalPfP7y2MAwxhPIdMwi4UXTxYwAWBfQHqGhP4icZ8TjMj+bs2 FaeGXJ1je1fu1IxZ6AqpIIWZiN77wQmFKFNq9iqY7FvjjvNosCLR5eY0gzNitkP66kDb 6L10mluRuiyvVCsEFdleAd+2t48nxdoto9e7EZwoAdDz5gKgowiYdMwXWqVo/79dTPai Fvt6Gf4Cr4ncPz3OFhqx5Q6vsX+H/tZgx+ZagCPhrdUJAcP9R99jLwzthPxt95sLUdLF 7dozfEulCNJ7Dj9xyel4oyPoS4YtTczV7EQHMfYRfUcAOMWdK4uZAwJ64LBgRQowjykt ZqhA== X-Gm-Message-State: AOAM533MBbueX3CDMSzySmjZ3sYsZoZRq+QIepW9SS0m+GJ/lr2bIPch zkFs21cH9f4IX6PkrIM52wK9KN3h6mY= X-Google-Smtp-Source: ABdhPJxBapeCmZhcU0Y/x4RUw1zJtJ1/eugE+eYhaE837MT0/rrSPA9KOWGbCVUsfT8/sKfpaOIdOw== X-Received: by 2002:adf:f2c9:: with SMTP id d9mr8575253wrp.319.1602920307126; Sat, 17 Oct 2020 00:38:27 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id 24sm5946553wmg.8.2020.10.17.00.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2020 00:38:26 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 17 Oct 2020 09:37:44 +0200 Message-Id: <20201017073745.403153-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201017073745.403153-1-andreas.rheinhardt@gmail.com> References: <20201017073745.403153-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 7/8] avcodec/movtextenc: Remove redundant function parameters 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" It makes no sense to call the functions to write styl, hlit or hclr boxes with a different box name than "styl", "hlit" or "hclr". Therefore this commit inlines these values in the functions, removes the function parameter containing the box's name and removes the (non obsolete) box names from the list of boxes. Signed-off-by: Andreas Rheinhardt --- libavcodec/movtextenc.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 908b2bfde5..2082dc9b25 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -92,8 +92,7 @@ typedef struct { } MovTextContext; typedef struct { - uint32_t type; - void (*encode)(MovTextContext *s, uint32_t tsmb_type); + void (*encode)(MovTextContext *s); } Box; static void mov_text_cleanup(MovTextContext *s) @@ -102,13 +101,13 @@ static void mov_text_cleanup(MovTextContext *s) s->style_attributes_temp = s->d; } -static void encode_styl(MovTextContext *s, uint32_t tsmb_type) +static void encode_styl(MovTextContext *s) { if ((s->box_flags & STYL_BOX) && s->count) { uint8_t buf[12], *p = buf; bytestream_put_be32(&p, s->count * STYLE_RECORD_SIZE + SIZE_ADD); - bytestream_put_be32(&p, tsmb_type); + bytestream_put_be32(&p, MKBETAG('s','t','y','l')); bytestream_put_be16(&p, s->count); /*The above three attributes are hard coded for now but will come from ASS style in the future*/ @@ -130,13 +129,13 @@ static void encode_styl(MovTextContext *s, uint32_t tsmb_type) mov_text_cleanup(s); } -static void encode_hlit(MovTextContext *s, uint32_t tsmb_type) +static void encode_hlit(MovTextContext *s) { if (s->box_flags & HLIT_BOX) { uint8_t buf[12], *p = buf; bytestream_put_be32(&p, 12); - bytestream_put_be32(&p, tsmb_type); + bytestream_put_be32(&p, MKBETAG('h','l','i','t')); bytestream_put_be16(&p, s->hlit.start); bytestream_put_be16(&p, s->hlit.end); @@ -144,13 +143,13 @@ static void encode_hlit(MovTextContext *s, uint32_t tsmb_type) } } -static void encode_hclr(MovTextContext *s, uint32_t tsmb_type) +static void encode_hclr(MovTextContext *s) { if (s->box_flags & HCLR_BOX) { uint8_t buf[12], *p = buf; bytestream_put_be32(&p, 12); - bytestream_put_be32(&p, tsmb_type); + bytestream_put_be32(&p, MKBETAG('h','c','l','r')); bytestream_put_be32(&p, s->hclr.color); av_bprint_append_any(&s->buffer, buf, 12); @@ -158,9 +157,9 @@ static void encode_hclr(MovTextContext *s, uint32_t tsmb_type) } static const Box box_types[] = { - { MKBETAG('s','t','y','l'), encode_styl }, - { MKBETAG('h','l','i','t'), encode_hlit }, - { MKBETAG('h','c','l','r'), encode_hclr }, + { encode_styl }, + { encode_hlit }, + { encode_hclr }, }; const static size_t box_count = FF_ARRAY_ELEMS(box_types); @@ -682,7 +681,7 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, #endif for (j = 0; j < box_count; j++) { - box_types[j].encode(s, box_types[j].type); + box_types[j].encode(s); } }