commit 2d27a5b4108ac8a957d69090219c4c1c4b9bda5f Author: Simon Bruder Date: Wed Aug 26 13:02:29 2020 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9553827 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/packages/ +/wmadec/bin/ +/wmadec/obj/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3fadbbd --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +Version 2, December 2004 + +Copyright (C) 2004 Sam Hocevar + +Everyone is permitted to copy and distribute verbatim or modified copies of +this license document, and changing it is allowed as long as the name is +changed. + +DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/README.md b/README.md new file mode 100644 index 0000000..788445f --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# wmadec + +*The worst media conversion tool* + +## Building + +You can build this tool on non-Windows operating systems. You need to have +nuget and msbuild (e.g. from mono) installed. You can then run the `build.sh` +script (possibly with `sh build.sh`, since I use `nix-shell` in the shebang). +If you use Nix you don’t have to install anything, just run the build script, +it takes care of installing the dependencies automatically. + +## Usage + +The usage of this tool is very simple. It reads compressed wma data from stdin +and writes uncompressed PCM to stdout. It has no way of communicating the +sample rate and bit depth, figuring that out is up to you (ffmpeg’s decoder +manages to extract that correctly, otherwise just assume 44.1kHz/16bit). + +## Motivation + +Since ffmpeg’s wma decoder fails to decode (especially short) wma files +accurately, I had to use the only working wma decoder I know of: The one built +into Microsoft Windows (MediaFoundation). + +For some reason, even if you manage to get the (discontinued?) Windows Media +Player working on a modern Windows machine, it only offers the option to burn +WMA files to a CD, not to convert them to other formats (at least I did not +find such an option). + +## License + +[WTFPL](WTFPL) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2efd7ad --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i sh -p dotnetPackages.Nuget msbuild +nuget restore -SolutionDirectory . -PackagesDirectory packages +msbuild /p:Configuration=Release wmadec/wmadec.csproj diff --git a/wmadec.sln b/wmadec.sln new file mode 100644 index 0000000..7d373b6 --- /dev/null +++ b/wmadec.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wmadec", "wmadec\wmadec.csproj", "{080607B5-66EB-4855-B1F0-BE98AA0812C4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {080607B5-66EB-4855-B1F0-BE98AA0812C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {080607B5-66EB-4855-B1F0-BE98AA0812C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {080607B5-66EB-4855-B1F0-BE98AA0812C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {080607B5-66EB-4855-B1F0-BE98AA0812C4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {90CDB330-38EF-4BC3-852E-D9C70ADB628F} + EndGlobalSection +EndGlobal diff --git a/wmadec/App.config b/wmadec/App.config new file mode 100644 index 0000000..ee28567 --- /dev/null +++ b/wmadec/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/wmadec/Program.cs b/wmadec/Program.cs new file mode 100644 index 0000000..90a51a5 --- /dev/null +++ b/wmadec/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.IO; +using NAudio.Wave; + +namespace wmadec +{ + class Program + { + static void Main() + { + var stdin = Console.OpenStandardInput(); + var wmaData = new MemoryStream(); + stdin.CopyTo(wmaData); + var wmaReader = new StreamMediaFoundationReader(wmaData); + var stdout = Console.OpenStandardOutput(); + wmaReader.CopyTo(stdout); + stdout.Flush(); + } + } +} diff --git a/wmadec/Properties/AssemblyInfo.cs b/wmadec/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..207c6ae --- /dev/null +++ b/wmadec/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("wmadec")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("wmadec")] +[assembly: AssemblyCopyright("WTFPL")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("080607b5-66eb-4855-b1f0-be98aa0812c4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/wmadec/packages.config b/wmadec/packages.config new file mode 100644 index 0000000..38cf596 --- /dev/null +++ b/wmadec/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/wmadec/wmadec.csproj b/wmadec/wmadec.csproj new file mode 100644 index 0000000..fe77c21 --- /dev/null +++ b/wmadec/wmadec.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {080607B5-66EB-4855-B1F0-BE98AA0812C4} + Exe + wmadec + wmadec + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\NAudio.1.10.0\lib\net35\NAudio.dll + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file