~ft/aacdec

18e4504118237d080ceaa0f02f773ac185801e48 — menno 19 years ago c7c6d38
ok, so now we can actually decode NeroDigital files :)
M common/mp4ff/mp4atom.c => common/mp4ff/mp4atom.c +26 -14
@@ 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.5 2003/11/25 13:16:09 menno Exp $
** $Id: mp4atom.c,v 1.6 2003/12/04 21:29:52 menno Exp $
**/

#include <stdlib.h>


@@ 41,7 41,7 @@ static int32_t mp4ff_atom_get_size(const int8_t *data)
    d = (uint8_t)data[3];

    result = (a<<24) | (b<<16) | (c<<8) | d;
    if (result > 0 && result < 8) result = 8;
    //if (result > 0 && result < 8) result = 8;

    return (int32_t)result;
}


@@ 161,9 161,9 @@ static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b,
}

/* read atom header, return atom size, atom size is with header included */
int32_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type)
uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size)
{
    int32_t size;
    uint64_t size;
    int32_t ret;
    int8_t atom_header[8];



@@ 172,6 172,14 @@ int32_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type)
        return 0;

    size = mp4ff_atom_get_size(atom_header);
    *header_size = 8;

    /* check for 64 bit atom size */
    if (size == 1)
    {
        *header_size = 16;
        size = mp4ff_read_int64(f);
    }

    //printf("%c%c%c%c\n", atom_header[4], atom_header[5], atom_header[6], atom_header[7]);



@@ 268,8 276,10 @@ static int32_t mp4ff_read_esds(mp4ff_t *f)

static int32_t mp4ff_read_mp4a(mp4ff_t *f)
{
    int32_t i, size;
    uint64_t size;
    int32_t i;
    uint8_t atom_type = 0;
    uint8_t header_size = 0;

    for (i = 0; i < 6; i++)
    {


@@ 290,7 300,7 @@ static int32_t mp4ff_read_mp4a(mp4ff_t *f)

    mp4ff_read_int16(f);

    size = mp4ff_atom_read_header(f, &atom_type);
    size = mp4ff_atom_read_header(f, &atom_type, &header_size);
    if (atom_type == ATOM_ESDS)
    {
        mp4ff_read_esds(f);


@@ 302,6 312,7 @@ static int32_t mp4ff_read_mp4a(mp4ff_t *f)
static int32_t mp4ff_read_stsd(mp4ff_t *f)
{
    int32_t i;
    uint8_t header_size = 0;

    mp4ff_read_char(f); /* version */
    mp4ff_read_int24(f); /* flags */


@@ 310,10 321,10 @@ static int32_t mp4ff_read_stsd(mp4ff_t *f)

    for (i = 0; i < f->track[f->total_tracks - 1]->stsd_entry_count; i++)
    {
        int32_t skip = mp4ff_position(f);
        int32_t size;
        uint64_t skip = mp4ff_position(f);
        uint64_t size;
        uint8_t atom_type = 0;
        size = mp4ff_atom_read_header(f, &atom_type);
        size = mp4ff_atom_read_header(f, &atom_type, &header_size);
        skip += size;

        if (atom_type == ATOM_MP4A)


@@ 430,22 441,23 @@ static int32_t mp4ff_read_mvhd(mp4ff_t *f)
}

#ifdef USE_TAGGING
static int32_t mp4ff_read_meta(mp4ff_t *f, const int32_t size)
static int32_t mp4ff_read_meta(mp4ff_t *f, const uint64_t size)
{
    int32_t subsize, sumsize = 0;
    uint64_t subsize, sumsize = 0;
    uint8_t atom_type;
    uint8_t header_size = 0;

    mp4ff_read_char(f); /* version */
    mp4ff_read_int24(f); /* flags */

    while (sumsize < (size-12))
    {
        subsize = mp4ff_atom_read_header(f, &atom_type);
        subsize = mp4ff_atom_read_header(f, &atom_type, &header_size);
        if (atom_type == ATOM_ILST)
        {
            mp4ff_parse_metadata(f, subsize);
            mp4ff_parse_metadata(f, subsize-(header_size+4));
        } else {
            mp4ff_set_position(f, mp4ff_position(f)+subsize-8);
            mp4ff_set_position(f, mp4ff_position(f)+subsize-header_size);
        }
        sumsize += subsize;
    }

M common/mp4ff/mp4ff.c => common/mp4ff/mp4ff.c +14 -12
@@ 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.5 2003/11/25 13:16:09 menno Exp $
** $Id: mp4ff.c,v 1.6 2003/12/04 21:29:52 menno Exp $
**/

#include <stdlib.h>


@@ 125,15 125,16 @@ static void mp4ff_track_add(mp4ff_t *f)
}

/* parse atoms that are sub atoms of other atoms */
static int32_t parse_sub_atoms(mp4ff_t *f, const int32_t total_size)
static int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size)
{
    int32_t size;
    uint64_t size;
    uint8_t atom_type = 0;
    int32_t counted_size = 0;
    uint64_t counted_size = 0;
    uint8_t header_size = 0;

    while (counted_size < total_size)
    {
        size = mp4ff_atom_read_header(f, &atom_type);
        size = mp4ff_atom_read_header(f, &atom_type, &header_size);
        counted_size += size;

        /* check for end of file */


@@ 151,7 152,7 @@ static int32_t parse_sub_atoms(mp4ff_t *f, const int32_t total_size)
        /* parse subatoms */
        if (atom_type < SUBATOMIC)
        {
            parse_sub_atoms(f, size-8);
            parse_sub_atoms(f, size-header_size);
        } else {
            mp4ff_atom_read(f, size, atom_type);
        }


@@ 163,12 164,13 @@ static int32_t parse_sub_atoms(mp4ff_t *f, const int32_t total_size)
/* parse root atoms */
static int32_t parse_atoms(mp4ff_t *f)
{
    int32_t size;
    uint64_t size;
    uint8_t atom_type = 0;
    uint8_t header_size = 0;

    f->file_size = 0;

    while ((size = mp4ff_atom_read_header(f, &atom_type)) != 0)
    while ((size = mp4ff_atom_read_header(f, &atom_type, &header_size)) != 0)
    {
        f->file_size += size;
        f->last_atom = atom_type;


@@ 180,20 182,20 @@ static int32_t parse_atoms(mp4ff_t *f)
//            break;
        }

        if (atom_type == ATOM_MOOV && size > 8)
        if (atom_type == ATOM_MOOV && size > header_size)
        {
            f->moov_read = 1;
            f->moov_offset = mp4ff_position(f)-8;
            f->moov_offset = mp4ff_position(f)-header_size;
            f->moov_size = size;
        }

        /* parse subatoms */
        if (atom_type < SUBATOMIC)
        {
            parse_sub_atoms(f, size-8);
            parse_sub_atoms(f, size-header_size);
        } else {
            /* skip this atom */
            mp4ff_set_position(f, mp4ff_position(f)+size-8);
            mp4ff_set_position(f, mp4ff_position(f)+size-header_size);
        }
    }


M common/mp4ff/mp4ff.h => common/mp4ff/mp4ff.h +1 -6
@@ 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.8 2003/11/25 13:16:09 menno Exp $
** $Id: mp4ff.h,v 1.9 2003/12/04 21:29:52 menno Exp $
**/

#ifndef MP4FF_H


@@ 52,9 52,6 @@ mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
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);
int mp4ff_get_sample_duration(const mp4ff_t *f, const int track, const int sample);
int mp4ff_read_sample(mp4ff_t *f, const int track, const int sample,
                          unsigned char **audio_buffer,  unsigned int *bytes);


@@ 64,7 61,6 @@ int mp4ff_total_tracks(const mp4ff_t *f);
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,


@@ 81,7 77,6 @@ int mp4ff_meta_get_track(const mp4ff_t *f, char **value);
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
}

M common/mp4ff/mp4ff.vcproj => common/mp4ff/mp4ff.vcproj +58 -30
@@ 24,7 24,7 @@
				InlineFunctionExpansion="1"
				PreprocessorDefinitions="USE_TAGGING"
				StringPooling="TRUE"
				RuntimeLibrary="2"
				RuntimeLibrary="0"
				EnableFunctionLevelLinking="TRUE"
				UsePrecompiledHeader="2"
				PrecompiledHeaderFile=".\Release/mp4ff.pch"


@@ 32,25 32,29 @@
				ObjectFile=".\Release/"
				ProgramDataBaseFileName=".\Release/"
				WarningLevel="3"
				SuppressStartupBanner="TRUE">
				SuppressStartupBanner="TRUE"
				AdditionalOptions="">
				<IntelOptions
					Optimization="1"
					InlineFunctionExpansion="1"
					OmitFramePointers="1"
					StringPooling="1"
					RuntimeLibrary="2"
					RuntimeLibrary="0"
					BufferSecurityCheck="1"
					EnableFunctionLevelLinking="1"
					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"/>
					AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TP"
					MSOriginalAdditionalOptions=""/>
			</Tool>
			<Tool
				Name="VCCustomBuildTool"/>
			<Tool
				Name="VCLibrarianTool"
				OutputFile=".\Release\mp4ff.lib"
				SuppressStartupBanner="TRUE">
				SuppressStartupBanner="TRUE"
				AdditionalOptions="">
				<IntelOptions
					AllOptions="/OUT:&quot;.\Release\mp4ff.lib&quot; /NOLOGO"/>
					AllOptions="/OUT:&quot;.\Release\mp4ff.lib&quot; /NOLOGO"
					MSOriginalAdditionalOptions=""/>
			</Tool>
			<Tool
				Name="VCMIDLTool"/>


@@ 95,22 99,26 @@
				ProgramDataBaseFileName=".\Debug/"
				WarningLevel="3"
				SuppressStartupBanner="TRUE"
				DebugInformationFormat="4">
				DebugInformationFormat="4"
				AdditionalOptions="">
				<IntelOptions
					Optimization="0"
					MinimalRebuild="1"
					BasicRuntimeChecks="3"
					RuntimeLibrary="3"
					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"/>
					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"
					MSOriginalAdditionalOptions=""/>
			</Tool>
			<Tool
				Name="VCCustomBuildTool"/>
			<Tool
				Name="VCLibrarianTool"
				OutputFile=".\Debug\mp4ff.lib"
				SuppressStartupBanner="TRUE">
				SuppressStartupBanner="TRUE"
				AdditionalOptions="">
				<IntelOptions
					AllOptions="/OUT:&quot;.\Debug\mp4ff.lib&quot; /NOLOGO"/>
					AllOptions="/OUT:&quot;.\Debug\mp4ff.lib&quot; /NOLOGO"
					MSOriginalAdditionalOptions=""/>
			</Tool>
			<Tool
				Name="VCMIDLTool"/>


@@ 148,10 156,12 @@
					<Tool
						Name="VCCLCompilerTool"
						Optimization="1"
						PreprocessorDefinitions="">
						PreprocessorDefinitions=""
						AdditionalOptions="">
						<IntelOptions
							Optimization="1"
							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"/>
							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
				<FileConfiguration


@@ 160,11 170,13 @@
						Name="VCCLCompilerTool"
						Optimization="0"
						PreprocessorDefinitions=""
						BasicRuntimeChecks="3">
						BasicRuntimeChecks="3"
						AdditionalOptions="">
						<IntelOptions
							Optimization="0"
							BasicRuntimeChecks="3"
							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"/>
							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"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
			</File>


@@ 175,10 187,12 @@
					<Tool
						Name="VCCLCompilerTool"
						Optimization="1"
						PreprocessorDefinitions="">
						PreprocessorDefinitions=""
						AdditionalOptions="">
						<IntelOptions
							Optimization="1"
							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"/>
							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
				<FileConfiguration


@@ 187,11 201,13 @@
						Name="VCCLCompilerTool"
						Optimization="0"
						PreprocessorDefinitions=""
						BasicRuntimeChecks="3">
						BasicRuntimeChecks="3"
						AdditionalOptions="">
						<IntelOptions
							Optimization="0"
							BasicRuntimeChecks="3"
							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"/>
							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"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
			</File>


@@ 202,10 218,12 @@
					<Tool
						Name="VCCLCompilerTool"
						Optimization="1"
						PreprocessorDefinitions="">
						PreprocessorDefinitions=""
						AdditionalOptions="">
						<IntelOptions
							Optimization="1"
							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"/>
							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
				<FileConfiguration


@@ 214,11 232,13 @@
						Name="VCCLCompilerTool"
						Optimization="0"
						PreprocessorDefinitions=""
						BasicRuntimeChecks="3">
						BasicRuntimeChecks="3"
						AdditionalOptions="">
						<IntelOptions
							Optimization="0"
							BasicRuntimeChecks="3"
							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"/>
							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"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
			</File>


@@ 229,10 249,12 @@
					<Tool
						Name="VCCLCompilerTool"
						Optimization="1"
						PreprocessorDefinitions="">
						PreprocessorDefinitions=""
						AdditionalOptions="">
						<IntelOptions
							Optimization="1"
							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"/>
							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
				<FileConfiguration


@@ 241,11 263,13 @@
						Name="VCCLCompilerTool"
						Optimization="0"
						PreprocessorDefinitions=""
						BasicRuntimeChecks="3">
						BasicRuntimeChecks="3"
						AdditionalOptions="">
						<IntelOptions
							Optimization="0"
							BasicRuntimeChecks="3"
							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"/>
							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"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
			</File>


@@ 256,10 280,12 @@
					<Tool
						Name="VCCLCompilerTool"
						Optimization="1"
						PreprocessorDefinitions="">
						PreprocessorDefinitions=""
						AdditionalOptions="">
						<IntelOptions
							Optimization="1"
							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"/>
							AllOptions="/c  /nologo /W3 /O1 /Ob1 /Oy /D &quot;USE_TAGGING&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/mp4ff.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd /TC"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
				<FileConfiguration


@@ 268,11 294,13 @@
						Name="VCCLCompilerTool"
						Optimization="0"
						PreprocessorDefinitions=""
						BasicRuntimeChecks="3">
						BasicRuntimeChecks="3"
						AdditionalOptions="">
						<IntelOptions
							Optimization="0"
							BasicRuntimeChecks="3"
							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"/>
							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"
							MSOriginalAdditionalOptions=""/>
					</Tool>
				</FileConfiguration>
			</File>

M common/mp4ff/mp4ffint.h => common/mp4ff/mp4ffint.h +8 -7
@@ 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.2 2003/11/25 13:16:09 menno Exp $
** $Id: mp4ffint.h,v 1.3 2003/12/04 21:29:52 menno Exp $
**/

#ifndef MP4FF_INTERNAL_H


@@ 200,10 200,10 @@ typedef struct
    int32_t current_position;

    int32_t moov_read;
    int32_t moov_offset;
    int32_t moov_size;
    uint64_t moov_offset;
    uint64_t moov_size;
    uint8_t last_atom;
    int32_t file_size;
    uint64_t file_size;

    /* mvhd */
    int32_t time_scale;


@@ 225,6 225,7 @@ typedef struct
/* 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);
uint64_t mp4ff_read_int64(mp4ff_t *f);
uint32_t mp4ff_read_int32(mp4ff_t *f);
uint32_t mp4ff_read_int24(mp4ff_t *f);
uint16_t mp4ff_read_int16(mp4ff_t *f);


@@ 238,7 239,7 @@ static int32_t mp4ff_atom_get_size(const int8_t *data);
static int32_t mp4ff_atom_compare(const int8_t a1, const int8_t b1, const int8_t c1, const int8_t d1,
                                  const int8_t a2, const int8_t b2, const int8_t c2, const int8_t d2);
static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b, const int8_t c, const int8_t d);
int32_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type);
uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size);
static int32_t mp4ff_read_stsz(mp4ff_t *f);
static int32_t mp4ff_read_esds(mp4ff_t *f);
static int32_t mp4ff_read_mp4a(mp4ff_t *f);


@@ 247,7 248,7 @@ 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);
static int32_t mp4ff_read_meta(mp4ff_t *f, const uint64_t size);
#endif
int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type);



@@ 299,7 300,7 @@ 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);
static int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size);
static int32_t parse_atoms(mp4ff_t *f);
int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample);
int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,

M common/mp4ff/mp4meta.c => common/mp4ff/mp4meta.c +16 -14
@@ 22,7 22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4meta.c,v 1.2 2003/11/25 13:16:09 menno Exp $
** $Id: mp4meta.c,v 1.3 2003/12/04 21:29:52 menno Exp $
**/

#ifdef USE_TAGGING


@@ 234,21 234,22 @@ static int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char
static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size)
{
    uint8_t atom_type;
    int32_t subsize, sumsize = 0;
    uint8_t header_size = 0;
    uint64_t subsize, sumsize = 0;
    char *name = NULL;
    char *data = NULL;

    while (sumsize < (size-8))
    while (sumsize < size)
    {
        subsize = mp4ff_atom_read_header(f, &atom_type);
        subsize = mp4ff_atom_read_header(f, &atom_type, &header_size);
        if (atom_type == ATOM_DATA)
        {
            mp4ff_read_char(f); /* version */
            mp4ff_read_int24(f); /* flags */
            mp4ff_read_int32(f); /* reserved */
            data = malloc(subsize-16+1);
            mp4ff_read_data(f, data, subsize-16);
            data[subsize-16] = '\0';
            data = malloc(subsize-(header_size+8)+1);
            mp4ff_read_data(f, data, subsize-(header_size+8));
            data[subsize-(header_size+8)] = '\0';

            /* some need special attention */
            if (parent_atom_type == ATOM_GENRE2 || parent_atom_type == ATOM_TEMPO)


@@ 289,11 290,11 @@ static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const
        } else if (atom_type == ATOM_NAME) {
            mp4ff_read_char(f); /* version */
            mp4ff_read_int24(f); /* flags */
            name = malloc(subsize-12+1);
            mp4ff_read_data(f, name, subsize-12);
            name = malloc(subsize-(header_size+4)+1);
            mp4ff_read_data(f, name, subsize-(header_size+4));
            name[subsize-12] = '\0';
        } else {
            mp4ff_set_position(f, mp4ff_position(f)+subsize-8);
            mp4ff_set_position(f, mp4ff_position(f)+subsize-header_size);
        }
        sumsize += subsize;
    }


@@ 310,13 311,14 @@ static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const

int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size)
{
    int32_t subsize, sumsize = 0;
    uint64_t subsize, sumsize = 0;
    uint8_t atom_type;
    uint8_t header_size = 0;

    while (sumsize < (size-12))
    while (sumsize < size)
    {
        subsize = mp4ff_atom_read_header(f, &atom_type);
        mp4ff_parse_tag(f, atom_type, subsize);
        subsize = mp4ff_atom_read_header(f, &atom_type, &header_size);
        mp4ff_parse_tag(f, atom_type, subsize-header_size);
        sumsize += subsize;
    }


M common/mp4ff/mp4sample.c => common/mp4ff/mp4sample.c +1 -1
@@ 22,7 22,7 @@
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4sample.c,v 1.3 2003/11/25 13:16:09 menno Exp $
** $Id: mp4sample.c,v 1.4 2003/12/04 21:29:52 menno Exp $
**/

#include <stdlib.h>

M common/mp4ff/mp4util.c => common/mp4ff/mp4util.c +17 -1
@@ 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.4 2003/11/25 13:16:09 menno Exp $
** $Id: mp4util.c,v 1.5 2003/12/04 21:29:52 menno Exp $
**/

#include "mp4ffint.h"


@@ 62,6 62,22 @@ int32_t mp4ff_position(const mp4ff_t *f)
    return f->current_position;
}

uint64_t mp4ff_read_int64(mp4ff_t *f)
{
    int8_t data[8];
    uint64_t result = 0;
    int8_t i;

    mp4ff_read_data(f, data, 8);

    for (i = 0; i < 8; i++)
    {
        result |= ((uint64_t)data[i]) << ((7 - i) * 8);
    }

    return result;
}

uint32_t mp4ff_read_int32(mp4ff_t *f)
{
    uint32_t result;