Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7738343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:14:23+00:00 2026-06-01T08:14:23+00:00

I have a program that receives webcam video and displays it on a C#

  • 0

I have a program that receives webcam video and displays it on a C# application using directshowlib-2005.dll.

In my application I also use GMFBridge so that I can stream and record video whenever indicated.

In this program, my application controls are in the main loop, and the video streaming are done in a separate thread. I have options to either record the current streaming video from the main thread by pressing a button and using:

play.filesink = (IFileSinkFilter)play.file;
play.filesink.SetFileName(GetDateTimeString("Video") + ".avi", null);
IMediaControl Second_Graph = play.s_mediaCtrl;
Second_Graph.Run();
play.bridge.BridgeGraphs(play.BridgeSink, play.sourceFilter);

where the play class is the class which converts the incoming video from yuv to rgb and then sets up both the streaming and recording graphs

file is the filter file writer. I convert file write to an IFileSinkFilter so that i can put a name on it, as seen in the second line. then I play create a media controller and run the graph and bridge the streaming and recording graph.

I also have the option to set up future recordings at later times and dates, as entered. The future recordings are entered, and stored inside a static list that is sorted based on when the recordings occur. Inside the streaming thread, I poll the list to see if its time for a recording to start, if it is I run the same code as above:

play.filesink = (IFileSinkFilter)play.file;
play.filesink.SetFileName(GetDateTimeString("Video") + ".avi", null);
IMediaControl Second_Graph = play.s_mediaCtrl;
Second_Graph.Run();
play.bridge.BridgeGraphs(play.BridgeSink, play.sourceFilter);

This occurs inside the thread and when there is a recording, the application will crash on the first and/or second line. the error is the same, it doesn’t know what IFileSinkFilter is so in both invocations in the first and second lines, it crashes.

The error received is:

Unable to cast COM object of type 'System.__ComObject' to interface type 'DirectShowLib.IFileSinkFilter'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{A2104830-7C70-11CF-8BCE-00AA00A3F1A6}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

I am not sure why it fails or how to fix it. It had no issues when this block of code was part of a button in the main thread, but when its threaded separately it fails.

Any help on how to fix this would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:14:25+00:00Added an answer on June 1, 2026 at 8:14 am

    There are issues with creating the graph in one thread and controlling it in another thread because of COM thread affinity issues.

    When you were using the block of code on a button handler, it worked because everything was executed in the same thread.

    One of addressing your problem is instead of trying to play the graph on your processing thread, send a user defined windows message instead, the process the message in the main thread where you actually play the graph.

    This would ensure that playback happens on the same thread that created the graph.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am using java to develop program that receives and processes SMS messages. I have
I have a program that receives real time data on 1000 topics. It receives
i have a program that receives data from a wireless device over bluetooth...i now
I have a c++/windows program that receives data from another c++ program via a
I have a program that creates a Windows user account using the NetUserAdd() API
I have a program with several worker threads, and a main thread that receives
I have a program that receives input arguments: $ myProgram.exe -arg1 -arg2 -arg3 in
I have a program that receives serial data and uses matplotlib to graph it
I have a program that I need to use signals and handlers with. I
I have a program which transmits(broadcasts) and receives UDP packets simultaneously using pthreads. What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.