]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpenc_mpegts.c
avcodec/packet_internal: move the next pointer in PacketList to the top of the struct
[ffmpeg] / libavformat / rtpenc_mpegts.c
index f7ee5a4448925cf044478c6eb7d030cc8ceeb120..fdc759c1793dc0ec28836f7d1eb53347164fa242 100644 (file)
@@ -25,6 +25,7 @@
 #include "avio_internal.h"
 
 typedef struct MuxChain {
+    const AVClass *class;
     AVFormatContext *mpegts_ctx;
     AVFormatContext *rtp_ctx;
     AVPacket *pkt;
@@ -55,8 +56,8 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
 {
     MuxChain *chain = s->priv_data;
     AVFormatContext *mpegts_ctx = NULL, *rtp_ctx = NULL;
-    ff_const59 AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);
-    ff_const59 AVOutputFormat *rtp_format    = av_guess_format("rtp", NULL, NULL);
+    const AVOutputFormat *mpegts_format = av_guess_format("mpegts", NULL, NULL);
+    const AVOutputFormat *rtp_format    = av_guess_format("rtp", NULL, NULL);
     int i, ret = AVERROR(ENOMEM);
     AVStream *st;
     AVDictionary *mpegts_muxer_options = NULL;
@@ -87,8 +88,11 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
 
     av_dict_copy(&mpegts_muxer_options, chain->mpegts_muxer_options, 0);
 
-    if ((ret = avformat_write_header(mpegts_ctx, &mpegts_muxer_options)) < 0)
+    ret = avformat_write_header(mpegts_ctx, &mpegts_muxer_options);
+    av_dict_free(&mpegts_muxer_options);
+    if (ret < 0)
         goto fail;
+
     for (i = 0; i < s->nb_streams; i++)
         s->streams[i]->time_base = mpegts_ctx->streams[i]->time_base;
 
@@ -111,8 +115,11 @@ static int rtp_mpegts_write_header(AVFormatContext *s)
     st->codecpar->codec_id = AV_CODEC_ID_MPEG2TS;
     rtp_ctx->pb = s->pb;
     av_dict_copy(&rtp_muxer_options, chain->rtp_muxer_options, 0);
-    if ((ret = avformat_write_header(rtp_ctx, &rtp_muxer_options)) < 0)
+    ret = avformat_write_header(rtp_ctx, &rtp_muxer_options);
+    av_dict_free(&rtp_muxer_options);
+    if (ret < 0)
         goto fail;
+
     chain->rtp_ctx = rtp_ctx;
 
     return 0;
@@ -121,10 +128,8 @@ fail:
     if (mpegts_ctx) {
         ffio_free_dyn_buf(&mpegts_ctx->pb);
         av_dict_free(&mpegts_ctx->metadata);
-        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;
@@ -182,7 +187,7 @@ static const AVClass rtp_mpegts_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-AVOutputFormat ff_rtp_mpegts_muxer = {
+const AVOutputFormat ff_rtp_mpegts_muxer = {
     .name              = "rtp_mpegts",
     .long_name         = NULL_IF_CONFIG_SMALL("RTP/mpegts output format"),
     .priv_data_size    = sizeof(MuxChain),