aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-09-14 20:00:36 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-09-14 20:00:36 +0000
commite1a12934c5fd97e1e41887aa907ed61dd3d18620 (patch)
tree3753487564d7eca83e766dcd8e04231967e9f46e /libavformat
parent8588e1484eff061b1e2dba12ebc2377d48d966ee (diff)
downloadffmpeg-e1a12934c5fd97e1e41887aa907ed61dd3d18620.tar.gz
write number of samples in FLAC extradata.
based on a patch by Mathieu Velten (matmaul gmail com). Originally committed as revision 15324 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/raw.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c
index 05c93ac338..65d13aa785 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -42,6 +42,23 @@ static int flac_write_header(struct AVFormatContext *s)
}
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 @@ AVOutputFormat flac_muxer = {
CODEC_ID_NONE,
flac_write_header,
raw_write_packet,
+ flac_write_trailer,
.flags= AVFMT_NOTIMESTAMPS,
};
#endif