Can't add bin in pipeline gst_bin_add: assertion 'GST_IS_ELEMENT (element)' failed.

Viatc viatc.msk at gmail.com
Fri Aug 31 10:49:00 UTC 2018


Hi!

 I have problem with my pipeline. This is recording from usb acmera sound
and video in mkv file.
My version of gstreamer in my raspberry :
apt-cache show gstreamer1.0-tools
Package: gstreamer1.0-tools
Source: gstreamer1.0
Version: 1.4.4-2+deb8u1
Architecture: armhf

 I try yo make realisation in C my pipeine:
 
 gst-launch-1.0 -e v4l2src \
  ! video/x-raw,format=YV12,width=640,height=480,framerate=5/1 \
  ! videoconvert ! queue ! videorate \
  ! clockoverlay halignment=left valignment=bottom time-format="%Y/%m/%d
%H:%M:%S" font-desc="Sans 24" \
  ! omxh264enc target-bitrate=400000 control-rate=variable \
  ! video/x-h264,stream-format=byte-stream,framerate=5/1 ! h264parse \
  ! queue ! mux. alsasrc device=plughw:1,0 do-timestamp=true \
  ! lamemp3enc target=0 bitrate=128 mono=true \
  ! queue leaky=2 max-size-buffers=0 max-size-time=0 max-size-bytes=0 \
  ! mux. matroskamux name=mux ! queue \
  ! filesink location=camera-start-`date -Iseconds`.mkv 
  
 I have my pipeline working. And i want to rotate recording file after each
n minutes.
For this purpose i make 2 pipelines and bins :
pipeline - binRec1
pipeline2 - binRec2


	gst_bin_add_many(GST_BIN(pipeline), src, capsfilter, videoconvert,
videorate, clockoverlay, avenc, capsfilteromx, parse,
					alsasrc, lamemp3enc, queueBinSound, NULL);
	gst_bin_add_many(GST_BIN(pipeline2), fakesrc, videoconvert2, videorate2,
clockoverlay2, avenc2, capsfilteromx2, parse2,
						alsasrc2, lamemp3enc2, queueBinSound2, NULL);

	gst_bin_add_many(GST_BIN(binRec1), queue_v, queue_a, matroskamux, queue2,
sink, NULL);
	gst_bin_add_many(GST_BIN(binRec2), queue_v2, queue_a2, matroskamux2,
queue2_2, sink2, NULL);
		
	if (!gst_element_link_many(src, capsfilter, videoconvert, videorate,
clockoverlay, avenc, capsfilteromx, parse, NULL)){
		g_error("Failed to link elements");
		return -2;
	}
	
	if (!gst_element_link_many(matroskamux, queue2, sink, NULL)){
		g_error("Failed to link elements");
		return -2;
	}
	
	if (!gst_element_link_many(fakesrc, videoconvert2, videorate2,
clockoverlay2, avenc2, capsfilteromx2, parse2, NULL)){
	g_error("Failed to link elements");
	return -2;
	}
	
	if (!gst_element_link_many(matroskamux2, queue2_2, sink2, NULL)){
		g_error("Failed to link elements");
		return -2;
	}
	 if (!gst_element_link_many(alsasrc, lamemp3enc, queueBinSound, NULL)){
		g_error("Failed to link elements");
		return -2;
	}
 	if (!gst_element_link_many(alsasrc2, lamemp3enc2, queueBinSound2, NULL)){
		g_error("Failed to link elements");
		return -2;
	} 


Working pipeline this is - pipeline. And pipeline2 is fake piepline.  In
moment of switch file i remove binRec1 and replace binRec2 in working
pipeline. 

 gst_element_set_state (pipeline2, GST_STATE_PLAYING);

 gst_element_set_state(binRec1, GST_STATE_NULL);
 
 gst_pad_unlink(parse_src_pad, sink_vpad_binRec1);
 gst_pad_unlink (queueBinSound_src_pad, sink_apad_binRec1);
 
 gst_pad_unlink(parse2_src_pad, sink_vpad_binRec2);
 gst_pad_unlink (queueBinSound2_src_pad, sink_apad_binRec2);
 
 gst_bin_remove(GST_BIN(pipeline), binRec1);
 gst_bin_remove(GST_BIN(pipeline2), binRec2);

 gst_bin_add(GST_BIN(pipeline), binRec2);
 gst_bin_add(GST_BIN(pipeline2), binRec1);

 gst_pad_link(parse_src_pad, sink_vpad_binRec2);
 gst_pad_link (queueBinSound_src_pad, sink_apad_binRec2);
 
 gst_pad_link(parse2_src_pad, sink_vpad_binRec1);
 gst_pad_link (queueBinSound2_src_pad, sink_apad_binRec1);
 
 gst_element_set_state (pipeline2, GST_STATE_NULL);
 gst_element_set_state(pipeline, GST_STATE_PLAYING);


 This is work fine i remove binRec2 and add (gst_bin_add(GST_BIN(pipeline),
binRec2) in pipeline.
 But when i try to remove and add in pipeline2 my bin binRec1 (
gst_bin_add(GST_BIN(pipeline2), binRec1)) ,
 i got error in one string with  GST_DEBUG="8" :  
 
 GStreamer-CRITICAL **: gst_bin_add: assertion 'GST_IS_ELEMENT (element)'
failed.
 
 Why i can't add binRec1 , but my binRec2 was added succeessfully?
 
 My full c file in the attachment.
 
Thanks in advance. gst-stream-req.c
<http://gstreamer-devel.966125.n4.nabble.com/file/t378518/gst-stream-req.c>  



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list