shithub: aacdec

Download patch

ref: 9e7e4c1abd383bd519551222d3e553c32729b035
parent: db2046678ef6046c6c0561ae6db0dfc999712f72
author: menno <menno>
date: Tue Nov 25 08:18:42 EST 2003

Linux compile fix

--- a/common/mp4ff/Makefile.am
+++ b/common/mp4ff/Makefile.am
@@ -4,7 +4,7 @@
 
 libmp4ff_la_SOURCES = mp4ff.c mp4atom.c mp4meta.c mp4sample.c mp4util.c mp4ff.h mp4ffint.h
 
-AM_CFLAGS = -O2 -g
+AM_CFLAGS = -O2 -g -DUSE_TAGGING=1
 LIBTOOL_DEPS =
 LIBS =
 
--- a/common/mp4ff/mp4atom.c
+++ b/common/mp4ff/mp4atom.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4atom.c,v 1.4 2003/11/22 15:30:19 menno Exp $
+** $Id: mp4atom.c,v 1.5 2003/11/25 13:16:09 menno Exp $
 **/
 
 #include <stdlib.h>
@@ -429,6 +429,7 @@
     return 0;
 }
 
+#ifdef USE_TAGGING
 static int32_t mp4ff_read_meta(mp4ff_t *f, const int32_t size)
 {
     int32_t subsize, sumsize = 0;
@@ -451,6 +452,7 @@
 
     return 0;
 }
+#endif
 
 int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type)
 {
@@ -473,9 +475,11 @@
     } else if (atom_type == ATOM_MVHD) {
         /* movie header box */
         mp4ff_read_mvhd(f);
+#ifdef USE_TAGGING
     } else if (atom_type == ATOM_META) {
         /* iTunes Metadata box */
         mp4ff_read_meta(f, size);
+#endif
     } else {
         /* skip this atom: not needed for reading */
         mp4ff_set_position(f, mp4ff_position(f)+size-8);
--- a/common/mp4ff/mp4ff.c
+++ b/common/mp4ff/mp4ff.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4ff.c,v 1.4 2003/11/22 15:30:19 menno Exp $
+** $Id: mp4ff.c,v 1.5 2003/11/25 13:16:09 menno Exp $
 **/
 
 #include <stdlib.h>
@@ -42,6 +42,44 @@
     return ff;
 }
 
+#ifdef USE_TAGGING
+mp4ff_t *mp4ff_open_edit(mp4ff_callback_t *f)
+{
+    mp4ff_t *ff = malloc(sizeof(mp4ff_t));
+
+    memset(ff, 0, sizeof(mp4ff_t));
+
+    ff->stream = f;
+
+    parse_atoms(ff);
+
+    /* copy moov atom to end of the file */
+    if (ff->last_atom != ATOM_MOOV)
+    {
+        char *free_data = "free";
+        char *moov_data;
+
+        moov_data = (unsigned char*)malloc(ff->moov_size);
+
+        /* read the moov atom */
+        mp4ff_set_position(ff, ff->moov_offset);
+        mp4ff_read_data(ff, moov_data, ff->moov_size);
+
+        /* rename old moov to free */
+        mp4ff_set_position(ff, ff->moov_offset + 4);
+        mp4ff_write_data(ff, free_data, 4);
+
+        /* write old moov at end of file */
+        mp4ff_set_position(ff, ff->file_size);
+        mp4ff_write_data(ff, moov_data, ff->moov_size);
+
+        free(moov_data);
+    }
+
+    return ff;
+}
+#endif
+
 void mp4ff_close(mp4ff_t *ff)
 {
     int32_t i;
@@ -70,7 +108,9 @@
         }
     }
 
+#ifdef USE_TAGGING
     mp4ff_tag_delete(&(ff->tags));
+#endif
 
     if (ff) free(ff);
 }
@@ -126,25 +166,24 @@
     int32_t size;
     uint8_t atom_type = 0;
 
+    f->file_size = 0;
+
     while ((size = mp4ff_atom_read_header(f, &atom_type)) != 0)
     {
+        f->file_size += size;
+        f->last_atom = atom_type;
+
         if (atom_type == ATOM_MDAT && f->moov_read)
         {
             /* moov atom is before mdat, we can stop reading when mdat is encountered */
             /* file position will stay at beginning of mdat data */
-            break;
+//            break;
         }
 
-        if (atom_type == ATOM_MDAT && size > 8)
-        {
-            f->mdat_read = 1;
-            f->mdat_offset = mp4ff_position(f);
-            f->mdat_size = size;
-        }
         if (atom_type == ATOM_MOOV && size > 8)
         {
             f->moov_read = 1;
-            f->moov_offset = mp4ff_position(f);
+            f->moov_offset = mp4ff_position(f)-8;
             f->moov_size = size;
         }
 
--- a/common/mp4ff/mp4ff.dsp
+++ b/common/mp4ff/mp4ff.dsp
@@ -40,10 +40,10 @@
 # PROP Output_Dir "Release"
 # PROP Intermediate_Dir "Release"
 # PROP Target_Dir ""
-MTL=midl.exe
 F90=df.exe
+MTL=midl.exe
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX- /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_TAGGING" /YX /FD /c
 # ADD BASE RSC /l 0x413 /d "NDEBUG"
 # ADD RSC /l 0x413 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -65,10 +65,10 @@
 # PROP Output_Dir "Debug"
 # PROP Intermediate_Dir "Debug"
 # PROP Target_Dir ""
-MTL=midl.exe
 F90=df.exe
+MTL=midl.exe
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX- /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_TAGGING" /YX /FD /GZ /c
 # ADD BASE RSC /l 0x413 /d "_DEBUG"
 # ADD RSC /l 0x413 /d "_DEBUG"
 BSC32=bscmake.exe
--- a/common/mp4ff/mp4ff.h
+++ b/common/mp4ff/mp4ff.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4ff.h,v 1.7 2003/11/22 15:30:19 menno Exp $
+** $Id: mp4ff.h,v 1.8 2003/11/25 13:16:09 menno Exp $
 **/
 
 #ifndef MP4FF_H
@@ -36,6 +36,7 @@
 typedef struct
 {
     int (*read)(void *user_data, void *buffer, int length);
+    int (*write)(void *udata, void *buffer, int length);
     int (*seek)(void *user_data, int position);
     void *user_data;
 } mp4ff_callback_t;
@@ -47,7 +48,10 @@
 /* API */
 
 mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
-void mp4ff_close(mp4ff_t *ff);
+#ifdef USE_TAGGING
+mp4ff_t *mp4ff_open_edit(mp4ff_callback_t *f);
+#endif
+void mp4ff_close(mp4ff_t *f);
 static void mp4ff_track_add(mp4ff_t *f);
 static int parse_sub_atoms(mp4ff_t *f, const int total_size);
 static int parse_atoms(mp4ff_t *f);
@@ -60,6 +64,7 @@
 int mp4ff_time_scale(const mp4ff_t *f, const int track);
 int mp4ff_num_samples(const mp4ff_t *f, const int track);
 
+#ifdef USE_TAGGING
 /* metadata */
 int mp4ff_meta_get_num_items(const mp4ff_t *f);
 int mp4ff_meta_get_by_index(const mp4ff_t *f, unsigned int index,
@@ -76,6 +81,7 @@
 int mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
 int mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
 int mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
+#endif
 
 #ifdef __cplusplus
 }
--- a/common/mp4ff/mp4ff.vcproj
+++ b/common/mp4ff/mp4ff.vcproj
@@ -22,7 +22,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="1"
 				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+				PreprocessorDefinitions="USE_TAGGING"
 				StringPooling="TRUE"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="TRUE"
@@ -41,7 +41,7 @@
 					RuntimeLibrary="2"
 					BufferSecurityCheck="1"
 					EnableFunctionLevelLinking="1"
-					AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TP"/>
+					AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TP"/>
 			</Tool>
 			<Tool
 				Name="VCCustomBuildTool"/>
@@ -85,7 +85,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+				PreprocessorDefinitions="USE_TAGGING"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
 				UsePrecompiledHeader="2"
@@ -101,7 +101,7 @@
 					MinimalRebuild="1"
 					BasicRuntimeChecks="3"
 					RuntimeLibrary="3"
-					AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TP"/>
+					AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;USE_TAGGING&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TP"/>
 			</Tool>
 			<Tool
 				Name="VCCustomBuildTool"/>
@@ -151,7 +151,7 @@
 						PreprocessorDefinitions="">
 						<IntelOptions
 							Optimization="1"
-							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
+							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 				<FileConfiguration
@@ -164,7 +164,7 @@
 						<IntelOptions
 							Optimization="0"
 							BasicRuntimeChecks="3"
-							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
+							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;USE_TAGGING&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 			</File>
@@ -178,7 +178,7 @@
 						PreprocessorDefinitions="">
 						<IntelOptions
 							Optimization="1"
-							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
+							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 				<FileConfiguration
@@ -191,7 +191,7 @@
 						<IntelOptions
 							Optimization="0"
 							BasicRuntimeChecks="3"
-							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
+							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;USE_TAGGING&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 			</File>
@@ -205,7 +205,7 @@
 						PreprocessorDefinitions="">
 						<IntelOptions
 							Optimization="1"
-							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
+							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 				<FileConfiguration
@@ -218,7 +218,7 @@
 						<IntelOptions
 							Optimization="0"
 							BasicRuntimeChecks="3"
-							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
+							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;USE_TAGGING&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 			</File>
@@ -232,7 +232,7 @@
 						PreprocessorDefinitions="">
 						<IntelOptions
 							Optimization="1"
-							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
+							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 				<FileConfiguration
@@ -245,7 +245,7 @@
 						<IntelOptions
 							Optimization="0"
 							BasicRuntimeChecks="3"
-							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
+							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;USE_TAGGING&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 			</File>
@@ -259,7 +259,7 @@
 						PreprocessorDefinitions="">
 						<IntelOptions
 							Optimization="1"
-							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
+							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MD /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 				<FileConfiguration
@@ -272,7 +272,7 @@
 						<IntelOptions
 							Optimization="0"
 							BasicRuntimeChecks="3"
-							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
+							AllOptions="/c  /ZI /nologo /W3 /Od /D &quot;USE_TAGGING&quot; /Gm /EHsc /RTC1 /MDd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/mp4ff.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd /TC"/>
 					</Tool>
 				</FileConfiguration>
 			</File>
--- a/common/mp4ff/mp4ffint.h
+++ b/common/mp4ff/mp4ffint.h
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4ffint.h,v 1.1 2003/11/22 15:38:31 menno Exp $
+** $Id: mp4ffint.h,v 1.2 2003/11/25 13:16:09 menno Exp $
 **/
 
 #ifndef MP4FF_INTERNAL_H
@@ -104,6 +104,9 @@
 typedef __int64 int64_t;
 typedef unsigned __int64 uint64_t;
 #else
+
+#define stricmp strcasecmp
+
 #ifdef HAVE_CONFIG_H
 #include "../../config.h"
 #endif
@@ -148,6 +151,7 @@
 typedef struct
 {
     int32_t (*read)(void *udata, void *buffer, int32_t length);
+    int32_t (*write)(void *udata, void *buffer, int32_t length);
     int32_t (*seek)(void *udata, int32_t position);
     void *user_data;
 } mp4ff_callback_t;
@@ -198,9 +202,8 @@
     int32_t moov_read;
     int32_t moov_offset;
     int32_t moov_size;
-    int32_t mdat_read;
-    int32_t mdat_offset;
-    int32_t mdat_size;
+    uint8_t last_atom;
+    int32_t file_size;
 
     /* mvhd */
     int32_t time_scale;
@@ -221,6 +224,7 @@
 
 /* mp4util.c */
 int32_t mp4ff_read_data(mp4ff_t *f, int8_t *data, const int32_t size);
+int32_t mp4ff_write_data(mp4ff_t *f, int8_t *data, const int32_t size);
 uint32_t mp4ff_read_int32(mp4ff_t *f);
 uint32_t mp4ff_read_int24(mp4ff_t *f);
 uint16_t mp4ff_read_int16(mp4ff_t *f);
@@ -242,7 +246,9 @@
 static int32_t mp4ff_read_stsc(mp4ff_t *f);
 static int32_t mp4ff_read_stco(mp4ff_t *f);
 static int32_t mp4ff_read_stts(mp4ff_t *f);
+#ifdef USE_TAGGING
 static int32_t mp4ff_read_meta(mp4ff_t *f, const int32_t size);
+#endif
 int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type);
 
 /* mp4sample.c */
@@ -255,6 +261,7 @@
 int32_t mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample);
 int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);
 
+#ifdef USE_TAGGING
 /* mp4meta.c */
 static int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, const char *value);
 static int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value);
@@ -283,9 +290,13 @@
 int32_t mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
 int32_t mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
 int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
+#endif
 
 /* mp4ff.c */
 mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
+#ifdef USE_TAGGING
+mp4ff_t *mp4ff_open_edit(mp4ff_callback_t *f);
+#endif
 void mp4ff_close(mp4ff_t *ff);
 static void mp4ff_track_add(mp4ff_t *f);
 static int32_t parse_sub_atoms(mp4ff_t *f, const int32_t total_size);
--- a/common/mp4ff/mp4meta.c
+++ b/common/mp4ff/mp4meta.c
@@ -22,9 +22,11 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4meta.c,v 1.1 2003/11/22 15:38:31 menno Exp $
+** $Id: mp4meta.c,v 1.2 2003/11/25 13:16:09 menno Exp $
 **/
 
+#ifdef USE_TAGGING
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -434,3 +436,5 @@
 {
     return mp4ff_meta_find_by_name(f, "tempo", value);
 }
+
+#endif
\ No newline at end of file
--- a/common/mp4ff/mp4util.c
+++ b/common/mp4ff/mp4util.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: mp4util.c,v 1.3 2003/11/22 15:30:19 menno Exp $
+** $Id: mp4util.c,v 1.4 2003/11/25 13:16:09 menno Exp $
 **/
 
 #include "mp4ffint.h"
@@ -32,6 +32,17 @@
     int32_t result = 1;
 
     result = f->stream->read(f->stream->user_data, data, size);
+
+    f->current_position += size;
+
+    return result;
+}
+
+int32_t mp4ff_write_data(mp4ff_t *f, int8_t *data, const int32_t size)
+{
+    int32_t result = 1;
+
+    result = f->stream->write(f->stream->user_data, data, size);
 
     f->current_position += size;
 
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: main.c,v 1.65 2003/11/22 15:30:19 menno Exp $
+** $Id: main.c,v 1.66 2003/11/25 13:16:09 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -625,7 +625,6 @@
 
     } while (sample_buffer != NULL);
 
-
     faacDecClose(hDecoder);
 
     if (adts_out == 1)
@@ -720,6 +719,7 @@
 
     /* initialise the callback structure */
     mp4ff_callback_t *mp4cb = malloc(sizeof(mp4ff_callback_t));
+
     mp4File = fopen(mp4file, "rb");
     mp4cb->read = read_callback;
     mp4cb->seek = seek_callback;
@@ -810,6 +810,8 @@
         fprintf(stderr, "%s\t%.3f secs, %d ch, %d Hz\n\n", ot[(mp4ASC.objectTypeIndex > 5)?0:mp4ASC.objectTypeIndex],
             seconds, mp4ASC.channelsConfiguration, mp4ASC.samplingFrequency);
 
+#define PRINT_MP4_METADATA
+#ifdef PRINT_MP4_METADATA
         j = mp4ff_meta_get_num_items(infile);
         for (k = 0; k < j; k++)
         {
@@ -824,6 +826,7 @@
             }
         }
         if (j > 0) printf("\n");
+#endif
     }
 
     if (infoOnly)