IPB

Welcome Guest ( Log In | Register )

3 Pages V  < 1 2 3 >  
Reply to this topicStart new topic
New FLAC frontend beta, Remake of the 10-year old classic
ktf
post Mar 17 2013, 23:06
Post #26





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



QUOTE (korth @ Mar 12 2013, 14:53) *
Maybe making chcp an option (or an option to disable it) with a note in the readme that this feature doesn't work on XP?

I'll use some code that removes chcp from the batch file if running on XP. Really, this chcp-stuff is giving me lots of headache.


QUOTE (agentk7 @ Mar 15 2013, 21:20) *
Wow, I was wondering if anyone would ever take up the mantle to improve/revamp Flac Frontend. I wanted to pass along my initial observations:

- When configuring the frontend I checked the box for "Keep foreign metadata". My first test was to decode some flac files and was immediately greeted with the command prompt error "ERROR reading foreign metadata: no foreign metadata found (017)". Perhaps this is a flac.exe issue and is fixed with the new version?

That's not a bug, it's a feature. Keep foreign metadata is an 'advanced' feature and should only be used if you know what you're doing, so enabling it for decoding while there's no foreign metadata indeed returns an error, that's by design.

QUOTE
One favorite feature of the old Flac Frontend was the fact that it preserved the file date of the input files. This version does not preserve the original file date

Weird, flac does this on linux by default as well. I'll take a look why this doesn't work on windows.

QUOTE
- Will the new Flac Frontend eventually have a config or ini file to save the settings?

I don't think so.


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
robert
post Mar 18 2013, 08:29
Post #27


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



Just curious, why does it need to write a batch file, instead of just running the executables with unicode command line?
Go to the top of the page
+Quote Post
ktf
post Mar 18 2013, 09:08
Post #28





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



QUOTE (robert @ Mar 18 2013, 08:29) *
Just curious, why does it need to write a batch file, instead of just running the executables with unicode command line?


The easiest way to feed back the output of the FLAC command is with the console. I tried to feed it back over the listbox but that didn't work very well. The problem is the status line that overwrites itself. Of course I could use a single command, but if a lot of files are given (>50) it has to be split into several commands because Windows has a certain maximum command length. If I would execute this without a batch file, several console windows would pop up to confuse the user.

I could try another way to display the output via the GUI though, with a textbox instead of a listbox. Maybe that would work.

This post has been edited by ktf: Mar 18 2013, 09:09


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
robert
post Mar 18 2013, 09:48
Post #29


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



I've to admit to never having tested it myself, but can't you just allocate a console for your gui program and execute processes using it?

edit: here is some test code
CODE
#include <qtgui/qtgui>
#include <windows.h>
#pragma comment( lib, "shell32.lib" )

void showConsole( HWND parent ) {
FreeConsole();
AllocConsole();
if ( HWND console = GetConsoleWindow() ) {
RECT r;
GetWindowRect( console, &r );
SetParent( console, parent );
MoveWindow( console, 48, 48, r.right, r.bottom, TRUE );
SetConsoleOutputCP(CP_UTF8); // assuming "Lucida console" font was selected already
}
}

void run( wchar_t app[], wchar_t * cmd ) {
STARTUPINFOW si;
ZeroMemory( & si, sizeof( si ) );
si.cb = sizeof( si );
PROCESS_INFORMATION pi;
ZeroMemory( & pi, sizeof( pi ) );
if ( CreateProcessW( app, cmd, 0, 0, 0, 0, 0, 0, & si, & pi ) ) {
DWORD exit_code = 0;
do {
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
GetExitCodeProcess( pi.hProcess, &exit_code );
} while( exit_code == STILL_ACTIVE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
}
void run( wchar_t app[], QString const& cmd ) {
run( app, (wchar_t*)cmd.utf16() );
}

char utf16_test[] = { 0x22, 0x04, 0x40, 0x04, 0x30, 0x04, 0x32, 0x04, 0x43, 0x04, 0x48, 0x04, 0x3a, 0x04, 0x30, 0x04, 0x2e, 0x00, 0x77, 0x00, 0x61, 0x00, 0x76, 0x00, 0x00, 0x00 };
QString const file = QString("E:\\dev-privat\\testsongs\\%1").arg(QString::fromUtf16((ushort*)utf16_test).trimmed());

int main(int argc, char** args) {
QApplication app( argc, args );
QMainWindow win;
win.show();
showConsole( win.effectiveWinId() );
QString const cmd( "LAME.EXE --nohist -V0 --out-dir . \"%1\"" );
run( L"LAME.EXE", cmd.arg(file) );
run( L"LAME.EXE", cmd.arg("testcase.wav") );
run( L"LAME.EXE", cmd.arg("W:\\CD\\Duffy\\2008-Rockferry\\07 Mercy.wav") );
app.exec();
return 0;
}


and the snapshot:
Attached Image


This post has been edited by robert: Mar 19 2013, 00:03
Go to the top of the page
+Quote Post
robert
post Mar 20 2013, 09:42
Post #30


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



This little exercise showed me, there is a bug in LAME displaying the input file name, if it contains non ansi chars. So it was worth it. (look into above screenshot to see what this means)
Go to the top of the page
+Quote Post
ktf
post Mar 20 2013, 18:24
Post #31





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



Nice stuff! Thanks for trying! I'll definitely check that out, looks promising.


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
ktf
post Mar 26 2013, 18:46
Post #32





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



It took a while (some bumps on the way) but it's fixed. Now FLAC frontend uses it's own console to process files instead of using a batch-file. Furthermore, I've created an installer that checks whether .NET Framework 2.0 is present and the program itself checks whether flac.exe and metaflac.exe are in it's path. This release uses the FLAC 1.3.0pre2 patched by Case for Unicode support, so it's not recommended to encode/decode anything critical with this.

The (MSI) installer can be downloaded from here:
http://sourceforge.net/projects/flacfronte...03.msi/download

I still have a zip for those who like it.
http://sourceforge.net/projects/flacfronte...03.zip/download

Please report any bugs found. The installer and program have been checked on Windows XP SP3 and Windows 7.

This post has been edited by ktf: Mar 26 2013, 18:47


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
korth
post Mar 27 2013, 00:19
Post #33





Group: Members
Posts: 445
Joined: 13-March 11
Member No.: 88969



Nice.
Not a big deal but text not clearing completely on file names with special characters. This is a FLAC 1.3.0pre2 problem though, not the frontend. Just mentioning it.

CODE

flac 1.3.0pre2, Copyright © 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for details.

test θιλ.flac: ok te
test.flac: ok
test θιλθιλ.flac: ok plete
Press any key to continue . . .

I don't see this when this frontend is using FLAC 1.2.1


--------------------
korth
Go to the top of the page
+Quote Post
Wombat
post Mar 27 2013, 01:43
Post #34





Group: Members
Posts: 1056
Joined: 7-October 01
Member No.: 235



Thanks! Works fine here.
One thing i noticed is the replaygain values are the same for higher samplingrate material as the corresponding downsampled 44.1kHz version of it, nice. The value seems to be the same as the good old metaflac has calculated. I know this is not related to the frontend itself but maybe someone wonders.
Go to the top of the page
+Quote Post
ktf
post Mar 27 2013, 08:38
Post #35





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



QUOTE (korth @ Mar 27 2013, 00:19) *
Not a big deal but text not clearing completely on file names with special characters.

I know, but that's a work in progress. As the patch has not been merged yet (and I guess this is a part that the patch "forgot", while it is already a very large patch), I'll wait with reporting it until it is merged. Otherwise, it makes merging only more difficult I guess.


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
robert
post Mar 27 2013, 08:42
Post #36


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



Am I right, you are not setting the console output to code page to utf-8?

SetConsoleOutputCP(CP_UTF8);
Go to the top of the page
+Quote Post
ktf
post Mar 27 2013, 08:48
Post #37





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



Indeed, I didn't set a codepage because chcp 65001 (which is the same but for use in batch files) gave me so much trouble, and now it seems to work well without setting a codepage.


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
Case
post Mar 27 2013, 13:02
Post #38





Group: Developer (Donating)
Posts: 2260
Joined: 19-October 01
From: Finland
Member No.: 322



Good find, korth. It seems I still had missed places where file name is printed, those need to call new printf function that converts internal UTF-8 to wide chars.

Robert, UTF-8 is not a valid codepage for console output. The function you mentioned will return error 0x32.
Go to the top of the page
+Quote Post
robert
post Mar 27 2013, 13:13
Post #39


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



I'll have to check my test code again later, from what I remember, not calling that function resulted in using code page 850 on my windows 7 machine, instead of CP_UTF8.

windows error code 32: "The process cannot access the file because it is being used by another process."

From the error code, it looks like some process is using the newly created console already, likely the frontend itself.

Anyway, if the console uses CP_UTF8 already, then there is no need to change code page.



This post has been edited by robert: Mar 27 2013, 13:18
Go to the top of the page
+Quote Post
Case
post Mar 27 2013, 13:31
Post #40





Group: Developer (Donating)
Posts: 2260
Joined: 19-October 01
From: Finland
Member No.: 322



Codepage doesn't matter, it's doing the printing in unicode. The error was not 32 but 0x32, hex. It translates to "not supported". If you look at the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage you'll see that there are no UTF codepages there.
Go to the top of the page
+Quote Post
robert
post Mar 27 2013, 14:01
Post #41


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



Ok, I've just looked again at my test program. The SetConsoleOutputCP(UTF_8) function call returns TRUE. Without this call, cyrillic text doesn't display correctly anymore. Btw, LAME doesn't use wide character printing functions, it uses normal printf and friends.
Go to the top of the page
+Quote Post
Case
post Mar 27 2013, 14:40
Post #42





Group: Developer (Donating)
Posts: 2260
Joined: 19-October 01
From: Finland
Member No.: 322



This is curious. I had made a silly mistake in my test program where I assumed error when SetConsoleOutputCP returned non-zero. It returns success code here too yet GetLastError returns "not supported" right afterwards. Also printing with WriteConsole gives UTF-8 garbage codes instead of translating them to anything intelligible. If this is supposed to work it certainly requires extra magic to take place.
Go to the top of the page
+Quote Post
ktf
post Apr 8 2013, 18:58
Post #43





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



I have just uploaded a new version, beta 4. It is available for download here: https://sourceforge.net/projects/flacfronte...ad?source=files

Changes in beta 4:
- Uses new compiles of flac 1.3.0pre3 + a few git fixes by Case. Known bugs: not correctly displaying non-latin chars in filenames
- Installer shrunk from 1MB to 635kb
- .NET 4.0 and 4.5 are supported. The installer simply packs two executables, one for .NET 2.0, 3.0 and 3.5 and one for .NET 4.0 and 4.5, and chooses which one should be installed. The .NET 4.0 version is preferred by the installer
- Fixes a few minor bugs

Bug reports are very welcome smile.gif

This post has been edited by ktf: Apr 8 2013, 19:10


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
ktf
post Apr 17 2013, 11:16
Post #44





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



Once more a new version, beta 5. Download here: https://sourceforge.net/projects/flacfronte...ad?source=files If you have an old beta installed with .msi, you don't have to remove it first, upgrading works.

Changes in beta 5
- Uses new compiles for flac 1.3.0pre3 + UTF-8 and line break patches by Case. Now non-latin characters should be supported fully, at least as much as your version of Windows has the right console fonts.
- Upgrading (from beta 3 or higher) was already possible, now downgrading (only to beta 4 now) is supported
- Fixes line breaks in COPYING.GPL.txt and README.txt fixed, should now be readable with Notepad.
- Now uses more explicit paths to make sure this won't happen
- Uses smaller console because wide consoles are no longer necessary because of Case's line break patch
- Added w64, raw and aiff to accepted input formats
- Several small fixes (see git)

Comments are welcome

This post has been edited by ktf: Apr 17 2013, 11:17


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
Case
post Apr 17 2013, 14:50
Post #45





Group: Developer (Donating)
Posts: 2260
Joined: 19-October 01
From: Finland
Member No.: 322



I noticed that Ctrl+C or closing the encoding window with other means kills the entire frontend. I don't think that's good behavior.
Go to the top of the page
+Quote Post
ktf
post Apr 17 2013, 16:48
Post #46





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



Why not? Ctrl+C or closing the window are usually ways to close an application, aren't they?

The problem is that encoding window is not a showing a child process, it's the main thread now. That is necessary to circumvent the UTF-8 problems with batchfiles. AFAIK it's either using a batch-file (and having lot's of problem with getting that to work) or this behaviour.


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
Case
post Apr 17 2013, 17:04
Post #47





Group: Developer (Donating)
Posts: 2260
Joined: 19-October 01
From: Finland
Member No.: 322



The scenario where I noticed the problem was that I had multiple files in the queue and I was working on a huge file that needed a long time to finish. I wanted to skip it and encode the rest but the program closed entirely. I think any alternate behavior would be better, like spawn new flac.exe process and continue encoding the next file or just remain open with the queue and let user reclick appropriate buttons.
Go to the top of the page
+Quote Post
ktf
post Apr 17 2013, 21:14
Post #48





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



I think this will get a little tricky. Now the output it sent to the console of the FLAC Frontend process itself. As the console is tied to the GUI, closing the console will close the GUI, they are just two different ways of input/output for the same process.

To get around this, I'll have to spawn separate processes. The problem is the communication between the processes: when calling a new process, there's a limit to the number of characters you can pass (little over 32000) which is just not enough if I were to test my whole library with FLAC frontend, which I think is not an unlikely case. I really don't like those artificial limits in programs. Communicating things to a new process with files is even more ugly (and might introduce problems like I had with using a batchfile or pose problems if the users tries to start a second thread) and I don't know of another way to pass information to another process.


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post
robert
post Apr 17 2013, 21:50
Post #49


LAME developer


Group: Developer
Posts: 788
Joined: 22-September 01
Member No.: 5



You can set a console control handler to react on ctr-c and close signals.

http://msdn.microsoft.com/en-us/library/wi...6(v=vs.85).aspx
Go to the top of the page
+Quote Post
ktf
post Apr 18 2013, 05:23
Post #50





Group: Members
Posts: 394
Joined: 22-March 09
From: The Netherlands
Member No.: 68263



That's just what I've come up with before I fell asleep last night, I'll try it soon. Thanks for the link!

This post has been edited by ktf: Apr 18 2013, 05:23


--------------------
Music: sounds arranged such that they construct feelings.
Go to the top of the page
+Quote Post

3 Pages V  < 1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd October 2014 - 07:50