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 C9AC443CAA for ; Thu, 4 Aug 2022 23:13:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D342E68B9F3; Fri, 5 Aug 2022 02:13:47 +0300 (EEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2089.outbound.protection.outlook.com [40.92.91.89]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 45FD368B920 for ; Fri, 5 Aug 2022 02:13:41 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mPyHq592X59WD0T+f/fBNVa1ynTpJucSXd4Qay+tSNaz16nCJp5zfbDVCfSJWM+hiBnLicqouC8cIt3w98K5ZBAjrgL+4Md7ef8C6cMlQdBm28hRIHZHrNoS9V9v8X48DW9lhi5OjRUoKMijiJw/5NUt3vvotmUwBxJp+b1Mh2e9iODjmu+4EPZSoBBkHhl03XmpM8Y0MLu/cdIcwWDnDm2i0zfGzkzMv1ZXFzPOOysWfMWf6cJS5D4EwOVOwJxzO5cIbaFS5tfOf2HTInC2015qHCv9DJ+yvKC5VN/8RCu282hpILijaGxFcE/aLm96GMZSGnYS6EvTDo4NGEz9xA== 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=X8EvbnpTesl8EPzOgYUJTbSgPqv8FyZVGWd5svf4BtQ=; b=Y13m1pezUsOCJDiC9QxLX9rC7jpKargJPSLrQhYyOj+RZLAIknL77eih8tg/HepqlWbVat8aLm5/JR7pDJLGVVq2APhANi6a94zoYePGAgyZdt8jcTXyvpsCiHF7sq5mIJn++QVIMXHhn6PRttdTI8i3zOBL4bpMsxaT8fDSBXCOYHhVWJjSE5/SiqFpUTiQOQrXMCA62o0LqxklNS8v0nhGDgSWZhDVA2EHPPDG+I0Wt1RXwG4kskuItu8LMywAp7dibB+aj5L4sx94rsQX9U0WW6NYh1s3irTXthgxliCNwVwhDSuzdtobto3C6PIonRAMgWP9YPYdXhDOM3Bdyw== 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=X8EvbnpTesl8EPzOgYUJTbSgPqv8FyZVGWd5svf4BtQ=; b=civ/WkPcy61YGpDtmhKLqOkNtfTzcEYRKMf1Pi5AOTW5OZaMHyPOAJRFBzS9vcUN7+zCyi5oOs+MzehNCgXOCuupOcCLSDB3K0Zl3IBVZUSh7bRXOpLBAB3S1/Xaz+NtqRXKiyv2QAAnrJB8qL4Kl3T1V4h6qQrmbFREIxJvB4c7NffStcJs5ARmQ0NBTRmWuCilQqSufMLMeaONo0oDGvXmOHvxuEpq2CTuWtZX4ZWLRUVIOlxIc4W962N//lAFCcyZBmN/CYneCS0YZz7SGMfhFAe4xwZn91lDVlJKoV++SuSwHh0xufOk51mJgwDdVLDnmI2aMTrYe49aMyOogA== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by PR3PR01MB6874.eurprd01.prod.exchangelabs.com (2603:10a6:102:73::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 23:13:39 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46%11]) with mapi id 15.20.5482.016; Thu, 4 Aug 2022 23:13:39 +0000 Message-ID: Date: Fri, 5 Aug 2022 01:13:38 +0200 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220731215157.22022-1-pal@sandflow.com> From: Andreas Rheinhardt In-Reply-To: X-TMN: [WogOttjbIXtnMGAODVKXf8Pxx0+mLCoT] X-ClientProxiedBy: ZR0P278CA0062.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::13) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: <96ba56ac-e0c5-f1e7-77f3-a1f5bcca49a7@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c528017-df85-43bd-4708-08da766ef710 X-MS-TrafficTypeDiagnostic: PR3PR01MB6874:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7kt4Yaa9wvC47IOkdP00rHs4v/uoQ/MwGMNxoWDoTHwLZLSlh/zzzF0vnGKD45OJAEM7quOxnK+oyItdizZ963xMIPsZqIUIrzcMj8PqgI0Np9Syt5AsyexhM5NJpydhUelOYN0IqmdujbYfeH/Vrox441QtIH3anQQ+XWBKEuIav1QrBFVLVGhX5Guet6P+Rl8o5VuqAjAWU9wzQUMK7G2dtyqD/lHVj3QhfelGgprWw90EfOlaxEXV9+0q1PBVak0eidOpaI3UOiv5U8wQTDEsFEHYNyigcSeWzAzWAYjpqQQxOGJC+KngHl4WHSRrzYEk7nlBtoBJYILgcExaSYvedCnj/y/X779tsVOaKC/XoHqIRJs37h5Tb+4CmdobvhL3A9AUCBXttwLVctGzFsr/BPgNg2uMdjphmvYxBjiOmXm6/VV7HkknbXiIEdrgIdZeYzmATWvaSstSPxYCPpBD0xIKl6UgZxV1fUGV98HoP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ZmRVRSOWpXZXJlWWpCaG13eitVUHcra3NuMHVvc0JpREUraFhicDRobjVO?= =?utf-8?B?ZjF1dmx6YkJvWmNjT2lnSU9FdFliditVaXBpbllKRFJGNnFlMTkvNmVhZ245?= =?utf-8?B?Y1JwNTNqblV6a1ROS09DWUl3cWlSVG9xdXRNWXVITm9UQmFVdU4rNkpnUkZ2?= =?utf-8?B?TERvSkpFdCs2cjN6U2hRK0NaOVhGMlNWN2lYcmlNZUlLSHFwaTdIRnYxclc3?= =?utf-8?Q?0T4RqzyVqUMVIxgwv4=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c528017-df85-43bd-4708-08da766ef710 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 23:13:39.2209 (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: PR3PR01MB6874 Subject: Re: [FFmpeg-devel] [PATCH v5 1/2] avformat: refactor ff_stream_encode_params_copy() to ff_stream_params_copy() 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: Pierre-Anthony Lemieux: > On Thu, Aug 4, 2022 at 3:22 PM Andreas Rheinhardt > wrote: >> >> Pierre-Anthony Lemieux: >>> On Thu, Aug 4, 2022 at 10:15 AM Andreas Rheinhardt >>> wrote: >>>> >>>> Pierre-Anthony Lemieux: >>>>> On Thu, Aug 4, 2022 at 9:53 AM Andreas Rheinhardt >>>>> wrote: >>>>>> >>>>>> pal@sandflow.com: >>>>>>> From: Pierre-Anthony Lemieux >>>>>>> >>>>>>> As discussed at https://ffmpeg.org/pipermail/ffmpeg-devel/2022-July/298491.html. >>>>>>> Note that ff_stream_params_copy() does not copy: >>>>>>> * the index field >>>>>>> * the attached_pic if its size is 0 >>>>>>> >>>>>>> Addresses http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299514.html >>>>>>> >>>>>>> --- >>>>>>> libavformat/avformat.c | 40 ++++++++++++++++++++++++++++++++++++++++ >>>>>>> libavformat/fifo.c | 2 +- >>>>>>> libavformat/internal.h | 12 ++++++++++++ >>>>>>> libavformat/mux.h | 9 --------- >>>>>>> libavformat/mux_utils.c | 28 ---------------------------- >>>>>>> libavformat/segment.c | 2 +- >>>>>>> libavformat/tee.c | 2 +- >>>>>>> libavformat/webm_chunk.c | 2 +- >>>>>>> 8 files changed, 56 insertions(+), 41 deletions(-) >>>>>>> >>>>>>> diff --git a/libavformat/avformat.c b/libavformat/avformat.c >>>>>>> index 30d6ea6a49..242187c359 100644 >>>>>>> --- a/libavformat/avformat.c >>>>>>> +++ b/libavformat/avformat.c >>>>>>> @@ -235,6 +235,46 @@ int ff_stream_side_data_copy(AVStream *dst, const AVStream *src) >>>>>>> return 0; >>>>>>> } >>>>>>> >>>>>>> +int ff_stream_params_copy(AVStream *dst, const AVStream *src) >>>>>>> +{ >>>>>>> + int ret; >>>>>>> + >>>>>>> + dst->id = src->id; >>>>>>> + dst->time_base = src->time_base; >>>>>>> + dst->start_time = src->start_time; >>>>>>> + dst->duration = src->duration; >>>>>>> + dst->nb_frames = src->nb_frames; >>>>>>> + dst->disposition = src->disposition; >>>>>>> + dst->discard = src->discard; >>>>>>> + dst->sample_aspect_ratio = src->sample_aspect_ratio; >>>>>>> + dst->avg_frame_rate = src->avg_frame_rate; >>>>>>> + dst->event_flags = src->event_flags; >>>>>>> + dst->r_frame_rate = src->r_frame_rate; >>>>>>> + dst->pts_wrap_bits = src->pts_wrap_bits; >>>>>>> + >>>>>>> + av_dict_free(&dst->metadata); >>>>>>> + ret = av_dict_copy(&dst->metadata, src->metadata, 0); >>>>>>> + if (ret < 0) >>>>>>> + return ret; >>>>>>> + >>>>>>> + ret = avcodec_parameters_copy(dst->codecpar, src->codecpar); >>>>>>> + if (ret < 0) >>>>>>> + return ret; >>>>>>> + >>>>>>> + ret = ff_stream_side_data_copy(dst, src); >>>>>>> + if (ret < 0) >>>>>>> + return ret; >>>>>>> + >>>>>>> + av_packet_unref(&dst->attached_pic); >>>>>>> + if (src->attached_pic.size > 0) { >>>>>>> + ret = av_packet_ref(&dst->attached_pic, &src->attached_pic); >>>>>>> + if (ret < 0) >>>>>>> + return ret; >>>>>>> + } >>>>>>> + >>>>>>> + return 0; >>>>>>> +} >>>>>>> + >>>>>>> AVProgram *av_new_program(AVFormatContext *ac, int id) >>>>>>> { >>>>>>> AVProgram *program = NULL; >>>>>>> diff --git a/libavformat/fifo.c b/libavformat/fifo.c >>>>>>> index ead2bdc5cf..fef116d040 100644 >>>>>>> --- a/libavformat/fifo.c >>>>>>> +++ b/libavformat/fifo.c >>>>>>> @@ -509,7 +509,7 @@ static int fifo_mux_init(AVFormatContext *avf, const AVOutputFormat *oformat, >>>>>>> if (!st) >>>>>>> return AVERROR(ENOMEM); >>>>>>> >>>>>>> - ret = ff_stream_encode_params_copy(st, avf->streams[i]); >>>>>>> + ret = ff_stream_params_copy(st, avf->streams[i]); >>>>>>> if (ret < 0) >>>>>>> return ret; >>>>>>> } >>>>>>> diff --git a/libavformat/internal.h b/libavformat/internal.h >>>>>>> index b6b8fbf56f..87a00bbae3 100644 >>>>>>> --- a/libavformat/internal.h >>>>>>> +++ b/libavformat/internal.h >>>>>>> @@ -625,6 +625,18 @@ enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags); >>>>>>> */ >>>>>>> int ff_stream_side_data_copy(AVStream *dst, const AVStream *src); >>>>>>> >>>>>>> +/** >>>>>>> + * Copy all stream parameters from source to destination stream, with the >>>>>>> + * exception of: >>>>>>> + * * the index field, which is usually set by avformat_new_stream() >>>>>>> + * * the attached_pic field, if attached_pic.size is 0 or less >>>>>>> + * >>>>>>> + * @param dst pointer to destination AVStream >>>>>>> + * @param src pointer to source AVStream >>>>>>> + * @return >=0 on success, AVERROR code on error >>>>>>> + */ >>>>>>> +int ff_stream_params_copy(AVStream *dst, const AVStream *src); >>>>>>> + >>>>>>> /** >>>>>>> * Wrap ffurl_move() and log if error happens. >>>>>>> * >>>>>>> diff --git a/libavformat/mux.h b/libavformat/mux.h >>>>>>> index c01da82194..1bfcaf795f 100644 >>>>>>> --- a/libavformat/mux.h >>>>>>> +++ b/libavformat/mux.h >>>>>>> @@ -113,15 +113,6 @@ int ff_format_shift_data(AVFormatContext *s, int64_t read_start, int shift_size) >>>>>>> */ >>>>>>> int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **options); >>>>>>> >>>>>>> -/** >>>>>>> - * Copy encoding parameters from source to destination stream >>>>>>> - * >>>>>>> - * @param dst pointer to destination AVStream >>>>>>> - * @param src pointer to source AVStream >>>>>>> - * @return >=0 on success, AVERROR code on error >>>>>>> - */ >>>>>>> -int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src); >>>>>>> - >>>>>>> /** >>>>>>> * Parse creation_time in AVFormatContext metadata if exists and warn if the >>>>>>> * parsing fails. >>>>>>> diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c >>>>>>> index eb8ea3d560..2fa2ab5b0f 100644 >>>>>>> --- a/libavformat/mux_utils.c >>>>>>> +++ b/libavformat/mux_utils.c >>>>>>> @@ -121,34 +121,6 @@ int ff_format_output_open(AVFormatContext *s, const char *url, AVDictionary **op >>>>>>> return 0; >>>>>>> } >>>>>>> >>>>>>> -int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src) >>>>>>> -{ >>>>>>> - int ret; >>>>>>> - >>>>>>> - dst->id = src->id; >>>>>>> - dst->time_base = src->time_base; >>>>>>> - dst->nb_frames = src->nb_frames; >>>>>>> - dst->disposition = src->disposition; >>>>>>> - dst->sample_aspect_ratio = src->sample_aspect_ratio; >>>>>>> - dst->avg_frame_rate = src->avg_frame_rate; >>>>>>> - dst->r_frame_rate = src->r_frame_rate; >>>>>>> - >>>>>>> - av_dict_free(&dst->metadata); >>>>>>> - ret = av_dict_copy(&dst->metadata, src->metadata, 0); >>>>>>> - if (ret < 0) >>>>>>> - return ret; >>>>>>> - >>>>>>> - ret = avcodec_parameters_copy(dst->codecpar, src->codecpar); >>>>>>> - if (ret < 0) >>>>>>> - return ret; >>>>>>> - >>>>>>> - ret = ff_stream_side_data_copy(dst, src); >>>>>>> - if (ret < 0) >>>>>>> - return ret; >>>>>>> - >>>>>>> - return 0; >>>>>>> -} >>>>>>> - >>>>>>> int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t *timestamp, int return_seconds) >>>>>>> { >>>>>>> AVDictionaryEntry *entry; >>>>>>> diff --git a/libavformat/segment.c b/libavformat/segment.c >>>>>>> index fa435d9f32..a8f3e94714 100644 >>>>>>> --- a/libavformat/segment.c >>>>>>> +++ b/libavformat/segment.c >>>>>>> @@ -169,7 +169,7 @@ static int segment_mux_init(AVFormatContext *s) >>>>>>> >>>>>>> if (!(st = avformat_new_stream(oc, NULL))) >>>>>>> return AVERROR(ENOMEM); >>>>>>> - ret = ff_stream_encode_params_copy(st, ist); >>>>>>> + ret = ff_stream_params_copy(st, ist); >>>>>>> if (ret < 0) >>>>>>> return ret; >>>>>>> opar = st->codecpar; >>>>>>> diff --git a/libavformat/tee.c b/libavformat/tee.c >>>>>>> index f1f2a9d2a5..dbfad604d0 100644 >>>>>>> --- a/libavformat/tee.c >>>>>>> +++ b/libavformat/tee.c >>>>>>> @@ -289,7 +289,7 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) >>>>>>> goto end; >>>>>>> } >>>>>>> >>>>>>> - ret = ff_stream_encode_params_copy(st2, st); >>>>>>> + ret = ff_stream_params_copy(st2, st); >>>>>>> if (ret < 0) >>>>>>> goto end; >>>>>>> } >>>>>>> diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c >>>>>>> index d69db3a004..39f21fce7a 100644 >>>>>>> --- a/libavformat/webm_chunk.c >>>>>>> +++ b/libavformat/webm_chunk.c >>>>>>> @@ -94,7 +94,7 @@ static int webm_chunk_init(AVFormatContext *s) >>>>>>> if (!(st = avformat_new_stream(oc, NULL))) >>>>>>> return AVERROR(ENOMEM); >>>>>>> >>>>>>> - if ((ret = ff_stream_encode_params_copy(st, ost)) < 0) >>>>>>> + if ((ret = ff_stream_params_copy(st, ost)) < 0) >>>>>>> return ret; >>>>>>> >>>>>>> if (wc->http_method) >>>>>> >>>>>> Looking at these callers shows that they all have one thing in common: >>>>>> They create a stream and immediately afterwards copy stream parameters. >>>>>> The caller that you intend to add in #2 does the same. How about we make >>>>>> a function that is equivalent to >>>>>> avformat_new_stream+ff_stream_params_copy above and use that? (But >>>>>> please leave ff_stream_params_copy as it is in the form of a static >>>>>> function.) >>>>> >>>>> avformat_clone_stream()? >>>>> >>>> >>>> I was not thinking about a public function. But clone_stream sounds good. >>> >>> Something like this? >>> >>> int ff_stream_clone(AVFormatContext *s, AVStream **dst, const AVStream *src) >>> { >>> AVStream *st; >>> int ret; >>> >>> st = avformat_new_stream(s, NULL); >>> if (!st) >>> return AVERROR(ENOMEM); >>> >>> ret = stream_params_copy(st, src); >>> if (ret < 0) >>> return ret; >>> >>> *dst = st; >>> >>> return 0; >>> } >>> >> >> I'd use AVStream *ff_stream_clone(AVFormatContext *dst_ctx, const >> AVStream *src); > > How does one recover a pointer to the stream that was just created? > Isn't there a potential race condition with dst_ctx[nb_streams - 1]? > ? 1. The function is supposed to return the stream just created; just like avformat_new_stream does. 2. If there are multiple threads adding streams to dst_ctx, we'd already be screwed anyway (avformat_new_stream does not use any lock). - Andreas _______________________________________________ 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".