Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend.c needs some tweaks to be built with MSVC #12

Closed
nu774 opened this issue Mar 23, 2011 · 9 comments
Closed

frontend.c needs some tweaks to be built with MSVC #12

nu774 opened this issue Mar 23, 2011 · 9 comments

Comments

@nu774
Copy link

nu774 commented Mar 23, 2011

Hi, thanks for your works.

At line 740 of frontend.c, "int bytes_out" is declared at the middle of the block scope around it, therefore can't be compiled with compilers which doesn't support C99 (at least MSVC).
I also tried forcing C++ compilation, but C++ compilation also requires some fix, because of lines like this:
char *string = malloc(MAX_NAME_SIZE);
(This is legal in C, but not in C++: it requires explicit cast)

@njh
Copy link
Owner

njh commented Mar 23, 2011

Hello,

I have committed some changes to github, are you getting any other errors in MSVC?

nick.

@nu774
Copy link
Author

nu774 commented Mar 24, 2011

Hi,
To tell the truth, I've done some more fix. The patch is here:
https://sites.google.com/site/qaacpage/cabinet/twolame.2011.01.21.patch?attredirects=0&d=1

Setting stdin/stdout to binary mode is essential for MSVC or MINGW like this:

_setmode(0, _O_BINARY);

MSVC doesn't have unistd.h, therefore dummy(empty) unistd.h is needed somewhere.

MSVC doesn't have getopt, too. I borrowed getopt from BSD implementation.

Finally, I have enabled pipe streaming from stdin with libsndfile.

As far as I know, libsndfile is capable of reading from non-seekable device, and sf_open_fd() is usable for that purpose.

I think, many users want to feed at least WAV files via pipe...

@nu774
Copy link
Author

nu774 commented Mar 24, 2011

Apparently, my patch is VERY adhoc. If you want to it to be more autotools friendly,

HAVE_UNISTD_H, HAVE_IO_H, HAVE_SETMODE or something would be nicer.

(A bit older) win32 port is also found at here:

http://www.rarewares.org/mp3-others.php

They seem to have dropped libsndfile dependency, and instead have built-in wav parser.

@njh
Copy link
Owner

njh commented Mar 24, 2011

Ok, thanks.

I will try and incorporate some of those changes back into trunk.

An easy to use DLL and a static binary of the frontend would be handy for people.

I don't have Windows, so it will be hard to test.

@bat999
Copy link

bat999 commented Feb 7, 2013

twolame doesn't seem to compile with mingw.
Is there a patch available?

@njh
Copy link
Owner

njh commented Feb 7, 2013

Sorry, I don't use Windows. If you are able to provide a patch, that would be great.

@filler56789
Copy link

Regarding MinGW-w64: I managed to compile twolame with GCC 4.5.2, three years ago. But now several .h files have changed (_mingw.h and types.h, minimum, probably crtdefs.h as well), and trying to build even the original 0.3.13 code with GCC 4.8.1 results in a truckload of errors. Since you yourself said you're not much into Windows, I highly recommend that you firstly drop all the MSVC and Windows-related references, because in this way, probably it will be less difficult to adjust the source-code later and make it compatible with the recent editions of MinGW. The files configure.ac and Makefile.am would have to go through some serious rewrite, I presume. Also, I still don't see the point of forcing the dependency on libsndfile onto the command-line frontend.

@filler56789
Copy link

Now I'm trying to compile the OLD twolame 0.3.13 (from the year 2011) with GCC 4.9.2.
The question now is, where does the stupid ./configure expect to find the libsndfile stuff?
FWIW, libsndfile installed itself on "/local".

P.S.: okay, I just had to add another CPPFLAGS option to the command-line.
However I got a ton of warnings and some fatal errors after calling "make".
I'd better give up.

@njh
Copy link
Owner

njh commented Jul 7, 2016

The above patch link doesn't work anymore, closing this.

If anyone has some improvements for Windows, please raise a Pull Request.

@njh njh closed this as completed Jul 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants