diff mbox series

[FFmpeg-devel,3/3] avformat/rtpenc_mpegts: allow options for rtp muxer

Message ID 20210323053734.6741-3-ffmpeg@gyani.pro
State Accepted
Commit 2c806aa2b4d61e87ee58df92153f87410c82cd09
Headers show
Series [FFmpeg-devel,1/3] avformat/rtpenc_mpegts: allow options for mpeg-ts muxer | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Gyan Doshi March 23, 2021, 5:37 a.m. UTC
---
 libavformat/rtpenc_mpegts.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Gyan Doshi March 25, 2021, 7:03 a.m. UTC | #1
Plan to push set tomorrow.

On 2021-03-23 11:07, Gyan Doshi wrote:
> ---
>   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 },
>   };
>
Gyan Doshi March 26, 2021, 7:12 a.m. UTC | #2
Set pushed as

affe911c65022c96bc8ade2ea5f2c09235974c30
325bb04188092f37aceee962f58a4816f0d8e79b
2c806aa2b4d61e87ee58df92153f87410c82cd09

Gyan

On 2021-03-25 12:33, Gyan Doshi wrote:
> Plan to push set tomorrow.
>
> On 2021-03-23 11:07, Gyan Doshi wrote:
>> ---
>>   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 },
>>   };
>
> _______________________________________________
> 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".
diff mbox series

Patch

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 },
 };