From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 382BC4BE00 for ; Fri, 29 Aug 2025 14:07:16 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'4YHSBEOz5+qWkSKaY0GMGPSUHvpvDBC2gaBqD97FS7o=', expected b'rUaRaDbCCrvkdxRBx1BMKqNfBXVoe8iQlQq27SclRu8=')) header.d=axis.com header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1756476386; h=to : date : message-id : in-reply-to : references : mime-version : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=zg5J48kHMuK2DM5oscrM7018d+7FcDPebH4iWVmMbWA=; b=ubM5fEREztSNmjTGIHv+QVtbTMDqLvTvKWPvbtZyfSyAC9pTPULbMqrLBr2iQItNzHOMy 0woqD34KpYd2toRjDwsjdOuKRmUNgabdBpoG7DzLIHrJ8fh7+JkOHRT+13duluvXWWhEd30 wMuIL10JBaIa+fKiS/5JmJmzHXF1SKqS+mbv1kN8N5o+xmreL8A1b5d2FkrO4h1ow/8IPou k4s6hhujnHO59EC6gSuprAieT+Scjy/bvHCuWg3MkYssML2DivKtTS7R03MLcqgN0XHdP0m OwZRa0H/xmsdFvVVNknny7g7jrDhW0nVDjJav9gX2BDRnDR2UkB6JXAPowbA== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id EA39868E882; Fri, 29 Aug 2025 17:06:26 +0300 (EEST) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1756476370; b=fKXaTG/Uq0tO6v84vnkhB4dqWPhsdMXNSSgaWsuNHcNpQjj3XgL38K0VfpiBkGlq5L6s2 2WS/B26Jfn7RdaEEJIABjq+DNQ9R/i7WsBLaI/B92BDRB6ntoptCaaJqg6LI9lPwd3HJXV3 ZDcHf9md+WUadJ1p6HLwBguhF0YL8/y1gBCQ6QHZkBJxCfvHuz6UPGklth+mvpreq1oqY9T 7BeN1dVWwkjTdS7312xMe74pzR/yC8KKTAEQIhMHbZfw8C3LJrnWLuu1PFSbeoiq8ghKlMI LRPN2eIRK2qXDedTjY3gmU48cSVK6LEkKN3PdgSArlvHWuG1S0mQfHTSnlaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1756476370; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=4YHSBEOz5+qWkSKaY0GMGPSUHvpvDBC2gaBqD97FS7o=; b=U+B+MPbFFNTenLAeccxpWZhOXcTRx6PMTdR7YZQINGfA4fBq8nTE11X7Bkp+7OpCwe1YU 4Gj5dmudPFnBFEoIBatll4Odj4rt7gxb1KjDHlHB/a/zQOMglk6DFcGigUj+FHCnjsCJafC IADllXbLav8vI369VtgkltTkbTOAXRmJpObIsWiQ6FAxmsj8p/aSPbGVjzfLcI12GzS0pHM O42eV86U/w3C0hVAdiKycJ6igWKzvYmFhM9qbDQW+48AifREj9gwGaZphGC03/VCFFN1+QF GePaxo8q6IVPaf+IVU10DXmNwYv/C+C5NQgEttV7N5OjVhwAivKhXgmemavw== ARC-Authentication-Results: i=2; ffmpeg.org; dkim=pass header.d=axis.com; arc=pass; dmarc=pass header.from=axis.com policy.dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=axis.com; arc=pass; dmarc=pass (Used From Domain Record) header.from=axis.com policy.dmarc=none Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011026.outbound.protection.outlook.com [40.107.130.26]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id A738868E714 for ; Fri, 29 Aug 2025 17:05:17 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a3bKGi77wG13PBO8r88t7VKdziF6nBIMPSLZzCAfp2jYB+i3QKJOcEs8PvPHEJ2y1mqNqIc0lbqB08l1XowRweocANHz4AB0bz22fpncddSO6mCQiHdS749bedVYWGpJVWFpQG0zy0HworjbTkRIhAodAYN0A2DO5dCOLtwlIBbKhtbJyQZCiST+CdIDWu6viqGRDecg+lPIArjjc9S499OAh1qIph5RMg4AzH3uw423Ws/Qktky8mm8L/E5hvRfMidS/gYfvKsN6DULd1bkLACfrj6AxdE5eJY2y0xm6kLhaUQ+syx86WPlr6LxOjU1jUdfCQjSDvTcA4QVCk5iyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rUaRaDbCCrvkdxRBx1BMKqNfBXVoe8iQlQq27SclRu8=; b=g0cyLw90Ew36lYqLoZisk0lzI6Ahzzt4KFG+pRRGOwb7kUQJWZMqFPKghVN8NqHqaaGWIlR17upIJmCg43Fkp9cadJCW2oAVqT+0Xulj6lP+gdzm2fKWdz742qnpk6Tdwhrr+mjtB0PtYL3/P2YQbw+2MrveL4WtDQLEp9axzgkKqmPGJlPk/BDKOUlBfK17yUm1b19Few0kwwfBq4QdRt1ICjz+cXztYwgSYwI56qfcDn5FSYWWq8SfPZJqfVkIza9VdDjZPBEXngsHjzTSK/rO+LfXgeoL/+Era8kxoQNRv5frikaGiqn26rey4Kxv/Bl2q/H0tf78yH4B2oFKhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=ffmpeg.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rUaRaDbCCrvkdxRBx1BMKqNfBXVoe8iQlQq27SclRu8=; b=RSZAl6i+Owznl0sHS6ElJ1OROJVtQDmuscqcVgxrDJQ7kBjlOyPZfnYJD0iljA1H8WEXuwqe3gAaTvoecJcnwwG9qG1EmVBXhRgHwAVjj28BEEhyclrvAvTLIZw7+m+WJ2sx6N8b3Jxu2am5YcAGbpyT2b+9FIop8ihskCuIR/w= Received: from DUZPR01CA0013.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::6) by GV2PR02MB8823.eurprd02.prod.outlook.com (2603:10a6:150:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9052.21; Fri, 29 Aug 2025 14:05:13 +0000 Received: from DB1PEPF00050A00.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::d5) by DUZPR01CA0013.outlook.office365.com (2603:10a6:10:3c3::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9073.20 via Frontend Transport; Fri, 29 Aug 2025 14:05:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF00050A00.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9073.11 via Frontend Transport; Fri, 29 Aug 2025 14:05:12 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 29 Aug 2025 16:05:07 +0200 Received: from se-intmail01x.se.axis.com (10.4.0.28) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 29 Aug 2025 16:05:07 +0200 Received: from pc55631-2335.se.axis.com (pc55631-2335.se.axis.com [10.94.180.160]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id DDFC34EB0; Fri, 29 Aug 2025 16:05:07 +0200 (CEST) Received: by pc55631-2335.se.axis.com (Postfix, from userid 18910) id DC4FA43A5198; Fri, 29 Aug 2025 16:05:07 +0200 (CEST) To: , , Date: Fri, 29 Aug 2025 16:04:58 +0200 Message-ID: <20250829140459.3220037-5-peterend@axis.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250829140459.3220037-1-peterend@axis.com> References: <0250811223419.GF29660@pb2> <20250829140459.3220037-1-peterend@axis.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF00050A00:EE_|GV2PR02MB8823:EE_ X-MS-Office365-Filtering-Correlation-Id: f7a24826-bcf1-419d-b010-08dde7051265 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?8t/V93kwN4V96naX8EIRKe626KWGoyZUoeD3RfroeJPIEEFKbKkzYe4cKXOL?= =?us-ascii?Q?cAUILFVejJCCQwYhc8gmtCrXTf1r0iG01l19J9ine8yC1fV/Z/m9Sz6STnMU?= =?us-ascii?Q?zLmuDWT97JCt+jotFOK8u/OygfYRxjM+UYMXi5XlLSuitEsf0XPgEPMrYx/X?= =?us-ascii?Q?Hri1o9b9Vgvt9QFTGwrB1RSzOwpkrg8p54P97JcW8IuWbonFo400ZKk0Wf86?= =?us-ascii?Q?fCsy9KF0kY42qv0//06GS5uxyhrB0lCYX2obp5bSzjt6yhNpU7mmgTZtrijD?= =?us-ascii?Q?Kr0X7am3334uDrn4H3kNOr0jYY1XpeThGujsht+ZvG6AfWYG3czlCgC74rHG?= =?us-ascii?Q?Fafsrf1RT8wDr/9NQqjwiVujgeh1L45v6w5VBePSGQKdLnk2JsGR+TXUq1xr?= =?us-ascii?Q?Ro7czl9vXK7k2ikQ+CQJAupOhzJlNwAbmny5/jh1i6B+HhvcOZSyFkYUPvkq?= =?us-ascii?Q?up+woJddxvLh6LBHgQhAUJqZ1rAjN+pLOwNmnhb62s6kKVvqNbk+75afQ++f?= =?us-ascii?Q?An2vG8+plS67VMnDuM0CClymA0j8xiFTlB3P/l+AHQU1hSoBicmk7j8Bsth4?= =?us-ascii?Q?658EA1ZoPtk3+4fgO/gdxx0kYKH6BKeTIPVD5gG/eUnmUMVr4pgvrRR1WUO9?= =?us-ascii?Q?tEN9+ghFSzfk8X/uE+kERzhYA7uMqNnUiJ5ikknSq9Rtb9zRjdM7kYDBt9Pn?= =?us-ascii?Q?YG5EEHcZ/NrliHBaYRJuQ6qonYVTaJ2/B/UlEtFd2BIP9vSxQFuktGGCMaRS?= =?us-ascii?Q?Bzj8ZlcU55u1sIIFl7hm/Jg44doMzhy+5RnasPLQ+pXqyTbV/6CTthPDO99F?= =?us-ascii?Q?OIgOaU58xQi3+NYGhD/9UHS13bmyHs2Yu4VoDM8tiAw/KCmAAVTdn6LPUd9T?= =?us-ascii?Q?k26BkRsQnJKCtx9PBBVD02XDbWorGIZyKBmsmHYkFXmLboxcUtxTe1SxL9rs?= =?us-ascii?Q?RNcY6N//Jb2Jw55O3k497iFTKHAeIvjT36NJdEIw3i1LcjBwFtCtLdHaDVzs?= =?us-ascii?Q?8FSpI/D9sFEItOd/vqzfVeUaKhZGcsXq/BTvCAVKUMq2FwvqzbB7K3Iwd9uR?= =?us-ascii?Q?fHqQhNuTllDV+L22IhXen453zCkaLi6Qx8f/XWsLgwDGEOjS1WohY7YDNQFx?= =?us-ascii?Q?b3PUfiZoEBe8bgUp/bhztdMWhRmNPb9HmyePkgEnl9JPhPy3bxGy8fBmDWc7?= =?us-ascii?Q?sRlwciJKipWqSEvZkbwVHDdZRV5w1Gvl1ZyYetgeD2swH6D/F5eSE04YbEt0?= =?us-ascii?Q?sgtP8rY2+iV/sMh5mV/WGoOr8LliD0sOke9wHcLB289rxZa2QPwN1teTrekx?= =?us-ascii?Q?MOjVdoPXWKbZ6Gz9FrTk/Ce2JBZ5WjRa+SYilNyav84RArioTC9DnZDa2H0G?= =?us-ascii?Q?CxokmFCm4tPZcNSi4gia9uJqOySJzwlDbmxg3iSdrlZQ/rm8bxt+L4OQThZ/?= =?us-ascii?Q?VEzFdIa0kbMxO708LJ1s5gDw1FfdNzQgGq0jZvYyiv9qEKhDXmWt86w1rQ5t?= =?us-ascii?Q?UGqjvIboKIN9ZYFNVhL12FZxh4bDCfZK4AQs?= X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2025 14:05:12.5466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7a24826-bcf1-419d-b010-08dde7051265 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00050A00.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR02MB8823 Message-ID-Hash: Y7C5TVA63WEVMH3HTJSU5RSDQI3KAP4C X-Message-ID-Hash: Y7C5TVA63WEVMH3HTJSU5RSDQI3KAP4C X-MailFrom: SRS0=YjuK=3J=axis.com=Peter.Enderborg@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH v3 4/5] libavformat: add multicast interface List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Enderborg via ffmpeg-devel Cc: Peter Enderborg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: Add a commandline option for selecting interface by name. This is useful when your multicast routing table for sending multicast does not match the interface reciving is wanted. Signed-off-by: Peter Enderborg --- libavformat/rtpproto.c | 4 ++++ libavformat/rtsp.c | 3 +++ libavformat/rtsp.h | 1 + libavformat/udp.c | 40 ++++++++++++++++++++++++++++++---------- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index c6abd7a02c..74c920ddc8 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -61,6 +61,7 @@ typedef struct RTPContext { char *fec_options_str; int64_t rw_timeout; char *localaddr; + char *multicast_interface; int multicast_max_join; } RTPContext; @@ -83,6 +84,7 @@ static const AVOption options[] = { { "fec", "FEC", OFFSET(fec_options_str), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = E }, { "localaddr", "Local address", OFFSET(localaddr), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, { "multicast_max_join", "Number of ipv6 network intefaces to join multicast group", OFFSET(multicast_max_join), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, .flags = D|E }, + { "multicast_interface", "Name of network inteface to join multicast group", OFFSET(multicast_interface), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, { NULL } }; @@ -202,6 +204,8 @@ static void build_udp_url(RTPContext *s, if (localaddr && localaddr[0]) url_add_option(buf, buf_size, "localaddr=%s", localaddr); url_add_option(buf, buf_size, "multicast_max_join=%d", s->multicast_max_join); + if (s->multicast_interface) + url_add_option(buf, buf_size, "multicast_interface=%s", s->multicast_interface); } /** diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 08ce628b0c..59e39fa97c 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -82,6 +82,7 @@ { "reorder_queue_size", "set number of packets to buffer for handling of reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC }, \ { "buffer_size", "Underlying protocol send/receive buffer size", OFFSET(buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, DEC|ENC }, \ { "multicast_max_join", "Number of ipv6 network intefaces to join multicast group", OFFSET(multicast_max_join), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, ENC }, \ + { "multicast_interface", "Name of network inteface to join multicast group", OFFSET(multicast_interface), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, \ { "pkt_size", "Underlying protocol send packet size", OFFSET(pkt_size), AV_OPT_TYPE_INT, { .i64 = 1472 }, -1, INT_MAX, ENC } \ @@ -141,6 +142,8 @@ static AVDictionary *map_to_opts(RTSPState *rt) if (rt->localaddr && rt->localaddr[0]) av_dict_set(&opts, "localaddr", rt->localaddr, 0); av_dict_set_int(&opts, "multicast_max_join", rt->multicast_max_join, 0); + if (rt->multicast_interface) + av_dict_set(&opts, "multicast_interface", rt->multicast_interface, 0); return opts; } diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 626114fb5a..e48af2feca 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -420,6 +420,7 @@ typedef struct RTSPState { int pkt_size; char *localaddr; int multicast_max_join; + char *multicast_interface; /** * Options used for TLS based RTSP streams. diff --git a/libavformat/udp.c b/libavformat/udp.c index 9c2f904e50..004d2a6a1c 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -126,6 +126,7 @@ typedef struct UDPContext { int remaining_in_dg; char *localaddr; int multicast_max_join; + char *multicast_interface; int timeout; struct sockaddr_storage local_addr_storage; char *sources; @@ -146,6 +147,7 @@ static const AVOption options[] = { { "local_port", "Local port", OFFSET(local_port), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, { "localaddr", "Local address", OFFSET(localaddr), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, { "multicast_max_join", "Number of ipv6 network intefaces to join multicast group", OFFSET(multicast_max_join), AV_OPT_TYPE_INT, { .i64 = IPV6_DEFAULT_JOIN }, -1, INT_MAX, .flags = D|E }, + { "multicast_interface", "Name of network inteface to join multicast group", OFFSET(multicast_interface), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E }, { "udplite_coverage", "choose UDPLite head size which should be validated by checksum", OFFSET(udplite_coverage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D|E }, { "pkt_size", "Maximum UDP packet size", OFFSET(pkt_size), AV_OPT_TYPE_INT, { .i64 = 1472 }, -1, INT_MAX, .flags = D|E }, { "reuse", "explicitly allow reusing UDP sockets", OFFSET(reuse_socket), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, D|E }, @@ -259,7 +261,8 @@ static int udp_ipv6_mc_devname_membership(int mop, const char *name, static int udp_ipv6_multicast_iterate(int sockfd, struct sockaddr_in6 *addr, struct sockaddr_in6 *local_addr, int mop, - int multicast_max_join, void *logctx) + int multicast_max_join, + char *interfacename, void *logctx) { struct in6_addr anyipv6 = IN6ADDR_ANY_INIT; struct ifaddrs *ifal=NULL,*ife=NULL; @@ -275,11 +278,13 @@ static int udp_ipv6_multicast_iterate(int sockfd, struct sockaddr_in6 *addr, multicast_max_join ) { if ((!memcmp(&local_addr->sin6_addr, &anyipv6, sizeof(struct in6_addr))) || (!memcmp(&local_addr->sin6_addr, &((struct sockaddr_in6 *)ife->ifa_addr)->sin6_addr, sizeof(struct in6_addr)))) { - if (udp_ipv6_mc_devname_membership(mop,ife->ifa_name, - iindex_fd, &addr->sin6_addr, - sockfd, logctx) == 1) { - membership_changed = 1; - multicast_max_join--; + if (!interfacename || !strncmp(interfacename, ife->ifa_name, IFNAMSIZ)) { + if (udp_ipv6_mc_devname_membership(mop,ife->ifa_name, + iindex_fd, &addr->sin6_addr, + sockfd, logctx) == 1) { + membership_changed = 1; + multicast_max_join--; + } } } } @@ -298,7 +303,8 @@ static int udp_ipv6_multicast_iterate(int sockfd, struct sockaddr_in6 *addr, static int udp_join_multicast_group(int sockfd, struct sockaddr *addr, struct sockaddr *local_addr, - int multicast_max_join, void *logctx) + int multicast_max_join, + char *multicast_interface,void *logctx) { #ifdef IP_ADD_MEMBERSHIP if (addr->sa_family == AF_INET) { @@ -313,6 +319,8 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr, ff_log_net_error(logctx, AV_LOG_ERROR, "setsockopt(IP_ADD_MEMBERSHIP)"); return ff_neterrno(); } + if (multicast_interface) + ff_log_net_error(logctx, AV_LOG_WARNING, "multicast_inteface is not used in ip4"); if (multicast_max_join) ff_log_net_error(logctx, AV_LOG_WARNING, "multicast_max_join is not used in ip4"); } @@ -337,6 +345,7 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr, (struct sockaddr_in6 *)local_addr, IPV6_JOIN_GROUP, multicast_max_join, + multicast_interface, logctx); } #else @@ -354,7 +363,8 @@ static int udp_join_multicast_group(int sockfd, struct sockaddr *addr, static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr, struct sockaddr *local_addr, - int multicast_max_join, void *logctx) + int multicast_max_join, + char *multicast_interface,void *logctx) { #ifdef IP_DROP_MEMBERSHIP if (addr->sa_family == AF_INET) { @@ -391,6 +401,7 @@ static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr, (struct sockaddr_in6 *)local_addr, IPV6_LEAVE_GROUP, multicast_max_join, + multicast_interface, logctx); } #else @@ -922,6 +933,14 @@ static int udp_open(URLContext *h, const char *uri, int flags) goto fail; } } + if (av_find_info_tag(buf, sizeof(buf), "multicast_interface", p)) { + av_freep(&s->multicast_interface); + s->multicast_interface = av_strdup(buf); + if (!s->multicast_interface) { + ret = AVERROR(ENOMEM); + goto fail; + } + } if (av_find_info_tag(buf, sizeof(buf), "sources", p)) { if ((ret = ff_ip_parse_sources(h, buf, &s->filters)) < 0) goto fail; @@ -1051,7 +1070,8 @@ static int udp_open(URLContext *h, const char *uri, int flags) } else { if ((ret = udp_join_multicast_group(udp_fd, (struct sockaddr *)&s->dest_addr, (struct sockaddr *)&s->local_addr_storage, - s->multicast_max_join, h)) < 0) + s->multicast_max_join, + s->multicast_interface, h)) < 0) goto fail; } if (s->filters.nb_exclude_addrs) { @@ -1306,7 +1326,7 @@ static int udp_close(URLContext *h) if (s->is_multicast && (h->flags & AVIO_FLAG_READ)) udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr, (struct sockaddr *)&s->local_addr_storage, - s->multicast_max_join, h); + s->multicast_max_join, s->multicast_interface, h); #if HAVE_PTHREAD_CANCEL if (s->thread_started) { int ret; -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org