From patchwork Mon Jun 29 17:33:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20701 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 D24D54483D1 for ; Mon, 29 Jun 2020 20:33:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB904688074; Mon, 29 Jun 2020 20:33:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ABFBC680A07 for ; Mon, 29 Jun 2020 20:33:37 +0300 (EEST) Received: by mail-ed1-f65.google.com with SMTP id e22so13538969edq.8 for ; Mon, 29 Jun 2020 10:33:37 -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=dp1pDGFf5lSiPjYhsSNAhlMLdqaFMOhmedZevYCgmKk=; b=hcAqEIOA702TYbdVKr+6dcC0rGyoxcymXy2/hDZUbUXLF4cslsTrOdOhH7sBxpuXXi NQvXABIbQ4WyHJOiyMitYMifXtz4PfHgOeNIyRc2INuz31JjyPqzZEbosfnO9TduDEQO kC7f9K5VbjEKIbHHtADQVAlUQ3WJfiSEOA4csKEiIsu4CLZGMhlaFf/ufF3FooWyHYw/ OKk/TvWCO6l5AIx6GpZA7kwNHad7kdeRBbzQRgB83z6dfyr9wjfJxdS4t/9GNGDBiBo5 2u13yjoMNGqbWdP924ZrQe0eJZiQ3X4w3TQMtO598GmOxofBcFw3lDI5q7fJG+R1c/1m N+LA== 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=dp1pDGFf5lSiPjYhsSNAhlMLdqaFMOhmedZevYCgmKk=; b=cBheokOMMbp8DxnM3k9nB621HlfIx/u57Ng+7mQv3k0bSPOrVz8Ym117h/xjW0iBtf ZYc+PP5cCZPuGXBUQ6xKPRkxhyisJcfBurCIEo4oEmKbFxaAK/BA8LnoBxn/Wwv50ylG GHq+rLroOrPs6+EYcI+IQQuex244QHRojLexixdWzjMR3gxF6MWxgI6N8h4xjdqcXfbu N1cpy+W0aZ7hxSYs4oebeCX246k1ZY1Ub48gLaV1op+SwFGBdRpqqLga+EgJ/TIda7nV o5eD3cAvQXIzoyheGxzhbLrhOEGhSai99YPG6nkgJ6JTVYOSiB73iSsp8jB5zTpNwms9 acvg== X-Gm-Message-State: AOAM533SdieJKFpxl6ZfpKOW0ZMfgTvbgF/rv2jH+S5L0waJln2I0cJO fxTFA7nXv+uFNzdKUYdacSJXC1/o X-Google-Smtp-Source: ABdhPJyi5MHkOd7toZkweGDS7Q8gfnhOtxQ6NJb09oWBrDcT8caiq5KffzMzn/2PsxUckCFdjOlGSw== X-Received: by 2002:a05:6402:319b:: with SMTP id di27mr19094535edb.133.1593452016839; Mon, 29 Jun 2020 10:33:36 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id i7sm332844eds.91.2020.06.29.10.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 10:33:36 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jun 2020 19:33:08 +0200 Message-Id: <20200629173309.4871-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200629173309.4871-1-andreas.rheinhardt@gmail.com> References: <20200629173309.4871-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/dvbsub_parser: Don't allocate buffer separately 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/dvbsub_parser.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c index 8ced3c4c34..b7a3d6154c 100644 --- a/libavcodec/dvbsub_parser.c +++ b/libavcodec/dvbsub_parser.c @@ -35,20 +35,12 @@ /* parser definition */ typedef struct DVBSubParseContext { - uint8_t *packet_buf; int packet_start; int packet_index; int in_packet; + uint8_t packet_buf[PARSE_BUF_SIZE]; } DVBSubParseContext; -static av_cold int dvbsub_parse_init(AVCodecParserContext *s) -{ - DVBSubParseContext *pc = s->priv_data; - pc->packet_buf = av_malloc(PARSE_BUF_SIZE); - - return 0; -} - static int dvbsub_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, @@ -173,16 +165,8 @@ static int dvbsub_parse(AVCodecParserContext *s, return buf_size; } -static av_cold void dvbsub_parse_close(AVCodecParserContext *s) -{ - DVBSubParseContext *pc = s->priv_data; - av_freep(&pc->packet_buf); -} - AVCodecParser ff_dvbsub_parser = { .codec_ids = { AV_CODEC_ID_DVB_SUBTITLE }, .priv_data_size = sizeof(DVBSubParseContext), - .parser_init = dvbsub_parse_init, .parser_parse = dvbsub_parse, - .parser_close = dvbsub_parse_close, };