Published by Roman on 06 Apr 2008

Sticky: Blog Navigation

  1. If you are searching for software or an utility:
  2. If you are you interested in C++ development, ATL and WTL:

Tags: ,

Published by Roman on 24 Jul 2010

Adobe Flash Media Live Encoder 3.1

It is the first time ever – because probably I am not as experienced as Geraint – I witness availability of IMediaSample interface without availability of IMediaSample2. One might be curious what kind of software could provide such a weirdo in 2010? It is latest and greatest Adobe Flash Media Live Encoder 3.1.

Additionally to this, they decided to provide garbage in AM_MEDIA_TYPE::formattype field of IAMStreamConfig::SetFormat. They perhaps learned that standard Audio Capture Filter will ignore it anyway, so why bother then?

Having fixed that, Tone Source Filter based virtual audio device is now compatible with Adobe Flash Media Live Encoder 3.1 and it is possible to send audio to remote Flash Media Server, e.g. such as Ustream.tv service (over RTMP protocol, as implemented by FMLE).

24-Image002

Tags: , , , , , , , ,

Published by Roman on 10 Jul 2010

Attributed ATL: Accessing BLOB with ISequentialStream

Before attributed ATL was deprecated, it was a convenient way to access databases using attributed classes on top of OLEDB Consumer Templates. Does not it look nice?


[
    db_command("SELECT ServerData FROM Server WHERE Server = ?")
]
class CGetServerData
{
public:
    [ db_param(1) ] LONG m_nServer;
    [ db_column(1, length = "m_nDataLength") ] ISequentialStream* m_pDataStream; DBLENGTH m_nDataLength;
};

It worked great with Visual Studio .NET 2003 and it failed to work with later releases. There are questions on internet about the problem, but there few answers if any. As I recently had to convert a project from 2003 version of the compiler to Visual Studio 2008, the problem was finally to be resolved.

Continue Reading »

Tags: , , , ,

Published by Roman on 13 May 2010

MediaTools: Two samples to capture M-JPEG video into JPEG files and to play JPEG files back

I added two new simple samples for the MediaTools DirectShow filters to demonstrate how to capture M-JPEG video feed, esp. from an IP camera, and write the video frames into sequence of JPEG files. The other sample takes a directory on the input and plays the images back as video. If you are working on certain transformation filter, it is an easy way to make a reference feed and use it for debugging purposes.

The filters behind that empower the sample are described in another post.

RenderHttpMjpegVideoIntoFiles01 sample takes an URL on the input to generate image/jpeg JPEG or multipart/x-mixed-replace M-JPEG stream. For example, it might be http://demo1.stardotcams.com/nph-mjpeg.cgi feed from a demo StarDot Technologies IP camera.

The application will create a new directory to write files into, and will save each new video frame received into new JPEG file.

Z:\MediaTools\Samples\RenderHttpMjpegVideoIntoFiles01\Release>RenderHttpMjpegVideoIntoFiles01.exe http://demo1.stardotcams.com/nph-mjpeg.cgi
URL: http://demo1.stardotcams.com/nph-mjpeg.cgi
Writing to directory: Z:\MediaTools\Samples\RenderHttpMjpegVideoIntoFiles01\Release\2010-05-12 22-07-37
Event: nCode EC_CLOCK_CHANGED 0xD, nParameter1 0x00000000, nParameter2 0x00000000
Event: nCode EC_PAUSED 0xE, nResult 0x00000000, nParameter2 0x00000000
[...]
^C

The application will generate the files and convert media sample time stamps into file time.

RenderHttpMjpegVideoIntoFiles01 Sample Output

The DirectShow graph that implements the operation is the following:

RenderHttpMjpegVideoIntoFiles01 Filter Graph

The other sample RenderJpegFiles01 takes a directory path to look for JPEG files, e.g. generated by previous sample, and pushes them into DirectShow graph as a video feed. File times will be converted [back] to media sample times.

Continue Reading »

Tags: , , , , , , , ,

Published by Roman on 25 Mar 2010

ProcessSnapshot: Create process minidump for port-mortem debugging

ProcessSnapshot is a utility to take a snapshot of process call stacks, and the snapshot taken is written into a human friendly text file.

ProcessSnapshot is taking process minidump files

Additionally to this, the utility has been given a capability to create process minidump files, on user request. The minidump files can be used with debugger to analyze the context of the process using feature rich debug environment, esp. Microsoft Visual Studio. To create a minidump for a process, check a corresponding box and press “Take a Dump” button. A file named “<process-image-name> – <date> <time>.dmp” will be created in the directory of the utility executable.

See also:

A binary [Win32, x64] and partial Visual C++ .NET 2008 source code are available from SVN.

Tags: , , , , , , , , ,

Published by Roman on 14 Mar 2010

Windows Visual PC files and locations

Microsoft Windows Visual PC implements virtual machines and the application holds the entire machine state and virtual hard disk information in files. In a few large files in fact, so a question to move and/or backup the files is a question of periodic interest.

So what are the files it is using? First of all, the primary file a user clicks on to start virtual machine is a .VMCX file and it is located in “C:\Users\$(UserName)\Virtual Machines” directory. It is a shortcut to internal files and is holding very basic information about the machine, its state and location of other files.

<?xml version="1.0" encoding="UTF-16"?>
<!-- Microsoft Virtual Machine Description and Registration Settings -->
<vm_description>
    <ram_size type="string">512 MB</ram_size>
    <vmstate type="string">Hibernated</vmstate>
    <primary_disk1 type="string">C:\Users\Roman\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vhd</primary_disk1>
    <secondary_disk1 type="string" />
    <notes type="string">Windows XP Professional in "XP Mode"
Username XPMUser, Password XPM User</notes>
    <vmc_path type="string">C:\Users\Roman\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\Windows XP Mode.vmc</vmc_path>
</vm_description>

This directory has a special hidden desktop.ini file in it, which instruct the shell to treat the directory and the files in a special way, as Virtual PC files. This is also how Windows is providing user a link “Create virtual machine”.

The .VMCX file is editable (its format is based on XML) and it holds references to .VHD virtual disk files and .VMC virtual machine configuration files. However, .VMCX file is nothing but a shortcut only, and Windows Virtual PC will re-created those files once underlying .VMC file is double-clicked to be started, so there is no need to edit .VMCX files.

.VMC file is a virtual machine configuration file and it holds the settings a user provides for the virtual machine through settings dialog. The file is also using XML formatting, and is editable. While the file is small itself, its location is used as a base location for .VSV file, where software stores runtime state of virtual machine. The .VSV file size is stipulated by amount of RAM granted to the virtual machine, so the file may be pretty large itself and it might be desired to be moved to another location also. To achieve this, the small .VMC file needs to be moved to location of interest. A .VMC file can be double-clicked itself to start the virtual machine.

Windows Virtual PC Settings Dialog

.VHD are the large files as they store data from virtual hard disks, so moving them may make sense. Additionally to the files themselves, if “Create Undo Disks” option is enabled, software will manage additional .VUD file with the name of format “VirtualPCUndo_$(VirtualMachineName)_$(Token).vud” file with changes that has not yet been applied. If moved, the .VUD files have to be thought of as a part of .VHD files.

By default a .VMC file holds both absolute and relative path refrences to .VHD and .VUD files, with relative reference as a priority. So if .VMC and .VHD (optionally with .VUD) files are moved together, no special path update/edit required. Software will be able to locate moved disk file automatically as soon as virtual machine is started. Still it is possible to edit the files manually and have files located in different directories. Also if disk file location is modified via GUI, software offers/attempts to strip undo disk .VUD file and cancel unapplied changes. If configuration file is edited manually, it is possible to keep undo disks without canceling the changes.

When moving files to a different location, make sure to check directory security so that Windows Virtual PC has sufficient privileges accessing files in the new location, or otherwise it would show ambiguous error messages “Could not register the virtual machine”.

See Also: Windows Virtual PC Tips on microsoft.com

Tags: , , , , , ,

Published by Roman on 08 Feb 2010

DirectShow Spy: IAMFilterData interface

This quick update for DirectShow Filter Graph Spy adds tracing for (deprecated) IAMFilterData interface, and also fixes problem with Media Player Classic – Home Cinema, when the player crashes in External Filters windows.

Partial Visual C++ .NET 2008 source code is available from SVN, release binary included (Win32, x64); installation instructions are in another post.

Tags: , , , , ,

Next »