]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/oggparseflac.c
configure: set HOSTCC to native compiler
[ffmpeg] / libavformat / oggparseflac.c
index 8960088d876562d844291519723d099c9fc11525..b1332c618ba86a4a57cedb06a14310e49228b6a5 100644 (file)
  */
 
 #include <stdlib.h>
+#include "libavcodec/bitstream.h"
 #include "avformat.h"
-#include "bitstream.h"
-#include "ogg2.h"
+#include "oggdec.h"
 
 #define FLAC_STREAMINFO_SIZE 0x22
 
 static int
 flac_header (AVFormatContext * s, int idx)
 {
-    ogg_t *ogg = s->priv_data;
-    ogg_stream_t *os = ogg->streams + idx;
+    struct ogg *ogg = s->priv_data;
+    struct ogg_stream *os = ogg->streams + idx;
     AVStream *st = s->streams[idx];
     GetBitContext gb;
     int mdt;
@@ -49,7 +49,7 @@ flac_header (AVFormatContext * s, int idx)
         skip_bits(&gb, 4*8); /* "fLaC" */
 
         /* METADATA_BLOCK_HEADER */
-        if (get_bits(&gb, 32) != FLAC_STREAMINFO_SIZE)
+        if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE)
             return -1;
 
         skip_bits(&gb, 16*2+24*2);
@@ -75,8 +75,24 @@ flac_header (AVFormatContext * s, int idx)
     return 1;
 }
 
-ogg_codec_t flac_codec = {
+static int
+old_flac_header (AVFormatContext * s, int idx)
+{
+    AVStream *st = s->streams[idx];
+    st->codec->codec_type = CODEC_TYPE_AUDIO;
+    st->codec->codec_id = CODEC_ID_FLAC;
+
+    return 0;
+}
+
+const struct ogg_codec ff_flac_codec = {
     .magic = "\177FLAC",
     .magicsize = 5,
     .header = flac_header
 };
+
+const struct ogg_codec ff_old_flac_codec = {
+    .magic = "fLaC",
+    .magicsize = 4,
+    .header = old_flac_header
+};