Blocking the tees?
killerrats
koreysjunkmail at gmail.com
Wed May 2 22:36:50 UTC 2018
figure out I can use the approach GST_PAD_PROBE_TYPE_IDLE through the video
then from video call back block probe GST_PAD_PROBE_TYPE_IDLE into audio
side.
The only draw back is that for some reason didn't send the block through the
audio side. You start from calling the method StoppingTheBranch(); then down
to each method below.
bool RtspPipeline::StoppingTheBranch(const std::string teePadName)
{
gErrorStoppingBranch = false;
bool result = true;
GstElement* vtee = nullptr;
GstPad* vteePad = nullptr;
unsigned __int16 count = 0;
GstPadProbeType BlockType = GST_PAD_PROBE_TYPE_IDLE;
this->aStopBranchPad = teePadName;
vtee = this->GetElementFromBin(this->srcPipeline, RTSP_V_TEE_NAME);
vteePad = GetStaticPad(vtee, teePadName);
this->aBlockVideoId1 = gst_pad_add_probe(vteePad, BlockType,
video_block_cb, this->pRtspPipeline, nullptr);
if (this->aBlockVideoId1 == 0)
result = false;
End:
{
this->UnrefPointerObject(vteePad, vtee, nullptr);
}
return result;
}
GstPadProbeReturn RtspPipeline::video_block_cb(GstPad * pad, GstPadProbeInfo
* info, gpointer user_data)
{
GstPadProbeType BlockType = GST_PAD_PROBE_TYPE_IDLE;
GstElement* atee = nullptr;
RtspPipeline* pPipe = static_cast<RtspPipeline*>(user_data);
GstPadProbeReturn result = GST_PAD_PROBE_OK;
try
{
pPipe->aBlockAudioId1 =
gst_pad_add_probe(GetStaticPad(atee,pPipe->aStopBranchPad),
BlockType,audio_block_cb,user_data, nullptr);
if (pPipe->aBlockAudioId1 == 0)
{
gErrorStoppingBranch = true;
result = GST_PAD_PROBE_DROP;
}
gst_object_unref(atee);
}
catch (...)
{
gErrorStoppingBranch = true;
}
return result;
}
GstPadProbeReturn RtspPipeline::audio_block_cb(GstPad * pad, GstPadProbeInfo
* info, gpointer user_data)
{
GstPadProbeType BlockType = GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM;
GstElement* appsink = nullptr, *queue1 = nullptr, *queue2 = nullptr;
GstPad* sinkPad = nullptr;
RtspPipeline* pPipe = static_cast<RtspPipeline*>(user_data);
PipelineElements pipe;
GstPadProbeReturn result = GST_PAD_PROBE_OK;
try
{
ReturnBranchElementNames(pPipe->aStopBranchPad, pipe.appsinkName,
pipe.avimuxName, pipe.queue1Name, pipe.queue2Name);
appsink = gst_bin_get_by_name(GST_BIN(pPipe->srcPipeline),
pipe.appsinkName.c_str());
queue1 = gst_bin_get_by_name(GST_BIN(pPipe->srcPipeline),
pipe.queue1Name.c_str());
queue2 = gst_bin_get_by_name(GST_BIN(pPipe->srcPipeline),
pipe.queue2Name.c_str());
sinkPad = gst_element_get_static_pad(appsink, "sink");
const unsigned long probeId = gst_pad_add_probe(sinkPad, BlockType,
RtspEventProbe, user_data, nullptr);
if(probeId == 0)
{
gErrorStoppingBranch = true;
result = GST_PAD_PROBE_DROP;
goto End;
}
gboolean queue1Event = gst_element_send_event(queue1, gst_event_new_eos())
,queue2Event = gst_element_send_event(queue2, gst_event_new_eos());
if( (queue1Event == FALSE) && (queue2Event == FALSE))
{
gErrorStoppingBranch = true;
result = GST_PAD_PROBE_DROP;
goto End;
}
if(pPipe->WaitForAppsinkEos())
{
pPipe->StopBranch(pPipe->aStopBranchPad);
}
}
catch (...)
{
gErrorStoppingBranch = true;
}
End:
{
gst_object_unref(appsink);
gst_object_unref(queue1);
gst_object_unref(queue2);
}
return result;
}
GstPadProbeReturn RtspPipeline::RtspEventProbe(GstPad * pad, GstPadProbeInfo
* info, gpointer user_data)
{
if (GST_EVENT_TYPE(GST_PAD_PROBE_INFO_DATA(info)) != GST_EVENT_EOS)
{
return GST_PAD_PROBE_PASS;
}
RtspPipeline* pPipe = static_cast<RtspPipeline*>(user_data);
gst_pad_remove_probe(pad, GST_PAD_PROBE_INFO_ID(info));
std::cout << "\nGot Eos through " << GST_ELEMENT_NAME(GST_PAD_PARENT(pad))
<< "\n";
pPipe->AppsinkEos = true;
return GST_PAD_PROBE_DROP;
}
-----
------------------------------
Gstreamer 1.12.4
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list