[xiph-commits] r10749 - in trunk/xiph-qt: OggImport/OggImport.xcodeproj OggImport/src common

arek at svn.xiph.org arek at svn.xiph.org
Mon Jan 23 10:07:42 PST 2006


Author: arek
Date: 2006-01-23 10:07:28 -0800 (Mon, 23 Jan 2006)
New Revision: 10749

Added:
   trunk/xiph-qt/OggImport/src/stream_flac.c
   trunk/xiph-qt/OggImport/src/stream_flac.h
   trunk/xiph-qt/OggImport/src/stream_types_flac.h
Modified:
   trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj
   trunk/xiph-qt/OggImport/src/OggImport.c
   trunk/xiph-qt/OggImport/src/importer_types.h
   trunk/xiph-qt/common/fccs.h
Log:
Added initial code for Ogg/FLAC support in OggImporter.

Modified: trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj	2006-01-23 18:07:28 UTC (rev 10749)
@@ -18,6 +18,7 @@
 		73182D9B090AB7F800C25A13 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 73182D62090AAEA700C25A13 /* common.c */; };
 		73182D9F090AB83F00C25A13 /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73182D9E090AB83F00C25A13 /* Vorbis.framework */; };
 		73182E37090AD49700C25A13 /* stream_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = 73182E35090AD49700C25A13 /* stream_vorbis.c */; };
+		73A515E509844E1D0018101A /* stream_flac.c in Sources */ = {isa = PBXBuildFile; fileRef = 73A515E209844E1D0018101A /* stream_flac.c */; };
 		73DDD2B3093E665C001E170C /* config.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 73DDD2B2093E665C001E170C /* config.h */; };
 		73E8B16D090BE13600686EE5 /* stream_speex.c in Sources */ = {isa = PBXBuildFile; fileRef = 73E8B16A090BE13600686EE5 /* stream_speex.c */; };
 		8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
@@ -90,6 +91,9 @@
 		737C5A6D0912A05200700B79 /* fccs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = fccs.h; path = ../common/fccs.h; sourceTree = SOURCE_ROOT; };
 		738602C50915732900CB8105 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = ../resources/icon.icns; sourceTree = SOURCE_ROOT; };
 		738602C60915732900CB8105 /* icon.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = icon.r; path = ../resources/icon.r; sourceTree = SOURCE_ROOT; };
+		73A515E209844E1D0018101A /* stream_flac.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stream_flac.c; path = src/stream_flac.c; sourceTree = "<group>"; };
+		73A515E309844E1D0018101A /* stream_flac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stream_flac.h; path = src/stream_flac.h; sourceTree = "<group>"; };
+		73A515E409844E1D0018101A /* stream_types_flac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stream_types_flac.h; path = src/stream_types_flac.h; sourceTree = "<group>"; };
 		73DDD2B2093E665C001E170C /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../common/config.h; sourceTree = SOURCE_ROOT; };
 		73E8B10F090BCB6100686EE5 /* data_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = data_types.h; path = ../common/data_types.h; sourceTree = SOURCE_ROOT; };
 		73E8B16A090BE13600686EE5 /* stream_speex.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stream_speex.c; path = src/stream_speex.c; sourceTree = "<group>"; };
@@ -155,6 +159,7 @@
 		08FB77ADFE841716C02AAC07 /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				73A515E109844DF70018101A /* flac */,
 				73E8B169090BE11D00686EE5 /* speex */,
 				73E8B162090BDE5D00686EE5 /* vorbis */,
 				73DDD2B2093E665C001E170C /* config.h */,
@@ -184,6 +189,16 @@
 			name = Products;
 			sourceTree = "<group>";
 		};
+		73A515E109844DF70018101A /* flac */ = {
+			isa = PBXGroup;
+			children = (
+				73A515E209844E1D0018101A /* stream_flac.c */,
+				73A515E309844E1D0018101A /* stream_flac.h */,
+				73A515E409844E1D0018101A /* stream_types_flac.h */,
+			);
+			name = flac;
+			sourceTree = "<group>";
+		};
 		73E8B162090BDE5D00686EE5 /* vorbis */ = {
 			isa = PBXGroup;
 			children = (
@@ -309,6 +324,7 @@
 				73182D9B090AB7F800C25A13 /* common.c in Sources */,
 				73182E37090AD49700C25A13 /* stream_vorbis.c in Sources */,
 				73E8B16D090BE13600686EE5 /* stream_speex.c in Sources */,
+				73A515E509844E1D0018101A /* stream_flac.c in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/xiph-qt/OggImport/src/OggImport.c
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImport.c	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/OggImport/src/OggImport.c	2006-01-23 18:07:28 UTC (rev 10749)
@@ -4,7 +4,7 @@
  *    The main part of the OggImport component.
  *
  *
- *  Copyright (c) 2005  Arek Korbik
+ *  Copyright (c) 2005-2006  Arek Korbik
  *
  *  This file is part of XiphQT, the Xiph QuickTime Components.
  *
@@ -64,11 +64,15 @@
 //stream-type support functions
 #include "stream_vorbis.h"
 #include "stream_speex.h"
+#include "stream_flac.h"
 
 static stream_format_handle_funcs s_formats[] = {
 #if defined(_HAVE__VORBIS_SUPPORT)
     HANDLE_FUNCTIONS__VORBIS,
 #endif
+#if defined(_HAVE__FLAC_SUPPORT)
+    HANDLE_FUNCTIONS__FLAC,
+#endif
 #if defined(_HAVE__SPEEX_SUPPORT)
     HANDLE_FUNCTIONS__SPEEX,
 #endif

Modified: trunk/xiph-qt/OggImport/src/importer_types.h
===================================================================
--- trunk/xiph-qt/OggImport/src/importer_types.h	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/OggImport/src/importer_types.h	2006-01-23 18:07:28 UTC (rev 10749)
@@ -4,7 +4,7 @@
  *    Definitions of OggImporter data structures.
  *
  *
- *  Copyright (c) 2005  Arek Korbik
+ *  Copyright (c) 2005-2006  Arek Korbik
  *
  *  This file is part of XiphQT, the Xiph QuickTime Components.
  *
@@ -66,6 +66,7 @@
 
 #include "stream_types_vorbis.h"
 #include "stream_types_speex.h"
+#include "stream_types_flac.h"
 
 #define INCOMPLETE_PAGE_DURATION 1
 
@@ -117,6 +118,9 @@
 #if defined(_HAVE__SPEEX_SUPPORT)
         StreamInfo__speex si_speex;
 #endif
+#if defined(_HAVE__FLAC_SUPPORT)
+        StreamInfo__flac si_flac;
+#endif
     };
 
 } StreamInfo, *StreamInfoPtr;

Added: trunk/xiph-qt/OggImport/src/stream_flac.c
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_flac.c	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/OggImport/src/stream_flac.c	2006-01-23 18:07:28 UTC (rev 10749)
@@ -0,0 +1,327 @@
+/*
+ *  stream_flac.c
+ *
+ *    FLAC format related part of OggImporter.
+ *
+ *
+ *  Copyright (c) 2006  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include <Ogg/ogg.h>
+
+#include "stream_flac.h"
+
+#include "debug.h"
+#define logg_page_last_packet_incomplete(op) (((unsigned char *)(op)->header)[26 + ((unsigned char *)(op)->header)[26]] == 255)
+
+#include "OggImport.h"
+
+#include "fccs.h"
+#include "data_types.h"
+
+
+int recognize_header__flac(ogg_page *op)
+{
+    char fh[] = {0x7f, 'F', 'L', 'A', 'C', '\0'};
+    dbg_printf("! -- - flac_recognise_header: '%4.4s'\n", ((char *)op->body) + 1);
+    if (!strncmp(fh, (char *)op->body, 5))
+        return 0;
+
+    return 1;
+};
+
+int verify_header__flac(ogg_page *op) //?
+{
+    // TODO: check mapping version, etc.?
+    return 0;
+};
+
+int initialize_stream__flac(StreamInfo *si)
+{
+    vorbis_comment_init(&si->si_flac.vc);
+
+    si->si_flac.metablocks = 0;
+    si->si_flac.skipped = 0;
+    si->si_flac.state = kFStateInitial;
+
+    return 0;
+};
+
+void clear_stream__flac(StreamInfo *si)
+{
+    vorbis_comment_clear(&si->si_flac.vc);
+};
+
+ComponentResult create_sample_description__flac(StreamInfo *si)
+{
+    ComponentResult err = noErr;
+    Handle desc;
+    AudioStreamBasicDescription asbd;
+    AudioChannelLayout acl;
+    AudioChannelLayout *pacl = &acl;
+    ByteCount acl_size = sizeof(acl);
+
+    asbd.mSampleRate = si->rate;
+    asbd.mFormatID = kAudioFormatXiphOggFramedFLAC;
+    asbd.mFormatFlags = 0;
+    asbd.mBytesPerPacket = 0;
+    asbd.mFramesPerPacket = 0;
+    //asbd.mBytesPerFrame = 2 * si->numChannels;
+    asbd.mBytesPerFrame = 0;
+    asbd.mChannelsPerFrame = si->numChannels;
+    //asbd.mBitsPerChannel = 16;
+    asbd.mBitsPerChannel = 0;
+    asbd.mReserved = 0;
+
+    if (si->numChannels == 1)
+        acl.mChannelLayoutTag = kAudioChannelLayoutTag_Mono;
+    else if (si->numChannels == 2)
+        acl.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo;
+    else {
+        pacl = NULL;
+        acl_size = 0;
+    }
+    acl.mChannelBitmap = 0;
+    acl.mNumberChannelDescriptions = 0;
+
+    err = QTSoundDescriptionCreate(&asbd, pacl, acl_size, NULL, 0, kQTSoundDescriptionKind_Movie_Version2, (SoundDescriptionHandle*) &desc);
+
+    if (err == noErr) {
+        si->sampleDesc = (SampleDescriptionHandle) desc;
+    }
+
+    return err;
+};
+
+int process_first_packet__flac(StreamInfo *si, ogg_page *op, ogg_packet *opckt)
+{
+    unsigned long serialnoatom[3] = { EndianU32_NtoB(sizeof(serialnoatom)), EndianU32_NtoB(kCookieTypeOggSerialNo),
+                                      EndianS32_NtoB(ogg_page_serialno(op)) };
+    //unsigned long atomhead[2] = { EndianU32_NtoB(opckt->bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeSpeexHeader) };
+
+    //vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, opckt); //check errors?
+
+    si->si_flac.metablocks =  (SInt32) EndianU16_BtoN(* (UInt16 *) (((char *)opckt->packet) + 7));
+    UInt32 sib = EndianU32_BtoN(* (UInt32 *) (((char *)opckt->packet) + 27));
+
+    sib >>= 4;
+    si->si_flac.bps = (sib & 0x1f) + 1;
+    sib >>= 5;
+    si->numChannels = (sib & 0x07) + 1;
+    si->rate = (sib >> 3) & 0xfffff;
+
+    dbg_printf("! -- - flac_first_packet: ch: %d, rate: %ld\n", si->numChannels, si->rate);
+
+    PtrAndHand(serialnoatom, si->soundDescExtension, sizeof(serialnoatom)); //check errors?
+    //PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead)); //check errors?
+    //PtrAndHand(opckt->packet, si->soundDescExtension, opckt->bytes); //check errors?
+
+    si->si_flac.state = kFStateReadingComments;
+
+    return 0;
+};
+
+ComponentResult process_stream_page__flac(OggImportGlobals *globals, StreamInfo *si, ogg_page *opg)
+{
+    ComponentResult ret = noErr;
+    int ovret = 0;
+    Boolean loop = true;
+    Boolean movie_changed = false;
+
+    ogg_packet op;
+
+    switch(si->si_flac.state) {
+    case kFStateReadingComments:
+    case kFStateReadingAdditionalMDBlocks:
+        ogg_stream_pagein(&si->os, opg);
+        break;
+    default:
+        break;
+    }
+
+    do {
+        switch(si->si_flac.state) {
+        case kFStateReadingComments:
+            ovret = ogg_stream_packetout(&si->os, &op);
+            if (ovret < 0) {
+                loop = false;
+                ret = invalidMedia;
+            } else if (ovret < 1) {
+                loop = false;
+            } else {
+                //unsigned long atomhead[2] = { EndianU32_NtoB(op.bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeSpeexComments) };
+
+                //PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead));
+                //PtrAndHand(op.packet, si->soundDescExtension, op.bytes);
+                //vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, &op);
+
+                ret = CreateTrackAndMedia(globals, si, opg);
+                if (ret != noErr) {
+                    dbg_printf("??? -- CreateTrackAndMedia failed?: %ld\n", (long)ret);
+                }
+
+                // /*err =*/ DecodeCommentsQT(globals, si, &si->si_vorbis.vc);
+                //NotifyMovieChanged(globals);
+
+                si->si_flac.skipped += 1;
+                si->si_flac.state = kFStateReadingAdditionalMDBlocks;
+            }
+
+            break;
+
+        case kFStateReadingAdditionalMDBlocks:
+            dbg_printf("! -- - flac_stream_page - mb: %ld, skipped: %ld\n", si->si_flac.metablocks, si->si_flac.skipped);
+            if (si->si_flac.skipped >= si->si_flac.metablocks) {
+                unsigned long endAtom[2] = { EndianU32_NtoB(sizeof(endAtom)), EndianU32_NtoB(kAudioTerminatorAtomType) };
+
+                ret = PtrAndHand(endAtom, si->soundDescExtension, sizeof(endAtom));
+                if (ret == noErr) {
+                    ret = AddSoundDescriptionExtension((SoundDescriptionHandle) si->sampleDesc,
+                                                       si->soundDescExtension, siDecompressionParams);
+                    //dbg_printf("??? -- Adding extension: %ld\n", ret);
+                } else {
+                    //dbg_printf("??? -- Hmm, something went wrong: %ld\n", ret);
+                }
+
+                si->insertTime = 0;
+                si->streamOffset = globals->currentGroupOffset;
+                si->incompleteCompensation = 0;
+                si->si_flac.state = kFStateReadingFirstPacket;
+
+                loop = false; // ??!
+                break;
+            }
+
+            ovret = ogg_stream_packetout(&si->os, &op);
+            dbg_printf("! -- - flac_stream_page - ovret: %d\n", ovret);
+            if (ovret < 0) {
+                loop = false;
+                ret = invalidMedia;
+            } else if (ovret < 1) {
+                loop = false;
+            } else {
+                // not much here so far, basically just skip the extra header packet
+                //unsigned long atomhead[2] = { EndianU32_NtoB(op.bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeSpeexExtraHeader) };
+                //PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead));
+                //PtrAndHand(op.packet, si->soundDescExtension, op.bytes);
+
+                si->si_flac.skipped += 1;
+            }
+
+            break;
+
+        case kFStateReadingFirstPacket:
+            if (ogg_page_pageno(opg) > 2 && false) {
+                si->lastGranulePos = ogg_page_granulepos(opg);
+                dbg_printf("----==< skipping: %llx, %lx\n", si->lastGranulePos, ogg_page_pageno(opg));
+                loop = false;
+
+                if (si->lastGranulePos < 0)
+                    si->lastGranulePos = 0;
+            }
+            si->si_flac.state = kFStateReadingPackets;
+            break;
+
+        case kFStateReadingPackets:
+            {
+                ogg_int64_t pos       = ogg_page_granulepos(opg);
+                int         len       = opg->header_len + opg->body_len;
+                TimeValue   duration  = pos - si->lastGranulePos;
+                TimeValue   inserted  = 0;
+                short       smp_flags = 0;
+
+                if (ogg_page_continued(opg) || si->incompleteCompensation != 0)
+                    smp_flags |= mediaSampleNotSync;
+
+                if (duration <= 0) {
+                    duration = INCOMPLETE_PAGE_DURATION;
+                    si->incompleteCompensation -= INCOMPLETE_PAGE_DURATION;
+                } else if (si->incompleteCompensation != 0) {
+                    duration += si->incompleteCompensation;
+                    si->incompleteCompensation = 0;
+                    if (duration <= 0) {
+                        ret = badFileFormat;
+                        loop = false;
+                        break;
+                    }
+                }
+
+                dbg_printf("   -   :++: adding sampleRef: %lld, len: %d, dur: %d\n", globals->dataOffset, len, duration);
+                ret = AddMediaSampleReference(si->theMedia, S32Set(globals->dataOffset),
+                                              len, duration, si->sampleDesc, 1, smp_flags, &inserted); //@@@@ 64-bit enable
+                if (ret == noErr) {
+                    TimeValue timeLoaded;
+
+                    dbg_printf("   -   :><: added page %04ld at %14ld (size: %5ld, tsize: %6d), f: %d\n",
+                               ogg_page_pageno(opg), inserted,
+                               opg->header_len + opg->body_len, len, !logg_page_last_packet_incomplete(opg));
+                    dbg_printf("   -   :/>: inserting media: %ld, mt: %lld, dur: %d\n", si->insertTime, si->lastGranulePos, duration);
+                    ret = InsertMediaIntoTrack(si->theTrack, si->insertTime /*inserted*/, /* si->lastGranulePos */ inserted,
+                                               duration, fixed1);
+                    if (si->insertTime == 0) {
+                        if (si->streamOffset != 0) {
+                            SetTrackOffset(si->theTrack, si->streamOffset);
+                            dbg_printf("   # -- SetTrackOffset(%ld) = %ld --> %ld\n",
+                                       si->streamOffset, GetMoviesError(),
+                                       GetTrackOffset(si->theTrack));
+                            if (globals->dataIsStream) {
+                                SetTrackEnabled(si->theTrack, false);
+                                SetTrackEnabled(si->theTrack, true);
+                            }
+                        }
+                        if (GetMovieTimeScale(globals->theMovie) < GetMediaTimeScale(si->theMedia)) {
+                            dbg_printf("   # - changing movie time scale: %ld --> %ld\n",
+                                       GetMovieTimeScale(globals->theMovie), GetMediaTimeScale(si->theMedia));
+                            SetMovieTimeScale(globals->theMovie, GetMediaTimeScale(si->theMedia));
+                        }
+                    }
+                    si->insertTime = -1;
+                    timeLoaded = GetTrackOffset(si->theTrack) + GetTrackDuration(si->theTrack);
+
+                    dbg_printf("   -   :><: added page %04ld at %14ld; offset: %ld, duration: %ld (%ld, %ld), mediats: %ld; moviets: %ld, ret = %ld\n",
+                               ogg_page_pageno(opg), inserted,
+                               GetTrackOffset(si->theTrack), GetTrackDuration(si->theTrack), timeLoaded,
+                               (duration * GetMovieTimeScale(globals->theMovie)) / GetMediaTimeScale(si->theMedia),
+                               GetMediaTimeScale(si->theMedia), GetMovieTimeScale(globals->theMovie), ret);
+                    if (globals->timeLoaded < timeLoaded)
+                        globals->timeLoaded = timeLoaded;
+
+                    movie_changed = true;
+                }
+
+                si->lastGranulePos = pos;
+            }
+            loop = false;
+            break;
+
+        default:
+            loop = false;
+        }
+    } while(loop);
+
+    if (movie_changed)
+        NotifyMovieChanged(globals);
+
+    return ret;
+};


Property changes on: trunk/xiph-qt/OggImport/src/stream_flac.c
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_flac.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_flac.h	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/OggImport/src/stream_flac.h	2006-01-23 18:07:28 UTC (rev 10749)
@@ -0,0 +1,53 @@
+/*
+ *  stream_flac.h
+ *
+ *    Declaration of FLAC format related functions of OggImporter.
+ *
+ *
+ *  Copyright (c) 2006  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__stream_flac_h__)
+#define __stream_flac_h__
+
+// TODO: #include <FLAC/all.h>
+
+#include "importer_types.h"
+
+extern int recognize_header__flac(ogg_page *op);
+extern int verify_header__flac(ogg_page *op);
+
+extern int initialize_stream__flac(StreamInfo *si);
+extern void clear_stream__flac(StreamInfo *si);
+extern ComponentResult create_sample_description__flac(StreamInfo *si);
+
+extern int process_first_packet__flac(StreamInfo *si, ogg_page *op, ogg_packet *opckt);
+extern ComponentResult process_stream_page__flac(OggImportGlobals *globals, StreamInfo *si, ogg_page *opg);
+
+#define HANDLE_FUNCTIONS__FLAC { &process_stream_page__flac, &recognize_header__flac, \
+            &verify_header__flac, &process_first_packet__flac, &create_sample_description__flac, \
+            &initialize_stream__flac, &clear_stream__flac }
+
+
+#endif /* __stream_flac_h__ */


Property changes on: trunk/xiph-qt/OggImport/src/stream_flac.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_types_flac.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_types_flac.h	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/OggImport/src/stream_types_flac.h	2006-01-23 18:07:28 UTC (rev 10749)
@@ -0,0 +1,59 @@
+/*
+ *  stream_types_flac.h
+ *
+ *    Definition of FLAC specific data structures.
+ *
+ *
+ *  Copyright (c) 2006  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__stream_types_flac_h__)
+#define __stream_types_flac_h__
+
+
+#include <Speex/speex.h>
+#include <Speex/speex_header.h>
+
+typedef enum FLACImportStates {
+    kFStateInitial,
+    kFStateReadingComments,
+    kFStateReadingAdditionalMDBlocks,
+    kFStateReadingFirstPacket,
+    kFStateReadingPackets
+} FLACImportStates;
+
+typedef struct {
+    FLACImportStates state;
+
+    // TODO: add needed variables
+    vorbis_comment vc;
+    SInt32 metablocks;
+    SInt32 skipped;
+    UInt32 bps;
+} StreamInfo__flac;
+
+
+#define _HAVE__FLAC_SUPPORT 1
+
+#endif /* __stream_types_flac_h__ */


Property changes on: trunk/xiph-qt/OggImport/src/stream_types_flac.h
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/xiph-qt/common/fccs.h
===================================================================
--- trunk/xiph-qt/common/fccs.h	2006-01-23 18:00:56 UTC (rev 10748)
+++ trunk/xiph-qt/common/fccs.h	2006-01-23 18:07:28 UTC (rev 10749)
@@ -6,7 +6,7 @@
  *    exported in QT movie container.
  *
  *
- *  Copyright (c) 2005  Arek Korbik
+ *  Copyright (c) 2005-2006  Arek Korbik
  *
  *  This file is part of XiphQT, the Xiph QuickTime Components.
  *
@@ -40,7 +40,10 @@
     kAudioFormatXiphOggFramedVorbis         = 'XoVs',
 
     kAudioFormatXiphSpeex                   = 'XiSp',
-    kAudioFormatXiphOggFramedSpeex          = 'XoSp'
+    kAudioFormatXiphOggFramedSpeex          = 'XoSp',
+
+    kAudioFormatXiphFLAC                    = 'XiFL',
+    kAudioFormatXiphOggFramedFLAC           = 'XoFL',
 };
 
 



More information about the commits mailing list