From patchwork Tue Mar 23 05:37:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 26553 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 9579944A77B for ; Tue, 23 Mar 2021 07:38:01 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80DFF68AB11; Tue, 23 Mar 2021 07:38:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E587E689A52 for ; Tue, 23 Mar 2021 07:37:53 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4F4Krx3YKWzQjx7 for ; Tue, 23 Mar 2021 06:37:53 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id 5cIK7Mcgo2hT for ; Tue, 23 Mar 2021 06:37:50 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Mar 2021 11:07:34 +0530 Message-Id: <20210323053734.6741-3-ffmpeg@gyani.pro> In-Reply-To: <20210323053734.6741-1-ffmpeg@gyani.pro> References: <20210323053734.6741-1-ffmpeg@gyani.pro> MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 0.24 / 15.00 / 15.00 X-Rspamd-Queue-Id: 8678917B4 X-Rspamd-UID: 7cc439 Subject: [FFmpeg-devel] [PATCH 3/3] avformat/rtpenc_mpegts: allow options for rtp muxer 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/rtpenc_mpegts.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c index 22881461e4..f7ee5a4448 100644 --- a/libavformat/rtpenc_mpegts.c +++ b/libavformat/rtpenc_mpegts.c @@ -29,6 +29,7 @@ typedef struct MuxChain { AVFormatContext *rtp_ctx; AVPacket *pkt; AVDictionary* mpegts_muxer_options; + AVDictionary* rtp_muxer_options; } MuxChain; static int rtp_mpegts_write_close(AVFormatContext *s) @@ -59,6 +60,7 @@ static int rtp_mpegts_write_header(AVFormatContext *s) int i, ret = AVERROR(ENOMEM); AVStream *st; AVDictionary *mpegts_muxer_options = NULL; + AVDictionary *rtp_muxer_options = NULL; if (!mpegts_format || !rtp_format) return AVERROR(ENOSYS); @@ -108,7 +110,8 @@ static int rtp_mpegts_write_header(AVFormatContext *s) st->time_base.den = 90000; st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS; rtp_ctx->pb = s->pb; - if ((ret = avformat_write_header(rtp_ctx, NULL)) < 0) + av_dict_copy(&rtp_muxer_options, chain->rtp_muxer_options, 0); + if ((ret = avformat_write_header(rtp_ctx, &rtp_muxer_options)) < 0) goto fail; chain->rtp_ctx = rtp_ctx; @@ -121,6 +124,7 @@ fail: av_dict_free(&mpegts_muxer_options); avformat_free_context(mpegts_ctx); } + av_dict_free(&rtp_muxer_options); avformat_free_context(rtp_ctx); rtp_mpegts_write_close(s); return ret; @@ -167,6 +171,7 @@ static int rtp_mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { { "mpegts_muxer_options", "set list of options for the MPEG-TS muxer", OFFSET(mpegts_muxer_options), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, E }, + { "rtp_muxer_options", "set list of options for the RTP muxer", OFFSET(rtp_muxer_options), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, E }, { NULL }, };