Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all 1079 articles
Browse latest View live

Source Resolver CreateObjectFromUrl hangs when called from ByteStreamHandler

$
0
0

Hi

I have a  MediaFoundation Bytestreamhandler for a specific extension and for a specific case  I have to create a mediasource from a modified URL within the Bytestreamhandler.  I am trying to do this by calling pSourceResolver->CreateObjectFromUrl. The problem is this function hangs when called within BytestreamHandler. It also hangs for pSourceResolver->CreateObjectFromByteStream. (no error returned, just hangs).

I was doubtful whether I am making a mistake with the options but when I try pSourceResolver->CreateObjectFromUrl from my own SchemeHandler, it gives me a valid mediasource which works.

I didn’t see any documentation about this but is it that we can’t call SourceResolver from BytestreamHandler? I get that this would be like a recursive call but there should be someway to work around this Or is this a bug? Or Should I be using some other function to be getting a valid mediasource for a Valid URL when I need this to be called from ByteStreamHandler?

Thanks,

Kaks



MFCreateSourceReaderFromURL causes program to hang (solved)

$
0
0

Solved:

I forgot to add MFStartup(MF_VERSION) before any Media Foundation functions.

Hi,

I am using Media Foundation to create a program which gets frames from a video file as textures.

I have some problem just at the start of my program.

When I call MFCreateSourceReaderFromURL() to read my file, the program hangs.

It does not let me go to GetVideoFormat()

my code is like this, it is actually just a copy from the sample VideoThumbnail from the sdk:

IMFSourceReader *m_pReader;

CoInitialize(NULL);

HRESULT hr = S_OK;

 IMFAttributes *pAttributes = NULL;

SafeRelease(&m_pReader);

// Configure the source reader to perform video processing.
    //
    // This includes:
    //   - YUV to RGB-32
    //   - Software deinterlace

hr = MFCreateAttributes(&pAttributes, 1);

    if (SUCCEEDED(hr))
    {
        hr = pAttributes->SetUINT32(MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, TRUE);
    }

// Create the source reader from the URL.

    if (SUCCEEDED(hr))
    {
        hr = MFCreateSourceReaderFromURL(fileName, pAttributes, &m_pReader);
    }

if (SUCCEEDED(hr))
    {
        hr = GetVideoFormat(&m_format);
    }

Any idea where the problem might be?

Thank you.


Provide IDirect3DDeviceManager9 from Custom Media Sink

$
0
0

I am writing a custom media sink to render video to a device, following the example of the WavSink.

Now how to proceed if I want to use DirectX surfaces for carrying video frame samples? As far as I know, the EVR renderer is usually providing IDirect3DDeviceManager9 interface, which is assigned to the MFTs by the topology loader.

Since I am not rendering on EVR, but on my sink instead, how can I create such IDirect3DDeviceManager9 instance to provide to the topology loader?

Does anyone know articles or resources describing such scenario?

Thanks for any help.

Confused about how to seek using IMFSourceReader:: SetCurrentPosition

$
0
0

I'm using IMFSourceReader to grab samples on an audio file.

I want to be able to seek anywhere in the audio timeline.

I have this function which sets the position:

void Seek(Windows::Foundation::TimeSpan position)
{
    HRESULT hr;

    PROPVARIANT var;
    hr = InitPropVariantFromInt64(position.Duration, &var);
    ThrowIfFailed(hr);
    
    hr = m_pSourceReader->SetCurrentPosition(GUID_NULL, var);
    PropVariantClear(&var);

    ThrowIfFailed(hr);
}

the position is tied to a slider between 0 and the audio max time obtained from:

Windows::Foundation::TimeSpan GetDuration()
{
    PROPVARIANT var;
    PropVariantInit(&var);

    HRESULT hr = m_pSourceReader->GetPresentationAttribute(MF_SOURCE_READER_MEDIASOURCE, MF_PD_DURATION, &var);
    ThrowIfFailed(hr);

    LONGLONG hnsDuration;
    hr = PropVariantToInt64(var, &hnsDuration);
    ThrowIfFailed(hr);

    PropVariantClear(&var);

    Windows::Foundation::TimeSpan timeSpan;
    timeSpan.Duration = hnsDuration;
    return timeSpan;
}

whenever I change the slider position it calls Seek(slider.Position.ToTimeSpan()) (in pseudo code)

But it doesn't work.

the next sample I read using

m_pSourceReader->ReadSample((DWORD)MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, NULL, &dwFlags, &_timeStamp, &pSample);

_timeStamp : does not reflect the seeked position.

What am I missing here ?

thanks!

Calling IMFSourceResolver::CreateObjectFromURL in an event callback

$
0
0

  Is this allowed?  It seems to deadlock the event callback thread. The thread is stuck in CreateObjectFromURL, apparently it is stuck on CAsyncResult::Wait.  Is there only one async event dispatch thread?

Ryan

Relevant to Protecting Files with DRM in windows 8.1

$
0
0

Hello ,

I have few question about windows media format sdk

1. What is the latest release version of the "Windows media format sdk" specially for windows 8.1 Os? Is it included inside

WDK 8.1?

2. I have downloaded "Windows media format sdk -11" from the microsoft site and run the sample drmheader , audioplayer,

but drmshow sample showing some license error and hence failed to run , so my question is :

To develope a desktop app of  "To protect the media file with DRM " for windows 8.1 Is it necessary to buy the license to get "WMStubDRM.lib".

3. There is no any evaluation version of this "WMStubDRM.lib" library for showing proof of concept.?

4. I have never found any information on the net relevant to this "writing DRM protected media".

any quick help will be appreciated!

hot to set a guid-represented property MFNETSOURCE_AUTORECONNECTLIMIT into IPropertyStore?

$
0
0
I want to set IPropertyStore, and set the property MFNETSOURCE_AUTORECONNECTLIMIT with some value, but MFNETSOURCE_AUTORECONNECTLIMIT is a guid symbol, and it does not work by setvalue(MFNETSOURCE_AUTORECONNECTLIMIT,var).     How can i?

Why the red value can not be larger than 229 in dxvahd VideoProcessBltHD?

$
0
0

I am using dxvahd with Visual C++ 2010 in Window 7.

There is a problem when I mix two stream with DXVAHD.

The video main format is YV12, and the sub format is D3DFMT_A8R8G8B8.

In the substream, I draw a rectangle with color 0xFF0000 (RED),  and I can not see the rectangle.

But when i draw the rectangle with color 0xE50000, and I can see the rectangle.

When the red value is in the range of 230 to 255, the rectangle can not be seen.

Can anybody tell me how to resolve this problem?


why onreadsample() cannot invoke onreadsample() in multiple ip camera videos scenario?

$
0
0
why onreadsample() cannot invoke onreadsample() in multiple video scenaria?

why readsample() cannot invoke onreadsample() in multiple ip camera videos scenario?

$
0
0
why readsample() cannot invoke onreadsample() in multiple video scenaria?

IMFSourceReader, H264 decoder and DXVA2_SurfaceType_D3DRenderTargetTexture

$
0
0

Hi,

 

I have created a IMFSourceReader from a H264 file using MFCreateSourceReaderFromURL, I provided a IDirect3DDeviceManager by setting the MF_SOURCE_READER_D3D_MANAGER attribute. So now when I read a IMFSample from the source reader I can get a IDirect3DSurface9 from the IMFSample.

But instead of a IDirect3dSurface9 I want to get a iDirect3dTexture9, I notice that there is a DXVA2_SurfaceType_D3DRenderTargetTexture type for the render target. So now I have the following questions:

1. Can I set DXVA2_SurfaceType_D3DRenderTargetTexture to the allocator used by the IMFSourceReade? If yes how can I do that?

2. How well is this DXVA2_SurfaceType_D3DRenderTargetTexture flag supported by the Media Foundation H264 decoder? There is too few documentation about this flag.

3. Can I inject my custom allocator into the H264 decoder in the source reader?

 

Thanks.

 

Alpha

How can I get the real size from SourceReader

$
0
0

I use SourceReader to decode H264 video to NV12. The actual size of output video is 1920x1088 with crop 1920x1080 When I call MFGetAttributeSize with MF_MT_FRAME_SIZE attribute for input IMFMediaType it returns height 1080. Is there any way to get the real size?

The same issue with other output formats.




IMFSinkWriter::WriteSample consume 80% processor.

$
0
0

1. Processor - WriteSample uses up 80% of my processor when my webcam runs at 30fps with audio around 26samples per second, while it uses up around only 22% processor when my webcam runs at around 8fps. Is this a normal behaviour or are there any ways or attribute that needs to be set?

2. Memory - When my webcam runs at 8fps, the memory usage is around 50k but at 30fps, the memory keeps increasing to more than 1000k until IMFSinkWriter::Finalize is called which the memory starts decreasing and the video file is created when memory drops back to around 50k. Is this problem caused by lack of processing power to write sample at 30fps? I'm using intel i5-2430m dual core processor and throttling is disabled.

Thank you

EVR, PresentImage

$
0
0

Hi everyone,

Is there any function of EVR works like PresentImage of VMR9? If not, how can we get in touch with the surface to be drawn in EVR? Do I have to write a custom presenter for this?

Thanks in advance.

Mpeg1Source Sample

$
0
0

I'm trying to get the new mpeg1sample to work but when I open a mpg file using MF_BasicPlayback the app just hangs and doing break all in the debugger doesn't seem to stot anywhere obvious.  This happen on both my Vista boxes, is there anything else, other than registering the mpeg1sample.dll that I need to do to test this?

 

John


DXVA2 Allocator & EVR

$
0
0
Hi,

I hope it's a right place for this questions, so.. here it is:
I'm writing DXVA 2.0 decoder filter and I have a problem with media type change negotiation (on-fly). I haven't found any doc on msdn which describes it for DXVA 2.0.
I have written my own DXVA sample allocator and when I try to call SetProperties method on i (with new cbBuffer size), I get error: VFW_E_BUFFERS_OUTSTANDING. And it's permanent problem (not a synchronization issue).
When I take a look at m_lFree member of my DXVA allocator: I see that it contains 16 samples, when I've allocated total of 19 samples.
I believe that this samples are used by EVR as a reference frames, but stream have changed and I dont need it anymore.
How can I signal EVR to release this samples?


Best regards,
Sergey.

EVR and DirectX 10

$
0
0
Hi,

I try to write custom muxer and presenter for EVR.

Now I have DirectX10 application that required some video processing features. I write skeleton for using media foundation, but if I set IID_ID3D10Device interface in responce to call to IVideoDeviceID::GetDeviceID, I return error while building topology, if I set IID_IDirect3DDevice9 in this call topology build's ok.

Question: Can I use DirectX 10 with EVR? If yes, how I do it? I have application already... If not, how I can get video processing features with DirectX10?

Regards,
Artyom.

Hardware acceleration in transcoding

$
0
0
My original goal was extract part of a video into a separate file. I tried to connect a media sink directly to a media source. However, from http://social.msdn.microsoft.com/Forums/en-US/mediafoundationdevelopment/thread/48349537-ca42-4535-b608-77dd70f6ab38 I realized that there's some hiccups doing that. Then I changed by mind to modify the Transcode sample in the 7.0 SDK to achieve my goal. However, unfortunately, transcode is very slow. It takes almost 1:1 time to extract clip (almost one minute to extract one minute clip from a 2gb wmv). It'll be nice if it can be several times faster. 

I found that DXVA probably could help me, but the documentation says it seens to be used between decoder and video renderer. I wonder if I can put it between decoder and encoder.

Thank you,

IMFVideoRenderer::InitializeRenderer and E_INVALIDARG response

$
0
0
Hey all,

After 5-10 playback graphs have been created and destroyed throughout the course of my application's lifetime, for some reason the EVR presenter returns
E_INVALIDARG on InitializeRenderer. Other presenters such as VMR7 or VMR9 have no such problem.

I'm just wondering what the root cause would be for IMFVideoRenderer::InitializeRenderer returning E_INVALIDARG to me. MSDN says "
Either the mixer or the presenter is invalid." which is less than helpful.

Any pointers appreciated,

- Simon

How to Disable Video acceleration programmatically?

$
0
0
Hello everyone.,
How do I Disable Video acceleration programmatically like the option in Media player->Tools->Performance->Video acceleration.?

Thanks in advance.!
Viewing all 1079 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>