[FFmpeg-devel] avformat/rtpenc_mpegts: copy metadata to mpegts sub-muxer

Submitted by Moritz Barsnick on July 2, 2018, 11:38 a.m.

Details

Message ID 20180702113804.GG8854@sunshine.barsnick.net
State New
Headers show

Commit Message

Moritz Barsnick July 2, 2018, 11:38 a.m.
Fixes #7293.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
Implemented to the best of my little knowledge (by checking other
metadata use cases). Feel free to correct.

Perhaps a candidate for backporting to release/4.0 or release/*?
---
 libavformat/rtpenc_mpegts.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c
index 5f81e1a145..6e5614db2f 100644
--- a/libavformat/rtpenc_mpegts.c
+++ b/libavformat/rtpenc_mpegts.c
@@ -60,6 +60,7 @@  static int rtp_mpegts_write_header(AVFormatContext *s)
         return AVERROR(ENOMEM);
     mpegts_ctx->oformat   = mpegts_format;
     mpegts_ctx->max_delay = s->max_delay;
+    av_dict_copy(&mpegts_ctx->metadata, s->metadata, 0);
     for (i = 0; i < s->nb_streams; i++) {
         AVStream* st = avformat_new_stream(mpegts_ctx, NULL);
         if (!st)
@@ -102,6 +103,7 @@  static int rtp_mpegts_write_header(AVFormatContext *s)
 fail:
     if (mpegts_ctx) {
         ffio_free_dyn_buf(&mpegts_ctx->pb);
+        av_dict_free(&mpegts_ctx->metadata);
         avformat_free_context(mpegts_ctx);
     }
     if (rtp_ctx)