changeset 1070:26d75e74c7b7 libavformat

Add support for raw flac decoding based on the .flac suffix of input files.
author banan
date Tue, 09 May 2006 12:34:35 +0000
parents 21c0614314aa
children 3f594a0fc976
files raw.c
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Sat May 06 10:57:38 2006 +0000
+++ b/raw.c	Tue May 09 12:34:35 2006 +0000
@@ -236,6 +236,22 @@
     return 0;
 }
 
+/* flac read */
+static int flac_read_header(AVFormatContext *s,
+                            AVFormatParameters *ap)
+{
+    AVStream *st;
+
+    st = av_new_stream(s, 0);
+    if (!st)
+        return AVERROR_NOMEM;
+    st->codec->codec_type = CODEC_TYPE_AUDIO;
+    st->codec->codec_id = CODEC_ID_FLAC;
+    st->need_parsing = 1;
+    /* the parameters will be extracted from the compressed bitstream */
+    return 0;
+}
+
 /* dts read */
 static int dts_read_header(AVFormatContext *s,
                            AVFormatParameters *ap)
@@ -370,6 +386,17 @@
     .extensions = "shn",
 };
 
+AVInputFormat flac_iformat = {
+    "flac",
+    "raw flac",
+    0,
+    NULL,
+    flac_read_header,
+    raw_read_partial_packet,
+    raw_read_close,
+    .extensions = "flac",
+};
+
 AVInputFormat ac3_iformat = {
     "ac3",
     "raw ac3",
@@ -764,6 +791,7 @@
 {
 
     av_register_input_format(&shorten_iformat);
+    av_register_input_format(&flac_iformat);
 
     av_register_input_format(&ac3_iformat);
     av_register_output_format(&ac3_oformat);