1
0
mirror of https://github.com/nu774/fdkaac.git synced 2025-06-05 23:29:14 +02:00

6 Commits

Author SHA1 Message Date
2642af896e bump version 2013-02-03 12:11:50 +09:00
7ce09815f7 win32: change _wfopen() -> wfsopen() 2013-02-03 12:11:13 +09:00
adbd1aac0e update README (add note for character encoding) 2013-01-30 14:27:37 +09:00
fe4d497877 bump version 2013-01-28 10:54:37 +09:00
bd3b4b343a gracefully shutdown on signals 2013-01-28 10:53:19 +09:00
406f0e0f44 fix MSVC project build issue 2013-01-27 11:11:03 +09:00
7 changed files with 74 additions and 6 deletions

View File

@ -52,13 +52,20 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>HAVE_STDINT_H;inline=__inline;_CRT_SECURE_NO_WARNINGS;WIN32;_CONSOLE;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>HAVE_STDINT_H;inline=__inline;_CRT_SECURE_NO_WARNINGS;WIN32;_CONSOLE;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../fdk-aac/libSYS/include;../fdk-aac/libAACenc/include;../missings;.;..</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./include;../missings;.;..</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<PreBuildEvent>
<Command>copy ..\fdk-aac\libAACdec\include\aacdecoder_lib.h include\fdk-aac\
copy ..\fdk-aac\libAACenc\include\aacenc_lib.h include\fdk-aac\
copy ..\fdk-aac\libSYS\include\FDK_Audio.h include\fdk-aac\
copy ..\fdk-aac\libSYS\include\genericStds.h include\fdk-aac\
copy ..\fdk-aac\libSYS\include\machine_type.h include\fdk-aac\ </Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
@ -69,7 +76,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HAVE_STDINT_H;inline=__inline;_CRT_SECURE_NO_WARNINGS;WIN32;_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>HAVE_STDINT_H;inline=__inline;_CRT_SECURE_NO_WARNINGS;WIN32;_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../fdk-aac/libSYS/include;../fdk-aac/libAACenc/include;../missings;.;..</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./include;../missings;.;..</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
</ClCompile> </ClCompile>
<Link> <Link>
@ -78,6 +85,13 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<PreBuildEvent>
<Command>copy ..\fdk-aac\libAACdec\include\aacdecoder_lib.h include\fdk-aac\
copy ..\fdk-aac\libAACenc\include\aacenc_lib.h include\fdk-aac\
copy ..\fdk-aac\libSYS\include\FDK_Audio.h include\fdk-aac\
copy ..\fdk-aac\libSYS\include\genericStds.h include\fdk-aac\
copy ..\fdk-aac\libSYS\include\machine_type.h include\fdk-aac\ </Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\missings\getopt.c" /> <ClCompile Include="..\missings\getopt.c" />

View File

8
README
View File

@ -42,3 +42,11 @@ can be found at http://code.google.com/p/mp4v2/wiki/iTunesMetadata
For tags such as Artist where first char of fcc is copyright sign, For tags such as Artist where first char of fcc is copyright sign,
you can skip first char and just say like --tag="ART:Foo Bar" or you can skip first char and just say like --tag="ART:Foo Bar" or
--tag-from-file=lyr:/path/to/your/lyrics.txt --tag-from-file=lyr:/path/to/your/lyrics.txt
Currently, --tag-from-file just stores file contents into m4a without any
character encoding / line terminater conversion.
Therefore, only use UTF-8 (without BOM) when setting text tags by this option.
On the other hand, --tag / --long-tag (and other command line arguments) are
converted from locale character encoding to UTF-8 on Posix environment.
On Windows, command line arguments are always treated as Unicode.

View File

@ -32,7 +32,7 @@ AC_CHECK_TYPES([ptrdiff_t])
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
AC_FUNC_FSEEKO AC_FUNC_FSEEKO
AC_CHECK_FUNCS([gettimeofday nl_langinfo strdup _vscprintf]) AC_CHECK_FUNCS([sigaction gettimeofday nl_langinfo strdup _vscprintf])
AC_CHECK_FUNC(getopt_long) AC_CHECK_FUNC(getopt_long)
AM_CONDITIONAL([FDK_NO_GETOPT_LONG],[test "$ac_cv_func_getopt_long" != "yes"]) AM_CONDITIONAL([FDK_NO_GETOPT_LONG],[test "$ac_cv_func_getopt_long" != "yes"])
AC_SEARCH_LIBS([aacEncOpen],[fdk-aac],[],[],[]) AC_SEARCH_LIBS([aacEncOpen],[fdk-aac],[],[],[])

View File

@ -15,6 +15,7 @@
#include <assert.h> #include <assert.h>
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <share.h>
#include <sys/timeb.h> #include <sys/timeb.h>
#include "compat.h" #include "compat.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -66,9 +67,12 @@ FILE *aacenc_fopen(const char *name, const char *mode)
fp = (mode[0] == 'r') ? stdin : stdout; fp = (mode[0] == 'r') ? stdin : stdout;
_setmode(_fileno(fp), _O_BINARY); _setmode(_fileno(fp), _O_BINARY);
} else { } else {
int share = _SH_DENYRW;
if (strchr(mode, 'r') && !strchr(mode, '+'))
share = _SH_DENYWR;
codepage_decode_wchar(CP_UTF8, name, &wname); codepage_decode_wchar(CP_UTF8, name, &wname);
codepage_decode_wchar(CP_UTF8, mode, &wmode); codepage_decode_wchar(CP_UTF8, mode, &wmode);
fp = _wfopen(wname, wmode); fp = _wfsopen(wname, wmode, share);
free(wname); free(wname);
free(wmode); free(wmode);
} }

View File

@ -24,8 +24,13 @@
#if HAVE_UNISTD_H #if HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#if HAVE_SIGACTION
#include <signal.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <io.h> #include <io.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif #endif
#include "compat.h" #include "compat.h"
#include "wav_reader.h" #include "wav_reader.h"
@ -36,6 +41,40 @@
#define PROGNAME "fdkaac" #define PROGNAME "fdkaac"
static volatile g_interrupted = 0;
#if HAVE_SIGACTION
static void signal_handler(int signum)
{
g_interrupted = 1;
}
static void handle_signals(void)
{
int i, sigs[] = { SIGINT, SIGHUP, SIGTERM };
for (i = 0; i < sizeof(sigs)/sizeof(sigs[0]); ++i) {
struct sigaction sa = { 0 };
sa.sa_handler = signal_handler;
sa.sa_flags |= SA_RESTART;
sigaction(sigs[i], &sa, 0);
}
}
#elif defined(_WIN32)
static BOOL WINAPI signal_handler(DWORD type)
{
g_interrupted = 1;
return TRUE;
}
static void handle_signals(void)
{
SetConsoleCtrlHandler(signal_handler, TRUE);
}
#else
static void handle_signals(void)
{
}
#endif
static static
int read_callback(void *cookie, void *data, uint32_t size) int read_callback(void *cookie, void *data, uint32_t size)
{ {
@ -462,7 +501,9 @@ int encode(wav_reader_t *wavf, HANDLE_AACENCODER encoder,
ibuf = malloc(frame_length * format->bytes_per_frame); ibuf = malloc(frame_length * format->bytes_per_frame);
aacenc_progress_init(&progress, wav_get_length(wavf), format->sample_rate); aacenc_progress_init(&progress, wav_get_length(wavf), format->sample_rate);
do { do {
if (nread) { if (g_interrupted)
nread = 0;
else if (nread) {
if ((nread = wav_read_frames(wavf, ibuf, frame_length)) < 0) { if ((nread = wav_read_frames(wavf, ibuf, frame_length)) < 0) {
fprintf(stderr, "ERROR: read failed\n"); fprintf(stderr, "ERROR: read failed\n");
goto END; goto END;
@ -821,6 +862,7 @@ int main(int argc, char **argv)
strerror(errno)); strerror(errno));
goto END; goto END;
} }
handle_signals();
if (!params.transport_format) { if (!params.transport_format) {
uint32_t scale; uint32_t scale;
unsigned framelen = aacinfo.frameLength; unsigned framelen = aacinfo.frameLength;

View File

@ -1,4 +1,4 @@
#ifndef VERSION_H #ifndef VERSION_H
#define VERSION_H #define VERSION_H
const char *fdkaac_version = "0.1.4"; const char *fdkaac_version = "0.1.6";
#endif #endif