Initial commit

This commit is contained in:
Simon Bruder 2020-08-26 13:02:29 +02:00
commit 2d27a5b410
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
10 changed files with 202 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/packages/
/wmadec/bin/
/wmadec/obj/

13
LICENSE Normal file
View file

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
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.

33
README.md Normal file
View file

@ -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 dont 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 (ffmpegs decoder
manages to extract that correctly, otherwise just assume 44.1kHz/16bit).
## Motivation
Since ffmpegs 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)

4
build.sh Executable file
View file

@ -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

25
wmadec.sln Normal file
View file

@ -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

6
wmadec/App.config Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

20
wmadec/Program.cs Normal file
View file

@ -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();
}
}
}

View file

@ -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")]

4
wmadec/packages.config Normal file
View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NAudio" version="1.10.0" targetFramework="net472" />
</packages>

58
wmadec/wmadec.csproj Normal file
View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{080607B5-66EB-4855-B1F0-BE98AA0812C4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>wmadec</RootNamespace>
<AssemblyName>wmadec</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NAudio, Version=1.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NAudio.1.10.0\lib\net35\NAudio.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>