From patchwork Mon Apr 6 17:52:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 18734 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 1BBB644A7AA for ; Mon, 6 Apr 2020 21:00:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 03EE268B516; Mon, 6 Apr 2020 21:00:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1519468B4E6 for ; Mon, 6 Apr 2020 21:00:10 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Mon, 6 Apr 2020 11:00:08 -0700 From: John Stebbins To: Date: Mon, 6 Apr 2020 11:52:16 -0600 Message-ID: <20200406175218.1299994-22-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200406175218.1299994-1-jstebbins@jetheaddev.com> References: <20200406175218.1299994-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 21/23] lavc/movtextenc: simplify initialization of new style record 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/movtextenc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 2e65489c4d..167dffee6a 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -96,8 +96,7 @@ static void mov_text_cleanup(MovTextContext *s) av_freep(&s->style_attributes); } if (s->style_attributes_temp) { - s->style_attributes_temp->style_flag = 0; - s->style_attributes_temp->style_start = 0; + *s->style_attributes_temp = s->d; } } @@ -122,7 +121,7 @@ static void encode_styl(MovTextContext *s, uint32_t tsmb_type) style_start = AV_RB16(&s->style_attributes[j]->style_start); style_end = AV_RB16(&s->style_attributes[j]->style_end); style_color = AV_RB32(&s->style_attributes[j]->style_color); - style_fontID = AV_RB16(&s->d.style_fontID); + style_fontID = AV_RB16(&s->style_attributes[j]->style_fontID); av_bprint_append_any(&s->buffer, &style_start, 2); av_bprint_append_any(&s->buffer, &style_end, 2); @@ -259,14 +258,10 @@ static int mov_text_style_start(MovTextContext *s) return 0; } - s->style_attributes_temp->style_flag = s->style_attributes[s->count - 1]->style_flag; - s->style_attributes_temp->style_color = s->style_attributes[s->count - 1]->style_color; - s->style_attributes_temp->style_fontsize = s->style_attributes[s->count - 1]->style_fontsize; + *s->style_attributes_temp = s->d; s->style_attributes_temp->style_start = s->text_pos; } else { // style entry matches defaults, drop entry - s->style_attributes_temp->style_flag = s->d.style_flag; - s->style_attributes_temp->style_color = s->d.style_color; - s->style_attributes_temp->style_fontsize = s->d.style_fontsize; + *s->style_attributes_temp = s->d; s->style_attributes_temp->style_start = s->text_pos; } return 1;