Dynamic-Pipeline ( Vidoetestsrc element works but Filesink element fails )

Ashish Kumar Mishra ashish.kmishra at dexceldesigns.com
Wed Dec 9 20:58:46 PST 2015


Hi All , 

static GstPadProbeReturn eos_cb (GstPad * pad, GstPadProbeInfo *
info,gpointer user_data)
{
  gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info));
 
 gst_element_set_state (mux, GST_STATE_NULL);
  gst_element_set_state (filesink, GST_STATE_NULL);

  gst_bin_remove (GST_BIN (pipeline), filesink);
  gst_bin_remove (GST_BIN (pipeline), mux);

  gst_object_unref (filesink);
  gst_object_unref (mux);

  mux = gst_element_factory_make("avimux",NULL);
  
  filesink = gst_element_factory_make ("filesink", NULL);
  attempt = attempt+1;
  sprintf( buffer, "test_%d.avi" , attempt);
  g_object_set(G_OBJECT (filesink),"location", buffer, NULL);

  gst_bin_add_many (GST_BIN (pipeline),mux,filesink, NULL);

  if (!gst_element_link_many (mux,filesink, NULL)) {
	    g_print ("[APP]: Failed to link STATIC_2 Pad's of elements");
	    return -3;
  } 

  muxsinkpad = gst_element_get_request_pad (mux, "video_%u");

  if (!gst_element_link_many (q1, mux,NULL )) {
	    g_print ("[APP]: Failed to link DYNAMIC Pad's of elements");
	    return -3;
  }
  
  muxsrcpad   = gst_element_get_static_pad (mux,"src");
  filesinkpad = gst_element_get_static_pad (filesink,"sink");
  q1sinkpad   = gst_element_get_static_pad (filesink,"sink");
 
  gst_element_set_state (filesink , GST_STATE_PLAYING);
  gst_element_set_state (mux     , GST_STATE_PLAYING);

  newfile = NO_NEW_FILE;

  return GST_PAD_PROBE_DROP;

} 


static GstPadProbeReturn pad_probe_cb (GstPad * pad, GstPadProbeInfo * info,
gpointer user_data)
{
 
  gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info));
  gst_pad_add_probe  (muxsrcpad,GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, eos_cb,
user_data, NULL);  
  gst_pad_send_event (muxsinkpad, gst_event_new_eos ());

  // Wait til the EOS have been processed  
  while(newfile != NO_NEW_FILE) 
	sleep(1);
 
 return GST_PAD_PROBE_OK;

} // End brace of pad_probe_cb 


static gboolean timeout_cb (gpointer user_data)
{

  timer_count=timer_count+1;
  newfile = NEW_FILE;
gst_pad_add_probe (q1sinkpad,
GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,pad_probe_cb, user_data, NULL);
  
  if ( timer_count == 10 ){
 	return FALSE;
  }

  return TRUE;
} // End brace of "timeout_cb"


 
** (dynamic-filter:3227): CRITICAL **: gst_collect_pads_pop: assertion
'GST_IS_COLLECT_PADS (pads)' failed

(dynamic-filter:3227): GStreamer-CRITICAL **: gst_object_unref: assertion
'((GObject *) object)->ref_count > 0' failed


Could group member let me know cause of the problem 
or 
Share a code snip of changing MUX + FILESINK at run time . 

Thanks ,
Ashish 



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Dynamic-Pipeline-Vidoetestsrc-element-works-but-Filesink-element-fails-tp4674638p4674848.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list