diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2009-02-26 02:41:53 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2009-02-26 02:41:53 +0000 |
commit | 2578326f13e5ea7945e2da810238118832dfb7a1 (patch) | |
tree | 54cbf1ae0a957b6d63733cb2e49cc9ce74fb2a43 /libavformat/flacenc.c | |
parent | faec0eba8b9ea2f54bb63c46daf7bd11d74c61f2 (diff) | |
download | ffmpeg-2578326f13e5ea7945e2da810238118832dfb7a1.tar.gz |
Share the function to write a raw FLAC header and use it in the Matroska
muxer.
Originally committed as revision 17606 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/flacenc.c')
-rw-r--r-- | libavformat/flacenc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index b391f8891d..81844cc2d2 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -21,13 +21,13 @@ #include "libavcodec/flac.h" #include "avformat.h" +#include "flacenc.h" -static int flac_write_header(struct AVFormatContext *s) +int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec) { static const uint8_t header[8] = { 0x66, 0x4C, 0x61, 0x43, 0x80, 0x00, 0x00, 0x22 }; - AVCodecContext *codec = s->streams[0]->codec; uint8_t *streaminfo; enum FLACExtradataFormat format; @@ -36,15 +36,20 @@ static int flac_write_header(struct AVFormatContext *s) /* write "fLaC" stream marker and first metadata block header if needed */ if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) { - put_buffer(s->pb, header, 8); + put_buffer(pb, header, 8); } /* write STREAMINFO or full header */ - put_buffer(s->pb, codec->extradata, codec->extradata_size); + put_buffer(pb, codec->extradata, codec->extradata_size); return 0; } +static int flac_write_header(struct AVFormatContext *s) +{ + return ff_flac_write_header(s->pb, s->streams[0]->codec); +} + static int flac_write_trailer(struct AVFormatContext *s) { ByteIOContext *pb = s->pb; |