#include "libavutil/mathematics.h"
#include "avformat.h"
+#include "avio_internal.h"
struct MuxChain {
AVFormatContext *mpegts_ctx;
if (chain->mpegts_ctx) {
av_write_trailer(chain->mpegts_ctx);
- if (chain->mpegts_ctx->pb) {
- uint8_t *buf;
- avio_close_dyn_buf(chain->mpegts_ctx->pb, &buf);
- av_free(buf);
- }
+ ffio_free_dyn_buf(&chain->mpegts_ctx->pb);
avformat_free_context(chain->mpegts_ctx);
}
if (chain->rtp_ctx) {
st->time_base.num = 1;
st->time_base.den = 90000;
st->codec->codec_id = AV_CODEC_ID_MPEG2TS;
- chain->rtp_ctx = rtp_ctx;
rtp_ctx->pb = s->pb;
if ((ret = avformat_write_header(rtp_ctx, NULL)) < 0)
goto fail;
- rtp_ctx = NULL;
+ chain->rtp_ctx = rtp_ctx;
return 0;
fail:
if (mpegts_ctx) {
- if (mpegts_ctx->pb) {
- uint8_t *buf;
- avio_close_dyn_buf(mpegts_ctx->pb, &buf);
- av_free(buf);
- }
+ ffio_free_dyn_buf(&mpegts_ctx->pb);
avformat_free_context(mpegts_ctx);
}
if (rtp_ctx)