[FFmpeg-devel] [PATCH] lavf: remove some flushing in write_packet muxers callbacks.
Clément Bœsch
ubitux at gmail.com
Mon Mar 25 00:28:19 CET 2013
Since 4f112a8e3, this is not necessary anymore. Also, it allows to
actually disable the flushing.
---
Note that this is not done for all the muxers; typically, I don't know if some
muxers don't actually requires it (the mxf or mov muxers for instance may be
needing the flushing to re-read some information, or could cause trouble when
not enabled with network formats like rtp).
---
libavformat/adtsenc.c | 1 -
libavformat/amr.c | 1 -
libavformat/assenc.c | 3 ---
libavformat/avienc.c | 1 -
libavformat/bit.c | 1 -
libavformat/daud.c | 1 -
libavformat/dvenc.c | 1 -
libavformat/flacenc.c | 1 -
libavformat/flvenc.c | 1 -
libavformat/framecrcenc.c | 1 -
libavformat/gif.c | 1 -
libavformat/gxfenc.c | 2 --
libavformat/icoenc.c | 2 --
libavformat/ilbc.c | 1 -
libavformat/ivfenc.c | 1 -
libavformat/microdvdenc.c | 1 -
libavformat/mkvtimestamp_v2.c | 1 -
libavformat/mpjpeg.c | 1 -
libavformat/rawenc.c | 1 -
libavformat/rmenc.c | 2 --
libavformat/smjpegenc.c | 1 -
libavformat/spdifenc.c | 1 -
libavformat/srtenc.c | 1 -
libavformat/swfenc.c | 2 --
libavformat/vc1testenc.c | 1 -
libavformat/wtvenc.c | 1 -
libavformat/wvenc.c | 1 -
libavformat/yuv4mpeg.c | 1 -
28 files changed, 34 deletions(-)
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 14c72a8..60d7b07 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -158,7 +158,6 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
}
}
avio_write(pb, pkt->data, pkt->size);
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 07ab1ba..7201ac3 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -56,7 +56,6 @@ static int amr_write_header(AVFormatContext *s)
static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
{
avio_write(s->pb, pkt->data, pkt->size);
- avio_flush(s->pb);
return 0;
}
#endif /* CONFIG_AMR_MUXER */
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
index bda507d..e378dc0 100644
--- a/libavformat/assenc.c
+++ b/libavformat/assenc.c
@@ -58,9 +58,6 @@ static int write_header(AVFormatContext *s)
static int write_packet(AVFormatContext *s, AVPacket *pkt)
{
avio_write(s->pb, pkt->data, pkt->size);
-
- avio_flush(s->pb);
-
return 0;
}
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 15f0794..fd2c36b 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -587,7 +587,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
if (size & 1)
avio_w8(pb, 0);
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/bit.c b/libavformat/bit.c
index 9f6ea4a..9b2246c 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -139,7 +139,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
init_get_bits(&gb, pkt->data, 8*10);
for(i=0; i< 8 * 10; i++)
avio_wl16(pb, get_bits1(&gb) ? BIT_1 : BIT_0);
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/daud.c b/libavformat/daud.c
index fb62ab1..6983785 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -68,7 +68,6 @@ static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
avio_wb16(s->pb, pkt->size);
avio_wb16(s->pb, 0x8010); // unknown
avio_write(s->pb, pkt->data, pkt->size);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 0b3811e..e37bd23 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -390,7 +390,6 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
pkt->data, pkt->size, &frame);
if (fsize > 0) {
avio_write(s->pb, frame, fsize);
- avio_flush(s->pb);
}
return 0;
}
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b625278..8c1a1bb 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -122,7 +122,6 @@ static int flac_write_trailer(struct AVFormatContext *s)
static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
avio_write(s->pb, pkt->data, pkt->size);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 502da0f..f88c22f 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -566,7 +566,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pts + flv->delay + pkt->duration);
}
- avio_flush(pb);
av_free(data);
return pb->error;
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index 92f2e91..df0ae79 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -46,7 +46,6 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
}
av_strlcatf(buf, sizeof(buf), "\n");
avio_write(s->pb, buf, strlen(buf));
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 31b0101..dd60e9c 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -329,7 +329,6 @@ static int gif_write_video(AVFormatContext *s, AVCodecContext *enc,
gif_image_write_image(pb, 0, 0, enc->width, enc->height,
buf, enc->width * 3, AV_PIX_FMT_RGB24);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 28acb74..9322f7b 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -950,8 +950,6 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
gxf->packet_count = 0;
}
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/icoenc.c b/libavformat/icoenc.c
index 3e6a1ea..561c6ca 100644
--- a/libavformat/icoenc.c
+++ b/libavformat/icoenc.c
@@ -151,8 +151,6 @@ static int ico_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_w8(pb, 0x00); // Write bitmask (opaque)
}
- avio_flush(pb);
-
return 0;
}
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index 7a23b2f..3f154ce 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -56,7 +56,6 @@ static int ilbc_write_header(AVFormatContext *s)
static int ilbc_write_packet(AVFormatContext *s, AVPacket *pkt)
{
avio_write(s->pb, pkt->data, pkt->size);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index ddb205b..45bae22 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -53,7 +53,6 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_wl32(pb, pkt->size);
avio_wl64(pb, pkt->pts);
avio_write(pb, pkt->data, pkt->size);
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/microdvdenc.c b/libavformat/microdvdenc.c
index 30fd0ea..4d84384 100644
--- a/libavformat/microdvdenc.c
+++ b/libavformat/microdvdenc.c
@@ -52,7 +52,6 @@ static int microdvd_write_packet(AVFormatContext *avf, AVPacket *pkt)
avio_printf(avf->pb, "{%"PRId64"}", pkt->pts + pkt->duration);
avio_write(avf->pb, pkt->data, pkt->size);
avio_write(avf->pb, "\n", 1);
- avio_flush(avf->pb);
return 0;
}
diff --git a/libavformat/mkvtimestamp_v2.c b/libavformat/mkvtimestamp_v2.c
index 3ed195a..7ba6691 100644
--- a/libavformat/mkvtimestamp_v2.c
+++ b/libavformat/mkvtimestamp_v2.c
@@ -37,7 +37,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
av_log(s, AV_LOG_WARNING, "More than one stream unsupported\n");
snprintf(buf, sizeof(buf), "%" PRId64 "\n", pkt->dts);
avio_write(s->pb, buf, strlen(buf));
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
index 916938f..2586ea8 100644
--- a/libavformat/mpjpeg.c
+++ b/libavformat/mpjpeg.c
@@ -47,7 +47,6 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
snprintf(buf1, sizeof(buf1), "\r\n--%s\r\n", BOUNDARY_TAG);
avio_write(s->pb, buf1, strlen(buf1));
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index b804c24..7894c8e 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -26,7 +26,6 @@
int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
{
avio_write(s->pb, pkt->data, pkt->size);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index a96c429..17192ff 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -374,7 +374,6 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
} else {
avio_write(pb, buf, size);
}
- avio_flush(pb);
stream->nb_frames++;
av_free(buf1);
return 0;
@@ -419,7 +418,6 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int
avio_w8(pb, stream->nb_frames & 0xff);
avio_write(pb, buf, size);
- avio_flush(pb);
stream->nb_frames++;
return 0;
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 0a27687..430a497 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -109,7 +109,6 @@ static int smjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_wb32(pb, pkt->pts);
avio_wb32(pb, pkt->size);
avio_write(pb, pkt->data, pkt->size);
- avio_flush(pb);
smc->duration = FFMAX(smc->duration, pkt->pts + pkt->duration);
return 0;
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 778ab88..857c20d 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -538,7 +538,6 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n",
ctx->data_type, ctx->out_bytes, ctx->pkt_offset);
- avio_flush(s->pb);
return 0;
}
diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c
index e02c4ef..b43504b 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -98,7 +98,6 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
avio_write(avf->pb, pkt->data, pkt->size);
if (write_ts)
avio_write(avf->pb, "\n\n", 2);
- avio_flush(avf->pb);
srt->index++;
return 0;
}
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 5b7fd1f..7018362 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -441,8 +441,6 @@ static int swf_write_video(AVFormatContext *s,
put_swf_tag(s, TAG_SHOWFRAME);
put_swf_end_tag(s);
- avio_flush(s->pb);
-
return 0;
}
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
index 9debf19..751333a 100644
--- a/libavformat/vc1testenc.c
+++ b/libavformat/vc1testenc.c
@@ -63,7 +63,6 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_wl32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0));
avio_wl32(pb, pkt->pts);
avio_write(pb, pkt->data, pkt->size);
- avio_flush(pb);
ctx->frames++;
return 0;
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index 22917a4..410a2dc 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -457,7 +457,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
write_pad(pb, WTV_PAD8(pkt->size) - pkt->size);
wctx->serial++;
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/wvenc.c b/libavformat/wvenc.c
index 03d471e..c33d430 100644
--- a/libavformat/wvenc.c
+++ b/libavformat/wvenc.c
@@ -110,7 +110,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb, ptr, size - 24);
ptr += size - 24; left -= size - 24;
}
- avio_flush(pb);
return 0;
}
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index f34a4af..bf48230 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -232,7 +232,6 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
}
}
- avio_flush(pb);
return 0;
}
--
1.8.2
More information about the ffmpeg-devel
mailing list