Adding stdout output (alternate method) - #23
Open
apocalyptech wants to merge 5 commits into
Open
Conversation
Owner
|
Cool, thanks, I'll look over this soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was looking to script this together with revorb and came across #8, which adds STDOUT output to ww2ogg. It looks like that one never got fully cleaned up, though, and I'd prefer a different implementation anyway, so I've done up my own PR.
What this does is:
--quietoption which silences all "status" type messages-as the output file option, which forces the use of--quiet--quiet) remains on stdout, rather than switching to stderr as the other PR does.isatty()as requested in that other PRI've introduced some OS-specific tweaks to support some of this -- namely, Linux machines will need to include
unistd.hand do some#defineshenanigans to be able to use_isattyand_fileno, as they're known on the Windows side. The other PR implied that MinGW32 neededfcntl.hfor_O_OUTPUTas well, so that's there. The call to_setmode(to ensure that stdout is handled as binary data) doesn't need to be done on Linux because Linux doesn't distinguish between binary + text on the standard streams (and doesn't define_setmode) anyway.This has received no testing on Windows, w/ MinGW or not, so I can't vouch for that. It also doesn't pull the
--quietfunctionality into those other commentedcoutinstances throughout the code, since that would involve passing some more vars around and it didn't seem worth it. I have tested this with revorb, and that works great.I did verify that the output is identical in a variety of circumstances, and checked it versus the unpatched output as well:
Auto-filename:
Specified filename:
Quiet output:
Redirected to file manually:
Checksums:
Errors still display when redirecting:
Refuses to output to stdout when on a TTY (also shows some extra
usage()text):Anyway, lots of text. Let me know if you want any changes or a different implementation, etc!