Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Filter Graphs

Filter Graphs

Scheduled Pinned Locked Moved C#
helpcsharpgraphicsdata-structuresquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GrizzlyDoug
    wrote on last edited by
    #1

    To All: I'm a newbie at filter graphs and I've been working on building a filter graph to convert/play a .mp3 file to a .wav format and play the music. In my filter graph I have an infinite pin tee filter, which is splitting the output to go to three output devices ( 2 sets of headphones and a set of speakers ). I built the filter graph in GraphEdit and it works fine. It splits the output to the 3 output devices. Now I've taken on the challenge of building this filter graph programmatically and I'm running into some difficulties. When I put my filter graph on the ROT to examine it in GraphEdit, either it's not visible when I try to get the remote graph or I get an error, "Object reference not set to an instance of an object." That's one part that would be useful for debugging. I also read that the physical connections that I created programmatically for the pins may be changed when I render the file, which causes the above error. The second part is that I may be building my filter graph incorrectly (most likely). Like I said, I'm a newbie at this. The code I have started with, came from a project I found on the net, and then I made quite a few modifications to get where I am now. My code doesn't seem to split the outputs to the different output devices. I only get the music to one headset, and nothing to the others. I'm not sure if it's how I'm finding and connecting my pins, or just how I'm building the filtergraph, which is causing me the problems. I read something on one of the forums last night about building the filter graph the way you would put it together in GraphEdit, so I changed my code to connect pins as I added filters. It still is giving me problems with not splitting the outputs to the devices. There is one more issue. This is being developed on a Vista machine in C#, but I went to the compatibility tab in the properties for the executable and set it to a Compatibility mode of "Windows XP (Service Pack 2)". Did I say that I do have it working in GraphEdit, with the splitting of the outputs? I have added the code below. If anyone has any suggestions or can help me, I would greatly appreciate it. Thanks in advance. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Runtime.InteropServices; using DirectShowLib; public class M2Mkv : Form { private Button button1; private RadioButton MkvRadioButton; private RadioButton WmvRadioButton; privat

    R 1 Reply Last reply
    0
    • G GrizzlyDoug

      To All: I'm a newbie at filter graphs and I've been working on building a filter graph to convert/play a .mp3 file to a .wav format and play the music. In my filter graph I have an infinite pin tee filter, which is splitting the output to go to three output devices ( 2 sets of headphones and a set of speakers ). I built the filter graph in GraphEdit and it works fine. It splits the output to the 3 output devices. Now I've taken on the challenge of building this filter graph programmatically and I'm running into some difficulties. When I put my filter graph on the ROT to examine it in GraphEdit, either it's not visible when I try to get the remote graph or I get an error, "Object reference not set to an instance of an object." That's one part that would be useful for debugging. I also read that the physical connections that I created programmatically for the pins may be changed when I render the file, which causes the above error. The second part is that I may be building my filter graph incorrectly (most likely). Like I said, I'm a newbie at this. The code I have started with, came from a project I found on the net, and then I made quite a few modifications to get where I am now. My code doesn't seem to split the outputs to the different output devices. I only get the music to one headset, and nothing to the others. I'm not sure if it's how I'm finding and connecting my pins, or just how I'm building the filtergraph, which is causing me the problems. I read something on one of the forums last night about building the filter graph the way you would put it together in GraphEdit, so I changed my code to connect pins as I added filters. It still is giving me problems with not splitting the outputs to the devices. There is one more issue. This is being developed on a Vista machine in C#, but I went to the compatibility tab in the properties for the executable and set it to a Compatibility mode of "Windows XP (Service Pack 2)". Did I say that I do have it working in GraphEdit, with the splitting of the outputs? I have added the code below. If anyone has any suggestions or can help me, I would greatly appreciate it. Thanks in advance. using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using System.Runtime.InteropServices; using DirectShowLib; public class M2Mkv : Form { private Button button1; private RadioButton MkvRadioButton; private RadioButton WmvRadioButton; privat

      R Offline
      R Offline
      Rich Insley
      wrote on last edited by
      #2

      Try the following. I marked the changes I made with "jl - " so you can what was causing the problems. Also, the reason you're not able to connect to the remote graph in GraphEdit is most likely because you have the wrong version for Vista. I explain why this is, in the article http://www.codeproject.com/cs/media/dsgraphedit.asp [^] in the section "Known Issues". Hope this helps.

          void Convert2Wav()
          {
              IPin mp3\_file\_sourceOut = null;
              IPin mpg\_stream\_splitterIn = null, mpg\_stream\_splitterOut = null;
              IPin dshow\_audio\_decoderIn = null, dshow\_audio\_decoderOut = null;
              IPin infinitePinTeeFilterIn = null, infinitePinTeeFilterOut1 = null;
              IPin infinitePinTeeFilterOut2 = null, infinitePinTeeFilterOut3 = null;
              // Output Devices
              IPin logitech\_earphone\_headsetIn = null;
              IPin logitech3\_earphone\_headsetIn = null;
              IPin sigmatel\_speakers\_headsetIn = null;
      
              try
              {
                  string fileName = fName;
      
                  // jl - you already created the GraphBuilder in InitInterfaces
                  /\*
                  Guid filter\_graph\_guid = new Guid("E436EBB8-524F-11CE-9F53-0020AF0BA770");
                  Type t = Type.GetTypeFromCLSID(filter\_graph\_guid);
                  gb = (IGraphBuilder)Activator.CreateInstance(t);
                  \*/
      
                  // jl - this will create a file source filter, but it wont actually point to a file
                  /\*
                  Guid file\_source\_guid = new Guid("E436EBB5-524F-11CE-9F53-0020AF0BA770");
                  Type file\_source\_type = Type.GetTypeFromCLSID(file\_source\_guid);
                  mp3\_file\_source = (IBaseFilter)Activator.CreateInstance(file\_source\_type);
      
                  hr = gb.AddFilter((IBaseFilter)mp3\_file\_source, fileName);
                  mp3\_file\_source.FindPin("Output", out mp3\_file\_sourceOut);
                  DsError.ThrowExceptionForHR(hr);
                  \*/
      
                  // jl - do this instead of the above to add a source filter
                  hr = gb.AddSourceFilter(fName + fExt, fName, out mp3\_file\_source);
                  DsError.ThrowExceptionForHR(hr);
                  mp3\_file\_source.FindPin("Output", out mp3\_file\_sourceOut);
      
                  Guid splitter\_guid = ne
      
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups