Click here to Skip to main content
16,004,974 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exceptions Pin
Jim Warburton8-Nov-07 7:15
Jim Warburton8-Nov-07 7:15 
AnswerRe: Exceptions Pin
PIEBALDconsult8-Nov-07 15:33
mvePIEBALDconsult8-Nov-07 15:33 
QuestionHow to get a window's icon, WM_GETICON indeed. Pin
Anthony Mushrow8-Nov-07 6:48
professionalAnthony Mushrow8-Nov-07 6:48 
AnswerRe: How to get a window's icon, WM_GETICON indeed. Pin
Giorgi Dalakishvili8-Nov-07 7:00
mentorGiorgi Dalakishvili8-Nov-07 7:00 
GeneralRe: How to get a window's icon, WM_GETICON indeed. Pin
Anthony Mushrow8-Nov-07 7:44
professionalAnthony Mushrow8-Nov-07 7:44 
GeneralRe: How to get a window's icon, WM_GETICON indeed. Pin
Giorgi Dalakishvili8-Nov-07 8:08
mentorGiorgi Dalakishvili8-Nov-07 8:08 
QuestionFilter Graphs Pin
GrizzlyDoug8-Nov-07 6:19
GrizzlyDoug8-Nov-07 6:19 
AnswerRe: Filter Graphs Pin
Rich Insley8-Nov-07 9:59
Rich Insley8-Nov-07 9:59 
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 = new Guid("336475D0-942A-11CE-A870-00AA002FEAB5");
        Type splitter_type = Type.GetTypeFromCLSID(splitter_guid);
        mpg_stream_splitter = (IBaseFilter)Activator.CreateInstance(splitter_type);

        hr = gb.AddFilter((IBaseFilter)mpg_stream_splitter, "MPEG 1 Stream Splitter");
        mpg_stream_splitter.FindPin("Input", out mpg_stream_splitterIn);
        // jl - you can't do this yet.  The audio pin will not appear until after the input pin
        // is connected to something
        // mpg_stream_splitter.FindPin("Audio", out mpg_stream_splitterOut);
        DsError.ThrowExceptionForHR(hr);

        // Connect the file source to the stream splitter
        gb.Connect(mp3_file_sourceOut, mpg_stream_splitterIn);

        // jl - now you can get the Audio pin
        mpg_stream_splitter.FindPin("Audio", out mpg_stream_splitterOut);

        Guid decoder_guid = new Guid("0F40E1E5-4F79-4988-B1A9-CC98794E6B55");
        Type decoder_type = Type.GetTypeFromCLSID(decoder_guid);
        dshow_audio_decoder = (IBaseFilter)Activator.CreateInstance(decoder_type);

        hr = gb.AddFilter((IBaseFilter)dshow_audio_decoder, "ffdshow Audio Decoder 0001");
        dshow_audio_decoder.FindPin("In", out dshow_audio_decoderIn);
        dshow_audio_decoder.FindPin("Out", out dshow_audio_decoderOut);
        DsError.ThrowExceptionForHR(hr);

        // Connect the stream splitter to the audio decoder
        gb.Connect(mpg_stream_splitterOut, dshow_audio_decoderIn);

        Guid tee_filter_guid = new Guid("F8388A40-D5BB-11D0-BE5A-0080C706568E");
        Type tee_filter_type = Type.GetTypeFromCLSID(tee_filter_guid);
        infinitePinTeeFilter = (IBaseFilter)Activator.CreateInstance(tee_filter_type);

        hr = gb.AddFilter((IBaseFilter)infinitePinTeeFilter, "Infinite Pin Tee Filter");
        infinitePinTeeFilter.FindPin("Input", out infinitePinTeeFilterIn);
        infinitePinTeeFilter.FindPin("Output1", out infinitePinTeeFilterOut1);
        // jl - Output2 won't appear until somthing is connected to Output1, and so on, and so on....
        /*
        infinitePinTeeFilter.FindPin("Output2", out infinitePinTeeFilterOut2);
        infinitePinTeeFilter.FindPin("Output3", out infinitePinTeeFilterOut3);
        */
        DsError.ThrowExceptionForHR(hr);

        // Connect the audio decoder to the infinite pin tee
        // (you really should be checking the HResults for the Connect methods)
        gb.Connect(dshow_audio_decoderOut, infinitePinTeeFilterIn);

        Guid logitech_earphone_guid = new Guid("E30629D1-27E5-11CE-875D-00608CB78066");
        Type earphone_type = Type.GetTypeFromCLSID(logitech_earphone_guid);
        logitech_earphone_headset = (IBaseFilter)Activator.CreateInstance(earphone_type);

        hr = gb.AddFilter((IBaseFilter)logitech_earphone_headset, "Headset Earphone (Logitech USB Headset)");
        logitech_earphone_headset.FindPin("Audio Input pin (rendered)", out logitech_earphone_headsetIn);
        DsError.ThrowExceptionForHR(hr);

        // Connect the infinite pin tee to first headphone through Output1
        gb.Connect(infinitePinTeeFilterOut1, logitech_earphone_headsetIn);

        // jl - NOW you can get the Output2 pin (assuming the above connection worked)
        infinitePinTeeFilter.FindPin("Output2", out infinitePinTeeFilterOut2);

        Guid logitech3_earphone_guid = new Guid("E30629D1-27E5-11CE-875D-00608CB78066");
        Type logitech3_earphone_type = Type.GetTypeFromCLSID(logitech3_earphone_guid);
        logitech3_earphone_headset = (IBaseFilter)Activator.CreateInstance(logitech3_earphone_type);

        hr = gb.AddFilter((IBaseFilter)logitech3_earphone_headset, "Headset Earphone (3- Logitech USB Headset)");
        logitech3_earphone_headset.FindPin("Audio Input pin (rendered)", out logitech3_earphone_headsetIn);
        DsError.ThrowExceptionForHR(hr);

        // Connect the infinite pin tee to second headphone through Output2
        gb.Connect(infinitePinTeeFilterOut2, logitech3_earphone_headsetIn);

        // jl - NOW you can get the Output3 pin (assuming the above connection worked. Check your HResults!)
        infinitePinTeeFilter.FindPin("Output3", out infinitePinTeeFilterOut3);

        // jl - The following technically will work, but you're just adding the exact same filter as the first two.
        // If you look at the Guids, they're all the same, and directshow is going to give you the same device
        // for all three.  Instead, you should enumerate your devices and use AddSourceFilterForMoniker,
        // or you can use DirectShowLib.Utils.FilterGraphTools.AddFilterByDevicePath with the device path
        Guid sigmatel_speakers_guid = new Guid("E30629D1-27E5-11CE-875D-00608CB78066");
        Type sigmatel_speakers_type = Type.GetTypeFromCLSID(sigmatel_speakers_guid);
        sigmatel_speakers_headset = (IBaseFilter)Activator.CreateInstance(sigmatel_speakers_type);

        hr = gb.AddFilter((IBaseFilter)sigmatel_speakers_headset, "Speakers (Sigma Tel High Definition Audio CODEC)");
        sigmatel_speakers_headset.FindPin("Audio Input pin (rendered)", out sigmatel_speakers_headsetIn);
        DsError.ThrowExceptionForHR(hr);

        // Connect the infinite pin tee to sigmatel speakers through Output3
        gb.Connect(infinitePinTeeFilterOut3, sigmatel_speakers_headsetIn);

        // jl - the graph should now be built, so this is not needed
        /*
        // use Intelligent connect to build the rest of the graph
        hr = gb.RenderFile(fileName + fExt, null);
        DsError.ThrowExceptionForHR(hr);
        */

        mc = (IMediaControl)gb;
        me = (IMediaEventEx)gb;

        hr = me.SetNotifyWindow(this.Handle, WM_GRAPHNOTIFY, IntPtr.Zero);
        DsError.ThrowExceptionForHR(hr);

        // DD For debugging, adds the graph to the ROT table
        rot = new DsROTEntry(gb);

        // we are ready to convert
        hr = mc.Run();
        DsError.ThrowExceptionForHR(hr);
    }
    catch (Exception ex)
    {
        MessageBox.Show("Error converting to mvk: " + ex.Message);
    }
}

QuestionAttributes giving problem Pin
humayunlalzad8-Nov-07 5:57
humayunlalzad8-Nov-07 5:57 
AnswerRe: Attributes giving problem Pin
J4amieC8-Nov-07 6:18
J4amieC8-Nov-07 6:18 
AnswerRe: Attributes giving problem Pin
Pete O'Hanlon8-Nov-07 9:11
mvePete O'Hanlon8-Nov-07 9:11 
AnswerRe: Attributes giving problem [modified] Pin
PIEBALDconsult8-Nov-07 15:37
mvePIEBALDconsult8-Nov-07 15:37 
GeneralRe: Attributes giving problem Pin
PIEBALDconsult8-Nov-07 16:58
mvePIEBALDconsult8-Nov-07 16:58 
AnswerRe: Attributes giving problem Pin
Nissim Salomon9-Nov-07 0:15
Nissim Salomon9-Nov-07 0:15 
QuestionHow to Send Parameter(s) to Reporting Service ? Pin
hdv2128-Nov-07 4:34
hdv2128-Nov-07 4:34 
AnswerRe: How to Send Parameter(s) to Reporting Service ? Pin
Giorgi Dalakishvili8-Nov-07 6:23
mentorGiorgi Dalakishvili8-Nov-07 6:23 
GeneralRe: How to Send Parameter(s) to Reporting Service ? Pin
hdv2128-Nov-07 11:32
hdv2128-Nov-07 11:32 
GeneralRe: How to Send Parameter(s) to Reporting Service ? Pin
Giorgi Dalakishvili8-Nov-07 20:15
mentorGiorgi Dalakishvili8-Nov-07 20:15 
QuestionXML Deserialisation & Malformed XML [modified] Pin
MrEyes8-Nov-07 4:23
MrEyes8-Nov-07 4:23 
AnswerRe: XML Deserialisation & Malformed XML Pin
MrEyes8-Nov-07 4:58
MrEyes8-Nov-07 4:58 
GeneralRe: XML Deserialisation & Malformed XML Pin
J4amieC8-Nov-07 6:14
J4amieC8-Nov-07 6:14 
GeneralRe: XML Deserialisation & Malformed XML Pin
MrEyes8-Nov-07 6:49
MrEyes8-Nov-07 6:49 
Questionshow/hide detection Pin
Morad SAJID8-Nov-07 3:36
Morad SAJID8-Nov-07 3:36 
AnswerRe: show/hide detection Pin
Pete O'Hanlon8-Nov-07 3:40
mvePete O'Hanlon8-Nov-07 3:40 
GeneralRe: show/hide detection Pin
Morad SAJID8-Nov-07 4:13
Morad SAJID8-Nov-07 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.