My first GitLab contribution: exhale encoder

My first GitLab contribution: exhale encoder

Hi everyone,

Yesterday, I collaborated on the exhale xHE-AAC Audio Encoder to add compatibility to compile the project on MinGW on Windows.

The exhale project is an Open-Source xHE-AAC USAC encoder. It allows you to encode wave (WAV) files to M4A using this specific codec.

Originally, compilation on Windows was done using Visual Studio, and this worked fine, but when compiling it on MSYS2/MinGW, it gave some issues, specifically:

H:/repos/media-autobuild_suite/build/exhale-git/src/app/../../src/app/exhaleApp.cpp: In function 'int main(int, char**)':
H:/repos/media-autobuild_suite/build/exhale-git/src/app/../../src/app/exhaleApp.cpp:246:85: error: '_SH_DENYWR' was not declared in this scope
  246 |     if (_sopen_s (&inFileHandle, inFileName, _O_RDONLY | _O_SEQUENTIAL | _O_BINARY, _SH_DENYWR, _S_IREAD) != 0)
      |                                                                                     ^~~~~~~~~~
H:/repos/media-autobuild_suite/build/exhale-git/src/app/../../src/app/exhaleApp.cpp:320:100: error: '_SH_DENYRD' was not declared in this scope
  320 |     if (_sopen_s (&outFileHandle, outFileName, i | _O_SEQUENTIAL | _O_CREAT | _O_EXCL | _O_BINARY, _SH_DENYRD, _S_IWRITE) != 0)
      |                                                                                                    ^~~~~~~~~~
make[1]: *** [../makefile.base:112: ../../build/exhaleApp.d.o] Error 1
make[1]: Leaving directory '/build/exhale-git/src/app'
make: *** [makefile:18: all] Error 2

It also complained about fprintf_s, so some changes needed to be done on the code.

To solve the _SH_DENYRD not declared issue, we had to include the share.h header:

Next, to solve the fprintf_s issue, I surrounded this on an #if !defined block to check if we were compiling on MinGW. If we are, we simply skip this declaration:

After these changes were done, the software compiled successfully.

Next, I did some additional changes to the makefile.base file to allow the Media Autobuild Suite project to pass its CXXFLAGS and LDFLAGS variable to exhale:

These changes got merged into the project.

My inspiration to add this tool to the Media Autobuild Suite came as a user requested this tool to be added to it. So, I worked on it and submitted a Pull Request, where I refined it further to apply some recommendations.

The Pull Request was merged into the suite and is now available for everyone to build and use.

Contributions