private void SetupRecordingPipeline() { // set up pipeline and elements // gst-launch-0.10 autoaudiosrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=dump.ogg // Create new pipeline. _pipeline = new Gst.Pipeline(); //Pipeline pipeline = new Pipeline("pipeline"); // Construct pipeline filesrc -> avidemux -> mpeg4 -> directdrawsink //_eleAudioSource = ElementFactory.Make("autoaudiosrc", "autoaudiosrc"); _eleAudioSource = ElementFactory.Make("pulsesrc"); _eleAudioConvert = ElementFactory.Make("audioconvert"); if (_recordOgg) { _eleVorbisEnc = ElementFactory.Make("vorbisenc"); _eleOggMux = ElementFactory.Make("oggmux"); } else { _eleWavPack = ElementFactory.Make("wavpackenc"); } _eleFileSink = new Gst.CorePlugins.FileSink(); //_eleFileSink = ElementFactory.Make("filesink", "filesink"); _eleFileSink ["location"] = _path; // Add and link pipeline. if (_recordOgg) { _pipeline.Add(_eleAudioSource, _eleAudioConvert, _eleVorbisEnc, _eleOggMux, _eleFileSink); } else { _pipeline.Add(_eleAudioSource, _eleAudioConvert, _eleWavPack, _eleFileSink); } // Play video. _pipeline.SetState(Gst.State.Ready); _pipeline.SetState(Gst.State.Paused); if (!_eleAudioSource.Link(_eleAudioConvert)) { Console.WriteLine("link failed between source and converter"); } if (_recordOgg) { if (!_eleAudioConvert.Link(_eleVorbisEnc)) { Console.WriteLine("link failed between converter and encoder"); } if (!_eleVorbisEnc.Link(_eleOggMux)) { Console.WriteLine("link failed between e and parser"); } if (!_eleOggMux.Link(_eleFileSink)) { Console.Error.WriteLine("link failed between parser and sink"); } } else { if (!_eleAudioConvert.Link(_eleWavPack)) { Console.WriteLine("link failed between converter and encoder"); } if (!_eleWavPack.Link(_eleFileSink)) { Console.Error.WriteLine("link failed between encoder and sink"); } } _recordInit = true; }
private void SetupRecordingPipeline () { // set up pipeline and elements // gst-launch-0.10 autoaudiosrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=dump.ogg // Create new pipeline. _pipeline = new Gst.Pipeline (); //Pipeline pipeline = new Pipeline("pipeline"); // Construct pipeline filesrc -> avidemux -> mpeg4 -> directdrawsink //_eleAudioSource = ElementFactory.Make("autoaudiosrc", "autoaudiosrc"); _eleAudioSource = ElementFactory.Make ("pulsesrc"); _eleAudioConvert = ElementFactory.Make ("audioconvert"); if (_recordOgg) { _eleVorbisEnc = ElementFactory.Make ("vorbisenc"); _eleOggMux = ElementFactory.Make ("oggmux"); } else { _eleWavPack = ElementFactory.Make ("wavpackenc"); } _eleFileSink = new Gst.CorePlugins.FileSink (); //_eleFileSink = ElementFactory.Make("filesink", "filesink"); _eleFileSink ["location"] = _path; // Add and link pipeline. if (_recordOgg) { _pipeline.Add (_eleAudioSource, _eleAudioConvert, _eleVorbisEnc, _eleOggMux, _eleFileSink); } else { _pipeline.Add (_eleAudioSource, _eleAudioConvert, _eleWavPack, _eleFileSink); } // Play video. _pipeline.SetState (Gst.State.Ready); _pipeline.SetState (Gst.State.Paused); if (!_eleAudioSource.Link (_eleAudioConvert)) { Console.WriteLine ("link failed between source and converter"); } if (_recordOgg) { if (!_eleAudioConvert.Link (_eleVorbisEnc)) { Console.WriteLine ("link failed between converter and encoder"); } if (!_eleVorbisEnc.Link (_eleOggMux)) { Console.WriteLine ("link failed between e and parser"); } if (!_eleOggMux.Link (_eleFileSink)) { Console.Error.WriteLine ("link failed between parser and sink"); } } else { if (!_eleAudioConvert.Link (_eleWavPack)) { Console.WriteLine ("link failed between converter and encoder"); } if (!_eleWavPack.Link (_eleFileSink)) { Console.Error.WriteLine ("link failed between encoder and sink"); } } _recordInit = true; }