示例#1
0
/*
 * \brief called when the appsink notifies us that there is a new buffer ready for processing in case of a redirection
 * \param GstElement elt the appsink element from SU pipeline
 * \param GstElement pipeline the pipeline from which we should retrieve appsrc ( SP's pipeline )
 * \return GstFlowReturn
 * */
static GstFlowReturn
	on_new_sample_from_sink (GstElement * appsink, GstElement *pipeline_SP )
{
	GstSample *sample;
	GstElement *appsource;
	GstFlowReturn ret;

	/* get the sample from appsink */
	sample = gst_app_sink_pull_sample (GST_APP_SINK (appsink));

	/* get appsource an push new sample */
	appsource = gst_bin_get_by_name (GST_BIN (pipeline_SP), APPSRC_NAME );
	ret = gst_app_src_push_sample (GST_APP_SRC (appsource), sample);
	gst_object_unref (appsource);

	/* we don't need the appsink sample anymore */
	gst_sample_unref (sample);

	return ret;
}
示例#2
0
static GstFlowReturn
on_new_sample_from_sink (GstElement * elt, ProgramData * data)
{
  GstSample *sample;
  GstElement *source;
  GstFlowReturn ret;

  /* get the sample from appsink */
  sample = gst_app_sink_pull_sample (GST_APP_SINK (elt));

  /* get source an push new sample */
  source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
  ret = gst_app_src_push_sample (GST_APP_SRC (source), sample);
  gst_object_unref (source);

  /* we don't need the appsink sample anymore */
  gst_sample_unref (sample);

  return ret;
}