Archive for February, 2009

Published by Roman on 28 Feb 2009

MediaTools: Tone Source Filter to generate reference audio feed, dual Audio Source Filter and Virtual Audio Capture Device

In order to obtain a reference audio source and especially useful for debugging purposes, including:

  • audio input device unrelated to physical device, to avoid conditions when device is already in use by someone else
  • non-zero audio signal which is independent of certain speaker or broadcasting service, including one that makes capture, transmission or rendering issues easily perceptible by human
  • configurable to provide different audio media types, including through well known DirectShow interfaces, such as IAMStreamConfig
  • configurable to present in system as both regular DirectShow Filter, and as an Audio Capture Source which can be enumerated by applications
  • to be able to check how exactly other applications are accessing and configuring audio capture source

I added a new filter to the Media Tools library, a Tone Source Filter. The filter generates PCM Audio data, either infinite sine waveform, or interrupted signal  of requested parameters:

Tone Source Filter General Property Page

The filter accepts connection on PCM media types with flexible sampling rates in range 8 KHz through 200 KHz, 8-bit audio and 1 channel. Media type is also configurable through or, if not configured this way, the first enumerated media type off the Output pin is also configurable through property page and/or persistent setting accessible via private IDispatch derived interface property.

Tone Source Filter Prefered Format Property Page

Additionally, the filter may configured as a system-wide available audio input device, such as for example available to VLC Media Player or Media Player Classic:

VLC Media Player's Option to use Tone Source Filter based device

In order to configure the filter as such device, the library exports function DoToneSourceFilterDevicePropertySheetModal, which can be called using rundll32 utility (“rundll32 Acquisition.dll,DoToneSourceFilterDevicePropertySheetModal” from command line):

Devices Property Page

A partial Visual C++ .NET 2008 source code is available from SVN, release binary included.

File and Class Summary

Acqusition.dll

Acqusition.dll (download) hosts the following classes:

  • DirectShow Filters
    • Tone Source Filter, to generate reference/debug audio data

Class Overview

Tone Source Filter

The filter generates uninterrupted or interrupted reference sine waveform in form of PCM audio data.

Remarks

The hosting library (DLL) exposes DoToneSourceFilterDevicePropertySheetModal function which provides GUI to configure the filter as one or more audio capture source device, which can be enumerated by System Device Enumerator.

Published by Roman on 27 Feb 2009

DHCP Server: More Configuration Choices for Router, Time Server and DNS Server (Options 3, 4 and 6)

Alax.Info DHCP Server received more configuration options and allows customizable DHCP parameters, options 3, 4 and 6:

Registry:
                                           Data
Tag       Name                             Length  Meaning                                           Reference
--------  -------------------------------  ------  ------------------------------------------------  ---------
3         Router                           N       N/4 Router addresses                              [RFC2132]
4         Time Server                      N       N/4 Timeserver addresses                          [RFC2132]
6         Domain Server                    N       N/4 DNS Server addresses                          [RFC2132]

Application GUI allows configuration of the options, including multiple IP addresses per option and “this” placeholder to be replaced with selected network adapter’s IP address:

Options Property Page

The DHCP Server application responds to the network device with a packet of the following kind (captured by WireShark):

Wireshark DHCP ACK Packet

Release information:

Published by Roman on 21 Feb 2009

Confusing AUDIO_STREAM_CONFIG_CAPS

I don’t have any idea who makes software nowadays, but how can it expected to be reliable?

Intel DG33FBC motherboard, onboard Realtek ALC888 High Definition Audio. I am tracing AUDIO_STREAM_CONFIG_CAPS capabilities reported by onboard audio capture board, one of them:

AM_MEDIA_TYPE:

majortype {73647561-0000-0010-8000-00AA00389B71}, subtype {00000001-0000-0010-8000-00AA00389B71}, pUnk 0x00000000
bFixedSizeSamples 1, bTemporalCompression 0, lSampleSize 4
formattype {05589F81-C356-11CE-BF01-00AA0055595A}, cbFormat 18, pbFormat 0x002911a8
pbFormat as WAVEFORMATEX:
  wFormatTag 1
  nChannels 2
  nSamplesPerSec 8000
  nAvgBytesPerSec 32000
  nBlockAlign 4
  wBitsPerSample 16
  cbSize 0

AUDIO_STREAM_CONFIG_CAPS:

guid {73647561-0000-0010-8000-00AA00389B71}
MinimumChannels 1, MaximumChannels 2, ChannelsGranularity 1
MinimumBitsPerSample 8, MaximumBitsPerSample 16, BitsPerSampleGranularity 8
MinimumSampleFrequency 11025, MaximumSampleFrequency 44100, SampleFrequencyGranularity 11025

Media type sampling frequency is 8 KHz (correct) but associated capabilities structure still report different sampling rates and granularity (crap), it is in fact 11025..44100 Hz for all capabilities, including those with sampling frequencies from a different row.

Published by Roman on 18 Feb 2009

Yet another time about FFDShow

While new NTFS Links propery page is looking for contained junction points, it shows an animated picture to indicate opertation in progress. The picture is a stock resource and is taken from shell32.dll resource type “AVI” name 150. It is an Audio Video Interleave (AVI) file embedded into binary resources as is.

Alax.Info NTFS Links Junction Points Property Page in Operation

What is however interesting is that being saved as a file and double-clicked, it appeared to be crashing the player process. What might go wrong with a stock resource, is it FFDShow again? This was the first guess and yes, it was FFDShow again. This is a “video only” file with video encoded with MS-RLE compression, FOURCC ‘RLE ‘. Microsoft provides a VCM codec for the format through msrle32.dll.

However, as already discovered, FFDShow register itself under extremely high merit and for this reason is preferred as a video decoder and attempts to handle the decompression itself. But it fails, and miserably enough to crash the hosting process.

FFDShow Crash

The registration under unfairly high merit defeats the purpose of DirectShow’s powerful Intelligent Connect approach. “Why do you need a video decoder? You have FFDShow Video Decoder, forget about the others. Oops, sorry, I don’t like your file.”

Is there any way to stop the villain? Of course, there is.

Continue Reading »

Published by Roman on 17 Feb 2009

Visual Studio .NET 2008 (9.0), Windows SDK version and MIDL compiler

Having installed Visual Studio .NET 2008 Service Pack 1 (installs Windows SDK 6.0a) and Windows SDK 6.1, I would obviously like to have newer Windows SDK used in include path. However after edit of WindowsSdkDir environment variable and checking all include directories to point to new Windows (former Platform) SDK path “C:\Program Files\Microsoft SDKs\Windows\v6.1“, MIDL compiler still looked for files in wrong directoty, why?

1>Microsoft (R) 32b/64b MIDL Compiler Version 7.00.05001>Copyright (c) Microsoft Corporation 1991-2006. All rights reserved.
1>Processing .\MyProject.idl
1>MyProject.idl
1>Processing C:\Program Files\Microsoft SDKs\Windows\v6.0a\include\dispex.idl
1>dispex.idl
1>Processing C:\Program Files\Microsoft SDKs\Windows\v6.0a\include\ocidl.idl
1>ocidl.idl
...

A quick check of devenv.exe process environment variables revealed mystic names _ACP_ATLPROV, _ACP_INCLUDE, _ACP_LIB, _ACP_PATH defined by Visual Studio environment itself and they don’t seem to be configurable through some file in Visual Studio directory.

However the solution came rather quickly. The older SDK directory has to be referenced from somewhere for the Visual Studio to pick it up. Installed Widnows SDK versions are listed in registry under key HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows, a subkey for each version, and it was older SDK set to be current.

Windows SDK Versions in Registry

Once switched to new there, MIDL compiler started taking include files from proper directory.

Published by Roman on 16 Feb 2009

NTFS Links: List junction points under certain directory

While NTFS junction points are powerful to relink files without duplicating data and/or moving between disks, they are treated as regular directories by most of software and it may unexpectedly result in conversion of a junction point into a regular directory with implied duplication of data and disk space waste.

This is a quick fix for the NTFS Links shell extension that allows to quickly list created junction points under certain directory, and delete if necessary. The update adds a property page Junction Points to NTFS non-UNC directory properties:

Directory Junction Points Property Page

This is a quick update, so be aware (also my TO DO list):

  • no Russian localization, sorry
  • context menu should also be given another item Open Containing Directory
  • does not work for root directories
  • list items should be OLE draggable
  • there should be a junction point validation feature that checks availability of substitution path and indicates result by an icon
  • I should remove the mess between “soft link” and”junction point” in favor of the latter

Release information:

Published by Roman on 16 Feb 2009

DHCP Server: VoIP Configuration Server Address Options 66 and 150

Alax.Info DHCP Server was updated and received a new feature to send TFTP Server Name (DHCP option 66) and TFTP Server IP Addresses (DHCP option 150) so much required to automatically configure VoIP hardware.

DHCP Server TFTP Server Options

Option 150 is defined by internet draft “VoIP Configuration Server Address Option”:

   This memo documents existing usage for the "VoIP Configuration Server
   Address Option" (previously known as the "TFTP Server IP Address
   Option").  The option number currently in use is 150.  This memo
   documents the current usage of the option in agreement with RFC 3942
   [RFC3942], which declares that any pre-existing usages of option
   numbers in the range 128 - 223 should be documented and the working
   group will try to officially assign those numbers to those options.

Release information:

Next »