Mercurial > libavformat.hg
changeset 3926:14020f10caf7 libavformat
write number of samples in FLAC extradata.
based on a patch by Mathieu Velten (matmaul gmail com).
author | jbr |
---|---|
date | Sun, 14 Sep 2008 20:00:36 +0000 |
parents | dfd3033e7de7 |
children | bb5d73587d16 |
files | raw.c |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/raw.c Sun Sep 14 17:29:34 2008 +0000 +++ b/raw.c Sun Sep 14 20:00:36 2008 +0000 @@ -42,6 +42,23 @@ } return 0; } + +static int flac_write_trailer(struct AVFormatContext *s) +{ + ByteIOContext *pb = s->pb; + uint8_t *streaminfo = s->streams[0]->codec->extradata; + int len = s->streams[0]->codec->extradata_size; + offset_t file_size; + + if (streaminfo && len > 0 && !url_is_streamed(s->pb)) { + file_size = url_ftell(pb); + url_fseek(pb, 8, SEEK_SET); + put_buffer(pb, streaminfo, len); + url_fseek(pb, file_size, SEEK_SET); + put_flush_packet(pb); + } + return 0; +} #endif #ifdef CONFIG_ROQ_MUXER @@ -705,6 +722,7 @@ CODEC_ID_NONE, flac_write_header, raw_write_packet, + flac_write_trailer, .flags= AVFMT_NOTIMESTAMPS, }; #endif