aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-19 03:02:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-19 16:33:49 +0100
commitc3a6d179fbfa30150dda0c30c3f70e289420bfa4 (patch)
tree52ffaa4faa1efc686f26f445a9c9b6f1367c0de3 /libavformat
parent5440d4b68b6af942ea460f0eb391b7f2442b5f50 (diff)
downloadffmpeg-c3a6d179fbfa30150dda0c30c3f70e289420bfa4.tar.gz
avformat/avienc: factor write_odml_master() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avienc.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 3b5e5c4413..9dd13ff57d 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -156,6 +156,34 @@ static int avi_write_counters(AVFormatContext *s, int riff_id)
return 0;
}
+static void write_odml_master(AVFormatContext *s, int stream_index)
+{
+ AVIOContext *pb = s->pb;
+ AVStream *st = s->streams[stream_index];
+ AVCodecContext *enc = st->codec;
+ 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
+ * like to get away without making AVI an OpenDML one
+ * for compatibility reasons. */
+ avist->indexes.entry = avist->indexes.ents_allocated = 0;
+ avist->indexes.indx_start = ff_start_tag(pb, "JUNK");
+ avio_wl16(pb, 4); /* wLongsPerEntry */
+ avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */
+ avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
+ avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */
+ ffio_wfourcc(pb, avi_stream2fourcc(tag, stream_index, enc->codec_type));
+ /* dwChunkId */
+ avio_wl64(pb, 0); /* dwReserved[3] */
+ // avio_wl32(pb, 0); /* Must be 0. */
+ for (j = 0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
+ avio_wl64(pb, 0);
+ ff_end_tag(pb, avist->indexes.indx_start);
+}
+
static int avi_write_header(AVFormatContext *s)
{
AVIContext *avi = s->priv_data;
@@ -365,26 +393,7 @@ static int avi_write_header(AVFormatContext *s)
}
if (pb->seekable) {
- 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
- * like to get away without making AVI an OpenDML one
- * for compatibility reasons. */
- avist->indexes.entry = avist->indexes.ents_allocated = 0;
- avist->indexes.indx_start = ff_start_tag(pb, "JUNK");
- avio_wl16(pb, 4); /* wLongsPerEntry */
- avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */
- avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
- avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */
- ffio_wfourcc(pb, avi_stream2fourcc(tag, i, enc->codec_type));
- /* dwChunkId */
- avio_wl64(pb, 0); /* dwReserved[3] */
- // avio_wl32(pb, 0); /* Must be 0. */
- for (j = 0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
- avio_wl64(pb, 0);
- ff_end_tag(pb, avist->indexes.indx_start);
+ write_odml_master(s, i);
}
if (enc->codec_type == AVMEDIA_TYPE_VIDEO &&