Initial setup of repository

This commit is contained in:
bok
2005-11-10 22:52:16 +00:00
commit 7320cc3eaa
220 changed files with 31995 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
##########################################################################
#
# Aac2Mp4 Program
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
include $(BUILD_ROOT)/Makefiles/Codecs.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Aac2Mp4.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Aac2Mp4
##########################################################################
# variables
##########################################################################
LINK = $(LINK_CPP_OPTIONS) $(OPTIMIZE_CPP) $(DEBUG_CPP) $(PROFILE_CPP)
##########################################################################
# rules
##########################################################################
aac2mp4: $(TARGET_SOURCES:.cpp=.o) $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $^ -o $@
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

View File

@@ -0,0 +1,16 @@
#######################################################################
#
# bootstrap makefile
#
#######################################################################
AP4_BUILD_CONFIG = Debug
ifeq ($(MAKECMDGOALS),)
MAKECMDGOALS = default
else
TARGETS = $(MAKECMDGOALS)
endif
$(MAKECMDGOALS):
@[ -d $(AP4_BUILD_CONFIG) ] || mkdir $(AP4_BUILD_CONFIG)
@$(MAKE) -C $(AP4_BUILD_CONFIG) AP4_BUILD_CONFIG=$(AP4_BUILD_CONFIG) -f ../Local.mak $(TARGETS)

View File

@@ -0,0 +1,10 @@
##########################################################################
#
# Codecs target exports
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
TARGET_LIBRARIES += AP4_Codecs
INCLUDES_CPP += -I$(SOURCE_ROOT)/Codecs

View File

@@ -0,0 +1,35 @@
##########################################################################
#
# Codecs target
#
# (c) 2001-2005 Gilles Boccon-Gibod
# Author: Gilles Boccon-Gibod (bok@bok.net)
#
##########################################################################
##########################################################################
# sources
##########################################################################
CODECS_SOURCES = Ap4AdtsParser.cpp Ap4BitStream.cpp
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Core.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = $(CODECS_SOURCES)
libAP4_Codecs.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Codecs
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

10
Build/Makefiles/Core.exp Normal file
View File

@@ -0,0 +1,10 @@
##########################################################################
#
# Core target exports
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
TARGET_LIBRARIES += AP4_Core
INCLUDES_CPP += -I$(SOURCE_ROOT)/Core -I$(SOURCE_ROOT)/Config

93
Build/Makefiles/Core.mak Normal file
View File

@@ -0,0 +1,93 @@
##########################################################################
#
# Core target
#
# (c) 2001-2002 Gilles Boccon-Gibod
# Author: Gilles Boccon-Gibod (bok@bok.net)
#
##########################################################################
##########################################################################
# source files
##########################################################################
CORE_SOURCES = \
Ap4Atom.cpp \
Ap4AtomFactory.cpp \
Ap4ContainerAtom.cpp \
Ap4FrmaAtom.cpp \
Ap4FtypAtom.cpp \
Ap4HdlrAtom.cpp \
Ap4MdhdAtom.cpp \
Ap4MoovAtom.cpp \
Ap4MvhdAtom.cpp \
Ap4SmhdAtom.cpp \
Ap4NmhdAtom.cpp \
Ap4HmhdAtom.cpp \
Ap4VmhdAtom.cpp \
Ap4SchmAtom.cpp \
Ap4StcoAtom.cpp \
Ap4StscAtom.cpp \
Ap4StsdAtom.cpp \
Ap4StssAtom.cpp \
Ap4StszAtom.cpp \
Ap4SttsAtom.cpp \
Ap4TkhdAtom.cpp \
Ap4IsmaCryp.cpp \
Ap4IsfmAtom.cpp \
Ap4IkmsAtom.cpp \
Ap4TimsAtom.cpp \
Ap4TrakAtom.cpp \
Ap4SdpAtom.cpp \
Ap4RtpAtom.cpp \
Ap4UrlAtom.cpp \
Ap4CttsAtom.cpp \
Ap4DrefAtom.cpp \
Ap4EsdsAtom.cpp \
Ap4Descriptor.cpp \
Ap4DescriptorFactory.cpp \
Ap4SLConfigDescriptor.cpp \
Ap4UnknownDescriptor.cpp \
Ap4DecoderConfigDescriptor.cpp \
Ap4DecoderSpecificInfoDescriptor.cpp \
Ap4EsDescriptor.cpp \
Ap4TrefTypeAtom.cpp \
Ap4File.cpp \
Ap4Track.cpp \
Ap4Utils.cpp \
Ap4Movie.cpp \
Ap4RtpHint.cpp \
Ap4Sample.cpp \
Ap4SampleTable.cpp \
Ap4AtomSampleTable.cpp \
Ap4SyntheticSampleTable.cpp \
Ap4SampleDescription.cpp \
Ap4SampleEntry.cpp \
Ap4FileWriter.cpp \
Ap4HintTrackReader.cpp \
Ap4Processor.cpp \
Ap4ByteStream.cpp \
Ap4DataBuffer.cpp \
Ap4Debug.cpp \
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = $(CORE_SOURCES)
libAP4_Core.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Core
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

View File

@@ -0,0 +1,10 @@
##########################################################################
#
# Crypto target exports
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
TARGET_LIBRARIES += AP4_Crypto
INCLUDES_CPP += -I$(SOURCE_ROOT)/Crypto

View File

@@ -0,0 +1,36 @@
##########################################################################
#
# Crypto target
#
# (c) 2001-2005 Gilles Boccon-Gibod
# Author: Gilles Boccon-Gibod (bok@bok.net)
#
##########################################################################
##########################################################################
# sources
##########################################################################
CODECS_SOURCES = Ap4StreamCipher.cpp Ap4AesBlockCipher.cpp
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/Crypto.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = $(CODECS_SOURCES)
libAP4_Crypto.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Crypto
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

View File

@@ -0,0 +1,38 @@
##########################################################################
#
# Mp42Aac Program
#
# (c) 2002-2003 Gilles Boccon-Gibod & Julien Boeuf
#
##########################################################################
all: mp42aac
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp42Aac.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp42Aac
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp42aac: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) -o $@

View File

@@ -0,0 +1,38 @@
##########################################################################
#
# Mp4Decrypt Program
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
all: mp4decrypt
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4Decrypt.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4Decrypt
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4decrypt: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@

View File

@@ -0,0 +1,38 @@
##########################################################################
#
# Ap4Dump Program
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
all: mp4dump
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4Dump.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4Dump
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4dump: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) -o $@

View File

@@ -0,0 +1,38 @@
##########################################################################
#
# Mp4Edit Program
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
all: mp4edit
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4Edit.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4Edit
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4edit: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@

View File

@@ -0,0 +1,38 @@
##########################################################################
#
# Mp4Encrypt Program
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
all: mp4encrypt
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4Encrypt.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4Encrypt
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4encrypt: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@

View File

@@ -0,0 +1,38 @@
##########################################################################
#
# Mp4Extract Program
#
# (c) 2001-2004 Gilles Boccon-Gibod
#
##########################################################################
all: mp4extract
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4Extract.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4Extract
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4extract: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@

View File

@@ -0,0 +1,37 @@
##########################################################################
#
# Mp4Info Program
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
all: mp4info
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4Info.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4Info
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4info: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) -o $@

View File

@@ -0,0 +1,37 @@
##########################################################################
#
# Mp4RtpHintInfo Program
#
# (c) 2001-2005 Gilles Boccon-Gibod
#
##########################################################################
all: mp4rtphintinfo
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = Mp4RtpHintInfo.cpp
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/Apps/Mp4RtpHintInfo
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak
##########################################################################
# rules
##########################################################################
mp4rtphintinfo: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
$(LINK) $(TARGET_OBJECTS) -o $@

76
Build/Makefiles/Rules.mak Normal file
View File

@@ -0,0 +1,76 @@
##########################################################################
#
# common make rules and variables
#
# (c) 2001-2002 Gilles Boccon-Gibod
# Author: Gilles Boccon-Gibod (bok@bok.net)
#
##########################################################################
##########################################################################
# build configurations
##########################################################################
VPATH += $(AP4_BUILD_CONFIG)
COMPILE_CPP_OPTIONS = $(WARNINGS_CPP)
ifeq ($(AP4_BUILD_CONFIG),Profile)
COMPILE_CPP_OPTIONS += $(PROFILE_CPP)
endif
ifeq ($(AP4_BUILD_CONFIG),Debug)
COMPILE_CPP_OPTIONS += $(DEBUG_CPP)
else
COMPILE_CPP_OPTIONS += $(OPTIMIZE_CPP)
endif
##########################################################################
# default rules
##########################################################################
%.d: %.cpp
$(AUTODEP_CPP) $(DEFINES_CPP) $(INCLUDES_CPP) $< -o $@
ifneq ($(AUTODEP_STDOUT),)
%.d: %.c
$(AUTODEP_C) $(DEFINES_C) $(INCLUDES_C) $< > $@
else
%.d: %.c
$(AUTODEP_CPP) $(DEFINES_CPP) $(INCLUDES_CPP) $< -o $@
endif
%.o: %.cpp
$(COMPILE_CPP) $(COMPILE_CPP_OPTIONS) $($@_LOCAL_DEFINES_CPP) $(DEFINES_CPP) $(INCLUDES_CPP) -c $< -o $@
%.a:
$(ARCHIVE) -o $@ $^
.PHONY: clean
clean:
@rm -rf $(TO_CLEAN)
TITLE = @echo ============ making $@ =============
INVOKE_SUBMAKE = $(MAKE) --no-print-directory
##########################################################################
# variables
##########################################################################
LINK = $(LINK_CPP) $(LINK_CPP_OPTIONS)
LINK_CPP_OPTIONS += $(foreach lib,$(TARGET_LIBRARIES),-l$(lib))
TARGET_LIBRARY_FILES = $(foreach lib,$(TARGET_LIBRARIES),lib$(lib).a)
TARGET_OBJECTS = $(TARGET_SOURCES:.cpp=.o)
##########################################################################
# auto dependencies
##########################################################################
TARGET_DEPENDENCIES := $(patsubst %.c,%.d,$(TARGET_SOURCES))
TARGET_DEPENDENCIES := $(patsubst %.cpp,%.d,$(TARGET_DEPENDENCIES))
ifneq ($(TARGET_DEPENDENCIES),)
include $(TARGET_DEPENDENCIES)
endif
##########################################################################
# includes
##########################################################################
ifneq ($(LOCAL_RULES),)
include $(LOCAL_RULES)
endif

50
Build/Makefiles/SDK.mak Normal file
View File

@@ -0,0 +1,50 @@
##########################################################################
#
# SDK Makefile
#
# (c) 2001-2005 Gilles Boccon-Gibod
#
##########################################################################
all: sdk
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Crypto.exp
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/Codecs.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# variables
##########################################################################
SDK_LIBRARY = SDK/lib/libAP4.a
SDK_HEADERS := $(SOURCE_ROOT)/Core/*.h $(SOURCE_ROOT)/Config/*.h $(SOURCE_ROOT)/Crypto/*.h $(SOURCE_ROOT)/Codecs/*.h
SDK_BINARIES = $(ALL_APPS)
##########################################################################
# rules
##########################################################################
.PHONY: sdk-dirs
sdk-dirs:
@rm -rf SDK
@mkdir SDK
@mkdir SDK/lib
@mkdir SDK/include
@mkdir SDK/bin
$(SDK_LIBRARY): $(foreach lib,$(TARGET_LIBRARIES),lib$(lib).a)
$(MAKELIB) $@ $^
$(RANLIB) $@
sdk: sdk-dirs $(SDK_LIBRARY) $(SDK_HEADERS)
@cp $(SDK_HEADERS) SDK/include
@cp $(SDK_BINARIES) SDK/bin
@$(STRIP) SDK/bin/*
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

View File

@@ -0,0 +1,10 @@
##########################################################################
#
# System target exports
#
# (c) 2001-2002 Gilles Boccon-Gibod
#
##########################################################################
TARGET_LIBRARIES += AP4_System
INCLUDES_CPP += -I$(SOURCE_ROOT)/System/StdC

View File

@@ -0,0 +1,36 @@
##########################################################################
#
# System target
#
# (c) 2001-2002 Gilles Boccon-Gibod
# Author: Gilles Boccon-Gibod (bok@bok.net)
#
##########################################################################
##########################################################################
# sources
##########################################################################
SYSTEM_SOURCES = $(FILE_BYTE_STREAM_IMPLEMENTATION).cpp
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Core.exp
include $(BUILD_ROOT)/Makefiles/System.exp
##########################################################################
# targets
##########################################################################
TARGET_SOURCES = $(SYSTEM_SOURCES)
libAP4_System.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
##########################################################################
# make path
##########################################################################
VPATH += $(SOURCE_ROOT)/System/StdC
##########################################################################
# includes
##########################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

View File

@@ -0,0 +1,131 @@
##########################################################################
#
# top level make rules and variables
#
# (c) 2001-2005 Gilles Boccon-Gibod
# Author: Gilles Boccon-Gibod (bok@bok.net)
#
##########################################################################
##########################################################################
# exported variables
##########################################################################
BUILD_ROOT = $(ROOT)/Build
SOURCE_ROOT = $(ROOT)/Source/C++
export BUILD_ROOT
export SOURCE_ROOT
export TARGET
export FILE_BYTE_STREAM_IMPLEMENTATION
export CC
export AUTODEP_CPP
export AUTODEP_STDOUT
export ARCHIVE
export COMPILE_CPP
export LINK_CPP
export MAKELIB
export MAKESHAREDLIB
export RANLIB
export STRIP
export DEBUG_CPP
export OPTIMIZE_CPP
export PROFILE_CPP
export DEFINES_CPP
export WARNINGS_CPP
export INCLUDES_CPP
export LIBRARIES_CPP
##########################################################################
# modular targets
##########################################################################
# ------- Setup -------------
.PHONY: Setup
Setup:
mkdir $(OUTPUT_DIR)
# ------- Core -------------
Core: Crypto
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Core.mak
# ------- System -----------
System:
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/System.mak
# ------- Codecs -----------
Codecs:
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Codecs.mak
# ------- Crypto -----------
Crypto:
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Crypto.mak
# ------- Apps -----------
ALL_APPS = mp4dump mp4info mp42aac aac2mp4 mp4decrypt mp4encrypt mp4edit mp4extract mp4rtphintinfo
export ALL_APPS
Apps: $(ALL_APPS)
##################################################################
# cleanup
##################################################################
TO_CLEAN += *.d *.o *.a *.exe $(ALL_APPS) SDK
##################################################################
# end targets
##################################################################
sdk: Core System Codecs Crypto Apps
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/SDK.mak
mp4dump: Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Dump.mak
mp4info: Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Info.mak
mp42aac: Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp42Aac.mak
aac2mp4: Codecs Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Aac2Mp4.mak
mp4decrypt: Crypto Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Decrypt.mak
mp4encrypt: Crypto Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Encrypt.mak
mp4edit: Crypto Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Edit.mak
mp4extract: Crypto Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Extract.mak
mp4rtphintinfo: Crypto Core System
$(TITLE)
@$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4RtpHintInfo.mak
##################################################################
# includes
##################################################################
include $(BUILD_ROOT)/Makefiles/Rules.mak

View File

@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<project name="Benta4" basedir="." default="build">
<!--===========================================================================
Setup properties
============================================================================-->
<!-- home -->
<property name="bento4.home" value="../../.."/>
<!-- sources -->
<property name="src.dir" value="${bento4.home}/Source/Java"/>
<!-- build -->
<property name="build.dir" value="."/>
<property name="lib.dir" value="${build.dir}/lib"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="bento4.lib" value="${lib.dir}/bento4.jar"/>
<!--===========================================================================
Targets
============================================================================-->
<!--===========================================================================
prepare Target
============================================================================-->
<target name="prepare">
<mkdir dir="${classes.dir}"/>
<mkdir dir="${lib.dir}"/>
</target>
<!--===========================================================================
clean Target
============================================================================-->
<target name="clean">
<delete dir="${classes.dir}"/>
<delete>
<!-- spare the svn directories -->
<fileset dir="${lib.dir}" includes="**/*.*"/>
</delete>
</target>
<!--===========================================================================
compile Target
============================================================================-->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}" destdir="${classes.dir}"/>
</target>
<!--===========================================================================
jar Target
============================================================================-->
<target name="jar" depends="compile">
<jar jarfile="${bento4.lib}" basedir="${classes.dir}"/>
</target>
<!--===========================================================================
build Target
============================================================================-->
<target name="build" depends="jar"/>
<!--===========================================================================
all Target
============================================================================-->
<target name="all" depends="clean, build"/>
</project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="AP4"
ProjectGUID="{A714AA1C-45A9-403D-A6E1-020E520119A2}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/AP4.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/AP4.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ST|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/AP4.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\Ap4Lib.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Aac2Mp4"
ProjectGUID="{2FCE14C9-42A9-4335-96EF-8B52A321720E}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core;..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Codecs"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Aac2Mp4.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Aac2Mp4.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core;..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Codecs"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Aac2Mp4.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Aac2Mp4\Aac2Mp4.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,166 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core.vcproj", "{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "System", "System\System.vcproj", "{ED568A42-C87E-47F1-AE87-E0C13FF90F74}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp42Aac", "Mp42Aac\Mp42Aac.vcproj", "{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Tag", "Mp4Tag\Mp4Tag.vcproj", "{73804182-47BC-4885-898D-939CA8672828}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Aac2Mp4", "Aac2Mp4\Aac2Mp4.vcproj", "{2FCE14C9-42A9-4335-96EF-8B52A321720E}"
ProjectSection(ProjectDependencies) = postProject
{F90FCD13-0472-46B5-8C8F-0E45BE6E287B} = {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Dump", "Mp4Dump\Mp4Dump.vcproj", "{602F1304-0BE4-4C48-983E-9A4F84BD1585}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Info", "Mp4Info\Mp4Info.vcproj", "{52A6B013-A542-4F5C-838E-F582CC6EF903}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Codecs", "Codecs\Codecs.vcproj", "{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Crypto", "Crypto\Crypto.vcproj", "{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Decrypt", "Mp4Decrypt\Mp4Decrypt.vcproj", "{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Encrypt", "Mp4Encrypt\Mp4Encrypt.vcproj", "{D467C78F-53CD-4AE8-82D4-BAE42530262B}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Edit", "Mp4Edit\Mp4Edit.vcproj", "{1B0690B7-BD89-4F6E-9C4A-A76682898963}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AP4", "AP4\AP4.vcproj", "{A714AA1C-45A9-403D-A6E1-020E520119A2}"
ProjectSection(ProjectDependencies) = postProject
{F90FCD13-0472-46B5-8C8F-0E45BE6E287B} = {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Extract", "Mp4Extract\Mp4Extract.vcproj", "{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}"
ProjectSection(ProjectDependencies) = postProject
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
{ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4RtpHintInfo", "Mp4RtpHintInfo\Mp4RtpHintInfo.vcproj", "{D100E130-718D-4060-ACD9-1061A159DD79}"
ProjectSection(ProjectDependencies) = postProject
{A714AA1C-45A9-403D-A6E1-020E520119A2} = {A714AA1C-45A9-403D-A6E1-020E520119A2}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Debug.ActiveCfg = Debug|Win32
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Debug.Build.0 = Debug|Win32
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Release.ActiveCfg = Release|Win32
{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Release.Build.0 = Release|Win32
{ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Debug.ActiveCfg = Debug|Win32
{ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Debug.Build.0 = Debug|Win32
{ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Release.ActiveCfg = Release|Win32
{ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Release.Build.0 = Release|Win32
{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Debug.ActiveCfg = Debug|Win32
{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Debug.Build.0 = Debug|Win32
{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Release.ActiveCfg = Release|Win32
{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Release.Build.0 = Release|Win32
{73804182-47BC-4885-898D-939CA8672828}.Debug.ActiveCfg = Debug|Win32
{73804182-47BC-4885-898D-939CA8672828}.Debug.Build.0 = Debug|Win32
{73804182-47BC-4885-898D-939CA8672828}.Release.ActiveCfg = Release|Win32
{73804182-47BC-4885-898D-939CA8672828}.Release.Build.0 = Release|Win32
{2FCE14C9-42A9-4335-96EF-8B52A321720E}.Debug.ActiveCfg = Debug|Win32
{2FCE14C9-42A9-4335-96EF-8B52A321720E}.Debug.Build.0 = Debug|Win32
{2FCE14C9-42A9-4335-96EF-8B52A321720E}.Release.ActiveCfg = Release|Win32
{2FCE14C9-42A9-4335-96EF-8B52A321720E}.Release.Build.0 = Release|Win32
{602F1304-0BE4-4C48-983E-9A4F84BD1585}.Debug.ActiveCfg = Debug|Win32
{602F1304-0BE4-4C48-983E-9A4F84BD1585}.Debug.Build.0 = Debug|Win32
{602F1304-0BE4-4C48-983E-9A4F84BD1585}.Release.ActiveCfg = Release|Win32
{602F1304-0BE4-4C48-983E-9A4F84BD1585}.Release.Build.0 = Release|Win32
{52A6B013-A542-4F5C-838E-F582CC6EF903}.Debug.ActiveCfg = Debug|Win32
{52A6B013-A542-4F5C-838E-F582CC6EF903}.Debug.Build.0 = Debug|Win32
{52A6B013-A542-4F5C-838E-F582CC6EF903}.Release.ActiveCfg = Release|Win32
{52A6B013-A542-4F5C-838E-F582CC6EF903}.Release.Build.0 = Release|Win32
{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Debug.ActiveCfg = Debug|Win32
{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Debug.Build.0 = Debug|Win32
{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Release.ActiveCfg = Release|Win32
{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Release.Build.0 = Release|Win32
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Debug.ActiveCfg = Debug|Win32
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Debug.Build.0 = Debug|Win32
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Release.ActiveCfg = Release|Win32
{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Release.Build.0 = Release|Win32
{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Debug.ActiveCfg = Debug|Win32
{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Debug.Build.0 = Debug|Win32
{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Release.ActiveCfg = Release|Win32
{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Release.Build.0 = Release|Win32
{D467C78F-53CD-4AE8-82D4-BAE42530262B}.Debug.ActiveCfg = Debug|Win32
{D467C78F-53CD-4AE8-82D4-BAE42530262B}.Debug.Build.0 = Debug|Win32
{D467C78F-53CD-4AE8-82D4-BAE42530262B}.Release.ActiveCfg = Release|Win32
{D467C78F-53CD-4AE8-82D4-BAE42530262B}.Release.Build.0 = Release|Win32
{1B0690B7-BD89-4F6E-9C4A-A76682898963}.Debug.ActiveCfg = Debug|Win32
{1B0690B7-BD89-4F6E-9C4A-A76682898963}.Debug.Build.0 = Debug|Win32
{1B0690B7-BD89-4F6E-9C4A-A76682898963}.Release.ActiveCfg = Release|Win32
{1B0690B7-BD89-4F6E-9C4A-A76682898963}.Release.Build.0 = Release|Win32
{A714AA1C-45A9-403D-A6E1-020E520119A2}.Debug.ActiveCfg = Debug|Win32
{A714AA1C-45A9-403D-A6E1-020E520119A2}.Debug.Build.0 = Debug|Win32
{A714AA1C-45A9-403D-A6E1-020E520119A2}.Release.ActiveCfg = Release|Win32
{A714AA1C-45A9-403D-A6E1-020E520119A2}.Release.Build.0 = Release|Win32
{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Debug.ActiveCfg = Debug|Win32
{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Debug.Build.0 = Debug|Win32
{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Release.ActiveCfg = Release|Win32
{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Release.Build.0 = Release|Win32
{D100E130-718D-4060-ACD9-1061A159DD79}.Debug.ActiveCfg = Debug|Win32
{D100E130-718D-4060-ACD9-1061A159DD79}.Debug.Build.0 = Debug|Win32
{D100E130-718D-4060-ACD9-1061A159DD79}.Release.ActiveCfg = Release|Win32
{D100E130-718D-4060-ACD9-1061A159DD79}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Codecs"
ProjectGUID="{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/Codecs.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/Codecs.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ST|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/Codecs.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Codecs\Ap4AdtsParser.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Codecs\Ap4BitStream.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\..\..\..\Source\C++\Codecs\Ap4AdtsParser.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Codecs\Ap4BitStream.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,554 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Core"
RootNamespace="Core"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/Core.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\Core.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/Core.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\Core.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ST|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/Core.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\Core.lib"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Atom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4AtomFactory.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4AtomSampleTable.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4ByteStream.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4ContainerAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4CttsAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DataBuffer.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Debug.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DecoderConfigDescriptor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DecoderSpecificInfoDescriptor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Descriptor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DescriptorFactory.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DrefAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4EsDescriptor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4EsdsAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4File.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FileWriter.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FrmaAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FtypAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4HdlrAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4HintTrackReader.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4HmhdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4IkmsAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4IsfmAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4IsmaCryp.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4MdhdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4MoovAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Movie.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4MvhdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4NmhdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Processor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4RtpAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4RtpHint.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Sample.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SampleDescription.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SampleEntry.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SampleTable.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SchmAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SdpAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SLConfigDescriptor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SmhdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StcoAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StscAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StsdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StssAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StszAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SttsAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SyntheticSampleTable.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TimsAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TkhdAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Track.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TrakAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TrefTypeAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4UnknownDescriptor.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4UrlAtom.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Utils.cpp">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4VmhdAtom.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Array.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Atom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4AtomFactory.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4AtomSampleTable.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4ByteStream.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Config\Ap4Config.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Constants.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4ContainerAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4CttsAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DataBuffer.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Debug.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DecoderConfigDescriptor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DecoderSpecificInfoDescriptor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Descriptor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DescriptorFactory.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4DrefAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4EsDescriptor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4EsdsAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4File.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FileByteStream.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FileWriter.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FrmaAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4FtypAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4HdlrAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4HintTrackReader.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4HmhdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4IkmsAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Interfaces.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4IsfmAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4IsmaCryp.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4List.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4MdhdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4MoovAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Movie.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4MvhdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4NmhdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Processor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Results.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4RtpAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4RtpHint.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Sample.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SampleDescription.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SampleEntry.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SampleTable.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SchmAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SdpAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SLConfigDescriptor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SmhdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StcoAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StscAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StsdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StssAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4StszAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SttsAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4SyntheticSampleTable.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TimsAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TkhdAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Track.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TrakAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4TrefTypeAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Types.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4UnknownDescriptor.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4UrlAtom.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4Utils.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Core\Ap4VmhdAtom.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Crypto"
ProjectGUID="{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/Crypto.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/Crypto.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ST|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/Crypto.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Crypto\Ap4AesBlockCipher.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="FALSE"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
EnableFiberSafeOptimizations="TRUE"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Source\C++\Crypto\Ap4StreamCipher.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\..\..\..\Source\C++\Crypto\Ap4AesBlockCipher.h">
</File>
<File
RelativePath="..\..\..\..\Source\C++\Crypto\Ap4StreamCipher.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp42Aac"
ProjectGUID="{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/Ap42Aac.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Debug/Mp42Aac.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/Ap42Aac.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/Ap42Aac.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/Ap42Aac.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Release/Mp42Aac.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/Ap42Aac.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/Ap42Aac.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp42Aac\Mp42Aac.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Decrypt"
ProjectGUID="{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core;..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Decrypt.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Mp4Decrypt.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core;..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Decrypt.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\source\apps\mp4decrypt\Mp4Decrypt.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Dump"
ProjectGUID="{602F1304-0BE4-4C48-983E-9A4F84BD1585}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/Mp4Dump.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Debug/Mp4Dump.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/Mp4Dump.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/Mp4Dump.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/Mp4Dump.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Release/Mp4Dump.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/Mp4Dump.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/Mp4Dump.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4Dump\Mp4Dump.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Edit"
ProjectGUID="{1B0690B7-BD89-4F6E-9C4A-A76682898963}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Edit.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Mp4Process.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Edit.exe"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4Edit\Mp4Edit.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
RuntimeTypeInfo="TRUE"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
RuntimeTypeInfo="TRUE"/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Encrypt"
ProjectGUID="{D467C78F-53CD-4AE8-82D4-BAE42530262B}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core;..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Encrypt.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Mp4Encrypt.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core;..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Crypto"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Encrypt.exe"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4Encrypt\Mp4Encrypt.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Extract"
ProjectGUID="{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Extract.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Mp4Extract.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Extract.exe"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4Extract\Mp4Extract.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Info"
ProjectGUID="{52A6B013-A542-4F5C-838E-F582CC6EF903}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/Mp4Info.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Debug/Mp4Info.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/Mp4Info.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/Mp4Info.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/Mp4Info.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib"
OutputFile=".\Release/Mp4Info.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/Mp4Info.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/Mp4Info.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1036"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4Info\Mp4Info.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4RtpHintInfo"
ProjectGUID="{D100E130-718D-4060-ACD9-1061A159DD79}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4RtpHintInfo.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Mp4RtpHintInfo.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Config;..\..\..\..\Source\C++\Core"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4RtpHintInfo.exe"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4RtpHintInfo\Mp4RtpHintInfo.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Mp4Tag"
ProjectGUID="{73804182-47BC-4885-898D-939CA8672828}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Tag.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/Mp4Tag.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\..\..\..\Source\C++\Core,..\..\..\..\Source\C++\Config"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/Mp4Tag.exe"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source\C++ Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\..\..\..\Source\C++\Apps\Mp4Tag\Mp4Tag.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,20 @@
AP4_ROOT=../../..
SOURCE_ROOT=$AP4_ROOT/Source
BUILD_TARGET_DIR=$AP4_ROOT/Build/Targets/x86-microsoft-win32
CP="cp"
MKDIR="mkdir -p"
for config in Debug Release
do
SDK_DIR=$config/SDK
$MKDIR $SDK_DIR
$MKDIR $SDK_DIR/include
$MKDIR $SDK_DIR/bin
$MKDIR $SDK_DIR/lib
$CP $SOURCE_ROOT/Config/*.h $SDK_DIR/include
$CP $SOURCE_ROOT/Core/*.h $SDK_DIR/include
$CP $SOURCE_ROOT/Codecs/*.h $SDK_DIR/include
$CP $SOURCE_ROOT/Crypto/*.h $SDK_DIR/include
$CP $BUILD_TARGET_DIR/AP4/$config/AP4.lib $SDK_DIR/lib
$CP $BUILD_TARGET_DIR/*/$config/*.exe $SDK_DIR/bin
done

View File

@@ -0,0 +1,66 @@
#######################################################################
#
# Makefile for x86-unknown-cygwin
#
#######################################################################
all: Apps
#######################################################################
# configuration variables
#######################################################################
TARGET = x86-unknown-cygwin
ROOT = ../../../..
#######################################################################
# tools
#######################################################################
# how to make dependencies
AUTODEP_CPP = gcc -MM
# how to archive of object files
ARCHIVE = ld -r
# how to make a library
MAKELIB = ar rs
# how to optimize the layout of a library
RANLIB = ranlib
# how to strip executables
STRIP = strip
# how to compile source code
COMPILE_CPP = g++
# how to link object files
LINK_CPP = g++ -L.
# optimization flags
OPTIMIZE_CPP = -O6
# debug flags
DEBUG_CPP = -g
# profiling flags
PROFILE_CPP = -pg
# compilation flags
DEFINES_CPP = -D_REENTRANT -DAP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN
# warning flags
WARNINGS_CPP = -Wall -Werror -Wshadow -Wpointer-arith -Wcast-qual
# include directories
INCLUDES_CPP =
# libraries
LIBRARIES_CPP =
#######################################################################
# module selection
#######################################################################
FILE_BYTE_STREAM_IMPLEMENTATION = Ap4StdCFileByteStream
#######################################################################
# includes
#######################################################################
include $(ROOT)/Build/Makefiles/TopLevel.mak

View File

@@ -0,0 +1 @@
include ../../Makefiles/Bootstrap.mak

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse-cdt version="2.0"?>
<cdtproject id="org.eclipse.cdt.make.core.make">
<extension point="org.eclipse.cdt.core.BinaryParser" id="org.eclipse.cdt.core.ELF"/>
<extension point="org.eclipse.cdt.core.CIndexer" id="org.eclipse.cdt.core.domsourceindexer"/>
<data>
<item id="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
</target>
</buildTargets>
</item>
<item id="cdt_indexer">
<indexEnabled indexValue="false"/>
<indexerProblemsEnabled indexProblemsValue="0"/>
</item>
<item id="cdt_resolver">
<custom value="false"/>
</item>
<item id="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path="" excluding="Debug/|.cdtproject|.project|README.eclipse"/>
<pathentry kind="out" path=""/>
<pathentry kind="out" path="Debug"/>
</item>
</data>
</cdtproject>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AP4</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.make.core.makeBuilder</name>
<arguments>
<dictionary>
<key>org.eclipse.cdt.core.errorOutputParser</key>
<value>org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>clean all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.incrementalBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.make.core.makeNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
</natures>
<linkedResources>
<link>
<name>Makefiles</name>
<type>2</type>
<location>AP4_HOME/Build/Makefiles</location>
</link>
<link>
<name>Source</name>
<type>2</type>
<location>AP4_HOME/Source</location>
</link>
</linkedResources>
</projectDescription>

View File

@@ -0,0 +1,66 @@
#######################################################################
#
# AP4 Makefile for x86-unknown-linux
#
#######################################################################
all: Apps
#######################################################################
# configuration variables
#######################################################################
TARGET = x86-unknown-linux
ROOT = ../../../..
#######################################################################
# tools
#######################################################################
# how to make dependencies
AUTODEP_CPP = gcc -MM
# how to archive of object files
ARCHIVE = ld -r
# how to make a library
MAKELIB = ar rs
# how to optimize the layout of a library
RANLIB = ranlib
# how to strip executables
STRIP = strip
# how to compile source code
COMPILE_CPP = g++
# how to link object files
LINK_CPP = g++ -L.
# optimization flags
OPTIMIZE_CPP = -O6
# debug flags
DEBUG_CPP = -g
# profiling flags
PROFILE_CPP = -pg
# compilation flags
DEFINES_CPP = -D_REENTRANT -DAP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN
# warning flags
WARNINGS_CPP = -Wall -Werror -Wshadow -Wpointer-arith -Wcast-qual
# include directories
INCLUDES_CPP =
# libraries
LIBRARIES_CPP =
#######################################################################
# module selection
#######################################################################
FILE_BYTE_STREAM_IMPLEMENTATION = Ap4StdCFileByteStream
#######################################################################
# includes
#######################################################################
include $(ROOT)/Build/Makefiles/TopLevel.mak

View File

@@ -0,0 +1 @@
include ../../Makefiles/Bootstrap.mak

View File

@@ -0,0 +1,5 @@
The eclipse project has been successfully tested with Eclipse 3.0 M8 and the CDT plugin 2.0 M8 (http://www.eclipse.org/cdt).
in order to make the eclipse project work, you must define a linked resource variable AP4_HOME pointing on the root of your local copy the AP4 module.
Go to >Windows>Preferences>Workbench>Linked Resources and define the AP4_HOME variable.

1
README Normal file
View File

@@ -0,0 +1 @@
hello

View File

@@ -0,0 +1,194 @@
/*****************************************************************
|
| AP4 - AAC to MP4 Converter
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4File.h"
#include "Ap4FileWriter.h"
#include "Ap4FileByteStream.h"
#include "Ap4SyntheticSampleTable.h"
#include "Ap4AdtsParser.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "AAC to MP4 Converter - Version 0.1a - (c) 2002-2005 Gilles Boccon-Gibod"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: aac2mp4 [options] <input> <output>\n");
exit(1);
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
AP4_Result result;
if (argc < 2) {
PrintUsageAndExit();
}
// open the input
AP4_ByteStream* input;
try {
input = new AP4_FileByteStream(argv[1], AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception&) {
AP4_Debug("ERROR: cannot open input (%s)\n", argv[1]);
return 1;
}
// open the output
AP4_ByteStream* output = new AP4_FileByteStream(
argv[2],
AP4_FileByteStream::STREAM_MODE_WRITE);
// create a sample table
AP4_SyntheticSampleTable* sample_table = new AP4_SyntheticSampleTable();
// create an ADTS parser
AP4_AdtsParser parser;
bool initialized = false;
unsigned int sample_description_index = 0;
// read from the input, feed, and get AAC frames
AP4_UI32 sample_rate = 0;
AP4_Cardinal sample_count = 0;
bool eos = false;
for(;;) {
// try to get a frame
AP4_AacFrame frame;
result = parser.FindFrame(frame);
if (AP4_SUCCEEDED(result)) {
AP4_Debug("AAC frame [%06d]: size = %d, %d kHz, %d ch\n",
sample_count,
frame.m_Info.m_FrameLength,
frame.m_Info.m_SamplingFrequency,
frame.m_Info.m_ChannelConfiguration);
if (!initialized) {
initialized = true;
// create a sample description for our samples
AP4_DataBuffer dsi;
unsigned char aac_dsi[2] = {0x12, 0x10};
dsi.SetData(aac_dsi, 2);
AP4_MpegAudioSampleDescription* sample_description =
new AP4_MpegAudioSampleDescription(
AP4_MPEG4_AUDIO_OTI, // object type
frame.m_Info.m_SamplingFrequency,
16, // sample size
frame.m_Info.m_ChannelConfiguration,
&dsi, // decoder info
6144, // buffer size
128000, // max bitrate
128000); // average bitrate
sample_description_index = sample_table->AddSampleDescription(sample_description);
sample_rate = frame.m_Info.m_SamplingFrequency;
}
AP4_MemoryByteStream* sample_data = new AP4_MemoryByteStream(frame.m_Info.m_FrameLength);
frame.m_Source->ReadBytes(sample_data->GetBuffer(), frame.m_Info.m_FrameLength);
printf("%02x %02x %02x %02x\n",
sample_data->GetBuffer()[0],
sample_data->GetBuffer()[1],
sample_data->GetBuffer()[2],
sample_data->GetBuffer()[3]);
sample_table->AddSample(*sample_data, 0, frame.m_Info.m_FrameLength, sample_description_index);
sample_data->Release();
sample_count++;
} else {
if (eos) break;
}
// read some data and feed the parser
AP4_UI08 input_buffer[4096];
AP4_Size bytes_read = 0;
AP4_Size to_read = parser.GetBytesFree();
if (to_read) {
if (to_read > sizeof(input_buffer)) to_read = sizeof(input_buffer);
result = input->Read(input_buffer, to_read, &bytes_read);
if (AP4_SUCCEEDED(result)) {
AP4_Size to_feed = bytes_read;
result = parser.Feed(input_buffer, &to_feed);
if (AP4_FAILED(result)) {
AP4_Debug("ERROR: parser.Feed() failed (%d)\n", result);
return 1;
}
} else {
if (result == AP4_ERROR_EOS) {
eos = true;
}
}
}
}
// create an audio track
AP4_Track* track = new AP4_Track(AP4_Track::TYPE_AUDIO,
sample_table,
0, // track id
sample_rate, // movie time scale
sample_rate, // track time scale
sample_count*1024, // track duration
"eng", // language
0, 0); // width, height
// create a movie
AP4_Movie* movie = new AP4_Movie();
// add the track to the movie
movie->AddTrack(track);
// create a multimedia file
AP4_File* file = new AP4_File(movie);
// create a writer to write the file
AP4_FileWriter* writer = new AP4_FileWriter(*file);
// write the file to the output
writer->Write(*output);
delete writer;
delete file;
delete output;
return 0;
}

View File

@@ -0,0 +1,160 @@
/*****************************************************************
|
| AP4 - MP4 to AAC File Converter
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Atom.h"
#include "Ap4File.h"
#include "Ap4Sample.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 To AAC File Converter - Version 0.1a\n"\
"(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: ap42aac [options] <input> <output>\n");
exit(1);
}
/*----------------------------------------------------------------------
| WriteAdtsHeader
+---------------------------------------------------------------------*/
static AP4_Result
WriteAdtsHeader(AP4_ByteStream* output, unsigned int frame_size)
{
unsigned char bits[7];
bits[0] = 0xFF;
bits[1] = 0xF1; // 0xF9 (MPEG2)
bits[2] = 0x50;
bits[3] = 0x80 | ((frame_size+7) >> 11);
bits[4] = ((frame_size+7) >> 3)&0xFF;
bits[5] = (((frame_size+7) << 5)&0xFF) | 0x1F;
bits[6] = 0xFC;
return output->Write(bits, 7);
/*
0: syncword 12 always: '111111111111'
12: ID 1 0: MPEG-4, 1: MPEG-2
13: layer 2 always: '00'
15: protection_absent 1
16: profile 2
18: sampling_frequency_index 4
22: private_bit 1
23: channel_configuration 3
26: original/copy 1
27: home 1
28: emphasis 2 only if ID == 0
ADTS Variable header: these can change from frame to frame
28: copyright_identification_bit 1
29: copyright_identification_start 1
30: aac_frame_length 13 length of the frame including header (in bytes)
43: adts_buffer_fullness 11 0x7FF indicates VBR
54: no_raw_data_blocks_in_frame 2
ADTS Error check
crc_check 16 only if protection_absent == 0
*/
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 3) {
PrintUsageAndExit();
}
// create the input stream
AP4_ByteStream* input =
new AP4_FileByteStream(argv[1],
AP4_FileByteStream::STREAM_MODE_READ);
// create the output stream
AP4_ByteStream* output =
new AP4_FileByteStream(argv[2],
AP4_FileByteStream::STREAM_MODE_WRITE);
// open the file
AP4_File* input_file = new AP4_File(*input);
// get the movie
AP4_Movie* movie = input_file->GetMovie();
if (movie != NULL) {
AP4_List<AP4_Track>& tracks = movie->GetTracks();
AP4_Debug("Found %d Tracks\n", tracks.ItemCount());
// get audio track
AP4_Track* audio_track = movie->GetTrack(AP4_Track::TYPE_AUDIO);
if (audio_track != NULL) {
// show info
AP4_Debug("Audio Track:\n");
AP4_Debug(" duration: %ld ms\n", audio_track->GetDurationMs());
AP4_Debug(" sample count: %ld\n", audio_track->GetSampleCount());
AP4_Sample sample;
AP4_DataBuffer data;
AP4_Ordinal index = 0;
while (AP4_SUCCEEDED(audio_track->ReadSample(index, sample, data))) {
WriteAdtsHeader(output, sample.GetSize());
output->Write(data.GetData(), data.GetDataSize());
AP4_Debug(" [%d] writing %ld bytes of data...\n",
index, sample.GetSize());
index++;
}
} else {
AP4_Debug("No Audio Track found\n");
}
} else {
AP4_Debug("No Movie in file\n");
}
delete input_file;
input->Release();
output->Release();
return 0;
}

View File

@@ -0,0 +1,157 @@
/*****************************************************************
|
| AP4 - MP4 Decrypter
|
| Copyright 2005 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Atom.h"
#include "Ap4File.h"
#include "Ap4Sample.h"
#include "Ap4SampleDescription.h"
#include "Ap4IsmaCryp.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 Decrypter - Version 0.1a\n"\
"(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\n"
"usage: mp4decrypt [--key <n>:<k>:<salt>] <input> <output>\n"
" where <n> is a track index, <k> a 128-bit key in hex\n"
" and <salt> a 128-bit salting key\n"
" (several --key options can be used, one for each track)\n");
exit(1);
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 3) {
PrintUsageAndExit();
}
// create a decrypting processor
AP4_IsmaDecryptingProcessor processor;
// parse options
const char* input_filename = NULL;
const char* output_filename = NULL;
char* arg;
while ((arg = *++argv)) {
if (!strcmp(arg, "--key")) {
arg = *++argv;
if (arg == NULL) {
fprintf(stderr, "ERROR: missing argument after --key option\n");
return 1;
}
char* track_ascii = NULL;
char* key_ascii = NULL;
char* salt_ascii = NULL;
if (AP4_SplitArgs(arg, track_ascii, key_ascii, salt_ascii)) {
fprintf(stderr, "ERROR: invalid argument for --key option\n");
return 1;
}
unsigned char key[16];
unsigned char salt[16];
unsigned int track = strtoul(track_ascii, NULL, 10);
if (AP4_ParseHex(key_ascii, key, 16)) {
fprintf(stderr, "ERROR: invalid hex format for key\n");
}
if (AP4_ParseHex(salt_ascii, salt, 8)) {
fprintf(stderr, "ERROR: invalid hex format for salt\n");
}
// set the key in the map
processor.GetKeyMap().SetKey(track, key, salt);
} else if (input_filename == NULL) {
input_filename = arg;
} else if (output_filename == NULL) {
output_filename = arg;
} else {
fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg);
return 1;
}
}
// check the arguments
if (input_filename == NULL) {
fprintf(stderr, "ERROR: missing input filename\n");
return 1;
}
if (output_filename == NULL) {
fprintf(stderr, "ERROR: missing output filename\n");
return 1;
}
// create the input stream
AP4_ByteStream* input;
try{
input = new AP4_FileByteStream(input_filename,
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
return 1;
}
// create the output stream
AP4_ByteStream* output;
try {
output = new AP4_FileByteStream(output_filename,
AP4_FileByteStream::STREAM_MODE_WRITE);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
return 1;
}
// process/decrypt the file
processor.Process(*input, *output);
// cleanup
input->Release();
output->Release();
return 0;
}

View File

@@ -0,0 +1,166 @@
/*****************************************************************
|
| AP4 - MP4 File Dumper
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Atom.h"
#include "Ap4File.h"
#include "Ap4Sample.h"
#include "Ap4DataBuffer.h"
#include "Ap4AtomFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 File Dumper - Version 0.2a\n"\
"(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: mp4dump [options] <input>\n"
"options are:\n"
" -track <track_id> <data_file>: writes the track data in data_file");
exit(1);
}
/*----------------------------------------------------------------------
| DumpTrackData
+---------------------------------------------------------------------*/
void
DumpTrackData(AP4_File* mp4_file, AP4_UI32 track_id, AP4_ByteStream* track_data)
{
// get the track
AP4_Track* track = mp4_file->GetMovie()->GetTrack(track_id);
if (track == NULL) {
fprintf(stderr, "track not found (id = %d)", track_id);
return;
}
// write the data
AP4_Sample sample;
AP4_DataBuffer sample_data;
AP4_Ordinal index = 0;
while (AP4_SUCCEEDED(track->ReadSample(index, sample, sample_data))) {
track_data->Write(sample_data.GetData(), sample_data.GetDataSize());
index++;
}
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 2) {
PrintUsageAndExit();
}
// init the variables
AP4_UI32 track_id = 0;
AP4_ByteStream* input = NULL;
AP4_ByteStream* track_data = NULL;
// parse the command line
argv++;
char* arg;
while ((arg = *argv++)) {
if (!strcmp(arg, "-track")) {
if (argv[0] && argv[1] && argv[2]) {
track_id = atoi(argv[0]);
if (track_id == 0) PrintUsageAndExit();
track_data =
new AP4_FileByteStream(argv[1],
AP4_FileByteStream::STREAM_MODE_WRITE);
argv += 2;
} else {
PrintUsageAndExit();
}
} else {
try {
input =
new AP4_FileByteStream(arg,
AP4_FileByteStream::STREAM_MODE_READ);
} catch(AP4_Exception e) {
AP4_Debug("ERROR: cannot open input (%d)\n", e.m_Error);
return 1;
}
}
}
// open the output
AP4_ByteStream* output =
new AP4_FileByteStream("-stdout",
AP4_FileByteStream::STREAM_MODE_WRITE);
// create an inspector
AP4_PrintInspector inspector(*output);
// inspect the atoms one by one
AP4_Atom* atom;
//for (int i=0; i<1000; i++) {
AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory;
//MyTypeHandler my_type_handler;
//atom_factory.AddTypeHandler(&my_type_handler);
while (atom_factory.CreateAtomFromStream(*input, atom) ==
AP4_SUCCESS) {
atom->Inspect(inspector);
delete atom;
}
// inspect the track data if needed
if ((track_id != 0) && (track_data != NULL)) {
// rewind
input->Seek(0);
// dump the track data
AP4_File* file = new AP4_File(*input);
DumpTrackData(file, track_id, track_data);
delete file;
}
if (input) input->Release();
if (output) output->Release();
if (track_data) track_data->Release();
return 0;
}

View File

@@ -0,0 +1,400 @@
/*****************************************************************
|
| AP4 - MP4 File Processor
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Processor.h"
#include "Ap4Utils.h"
#include "Ap4ContainerAtom.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 File Editor - Version 0.5a\n"\
"(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: mp4edit [commands] <input> <output>\n"
" where commands include one or more of:\n"
" --insert <atom_name>:<source_file>[:<position>]\n"
" --remove <atom_name>\n"
" --replace <atom_name>:<source_file>\n");
exit(1);
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor
+---------------------------------------------------------------------*/
class AP4_EditingProcessor : public AP4_Processor
{
public:
// types
class Command {
public:
// types
typedef enum {
TYPE_INSERT,
TYPE_REMOVE,
TYPE_REPLACE
} Type;
// constructor
Command(Type type, const char* atom_path,
const char* file_path,
int position = -1) :
m_Type(type),
m_AtomPath(atom_path),
m_FilePath(file_path),
m_Position(position) {}
// members
Type m_Type;
AP4_String m_AtomPath;
AP4_String m_FilePath;
int m_Position;
};
// constructor and destructor
virtual ~AP4_EditingProcessor();
// methods
virtual AP4_Result Initialize(AP4_AtomParent& top_level);
AP4_Result AddCommand(Command::Type type,
const char* atom_path,
const char* file_path,
int position = -1);
private:
// methods
AP4_Result InsertAtom(const char* file_path,
AP4_AtomParent* container,
int position);
AP4_Result DoRemove(Command* command, AP4_AtomParent& top_level);
AP4_Result DoInsert(Command* command, AP4_AtomParent& top_level);
AP4_Result DoReplace(Command* command, AP4_AtomParent& top_level);
// members
AP4_List<Command> m_Commands;
AP4_AtomParent m_TopLevelParent;
};
/*----------------------------------------------------------------------
| AP4_EditingProcessor::~AP4_EditingProcessor
+---------------------------------------------------------------------*/
AP4_EditingProcessor::~AP4_EditingProcessor()
{
m_Commands.DeleteReferences();
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor::AddCommand
+---------------------------------------------------------------------*/
AP4_Result
AP4_EditingProcessor::AddCommand(Command::Type type,
const char* atom_path,
const char* file_path,
int position)
{
return m_Commands.Add(new Command(type, atom_path, file_path, position));
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor::Initialize
+---------------------------------------------------------------------*/
AP4_Result
AP4_EditingProcessor::Initialize(AP4_AtomParent& top_level)
{
AP4_Result result;
AP4_List<Command>::Item* command_item = m_Commands.FirstItem();
while (command_item) {
Command* command = command_item->GetData();
switch (command->m_Type) {
case Command::TYPE_REMOVE:
result = DoRemove(command, top_level);
if (AP4_FAILED(result)) return result;
break;
case Command::TYPE_INSERT:
result = DoInsert(command, top_level);
if (AP4_FAILED(result)) return result;
break;
case Command::TYPE_REPLACE:
result = DoReplace(command, top_level);
if (AP4_FAILED(result)) return result;
break;
}
command_item = command_item->GetNext();
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor::DoRemove
+---------------------------------------------------------------------*/
AP4_Result
AP4_EditingProcessor::DoRemove(Command* command, AP4_AtomParent& top_level)
{
AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str());
if (atom == NULL) {
fprintf(stderr, "ERROR: atom '%s' not found\n", command->m_AtomPath.c_str());
return AP4_FAILURE;
} else {
atom->Detach();
delete atom;
return AP4_SUCCESS;
}
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor::InsertAtom
+---------------------------------------------------------------------*/
AP4_Result
AP4_EditingProcessor::InsertAtom(const char* file_path,
AP4_AtomParent* container,
int position)
{
// read the atom to insert
AP4_Atom* child = NULL;
AP4_ByteStream* input;
try {
input = new AP4_FileByteStream(file_path,
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open atom file (%s)\n", file_path);
return AP4_FAILURE;
}
AP4_Result result;
result = AP4_AtomFactory::DefaultFactory.CreateAtomFromStream(*input, child);
input->Release();
if (AP4_FAILED(result)) {
fprintf(stderr, "ERROR: failed to create atom\n");
return AP4_FAILURE;
}
// insert the atom
result = container->AddChild(child, position);
if (AP4_FAILED(result)) {
fprintf(stderr, "ERROR: failed to insert atom\n");
delete child;
return result;
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor::DoInsert
+---------------------------------------------------------------------*/
AP4_Result
AP4_EditingProcessor::DoInsert(Command* command, AP4_AtomParent& top_level)
{
AP4_AtomParent* parent = NULL;
if (command->m_AtomPath.length() == 0) {
// insert into the toplevel list
parent = &top_level;
} else {
// find the atom to insert into
AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str(), true);
if (atom == NULL) {
fprintf(stderr, "ERROR: atom '%s' not found\n",
command->m_AtomPath.c_str());
return AP4_FAILURE;
}
// check that the atom is a container
parent = dynamic_cast<AP4_AtomParent*>(atom);
}
// check that we have a place to insert into
if (parent == NULL) {
fprintf(stderr, "ERROR: atom '%s' is not a container\n",
command->m_AtomPath.c_str());
return AP4_FAILURE;
}
return InsertAtom(command->m_FilePath.c_str(), parent, command->m_Position);
}
/*----------------------------------------------------------------------
| AP4_EditingProcessor::DoReplace
+---------------------------------------------------------------------*/
AP4_Result
AP4_EditingProcessor::DoReplace(Command* command, AP4_AtomParent& top_level)
{
// remove the atom
AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str());
if (atom == NULL) {
fprintf(stderr, "ERROR: atom '%s' not found\n", command->m_AtomPath.c_str());
return AP4_FAILURE;
} else {
// find the position of the atom in the parent
AP4_AtomParent* parent = atom->GetParent();
int position = 0;
AP4_List<AP4_Atom>::Item* list_item = parent->GetChildren().FirstItem();
while (list_item) {
if (list_item->GetData() == atom) break;
position++;
list_item = list_item->GetNext();
}
// remove the atom from the parent
atom->Detach();
delete atom;
// insert the replacement
return InsertAtom(command->m_FilePath.c_str(), parent, position);
}
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 3) {
PrintUsageAndExit();
}
// create initial objects
AP4_EditingProcessor processor;
// parse arguments
const char* input_filename = NULL;
const char* output_filename = NULL;
char* arg;
while ((arg = *++argv)) {
if (!strcmp(arg, "--insert")) {
char* param = *++argv;
if (param == NULL) {
fprintf(stderr, "ERROR: missing argument for --insert command\n");
return 1;
}
char* atom_path = NULL;
char* file_path = NULL;
if (AP4_SUCCEEDED(AP4_SplitArgs(param, atom_path, file_path))) {
int position = -1;
char* position_str = NULL;
if (AP4_SUCCEEDED(AP4_SplitArgs(file_path, file_path, position_str))) {
if (position_str) {
position = strtoul(position_str, NULL, 10);
}
}
processor.AddCommand(AP4_EditingProcessor::Command::TYPE_INSERT, atom_path, file_path, position);
} else {
fprintf(stderr, "ERROR: invalid format for --insert command argument\n");
return 1;
}
} else if (!strcmp(arg, "--remove")) {
char* atom_path = *++argv;
if (atom_path == NULL) {
fprintf(stderr, "ERROR: missing argument for --remove command\n");
return 1;
}
processor.AddCommand(AP4_EditingProcessor::Command::TYPE_REMOVE, atom_path, "");
} else if (!strcmp(arg, "--replace")) {
char* param = *++argv;
if (param == NULL) {
fprintf(stderr, "ERROR: missing argument for --replace command\n");
return 1;
}
char* atom_path = NULL;
char* file_path = NULL;
if (AP4_SUCCEEDED(AP4_SplitArgs(param, atom_path, file_path))) {
processor.AddCommand(AP4_EditingProcessor::Command::TYPE_REPLACE, atom_path, file_path);
} else {
fprintf(stderr, "ERROR: invalid format for --replace command argument\n");
return 1;
}
} else if (input_filename == NULL) {
input_filename = arg;
} else if (output_filename == NULL) {
output_filename = arg;
} else {
fprintf(stderr, "ERROR: invalid command line argument (%s)\n", arg);
return 1;
}
}
// check arguments
if (input_filename == NULL) {
fprintf(stderr, "ERROR: missing input filename\n");
return 1;
}
if (output_filename == NULL) {
fprintf(stderr, "ERROR: missing output filename\n");
return 1;
}
// create the input stream
AP4_ByteStream* input = NULL;
try {
input = new AP4_FileByteStream(input_filename,
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
return 1;
}
// create the output stream
AP4_ByteStream* output = NULL;
try {
output = new AP4_FileByteStream(output_filename,
AP4_FileByteStream::STREAM_MODE_WRITE);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
input->Release();
return 1;
}
// process!
processor.Process(*input, *output);
// cleanup
input->Release();
output->Release();
return 0;
}

View File

@@ -0,0 +1,168 @@
/*****************************************************************
|
| AP4 - MP4 Encrypter
|
| Copyright 2005 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Atom.h"
#include "Ap4File.h"
#include "Ap4Sample.h"
#include "Ap4SampleDescription.h"
#include "Ap4IsmaCryp.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 Encrypter - Version 0.1a\n"\
"(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\n"
"usage: mp4encrypt --kms-uri <uri> [--key <n>:<k>:<salt>] <input> <output>\n"
" where <n> is a track index, <k> a 128-bit key in hex\n"
" and <salt> a 128-bit salting key\n"
" (several --key options can be used, one for each track)\n");
exit(1);
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 5) {
PrintUsageAndExit();
}
// parse options
if (strcmp(*++argv, "--kms-uri")) {
fprintf(stderr, "ERROR: the first option must be --kms-uri\n");
return 1;
}
const char* kms_uri = *++argv;
// create an encrypting processor
AP4_IsmaEncryptingProcessor processor(kms_uri);
// setup default values
const char* input_filename = NULL;
const char* output_filename = NULL;
char* arg;
while ((arg = *++argv)) {
if (!strcmp(arg, "--key")) {
arg = *++argv;
if (arg == NULL) {
fprintf(stderr, "ERROR: missing argument for --key option\n");
return 1;
}
char* track_ascii = NULL;
char* key_ascii = NULL;
char* salt_ascii = NULL;
if (AP4_FAILED(AP4_SplitArgs(arg, track_ascii, key_ascii, salt_ascii))) {
fprintf(stderr, "ERROR: invalid argument for --key option\n");
return 1;
}
unsigned char key[16];
unsigned char salt[8];
unsigned int track = strtoul(track_ascii, NULL, 10);
if (AP4_ParseHex(key_ascii, key, 16)) {
fprintf(stderr, "ERROR: invalid hex format for key\n");
}
if (AP4_ParseHex(salt_ascii, salt, 8)) {
fprintf(stderr, "ERROR: invalid hex format for salt\n");
}
// set the key in the map
processor.GetKeyMap().SetKey(track, key, salt);
} else if (input_filename == NULL) {
input_filename = arg;
} else if (output_filename == NULL) {
output_filename = arg;
} else {
fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg);
return 1;
}
}
// check the arguments
if (input_filename == NULL) {
fprintf(stderr, "ERROR: missing input filename\n");
return 1;
}
if (output_filename == NULL) {
fprintf(stderr, "ERROR: missing output filename\n");
return 1;
}
if (kms_uri == NULL) {
fprintf(stderr, "ERROR: missing kms uri\n");
return 1;
}
// create the input stream
AP4_ByteStream* input;
try{
input = new AP4_FileByteStream(input_filename,
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
return 1;
}
// create the output stream
AP4_ByteStream* output;
try {
output = new AP4_FileByteStream(output_filename,
AP4_FileByteStream::STREAM_MODE_WRITE);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
return 1;
}
// process/decrypt the file
processor.Process(*input, *output);
// cleanup
input->Release();
output->Release();
return 0;
}

View File

@@ -0,0 +1,155 @@
/*****************************************************************
|
| AP4 - MP4 File Processor
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4AtomFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 Atom Extractor - Version 0.5a\n"\
"(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: mp4extract [options] <atom_path> <input> <output>\n"
" options:\n"
" --payload-only : ommit the atom header\n");
exit(1);
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 4) {
PrintUsageAndExit();
}
// parse arguments
const char* atom_path = NULL;
const char* input_filename = NULL;
const char* output_filename = NULL;
bool payload_only = false;
char* arg;
while ((arg = *++argv)) {
if (!strcmp(arg, "--payload-only")) {
payload_only = true;
} else if (atom_path == NULL) {
atom_path = arg;
} else if (input_filename == NULL) {
input_filename = arg;
} else if (output_filename == NULL) {
output_filename = arg;
} else {
fprintf(stderr, "ERROR: invalid command line argument (%s)\n", arg);
return 1;
}
}
// check arguments
if (atom_path == NULL) {
fprintf(stderr, "ERROR: missing atom path\n");
return 1;
}
if (input_filename == NULL) {
fprintf(stderr, "ERROR: missing input filename\n");
return 1;
}
if (output_filename == NULL) {
fprintf(stderr, "ERROR: missing output filename\n");
return 1;
}
// create the input stream
AP4_ByteStream* input;
try {
input = new AP4_FileByteStream(input_filename,
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
return 1;
}
// parse the atoms
AP4_AtomParent top_level;
AP4_Atom* atom;
AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory;
while (atom_factory.CreateAtomFromStream(*input, atom) == AP4_SUCCESS) {
top_level.AddChild(atom);
}
// release the input
input->Release();
// find the atom
atom = top_level.FindChild(atom_path);
if (atom == NULL) {
fprintf(stderr, "ERROR: atom '%s' not found\n", atom_path);
return 1;
}
// create the output stream
AP4_ByteStream* output;
try {
output = new AP4_FileByteStream(output_filename,
AP4_FileByteStream::STREAM_MODE_WRITE);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
return 1;
}
// write the atom
if (payload_only) {
atom->WriteFields(*output);
} else {
atom->Write(*output);
}
// cleanup
output->Release();
return 0;
}

View File

@@ -0,0 +1,233 @@
/*****************************************************************
|
| AP4 - MP4 File Info
|
| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Atom.h"
#include "Ap4File.h"
#include "Ap4Sample.h"
#include "Ap4SampleDescription.h"
#include "Ap4IsmaCryp.h"
#include "Ap4IsfmAtom.h"
#include "Ap4IkmsAtom.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 File Info - Version 0.1a\n"\
"(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: mp4info [options] <input>\n");
exit(1);
}
/*----------------------------------------------------------------------
| ShowIsmaSampleDescription
+---------------------------------------------------------------------*/
static void
ShowIsmaSampleDescription(AP4_IsmaCrypSampleDescription* desc)
{
if (desc == NULL) return;
AP4_Debug(" [ENCRYPTED]\n");
char coding[5];
AP4_FormatFourChars(coding, desc->GetFormat());
AP4_Debug(" Coding: %s\n", coding);
AP4_UI32 st = desc->GetSchemeType();
AP4_Debug(" Scheme Type: %c%c%c%c\n",
(char)((st>>24) & 0xFF),
(char)((st>>16) & 0xFF),
(char)((st>> 8) & 0xFF),
(char)((st ) & 0xFF));
AP4_Debug(" Scheme Version: %d\n", desc->GetSchemeVersion());
AP4_Debug(" Scheme URI: %s\n", desc->GetSchemeUri().c_str());
AP4_IsmaCrypSchemeInfo* scheme_info = desc->GetSchemeInfo();
if (scheme_info == NULL) return;
if (desc->GetSchemeType() != AP4_ISMACRYP_SCHEME_TYPE_IAEC) {
return;
}
AP4_Debug(" iAEC Scheme Info:\n");
AP4_IkmsAtom* ikms = (AP4_IkmsAtom*)scheme_info->GetSchiAtom().FindChild("iKMS");
if (ikms) {
AP4_Debug(" KMS URI: %s\n", ikms->GetKmsUri().c_str());
}
AP4_IsfmAtom* isfm = (AP4_IsfmAtom*)scheme_info->GetSchiAtom().FindChild("iSFM");
if (isfm) {
AP4_Debug(" Selective Encryption: %s\n", isfm->GetSelectiveEncryption()?"yes":"no");
AP4_Debug(" Key Indicator Length: %d\n", isfm->GetKeyIndicatorLength());
AP4_Debug(" IV Length: %d\n", isfm->GetIvLength());
}
}
/*----------------------------------------------------------------------
| ShowSampleDescription
+---------------------------------------------------------------------*/
static void
ShowSampleDescription(AP4_SampleDescription* desc)
{
if (desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
AP4_IsmaCrypSampleDescription* isma_desc = dynamic_cast<AP4_IsmaCrypSampleDescription*>(desc);
ShowIsmaSampleDescription(isma_desc);
desc = isma_desc->GetOriginalSampleDescription();
}
char coding[5];
AP4_FormatFourChars(coding, desc->GetFormat());
AP4_Debug( " Coding: %s\n", coding);
if (desc->GetType() == AP4_SampleDescription::TYPE_MPEG) {
AP4_MpegSampleDescription* mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
AP4_Debug(" Stream Type: %s\n", mpeg_desc->GetStreamTypeString(mpeg_desc->GetStreamType()));
AP4_Debug(" Object Type: %s\n", mpeg_desc->GetObjectTypeString(mpeg_desc->GetObjectTypeId()));
AP4_Debug(" Max Bitrate: %d\n", mpeg_desc->GetMaxBitrate());
AP4_Debug(" Avg Bitrate: %d\n", mpeg_desc->GetAvgBitrate());
AP4_Debug(" Buffer Size: %d\n", mpeg_desc->GetBufferSize());
}
AP4_AudioSampleDescription* audio_desc =
dynamic_cast<AP4_AudioSampleDescription*>(desc);
if (audio_desc) {
AP4_Debug(" Sample Rate: %d\n", audio_desc->GetSampleRate());
AP4_Debug(" Sample Size: %d\n", audio_desc->GetSampleSize());
AP4_Debug(" Channels: %d\n", audio_desc->GetChannelCount());
}
AP4_VideoSampleDescription* video_desc =
dynamic_cast<AP4_VideoSampleDescription*>(desc);
if (video_desc) {
AP4_Debug(" Width: %d\n", video_desc->GetWidth());
AP4_Debug(" Height: %d\n", video_desc->GetHeight());
AP4_Debug(" Depth: %d\n", video_desc->GetDepth());
}
}
/*----------------------------------------------------------------------
| ShowTrackInfo
+---------------------------------------------------------------------*/
static void
ShowTrackInfo(AP4_Track* track)
{
AP4_Debug(" id: %ld\n", track->GetId());
AP4_Debug(" type: ");
switch (track->GetType()) {
case AP4_Track::TYPE_AUDIO: AP4_Debug("Audio\n"); break;
case AP4_Track::TYPE_VIDEO: AP4_Debug("Video\n"); break;
case AP4_Track::TYPE_HINT: AP4_Debug("Hint\n"); break;
default: AP4_Debug("System\n");break;
}
AP4_Debug(" duration: %ld ms\n", track->GetDurationMs());
AP4_Debug(" timescale: %ld\n", track->GetMediaTimeScale());
AP4_Debug(" sample count: %ld\n", track->GetSampleCount());
AP4_Sample sample;
AP4_Ordinal index = 0;
AP4_Ordinal desc_index = 0xFFFFFFFF;
while (AP4_SUCCEEDED(track->GetSample(index, sample))) {
if (sample.GetDescriptionIndex() != desc_index) {
desc_index = sample.GetDescriptionIndex();
AP4_Debug(" [%d]: Sample Description %d\n", index, desc_index);
// get the sample description
AP4_SampleDescription* sample_desc =
track->GetSampleDescription(desc_index);
if (sample_desc != NULL) {
ShowSampleDescription(sample_desc);
}
}
index++;
}
}
/*----------------------------------------------------------------------
| ShowMovieInfo
+---------------------------------------------------------------------*/
static void
ShowMovieInfo(AP4_Movie* movie)
{
AP4_Debug("Movie:\n");
AP4_Debug(" duration: %ld ms\n", movie->GetDurationMs());
AP4_Debug(" time scale: %ld\n", movie->GetTimeScale());
AP4_Debug("\n");
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 2) {
PrintUsageAndExit();
}
AP4_ByteStream* input;
try {
input = new AP4_FileByteStream(argv[1],
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", argv[1]);
return 1;
}
AP4_File* file = new AP4_File(*input);
AP4_Movie* movie = file->GetMovie();
if (movie != NULL) {
ShowMovieInfo(movie);
AP4_List<AP4_Track>& tracks = movie->GetTracks();
AP4_Debug("Found %d Tracks\n", tracks.ItemCount());
AP4_List<AP4_Track>::Item* track_item = tracks.FirstItem();
int index = 1;
while (track_item) {
AP4_Debug("Track %d:\n", index);
index++;
ShowTrackInfo(track_item->GetData());
track_item = track_item->GetNext();
}
} else {
AP4_Debug("No movie found in the file\n");
}
delete file;
input->Release();
return 0;
}

View File

@@ -0,0 +1,171 @@
/*****************************************************************
|
| AP4 - MP4 Rtp Hint Info
|
| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4HintTrackReader.h"
#include "Ap4ByteStream.h"
#include "Ap4File.h"
#include "Ap4Movie.h"
#include "Ap4FileByteStream.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 Rtp Hint Info - Version 0.1a\n"\
"(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: mp4rtphintinfo [--trackid<hinttrackid>] <input>\n");
exit(1);
}
/*----------------------------------------------------------------------
| DumpRtpPackets
+---------------------------------------------------------------------*/
static AP4_Result
DumpRtpPackets(AP4_HintTrackReader& reader, const char* file_name)
{
// create the output stream
AP4_ByteStream* output;
try {
output = new AP4_FileByteStream(file_name,
AP4_FileByteStream::STREAM_MODE_WRITE);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open output file (%s)\n", file_name);
return AP4_FAILURE;
}
// read the packets from the reader and write them in the output stream
AP4_DataBuffer data(1500);
AP4_TimeStamp ts;
while(AP4_SUCCEEDED(reader.GetNextPacket(data, ts))) {
output->Write(data.GetData(), data.GetDataSize());
AP4_Debug("#########\n\tpacket contains %d bytes\n", data.GetDataSize());
AP4_Debug("\tsent at time stamp %d\n\n", ts);
}
output->Release();
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
AP4_Result result = AP4_SUCCESS;
// parse the command line
if (argc != 4) PrintUsageAndExit();
// parse options
const char* input_filename = NULL;
AP4_UI32 hint_track_id = 0;
char* arg;
while ((arg = *++argv)) {
if (!strcmp(arg, "--trackid")) {
arg = *++argv;
if (arg == NULL) {
fprintf(stderr, "ERROR: missing argument after --trackid option\n");
PrintUsageAndExit();
}
hint_track_id = atoi(arg);
} else if (input_filename == NULL) {
input_filename = arg;
} else {
fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg);
return 1;
}
}
// create the input stream
AP4_ByteStream* input;
try {
input = new AP4_FileByteStream(input_filename,
AP4_FileByteStream::STREAM_MODE_READ);
} catch (AP4_Exception) {
fprintf(stderr, "ERROR: cannot open input file (%s)\n", argv[1]);
PrintUsageAndExit();
}
AP4_File* file = new AP4_File(*input);
AP4_Movie* movie = file->GetMovie();
if (movie != NULL) {
// get a hint track reader
AP4_Track* hint_track = movie->GetTrack(hint_track_id);
if (hint_track == NULL) {
fprintf(stderr, "ERROR: No track for track id (%d)\n", hint_track_id);
return AP4_FAILURE;
}
if (hint_track->GetType() != AP4_Track::TYPE_HINT) {
fprintf(stderr, "track of id (%d) is not of type 'hint'\n", hint_track_id);
return AP4_FAILURE;
}
AP4_HintTrackReader reader(*hint_track, *movie, 0x01020304);
char rtp_file_name[256];
sprintf(rtp_file_name, "%s-track-%d.rtp", input_filename, hint_track_id);
// display the sdp
AP4_String sdp;
reader.GetSdpText(sdp);
AP4_Debug("sdp:\n%s\n\n", sdp.c_str());
// dump the packet
result = DumpRtpPackets(reader, rtp_file_name);
if (AP4_FAILED(result)) goto bail;
} else {
AP4_Debug("No movie found in the file\n");
return AP4_FAILURE;
}
bail:
delete file;
input->Release();
return result;
}

View File

@@ -0,0 +1,85 @@
/*****************************************************************
|
| AP4 - MP4 File Tagger
|
| Copyright 2002-2003 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include "Ap4.h"
#include "Ap4FileByteStream.h"
#include "Ap4Atom.h"
#include "Ap4File.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define BANNER "MP4 File Tagger - Version 0.1a\n"\
"(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
/*----------------------------------------------------------------------
| PrintUsageAndExit
+---------------------------------------------------------------------*/
static void
PrintUsageAndExit()
{
fprintf(stderr,
BANNER
"\n\nusage: mp4tag [options] <input> <output>\n");
exit(1);
}
/*----------------------------------------------------------------------
| main
+---------------------------------------------------------------------*/
int
main(int argc, char** argv)
{
if (argc < 3) {
PrintUsageAndExit();
}
AP4_ByteStream* input =
new AP4_FileByteStream(argv[1],
AP4_FileByteStream::STREAM_MODE_READ);
AP4_ByteStream* output =
new AP4_FileByteStream(argv[2],
AP4_FileByteStream::STREAM_MODE_WRITE);
AP4_File* file = new AP4_File(*input);
//file->Write(output);
printf("Successfully wrote %s in %s\n", argv[1], argv[2]);
delete file;
delete input;
delete output;
return 0;
}

View File

@@ -0,0 +1,303 @@
/*****************************************************************
|
| File: Ap4AdtsParser.c
|
| AP4 - ADTS Parser
|
| (c) 2005 Gilles Boccon-Gibod
| Author: Gilles Boccon-Gibod (bok@bok.net)
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4BitStream.h"
#include "Ap4AdtsParser.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define AP4_ADTS_HEADER_SIZE 7
#define AP4_ADTS_SYNC_MASK 0xFFF6 /* 12 sync bits plus 2 layer bits */
#define AP4_ADTS_SYNC_PATTERN 0xFFF0 /* 12 sync bits=1 layer=0 */
const unsigned long
AP4_AdtsSamplingFrequencyTable[16] =
{
96000,
88200,
64000,
48000,
44100,
32000,
24000,
22050,
16000,
12000,
11025,
8000,
7350,
0, /* Reserved */
0, /* Reserved */
0 /* Escape code */
};
/*----------------------------------------------------------------------+
| AP4_AdtsHeader::AP4_AdtsHeader
+----------------------------------------------------------------------*/
AP4_AdtsHeader::AP4_AdtsHeader(const AP4_UI08* bytes)
{
// fixed part
m_Id = ( bytes[1] & 0x08) >> 3;
m_ProtectionAbsent = bytes[1] & 0x01;
m_ProfileObjectType = ( bytes[2] & 0xC0) >> 6;
m_SamplingFrequencyIndex = ( bytes[2] & 0x3C) >> 2;
m_ChannelConfiguration = ((bytes[2] & 0x01) << 2) |
((bytes[3] & 0xC0) >> 6);
// variable part
m_FrameLength = ((unsigned int)(bytes[3] & 0x03) << 11) |
((unsigned int)(bytes[4] ) << 3) |
((unsigned int)(bytes[5] & 0xE0) >> 5);
m_RawDataBlocks = bytes[6] & 0x03;
}
/*----------------------------------------------------------------------+
| AP4_AdtsHeader::MatchFixed
|
| Check that two fixed headers are the same
|
+----------------------------------------------------------------------*/
bool
AP4_AdtsHeader::MatchFixed(unsigned char* a, unsigned char* b)
{
if (a[0] == b[0] &&
a[1] == b[1] &&
a[2] == b[2] &&
(a[3] & 0xF0) == (b[3] & 0xF0)) {
return true;
} else {
return false;
}
}
/*----------------------------------------------------------------------+
| AP4_AdtsHeader::Check
+----------------------------------------------------------------------*/
AP4_Result
AP4_AdtsHeader::Check()
{
// check that the sampling frequency index is valid
if (m_SamplingFrequencyIndex >= 0xD) {
return AP4_FAILURE;
}
/* MPEG2 does not use all profiles */
if (m_Id == 1 && m_ProfileObjectType == 3) {
return AP4_FAILURE;
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::AP4_AdtsParser
+----------------------------------------------------------------------*/
AP4_AdtsParser::AP4_AdtsParser()
{
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::~AP4_AdtsParser
+----------------------------------------------------------------------*/
AP4_AdtsParser::~AP4_AdtsParser()
{
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::Reset
+----------------------------------------------------------------------*/
AP4_Result
AP4_AdtsParser::Reset()
{
m_FrameCount = 0;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::Feed
+----------------------------------------------------------------------*/
AP4_Result
AP4_AdtsParser::Feed(const AP4_UI08* buffer,
AP4_Size* buffer_size,
AP4_Flags flags)
{
AP4_Size free_space;
/* update flags */
m_Bits.m_Flags = flags;
/* possible shortcut */
if (buffer == NULL ||
buffer_size == NULL ||
*buffer_size == 0) {
return AP4_SUCCESS;
}
/* see how much data we can write */
free_space = m_Bits.GetBytesFree();
if (*buffer_size > free_space) *buffer_size = free_space;
/* write the data */
return m_Bits.WriteBytes(buffer, *buffer_size);
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::FindHeader
+----------------------------------------------------------------------*/
AP4_Result
AP4_AdtsParser::FindHeader(AP4_UI08* header)
{
int available = m_Bits.GetBytesAvailable();
unsigned int sync = 0;
long nbr_skipped_bytes = 0;
/* look for the sync pattern */
while (available-- >= AP4_ADTS_HEADER_SIZE) {
sync = (m_Bits.ReadByte() << 8) | m_Bits.PeekByte();
if ((sync & AP4_ADTS_SYNC_MASK) == AP4_ADTS_SYNC_PATTERN) {
/* found a sync pattern, read the rest of the header */
header[0] = (sync >> 8) & 0xFF;
m_Bits.ReadBytes(&header[1], AP4_ADTS_HEADER_SIZE-1);
return AP4_SUCCESS;
} else {
++ nbr_skipped_bytes;
}
}
return AP4_ERROR_NOT_ENOUGH_DATA;
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::FindFrame
+----------------------------------------------------------------------*/
AP4_Result
AP4_AdtsParser::FindFrame(AP4_AacFrame& frame)
{
unsigned int available;
unsigned char raw_header[AP4_ADTS_HEADER_SIZE];
AP4_Result result;
/* align to the start of the next byte */
m_Bits.ByteAlign();
/* find a frame header */
result = FindHeader(raw_header);
if (AP4_FAILED(result)) return result;
/* parse the header */
AP4_AdtsHeader adts_header(raw_header);
/* check the header */
result = adts_header.Check();
if (AP4_FAILED(result)) goto fail;
/* check that we have enough data to peek at the next header */
available = AP4_ADTS_HEADER_SIZE + m_Bits.GetBytesAvailable();
if (m_Bits.m_Flags & AP4_BITSTREAM_FLAG_EOS) {
/* we're at the end of the stream, we only need the entire frame */
if (available < adts_header.m_FrameLength) {
return AP4_ERROR_NOT_ENOUGH_DATA;
}
} else {
/* peek at the header of the next frame */
unsigned char peek_raw_header[AP4_ADTS_HEADER_SIZE];
if (available < adts_header.m_FrameLength+AP4_ADTS_HEADER_SIZE) {
return AP4_ERROR_NOT_ENOUGH_DATA;
}
m_Bits.SkipBytes(adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE);
m_Bits.PeekBytes(peek_raw_header, AP4_ADTS_HEADER_SIZE);
m_Bits.SkipBytes(-((int)adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE));
/* check the header */
AP4_AdtsHeader peek_adts_header(peek_raw_header);
result = peek_adts_header.Check();
if (AP4_FAILED(result)) goto fail;
/* check that the fixed part of this header is the same as the */
/* fixed part of the previous header */
if (!AP4_AdtsHeader::MatchFixed(peek_raw_header, raw_header)) {
goto fail;
}
}
/* fill in the frame info */
frame.m_Info.m_Standard = (adts_header.m_Id == 1 ?
AP4_AAC_STANDARD_MPEG2 :
AP4_AAC_STANDARD_MPEG4);
switch (adts_header.m_ProfileObjectType) {
case 0:
frame.m_Info.m_Profile = AP4_AAC_PROFILE_MAIN;
break;
case 1:
frame.m_Info.m_Profile = AP4_AAC_PROFILE_LC;
break;
case 2:
frame.m_Info.m_Profile = AP4_AAC_PROFILE_SSR;
break;
case 3:
frame.m_Info.m_Profile = AP4_AAC_PROFILE_LTP;
}
frame.m_Info.m_FrameLength = adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE;
frame.m_Info.m_ChannelConfiguration = adts_header.m_ChannelConfiguration;
frame.m_Info.m_SamplingFrequencyIndex = adts_header.m_SamplingFrequencyIndex;
frame.m_Info.m_SamplingFrequency = AP4_AdtsSamplingFrequencyTable[adts_header.m_SamplingFrequencyIndex];
/* skip crc if present */
if (adts_header.m_ProtectionAbsent == 0) {
m_Bits.SkipBits(16);
}
/* set the frame source */
frame.m_Source = &m_Bits;
return AP4_SUCCESS;
fail:
/* skip the header and return (only skip the first byte in */
/* case this was a false header that hides one just after) */
//m_Bits.SkipBytes(-(AP4_ADTS_HEADER_SIZE-1));
return AP4_ERROR_CORRUPTED_BITSTREAM;
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::GetBytesFree
+----------------------------------------------------------------------*/
AP4_Size
AP4_AdtsParser::GetBytesFree()
{
return (m_Bits.GetBytesFree());
}
/*----------------------------------------------------------------------+
| AP4_AdtsParser::GetBytesAvailable
+----------------------------------------------------------------------*/
AP4_Size
AP4_AdtsParser::GetBytesAvailable()
{
return (m_Bits.GetBytesAvailable());
}

View File

@@ -0,0 +1,105 @@
/*****************************************************************
|
| File: Ap4AdtsParser.h
|
| AP4 - ADTS Parser
|
| (c) 2005 Gilles Boccon-Gibod
| Author: Gilles Boccon-Gibod (bok@bok.net)
|
****************************************************************/
#ifndef _AP4_ADTS_PARSER_H_
#define _AP4_ADTS_PARSER_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4BitStream.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
extern const unsigned long AP4_AdtsSamplingFrequencyTable[16];
/*----------------------------------------------------------------------
| types
+---------------------------------------------------------------------*/
class AP4_AdtsHeader {
public:
// constructor
AP4_AdtsHeader(const AP4_UI08* bytes);
// methods
AP4_Result Check();
// members
// fixed part
unsigned int m_Id;
unsigned int m_ProtectionAbsent;
unsigned int m_ProfileObjectType;
unsigned int m_SamplingFrequencyIndex;
unsigned int m_ChannelConfiguration;
// variable part
unsigned int m_FrameLength;
unsigned int m_RawDataBlocks;
// class methods
static bool MatchFixed(unsigned char* a, unsigned char* b);
};
typedef enum {
AP4_AAC_STANDARD_MPEG2,
AP4_AAC_STANDARD_MPEG4
} AP4_AacStandard;
typedef enum {
AP4_AAC_PROFILE_MAIN,
AP4_AAC_PROFILE_LC,
AP4_AAC_PROFILE_SSR,
AP4_AAC_PROFILE_LTP
} AP4_AacProfile;
typedef struct {
AP4_AacStandard m_Standard;
AP4_AacProfile m_Profile;
unsigned int m_SamplingFrequencyIndex;
unsigned long m_SamplingFrequency;
unsigned int m_ChannelConfiguration;
unsigned int m_FrameLength;
} AP4_AacFrameInfo;
typedef struct {
AP4_BitStream* m_Source;
AP4_AacFrameInfo m_Info;
} AP4_AacFrame;
class AP4_AdtsParser {
public:
// constructor and destructor
AP4_AdtsParser();
virtual ~AP4_AdtsParser();
// methods
AP4_Result Reset();
AP4_Result Feed(const AP4_UI08* buffer,
AP4_Size* buffer_size,
AP4_Flags flags = 0);
AP4_Result FindFrame(AP4_AacFrame& frame);
AP4_Result Skip(AP4_Size size);
AP4_Size GetBytesFree();
AP4_Size GetBytesAvailable();
private:
// methods
AP4_Result FindHeader(AP4_UI08* header);
// members
AP4_BitStream m_Bits;
AP4_Cardinal m_FrameCount;
};
#endif // _AP4_ADTS_PARSER_H_

View File

@@ -0,0 +1,250 @@
/*****************************************************************
|
| File: Ap4BitStream.c
|
| AP4 - Bit Streams
|
| (c) 2004 Gilles Boccon-Gibod
| Author: Gilles Boccon-Gibod (bok@bok.net)
|
****************************************************************/
/*----------------------------------------------------------------------
| For efficiency reasons, this bitstream library only handles
| data buffers that are a power of 2 in size
+---------------------------------------------------------------------*/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4BitStream.h"
/*----------------------------------------------------------------------
| AP4_BitStream::AP4_BitStream
+---------------------------------------------------------------------*/
AP4_BitStream::AP4_BitStream()
{
m_Buffer = new AP4_UI08[AP4_BITSTREAM_BUFFER_SIZE];
Reset();
}
/*----------------------------------------------------------------------
| AP4_BitStream::~AP4_BitStream
+---------------------------------------------------------------------*/
AP4_BitStream::~AP4_BitStream()
{
delete[] m_Buffer;
}
/*----------------------------------------------------------------------
| AP4_BitStream::Reset
+---------------------------------------------------------------------*/
AP4_Result
AP4_BitStream::Reset()
{
m_In = 0;
m_Out = 0;
m_BitsCached = 0;
m_Cache = 0;
m_Flags = 0;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_BitStream::ByteAlign
+---------------------------------------------------------------------*/
AP4_Result
AP4_BitStream::ByteAlign()
{
unsigned int to_flush = m_BitsCached & 7;
if (to_flush > 0) SkipBits(to_flush);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_BitStream::GetContiguousBytesFree
+---------------------------------------------------------------------*/
AP4_Size
AP4_BitStream::GetContiguousBytesFree()
{
return
(m_In < m_Out) ?
(m_Out - m_In - 1) :
(m_Out == 0 ? (AP4_BITSTREAM_BUFFER_SIZE - m_In - 1) :
(AP4_BITSTREAM_BUFFER_SIZE - m_In));
}
/*----------------------------------------------------------------------
| AP4_BitStream_GetBytesFree
+---------------------------------------------------------------------*/
AP4_Size
AP4_BitStream::GetBytesFree()
{
return
(m_In < m_Out) ?
(m_Out - m_In - 1) :
(AP4_BITSTREAM_BUFFER_SIZE + (m_Out - m_In) - 1);
}
/*----------------------------------------------------------------------+
| AP4_BitStream::WriteBytes
+----------------------------------------------------------------------*/
AP4_Result
AP4_BitStream::WriteBytes(const AP4_UI08* bytes,
AP4_Size byte_count)
{
/* check parameters */
if (byte_count == 0) return AP4_SUCCESS;
if (bytes == NULL) return AP4_ERROR_INVALID_PARAMETERS;
/* check that we have enough space */
if (GetBytesFree() < byte_count) {
return AP4_FAILURE;
}
/* write the bytes */
if (m_In < m_Out) {
memcpy(m_Buffer+m_In, bytes, byte_count);
AP4_BITSTREAM_POINTER_ADD(m_In, byte_count);
} else {
unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_In;
if (chunk > byte_count) chunk = byte_count;
memcpy(m_Buffer+m_In, bytes, chunk);
AP4_BITSTREAM_POINTER_ADD(m_In, chunk);
if (chunk != byte_count) {
memcpy(m_Buffer+m_In,
bytes+chunk, byte_count-chunk);
AP4_BITSTREAM_POINTER_ADD(m_In, byte_count-chunk);
}
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_BitStream_GetContiguousBytesAvailable
+---------------------------------------------------------------------*/
AP4_Size
AP4_BitStream::GetContiguousBytesAvailable()
{
return
(m_Out <= m_In) ?
(m_In - m_Out) :
(AP4_BITSTREAM_BUFFER_SIZE - m_Out);
}
/*----------------------------------------------------------------------
| AP4_BitStream::GetBytesAvailable
+---------------------------------------------------------------------*/
AP4_Size
AP4_BitStream::GetBytesAvailable()
{
return
(m_Out <= m_In) ?
(m_In - m_Out) :
(m_In + (AP4_BITSTREAM_BUFFER_SIZE - m_Out));
}
/*----------------------------------------------------------------------+
| AP4_BitStream::ReadBytes
+----------------------------------------------------------------------*/
AP4_Result
AP4_BitStream::ReadBytes(AP4_UI08* bytes,
AP4_Size byte_count)
{
if (byte_count == 0 || bytes == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
/* Gets bytes from the cache */
ByteAlign();
while (m_BitsCached > 0 && byte_count > 0) {
*bytes = ReadBits(8);
++ bytes;
-- byte_count;
}
/* Get other bytes */
if (byte_count > 0) {
if (m_Out < m_In) {
memcpy(bytes, m_Buffer + m_Out, byte_count);
AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count);
} else {
unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_Out;
if (chunk >= byte_count) chunk = byte_count;
memcpy(bytes, m_Buffer+m_Out, chunk);
AP4_BITSTREAM_POINTER_ADD(m_Out, chunk);
if (chunk != byte_count) {
memcpy(bytes+chunk,
m_Buffer+m_Out,
byte_count-chunk);
AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count-chunk);
}
}
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------+
| AP4_BitStream::PeekBytes
+----------------------------------------------------------------------*/
AP4_Result
AP4_BitStream::PeekBytes(AP4_UI08* bytes,
AP4_Size byte_count)
{
int bits_cached_byte;
if (byte_count == 0 || bytes == NULL) {
return AP4_ERROR_INVALID_PARAMETERS;
}
/* Gets bytes from the cache */
bits_cached_byte = m_BitsCached & ~7;
while (bits_cached_byte > 0 && byte_count > 0) {
*bytes = (m_Cache >> bits_cached_byte) & 0xFF;
++ bytes;
-- byte_count;
bits_cached_byte -= 8;
}
/* Get other bytes */
if (byte_count > 0) {
if (m_In > m_Out) {
memcpy(bytes, m_Buffer + m_Out, byte_count);
} else {
unsigned int out = m_Out;
unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - out;
if (chunk >= byte_count) {
chunk = byte_count;
}
memcpy(bytes, m_Buffer+out, chunk);
AP4_BITSTREAM_POINTER_ADD(out, chunk);
if (chunk != byte_count) {
memcpy(bytes+chunk,
m_Buffer+out,
byte_count-chunk);
}
}
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------+
| AP4_BitStream::SkipBytes
+----------------------------------------------------------------------*/
AP4_Result
AP4_BitStream::SkipBytes(AP4_Size byte_count)
{
AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count);
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,292 @@
/*****************************************************************
|
| File: Ap4BitStream.h
|
| AP4 - Bit Streams
|
| (c) 2005 Gilles Boccon-Gibod
| Author: Gilles Boccon-Gibod (bok@bok.net)
|
****************************************************************/
#ifndef _AP4_BIT_STREAM_H_
#define _AP4_BIT_STREAM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4Results.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define AP4_ERROR_BASE_BITSTREAM -10000
/* the max frame size we can handle */
#define AP4_BITSTREAM_BUFFER_SIZE 8192
/* flags */
#define AP4_BITSTREAM_FLAG_EOS 0x01
/* error codes */
#define AP4_ERROR_NOT_ENOUGH_DATA (AP4_ERROR_BASE_BITSTREAM - 0)
#define AP4_ERROR_CORRUPTED_BITSTREAM (AP4_ERROR_BASE_BITSTREAM - 1)
#define AP4_ERROR_NOT_ENOUGH_FREE_BUFFER (AP4_ERROR_BASE_BITSTREAM - 2)
/*----------------------------------------------------------------------
| types helpers
+---------------------------------------------------------------------*/
/* use long by default */
typedef unsigned int AP4_BitsWord;
#define AP4_WORD_BITS 32
#define AP4_WORD_BYTES 4
/*----------------------------------------------------------------------
| types
+---------------------------------------------------------------------*/
class AP4_BitStream
{
public:
// constructor and destructor
AP4_BitStream();
~AP4_BitStream();
// methods
AP4_Result Reset();
AP4_Size GetContiguousBytesFree();
AP4_Size GetBytesFree();
AP4_Result WriteBytes(const AP4_UI08* bytes, AP4_Size byte_count);
AP4_Size GetContiguousBytesAvailable();
AP4_Size GetBytesAvailable();
AP4_UI08 ReadByte();
AP4_Result ReadBytes(AP4_UI08* bytes, AP4_Size byte_count);
AP4_UI08 PeekByte();
AP4_Result PeekBytes(AP4_UI08* bytes, AP4_Size byte_count);
int ReadBit();
AP4_UI32 ReadBits(unsigned int bit_count);
int PeekBit();
AP4_UI32 PeekBits(unsigned int bit_count);
AP4_Result SkipBytes(AP4_Size byte_count);
void SkipBit();
void SkipBits(unsigned int bit_count);
AP4_Result ByteAlign();
// members
AP4_UI08* m_Buffer;
unsigned int m_In;
unsigned int m_Out;
AP4_BitsWord m_Cache;
unsigned int m_BitsCached;
unsigned int m_Flags;
private:
// methods
AP4_BitsWord ReadCache() const;
};
/*----------------------------------------------------------------------
| macros
+---------------------------------------------------------------------*/
#define AP4_BIT_MASK(_n) ((1<<(_n))-1)
#define AP4_BITSTREAM_POINTER_VAL(offset) \
((offset)&(AP4_BITSTREAM_BUFFER_SIZE-1))
#define AP4_BITSTREAM_POINTER_OFFSET(pointer, offset) \
(AP4_BITSTREAM_POINTER_VAL((pointer)+(offset)))
#define AP4_BITSTREAM_POINTER_ADD(pointer, offset) \
((pointer) = AP4_BITSTREAM_POINTER_OFFSET(pointer, offset))
/*----------------------------------------------------------------------
| AP4_BitStream::ReadCache
+---------------------------------------------------------------------*/
inline AP4_BitsWord
AP4_BitStream::ReadCache() const
{
unsigned int pos = m_Out;
AP4_BitsWord cache;
#if AP4_WORD_BITS != 32
#error unsupported word size /* 64 and other word size not yet implemented */
#endif
if (pos <= AP4_BITSTREAM_BUFFER_SIZE - AP4_WORD_BYTES) {
unsigned char* out_ptr = &m_Buffer[pos];
cache = (((AP4_BitsWord) out_ptr[0]) << 24)
| (((AP4_BitsWord) out_ptr[1]) << 16)
| (((AP4_BitsWord) out_ptr[2]) << 8)
| (((AP4_BitsWord) out_ptr[3]) );
} else {
unsigned char* buf_ptr = m_Buffer;
cache = (((AP4_BitsWord) buf_ptr[ pos ]) << 24)
| (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 1)]) << 16)
| (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 2)]) << 8)
| (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 3)]) );
}
return cache;
}
/*----------------------------------------------------------------------
| AP4_BitStream::ReadBits
+---------------------------------------------------------------------*/
inline AP4_UI32
AP4_BitStream::ReadBits(unsigned int n)
{
AP4_BitsWord result;
if (m_BitsCached >= n) {
/* we have enough bits in the cache to satisfy the request */
m_BitsCached -= n;
result = (m_Cache >> m_BitsCached) & AP4_BIT_MASK(n);
} else {
/* not enough bits in the cache */
AP4_BitsWord word;
/* read the next word */
{
word = ReadCache();
m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
}
/* combine the new word and the cache, and update the state */
{
AP4_BitsWord cache = m_Cache & AP4_BIT_MASK(m_BitsCached);
n -= m_BitsCached;
m_BitsCached = AP4_WORD_BITS - n;
result = (word >> m_BitsCached) | (cache << n);
m_Cache = word;
}
}
return result;
}
/*----------------------------------------------------------------------
| AP4_BitStream::ReadBit
+---------------------------------------------------------------------*/
inline int
AP4_BitStream::ReadBit()
{
AP4_BitsWord result;
if (m_BitsCached == 0) {
/* the cache is empty */
/* read the next word into the cache */
m_Cache = ReadCache();
m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
m_BitsCached = AP4_WORD_BITS - 1;
/* return the first bit */
result = m_Cache >> (AP4_WORD_BITS - 1);
} else {
/* get the bit from the cache */
result = (m_Cache >> (--m_BitsCached)) & 1;
}
return result;
}
/*----------------------------------------------------------------------
| AP4_BitStream::PeekBits
+---------------------------------------------------------------------*/
inline AP4_UI32
AP4_BitStream::PeekBits(unsigned int n)
{
/* we have enough bits in the cache to satisfy the request */
if (m_BitsCached >= n) {
return (m_Cache >> (m_BitsCached - n)) & AP4_BIT_MASK(n);
} else {
/* not enough bits in the cache, read the next word */
AP4_BitsWord word = ReadCache();
/* combine the new word and the cache, and update the state */
AP4_BitsWord cache = m_Cache & AP4_BIT_MASK(m_BitsCached);
n -= m_BitsCached;
return (word >> (AP4_WORD_BITS - n)) | (cache << n);
}
}
/*----------------------------------------------------------------------
| AP4_BitStream::PeekBit
+---------------------------------------------------------------------*/
inline int
AP4_BitStream::PeekBit()
{
/* the cache is empty */
if (m_BitsCached == 0) {
/* read the next word into the cache */
AP4_BitsWord cache = ReadCache();
/* return the first bit */
return cache >> (AP4_WORD_BITS - 1);
} else {
/* get the bit from the cache */
return (m_Cache >> (m_BitsCached-1)) & 1;
}
}
/*----------------------------------------------------------------------
| AP4_BitStream::SkipBits
+---------------------------------------------------------------------*/
inline void
AP4_BitStream::SkipBits(unsigned int n)
{
if (n <= m_BitsCached) {
m_BitsCached -= n;
} else {
n -= m_BitsCached;
while (n >= AP4_WORD_BITS) {
m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
n -= AP4_WORD_BITS;
}
if (n) {
m_Cache = ReadCache();
m_BitsCached = AP4_WORD_BITS-n;
m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
} else {
m_BitsCached = 0;
m_Cache = 0;
}
}
}
/*----------------------------------------------------------------------
| AP4_BitStream::SkipBit
+---------------------------------------------------------------------*/
inline void
AP4_BitStream::SkipBit()
{
if (m_BitsCached == 0) {
m_Cache = ReadCache();
m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
m_BitsCached = AP4_WORD_BITS - 1;
} else {
--m_BitsCached;
}
}
/*----------------------------------------------------------------------
| AP4_BitStream::ReadByte
+---------------------------------------------------------------------*/
inline AP4_UI08
AP4_BitStream::ReadByte()
{
SkipBits(m_BitsCached & 7);
return ReadBits(8);
}
/*----------------------------------------------------------------------
| AP4_BitStream::PeekByte
+---------------------------------------------------------------------*/
inline AP4_UI08
AP4_BitStream::PeekByte()
{
int extra_bits = m_BitsCached & 7;
int data = PeekBits(extra_bits + 8);
int byte = data & 0xFF;
return byte;
}
#endif // _AP4_BIT_STREAM_H_

View File

@@ -0,0 +1,67 @@
/*****************************************************************
|
| AP4 - Target Platform and Compiler Configuration
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_CONFIG_H_
#define _AP4_CONFIG_H_
/*----------------------------------------------------------------------
| defaults
+---------------------------------------------------------------------*/
#define AP4_CONFIG_HAVE_CPP_STRING_H
#define AP4_CONFIG_HAVE_STDIO_H
#define AP4_CONFIG_HAVE_ASSERT_H
#define AP4_CONFIG_HAVE_CPP_STRING
#define AP4_CONFIG_HAVE_SNPRINTF
/*----------------------------------------------------------------------
| byte order
+---------------------------------------------------------------------*/
// define AP4_PLATFORM_BYTE_ORDER to one of these two choices
#define AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN 0
#define AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN 1
#ifdef __ppc__
#define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN
#endif
/*----------------------------------------------------------------------
| Win32 specifics
+---------------------------------------------------------------------*/
#ifdef WIN32
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#if defined(_DEBUG)
#define AP4_DEBUG
#endif
#endif
#endif // _AP4_CONFIG_H_

41
Source/C++/Core/Ap4.h Normal file
View File

@@ -0,0 +1,41 @@
/*****************************************************************
|
| AP4 - Main Header
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_H_
#define _AP4_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Config.h"
#include "Ap4Types.h"
#include "Ap4Constants.h"
#include "Ap4Results.h"
#include "Ap4Debug.h"
#endif // _AP4_H_

152
Source/C++/Core/Ap4Array.h Normal file
View File

@@ -0,0 +1,152 @@
/*****************************************************************
|
| AP4 - Arrays
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_ARRAY_H_
#define _AP4_ARRAY_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4Results.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const int AP4_ARRAY_INITIAL_COUNT = 64;
/*----------------------------------------------------------------------
| AP4_Array
+---------------------------------------------------------------------*/
template <typename T>
class AP4_Array
{
public:
// methods
AP4_Array<T>(): m_AllocatedCount(0), m_ItemCount(0), m_Items(0) {}
virtual ~AP4_Array<T>();
AP4_Cardinal ItemCount() { return m_ItemCount; }
AP4_Result Append(const T& item);
T& operator[](unsigned long idx);
AP4_Result EnsureCapacity(AP4_Cardinal count);
protected:
// members
AP4_Cardinal m_AllocatedCount;
AP4_Cardinal m_ItemCount;
T* m_Items;
T m_OverflowItem;
};
/*----------------------------------------------------------------------
| AP4_Array<T>::~AP4_Array<T>
+---------------------------------------------------------------------*/
template <typename T>
AP4_Array<T>::~AP4_Array<T>()
{
delete[] m_Items;
}
/*----------------------------------------------------------------------
| AP4_Array<T>::EnsureCapacity
+---------------------------------------------------------------------*/
template <typename T>
AP4_Result
AP4_Array<T>::EnsureCapacity(AP4_Cardinal count)
{
if (count <= m_AllocatedCount) return AP4_SUCCESS;
unsigned long new_count;
if (m_AllocatedCount) {
new_count = 2*m_AllocatedCount;
} else {
new_count = AP4_ARRAY_INITIAL_COUNT;
}
// (re)allocate the items
T* new_items = new T[new_count];
if (new_items == NULL) {
return AP4_ERROR_OUT_OF_MEMORY;
}
if (m_ItemCount && m_Items) {
for (unsigned int i=0; i<m_ItemCount; i++) {
new_items[i] = m_Items[i];
}
delete[] m_Items;
}
m_Items = new_items;
m_AllocatedCount = new_count;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Array<T>::operator[]
+---------------------------------------------------------------------*/
template <typename T>
T&
AP4_Array<T>::operator[](unsigned long idx)
{
if (idx >= m_ItemCount) {
return m_OverflowItem;
} else {
return m_Items[idx];
}
}
/*----------------------------------------------------------------------
| AP4_Array<T>::Append
+---------------------------------------------------------------------*/
template <typename T>
AP4_Result
AP4_Array<T>::Append(const T& item)
{
// ensure capacity
AP4_Result result = EnsureCapacity(m_ItemCount+1);
if (result != AP4_SUCCESS) return result;
// store the item
m_Items[m_ItemCount++] = item;
return AP4_SUCCESS;
}
#endif // _AP4_ARRAY_H_

433
Source/C++/Core/Ap4Atom.cpp Normal file
View File

@@ -0,0 +1,433 @@
/*****************************************************************
|
| AP4 - Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4Atom.h"
#include "Ap4Utils.h"
#include "Ap4ContainerAtom.h"
#include "Ap4StsdAtom.h"
#include "Ap4Debug.h"
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
AP4_Atom::AP4_Atom(Type type,
bool is_full) :
m_Type(type),
m_Size(is_full ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE),
m_IsFull(is_full),
m_Version(0),
m_Flags(0),
m_Parent(NULL)
{
}
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
AP4_Atom::AP4_Atom(Type type,
AP4_Size size,
bool is_full) :
m_Type(type),
m_Size(size),
m_IsFull(is_full),
m_Version(0),
m_Flags(0),
m_Parent(NULL)
{
}
/*----------------------------------------------------------------------
| AP4_Atom::AP4_Atom
+---------------------------------------------------------------------*/
AP4_Atom::AP4_Atom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream) :
m_Type(type),
m_Size(size),
m_IsFull(is_full),
m_Parent(NULL)
{
// if this is a full atom, read the version and flags
if (is_full) {
AP4_UI32 header;
stream.ReadUI32(header);
m_Version = (header>>24)&0xFF;
m_Flags = (header&0xFFFFFF);
} else {
m_Version = 0;
m_Flags = 0;
}
}
/*----------------------------------------------------------------------
| AP4_Atom::GetHeaderSize
+---------------------------------------------------------------------*/
AP4_Size
AP4_Atom::GetHeaderSize()
{
return m_IsFull ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE;
}
/*----------------------------------------------------------------------
| AP4_Atom::WriteHeader
+---------------------------------------------------------------------*/
AP4_Result
AP4_Atom::WriteHeader(AP4_ByteStream& stream)
{
AP4_Result result;
// write the size
result = stream.WriteUI32(m_Size);
if (AP4_FAILED(result)) return result;
// write the type
result = stream.WriteUI32(m_Type);
if (AP4_FAILED(result)) return result;
// for full atoms, write version and flags
if (m_IsFull) {
result = stream.WriteUI08(m_Version);
if (AP4_FAILED(result)) return result;
result = stream.WriteUI24(m_Flags);
if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Atom::Write
+---------------------------------------------------------------------*/
AP4_Result
AP4_Atom::Write(AP4_ByteStream& stream)
{
AP4_Result result;
#if defined(AP4_DEBUG)
AP4_Offset before;
stream.Tell(before);
#endif
// write the header
result = WriteHeader(stream);
if (AP4_FAILED(result)) return result;
// write the fields
result = WriteFields(stream);
if (AP4_FAILED(result)) return result;
#if defined(AP4_DEBUG)
AP4_Offset after;
stream.Tell(after);
AP4_ASSERT(after-before == m_Size);
#endif
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Atom::Inspect
+---------------------------------------------------------------------*/
AP4_Result
AP4_Atom::Inspect(AP4_AtomInspector& inspector)
{
InspectHeader(inspector);
InspectFields(inspector);
inspector.EndElement();
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Atom::InspectHeader
+---------------------------------------------------------------------*/
AP4_Result
AP4_Atom::InspectHeader(AP4_AtomInspector& inspector)
{
// write atom name
char name[7];
name[0] = '[';
AP4_FormatFourChars(&name[1], m_Type);
name[5] = ']';
name[6] = '\0';
char size[64];
AP4_StringFormat(size, sizeof(size), "size=%ld+%ld", GetHeaderSize(),
m_Size-GetHeaderSize());
inspector.StartElement(name, size);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_Atom::Detach
+---------------------------------------------------------------------*/
AP4_Result
AP4_Atom::Detach()
{
if (m_Parent) {
return m_Parent->RemoveChild(this);
} else {
return AP4_SUCCESS;
}
}
/*----------------------------------------------------------------------
| AP4_UnknownAtom::AP4_UnknownAtom
+---------------------------------------------------------------------*/
AP4_UnknownAtom::AP4_UnknownAtom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream) :
AP4_Atom(type, size, is_full, stream),
m_SourceStream(&stream)
{
// store source stream offset
stream.Tell(m_SourceOffset);
// keep a reference to the source stream
m_SourceStream->AddReference();
}
/*----------------------------------------------------------------------
| AP4_UnknownAtom::~AP4_UnknownAtom
+---------------------------------------------------------------------*/
AP4_UnknownAtom::~AP4_UnknownAtom()
{
// release the source stream reference
if (m_SourceStream) {
m_SourceStream->Release();
}
}
/*----------------------------------------------------------------------
| AP4_UnknownAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_UnknownAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
// check that we have a source stream
// and a normal size
if (m_SourceStream == NULL || m_Size < 8) {
return AP4_FAILURE;
}
// seek into the source at the stored offset
result = m_SourceStream->Seek(m_SourceOffset);
if (AP4_FAILED(result)) return result;
// copy the source stream to the output
result = m_SourceStream->CopyTo(stream, m_Size-GetHeaderSize());
if (AP4_FAILED(result)) return result;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AtomParent::~AP4_AtomParent
+---------------------------------------------------------------------*/
AP4_AtomParent::~AP4_AtomParent()
{
m_Children.DeleteReferences();
}
/*----------------------------------------------------------------------
| AP4_AtomParent::AddChild
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomParent::AddChild(AP4_Atom* child, int position)
{
// check that the child does not already have a parent
if (child->GetParent() != NULL) return AP4_ERROR_INVALID_PARAMETERS;
// attach the child
AP4_Result result;
if (position == -1) {
// insert at the tail
result = m_Children.Add(child);
} else if (position == 0) {
// insert at the head
result = m_Children.Insert(NULL, child);
} else {
// insert after <n-1>
AP4_List<AP4_Atom>::Item* insertion_point = m_Children.FirstItem();
unsigned int count = position;
while (insertion_point && --count) {
insertion_point = insertion_point->GetNext();
}
if (insertion_point) {
result = m_Children.Insert(insertion_point, child);
} else {
result = AP4_ERROR_OUT_OF_RANGE;
}
}
if (AP4_FAILED(result)) return result;
// notify the child of its parent
child->SetParent(this);
// get a chance to update
OnChildAdded(child);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AtomParent::RemoveChild
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomParent::RemoveChild(AP4_Atom* child)
{
// check that this is our child
if (child->GetParent() != this) return AP4_ERROR_INVALID_PARAMETERS;
// remove the child
AP4_Result result = m_Children.Remove(child);
if (AP4_FAILED(result)) return result;
// notify that child that it is orphaned
child->SetParent(NULL);
// get a chance to update
OnChildRemoved(child);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AtomParent::DeleteChild
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomParent::DeleteChild(AP4_Atom::Type type)
{
// find the child
AP4_Atom* child = GetChild(type);
if (child == NULL) return AP4_FAILURE;
// remove the child
AP4_Result result = RemoveChild(child);
if (AP4_FAILED(result)) return result;
// delete the child
delete child;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AtomParent::GetChild
+---------------------------------------------------------------------*/
AP4_Atom*
AP4_AtomParent::GetChild(AP4_Atom::Type type, AP4_Ordinal index /* = 0 */)
{
AP4_Atom* atom;
AP4_Result result = m_Children.Find(AP4_AtomFinder(type, index), atom);
if (AP4_SUCCEEDED(result)) {
return atom;
} else {
return NULL;
}
}
/*----------------------------------------------------------------------
| AP4_AtomParent::FindChild
+---------------------------------------------------------------------*/
AP4_Atom*
AP4_AtomParent::FindChild(const char* path,
bool auto_create)
{
// start from here
AP4_AtomParent* parent = this;
// walk the path
while (path[0] && path[1] && path[2] && path[3]) {
// we have 4 valid chars
const char* tail;
int index = 0;
if (path[4] == '\0') {
tail = NULL;
} else if (path[4] == '/') {
// separator
tail = &path[5];
} else if (path[4] == '[') {
const char* x = &path[5];
while (*x >= '0' && *x <= '9') {
index = 10*index+(*x++ - '0');
}
if (x[0] == ']') {
if (x[1] == '\0') {
tail = NULL;
} else {
tail = x+2;
}
} else {
// malformed path
return NULL;
}
} else {
// malformed path
return NULL;
}
// look for this atom in the current list
AP4_Atom::Type type = AP4_ATOM_TYPE(path[0], path[1], path[2], path[3]);
AP4_Atom* atom = parent->GetChild(type, index);
if (atom == NULL) {
// not found
if (auto_create && (index == 0)) {
AP4_ContainerAtom* container = dynamic_cast<AP4_ContainerAtom*>(parent);
if (parent) {
atom = new AP4_ContainerAtom(type, false);
container->AddChild(atom);
} else {
return NULL;
}
} else {
return NULL;
}
}
if (tail) {
path = tail;
// if this atom is an atom parent, recurse
parent = dynamic_cast<AP4_ContainerAtom*>(atom);
if (parent == NULL) return NULL;
} else {
return atom;
}
}
// not found
return NULL;
}

312
Source/C++/Core/Ap4Atom.h Normal file
View File

@@ -0,0 +1,312 @@
/*****************************************************************
|
| AP4 - Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_ATOM_H_
#define _AP4_ATOM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4List.h"
#include "Ap4ByteStream.h"
#include "Ap4Debug.h"
/*----------------------------------------------------------------------
| macros
+---------------------------------------------------------------------*/
#define AP4_ATOM_TYPE(a,b,c,d) \
((((unsigned long)a)<<24) | \
(((unsigned long)b)<<16) | \
(((unsigned long)c)<< 8) | \
(((unsigned long)d) ))
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const int AP4_ATOM_HEADER_SIZE = 8;
const int AP4_FULL_ATOM_HEADER_SIZE = 12;
const int AP4_ATOM_MAX_NAME_SIZE = 256;
const int AP4_ATOM_MAX_URI_SIZE = 512;
/*----------------------------------------------------------------------
| forward references
+---------------------------------------------------------------------*/
class AP4_AtomParent;
/*----------------------------------------------------------------------
| AP4_AtomInspector
+---------------------------------------------------------------------*/
class AP4_AtomInspector {
public:
// types
typedef enum {
HINT_NONE,
HINT_HEX,
HINT_BOOLEAN
} FormatHint;
// constructor and destructor
AP4_AtomInspector() {}
virtual ~AP4_AtomInspector() {}
// methods
virtual void StartElement(const char* name, const char* extra = NULL) {}
virtual void EndElement() {}
virtual void AddField(const char* name, AP4_UI32 value, FormatHint hint = HINT_NONE) {}
virtual void AddField(const char* name, const char* value, FormatHint hint = HINT_NONE) {}
};
/*----------------------------------------------------------------------
| AP4_Atom
+---------------------------------------------------------------------*/
class AP4_Atom {
public:
// types
typedef AP4_UI32 Type;
// methods
AP4_Atom(Type type,
bool is_full = false);
AP4_Atom(Type type,
AP4_Size size,
bool is_full = false);
AP4_Atom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream);
virtual ~AP4_Atom() {}
Type GetType() { return m_Type; }
void SetType(Type type) { m_Type = type; }
AP4_Size GetHeaderSize();
virtual AP4_Size GetSize() { return m_Size; }
virtual AP4_Result Write(AP4_ByteStream& stream);
virtual AP4_Result WriteHeader(AP4_ByteStream& stream);
virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
virtual AP4_Result InspectHeader(AP4_AtomInspector& inspector);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector) {
return AP4_SUCCESS;
}
// parent/child realtionship methods
virtual AP4_Result SetParent(AP4_AtomParent* parent) {
m_Parent = parent;
return AP4_SUCCESS;
}
virtual AP4_AtomParent* GetParent() { return m_Parent; }
virtual AP4_Result Detach();
// override this if your want to make an atom cloneable
virtual AP4_Atom* Clone() { return NULL; }
protected:
// members
Type m_Type;
AP4_Size m_Size;
bool m_IsFull;
AP4_UI32 m_Version;
AP4_UI32 m_Flags;
AP4_AtomParent* m_Parent;
};
/*----------------------------------------------------------------------
| AP4_AtomParent
+---------------------------------------------------------------------*/
class AP4_AtomParent {
public:
// base methods
virtual ~AP4_AtomParent();
AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
virtual AP4_Result AddChild(AP4_Atom* child, int position = -1);
virtual AP4_Result RemoveChild(AP4_Atom* child);
virtual AP4_Result DeleteChild(AP4_Atom::Type type);
virtual AP4_Atom* GetChild(AP4_Atom::Type type, AP4_Ordinal index = 0);
virtual AP4_Atom* FindChild(const char* path,
bool auto_create = false);
// methods designed to be overridden
virtual void OnChildChanged(AP4_Atom* child) {}
virtual void OnChildAdded(AP4_Atom* child) {}
virtual void OnChildRemoved(AP4_Atom* child) {}
protected:
// members
AP4_List<AP4_Atom> m_Children;
};
/*----------------------------------------------------------------------
| AP4_UnknownAtom
+---------------------------------------------------------------------*/
class AP4_UnknownAtom : public AP4_Atom {
public:
// constructor and destructor
AP4_UnknownAtom(AP4_Atom::Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream);
~AP4_UnknownAtom();
// methods
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
private:
// members
AP4_ByteStream* m_SourceStream;
AP4_Offset m_SourceOffset;
};
/*----------------------------------------------------------------------
| atom types
+---------------------------------------------------------------------*/
const AP4_Atom::Type AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u','d','t','a');
const AP4_Atom::Type AP4_ATOM_TYPE_URL = AP4_ATOM_TYPE('u','r','l',' ');
const AP4_Atom::Type AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t','r','a','k');
const AP4_Atom::Type AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t','k','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s','t','t','s');
const AP4_Atom::Type AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s','t','s','z');
const AP4_Atom::Type AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s','t','s','s');
const AP4_Atom::Type AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s','t','s','d');
const AP4_Atom::Type AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s','t','s','c');
const AP4_Atom::Type AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s','t','c','o');
const AP4_Atom::Type AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s','t','b','l');
const AP4_Atom::Type AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s','i','n','f');
const AP4_Atom::Type AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s','c','h','m');
const AP4_Atom::Type AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s','c','h','i');
const AP4_Atom::Type AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m','v','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m','p','4','s');
const AP4_Atom::Type AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m','p','4','a');
const AP4_Atom::Type AP4_ATOM_TYPE_MP4V = AP4_ATOM_TYPE('m','p','4','v');
const AP4_Atom::Type AP4_ATOM_TYPE_AVC1 = AP4_ATOM_TYPE('a','v','c','1');
const AP4_Atom::Type AP4_ATOM_TYPE_ENCA = AP4_ATOM_TYPE('e','n','c','a');
const AP4_Atom::Type AP4_ATOM_TYPE_ENCV = AP4_ATOM_TYPE('e','n','c','v');
const AP4_Atom::Type AP4_ATOM_TYPE_MOOV = AP4_ATOM_TYPE('m','o','o','v');
const AP4_Atom::Type AP4_ATOM_TYPE_MINF = AP4_ATOM_TYPE('m','i','n','f');
const AP4_Atom::Type AP4_ATOM_TYPE_META = AP4_ATOM_TYPE('m','e','t','a');
const AP4_Atom::Type AP4_ATOM_TYPE_MDHD = AP4_ATOM_TYPE('m','d','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_ILST = AP4_ATOM_TYPE('i','l','s','t');
const AP4_Atom::Type AP4_ATOM_TYPE_HDLR = AP4_ATOM_TYPE('h','d','l','r');
const AP4_Atom::Type AP4_ATOM_TYPE_FTYP = AP4_ATOM_TYPE('f','t','y','p');
const AP4_Atom::Type AP4_ATOM_TYPE_ESDS = AP4_ATOM_TYPE('e','s','d','s');
const AP4_Atom::Type AP4_ATOM_TYPE_EDTS = AP4_ATOM_TYPE('e','d','t','s');
const AP4_Atom::Type AP4_ATOM_TYPE_DRMS = AP4_ATOM_TYPE('d','r','m','s');
const AP4_Atom::Type AP4_ATOM_TYPE_DRMI = AP4_ATOM_TYPE('d','r','m','i');
const AP4_Atom::Type AP4_ATOM_TYPE_DREF = AP4_ATOM_TYPE('d','r','e','f');
const AP4_Atom::Type AP4_ATOM_TYPE_DINF = AP4_ATOM_TYPE('d','i','n','f');
const AP4_Atom::Type AP4_ATOM_TYPE_CTTS = AP4_ATOM_TYPE('c','t','t','s');
const AP4_Atom::Type AP4_ATOM_TYPE_MDIA = AP4_ATOM_TYPE('m','d','i','a');
const AP4_Atom::Type AP4_ATOM_TYPE_VMHD = AP4_ATOM_TYPE('v','m','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_SMHD = AP4_ATOM_TYPE('s','m','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_NMHD = AP4_ATOM_TYPE('n','m','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_HMHD = AP4_ATOM_TYPE('h','m','h','d');
const AP4_Atom::Type AP4_ATOM_TYPE_FRMA = AP4_ATOM_TYPE('f','r','m','a');
const AP4_Atom::Type AP4_ATOM_TYPE_MDAT = AP4_ATOM_TYPE('m','d','a','t');
const AP4_Atom::Type AP4_ATOM_TYPE_FREE = AP4_ATOM_TYPE('f','r','e','e');
const AP4_Atom::Type AP4_ATOM_TYPE_TIMS = AP4_ATOM_TYPE('t','i','m','s');
const AP4_Atom::Type AP4_ATOM_TYPE_RTP = AP4_ATOM_TYPE('r','t','p',' ');
const AP4_Atom::Type AP4_ATOM_TYPE_HNTI = AP4_ATOM_TYPE('h','n','t','i');
const AP4_Atom::Type AP4_ATOM_TYPE_SDP = AP4_ATOM_TYPE('s','d','p',' ');
const AP4_Atom::Type AP4_ATOM_TYPE_IKMS = AP4_ATOM_TYPE('i','K','M','S');
const AP4_Atom::Type AP4_ATOM_TYPE_ISFM = AP4_ATOM_TYPE('i','S','F','M');
const AP4_Atom::Type AP4_ATOM_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
const AP4_Atom::Type AP4_ATOM_TYPE_TREF = AP4_ATOM_TYPE('t','r','e','f');
/*----------------------------------------------------------------------
| AP4_AtomListInspector
+---------------------------------------------------------------------*/
class AP4_AtomListInspector : public AP4_List<AP4_Atom>::Item::Operator
{
public:
AP4_AtomListInspector(AP4_AtomInspector& inspector) :
m_Inspector(inspector) {}
AP4_Result Action(AP4_Atom* atom) const {
atom->Inspect(m_Inspector);
return AP4_SUCCESS;
}
private:
AP4_AtomInspector& m_Inspector;
};
/*----------------------------------------------------------------------
| AP4_AtomListWriter
+---------------------------------------------------------------------*/
class AP4_AtomListWriter : public AP4_List<AP4_Atom>::Item::Operator
{
public:
AP4_AtomListWriter(AP4_ByteStream& stream) :
m_Stream(stream) {}
AP4_Result Action(AP4_Atom* atom) const {
atom->Write(m_Stream);
return AP4_SUCCESS;
}
private:
AP4_ByteStream& m_Stream;
};
/*----------------------------------------------------------------------
| AP4_AtomFinder
+---------------------------------------------------------------------*/
class AP4_AtomFinder : public AP4_List<AP4_Atom>::Item::Finder
{
public:
AP4_AtomFinder(AP4_Atom::Type type, AP4_Ordinal index = 0) :
m_Type(type), m_Index(index) {}
AP4_Result Test(AP4_Atom* atom) const {
if (atom->GetType() == m_Type) {
if (m_Index-- == 0) {
return AP4_SUCCESS;
} else {
return AP4_FAILURE;
}
} else {
return AP4_FAILURE;
}
}
private:
AP4_Atom::Type m_Type;
mutable AP4_Ordinal m_Index;
};
/*----------------------------------------------------------------------
| AP4_AtomSizeAdder
+---------------------------------------------------------------------*/
class AP4_AtomSizeAdder : public AP4_List<AP4_Atom>::Item::Operator {
public:
AP4_AtomSizeAdder(AP4_Size& size) : m_Size(size) {}
private:
AP4_Result Action(AP4_Atom* atom) const {
m_Size += atom->GetSize();
return AP4_SUCCESS;
}
AP4_Size& m_Size;
};
#endif // _AP4_ATOM_H_

View File

@@ -0,0 +1,363 @@
/*****************************************************************
|
| AP4 - Atom Factory
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4AtomFactory.h"
#include "Ap4SampleEntry.h"
#include "Ap4IsmaCryp.h"
#include "Ap4UrlAtom.h"
#include "Ap4MoovAtom.h"
#include "Ap4MvhdAtom.h"
#include "Ap4TrakAtom.h"
#include "Ap4HdlrAtom.h"
#include "Ap4DrefAtom.h"
#include "Ap4TkhdAtom.h"
#include "Ap4MdhdAtom.h"
#include "Ap4StsdAtom.h"
#include "Ap4StscAtom.h"
#include "Ap4StcoAtom.h"
#include "Ap4StszAtom.h"
#include "Ap4EsdsAtom.h"
#include "Ap4SttsAtom.h"
#include "Ap4CttsAtom.h"
#include "Ap4StssAtom.h"
#include "Ap4FtypAtom.h"
#include "Ap4VmhdAtom.h"
#include "Ap4SmhdAtom.h"
#include "Ap4NmhdAtom.h"
#include "Ap4HmhdAtom.h"
#include "Ap4SchmAtom.h"
#include "Ap4FrmaAtom.h"
#include "Ap4TimsAtom.h"
#include "Ap4RtpAtom.h"
#include "Ap4SdpAtom.h"
#include "Ap4IkmsAtom.h"
#include "Ap4IsfmAtom.h"
#include "Ap4TrefTypeAtom.h"
/*----------------------------------------------------------------------
| class variables
+---------------------------------------------------------------------*/
AP4_AtomFactory AP4_AtomFactory::DefaultFactory;
/*----------------------------------------------------------------------
| AP4_AtomFactory::AddTypeHandler
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::AddTypeHandler(TypeHandler* handler)
{
return m_TypeHandlers.Add(handler);
}
/*----------------------------------------------------------------------
| AP4_AtomFactory::RemoveTypeHandler
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::RemoveTypeHandler(TypeHandler* handler)
{
return m_TypeHandlers.Remove(handler);
}
/*----------------------------------------------------------------------
| AP4_AtomFactory::CreateAtomFromStream
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
AP4_Atom*& atom)
{
AP4_Size bytes_available = 0;
if (AP4_FAILED(stream.GetSize(bytes_available)) ||
bytes_available == 0) {
bytes_available = (AP4_Size)((unsigned long)(-1));
}
return CreateAtomFromStream(stream, bytes_available, atom);
}
/*----------------------------------------------------------------------
| AP4_AtomFactory::CreateAtomFromStream
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
AP4_Size& bytes_available,
AP4_Atom*& atom)
{
AP4_Result result;
// NULL by default
atom = NULL;
// check that there are enough bytes for at least a header
if (bytes_available < 8) return AP4_ERROR_EOS;
// remember current stream offset
AP4_Offset start;
stream.Tell(start);
// read atom size
AP4_UI32 size;
result = stream.ReadUI32(size);
if (AP4_FAILED(result)) {
stream.Seek(start);
return result;
}
if (size == 0) {
// atom extends to end of file
AP4_Size streamSize = 0;
stream.GetSize(streamSize);
if (streamSize >= start) {
size = streamSize - start;
}
}
// check the size (we don't handle extended size yet)
if (size < 8 || size > bytes_available) {
stream.Seek(start);
return AP4_ERROR_INVALID_FORMAT;
}
// read atom type
AP4_Atom::Type type;
result = stream.ReadUI32(type);
if (AP4_FAILED(result)) {
stream.Seek(start);
return result;
}
// create the atom
switch (type) {
case AP4_ATOM_TYPE_MOOV:
atom = new AP4_MoovAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_MVHD:
atom = new AP4_MvhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_TRAK:
atom = new AP4_TrakAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_HDLR:
atom = new AP4_HdlrAtom(size, stream);
break;
case AP4_ATOM_TYPE_DREF:
atom = new AP4_DrefAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_URL:
atom = new AP4_UrlAtom(size, stream);
break;
case AP4_ATOM_TYPE_TKHD:
atom = new AP4_TkhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_MDHD:
atom = new AP4_MdhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_STSD:
atom = new AP4_StsdAtom(size, stream, *this);
break;
case AP4_ATOM_TYPE_STSC:
atom = new AP4_StscAtom(size, stream);
break;
case AP4_ATOM_TYPE_STCO:
atom = new AP4_StcoAtom(size, stream);
break;
case AP4_ATOM_TYPE_STSZ:
atom = new AP4_StszAtom(size, stream);
break;
case AP4_ATOM_TYPE_STTS:
atom = new AP4_SttsAtom(size, stream);
break;
case AP4_ATOM_TYPE_CTTS:
atom = new AP4_CttsAtom(size, stream);
break;
case AP4_ATOM_TYPE_STSS:
atom = new AP4_StssAtom(size, stream);
break;
case AP4_ATOM_TYPE_MP4S:
atom = new AP4_Mp4sSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_MP4A:
atom = new AP4_Mp4aSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_MP4V:
atom = new AP4_Mp4vSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_AVC1:
atom = new AP4_Avc1SampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_ENCA:
atom = new AP4_EncaSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_ENCV:
atom = new AP4_EncvSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_DRMS:
atom = new AP4_DrmsSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_DRMI:
atom = new AP4_DrmiSampleEntry(size, stream, *this);
break;
case AP4_ATOM_TYPE_ESDS:
atom = new AP4_EsdsAtom(size, stream);
break;
case AP4_ATOM_TYPE_VMHD:
atom = new AP4_VmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_SMHD:
atom = new AP4_SmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_NMHD:
atom = new AP4_NmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_HMHD:
atom = new AP4_HmhdAtom(size, stream);
break;
case AP4_ATOM_TYPE_FRMA:
atom = new AP4_FrmaAtom(size, stream);
break;
case AP4_ATOM_TYPE_SCHM:
atom = new AP4_SchmAtom(size, stream);
break;
case AP4_ATOM_TYPE_FTYP:
atom = new AP4_FtypAtom(size, stream);
break;
case AP4_ATOM_TYPE_RTP:
if (m_Context == AP4_ATOM_TYPE_HNTI) {
atom = new AP4_RtpAtom(size, stream);
} else {
atom = new AP4_RtpHintSampleEntry(size, stream, *this);
}
break;
case AP4_ATOM_TYPE_TIMS:
atom = new AP4_TimsAtom(size, stream);
break;
case AP4_ATOM_TYPE_SDP:
atom = new AP4_SdpAtom(size, stream);
break;
case AP4_ATOM_TYPE_IKMS:
atom = new AP4_IkmsAtom(size, stream);
break;
case AP4_ATOM_TYPE_ISFM:
atom = new AP4_IsfmAtom(size, stream);
break;
case AP4_ATOM_TYPE_HINT:
atom = new AP4_TrefTypeAtom(type, size, stream);
break;
// container atoms
case AP4_ATOM_TYPE_TREF:
case AP4_ATOM_TYPE_HNTI:
case AP4_ATOM_TYPE_STBL:
case AP4_ATOM_TYPE_MDIA:
case AP4_ATOM_TYPE_DINF:
case AP4_ATOM_TYPE_MINF:
case AP4_ATOM_TYPE_SCHI:
case AP4_ATOM_TYPE_SINF:
case AP4_ATOM_TYPE_UDTA:
case AP4_ATOM_TYPE_ILST:
case AP4_ATOM_TYPE_EDTS: {
AP4_UI32 context = m_Context;
m_Context = type; // set the context for the children
atom = new AP4_ContainerAtom(type, size, false, stream, *this);
m_Context = context; // restore the previous context
break;
}
// full container atoms
case AP4_ATOM_TYPE_META:
atom = new AP4_ContainerAtom(type, size, true, stream, *this);
break;
default:
// try all the external type handlers
{
atom = NULL;
AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
while (handler_item) {
TypeHandler* handler = handler_item->GetData();
if (AP4_SUCCEEDED(handler->CreateAtom(type, size, stream, atom))) {
break;
}
handler_item = handler_item->GetNext();
}
if (atom == NULL) {
// no custom handlers, create a generic atom
atom = new AP4_UnknownAtom(type, size, false, stream);
}
break;
}
}
// skip to the end of the atom
bytes_available -= size;
result = stream.Seek(start+size);
if (AP4_FAILED(result)) {
delete atom;
atom = NULL;
}
return result;
}

View File

@@ -0,0 +1,83 @@
/*****************************************************************
|
| AP4 - Atom Factory
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_ATOM_FACTORY_H_
#define _AP4_ATOM_FACTORY_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4Atom.h"
/*----------------------------------------------------------------------
| class references
+---------------------------------------------------------------------*/
class AP4_ByteStream;
/*----------------------------------------------------------------------
| AP4_AtomFactory
+---------------------------------------------------------------------*/
class AP4_AtomFactory {
public:
// types
class TypeHandler {
public:
virtual ~TypeHandler() {};
virtual AP4_Result CreateAtom(AP4_Atom::Type type,
AP4_Size size,
AP4_ByteStream& stream,
AP4_Atom*& atom) = 0;
};
// class members
static AP4_AtomFactory DefaultFactory;
// constructor
AP4_AtomFactory() : m_Context(0) {}
// methods
AP4_Result AddTypeHandler(TypeHandler* handler);
AP4_Result RemoveTypeHandler(TypeHandler* handler);
AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
AP4_Size& bytes_available,
AP4_Atom*& atom);
AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
AP4_Atom*& atom);
// context
void SetContext(AP4_Atom::Type context) { m_Context = context; }
AP4_Atom::Type GetContext() const { return m_Context; }
private:
// members
AP4_Atom::Type m_Context;
AP4_List<TypeHandler> m_TypeHandlers;
};
#endif // _AP4_ATOM_FACTORY_H_

View File

@@ -0,0 +1,210 @@
/*****************************************************************
|
| AP4 - Atom Based Sample Tables
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This atom is part of AP4 (MP4 Audio Proatom Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the atom COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4AtomSampleTable.h"
#include "Ap4ByteStream.h"
#include "Ap4StsdAtom.h"
#include "Ap4StscAtom.h"
#include "Ap4StcoAtom.h"
#include "Ap4StszAtom.h"
#include "Ap4SttsAtom.h"
#include "Ap4CttsAtom.h"
#include "Ap4StssAtom.h"
#include "Ap4Sample.h"
#include "Ap4Atom.h"
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::AP4_AtomSampleTable
+---------------------------------------------------------------------*/
AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
AP4_ByteStream& sample_stream) :
m_SampleStream(sample_stream)
{
m_StscAtom = dynamic_cast<AP4_StscAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSC));
m_StcoAtom = dynamic_cast<AP4_StcoAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STCO));
m_StszAtom = dynamic_cast<AP4_StszAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSZ));
m_CttsAtom = dynamic_cast<AP4_CttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_CTTS));
m_SttsAtom = dynamic_cast<AP4_SttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STTS));
m_StssAtom = dynamic_cast<AP4_StssAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSS));
m_StsdAtom = dynamic_cast<AP4_StsdAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSD));
// keep a reference to the sample stream
m_SampleStream.AddReference();
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::~AP4_AtomSampleTable
+---------------------------------------------------------------------*/
AP4_AtomSampleTable::~AP4_AtomSampleTable()
{
m_SampleStream.Release();
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSample
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
AP4_Sample& sample)
{
AP4_Result result;
// MP4 uses 1-based indexes internally, so adjust by one
index++;
// find out in which chunk this sample is located
AP4_Ordinal chunk, skip, desc;
result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);
if (AP4_FAILED(result)) return result;
// check that the result is within bounds
if (skip > index) return AP4_ERROR_INTERNAL;
// get the atom offset for this chunk
AP4_Offset offset;
result = m_StcoAtom->GetChunkOffset(chunk, offset);
if (AP4_FAILED(result)) return result;
// compute the additional offset inside the chunk
for (unsigned int i = index-skip; i < index; i++) {
AP4_Size size;
result = m_StszAtom->GetSampleSize(i, size);
if (AP4_FAILED(result)) return result;
offset += size;
}
// set the description index
sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes
// set the dts and cts
AP4_TimeStamp cts_offset, dts;
result = m_SttsAtom->GetDts(index, dts);
if (AP4_FAILED(result)) return result;
sample.SetDts(dts);
if (m_CttsAtom == NULL) {
sample.SetCts(dts);
} else {
result = m_CttsAtom->GetCtsOffset(index, cts_offset);
if (AP4_FAILED(result)) return result;
sample.SetCts(dts + cts_offset);
}
// set the size
AP4_Size sample_size;
result = m_StszAtom->GetSampleSize(index, sample_size);
if (AP4_FAILED(result)) return result;
sample.SetSize(sample_size);
// set the offset
sample.SetOffset(offset);
// set the data stream
sample.SetDataStream(m_SampleStream);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSampleCount
+---------------------------------------------------------------------*/
AP4_Cardinal
AP4_AtomSampleTable::GetSampleCount()
{
return m_StszAtom ? m_StszAtom->GetSampleCount() : 0;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSampleDescription
+---------------------------------------------------------------------*/
AP4_SampleDescription*
AP4_AtomSampleTable::GetSampleDescription(AP4_Ordinal index)
{
return m_StsdAtom ? m_StsdAtom->GetSampleDescription(index) : NULL;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSampleDescriptionCount
+---------------------------------------------------------------------*/
AP4_Cardinal
AP4_AtomSampleTable::GetSampleDescriptionCount()
{
return m_StsdAtom ? m_StsdAtom->GetSampleDescriptionCount() : 0;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetChunkForSample
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomSampleTable::GetChunkForSample(AP4_Ordinal sample,
AP4_Ordinal& chunk,
AP4_Ordinal& skip,
AP4_Ordinal& sample_description)
{
return m_StscAtom ? m_StscAtom->GetChunkForSample(sample, chunk, skip, sample_description) : AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetChunkOffset
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset)
{
return m_StcoAtom ? m_StcoAtom->GetChunkOffset(chunk, offset) : AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::SetChunkOffset
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset)
{
return m_StcoAtom ? m_StcoAtom->SetChunkOffset(chunk, offset) : AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::SetSampleSize
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomSampleTable::SetSampleSize(AP4_Ordinal sample, AP4_Size size)
{
return m_StszAtom ? m_StszAtom->SetSampleSize(sample, size) : AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_AtomSampleTable::GetSample
+---------------------------------------------------------------------*/
AP4_Result
AP4_AtomSampleTable::GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
AP4_Ordinal& index)
{
return m_SttsAtom ? m_SttsAtom->GetSampleIndexForTimeStamp(ts, index)
: AP4_FAILURE;
}

View File

@@ -0,0 +1,89 @@
/*****************************************************************
|
| AP4 - Atom Based Sample Table
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This atom is part of AP4 (MP4 Audio Proatom Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the atom COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_ATOM_SAMPLE_TABLE_H_
#define _AP4_ATOM_SAMPLE_TABLE_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4SampleTable.h"
/*----------------------------------------------------------------------
| forward declarations
+---------------------------------------------------------------------*/
class AP4_Atom;
class AP4_ByteStream;
class AP4_StscAtom;
class AP4_StcoAtom;
class AP4_StszAtom;
class AP4_SttsAtom;
class AP4_CttsAtom;
class AP4_StssAtom;
class AP4_StsdAtom;
/*----------------------------------------------------------------------
| AP4_AtomSampleTable
+---------------------------------------------------------------------*/
class AP4_AtomSampleTable : public AP4_SampleTable
{
public:
// methods
AP4_AtomSampleTable(AP4_ContainerAtom* stbl_atom,
AP4_ByteStream& sample_stream);
virtual ~AP4_AtomSampleTable();
// AP4_SampleTable methods
virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
virtual AP4_Cardinal GetSampleCount();
virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
virtual AP4_Cardinal GetSampleDescriptionCount();
virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
AP4_Ordinal& chunk,
AP4_Ordinal& skip,
AP4_Ordinal& sample_description);
virtual AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset);
virtual AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset);
virtual AP4_Result SetSampleSize(AP4_Ordinal sample, AP4_Size size);
virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
AP4_Ordinal& index);
private:
// members
AP4_ByteStream& m_SampleStream;
AP4_StscAtom* m_StscAtom;
AP4_StcoAtom* m_StcoAtom;
AP4_StszAtom* m_StszAtom;
AP4_SttsAtom* m_SttsAtom;
AP4_CttsAtom* m_CttsAtom;
AP4_StsdAtom* m_StsdAtom;
AP4_StssAtom* m_StssAtom;
};
#endif // _AP4_ATOM_SAMPLE_TABLE_H_

View File

@@ -0,0 +1,536 @@
/*****************************************************************
|
| AP4 - Byte Stream support
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4ByteStream.h"
#include "Ap4Utils.h"
#include "Ap4Debug.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const int AP4_BYTE_STREAM_COPY_BUFFER_SIZE = 4096;
/*----------------------------------------------------------------------
| AP4_ByteStream::WriteString
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::WriteString(const char* buffer)
{
AP4_Size string_length = static_cast<AP4_Size>(strlen(buffer));
// shortcut
if ((buffer == NULL) || (string_length == 0)) return AP4_SUCCESS;
// write the string
return Write((const void*)buffer, string_length);
}
/*----------------------------------------------------------------------
| AP4_ByteStream::WriteUI32
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::WriteUI32(AP4_UI32 value)
{
unsigned char buffer[4];
// convert value to bytes
AP4_BytesFromUInt32BE(buffer, value);
// write bytes to the stream
return Write((void*)buffer, 4);
}
/*----------------------------------------------------------------------
| AP4_ByteStream::WriteUI24
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::WriteUI24(AP4_UI32 value)
{
unsigned char buffer[3];
// convert value to bytes
AP4_BytesFromUInt24BE(buffer, value);
// write bytes to the stream
return Write((void*)buffer, 3);
}
/*----------------------------------------------------------------------
| AP4_ByteStream::WriteUI16
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::WriteUI16(AP4_UI16 value)
{
unsigned char buffer[2];
// convert value to bytes
AP4_BytesFromUInt16BE(buffer, value);
// write bytes to the stream
return Write((void*)buffer, 2);
}
/*----------------------------------------------------------------------
| AP4_ByteStream::WriteUI08
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::WriteUI08(AP4_UI08 value)
{
return Write((void*)&value, 1);
}
/*----------------------------------------------------------------------
| AP4_ByteStream::ReadUI32
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::ReadUI32(AP4_UI32& value)
{
unsigned char buffer[4];
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 4);
if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt32BE(buffer);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_ByteStream::ReadUI24
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::ReadUI24(AP4_UI32& value)
{
unsigned char buffer[3];
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 3);
if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt24BE(buffer);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_ByteStream::ReadUI16
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::ReadUI16(AP4_UI16& value)
{
unsigned char buffer[2];
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 2);
if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = AP4_BytesToUInt16BE(buffer);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_ByteStream::ReadUI08
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::ReadUI08(AP4_UI08& value)
{
unsigned char buffer[1];
// read bytes from the stream
AP4_Result result;
result = Read((void*)buffer, 1);
if (AP4_FAILED(result)) {
value = 0;
return result;
}
// convert bytes to value
value = buffer[0];
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_ByteStream::ReadString
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::ReadString(char* buffer, AP4_Size size)
{
if (buffer == NULL || size == 0) {
return AP4_ERROR_INVALID_PARAMETERS;
}
AP4_Size bytes_read = 0;
while (bytes_read < size-1) {
AP4_Result result;
result = Read(&buffer[bytes_read], 1, NULL);
if (AP4_FAILED(result)) {
buffer[bytes_read] = '\0';
return result;
}
if (buffer[bytes_read] == '\0') {
// end of string
return AP4_SUCCESS;
}
bytes_read++;
}
// the string was not null terminated, terminate it
buffer[size-1] = '\0';
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_ByteStream::CopyTo
+---------------------------------------------------------------------*/
AP4_Result
AP4_ByteStream::CopyTo(AP4_ByteStream& stream, AP4_Size size)
{
unsigned char buffer[AP4_BYTE_STREAM_COPY_BUFFER_SIZE];
while (size) {
AP4_Size bytes_read;
AP4_Size bytes_to_read;
AP4_Result result;
// decide how much to read
if (size >= sizeof(buffer)) {
bytes_to_read = sizeof(buffer);
} else {
bytes_to_read = size;
}
// read up to one buffer full
result = Read(buffer, bytes_to_read, &bytes_read);
if (AP4_FAILED(result)) return result;
// copy to destination
if (bytes_read != 0) {
result = stream.Write(buffer, bytes_read);
if (AP4_FAILED(result)) return result;
}
// update the size
size -= bytes_read;
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_SubStream::AP4_SubStream
+---------------------------------------------------------------------*/
AP4_SubStream::AP4_SubStream(AP4_ByteStream& container,
AP4_Offset offset,
AP4_Size size) :
m_Container(container),
m_Offset(offset),
m_Size(size),
m_Position(0),
m_ReferenceCount(1)
{
m_Container.AddReference();
}
/*----------------------------------------------------------------------
| AP4_SubStream::~AP4_SubStream
+---------------------------------------------------------------------*/
AP4_SubStream::~AP4_SubStream()
{
m_Container.Release();
}
/*----------------------------------------------------------------------
| AP4_SubStream::Read
+---------------------------------------------------------------------*/
AP4_Result
AP4_SubStream::Read(void* buffer,
AP4_Size bytes_to_read,
AP4_Size* bytes_read)
{
// default values
if (bytes_read) *bytes_read = 0;
// shortcut
if (bytes_to_read == 0) {
return AP4_SUCCESS;
}
// clamp to range
if (m_Position+bytes_to_read > m_Size) {
bytes_to_read = m_Size - m_Position;
}
// check for end of substream
if (bytes_to_read == 0) {
return AP4_ERROR_EOS;
}
// seek inside container
//AP4_Result result;
//result = m_Container.Seek(m_Offset+m_Position);
//if (AP4_FAILED(result)) {
// return result;
//}
// read from the container
AP4_Size local_bytes_read;
AP4_Result result = m_Container.Read(buffer, bytes_to_read, &local_bytes_read);
if (bytes_read) *bytes_read = local_bytes_read;
if (AP4_SUCCEEDED(result)) {
m_Position += local_bytes_read;
}
return result;
}
/*----------------------------------------------------------------------
| AP4_SubStream::Write
+---------------------------------------------------------------------*/
AP4_Result
AP4_SubStream::Write(const void* buffer,
AP4_Size bytes_to_write,
AP4_Size* bytes_written)
{
// default values
if (bytes_written) *bytes_written = 0;
// shortcut
if (bytes_to_write == 0) {
return AP4_SUCCESS;
}
// clamp to range
if (m_Position+bytes_to_write > m_Size) {
bytes_to_write = m_Size - m_Position;
}
// check for en of substream
if (bytes_to_write == 0) {
return AP4_ERROR_EOS;
}
// seek inside container
//AP4_Result result;
//result = m_Container.Seek(m_Offset+m_Position);
//if (AP4_FAILED(result)) return result;
// write to container
AP4_Size local_bytes_written;
AP4_Result result = m_Container.Write(buffer, bytes_to_write, &local_bytes_written);
if (bytes_written) *bytes_written = local_bytes_written;
if (AP4_SUCCEEDED(result)) {
m_Position += local_bytes_written;
}
return result;
}
/*----------------------------------------------------------------------
| AP4_SubStream::Seek
+---------------------------------------------------------------------*/
AP4_Result
AP4_SubStream::Seek(AP4_Offset offset)
{
if (offset > m_Size) return AP4_FAILURE;
AP4_Result result;
result = m_Container.Seek(m_Offset+offset);
if (AP4_SUCCEEDED(result)) {
m_Position = offset;
}
return result;
}
/*----------------------------------------------------------------------
| AP4_SubStream::AddReference
+---------------------------------------------------------------------*/
void
AP4_SubStream::AddReference()
{
m_ReferenceCount++;
}
/*----------------------------------------------------------------------
| AP4_SubStream::Release
+---------------------------------------------------------------------*/
void
AP4_SubStream::Release()
{
if (--m_ReferenceCount == 0) {
delete this;
}
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::AP4_MemoryByteStream
+---------------------------------------------------------------------*/
AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_Size size) :
m_BufferIsLocal(true),
m_Size(size),
m_Position(0),
m_ReferenceCount(1)
{
m_Buffer = new AP4_UI08[size];
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::AP4_MemoryByteStream
+---------------------------------------------------------------------*/
AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size) :
m_BufferIsLocal(false),
m_Buffer(buffer),
m_Size(size),
m_Position(0),
m_ReferenceCount(1)
{}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::~AP4_MemoryByteStream
+---------------------------------------------------------------------*/
AP4_MemoryByteStream::~AP4_MemoryByteStream()
{
if (m_BufferIsLocal) delete[] m_Buffer;
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::Read
+---------------------------------------------------------------------*/
AP4_Result
AP4_MemoryByteStream::Read(void* buffer,
AP4_Size bytes_to_read,
AP4_Size* bytes_read)
{
// default values
if (bytes_read) *bytes_read = 0;
// shortcut
if (bytes_to_read == 0) {
return AP4_SUCCESS;
}
// clamp to range
if (m_Position+bytes_to_read > m_Size) {
bytes_to_read = m_Size - m_Position;
}
// check for end of stream
if (bytes_to_read == 0) {
return AP4_ERROR_EOS;
}
// read from the memory
memcpy(buffer, &m_Buffer[m_Position], bytes_to_read);
m_Position += bytes_to_read;
if (bytes_read) *bytes_read = bytes_to_read;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::Write
+---------------------------------------------------------------------*/
AP4_Result
AP4_MemoryByteStream::Write(const void* buffer,
AP4_Size bytes_to_write,
AP4_Size* bytes_written)
{
// default values
if (bytes_written) *bytes_written = 0;
// shortcut
if (bytes_to_write == 0) {
return AP4_SUCCESS;
}
// clamp to range
if (m_Position+bytes_to_write > m_Size) {
bytes_to_write = m_Size - m_Position;
}
// check for en of stream
if (bytes_to_write == 0) {
return AP4_ERROR_EOS;
}
// write to memory
memcpy(&m_Buffer[m_Position], buffer, bytes_to_write);
m_Position += bytes_to_write;
if (bytes_written) *bytes_written = bytes_to_write;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::Seek
+---------------------------------------------------------------------*/
AP4_Result
AP4_MemoryByteStream::Seek(AP4_Offset offset)
{
if (offset > m_Size) return AP4_FAILURE;
m_Position = offset;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::AddReference
+---------------------------------------------------------------------*/
void
AP4_MemoryByteStream::AddReference()
{
m_ReferenceCount++;
}
/*----------------------------------------------------------------------
| AP4_MemoryByteStream::Release
+---------------------------------------------------------------------*/
void
AP4_MemoryByteStream::Release()
{
if (--m_ReferenceCount == 0) {
delete this;
}
}

View File

@@ -0,0 +1,152 @@
/*****************************************************************
|
| AP4 - ByteStream Interface
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_BYTE_STREAM_H_
#define _AP4_BYTE_STREAM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4Interfaces.h"
#include "Ap4Results.h"
/*----------------------------------------------------------------------
| AP4_ByteStream
+---------------------------------------------------------------------*/
class AP4_ByteStream : public AP4_Referenceable
{
public:
// methods
virtual AP4_Result Read(void* buffer,
AP4_Size bytes_to_read,
AP4_Size* bytes_read = 0) = 0;
virtual AP4_Result ReadUI32(AP4_UI32& value);
virtual AP4_Result ReadUI24(AP4_UI32& value);
virtual AP4_Result ReadUI16(AP4_UI16& value);
virtual AP4_Result ReadUI08(AP4_UI08& value);
virtual AP4_Result ReadString(char* buffer, AP4_Size size);
virtual AP4_Result Write(const void* buffer,
AP4_Size bytes_to_write,
AP4_Size* bytes_written = 0) = 0;
virtual AP4_Result WriteString(const char* stringBuffer);
virtual AP4_Result WriteUI32(AP4_UI32 value);
virtual AP4_Result WriteUI24(AP4_UI32 value);
virtual AP4_Result WriteUI16(AP4_UI16 value);
virtual AP4_Result WriteUI08(AP4_UI08 value);
virtual AP4_Result Seek(AP4_Offset offset) = 0;
virtual AP4_Result Tell(AP4_Offset& offset) = 0;
virtual AP4_Result GetSize(AP4_Size& size) = 0;
virtual AP4_Result CopyTo(AP4_ByteStream& stream, AP4_Size size);
};
/*----------------------------------------------------------------------
| AP4_SubStream
+---------------------------------------------------------------------*/
class AP4_SubStream : public AP4_ByteStream
{
public:
AP4_SubStream(AP4_ByteStream& container, AP4_Offset offset, AP4_Size size);
// AP4_ByteStream methods
AP4_Result Read(void* buffer,
AP4_Size bytes_to_read,
AP4_Size* bytes_read = 0);
AP4_Result Write(const void* buffer,
AP4_Size bytes_to_write,
AP4_Size* bytes_written = 0);
AP4_Result Seek(AP4_Offset offset);
AP4_Result Tell(AP4_Offset& offset) {
offset = m_Position;
return AP4_SUCCESS;
}
AP4_Result GetSize(AP4_Size& size) {
size = m_Size;
return AP4_SUCCESS;
}
// AP4_Referenceable methods
void AddReference();
void Release();
protected:
virtual ~AP4_SubStream();
private:
AP4_ByteStream& m_Container;
AP4_Offset m_Offset;
AP4_Size m_Size;
AP4_Offset m_Position;
AP4_Cardinal m_ReferenceCount;
};
/*----------------------------------------------------------------------
| AP4_MemoryByteStream
+---------------------------------------------------------------------*/
class AP4_MemoryByteStream : public AP4_ByteStream
{
public:
AP4_MemoryByteStream(AP4_Size size);
AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size);
// AP4_ByteStream methods
AP4_Result Read(void* buffer,
AP4_Size bytes_to_read,
AP4_Size* bytes_read = 0);
AP4_Result Write(const void* buffer,
AP4_Size bytes_to_write,
AP4_Size* bytes_written = 0);
AP4_Result Seek(AP4_Offset offset);
AP4_Result Tell(AP4_Offset& offset) {
offset = m_Position;
return AP4_SUCCESS;
}
AP4_Result GetSize(AP4_Size& size) {
size = m_Size;
return AP4_SUCCESS;
}
// AP4_Referenceable methods
void AddReference();
void Release();
// methods
AP4_UI08* GetBuffer() { return m_Buffer; }
protected:
virtual ~AP4_MemoryByteStream();
private:
bool m_BufferIsLocal;
AP4_UI08* m_Buffer;
AP4_Size m_Size;
AP4_Offset m_Position;
AP4_Cardinal m_ReferenceCount;
};
#endif // _AP4_BYTE_STREAM_H_

View File

@@ -0,0 +1,39 @@
/*****************************************************************
|
| AP4 - Shared Constants
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_CONSTANTS_H_
#define _AP4_CONSTANTS_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#ifndef NULL
#define NULL 0
#endif
#endif // _AP4_CONSTANTS_H_

View File

@@ -0,0 +1,164 @@
/*****************************************************************
|
| AP4 - Container Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4Atom.h"
#include "Ap4Utils.h"
#include "Ap4ContainerAtom.h"
#include "Ap4AtomFactory.h"
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
AP4_ContainerAtom::AP4_ContainerAtom(Type type, bool is_full) :
AP4_Atom(type, is_full)
{
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
AP4_ContainerAtom::AP4_ContainerAtom(Type type, AP4_Size size, bool is_full) :
AP4_Atom(type, size, is_full)
{
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
AP4_ContainerAtom::AP4_ContainerAtom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
AP4_Atom(type, size, is_full, stream)
{
ReadChildren(atom_factory, stream, size-GetHeaderSize());
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::AP4_ContainerAtom
+---------------------------------------------------------------------*/
AP4_ContainerAtom::AP4_ContainerAtom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream) :
AP4_Atom(type, size, is_full, stream)
{
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::ReadChildren
+---------------------------------------------------------------------*/
void
AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
AP4_ByteStream& stream,
AP4_Size size)
{
AP4_Atom* atom;
AP4_Size bytes_available = size;
while (AP4_SUCCEEDED(
atom_factory.CreateAtomFromStream(stream, bytes_available, atom))) {
atom->SetParent(this);
m_Children.Add(atom);
}
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::InspectFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_ContainerAtom::InspectFields(AP4_AtomInspector& inspector)
{
return InspectChildren(inspector);
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::InspectChildren
+---------------------------------------------------------------------*/
AP4_Result
AP4_ContainerAtom::InspectChildren(AP4_AtomInspector& inspector)
{
// inspect children
m_Children.Apply(AP4_AtomListInspector(inspector));
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_ContainerAtom::WriteFields(AP4_ByteStream& stream)
{
// write all children
return m_Children.Apply(AP4_AtomListWriter(stream));
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::OnChildChanged
+---------------------------------------------------------------------*/
void
AP4_ContainerAtom::OnChildChanged(AP4_Atom*)
{
// remcompute our size
m_Size = GetHeaderSize();
m_Children.Apply(AP4_AtomSizeAdder(m_Size));
// update our parent
if (m_Parent) m_Parent->OnChildChanged(this);
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::OnChildAdded
+---------------------------------------------------------------------*/
void
AP4_ContainerAtom::OnChildAdded(AP4_Atom* child)
{
// update our size
m_Size += child->GetSize();
// update our parent
if (m_Parent) m_Parent->OnChildChanged(this);
}
/*----------------------------------------------------------------------
| AP4_ContainerAtom::OnChildRemoved
+---------------------------------------------------------------------*/
void
AP4_ContainerAtom::OnChildRemoved(AP4_Atom* child)
{
// update our size
m_Size -= child->GetSize();
// update our parent
if (m_Parent) m_Parent->OnChildChanged(this);
}

View File

@@ -0,0 +1,81 @@
/*****************************************************************
|
| AP4 - Container Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_CONTAINER_ATOM_H_
#define _AP4_CONTAINER_ATOM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Types.h"
#include "Ap4List.h"
#include "Ap4Atom.h"
/*----------------------------------------------------------------------
| class references
+---------------------------------------------------------------------*/
class AP4_ByteStream;
class AP4_AtomFactory;
/*----------------------------------------------------------------------
| AP4_ContainerAtom
+---------------------------------------------------------------------*/
class AP4_ContainerAtom : public AP4_Atom, public AP4_AtomParent {
public:
// methods
AP4_ContainerAtom(Type type, bool is_full = false);
AP4_ContainerAtom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
AP4_ContainerAtom(Type type,
AP4_Size size,
bool is_full,
AP4_ByteStream& stream);
AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result InspectChildren(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
// AP4_AtomParent methods
void OnChildChanged(AP4_Atom* child);
void OnChildAdded(AP4_Atom* child);
void OnChildRemoved(AP4_Atom* child);
protected:
// constructor
AP4_ContainerAtom(Type type, AP4_Size size, bool is_full = false);
// methods
void ReadChildren(AP4_AtomFactory& atom_factory,
AP4_ByteStream& stream,
AP4_Size size);
};
#endif // _AP4_CONTAINER_ATOM_H_

View File

@@ -0,0 +1,115 @@
/*****************************************************************
|
| AP4 - ctts Atoms
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4CttsAtom.h"
#include "Ap4AtomFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| AP4_CttsAtom::AP4_CttsAtom
+---------------------------------------------------------------------*/
AP4_CttsAtom::AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_CTTS, size, true, stream)
{
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
while (entry_count--) {
AP4_UI32 sample_count;
AP4_UI32 sample_offset;
if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
stream.ReadUI32(sample_offset) == AP4_SUCCESS) {
m_Entries.Append(AP4_CttsTableEntry(sample_count,
sample_offset));
}
}
}
/*----------------------------------------------------------------------
| AP4_CttsAtom::GetCtsOffset
+---------------------------------------------------------------------*/
AP4_Result
AP4_CttsAtom::GetCtsOffset(AP4_Ordinal sample, AP4_Offset& cts_offset)
{
AP4_Ordinal current_sample = 0;
for (unsigned int i = 0; i < m_Entries.ItemCount(); i++) {
AP4_CttsTableEntry& entry = m_Entries[i];
current_sample += entry.m_SampleCount;
// check if we have the right entry
if (current_sample >= sample) {
cts_offset = entry.m_SampleOffset;
return AP4_SUCCESS;
}
}
// sample is greater than the number of samples
return AP4_FAILURE;
}
/*----------------------------------------------------------------------
| AP4_CttsAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_CttsAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
// write the entry count
AP4_Cardinal entry_count = m_Entries.ItemCount();
result = stream.WriteUI32(entry_count);
if (AP4_FAILED(result)) return result;
// write the entries
for (AP4_Ordinal i=0; i<entry_count; i++) {
// sample count
result = stream.WriteUI32(m_Entries[i].m_SampleCount);
if (AP4_FAILED(result)) return result;
// time offset
result = stream.WriteUI32(m_Entries[i].m_SampleOffset);
if (AP4_FAILED(result)) return result;
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_CttsAtom::InspectFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_CttsAtom::InspectFields(AP4_AtomInspector& inspector)
{
inspector.AddField("entry_count", m_Entries.ItemCount());
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,73 @@
/*****************************************************************
|
| AP4 - ctts Atoms
|
| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_CTTS_ATOM_H_
#define _AP4_CTTS_ATOM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Atom.h"
#include "Ap4Types.h"
#include "Ap4Array.h"
/*----------------------------------------------------------------------
| AP4_CttsTableEntry
+---------------------------------------------------------------------*/
class AP4_CttsTableEntry {
public:
AP4_CttsTableEntry() :
m_SampleCount(0),
m_SampleOffset(0) {}
AP4_CttsTableEntry(AP4_Cardinal sample_count,
AP4_Offset sample_offset) :
m_SampleCount(sample_count),
m_SampleOffset(sample_offset) {}
AP4_Cardinal m_SampleCount;
AP4_Offset m_SampleOffset;
};
/*----------------------------------------------------------------------
| AP4_CttsAtom
+---------------------------------------------------------------------*/
class AP4_CttsAtom : public AP4_Atom
{
public:
// methods
AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result GetCtsOffset(AP4_Ordinal sample,
AP4_Offset& cts_offset);
private:
AP4_Array<AP4_CttsTableEntry> m_Entries;
};
#endif // _AP4_CTTS_ATOM_H_

View File

@@ -0,0 +1,177 @@
/*****************************************************************
|
| AP4 - Data Buffer
|
| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4DataBuffer.h"
/*----------------------------------------------------------------------
| AP4_DataBuffer::AP4_DataBuffer
+---------------------------------------------------------------------*/
AP4_DataBuffer::AP4_DataBuffer() :
m_BufferIsLocal(true),
m_Buffer(NULL),
m_BufferSize(0),
m_DataSize(0)
{
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::AP4_DataBuffer
+---------------------------------------------------------------------*/
AP4_DataBuffer::AP4_DataBuffer(AP4_Size buffer_size) :
m_BufferIsLocal(true),
m_Buffer(NULL),
m_BufferSize(buffer_size),
m_DataSize(0)
{
m_Buffer = new AP4_Byte[buffer_size];
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::AP4_DataBuffer
+---------------------------------------------------------------------*/
AP4_DataBuffer::AP4_DataBuffer(const AP4_DataBuffer& other) :
m_BufferIsLocal(true),
m_Buffer(NULL),
m_BufferSize(other.m_DataSize),
m_DataSize(other.m_DataSize)
{
m_Buffer = new AP4_Byte[m_BufferSize];
memcpy(m_Buffer, other.m_Buffer, m_BufferSize);
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::~AP4_DataBuffer
+---------------------------------------------------------------------*/
AP4_DataBuffer::~AP4_DataBuffer()
{
if (m_BufferIsLocal) {
delete[] m_Buffer;
}
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::SetBuffer
+---------------------------------------------------------------------*/
AP4_Result
AP4_DataBuffer::SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size)
{
if (m_BufferIsLocal) {
// destroy the local buffer
delete[] m_Buffer;
}
// we're now using an external buffer
m_BufferIsLocal = false;
m_Buffer = buffer;
m_BufferSize = buffer_size;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::SetBufferSize
+---------------------------------------------------------------------*/
AP4_Result
AP4_DataBuffer::SetBufferSize(AP4_Size buffer_size)
{
if (m_BufferIsLocal) {
return ReallocateBuffer(buffer_size);
} else {
return AP4_FAILURE; // you cannot change the
// buffer management mode
}
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::SetDataSize
+---------------------------------------------------------------------*/
AP4_Result
AP4_DataBuffer::SetDataSize(AP4_Size size)
{
if (size > m_BufferSize) {
if (m_BufferIsLocal) {
AP4_Result result = ReallocateBuffer(size);
if (AP4_FAILED(result)) return result;
} else {
return AP4_FAILURE;
}
}
m_DataSize = size;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::SetData
+---------------------------------------------------------------------*/
AP4_Result
AP4_DataBuffer::SetData(AP4_Byte* data, AP4_Size size)
{
if (size > m_BufferSize) {
if (m_BufferIsLocal) {
AP4_Result result = ReallocateBuffer(size);
if (AP4_FAILED(result)) return result;
} else {
return AP4_FAILURE;
}
}
memcpy(m_Buffer, data, size);
m_DataSize = size;
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DataBuffer::ReallocateBuffer
+---------------------------------------------------------------------*/
AP4_Result
AP4_DataBuffer::ReallocateBuffer(AP4_Size size)
{
// check that the existing data fits
if (m_DataSize > size) return AP4_FAILURE;
// allocate a new buffer
AP4_Byte* new_buffer = new AP4_Byte[size];
// copy the contents of the previous buffer ,is any
if (m_Buffer && m_DataSize) {
memcpy(new_buffer, m_Buffer, m_DataSize);
}
// destroy the previous buffer
delete[] m_Buffer;
// use the new buffer
m_Buffer = new_buffer;
m_BufferSize = size;
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,77 @@
/*****************************************************************
|
| AP4 - Data Buffer Objects
|
| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DATA_BUFFER_H_
#define _AP4_DATA_BUFFER_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
/*----------------------------------------------------------------------
| AP4_DataBuffer
+---------------------------------------------------------------------*/
class AP4_DataBuffer
{
public:
// constructors & destructor
AP4_DataBuffer();
AP4_DataBuffer(AP4_Size size);
AP4_DataBuffer(const AP4_DataBuffer& other);
virtual ~AP4_DataBuffer();
// data buffer handling methods
virtual AP4_Result SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size);
virtual AP4_Result SetBufferSize(AP4_Size buffer_size);
virtual AP4_Size GetBufferSize() const { return m_BufferSize; }
// data handling methods
virtual const AP4_Byte* GetData() const { return m_Buffer; }
virtual AP4_Byte* UseData() { return m_Buffer; };
virtual AP4_Size GetDataSize() const { return m_DataSize; }
virtual AP4_Result SetDataSize(AP4_Size size);
virtual AP4_Result SetData(AP4_Byte* data, AP4_Size data_size);
protected:
// members
bool m_BufferIsLocal;
AP4_Byte* m_Buffer;
AP4_Size m_BufferSize;
AP4_Size m_DataSize;
// methods
AP4_Result ReallocateBuffer(AP4_Size size);
private:
// forbid this
AP4_DataBuffer& operator=(const AP4_DataBuffer& other);
};
#endif // _AP4_DATA_BUFFER_H_

View File

@@ -0,0 +1,67 @@
/*****************************************************************
|
| AP4 - Debug Support
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include <stdarg.h>
#include <stdio.h>
#include "Ap4.h"
#include "Ap4Debug.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const int AP4_DEBUG_MAX_BUFFER = 1024;
/*----------------------------------------------------------------------
| AP4_Print
+---------------------------------------------------------------------*/
static void
AP4_Print(const char* message)
{
printf(message);
}
/*----------------------------------------------------------------------
| AP4_Debug
+---------------------------------------------------------------------*/
void
AP4_Debug(const char* format, ...)
{
va_list args;
va_start(args, format);
char buffer[AP4_DEBUG_MAX_BUFFER];
vsnprintf(buffer, sizeof(buffer), format, args);
AP4_Print(buffer);
va_end(args);
}

View File

@@ -0,0 +1,51 @@
/*****************************************************************
|
| AP4 - Debug Support
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DEBUG_H_
#define _AP4_DEBUG_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4Config.h"
/*----------------------------------------------------------------------
| AP4_Debug
+---------------------------------------------------------------------*/
extern void AP4_Debug(const char* format, ...);
/*----------------------------------------------------------------------
| AP4_ASSERT
+---------------------------------------------------------------------*/
#if defined (AP4_CONFIG_HAVE_ASSERT_H)
#include <assert.h>
#define AP4_ASSERT assert
#endif
#endif // _AP4_DEBUG_H_

View File

@@ -0,0 +1,165 @@
/*****************************************************************
|
| AP4 - DecoderConfig Descriptors
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4DecoderConfigDescriptor.h"
#include "Ap4DescriptorFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor
+---------------------------------------------------------------------*/
AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
AP4_UI08 stream_type,
AP4_UI08 oti,
AP4_UI32 buffer_size,
AP4_UI32 max_bitrate,
AP4_UI32 avg_bitrate,
AP4_DecoderSpecificInfoDescriptor* dsi) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG, 2, 13),
m_StreamType(stream_type),
m_ObjectTypeIndication(oti),
m_BufferSize(buffer_size),
m_MaxBitrate(max_bitrate),
m_AverageBitrate(avg_bitrate)
{
if (dsi) {
m_SubDescriptors.Add(dsi);
m_PayloadSize += dsi->GetSize();
m_HeaderSize = MinHeaderSize(m_PayloadSize);
}
}
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor
+---------------------------------------------------------------------*/
AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG,
header_size,
payload_size)
{
// record the start position
AP4_Offset start;
stream.Tell(start);
// read descriptor fields
stream.ReadUI08(m_ObjectTypeIndication);
unsigned char bits;
stream.ReadUI08(bits);
m_StreamType = (bits>>2)&0x3F;
m_UpStream = bits&2 ? true:false;
stream.ReadUI24(m_BufferSize);
stream.ReadUI32(m_MaxBitrate);
stream.ReadUI32(m_AverageBitrate);
// read other descriptors
AP4_SubStream* substream = new AP4_SubStream(stream, start+13, payload_size-13);
AP4_Descriptor* descriptor = NULL;
while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
descriptor)
== AP4_SUCCESS) {
m_SubDescriptors.Add(descriptor);
}
substream->Release();
}
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor::~AP4_DecoderConfigDescriptor
+---------------------------------------------------------------------*/
AP4_DecoderConfigDescriptor::~AP4_DecoderConfigDescriptor()
{
m_SubDescriptors.DeleteReferences();
}
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_DecoderConfigDescriptor::WriteFields(AP4_ByteStream& stream)
{
stream.WriteUI08(m_ObjectTypeIndication);
AP4_UI08 bits = (m_StreamType<<2) | (m_UpStream? 2 : 0) | 1;
stream.WriteUI08(bits);
stream.WriteUI24(m_BufferSize);
stream.WriteUI32(m_MaxBitrate);
stream.WriteUI32(m_AverageBitrate);
m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor::Inspect
+---------------------------------------------------------------------*/
AP4_Result
AP4_DecoderConfigDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
GetHeaderSize(),
m_PayloadSize);
inspector.StartElement("#[DecoderConfig]", info);
inspector.AddField("stream_type", m_StreamType);
inspector.AddField("object_type", m_ObjectTypeIndication);
inspector.AddField("up_stream", m_UpStream);
inspector.AddField("buffer_size", m_BufferSize);
inspector.AddField("max_bitrate", m_MaxBitrate);
inspector.AddField("avg_bitrate", m_AverageBitrate);
// inspect children
m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
inspector.EndElement();
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor
+---------------------------------------------------------------------*/
const AP4_DecoderSpecificInfoDescriptor*
AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor() const
{
// find the decoder specific info
AP4_Descriptor* descriptor = NULL;
AP4_Result result =
m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO),
descriptor);
// return it
if (AP4_SUCCEEDED(result)) {
return dynamic_cast<AP4_DecoderSpecificInfoDescriptor*>(descriptor);
} else {
return NULL;
}
}

View File

@@ -0,0 +1,88 @@
/*****************************************************************
|
| AP4 - DecoderConfig Descriptor
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DECODER_CONFIG_DESCRIPTOR_H_
#define _AP4_DECODER_CONFIG_DESCRIPTOR_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#include "Ap4List.h"
#include "Ap4Descriptor.h"
#include "Ap4DecoderSpecificInfoDescriptor.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_DECODER_CONFIG = 0x04;
/*----------------------------------------------------------------------
| AP4_DecoderConfigDescriptor
+---------------------------------------------------------------------*/
class AP4_DecoderConfigDescriptor : public AP4_Descriptor
{
public:
// methods
AP4_DecoderConfigDescriptor(AP4_UI08 stream_type,
AP4_UI08 oti,
AP4_UI32 buffer_size,
AP4_UI32 max_bitrate,
AP4_UI32 avg_bitrate,
AP4_DecoderSpecificInfoDescriptor* dsi);
AP4_DecoderConfigDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size);
virtual ~AP4_DecoderConfigDescriptor();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
// accessors
virtual const AP4_DecoderSpecificInfoDescriptor*
GetDecoderSpecificInfoDescriptor() const;
virtual AP4_UI08 GetObjectTypeIndication() const {
return m_ObjectTypeIndication;
}
virtual AP4_UI08 GetStreamType() const { return m_StreamType; }
virtual AP4_UI32 GetBufferSize() const { return m_BufferSize; }
virtual AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
virtual AP4_UI32 GetAvgBitrate() const { return m_AverageBitrate; }
private:
// members
AP4_UI08 m_StreamType;
AP4_UI08 m_ObjectTypeIndication;
bool m_UpStream;
AP4_UI32 m_BufferSize;
AP4_UI32 m_MaxBitrate;
AP4_UI32 m_AverageBitrate;
mutable AP4_List<AP4_Descriptor> m_SubDescriptors;
};
#endif // _AP4_DECODER_CONFIG_DESCRIPTOR_H_

View File

@@ -0,0 +1,98 @@
/*****************************************************************
|
| AP4 - DecoderSpecificInfo Descriptors
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4DecoderSpecificInfoDescriptor.h"
#include "Ap4DescriptorFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor
+---------------------------------------------------------------------*/
AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
const AP4_DataBuffer& data) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
MinHeaderSize(data.GetDataSize()),
data.GetDataSize()),
m_Info(data)
{
}
/*----------------------------------------------------------------------
| AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor
+---------------------------------------------------------------------*/
AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
header_size, payload_size)
{
m_Info.SetDataSize(payload_size);
stream.Read(m_Info.UseData(), payload_size);
}
/*----------------------------------------------------------------------
| AP4_DecoderSpecificInfoDescriptor::~AP4_DecoderSpecificInfoDescriptor
+---------------------------------------------------------------------*/
AP4_DecoderSpecificInfoDescriptor::~AP4_DecoderSpecificInfoDescriptor()
{
}
/*----------------------------------------------------------------------
| AP4_DecoderSpecificInfoDescriptor::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_DecoderSpecificInfoDescriptor::WriteFields(AP4_ByteStream& stream)
{
// write the info buffer
if (m_PayloadSize && m_Info.GetDataSize()) {
stream.Write(m_Info.GetData(), m_Info.GetDataSize());
}
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_DecoderSpecificInfoDescriptor::Inspect
+---------------------------------------------------------------------*/
AP4_Result
AP4_DecoderSpecificInfoDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char* info = new char[m_Info.GetDataSize()*3+1];
for (unsigned int i=0; i<m_Info.GetDataSize(); i++) {
AP4_StringFormat(&info[i*3], 3, "%02x ", m_Info.UseData()[i]);
}
info[m_Info.GetDataSize()*3] = '\0';
inspector.AddField("#[DecoderSpecificInfo]", info);
delete[] info;
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,67 @@
/*****************************************************************
|
| AP4 - DecoderSpecificInfo Descriptor
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
#define _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#include "Ap4List.h"
#include "Ap4Descriptor.h"
#include "Ap4DataBuffer.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO = 0x05;
/*----------------------------------------------------------------------
| AP4_DecoderSpecificInfoDescriptor
+---------------------------------------------------------------------*/
class AP4_DecoderSpecificInfoDescriptor : public AP4_Descriptor
{
public:
// methods
AP4_DecoderSpecificInfoDescriptor(const AP4_DataBuffer& data);
AP4_DecoderSpecificInfoDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size);
virtual ~AP4_DecoderSpecificInfoDescriptor();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
virtual const AP4_DataBuffer& GetDecoderSpecificInfo() const { return m_Info; }
private:
// members
AP4_DataBuffer m_Info;
};
#endif // _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_

View File

@@ -0,0 +1,116 @@
/*****************************************************************
|
| AP4 - Descriptors
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4Descriptor.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| AP4_Descriptor::MinHeaderSize
+---------------------------------------------------------------------*/
AP4_Size
AP4_Descriptor::MinHeaderSize(AP4_Size payload_size)
{
// compute how many bytes are needed to encode the payload size
// plus tag
return 2+(payload_size/128);
}
/*----------------------------------------------------------------------
| AP4_Descriptor::AP4_Descriptor
+---------------------------------------------------------------------*/
AP4_Descriptor::AP4_Descriptor(Tag tag,
AP4_Size header_size,
AP4_Size payload_size) :
m_Tag(tag),
m_HeaderSize(header_size),
m_PayloadSize(payload_size)
{
AP4_ASSERT(header_size >= 1+1);
AP4_ASSERT(header_size <= 1+4);
}
/*----------------------------------------------------------------------
| AP4_Descriptor::Write
+---------------------------------------------------------------------*/
AP4_Result
AP4_Descriptor::Write(AP4_ByteStream& stream)
{
AP4_Result result;
// write the tag
result = stream.WriteUI08(m_Tag);
if (AP4_FAILED(result)) return result;
// write the size
AP4_ASSERT(m_HeaderSize-1 <= 8);
AP4_ASSERT(m_HeaderSize >= 2);
unsigned int size = m_PayloadSize;
unsigned char bytes[8];
// last bytes of the encoded size
bytes[m_HeaderSize-2] = size&0x7F;
// leading bytes of the encoded size
for (int i=m_HeaderSize-3; i>=0; i--) {
// move to the next 7 bits
size >>= 7;
// output a byte with a top bit marker
bytes[i] = (size&0x7F) | 0x80;
}
result = stream.Write(bytes, m_HeaderSize-1);
if (AP4_FAILED(result)) return result;
// write the fields
WriteFields(stream);
return result;
}
/*----------------------------------------------------------------------
| AP4_Descriptor::Inspect
+---------------------------------------------------------------------*/
AP4_Result
AP4_Descriptor::Inspect(AP4_AtomInspector& inspector)
{
char name[6];
AP4_StringFormat(name, sizeof(name), "#[%02x]", m_Tag);
char info[64];
AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
GetHeaderSize(),
m_PayloadSize);
inspector.StartElement(name, info);
inspector.EndElement();
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,116 @@
/*****************************************************************
|
| AP4 - Descriptors
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DESCRIPTOR_H_
#define _AP4_DESCRIPTOR_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#include "Ap4List.h"
#include "Ap4Atom.h"
/*----------------------------------------------------------------------
| AP4_Descriptor
+---------------------------------------------------------------------*/
class AP4_Descriptor
{
public:
// types
typedef unsigned char Tag;
// class methods
static AP4_Size MinHeaderSize(AP4_Size payload_size);
// methods
AP4_Descriptor(Tag tag, AP4_Size header_size, AP4_Size payload_size);
virtual ~AP4_Descriptor() {}
Tag GetTag() { return m_Tag; }
AP4_Size GetSize() { return m_PayloadSize+m_HeaderSize; }
AP4_Size GetHeaderSize() { return m_HeaderSize; }
virtual AP4_Result Write(AP4_ByteStream& stream);
virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
protected:
// members
Tag m_Tag;
AP4_Size m_HeaderSize;
AP4_Size m_PayloadSize;
};
/*----------------------------------------------------------------------
| AP4_DescriptorFinder
+---------------------------------------------------------------------*/
class AP4_DescriptorFinder : public AP4_List<AP4_Descriptor>::Item::Finder
{
public:
AP4_DescriptorFinder(AP4_Descriptor::Tag tag) : m_Tag(tag) {}
AP4_Result Test(AP4_Descriptor* descriptor) const {
return descriptor->GetTag() == m_Tag ? AP4_SUCCESS : AP4_FAILURE;
}
private:
AP4_Descriptor::Tag m_Tag;
};
/*----------------------------------------------------------------------
| AP4_DescriptorListWriter
+---------------------------------------------------------------------*/
class AP4_DescriptorListWriter : public AP4_List<AP4_Descriptor>::Item::Operator
{
public:
AP4_DescriptorListWriter(AP4_ByteStream& stream) :
m_Stream(stream) {}
AP4_Result Action(AP4_Descriptor* descriptor) const {
return descriptor->Write(m_Stream);
}
private:
AP4_ByteStream& m_Stream;
};
/*----------------------------------------------------------------------
| AP4_DescriptorListInspector
+---------------------------------------------------------------------*/
class AP4_DescriptorListInspector : public AP4_List<AP4_Descriptor>::Item::Operator
{
public:
AP4_DescriptorListInspector(AP4_AtomInspector& inspector) :
m_Inspector(inspector) {}
AP4_Result Action(AP4_Descriptor* descriptor) const {
descriptor->Inspect(m_Inspector);
return AP4_SUCCESS;
}
private:
AP4_AtomInspector& m_Inspector;
};
#endif // _AP4_DESCRIPTOR_H_

View File

@@ -0,0 +1,108 @@
/*****************************************************************
|
| AP4 - Descriptor Factory
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4DescriptorFactory.h"
#include "Ap4EsDescriptor.h"
#include "Ap4DecoderConfigDescriptor.h"
#include "Ap4DecoderSpecificInfoDescriptor.h"
#include "Ap4SLConfigDescriptor.h"
#include "Ap4UnknownDescriptor.h"
/*----------------------------------------------------------------------
| AP4_DescriptorFactory::CreateDescriptorFromStream
+---------------------------------------------------------------------*/
AP4_Result
AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream,
AP4_Descriptor*& descriptor)
{
AP4_Result result;
// NULL by default
descriptor = NULL;
// remember current stream offset
AP4_Offset offset;
stream.Tell(offset);
// read descriptor tag
unsigned char tag;
result = stream.ReadUI08(tag);
if (AP4_FAILED(result)) {
stream.Seek(offset);
return result;
}
// read descriptor size
unsigned long payload_size = 0;
unsigned int header_size = 1;
unsigned int max = 4;
unsigned char ext = 0;
do {
header_size++;
result = stream.ReadUI08(ext);
if (AP4_FAILED(result)) {
stream.Seek(offset);
return result;
}
payload_size = (payload_size<<7) + (ext&0x7F);
} while (--max && (ext&0x80));
// create the descriptor
switch (tag) {
case AP4_DESCRIPTOR_TAG_ES:
descriptor = new AP4_EsDescriptor(stream, header_size, payload_size);
break;
case AP4_DESCRIPTOR_TAG_DECODER_CONFIG:
descriptor = new AP4_DecoderConfigDescriptor(stream, header_size, payload_size);
break;
case AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO:
descriptor = new AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size);
break;
case AP4_DESCRIPTOR_TAG_SL_CONFIG:
if (payload_size != 1) return AP4_ERROR_INVALID_FORMAT;
descriptor = new AP4_SLConfigDescriptor(header_size);
break;
default:
descriptor = new AP4_UnknownDescriptor(stream, tag, header_size, payload_size);
break;
}
// skip to the end of the descriptor
stream.Seek(offset+header_size+payload_size);
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,50 @@
/*****************************************************************
|
| AP4 - Descriptor Factory
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DESCRIPTOR_FACTORY_H_
#define _AP4_DESCRIPTOR_FACTORY_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4Descriptor.h"
#include "Ap4ByteStream.h"
/*----------------------------------------------------------------------
| AP4_DescriptorFactory
+---------------------------------------------------------------------*/
class AP4_DescriptorFactory
{
public:
// class methods
static AP4_Result CreateDescriptorFromStream(AP4_ByteStream& stream,
AP4_Descriptor*& descriptor);
};
#endif // _AP4_DESCRIPTOR_FACTORY_H_

View File

@@ -0,0 +1,88 @@
/*****************************************************************
|
| AP4 - dref Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4DrefAtom.h"
#include "Ap4AtomFactory.h"
#include "Ap4Utils.h"
#include "Ap4ContainerAtom.h"
/*----------------------------------------------------------------------
| AP4_DrefAtom::AP4_DrefAtom
+---------------------------------------------------------------------*/
AP4_DrefAtom::AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count) :
AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, AP4_FULL_ATOM_HEADER_SIZE+4, true)
{
for (unsigned i=0; i<refs_count; i++) {
m_Children.Add(refs[i]);
m_Size += refs[i]->GetSize();
}
}
/*----------------------------------------------------------------------
| AP4_DrefAtom::AP4_DrefAtom
+---------------------------------------------------------------------*/
AP4_DrefAtom::AP4_DrefAtom(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory) :
AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, size, true, stream)
{
// read the number of entries
AP4_UI32 entry_count;
stream.ReadUI32(entry_count);
// read children
AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
while (entry_count--) {
AP4_Atom* atom;
while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
bytes_available,
atom))) {
m_Children.Add(atom);
}
}
}
/*----------------------------------------------------------------------
| AP4_DrefAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_DrefAtom::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
// write the number of entries
result = stream.WriteUI32(m_Children.ItemCount());
if (AP4_FAILED(result)) return result;
// write the children
return m_Children.Apply(AP4_AtomListWriter(stream));
}

View File

@@ -0,0 +1,56 @@
/*****************************************************************
|
| AP4 - dref Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_DREF_ATOM_H_
#define _AP4_DREF_ATOM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#include "Ap4Array.h"
#include "Ap4Atom.h"
#include "Ap4AtomFactory.h"
#include "Ap4ContainerAtom.h"
/*----------------------------------------------------------------------
| AP4_DrefAtom
+---------------------------------------------------------------------*/
class AP4_DrefAtom : public AP4_ContainerAtom
{
public:
// methods
AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count);
AP4_DrefAtom(AP4_Size size,
AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
};
#endif // _AP4_DREF_ATOM_H_

View File

@@ -0,0 +1,205 @@
/*****************************************************************
|
| AP4 - ES Descriptors
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4EsDescriptor.h"
#include "Ap4DescriptorFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| AP4_EsDescriptor::AP4_EsDescriptor
+---------------------------------------------------------------------*/
AP4_EsDescriptor::AP4_EsDescriptor(AP4_UI16 es_id) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, 2, 2+1),
m_EsId(es_id),
m_OcrEsId(0),
m_Flags(0),
m_StreamPriority(0),
m_DependsOn(0)
{
}
/*----------------------------------------------------------------------
| AP4_EsDescriptor::AP4_EsDescriptor
+---------------------------------------------------------------------*/
AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size) :
AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, header_size, payload_size)
{
AP4_Offset start;
stream.Tell(start);
// read descriptor fields
stream.ReadUI16(m_EsId);
unsigned char bits;
stream.ReadUI08(bits);
m_Flags = (bits>>5)&7;
m_StreamPriority = bits&0x1F;
if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
stream.ReadUI16(m_DependsOn);
} else {
m_DependsOn = 0;
}
if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
unsigned char url_length;
stream.ReadUI08(url_length);
if (url_length) {
char* url = new char[url_length+1];
if (url) {
stream.Read(url, url_length, NULL);
url[url_length] = '\0';
m_Url = url;
delete[] url;
}
}
}
if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
stream.ReadUI16(m_OcrEsId);
} else {
m_OcrEsId = 0;
}
// read other descriptors
AP4_Offset offset;
stream.Tell(offset);
AP4_SubStream* substream = new AP4_SubStream(stream, offset,
payload_size-(offset-start));
AP4_Descriptor* descriptor = NULL;
while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
descriptor)
== AP4_SUCCESS) {
m_SubDescriptors.Add(descriptor);
}
substream->Release();
}
/*----------------------------------------------------------------------
| AP4_EsDescriptor::~AP4_EsDescriptor
+---------------------------------------------------------------------*/
AP4_EsDescriptor::~AP4_EsDescriptor()
{
m_SubDescriptors.DeleteReferences();
}
/*----------------------------------------------------------------------
| AP4_EsDescriptor::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_EsDescriptor::WriteFields(AP4_ByteStream& stream)
{
AP4_Result result;
// es id
result = stream.WriteUI16(m_EsId);
if (AP4_FAILED(result)) return result;
// flags and other bits
AP4_UI08 bits = m_StreamPriority | (AP4_UI08)(m_Flags<<5);
result = stream.WriteUI08(bits);
if (AP4_FAILED(result)) return result;
// optional fields
if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
result = stream.WriteUI16(m_DependsOn);
if (AP4_FAILED(result)) return result;
}
if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
result = stream.WriteUI08(m_Url.length());
if (AP4_FAILED(result)) return result;
result = stream.WriteString(m_Url.c_str());
if (AP4_FAILED(result)) return result;
result = stream.WriteUI08(0);
if (AP4_FAILED(result)) return result;
}
if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM) {
result = stream.WriteUI16(m_OcrEsId);
if (AP4_FAILED(result)) return result;
}
// write the sub descriptors
m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_EsDescriptor::Inspect
+---------------------------------------------------------------------*/
AP4_Result
AP4_EsDescriptor::Inspect(AP4_AtomInspector& inspector)
{
char info[64];
AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
GetHeaderSize(),m_PayloadSize);
inspector.StartElement("#[ES]", info);
inspector.AddField("es_id", m_EsId);
inspector.AddField("stream_priority", m_StreamPriority);
// inspect children
m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
inspector.EndElement();
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_EsDescriptor::AddSubDescriptor
+---------------------------------------------------------------------*/
AP4_Result
AP4_EsDescriptor::AddSubDescriptor(AP4_Descriptor* descriptor)
{
m_SubDescriptors.Add(descriptor);
m_PayloadSize += descriptor->GetSize();
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_EsDescriptor::GetDecoderConfigDescriptor
+---------------------------------------------------------------------*/
const AP4_DecoderConfigDescriptor*
AP4_EsDescriptor::GetDecoderConfigDescriptor() const
{
// find the decoder config descriptor
AP4_Descriptor* descriptor = NULL;
AP4_Result result =
m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_CONFIG),
descriptor);
// return it
if (AP4_SUCCEEDED(result)) {
return dynamic_cast<AP4_DecoderConfigDescriptor*>(descriptor);
} else {
return NULL;
}
}

View File

@@ -0,0 +1,78 @@
/*****************************************************************
|
| AP4 - ES Descriptor
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_ES_DESCRIPTOR_H_
#define _AP4_ES_DESCRIPTOR_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#include "Ap4List.h"
#include "Ap4Descriptor.h"
#include "Ap4DecoderConfigDescriptor.h"
/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_ES = 0x03;
const int AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY = 1;
const int AP4_ES_DESCRIPTOR_FLAG_URL = 2;
const int AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM = 4;
/*----------------------------------------------------------------------
| AP4_EsDescriptor
+---------------------------------------------------------------------*/
class AP4_EsDescriptor : public AP4_Descriptor
{
public:
// methods
AP4_EsDescriptor(AP4_UI16 es_id);
AP4_EsDescriptor(AP4_ByteStream& stream,
AP4_Size header_size,
AP4_Size payload_size);
~AP4_EsDescriptor();
virtual AP4_Result AddSubDescriptor(AP4_Descriptor* descriptor);
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
virtual const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor() const;
private:
// members
unsigned short m_EsId;
unsigned short m_OcrEsId;
AP4_Flags m_Flags;
unsigned char m_StreamPriority;
unsigned short m_DependsOn;
AP4_String m_Url;
mutable AP4_List<AP4_Descriptor> m_SubDescriptors;
};
#endif // _AP4_ES_DESCRIPTOR_H_

View File

@@ -0,0 +1,95 @@
/*****************************************************************
|
| AP4 - esds Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4EsdsAtom.h"
#include "Ap4DescriptorFactory.h"
#include "Ap4Utils.h"
/*----------------------------------------------------------------------
| AP4_EsdsAtom::AP4_EsdsAtom
+---------------------------------------------------------------------*/
AP4_EsdsAtom::AP4_EsdsAtom(AP4_EsDescriptor* descriptor) :
AP4_Atom(AP4_ATOM_TYPE_ESDS, AP4_FULL_ATOM_HEADER_SIZE, true),
m_EsDescriptor(descriptor)
{
if (m_EsDescriptor) m_Size += m_EsDescriptor->GetSize();
}
/*----------------------------------------------------------------------
| AP4_EsdsAtom::AP4_EsdsAtom
+---------------------------------------------------------------------*/
AP4_EsdsAtom::AP4_EsdsAtom(AP4_Size size, AP4_ByteStream& stream) :
AP4_Atom(AP4_ATOM_TYPE_ESDS, size, true, stream)
{
// read descriptor
AP4_Descriptor* descriptor = NULL;
if (AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor)
== AP4_SUCCESS) {
m_EsDescriptor = dynamic_cast<AP4_EsDescriptor*>(descriptor);
} else {
m_EsDescriptor = NULL;
}
}
/*----------------------------------------------------------------------
| AP4_EsdsAtom::~AP4_EsdsAtom
+---------------------------------------------------------------------*/
AP4_EsdsAtom::~AP4_EsdsAtom()
{
delete m_EsDescriptor;
}
/*----------------------------------------------------------------------
| AP4_EsdsAtom::WriteFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_EsdsAtom::WriteFields(AP4_ByteStream& stream)
{
// write the es descriptor
if (m_EsDescriptor) return m_EsDescriptor->Write(stream);
return AP4_SUCCESS;
}
/*----------------------------------------------------------------------
| AP4_EsdsAtom::InspectFields
+---------------------------------------------------------------------*/
AP4_Result
AP4_EsdsAtom::InspectFields(AP4_AtomInspector& inspector)
{
// inspect descriptor
if (m_EsDescriptor) {
m_EsDescriptor->Inspect(inspector);
}
return AP4_SUCCESS;
}

View File

@@ -0,0 +1,61 @@
/*****************************************************************
|
| AP4 - esds Atoms
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_ESDS_ATOM_H_
#define _AP4_ESDS_ATOM_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#include "Ap4List.h"
#include "Ap4Atom.h"
#include "Ap4EsDescriptor.h"
#include "Ap4AtomFactory.h"
/*----------------------------------------------------------------------
| AP4_EsdsAtom
+---------------------------------------------------------------------*/
class AP4_EsdsAtom : public AP4_Atom
{
public:
// methods
AP4_EsdsAtom(AP4_EsDescriptor* descriptor);
AP4_EsdsAtom(AP4_Size size, AP4_ByteStream& stream);
~AP4_EsdsAtom();
virtual AP4_Result WriteFields(AP4_ByteStream& stream);
virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
const AP4_EsDescriptor* GetEsDescriptor() const { return m_EsDescriptor; }
private:
// members
AP4_EsDescriptor* m_EsDescriptor;
};
#endif // _AP4_ESDS_ATOM_H_

View File

@@ -0,0 +1,90 @@
/*****************************************************************
|
| AP4 - File
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4File.h"
#include "Ap4Atom.h"
#include "Ap4TrakAtom.h"
#include "Ap4MoovAtom.h"
#include "Ap4MvhdAtom.h"
#include "Ap4AtomFactory.h"
/*----------------------------------------------------------------------
| AP4_File::AP4_File
+---------------------------------------------------------------------*/
AP4_File::AP4_File(AP4_Movie* movie) :
m_Movie(movie)
{
}
/*----------------------------------------------------------------------
| AP4_File::AP4_File
+---------------------------------------------------------------------*/
AP4_File::AP4_File(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) :
m_Movie(NULL)
{
// get all atoms
AP4_Atom* atom;
while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
switch (atom->GetType()) {
case AP4_ATOM_TYPE_MOOV:
m_Movie = new AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
stream);
break;
default:
m_OtherAtoms.Add(atom);
}
}
}
/*----------------------------------------------------------------------
| AP4_File::~AP4_File
+---------------------------------------------------------------------*/
AP4_File::~AP4_File()
{
delete m_Movie;
m_OtherAtoms.DeleteReferences();
}
/*----------------------------------------------------------------------
| AP4_File::Inspect
+---------------------------------------------------------------------*/
AP4_Result
AP4_File::Inspect(AP4_AtomInspector& inspector)
{
// dump the moov atom first
if (m_Movie) m_Movie->Inspect(inspector);
// dump the other atoms
m_OtherAtoms.Apply(AP4_AtomListInspector(inspector));
return AP4_SUCCESS;
}

65
Source/C++/Core/Ap4File.h Normal file
View File

@@ -0,0 +1,65 @@
/*****************************************************************
|
| AP4 - File
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
#ifndef _AP4_FILE_H_
#define _AP4_FILE_H_
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4Atom.h"
#include "Ap4Track.h"
#include "Ap4List.h"
#include "Ap4Movie.h"
#include "Ap4ByteStream.h"
#include "Ap4AtomFactory.h"
/*----------------------------------------------------------------------
| AP4_File
+---------------------------------------------------------------------*/
class AP4_File {
public:
// constructors and destructor
AP4_File(AP4_Movie* movie);
AP4_File(AP4_ByteStream& stream,
AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory);
virtual ~AP4_File();
// methods
AP4_List<AP4_Atom>& GetOtherAtoms() { return m_OtherAtoms;}
AP4_Movie* GetMovie() { return m_Movie; }
virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
private:
// members
AP4_Movie* m_Movie;
AP4_List<AP4_Atom> m_OtherAtoms;
};
#endif // _AP4_FILE_H_

View File

@@ -0,0 +1,90 @@
/*****************************************************************
|
| AP4 - FileByteStream
|
| Copyright 2002 Gilles Boccon-Gibod
|
|
| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
|
| Unless you have obtained Bento4 under a difference license,
| this version of Bento4 is Bento4|GPL.
| Bento4|GPL is free software; you can redistribute it and/or modify
| it under the terms of the GNU General Public License as published by
| the Free Software Foundation; either version 2, or (at your option)
| any later version.
|
| Bento4|GPL 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 General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with Bento4|GPL; see the file COPYING. If not, write to the
| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
| 02111-1307, USA.
|
****************************************************************/
/*----------------------------------------------------------------------
| includes
+---------------------------------------------------------------------*/
#include "Ap4.h"
#include "Ap4ByteStream.h"
#ifndef _AP4_FILE_BYTE_STREAM_H_
#define _AP4_FILE_BYTE_STREAM_H_
/*----------------------------------------------------------------------
| AP4_FileByteStream
+---------------------------------------------------------------------*/
class AP4_FileByteStream: public AP4_ByteStream
{
public:
// types
typedef enum {
STREAM_MODE_READ,
STREAM_MODE_WRITE
} Mode;
// methods
AP4_FileByteStream(const char* name, Mode mode);
// AP4_ByteStream methods
AP4_Result Read(void* buffer,
AP4_Size bytesToRead,
AP4_Size* bytesRead) {
return m_Delegate->Read(buffer, bytesToRead, bytesRead);
}
AP4_Result Write(const void* buffer,
AP4_Size bytesToWrite,
AP4_Size* bytesWritten) {
return m_Delegate->Write(buffer, bytesToWrite, bytesWritten);
}
AP4_Result Seek(AP4_Offset offset) { return m_Delegate->Seek(offset); }
AP4_Result Tell(AP4_Offset& offset) { return m_Delegate->Tell(offset); }
AP4_Result GetSize(AP4_Size& size) { return m_Delegate->GetSize(size);}
// AP4_Referenceable methods
void AddReference() { m_Delegate->AddReference(); }
void Release() { m_Delegate->Release(); }
protected:
// methods
virtual ~AP4_FileByteStream() {
delete m_Delegate;
}
// members
AP4_ByteStream* m_Delegate;
};
#endif // _AP4_FILE_BYTE_STREAM_H_

Some files were not shown because too many files have changed in this diff Show More