Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nu774/m4acut
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.1
Choose a base ref
...
head repository: nu774/m4acut
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 1,466 additions and 93 deletions.
  1. +34 −0 .gitignore
  2. +11 −9 INSTALL
  3. +5 −1 MSVC/m4acut.props
  4. +9 −5 MSVC/m4acut.vcxproj
  5. +8 −2 MSVC/m4acut.vcxproj.filters
  6. +4 −0 Makefile.am
  7. +23 −7 configure.ac
  8. 0 m4/.gitkeep
  9. +119 −0 m4/lib-ld.m4
  10. +777 −0 m4/lib-link.m4
  11. +224 −0 m4/lib-prefix.m4
  12. +136 −48 src/M4ATrimmer.cpp
  13. +13 −4 src/M4ATrimmer.h
  14. +4 −3 src/StringConverterIConv.cpp
  15. +2 −1 src/StringConverterUTF8.cpp
  16. +1 −0 src/StringConverterWin32.cpp
  17. +56 −0 src/bitstream.cpp
  18. +33 −0 src/bitstream.h
  19. +4 −11 src/compat_win32.c
  20. +2 −1 src/main.cpp
  21. +1 −1 src/version.h
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# automatically copied or created by autoreconf
/autom4te.cache/
/build-aux/

/m4/libtool.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/aclocal.m4

/config.h*
/configure
/Makefile.in


# created by configure
/Makefile

/config.log
/config.status
/libtool
/stamp-h1

.libs
.deps
.dirstamp


# object files and executables
/m4acut
*.o
*.exe
*.app
20 changes: 11 additions & 9 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -17,15 +17,17 @@ You can build and install m4acut in the following step.
Windows, MSVC
-------------

This is much more difficult than building in MinGW.
Even if you want to stick to MSVC, note that L-SMASH cannot be built with MSVC.
You have to build it using MinGW GCC compiler (I don't explain how to do it).
Also, note that static linking between binaries generated by different toolsets
can have potential issues, and at least requires some additional runtime
libs of GCC/MinGW. Dynamic linking should be easier.
First, you have to build L-SMASH.
Since L-SMASH is written in C99, it requires Visual Studio 2013 or later,
otherwise you have to build it in MinGW.

Before building m4acut, you have to edit MSVC/m4acut.props as you need.
By default, value of LSMASH_INCLUDE and LSMASH_LIBDIR is not set (nil).
Then, you have to edit MSVC/m4acut.props as you need.
By default, value of LSMASH_INCLUDE and LSMASH_LIBDIR is not set.
Depending on your environment, you have to set appropriate directory path
so that MSVC can find them.
Also, enumerate libraries in LSMASH_LIB (separator is semicolon).
Also, enumerate libraries in LSMASH_LIB (separator is semicolon). If you want
to statically link to L-SMASH build with MinGW, you will need several MinGW
related runtime library here (not recommended). Otherwise, you will only need
lsmash itself.
If you are linking to L-SMASH DLL, LSMASH_API_IMPORTS is required to be set in
LSMASH_CPPFLAGS. Otherwise, remove it and leave LSMASH_CPPFLAGS empty.
6 changes: 5 additions & 1 deletion MSVC/m4acut.props
Original file line number Diff line number Diff line change
@@ -2,13 +2,17 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<LSMASH_CPPFLAGS>LSMASH_API_IMPORTS;HAVE_COMPACT_SAMPLE_SIZE_TABLE</LSMASH_CPPFLAGS>
<LSMASH_INCLUDE />
<LSMASH_LIB>lsmash.lib</LSMASH_LIB>
<LSMASH_LIB>liblsmash.lib</LSMASH_LIB>
<LSMASH_LIBDIR />
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup>
<BuildMacro Include="LSMASH_CPPFLAGS">
<Value>$(LSMASH_CPPFLAGS)</Value>
</BuildMacro>
<BuildMacro Include="LSMASH_INCLUDE">
<Value>$(LSMASH_INCLUDE)</Value>
</BuildMacro>
14 changes: 9 additions & 5 deletions MSVC/m4acut.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@@ -20,12 +20,14 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@@ -51,8 +53,8 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../missings;$(LSMASH_INCLUDE)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(LSMASH_CPPFLAGS);_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../missings;$(LSMASH_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -69,8 +71,8 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../missings;$(LSMASH_INCLUDE)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(LSMASH_CPPFLAGS);_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../missings;$(LSMASH_INCLUDE);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -83,6 +85,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\missings\getopt.c" />
<ClCompile Include="..\src\bitstream.cpp" />
<ClCompile Include="..\src\compat_win32.c" />
<ClCompile Include="..\src\cuesheet.cpp" />
<ClCompile Include="..\src\M4ATrimmer.cpp" />
@@ -92,6 +95,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\missings\getopt.h" />
<ClInclude Include="..\src\bitstream.h" />
<ClInclude Include="..\src\compat.h" />
<ClInclude Include="..\src\cuesheet.h" />
<ClInclude Include="..\src\die.h" />
10 changes: 8 additions & 2 deletions MSVC/m4acut.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
@@ -36,6 +36,9 @@
<ClCompile Include="..\missings\getopt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bitstream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\missings\getopt.h">
@@ -62,5 +65,8 @@
<ClInclude Include="..\src\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bitstream.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>
4 changes: 4 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AM_CXXFLAGS = -Wall
AM_CFLAGS = -Wall

ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = subdir-objects

@@ -8,6 +11,7 @@ dist_man_MANS = man/m4acut.1
m4acut_SOURCES = src/M4ATrimmer.cpp \
src/MP4Edits.cpp \
src/StringConverterUTF8.cpp \
src/bitstream.cpp \
src/cuesheet.cpp \
src/main.cpp

30 changes: 23 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -4,27 +4,38 @@ m4_define({{XX_VERSION}},m4_bregexp(VERSION_H,{{^const.*"\(.+\)";}},{{\1}}))
changequote([,])dnl

AC_INIT([m4acut], [XX_VERSION], [honeycomb77@gmail.com])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

m4_esyscmd([mkdir -p build-aux && cp -f config.rpath build-aux])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign])

AC_PROG_CC
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
LT_INIT

# Checks for libraries and header files.
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/time.h sys/timeb.h])
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX_11(noext,mandatory)

AC_CHECK_HEADER([stdint.h])
AC_CHECK_FUNCS([_vscprintf getopt_long])
AC_CHECK_TYPES([struct __timeb64],[],[],[[#include <sys/timeb.h>]])
AM_CONDITIONAL([AAC_NO_GETOPT_LONG],[test "$ac_cv_func_getopt_long" != "yes"])
AX_CXX_COMPILE_STDCXX_11(noext,optional)
AS_IF([test -z $HAVE_CXX11],[CXXFLAGS="$CXXFLAGS -std=c++0x"])
AC_SEARCH_LIBS([lsmash_get_tyrant_chapter],[lsmash],,
[AC_MSG_ERROR(L-SMASH version 1.10.0 or greater required)])
AC_CHECK_MEMBER([lsmash_media_parameters_t.compact_sample_size_table],
[AC_DEFINE_UNQUOTED([HAVE_COMPACT_SAMPLE_SIZE_TABLE],[1],
[have compact_sample_size_table field])],
[],[[#include <lsmash.h>]])
AM_ICONV
AM_CONDITIONAL([AAC_HAVE_ICONV],[test "$am_cv_func_iconv" = "yes"])
AC_CANONICAL_HOST

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_TYPES([struct __timeb64],[],[],[[#include <sys/timeb.h>]])

X_PLATFORM=posix
case ${host} in
*-*-mingw*)
@@ -34,6 +45,11 @@ esac
AM_CONDITIONAL([AAC_PLATFORM_POSIX],[test "$X_PLATFORM" = "posix"])
AM_CONDITIONAL([AAC_PLATFORM_WIN32],[test "$X_PLATFORM" = "win32"])

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([_vscprintf getopt_long atexit ftime gettimeofday memset setlocale strchr strerror])
AM_CONDITIONAL([AAC_NO_GETOPT_LONG],[test "$ac_cv_func_getopt_long" != "yes"])

AC_CONFIG_FILES([Makefile])

AC_OUTPUT
Empty file removed m4/.gitkeep
Empty file.
119 changes: 119 additions & 0 deletions m4/lib-ld.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# lib-ld.m4 serial 6
dnl Copyright (C) 1996-2003, 2009-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl Subroutines of libtool.m4,
dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
dnl collision with libtool.m4.

dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
AC_DEFUN([AC_LIB_PROG_LD_GNU],
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
[# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
acl_cv_prog_gnu_ld=yes
;;
*)
acl_cv_prog_gnu_ld=no
;;
esac])
with_gnu_ld=$acl_cv_prog_gnu_ld
])

dnl From libtool-2.4. Sets the variable LD.
AC_DEFUN([AC_LIB_PROG_LD],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_ARG_WITH([gnu-ld],
[AS_HELP_STRING([--with-gnu-ld],
[assume the C compiler uses GNU ld [default=no]])],
[test "$withval" = no || with_gnu_ld=yes],
[with_gnu_ld=no])dnl
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
# Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
# contains only /bin. Note that ksh looks also at the FPATH variable,
# so we have to set that as well for the test.
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
&& { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
|| PATH_SEPARATOR=';'
}
fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by $CC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[[\\/]]* | ?:[[\\/]]*)
re_direlt='/[[^/]][[^/]]*/\.\./'
# Canonicalize the pathname of ld
ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL([acl_cv_path_LD],
[if test -z "$LD"; then
acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
for ac_dir in $PATH; do
IFS="$acl_save_ifs"
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
acl_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some variants of GNU ld only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
test "$with_gnu_ld" != no && break
;;
*)
test "$with_gnu_ld" != yes && break
;;
esac
fi
done
IFS="$acl_save_ifs"
else
acl_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$acl_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT([$LD])
else
AC_MSG_RESULT([no])
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_LIB_PROG_LD_GNU
])
Loading