Martin Delille
Martin Delille

Reputation: 11790

Invalid format specified for texture

I want to use the *Built-in iSight" camera of my macbook (I'm under bootcamp).

I create a simple program reading the video stream from the webcam using DirectShow graph. Here is the *Form1_Load()* method:

private void Form1_Load(object sender, EventArgs e)
{
    int hr = 0;

    _graphBuilder = (IGraphBuilder)new FilterGraph();
    Console.WriteLine("Create the VMR9 object");

    _vmr9 = (IBaseFilter)new VideoMixingRenderer9();

    Console.WriteLine("Configure the VMR9 for one stream");
    _filterConfig = (IVMRFilterConfig9)_vmr9;
    // One stream is enough for this sample
    _filterConfig.SetNumberOfStreams(1);

    _graphBuilder.AddFilter(_vmr9, "Video Mixing Renderer");


    Console.WriteLine("Change VMR9 mode to Windowless");
    hr = _filterConfig.SetRenderingMode(VMR9Mode.Windowless);
    Marshal.ThrowExceptionForHR(hr);

    _windowlessCtrl = (IVMRWindowlessControl9)_vmr9;

    Console.WriteLine("Set parent window");
    hr = _windowlessCtrl.SetVideoClippingWindow(this.Handle);
    Marshal.ThrowExceptionForHR(hr);

    Console.WriteLine("Set Aspect-Ratio");
    hr = _windowlessCtrl.SetAspectRatioMode(VMR9AspectRatioMode.None);
    Marshal.ThrowExceptionForHR(hr);

    Console.WriteLine("Set video position");
    hr = _windowlessCtrl.SetVideoPosition(null, DsRect.FromRectangle(this.ClientRectangle));
    Marshal.ThrowExceptionForHR(hr);

    Console.WriteLine("Building graph...");

    ICaptureGraphBuilder2 pBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
    hr = pBuilder.SetFiltergraph(_graphBuilder);
    checkHR(hr, "Can't SetFiltergraph");

    Guid CLSID_WDMStreamingCaptureDevices = new Guid("{65E8773D-8F56-11D0-A3B9-00A0C9223196}"); //

    //add Built-in iSight
    IBaseFilter pBuiltiniSight = CreateFilterByName(@"Built-in iSight", CLSID_WDMStreamingCaptureDevices);
    hr = _graphBuilder.AddFilter(pBuiltiniSight, "Built-in iSight");
    checkHR(hr, "Can't add Built-in iSight to graph");

    //connect Built-in iSight and Video Renderer
    hr = _graphBuilder.ConnectDirect(GetPin(pBuiltiniSight, "Capturer"), GetPin(_vmr9, "VMR Input0"), null); // => Program hungs up!!!
    checkHR(hr, "Can't connect Built-in iSight and Video Renderer");

    Console.WriteLine("Running...");
    mediaControl = (IMediaControl)_graphBuilder;
    hr = mediaControl.Run();
    checkHR(hr, "Can't run the graph");
}

The program is stuck when calling the ConnectDirect() method...

It use to work. It works perfectly fine when using a video renderer filter but I need to use the video mixing renderer 9.

I used TraceSpy to catch the following trace:

Direct3D9: :====> ENTER: DLLMAIN(581fd9a0): Process Attach: 00000a70, tid=00000658
Direct3D9: :====> EXIT: DLLMAIN(581fd9a0): Process Attach: 00000a70
Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.
Direct3D9: (INFO) :Direct3D9 Debug Runtime selected.
D3D9 Helper: Enhanced D3DDebugging disabled; Application was not compiled with D3D_DEBUG_INFO
Direct3D9: (INFO) :======================= Hal SWVP device selected
Direct3D9: (INFO) :HalDevice Driver Style b
Direct3D9: :BackBufferCount not specified, considered default 1
Direct3D9: :DoneExclusiveMode
Direct3D9: (INFO) :Using FF to PS converter
Direct3D9: (INFO) :Enabling multi-processor optimizations
Direct3D9: (WARN) :Athlon32Compiler: CPU does not meet minimum requirements
Direct3D9: (INFO) :Using P4 PSGP
Direct3D9: (INFO) :Using FF to VS converter in software vertex processing
Direct3D9: :BackBufferCount not specified, considered default 1
Direct3D9: :DoneExclusiveMode
Direct3D9: :DoneExclusiveMode
Direct3D9: (ERROR) :Invalid format specified for texture

Upvotes: 2

Views: 358

Answers (0)

Related Questions