diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 20b4b121399d13207843f44132e4866743b3611f..fac5bcf4177395848969aaf1a4d6b208ea8f5c18 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -549,7 +549,7 @@ static int hds_write_packet(AVFormatContext *s, AVPacket *pkt) os->last_ts = pkt->dts; os->packets_written++; - return ff_write_chained(os->ctx, pkt->stream_index - os->first_stream, pkt, s); + return ff_write_chained(os->ctx, pkt->stream_index - os->first_stream, pkt, s, 0); } static int hds_write_trailer(AVFormatContext *s) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 388a23a18bf725ac175b5170d5586a2c840bd778..ca42b444b17372c7a6c5dab450f1ff6c4801e3be 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -302,7 +302,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) return ret; } - ret = ff_write_chained(oc, pkt->stream_index, pkt, s); + ret = ff_write_chained(oc, pkt->stream_index, pkt, s, 0); return ret; } diff --git a/libavformat/internal.h b/libavformat/internal.h index 467e25d830fc46543d900b275eeae67caa3bf509..08987c76be720800a73b6ca8de86bac2148d19c8 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -134,10 +134,11 @@ void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, * @param dst_stream the stream index within dst to write the packet to * @param pkt the packet to be written * @param src the muxer the packet originally was intended for + * @param interleave 0->use av_write_frame, 1->av_write_interleaved_frame * @return the value av_write_frame returned */ int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, - AVFormatContext *src); + AVFormatContext *src, int interleave); /** * Get the length in bytes which is needed to store val as v. diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 9d6a66e8ce111a29f5c0abdf3f2865c37ccc463e..2602254be9a75c515b366e8fef8b0fe69926422d 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -422,7 +422,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt, sample_queue_push(&trk->sample_queue, pkt->data, pkt->size, sample); /* Feed the packet to the RTP muxer */ - ff_write_chained(rtp_ctx, 0, pkt, s); + ff_write_chained(rtp_ctx, 0, pkt, s, 0); /* Fetch the output from the RTP muxer, open a new output buffer * for next time. */ diff --git a/libavformat/mux.c b/libavformat/mux.c index 3abeccfaa0083b855eba737defb23b53b5e7fc43..bd9f7e5dccac890966934adf8ce0415c0b0cffdf 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -960,7 +960,7 @@ int av_get_output_timestamp(struct AVFormatContext *s, int stream, } int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, - AVFormatContext *src) + AVFormatContext *src, int interleave) { AVPacket local_pkt; int ret; @@ -980,7 +980,8 @@ int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, src->streams[pkt->stream_index]->time_base, dst->streams[dst_stream]->time_base); - ret = av_write_frame(dst, &local_pkt); + if (interleave) ret = av_interleaved_write_frame(dst, &local_pkt); + else ret = av_write_frame(dst, &local_pkt); pkt->buf = local_pkt.buf; pkt->destruct = local_pkt.destruct; return ret; diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index cc6e729e8cda4f5d70eb719747e537a1141ff21a..af6f7996dce0a0f5aafafef31de4fbfb3c803fcf 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -212,7 +212,7 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) rtsp_st = rt->rtsp_streams[pkt->stream_index]; rtpctx = rtsp_st->transport_priv; - ret = ff_write_chained(rtpctx, 0, pkt, s); + ret = ff_write_chained(rtpctx, 0, pkt, s, 0); /* ff_write_chained does all the RTP packetization. If using TCP as * transport, rtpctx->pb is only a dyn_packet_buf that queues up the * packets, so we need to send them out on the TCP connection separately. diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index c725ce354479c9e456090df1eb81feaa6bc4e6fb..f90955790d448687f6d0f887e8a9d7404b2ce874 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -256,7 +256,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt) sap->last_time = now; } rtpctx = s->streams[pkt->stream_index]->priv_data; - return ff_write_chained(rtpctx, 0, pkt, s); + return ff_write_chained(rtpctx, 0, pkt, s, 0); } AVOutputFormat ff_sap_muxer = { diff --git a/libavformat/segment.c b/libavformat/segment.c index 135def226b0ef9493da5883493d2d9ee7645797d..cae0f114a55bb03f986f3a6b22250db56b65af8e 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -766,7 +766,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); - ret = ff_write_chained(seg->avf, pkt->stream_index, pkt, s); + ret = ff_write_chained(seg->avf, pkt->stream_index, pkt, s, 0); fail: if (pkt->stream_index == seg->reference_stream_index) { diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 5a77ec3f74b96e10b3bd1cb37f62f93480132b46..94910054226681a4aade434394ac18fa70b65783 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -593,7 +593,7 @@ static int ism_write_packet(AVFormatContext *s, AVPacket *pkt) } os->packets_written++; - return ff_write_chained(os->ctx, 0, pkt, s); + return ff_write_chained(os->ctx, 0, pkt, s, 0); } static int ism_write_trailer(AVFormatContext *s)