Administrator
|
This post was updated on .
I am wanting the src_0 for each tee to go to the recordbin. That one I will send EOS through and stop the recording and restart the record bin over. I Have Unlinked the pad but for some reason it says I can't find the pad that I assigned to each tee I on the pipeline? I am successfully blocking the vtee and atee. If you need the full file look testingPurpose.h
///// -------------- PIPELINE ------------- ///////////// / - - q3 - - - - q1 - - - rtph264depay - - - - h264parse - - - - vtee - - \ / - - q5 source -- - - q4 \ - - - - q2 - - - rtpmp4gdepay - - - aacparse - - - faad - - - atee - -/ \ - - q6 FakeSinkBin: q5 - - fakesink q6 - - fakesink2 Record bin: q4 - - \ avimux - - appsink q3- - - / / ------------------------ METHOD ---------------------- / void SetupRecPipeline() { _videoData.Rec = gst_bin_new("rec"); _videoData.mux = gst_element_factory_make("avimux","avimux"); _videoData.q3 = gst_element_factory_make("queue","video-queueRec"); _videoData.q4 = gst_element_factory_make("queue","audio-queueRec"); _videoData.appsink = gst_element_factory_make ("appsink", "appsink"); g_object_set(GST_OBJECT(_videoData.appsink),"emit-signals",TRUE,NULL); Console::WriteLine("Adding Elements to Mux Container"); gst_bin_add_many(GST_BIN(_videoData.Rec),_videoData.q3,_videoData.q4,_videoData.mux,_videoData.appsink,NULL); } / ------------------------ METHOD ---------------------- / gboolean LinkRecPipeline() { GstPad* OverallSrcpad,* OverallSinkpad; // Request source pads from tee and sink pads from bin _videoData.SourcePadVideoQ3ToMux = gst_element_get_static_pad(_videoData.q3,"src"); _videoData.SinkPadVideoQ3ToMux = gst_element_get_request_pad(_videoData.mux,"video_00"); gst_pad_link(_videoData.SourcePadVideoQ3ToMux,_videoData.SinkPadVideoQ3ToMux); _videoData.SourcePadAudioQ4ToMux = gst_element_get_static_pad(_videoData.q4,"src"); _videoData.SinkPadAudioQ4ToMux = gst_element_get_request_pad(_videoData.mux,"audio_00"); gst_pad_link(_videoData.SourcePadAudioQ4ToMux,_videoData.SinkPadAudioQ4ToMux); gst_bin_add(GST_BIN(_videoData.srcPipeline),_videoData.Rec); std::cout << std::endl << "linked record pipeline" << std::endl; // Create ghost pads on the bin and link to queues GstPad* sinkpad; sinkpad = gst_element_get_static_pad(_videoData.q3, "sink"); gst_element_add_pad(_videoData.Rec, gst_ghost_pad_new("videosink", sinkpad)); gst_object_unref(GST_OBJECT(sinkpad)); sinkpad = gst_element_get_static_pad(_videoData.q4, "sink"); gst_element_add_pad(_videoData.Rec, gst_ghost_pad_new("audiosink", sinkpad)); gst_object_unref(GST_OBJECT(sinkpad)); gst_element_set_state(_videoData.Rec, GST_STATE_PAUSED); std::cout << std::endl << "rec pipeline to pause state" << std::endl; // set the new bin to PAUSE to preroll // Request source pads from tee and sink pads from bin _videoData.vtee = gst_bin_get_by_name (GST_BIN(_videoData.srcPipeline), "videotee"); _videoData.SourcePadVideoVTeeToQ3 = gst_element_get_request_pad(_videoData.vtee, "src_0"); _videoData.SinkPadVideoVTeeQ3 = gst_element_get_static_pad(_videoData.Rec, "videosink"); gst_pad_link(_videoData.SourcePadVideoVTeeToQ3, _videoData.SinkPadVideoVTeeQ3); _videoData.atee = gst_bin_get_by_name (GST_BIN(_videoData.srcPipeline), "audiotee"); _videoData.SourcePadAudioATeeToQ4 = gst_element_get_request_pad(_videoData.atee, "src_0"); _videoData.SinkPadAudioATeeToQ4 = gst_element_get_static_pad(_videoData.Rec, "audiosink"); gst_pad_link(_videoData.SourcePadAudioATeeToQ4, _videoData.SinkPadAudioATeeToQ4); if(!elementLinking(_videoData.mux,_videoData.appsink,"\nFailed Link mux to appsink\n")) return false; return TRUE; } / ------------------------ METHOD ---------------------- / static GstPadProbeReturn event_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { GMainLoop *loop = (GMainLoop *)user_data; GstElement *next; GstElement* temp; GstPad* srcpad,*sinkpad; if (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_DATA (info)) != GST_EVENT_EOS) return GST_PAD_PROBE_PASS; gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); std::cout << std::endl << "Removed Blocked Probe in mux"<< std::endl; //g_print ("Switching from '%s' to '%s'..\n", GST_OBJECT_NAME (cur_effect), //GST_OBJECT_NAME (next)); g_print("\nSwitching\n"); if(gst_pad_unlink(_videoData.SourcePadVideoVTeeToQ3, _videoData.SinkPadVideoVTeeQ3)) Console::WriteLine("Unlinked VTee q3"); if(gst_pad_unlink(_videoData.SourcePadAudioATeeToQ4, _videoData.SinkPadAudioATeeToQ4)) Console::WriteLine("Unlinked ATee q4"); if(gst_pad_unlink(_videoData.SourcePadVideoQ3ToMux,_videoData.SinkPadVideoQ3ToMux)) Console::WriteLine("Unlinked q3 to mux"); if(gst_pad_unlink(_videoData.SourcePadAudioQ4ToMux,_videoData.SinkPadAudioQ4ToMux)) Console::WriteLine("Unlinked q4 mux"); if(gst_element_unlinkBool(_videoData.mux,_videoData.appsink)) Console::WriteLine("Unlinked mux to appsink"); gst_element_release_request_pad(_videoData.vtee,_videoData.SourcePadVideoVTeeToQ3); gst_element_release_request_pad(_videoData.atee,_videoData.SourcePadAudioATeeToQ4); gst_element_release_request_pad(_videoData.q3,_videoData.SourcePadVideoQ3ToMux); gst_element_release_request_pad(_videoData.q4,_videoData.SourcePadAudioQ4ToMux); gst_pad_set_active(_videoData.SourcePadVideoVTeeToQ3,FALSE); gst_pad_set_active(_videoData.SinkPadVideoVTeeQ3,FALSE); gst_pad_set_active(_videoData.SourcePadAudioATeeToQ4,FALSE); gst_pad_set_active(_videoData.SinkPadAudioATeeToQ4,FALSE); gst_element_remove_pad(_videoData.vtee,_videoData.SourcePadVideoVTeeToQ3); gst_element_remove_pad(_videoData.atee,_videoData.SourcePadAudioATeeToQ4); gst_element_remove_pad(_videoData.q3,_videoData.SourcePadVideoQ3ToMux); gst_element_remove_pad(_videoData.q4,_videoData.SourcePadAudioQ4ToMux); g_print("\nsetting state NULL\n"); gst_element_set_state (_videoData.mux, GST_STATE_NULL); gst_element_set_state (_videoData.q3, GST_STATE_NULL); gst_element_set_state (_videoData.q4, GST_STATE_NULL); gst_element_set_state (_videoData.appsink, GST_STATE_NULL); gst_element_set_state (_videoData.Rec, GST_STATE_NULL); gst_bin_remove (GST_BIN (_videoData.Rec), _videoData.q3); gst_bin_remove (GST_BIN (_videoData.Rec), _videoData.q4); gst_bin_remove (GST_BIN (_videoData.Rec), _videoData.mux); gst_bin_remove (GST_BIN (_videoData.Rec), _videoData.appsink); gst_bin_remove (GST_BIN (_videoData.srcPipeline), _videoData.Rec); SetupRecPipeline(); LinkRecPipeline(); gst_pad_set_active(_videoData.SourcePadVideoVTeeToQ3,TRUE); gst_pad_set_active(_videoData.SinkPadVideoVTeeQ3,TRUE); gst_pad_set_active(_videoData.SourcePadAudioATeeToQ4,TRUE); gst_pad_set_active(_videoData.SinkPadAudioATeeToQ4,TRUE); CheckStateChange(gst_element_set_state (_videoData.Rec, GST_STATE_PLAYING)); return GST_PAD_PROBE_OK; } / ------------------------ METHOD ---------------------- / static GstPadProbeReturn pad_probe_cb_block (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { GstPad *srcpad; GST_DEBUG_OBJECT (pad, "pad is blocked now"); g_print("\nBlocked Now\n"); /* remove the probe first */ //gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); send_eos_element = _videoData.mux; // install new probe for EOS srcpad = gst_element_get_static_pad(_videoData.appsink, "sink"); muxID = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, event_probe_cb, user_data, NULL); gst_object_unref(srcpad); /* push EOS into the element, the probe will be fired when the * EOS leaves the effect and it has thus drained all of its data */ //sinkpad = gst_element_get_static_pad (send_eos_element, "sink"); //gst_pad_send_event (_videoData.SinkPadVideoVTeeQ3, gst_event_new_eos ()); //gst_object_unref (_videoData.SinkPadVideoVTeeQ3); //g_print("\nsending eos \n"); gst_element_send_event(_videoData.Rec,gst_event_new_eos()); return GST_PAD_PROBE_OK; } / ------------------------ METHOD ---------------------- / static GstPadProbeReturn pad_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { GstPad *srcpad; GST_DEBUG_OBJECT (pad, "pad is blocked now"); g_print("\nBlocked Now\n"); /* remove the probe first */ //gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); std::cout << std::endl << " Blocking Video" << std::endl; vID = gst_pad_add_probe (BlockVideoPad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, pad_probe_cb_block, user_data, NULL); //gst_pad_remove_probe(BlockVideoPad,vID); return GST_PAD_PROBE_OK; }
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Administrator
|
I think I got it now.
Dont know if this is the answer but this is what i think did the trick. I used: gst_element_release_request_pad(); gst_element_remove_pad(); on all the Rec bin elements but now I did a corrections for them. Released pad on the video and audio tee source. only removed pad on q3 and q4 source. didn't use the gst_pad_set_active();. I also used in the Linking again method I used local variables to the record bin elements instead. Corrected: testingPurposeCorrect
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Free forum by Nabble | Edit this page |