From patchwork Fri Jul 23 17:04:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29038 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp1560207ios; Fri, 23 Jul 2021 10:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvt3cH9WFt4x8Z8EhyoE2a/RVV+YpTiAlWJIY31jLebqwlHwiDAHLVce6JY2eu43K01v8N X-Received: by 2002:a17:906:b10e:: with SMTP id u14mr5722987ejy.522.1627059889649; Fri, 23 Jul 2021 10:04:49 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w21si33911781edx.566.2021.07.23.10.04.48; Fri, 23 Jul 2021 10:04:49 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b="iSiW/hiF"; arc=fail (body hash mismatch); 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=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80C5D68AE12; Fri, 23 Jul 2021 20:04:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-oln040092070040.outbound.protection.outlook.com [40.92.70.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0FDBD689EAA for ; Fri, 23 Jul 2021 20:04:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dTzwgZMpVbOkY3vbGUChGisV1R4PJOIJBtiAuL7M/kehdoei7fP4afHS9I4lfs57/r5X6Z0qyIzRw0MtWU1fs2qFvDcwRUGIvuj5wIuoB009CHRGx+n+WXl6trp2jCKAtpbCqBhIiqtuX7tKOj4esVFZqdc/J/qmosLExw83bsUmyAd9/pmfx/0TmqFpUvD/V1renkOW6TEEHpXct05ji2K9xF3elILIolZBEiSeTKteWq0GD1CLQTCkkOzF4VwrorsBRqtjZFntDmX5zs6V7mvq8OKIthMn3Edrtl8O97dxwlYDCaIqAI/cCoqvI3KTiQ3PFEYG1X9RdJKb/vhAlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WrhFBFjdlvsR0b5954kyL8WmcpXfRT1ck+WBM7dGec8=; b=hnFyBEApJ92iFpQtxc5t6yC2QxMRuoOB27wJr3sLdFT8ubSsB2kQJyKmzBXvfvzvmskpFue/kVadKgxenS8//VJhdk4JiPFPvQomw1bX8fZVDq0T6/jFJjh5I6/xVDej2SqF+iQR8r/6Cp4zuOXagkCHav1iEXc+O+JGFesispEIZyO8+Pf/lNbJikYB4GirrG7kAdAe+l+VGhsN256eTF3fKTXHWwwB7D7zm4+1IRNCAK/bBkmmLTbiXaIUju9Hc7OzDICgM8r1q8ZOSCFuy07nrlCtmZbJESk035h97twcO0I3YsKq/XEmlq0YAt6TLnI2ifaaEuDDzIxAs8QaYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WrhFBFjdlvsR0b5954kyL8WmcpXfRT1ck+WBM7dGec8=; b=iSiW/hiF27Xb2UdNhKkbDAIOBQv01Ug68nbhpfTaskctsxUrC8hTJYTNRG6n8j/uHRhhnZ/EhAC4Ep4E1B9YmycnU+6GDTOp7EnT1zxKLCswyBsexHBV1aIT8TtqUVC/Auq1JbqUBQzUM3XqL6A4jnKnGaqY1VMHHJ0IZh/GPD5Qdbn3nbkHboiehEgx3eVimtuVQQsduXlz0H/wBQVKYoPvBkwJc3Ft8H7P5vlprE6U46pP+m8GO8NivTWcfHqXCqKUwjLhYCU41zzqUmQso7vGAh/vrKT4CQVspUF9sbyxoQj9vpO6PB/FMo/cFY9g5KXewGrHqnjIEK5CeigmYw== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (10.141.218.86) by AS8PR03MB7045.eurprd03.prod.outlook.com (20.182.240.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Fri, 23 Jul 2021 17:04:36 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::c9b2:14f8:d555:6f2d]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::c9b2:14f8:d555:6f2d%7]) with mapi id 15.20.4352.029; Fri, 23 Jul 2021 17:04:36 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Jul 2021 19:04:24 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [zakmS6zCdnhJHPJuHtM8udm2PAB+dQql] X-ClientProxiedBy: AM0PR02CA0025.eurprd02.prod.outlook.com (2603:10a6:208:3e::38) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210723170428.1653805-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.94.230) by AM0PR02CA0025.eurprd02.prod.outlook.com (2603:10a6:208:3e::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Fri, 23 Jul 2021 17:04:36 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 659fee78-d424-40f1-b5b8-08d94dfbf37b X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEuYszm9Wtzpdck6zxOB5Y82DtnHkM1lPy2mUplBmvFm9Vv1gCsMPvevMdUqiQkz6AP3oyDT8umvvtvDA5zg3/CVPmu0JGHrl9yjUQDvYoKVsZEJWQI1fXVenfOtg4lULQvSK6m+vE9//U+ojpNgmwFZBX/Sp+fWbwaCs8t6IRBCLfkpr7eBGwIvK3f1uC7RQ/vYcBOhcio77xTZ3KI5lhQ2XGZthPyxFhArz/fA++i7ctnDvj6Q4y28GrTFqZV53sPN5wmKpUqSakpZzXv1qvKC/4+f3adUJ4m9+xFXev+S542dclF0IiFx6yhco9GXjwO1D1FVRbIWzaZflL9EJ2SzfWrPiT0mUsGdLC4Ea5kfW15AvRPlHRnE+i7RaRRa7IcRhubmRusgbadp1ovLNk0Tu8jdhrfdB1v3RVPsBlf4cqz6KWHIvyh8NQgwiIblvNYw4ruXMZHTOGj+D3Qx/uG/u1rAhuHllYS50qbdLTTVYOFaO2up4rzxhtNtK5oLbUq9iPa0G4fCFWgQneotTpjKsKZ8VgMCyAiG3wF5UspPw23YieDFLCDY+axN2DmeH22Hag5SEXPdYMkO4ZWno40d90u3iduDYKe0Z5ZTPXyOoRszCk5OetV32OvhK2l5OFUQMmQtvdMXXLEmzYfn9A1eXRw3eggRJcuHbfs+RRNGTnl5CJK0SeTn7+M3HYzBSsZDqDEe6GU0eIPl+PQsVemFwEC4w1G/D9xz/dcM0T2dlBhmIorxOmzshzFlwXoUkH9ONMwqNsxhVPVIRpYqAFiW X-MS-TrafficTypeDiagnostic: AS8PR03MB7045: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0j+cl1gR/ajbGSBPtlm058ZVtPKlB4IIM3sPoVvJx8+1jxVbo2kPWjsXP8rsWX3WB+8OLQrjtymua/ak0LDIcGoL/KB+0pQYa6ZP1unycj8udfZOMnTccoUKCvqc8abndjs4Cu8M+Cmj/nvFtPbe4vaUvhVeofSdIfEij5THEQMbYm0oWhE5nBfSEpD34StTQdsN9hx5ly6+pX272Mibr2luwXQ0VcpSXBT+BjGMyQYfrj+amEgaHMaGnHoetC5mwYoolJrgiGgYAybfqf0On3yk0rH4sOA37D6uyGKUnTyY8tjfmRYc1+Vg75GzvsgkDs5eJxbUsaAiiuljjBLNmVSEwmGQ+GuCzGDYQTCjhqmvZ7FeZsLyIHXruBKNsH5/0izRKtVZHxrWxrCP82VlyydbXdpHAZLqvN5/xVTpdp8zpwrenbjS+5NU4c+DoadQYc+IMCrGNJ5W+EC2CfUpbe6/+id94Rt0QJdDB9wqIXA= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7aUSGDIzj2U0EZ80hlJYHQJEMePVe3YneqozpfUfNLHNu7vRD9JJnWaZeKLUg96flerRIyCfF7Ilq7wNBZhU1P+UzHtdYdErQw6Ex88RRWgVwxna9eKKQ9U4F9jBwJ0o0G7UXyZz05OipepQq2K/TA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 659fee78-d424-40f1-b5b8-08d94dfbf37b X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jul 2021 17:04:36.8867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7045 Subject: [FFmpeg-devel] [PATCH 2/6] avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.h 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qq7rR3KqD5E5 It only uses an AVIOContext and an AVBPrint. When doing so, it turned out that several non-users of ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata() relied on libavformat/internal.h to include bprint.h or avstring.h for them. In order to avoid a repeat of this and in order to reduce unnecessary dependencies, a forward declaration of struct AVBPrint is used instead of including bprint.h. Signed-off-by: Andreas Rheinhardt --- libavdevice/v4l2.c | 1 + libavformat/aadec.c | 1 + libavformat/argo_asf.c | 1 + libavformat/argo_cvg.c | 1 + libavformat/au.c | 1 + libavformat/avio_internal.h | 14 ++++++++++++++ libavformat/concatdec.c | 1 + libavformat/dashdec.c | 1 + libavformat/dashenc.c | 1 + libavformat/flacenc.c | 1 + libavformat/framecrcenc.c | 1 + libavformat/hlsenc.c | 1 + libavformat/internal.h | 16 +--------------- libavformat/librist.c | 1 + libavformat/mxfdec.c | 1 + libavformat/ttmlenc.c | 1 + libavformat/utils.c | 1 + 17 files changed, 30 insertions(+), 15 deletions(-) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 1c0de118cc..b5997fba33 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -33,6 +33,7 @@ #include #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "v4l2-common.h" #include diff --git a/libavformat/aadec.c b/libavformat/aadec.c index 247c498147..9771a1df81 100644 --- a/libavformat/aadec.c +++ b/libavformat/aadec.c @@ -25,6 +25,7 @@ #include "avformat.h" #include "internal.h" +#include "libavutil/avstring.h" #include "libavutil/dict.h" #include "libavutil/intreadwrite.h" #include "libavutil/tea.h" diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 0bc09522c0..5adafb7230 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -19,6 +19,7 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avstring.h" #include "avformat.h" #include "internal.h" #include "libavutil/channel_layout.h" diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c index 11f68c2405..e1854b4493 100644 --- a/libavformat/argo_cvg.c +++ b/libavformat/argo_cvg.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "avformat.h" #include "internal.h" diff --git a/libavformat/au.c b/libavformat/au.c index ff8f841cce..9bd408f65c 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -27,6 +27,7 @@ * http://www.goice.co.jp/member/mo/formats/au.html */ +#include "libavutil/bprint.h" #include "avformat.h" #include "internal.h" #include "avio_internal.h" diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index fe87f2a288..2c6d00b5ff 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -187,4 +187,18 @@ void ffio_reset_dyn_buf(AVIOContext *s); */ void ffio_free_dyn_buf(AVIOContext **s); +struct AVBPrint; +/** + * Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting + * its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or + * EOF. The line ending characters are NOT included in the buffer, but they + * are skipped on the input. + * + * @param s the read-only AVIOContext + * @param bp the AVBPrint buffer + * @return the length of the read line not including the line endings, + * negative on error, or if the buffer becomes truncated. + */ +int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp); + #endif /* AVFORMAT_AVIO_INTERNAL_H */ diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 74354fce25..934e9c02fc 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -26,6 +26,7 @@ #include "libavutil/timestamp.h" #include "libavcodec/bsf.h" #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "url.h" diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 11966f905c..6105ec46d9 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include +#include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" #include "libavutil/time.h" diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 2b8fbcbe6e..679e30611c 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -28,6 +28,7 @@ #include "libavutil/avassert.h" #include "libavutil/avutil.h" #include "libavutil/avstring.h" +#include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index d8cf3ea4db..44c9341493 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/avstring.h" #include "libavutil/channel_layout.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index 56f7ea1b5a..ab79903e31 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -22,6 +22,7 @@ #include #include "libavutil/adler32.h" +#include "libavutil/avstring.h" #include "libavcodec/codec_id.h" #include "libavcodec/codec_par.h" diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 151ef6ec8f..6447f9bf48 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -37,6 +37,7 @@ #include "libavutil/mathematics.h" #include "libavutil/parseutils.h" #include "libavutil/avstring.h" +#include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" #include "libavutil/random_seed.h" #include "libavutil/opt.h" diff --git a/libavformat/internal.h b/libavformat/internal.h index d71852afb9..002aeb6601 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -23,8 +23,6 @@ #include -#include "libavutil/bprint.h" - #include "libavcodec/avcodec.h" #include "libavcodec/bsf.h" @@ -539,19 +537,6 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen); */ int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen); -/** - * Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting - * its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or - * EOF. The line ending characters are NOT included in the buffer, but they - * are skipped on the input. - * - * @param s the read-only AVIOContext - * @param bp the AVBPrint buffer - * @return the length of the read line not including the line endings, - * negative on error, or if the buffer becomes truncated. - */ -int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp); - #define SPACE_CHARS " \t\r\n" /** @@ -931,6 +916,7 @@ int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters */ int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette); +struct AVBPrint; /** * Finalize buf into extradata and set its size appropriately. */ diff --git a/libavformat/librist.c b/libavformat/librist.c index 01a3f9c122..8f51050c3e 100644 --- a/libavformat/librist.c +++ b/libavformat/librist.c @@ -22,6 +22,7 @@ */ #include "libavutil/avassert.h" +#include "libavutil/avstring.h" #include "libavutil/opt.h" #include "libavutil/parseutils.h" #include "libavutil/time.h" diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 52fbbc6e35..f93cc30f0e 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -47,6 +47,7 @@ #include #include "libavutil/aes.h" +#include "libavutil/avstring.h" #include "libavutil/mastering_display_metadata.h" #include "libavutil/mathematics.h" #include "libavcodec/bytestream.h" diff --git a/libavformat/ttmlenc.c b/libavformat/ttmlenc.c index 7577cb543b..8546d35196 100644 --- a/libavformat/ttmlenc.c +++ b/libavformat/ttmlenc.c @@ -27,6 +27,7 @@ * @see https://www.w3.org/TR/ttml-imsc/rec */ +#include "libavutil/avstring.h" #include "avformat.h" #include "internal.h" #include "libavcodec/ttmlenc.h" diff --git a/libavformat/utils.c b/libavformat/utils.c index 508a2b8bc2..60d7364018 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -25,6 +25,7 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" +#include "libavutil/bprint.h" #include "libavutil/dict.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h"