From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6F70742FD1 for ; Thu, 16 Jun 2022 16:24:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A95CE68B7C7; Thu, 16 Jun 2022 19:24:07 +0300 (EEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2023.outbound.protection.outlook.com [40.92.23.23]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F22C868B3EC for ; Thu, 16 Jun 2022 19:24:00 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AaM3Cb+xu+p0ieoK9t9PZPzduouJBR0e5h+as7GUmJIWl+TVw+vi076vF2OcHF0NZGG4pdSOECWr+NRBfa8VaufMl7EgbE5e40v3gSEdXgK5ADun5BhaA2ulz21tL6RJ9dkwBFcrIR3sbItGAyonYdFBmClGSWNY49h3pWZJ5pgZz5TrT+ytY0NLd7fFqLEbkLcXPH+sdICTA177wb3VbDw2dzHWuqRRiXwC51uIJYa7lseqJxPPktq1VTYuI8hhLCTEe59lj3+CA5lry+J1UsUYtWPn0W/vjAUBMZyj1fK5qjruVVJw1uzo3IIiwblwD4ej5pqtzIZlfBfXLO94dg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hZTmUs/c3ywNCDEMsEuCTWeT/1mZBGkj8b5NNkkavM8=; b=dHqwuv30IRdqvqUNrWcOIulH7G849HI10JSqXfqSZXMTIXsZFIZ6eebnC0IO2Z2jG8/LorgNCulK61rfE43M/wlvPfYEkl0J4Fbdf/l0+4Tp5fEmWYiAxRcnI8zuAoyvmqmhK8xZAW6WiXie1l5cL3lHaoVDcHT9iJot9JBkTUtYmUNMjvXdC1V1uR8AiBwK16W+bAOrP8aJ94bEDoYbPbmw0l8mu+JEXW8Rb23UQUoFDrV8jb7Oz5SLIn8XtOrJTONm+Ub+fAoQ6PJN/65K3LJ+R0ajCU0xXj621+tMz3NW/rMXVvkeqKSmNGS74uTtnIkXNon15IhwqitOkyTM5A== 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=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hZTmUs/c3ywNCDEMsEuCTWeT/1mZBGkj8b5NNkkavM8=; b=ph4/UFHrmpQl9TMOAA/oBGuNKjlPtuhGOCbbFcDFe4jbi30mHVZydD+y4rzjfH3oBRegwvojHQiStmBZBDRzFf+AocEZ/ufn4C41AJn1/OBYUvPcV35IL3SzkZWPcFQ8Q2bE3y/gwct49FJZI/tK4Fe+gREPA2vH0hWGf2VU/nPA3Yn8wLwvG/yaUHIlGYMj5VlWfkkMPf6v5h3io6VYOGj28NmyidLPOi53BkbgMNUwWbxISbZnaXHApBdvckczVUowNNp8fNUO1gppXqytbpg2WJnAvbrdPSfigf0SAekzlK92cIIWAouqWtCk9U0yuG/TF+Y3ly7SjU+PGCTLsw== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by DM8P223MB0094.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Thu, 16 Jun 2022 16:23:58 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::d08c:b865:df15:6a]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::d08c:b865:df15:6a%6]) with mapi id 15.20.5353.014; Thu, 16 Jun 2022 16:23:58 +0000 From: Soft Works To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH 1/2] lavf/avio: add avio_vprintf() Thread-Index: AQHXNJonk6QuGcObckCdx/9Ps87qt6q/iFmAgiDVqwCAaZ/dAIAEfBQAgAAYu4CABi1WQA== Date: Thu, 16 Jun 2022 16:23:58 +0000 Message-ID: References: <20210418213058.24475-1-stefasab@gmail.com> <20210421215335.GC12140@mariano> <20220403140336.GA264464@mariano> <9ee5c7d1-fe54-f415-ba48-c0a095326d85@passwd.hu> <20220612153210.GB11679@mariano> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-tmn: [Tj5rKnGgb8JielBg3cTeh8UeoKCgtnDX] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 13f37997-eaba-4cf9-c9cd-08da4fb49d8f x-ms-traffictypediagnostic: DM8P223MB0094:EE_ x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 00gdpAKpuD0y1U5o1yudxsb4S4HCO+RyMNZ204tCK+HBtllPOtYqb6ISOGJq6kGkBoMJGBM1P7JAHYZfBf792AufWQ1vY34nCUyBeB3u0Buo8usanIUhJSjycne0IJoZU4RN2ngUyKQ5kPS2yJVYc1Pc4G1rzKAGbOGH0avtUQVRTenxBCPLih/m1UhNNcvHl65HGi6rub/J8gqg3pokDpbrOGijDqHl3ofnogjxTu7sKcZ9xO4/r/FE/M5i8AMIbhsc2HMp0HD0/RKPj3ABCnnP1j95MfkoPEb1zPsgQNdN61ZOeVdHy1a4acfd30yXZ0d/TKlZGt3USdbPtog1VDpnvpG1WzO0RckXfYcr1Qst2c4SwDTBybP1YECalfxiAaQNGa8LmloeVgE49tMfNc5itrD1QXStx+lwXTDQtgmYWSPrfXfbCXXj26xAT/eABGd8AQqAK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QXd0WmtEdWJuZTVDTDJuNVltcWNVTk5tVWNi?= =?utf-8?B?Wm9nWjJJbGUyUUZQdnVFdUlXTUN5aDg5eUV5MWsvRGM1bEk4YlNaYWNYSnd6?= =?utf-8?B?WW54Y3RiZkluVFVGMldQN3dtYVU0dmpTRHArdDRyRkJKN1pFc2ZCMGpPVGF4?= =?utf-8?B?V3VYNUVsY1VPTEJGSVVlVnNiS3RSZ0lWV1cvdE9icnoxRitTQjdYVndBd2Zw?= =?utf-8?B?dkJiNFpLZkg5U2JYNVhzempJWGJ5aWxDVnRIREtTVGZlVzA1OUZhTHpBMzJl?= =?utf-8?B?YUJXRjlIUVNIQWRJVnR6Z1JVOWloc0dIVk5ySzl5cHRIeWdGZWVnMFFLNHor?= =?utf-8?Q?CTUrVPmzMjE=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-1ff67.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 13f37997-eaba-4cf9-c9cd-08da4fb49d8f X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jun 2022 16:23:58.2344 (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: DM8P223MB0094 Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavf/avio: add avio_vprintf() 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > -----Original Message----- > From: ffmpeg-devel On Behalf Of > Nicolas George > Sent: Sunday, June 12, 2022 7:01 PM > To: FFmpeg development discussions and patches devel@ffmpeg.org> > Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavf/avio: add avio_vprintf() > > Stefano Sabatini (12022-06-12): > > Updated. > > Hi. Since it is somewhat related, I would appreciate if you gave your > opinion on the option of having a good string API in FFmpeg: > > https://ffmpeg.org/pipermail/ffmpeg-devel/2021-December/290226.html > > Eventually, I would like to have the more generic writers from > ffprobe > (JSON, XML) in lavu to be used by diagnostic filters. But I will not > be > doing that with pedestrian strings. Hi, as mentioned a while ago, I am quite interested in this and I would be glad when it would be possible to find a way for going forward. My primary interest would be the generalization of ffprobe string writing code, from which I have two duplicates by now. I had put further work on hold as I became aware that were plans or proposals for this. Now I've read your "Intro to AVWriter" from April 2021 and I have some questions. > ## Scenario 2: Concatenating the string into a message. > > Let us say you have two foobars to present to the user. Good old C: > > char msg[2500], foo1_buf[1000], foo2_buf[1000]; > av_foobar_to_string(foo1_buf, sizeof(foo1_buf), foo1); > av_foobar_to_string(foo2_buf, sizeof(foo2_buf), foo2); > snprintf(msg, sizeof(msg), "F%d = [ %s, %s ]", num, foo1_buf, foo2_buf); > > But it's ugly. Less ugly, but more complicated: [skip that version] > Well, that was the first thing AVWriter was meant to do: allow to build > strings by concatenating them together. So, the AVWraper version of this > code: > > char msg[2500]; > AVWriter wr = av_buf_writer_array(msg); > av_writer_printf(wr, "F%d = [ ", num); > av_foobar_write(wr, foo1); > av_writer_print(wr, ", "); > av_foobar_write(wr, foo2); > av_writer_print(wr, " ]"); There are cases where it might be preferable to subsequently append to a buffer like that, but it requires many lines of code and it's not as easy to get a picture of how the produced string will actually look like. Maybe you meant it just as one possible example to use AVWriter, but in this context it looks like as if that's the supposed way to replace the "Good old C" version? When you would ask me which code I would _wish_ to be able to write in this example case, then it would be this: char msg[2500]; snprintf(msg, sizeof(msg), "F%d = [ %s, %s ]", num, foo1, foo2); Of course it doesn't need to be snprintf, it could also be av_xprintf(). It would also be fine to have some macro around those params like XX(foo1). Or a custom format specifier would also be fine. Basically I think there are a number of possible ways, but I'm not sure whether this would be possible with regards to the automatisms you are planning to checking for a matching string conversion function? This might be a tough one: it would be cool when this could be used in av_log() calls for logging, but in this case it would be of course required that the string writing will be performed upstream, only when the log level condition would be satisfied. Could that even work? PS: Yes, I have read it to the end; the mentioned av_writer_fmt() might be related to what I'm asking, but I wasn't sure. Thanks, softworkz _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".