[Ffmpeg-cvslog] CVS: ffmpeg/libavformat raw.c,1.70,1.71

Benjamin Larsson CVS banan
Fri May 12 17:13:54 CEST 2006


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv26245/libavformat

Modified Files:
	raw.c 
Log Message:
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.


Index: raw.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/raw.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- raw.c	9 May 2006 12:34:35 -0000	1.70
+++ raw.c	12 May 2006 15:13:51 -0000	1.71
@@ -26,6 +26,20 @@
     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 @@
     .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 @@
 
     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);





More information about the ffmpeg-cvslog mailing list