Mercurial > libavformat.hg
diff matroskaenc.c @ 4581:c52d40f0a955 libavformat
Share the function to write a raw FLAC header and use it in the Matroska
muxer.
author | jbr |
---|---|
date | Thu, 26 Feb 2009 02:41:53 +0000 |
parents | c05d167a4fe2 |
children | 33a244b7ca65 |
line wrap: on
line diff
--- a/matroskaenc.c Thu Feb 26 02:33:19 2009 +0000 +++ b/matroskaenc.c Thu Feb 26 02:41:53 2009 +0000 @@ -24,11 +24,11 @@ #include "isom.h" #include "matroska.h" #include "avc.h" +#include "flacenc.h" #include "libavutil/intreadwrite.h" #include "libavutil/md5.h" #include "libavcodec/xiph.h" #include "libavcodec/mpeg4audio.h" -#include "libavcodec/flac.h" typedef struct ebml_master { int64_t pos; ///< absolute offset in the file where the master's elements start @@ -421,25 +421,6 @@ return 0; } -static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec) -{ - uint8_t *streaminfo; - enum FLACExtradataFormat format; - - if (!ff_flac_is_extradata_valid(codec, &format, &streaminfo)) { - av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n"); - return -1; - } - if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) { - // only the streaminfo packet - put_buffer(pb, "fLaC", 4); - put_byte(pb, 0x80); - put_be24(pb, FLAC_STREAMINFO_SIZE); - } - put_buffer(pb, codec->extradata, codec->extradata_size); - return 0; -} - static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate) { int sri; @@ -481,7 +462,7 @@ if (codec->codec_id == CODEC_ID_VORBIS || codec->codec_id == CODEC_ID_THEORA) ret = put_xiph_codecpriv(s, dyn_cp, codec); else if (codec->codec_id == CODEC_ID_FLAC) - ret = put_flac_codecpriv(s, dyn_cp, codec); + ret = ff_flac_write_header(dyn_cp, codec); else if (codec->codec_id == CODEC_ID_H264) ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size); else if (codec->extradata_size)