aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <jruggle@earthlink.net>2006-05-12 15:13:51 +0000
committerBenjamin Larsson <banan@ludd.ltu.se>2006-05-12 15:13:51 +0000
commitce1d2a95c3d73663aecc6e5f51533d2bcf1fb1ae (patch)
treedba09a815c94f18f1e59dd678466589b3925fdcb
parent3644cb8ff9e8603859e74ebf2d0ed6eff5bef551 (diff)
downloadffmpeg-ce1d2a95c3d73663aecc6e5f51533d2bcf1fb1ae.tar.gz
Raw flac muxer, patch by Justin Ruggles (jruggle earthlink net). Can be
used with "-acodec copy" to either copy a flac file verbatim or extract the raw flac from an ogg-flac file. Originally committed as revision 5368 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/raw.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c
index 057e060341..aaca88103d 100644
--- a/libavformat/raw.c
+++ b/libavformat/raw.c
@@ -26,6 +26,20 @@ static int raw_write_header(struct AVFormatContext *s)
return 0;
}
+static int flac_write_header(struct AVFormatContext *s)
+{
+ static const uint8_t header[8] = {
+ 0x66, 0x4C, 0x61, 0x43, 0x80, 0x00, 0x00, 0x22
+ };
+ uint8_t *streaminfo = s->streams[0]->codec->extradata;
+ int len = s->streams[0]->codec->extradata_size;
+ if(streaminfo != NULL && len > 0) {
+ put_buffer(&s->pb, header, 8);
+ put_buffer(&s->pb, streaminfo, len);
+ }
+ return 0;
+}
+
static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
put_buffer(&s->pb, pkt->data, pkt->size);
@@ -397,6 +411,21 @@ AVInputFormat flac_iformat = {
.extensions = "flac",
};
+#ifdef CONFIG_MUXERS
+AVOutputFormat flac_oformat = {
+ "flac",
+ "raw flac",
+ "audio/x-flac",
+ "flac",
+ 0,
+ CODEC_ID_FLAC,
+ 0,
+ flac_write_header,
+ raw_write_packet,
+ raw_write_trailer,
+};
+#endif //CONFIG_MUXERS
+
AVInputFormat ac3_iformat = {
"ac3",
"raw ac3",
@@ -792,6 +821,7 @@ int raw_init(void)
av_register_input_format(&shorten_iformat);
av_register_input_format(&flac_iformat);
+ av_register_output_format(&flac_oformat);
av_register_input_format(&ac3_iformat);
av_register_output_format(&ac3_oformat);