summaryrefslogtreecommitdiff
path: root/libavformat/avienc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-23 01:10:51 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-27 07:08:59 +0200
commit5eafbf0b087034771c680f15c6f43608dab5422e (patch)
treecd5761a95094e2ddba3ba7baf6946682c61459a3 /libavformat/avienc.c
parentc8e75076f1d5a53a58da9d14574721f9404c99d4 (diff)
downloadffmpeg-5eafbf0b087034771c680f15c6f43608dab5422e.tar.gz
avformat/avienc: Simplify writing padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r--libavformat/avienc.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9eb072ce12..3b11841cd3 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -237,7 +237,6 @@ static void write_odml_master(AVFormatContext *s, int stream_index)
AVCodecParameters *par = st->codecpar;
AVIStream *avist = st->priv_data;
unsigned char tag[5];
- int j;
/* Starting to lay out AVI OpenDML master index.
* We want to make it JUNK entry for now, since we'd
@@ -250,10 +249,8 @@ static void write_odml_master(AVFormatContext *s, int stream_index)
avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */
ffio_wfourcc(pb, avi_stream2fourcc(tag, stream_index, par->codec_type));
/* dwChunkId */
- avio_wl64(pb, 0); /* dwReserved[3] */
- avio_wl32(pb, 0); /* Must be 0. */
- for (j = 0; j < avi->master_index_max_size * 2; j++)
- avio_wl64(pb, 0);
+ ffio_fill(pb, 0, 3 * 4 /* dwReserved[3] */
+ + 16LL * avi->master_index_max_size);
ff_end_tag(pb, avist->indexes.indx_start);
}
@@ -351,10 +348,7 @@ static int avi_write_header(AVFormatContext *s)
avio_wl32(pb, 0);
avio_wl32(pb, 0);
}
- avio_wl32(pb, 0); /* reserved */
- avio_wl32(pb, 0); /* reserved */
- avio_wl32(pb, 0); /* reserved */
- avio_wl32(pb, 0); /* reserved */
+ ffio_fill(pb, 0, 4 * 4); /* reserved */
/* stream list */
for (i = 0; i < n; i++) {
@@ -569,8 +563,7 @@ static int avi_write_header(AVFormatContext *s)
ffio_wfourcc(pb, "odml");
ffio_wfourcc(pb, "dmlh");
avio_wl32(pb, 248);
- for (i = 0; i < 248; i += 4)
- avio_wl32(pb, 0);
+ ffio_fill(pb, 0, 248);
ff_end_tag(pb, avi->odml_list);
}
@@ -586,8 +579,7 @@ static int avi_write_header(AVFormatContext *s)
/* some padding for easier tag editing */
if (padding) {
list2 = ff_start_tag(pb, "JUNK");
- for (i = padding; i > 0; i -= 4)
- avio_wl32(pb, 0);
+ ffio_fill(pb, 0, FFALIGN((uint32_t)padding, 4));
ff_end_tag(pb, list2);
}