How to write a no-input stream DMO (directx media object) component - winapi

DMO seems to be used for replacing DirectShow transform filter. Some documents say there could be a DMO without input streams. But how is it supposed to work? If there is no input stream, in function IMediaObject::CheckInputType what should be written?

You can implement an inputless DMO, e.g. let's suppose the DMO generates output internally. Noone will call CheckInputType because no inputs exist, this is fine (your CheckInputType body will be empty and e.g. returning E_NOTIMPL).
However you should rather step back and explain what it is for. No, DMOs are not a replacement for DirectShow filters. DMOs can be mapped into DirectShow filter space, through DMO Wrapper Filter, however the latter does not support DMOs with no inputs so your DMO is going to be useless for DirectShow pipeline.
To create a custom DirectShow source, you need to implement full filter.

Related

Difference between Tensorfloat and ImageFeatureValue

When using the Windows-Machine-Learning library, the input and output to the onnx models is often either TensorFloat or ImageFeatureValue format.
My question: What is the difference between these? It seems like I am able to change the form of the input in the automatically created model.cs file after onnx import (for body pose detection) from TensorFloat to ImageFeatureValue and the code still runs. This makes it e.g. easier to work with videoframes, since I can then create my input via ImageFeatureValue.CreateFromVideoFrame(frame).
Is there a reason why this might lead to problems and what are the differences between these when using videoframes as input, I don't see it from the documentation? Or why does the model.cs script create a TensorFloat instead of an ImageFeatureValue in the first place anyway if the input is a videoframe?
Found the answer here.
If Windows ML does not support your model's color format or pixel range, then you can implement conversions and tensorization. You'll create an NCHW four-dimensional tensor for 32-bit floats for your input value. See the Custom Tensorization Sample for an example of how to do this.

How to use COMMON_TREE_NODE_STREAM

I'm following http://antlr3.org/api/C/buildrec.html tutorial.
It's my understanding that in order to remove/alter tokens before they are consumed by the parser I have to use none buffered stream COMMON_TREE_NODE_STREAM
In this view, how should i feed the parser ?
currently I use tstream=antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT,TOKENSOURCE(lxr));
to "feed" the parser.
Appreciate every advice
No, the COMMON_TREE_NODE_STREAM is the source for a tree parser, not the normal parser. The ANTLR_TOKEN_STREAM is the input stream for that which has a default implementation in the C runtime known as ANTLR3_COMMON_TOKEN_STREAM_struct. Look up its implementation to learn how to create your own token stream.

Creating a custom security encoding/decoding transform

I'd like to create a Base16 encoder and decoder for Lion's new Security.framework to complement kSecBase32Encoding and kSecBase64Encoding. Apple's documentation shows how to write a custom transform (Caesar cipher) using SecTransformRegister. As far as I can tell, custom transforms registered this way have to operate symmetrically on the data and can't be used to encode and decode data differently. Does anyone know if writing a custom encoder/decoder is possible, and if so, how?
I don't see a way to tie custom encoders into SecEncodeTransformCreate(), which is what kSecBase32Encoding and the others are based on. But it's easy to create a transform that accepts a "encoding" bool and makes use of that to decide whether to encode or decode. In the CaesarTransform example, they attach an attribute called key with SecTransformSetAttribute(). You'd do the same thing, but with a bool encode.
And of course you could just create an encoding transform and a decoding transform.

DirectShow ISampleGrabber which accepts VIDEOINFOHEADER2

As stated in http://msdn.microsoft.com/en-us/library/dd377544(VS.85).aspx, ISampleGrabber accepts only videos with VIDEOINFOHEADER structure, but not VIDEOINFOHEADER2. Is there any alternative to ISampleGrabber, or any example code for a filter that would do similar job? I have tried with IBasicVide, but it renders video on the screen which I would like to avoid. Thanks.
You have to write your own filter for this goal.
There is already a sample in the SDK. See the dump filter sample.
If the renderer sample is too complex, use a transform filter and insert a NullRenderer behind this filter.

How to create simple animations in 3gp format?

I am trying to create a simple animation which includes face of a famous character. For example Santa Clause. The face and the lips of the character will act according to the given input message. For example if a string is inputed then the lips of the character will be opened and closed till the end of the string while the given input message is vocalized using a text to speech converter. Moreover if the " :) " is used the character in the animation will smile. How could I do this? I was told that I can create this type of animations using "smill". But this is not convenient for the other purposes therefore I need to use a different method. Could you give me any suggestions?
Not totally sure about if you need only to convert an avi or the like video file to 3gp format, or wish something that involves quite more. If it is the first case, you can try the following free converter :
http://www.videohelp.com/tools/3GP_Converter

Resources