<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hello,</p>
<p><br>
</p>
<p>I have a static pipeline for capturing video via a v4l2src plugin and rendering this to an overlaysink. I have tee'ed this pipeline in order to take snapshot png's of the live video input being rendered as show below.
<br>
<br>
v4l2src -> tee --> imxvideoconvert_g2d -> queue -> overlaysink<br>
|<br>
--> queue -> valve -> videoconvert -> pngenc -> multifilesink<br>
<br>
I can construct and teardown the pipeline and reconstruct the pipeline fine if I do not take pictures.<br>
<br>
</p>
<p>To take pictures, the valve is initially placed in drop mode ("drop==TRUE"). When a picture is desired, the valve is placed in passthrough mode ("drop==FALSE") to allow a frame to propogate to the pngenc sink at which point a padprobe callback is called
to again turn off the upstream valve ("drop==TRUE"). I can take unlimited pictures successfully in this manor on the pipeline using this design, but when I teardown the pipeline after taking at least one picture, I am left with a residual reference to the
v4l2src element and cannot rebuild the pipeline because of this.<br>
</p>
<br>
Any ideas on what the object reference problem can be when the valve is used in this manor?<br>
<br>
<p>The include debug spew logs one pipeline construction/destruction with no image capture, immediately followed by a construction/destruction which takes one image. The error can be seen in the second pipeline destruction which has a v4l2src element with 2
references instead of 1 ("capture_src: 2"). Moduel source is include below the debug spew.</p>
<p><br>
</p>
<p><br>
</p>
<p>*************** debug spew ***************</p>
<p><br>
</p>
<p>main entry<br>
<br>
state: NONE<br>
<br>
************************* usage *************************<br>
* k: live exam video *<br>
* h: return to home: *<br>
* q: exit executable *<br>
* s: save image *<br>
* g: save current pipeline graph *<br>
************************* usage *************************<br>
<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
destroyPipeline entry<br>
pipeline does not exist<br>
destroyPipeline exit<br>
initPipeline entry<br>
init PIPELINE_LIVE<br>
initCapture entry<br>
0:00:17.874405003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.874652669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<capture_src> set parent (ref and sink)<br>
initCapture exit<br>
initDisplay entry<br>
0:00:17.878431336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.878633336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
display(/dev/fb2) resolution is (1920x1080).<br>
0:00:17.887805336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
====== OVERLAYSINK: 4.0.3 build on Nov 6 2015 14:19:51. ======<br>
0:00:17.898062003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.898250003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.898466336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_convert> set parent (ref and sink)<br>
0:00:17.898591336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_queue> set parent (ref and sink)<br>
0:00:17.898689003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_sink> set parent (ref and sink)<br>
initDisplay exit<br>
initImg entry<br>
0:00:17.912533336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.912699336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.913053669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.913202003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.915506003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.915615669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.919927003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.920039003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.925385336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
attach_img_encode_sink_probe entry<br>
attach_img_encode_sink_probe exit<br>
0:00:17.925730669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_queue> set parent (ref and sink)<br>
0:00:17.925821003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_valve> set parent (ref and sink)<br>
0:00:17.925894336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_converter> set parent (ref and sink)<br>
0:00:17.925966003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_pngEnc> set parent (ref and sink)<br>
0:00:17.926036669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_sink> set parent (ref and sink)<br>
initImg exit<br>
0:00:17.934316669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
state: NONE<br>
0:00:17.934498003 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<tee> set parent (ref and sink)<br>
0:00:17.934821336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:17.934922336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:17.935021669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<capsfilter0> set parent (ref and sink)<br>
linkTee entry<br>
linkTeeDynamic entry<br>
0:00:17.935744669 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src_0> set parent (ref and sink)<br>
Obtained request pad src_0 from tee.<br>
Obtained pad sink for branch video_convert.<br>
linkTeeDynamic exit<br>
linkTee exit<br>
linkTee entry<br>
linkTeeDynamic entry<br>
0:00:17.937632336 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src_1> set parent (ref and sink)<br>
Obtained request pad src_1 from tee.<br>
Obtained pad sink for branch img_queue.<br>
linkTeeDynamic exit<br>
linkTee exit<br>
initPipeline exit<br>
startPipeline entry<br>
PIPELINE_FLATTENED_LIVE <br>
state: LIVE<br>
display(/dev/fb2) resolution is (1920x1080).<br>
display(/dev/fb0) resolution is (1920x1080).<br>
display(/dev/fb2) resolution is (1920x1080).<br>
0:00:18.367811336 WARN v4l2 /gst-plugins-good-1.4.1/sys/v4l2/gstv4l2bufferpool.c:658:gst_v4l2_buffer_pool_start:<capture_src:pool:src> using 4 buffers instead of 2<br>
0:00:19.442526003 WARN default /gst-plugins-base-1.4.1/gst-libs/gst/video/gstvideopool.c:189:video_buffer_pool_set_config:<videobufferpool1> no caps in config<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
navigate home<br>
destroyPipeline entry<br>
capture_src != NULL<br>
capture_src::device-fd:9<br>
capture_src: 7<br>
tee ref_count: 4<br>
video_queue ref_count: 6<br>
video_convert ref_count: 5<br>
video_sink ref_count: 8<br>
img_queue ref_count: 6<br>
img_valve ref_count: 4<br>
img_converter ref_count: 4<br>
img_pngEnc ref_count: 4<br>
img_sink ref_count: 4<br>
remove_img_encode_sink_probe entry<br>
<br>
0:00:23.097931003 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<img_converter:sink> dispose<br>
<br>
remove_img_encode_sink_probe exit<br>
Total showed frames (54), display master blited (54), playing for (0:00:04.775867667), fps (11.307).<br>
Total showed frames (54), display slave blited (54), playing for (0:00:04.775867667), fps (11.307).<br>
state: NONE<br>
data->pipeline ref_count: 1<br>
capture_src: 1<br>
tee ref_count: 1<br>
video_queue ref_count: 1<br>
video_convert ref_count: 1<br>
video_sink ref_count: 1<br>
img_queue ref_count: 1<br>
img_valve ref_count: 1<br>
img_converter ref_count: 1<br>
img_pngEnc ref_count: 1<br>
img_sink ref_count: 1<br>
capture_src != NULL<br>
capture_src::device-fd:-1<br>
destroyPipeline exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
0:00:23.194379670 DEBUG GST_REFCOUNTING gstpipeline.c:227:gst_pipeline_dispose:<pipeline> dispose<br>
0:00:23.194505670 DEBUG GST_REFCOUNTING gstbin.c:516:gst_bin_dispose:<pipeline> dispose<br>
0:00:23.194917337 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<capsfilter0> dispose<br>
0:00:23.195065337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.195215337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.195355670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<capsfilter0> parent class dispose<br>
0:00:23.195465337 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<capsfilter0> finalize<br>
0:00:23.195552003 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<capsfilter0> finalize parent<br>
0:00:23.195932003 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src_0> dispose<br>
0:00:23.196092003 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src_1> dispose<br>
0:00:23.196222337 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<tee> dispose<br>
0:00:23.196336003 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.196464670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<tee> parent class dispose<br>
0:00:23.196568003 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<tee> finalize<br>
0:00:23.196652337 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<tee> finalize parent<br>
0:00:23.196930670 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_sink> dispose<br>
0:00:23.197039337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.197157670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_sink> parent class dispose<br>
0:00:23.197262337 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_sink> finalize<br>
0:00:23.197348337 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_sink> finalize parent<br>
0:00:23.197625337 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_pngEnc> dispose<br>
0:00:23.197735670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.197864670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.197978003 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_pngEnc> parent class dispose<br>
0:00:23.198080670 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_pngEnc> finalize<br>
0:00:23.198164670 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_pngEnc> finalize parent<br>
0:00:23.198347337 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_converter> dispose<br>
0:00:23.198454337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.198587337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.198704670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_converter> parent class dispose<br>
0:00:23.198803670 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_converter> finalize<br>
0:00:23.198890670 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_converter> finalize parent<br>
0:00:23.199169003 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_valve> dispose<br>
0:00:23.199279670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.199420337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.199545670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_valve> parent class dispose<br>
0:00:23.199641337 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_valve> finalize<br>
0:00:23.199725337 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_valve> finalize parent<br>
0:00:23.199890337 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_queue> dispose<br>
0:00:23.200001337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.200145670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.200273003 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_queue> parent class dispose<br>
0:00:23.200383670 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_queue> finalize<br>
0:00:23.200469337 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_queue> finalize parent<br>
0:00:23.200741670 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_sink> dispose<br>
0:00:23.200852337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.200988337 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_sink> parent class dispose<br>
0:00:23.201091670 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_sink> finalize<br>
0:00:23.201178003 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_sink> finalize parent<br>
0:00:23.201485003 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_queue> dispose<br>
0:00:23.201596003 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.201736337 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.201868670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_queue> parent class dispose<br>
0:00:23.201979003 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_queue> finalize<br>
0:00:23.202240337 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_queue> finalize parent<br>
0:00:23.202420003 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_convert> dispose<br>
0:00:23.202529670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:23.202657670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.202772337 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_convert> parent class dispose<br>
0:00:23.203366003 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_convert> finalize<br>
0:00:23.203470003 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_convert> finalize parent<br>
0:00:23.203664670 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<capture_src> dispose<br>
0:00:23.203777670 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:23.203897670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<capture_src> parent class dispose<br>
0:00:23.204007670 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<capture_src> finalize<br>
0:00:23.204098670 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<capture_src> finalize parent<br>
0:00:23.204211670 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<pipeline> dispose<br>
0:00:23.204305670 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<pipeline> parent class dispose<br>
0:00:23.204401670 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<pipeline> finalize<br>
0:00:23.204486003 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<pipeline> finalize parent<br>
state: NONE<br>
startPipeline exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
destroyPipeline entry<br>
pipeline does not exist<br>
destroyPipeline exit<br>
initPipeline entry<br>
init PIPELINE_LIVE<br>
initCapture entry<br>
0:00:26.425296337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.425576670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<capture_src> set parent (ref and sink)<br>
initCapture exit<br>
initDisplay entry<br>
0:00:26.426165004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.426510670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.426853337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
====== OVERLAYSINK: 4.0.3 build on Nov 6 2015 14:19:51. ======<br>
0:00:26.427302337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.427548004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.427823670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_convert> set parent (ref and sink)<br>
0:00:26.428006004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_queue> set parent (ref and sink)<br>
0:00:26.428178337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_sink> set parent (ref and sink)<br>
initDisplay exit<br>
initImg entry<br>
0:00:26.447411004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.447564670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.447753337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.447899004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.448032337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.448127337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.448259670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.448385337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.448519670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
attach_img_encode_sink_probe entry<br>
attach_img_encode_sink_probe exit<br>
0:00:26.448747670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_queue> set parent (ref and sink)<br>
0:00:26.448825004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_valve> set parent (ref and sink)<br>
0:00:26.448896337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_converter> set parent (ref and sink)<br>
0:00:26.448965004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_pngEnc> set parent (ref and sink)<br>
0:00:26.449033004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_sink> set parent (ref and sink)<br>
initImg exit<br>
0:00:26.457175670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
state: NONE<br>
0:00:26.457319337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<tee> set parent (ref and sink)<br>
0:00:26.457462670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:26.457560004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:26.457644670 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<capsfilter1> set parent (ref and sink)<br>
linkTee entry<br>
linkTeeDynamic entry<br>
0:00:26.458222337 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src_0> set parent (ref and sink)<br>
Obtained request pad src_0 from tee.<br>
Obtained pad sink for branch video_convert.<br>
linkTeeDynamic exit<br>
linkTee exit<br>
linkTee entry<br>
linkTeeDynamic entry<br>
0:00:26.460143004 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src_1> set parent (ref and sink)<br>
Obtained request pad src_1 from tee.<br>
Obtained pad sink for branch img_queue.<br>
linkTeeDynamic exit<br>
linkTee exit<br>
initPipeline exit<br>
startPipeline entry<br>
PIPELINE_FLATTENED_LIVE <br>
state: LIVE<br>
display(/dev/fb2) resolution is (1920x1080).<br>
display(/dev/fb0) resolution is (1920x1080).<br>
display(/dev/fb2) resolution is (1920x1080).<br>
0:00:26.898655004 WARN v4l2 /gst-plugins-good-1.4.1/sys/v4l2/gstv4l2bufferpool.c:658:gst_v4l2_buffer_pool_start:<capture_src:pool:src> using 4 buffers instead of 2<br>
0:00:27.974872004 WARN default /gst-plugins-base-1.4.1/gst-libs/gst/video/gstvideopool.c:189:video_buffer_pool_set_config:<videobufferpool3> no caps in config<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
save image<br>
Save image to 20151127T231604.png<br>
captureImage entry<br>
captureImage exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
image_cb entry<br>
image_cb exit<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
navigate home<br>
destroyPipeline entry<br>
capture_src != NULL<br>
capture_src::device-fd:11<br>
capture_src: 7<br>
tee ref_count: 4<br>
video_queue ref_count: 6<br>
video_convert ref_count: 5<br>
video_sink ref_count: 7<br>
img_queue ref_count: 6<br>
img_valve ref_count: 4<br>
img_converter ref_count: 4<br>
img_pngEnc ref_count: 4<br>
img_sink ref_count: 4<br>
remove_img_encode_sink_probe entry<br>
<br>
0:00:32.056686671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<img_converter:sink> dispose<br>
<br>
remove_img_encode_sink_probe exit<br>
Total showed frames (51), display master blited (51), playing for (0:00:05.210536001), fps (9.788).<br>
Total showed frames (51), display slave blited (51), playing for (0:00:05.210536001), fps (9.788).<br>
state: NONE<br>
data->pipeline ref_count: 1<br>
capture_src: 2<br>
tee ref_count: 1<br>
video_queue ref_count: 1<br>
video_convert ref_count: 1<br>
video_sink ref_count: 1<br>
img_queue ref_count: 1<br>
img_valve ref_count: 1<br>
img_converter ref_count: 1<br>
img_pngEnc ref_count: 1<br>
img_sink ref_count: 1<br>
capture_src != NULL<br>
capture_src::device-fd:-1<br>
destroyPipeline exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
0:00:32.155537338 DEBUG GST_REFCOUNTING gstpipeline.c:227:gst_pipeline_dispose:<pipeline> dispose<br>
0:00:32.155659671 DEBUG GST_REFCOUNTING gstbin.c:516:gst_bin_dispose:<pipeline> dispose<br>
0:00:32.156073004 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<capsfilter1> dispose<br>
0:00:32.156205671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.156350671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.156470004 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<capsfilter1> parent class dispose<br>
0:00:32.156578671 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<capsfilter1> finalize<br>
0:00:32.156665338 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<capsfilter1> finalize parent<br>
0:00:32.157041338 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src_0> dispose<br>
0:00:32.157200338 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src_1> dispose<br>
0:00:32.157330338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<tee> dispose<br>
0:00:32.157443004 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.157571671 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<tee> parent class dispose<br>
0:00:32.157673671 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<tee> finalize<br>
0:00:32.157757338 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<tee> finalize parent<br>
0:00:32.158036338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_sink> dispose<br>
0:00:32.158146338 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.158264004 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_sink> parent class dispose<br>
0:00:32.158371671 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_sink> finalize<br>
0:00:32.158455338 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_sink> finalize parent<br>
0:00:32.158733338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_pngEnc> dispose<br>
0:00:32.158843671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.158968338 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.159082004 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_pngEnc> parent class dispose<br>
0:00:32.159203004 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_pngEnc> finalize<br>
0:00:32.159287671 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_pngEnc> finalize parent<br>
0:00:32.159468338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_converter> dispose<br>
0:00:32.159574004 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.159701004 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.159817004 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_converter> parent class dispose<br>
0:00:32.159921338 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_converter> finalize<br>
0:00:32.160003671 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_converter> finalize parent<br>
0:00:32.160281004 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_valve> dispose<br>
0:00:32.160392338 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.160533671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.160658671 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_valve> parent class dispose<br>
0:00:32.160753004 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_valve> finalize<br>
0:00:32.160835671 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_valve> finalize parent<br>
0:00:32.160994004 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_queue> dispose<br>
0:00:32.161101671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.161246671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.161373671 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_queue> parent class dispose<br>
0:00:32.161486671 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_queue> finalize<br>
0:00:32.161573338 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_queue> finalize parent<br>
0:00:32.161851338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_sink> dispose<br>
0:00:32.161964004 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.162225004 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_sink> parent class dispose<br>
0:00:32.162338671 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_sink> finalize<br>
0:00:32.162427004 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_sink> finalize parent<br>
0:00:32.162707338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_queue> dispose<br>
0:00:32.162827671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.162970338 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.163104338 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_queue> parent class dispose<br>
0:00:32.163214671 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_queue> finalize<br>
0:00:32.163300338 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_queue> finalize parent<br>
0:00:32.163464338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_convert> dispose<br>
0:00:32.163568671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:32.163694671 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:32.163808338 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_convert> parent class dispose<br>
0:00:32.164401338 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_convert> finalize<br>
0:00:32.164504671 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_convert> finalize parent<br>
0:00:32.164702338 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<pipeline> dispose<br>
0:00:32.164799338 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<pipeline> parent class dispose<br>
0:00:32.164894004 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<pipeline> finalize<br>
0:00:32.164979004 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<pipeline> finalize parent<br>
state: NONE<br>
startPipeline exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
destroyPipeline entry<br>
pipeline does not exist<br>
destroyPipeline exit<br>
initPipeline entry<br>
init PIPELINE_LIVE<br>
initCapture entry<br>
0:00:35.049455671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.049915005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<capture_src> set parent (ref and sink)<br>
initCapture exit<br>
initDisplay entry<br>
0:00:35.050860338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.051347005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.051823338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
====== OVERLAYSINK: 4.0.3 build on Nov 6 2015 14:19:51. ======<br>
0:00:35.052605671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.052988671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.053397005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_convert> set parent (ref and sink)<br>
0:00:35.053709338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_queue> set parent (ref and sink)<br>
0:00:35.054010338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<video_sink> set parent (ref and sink)<br>
initDisplay exit<br>
initImg entry<br>
0:00:35.069983338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.070205338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.070443005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.070618671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.070747671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.070845005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.070976005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.071070005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.071205005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
attach_img_encode_sink_probe entry<br>
attach_img_encode_sink_probe exit<br>
0:00:35.071433005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_queue> set parent (ref and sink)<br>
0:00:35.071510338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_valve> set parent (ref and sink)<br>
0:00:35.071581671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_converter> set parent (ref and sink)<br>
0:00:35.071651338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_pngEnc> set parent (ref and sink)<br>
0:00:35.071720338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<img_sink> set parent (ref and sink)<br>
initImg exit<br>
0:00:35.079779671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
state: NONE<br>
0:00:35.079923671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<tee> set parent (ref and sink)<br>
0:00:35.080066671 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':sink> set parent (ref and sink)<br>
0:00:35.080165338 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src> set parent (ref and sink)<br>
0:00:35.080248005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<capsfilter2> set parent (ref and sink)<br>
linkTee entry<br>
linkTeeDynamic entry<br>
0:00:35.080862005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src_0> set parent (ref and sink)<br>
Obtained request pad src_0 from tee.<br>
Obtained pad sink for branch video_convert.<br>
linkTeeDynamic exit<br>
linkTee exit<br>
linkTee entry<br>
linkTeeDynamic entry<br>
0:00:35.082806005 DEBUG GST_REFCOUNTING gstobject.c:692:gst_object_set_parent:<'':src_1> set parent (ref and sink)<br>
Obtained request pad src_1 from tee.<br>
Obtained pad sink for branch img_queue.<br>
linkTeeDynamic exit<br>
linkTee exit<br>
initPipeline exit<br>
startPipeline entry<br>
PIPELINE_FLATTENED_LIVE <br>
state: LIVE<br>
display(/dev/fb2) resolution is (1920x1080).<br>
display(/dev/fb0) resolution is (1920x1080).<br>
display(/dev/fb2) resolution is (1920x1080).<br>
0:00:35.471775671 v4l2allocator /gst-plugins-good-1.4.1/sys/v4l2/gstv4l2allocator.c:650:gst_v4l2_allocator_new:<capture_src:pool:src:allocator> No memory model supported by GStreamer for this device<br>
0:00:35.471860671 v4l2 /gst-plugins-good-1.4.1/sys/v4l2/gstv4l2bufferpool.c:1452:gst_v4l2_buffer_pool_new:<capture_src:pool:src> Failed to create V4L2 allocator<br>
0:00:35.471948005 v4l2 /gst-plugins-good-1.4.1/sys/v4l2/gstv4l2object.c:2294:gst_v4l2_object_setup_pool:<capture_src> error: Could not map buffers from device '/dev/video0'<br>
0:00:35.471985338 v4l2 /gst-plugins-good-1.4.1/sys/v4l2/gstv4l2object.c:2294:gst_v4l2_object_setup_pool:<capture_src> error: Failed to create buffer pool: Device or resource busy<br>
0:00:35.472223338 basesrc /gstreamer-1.4.1/libs/gst/base/gstbasesrc.c:2933:gst_base_src_loop:<capture_src> error: Internal data flow error.<br>
0:00:35.472277005 basesrc /gstreamer-1.4.1/libs/gst/base/gstbasesrc.c:2933:gst_base_src_loop:<capture_src> error: streaming task paused, reason not-negotiated (-4)<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
navigate home<br>
destroyPipeline entry<br>
capture_src != NULL<br>
capture_src::device-fd:15<br>
capture_src: 8<br>
tee ref_count: 4<br>
video_queue ref_count: 6<br>
video_convert ref_count: 4<br>
video_sink ref_count: 5<br>
img_queue ref_count: 6<br>
img_valve ref_count: 4<br>
img_converter ref_count: 4<br>
img_pngEnc ref_count: 4<br>
img_sink ref_count: 4<br>
remove_img_encode_sink_probe entry<br>
<br>
0:00:39.970354005 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<img_converter:sink> dispose<br>
<br>
remove_img_encode_sink_probe exit<br>
state: NONE<br>
data->pipeline ref_count: 1<br>
capture_src: 1<br>
tee ref_count: 1<br>
video_queue ref_count: 1<br>
video_convert ref_count: 1<br>
video_sink ref_count: 1<br>
img_queue ref_count: 1<br>
img_valve ref_count: 1<br>
img_converter ref_count: 1<br>
img_pngEnc ref_count: 1<br>
img_sink ref_count: 1<br>
capture_src != NULL<br>
capture_src::device-fd:-1<br>
destroyPipeline exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
0:00:40.085397339 DEBUG GST_REFCOUNTING gstpipeline.c:227:gst_pipeline_dispose:<pipeline> dispose<br>
0:00:40.085518672 DEBUG GST_REFCOUNTING gstbin.c:516:gst_bin_dispose:<pipeline> dispose<br>
0:00:40.085929339 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<capsfilter2> dispose<br>
0:00:40.086062005 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.086208339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.086336672 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<capsfilter2> parent class dispose<br>
0:00:40.086441005 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<capsfilter2> finalize<br>
0:00:40.086536672 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<capsfilter2> finalize parent<br>
0:00:40.086908672 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src_0> dispose<br>
0:00:40.087078339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src_1> dispose<br>
0:00:40.087211672 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<tee> dispose<br>
0:00:40.087324339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.087464005 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<tee> parent class dispose<br>
0:00:40.087579672 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<tee> finalize<br>
0:00:40.087663339 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<tee> finalize parent<br>
0:00:40.087939339 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_sink> dispose<br>
0:00:40.088050005 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.088166005 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_sink> parent class dispose<br>
0:00:40.088272672 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_sink> finalize<br>
0:00:40.088358672 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_sink> finalize parent<br>
0:00:40.088637672 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_pngEnc> dispose<br>
0:00:40.088748005 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.088875339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.088988005 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_pngEnc> parent class dispose<br>
0:00:40.089091005 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_pngEnc> finalize<br>
0:00:40.089176005 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_pngEnc> finalize parent<br>
0:00:40.089343339 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_converter> dispose<br>
0:00:40.089462005 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.089591339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.089711672 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_converter> parent class dispose<br>
0:00:40.089810339 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_converter> finalize<br>
0:00:40.089894672 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_converter> finalize parent<br>
0:00:40.090170005 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_valve> dispose<br>
0:00:40.090283339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.090425339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.090551339 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_valve> parent class dispose<br>
0:00:40.090647672 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_valve> finalize<br>
0:00:40.090733339 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_valve> finalize parent<br>
0:00:40.090896672 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<img_queue> dispose<br>
0:00:40.091003339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.091148339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.091280672 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<img_queue> parent class dispose<br>
0:00:40.091391005 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<img_queue> finalize<br>
0:00:40.091476339 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<img_queue> finalize parent<br>
0:00:40.091749672 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_sink> dispose<br>
0:00:40.091860005 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.091978672 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_sink> parent class dispose<br>
0:00:40.092206339 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_sink> finalize<br>
0:00:40.092299339 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_sink> finalize parent<br>
0:00:40.092583339 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_queue> dispose<br>
0:00:40.092697339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.092839672 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.092971005 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_queue> parent class dispose<br>
0:00:40.093083339 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_queue> finalize<br>
0:00:40.093171005 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_queue> finalize parent<br>
0:00:40.093336005 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<video_convert> dispose<br>
0:00:40.093441672 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':sink> dispose<br>
0:00:40.093573339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.093687672 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<video_convert> parent class dispose<br>
0:00:40.093792005 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<video_convert> finalize<br>
0:00:40.093878005 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<video_convert> finalize parent<br>
0:00:40.094060005 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<capture_src> dispose<br>
0:00:40.094167339 DEBUG GST_REFCOUNTING gstpad.c:662:gst_pad_dispose:<'':src> dispose<br>
0:00:40.094282339 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<capture_src> parent class dispose<br>
0:00:40.094393339 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<capture_src> finalize<br>
0:00:40.094480005 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<capture_src> finalize parent<br>
0:00:40.094579672 INFO GST_REFCOUNTING gstelement.c:2873:gst_element_dispose:<pipeline> dispose<br>
0:00:40.094669339 INFO GST_REFCOUNTING gstelement.c:2917:gst_element_dispose:<pipeline> parent class dispose<br>
0:00:40.094764005 INFO GST_REFCOUNTING gstelement.c:2948:gst_element_finalize:<pipeline> finalize<br>
0:00:40.094846339 INFO GST_REFCOUNTING gstelement.c:2953:gst_element_finalize:<pipeline> finalize parent<br>
state: NONE<br>
startPipeline exit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
keyboard_gsource_func entry<br>
handle_keyboard entry<br>
quit<br>
handle_keyboard exit<br>
keyboard_gsource_func exit<br>
g_client_loop exit<br>
main exit<br>
</p>
<p><br>
</p>
<p>*************** module source code ***************</p>
<p><br>
</p>
<p>#include <stdint.h><br>
#include <stdio.h><br>
#include <stdlib.h> <br>
#include <string.h><br>
#include <time.h><br>
#include <unistd.h><br>
#include <gst/gst.h><br>
<br>
#define IMX6<br>
<br>
/* capture dims */<br>
#define CAPTURE_W 512<br>
#define CAPTURE_H 512<br>
/* main display screen dims */<br>
#define SCREEN_W 1920<br>
#define SCREEN_H 1080<br>
/* main display video dims */<br>
#define VIDEO_W 1000<br>
#define VIDEO_H 1000<br>
<br>
typedef enum {<br>
LIVE,<br>
LIVE_PAUSE,<br>
NONE,<br>
NUM_STATES = NONE,<br>
} PipelineState_t;<br>
<br>
typedef enum {<br>
PIPELINE_FLATTENED_LIVE,<br>
NUM_PIPELINE_TYPES<br>
} PipelineType_t;<br>
<br>
typedef struct {<br>
/* gst stuctures */<br>
GstElement *pipeline;<br>
<br>
/* Flattened evaluation */<br>
GstElement *capture_src;<br>
GstElement *video_convert;<br>
GstElement *video_queue;<br>
GstElement *video_sink;<br>
GstElement *img_queue;<br>
GstElement *img_valve;<br>
GstElement *img_converter;<br>
GstElement *img_pngEnc;<br>
GstElement *img_sink;<br>
<br>
/* image encoder sink probe */<br>
gulong img_encode_sink_probe_id;<br>
GstPad *img_encode_block_pad;<br>
<br>
GstElement *aux_bin;<br>
GstElement *encode_bin;<br>
GstElement *encode_filesink;<br>
GstElement *img_filesink;<br>
GstElement *decode_bin;<br>
GstElement *flushPipline;<br>
<br>
GstElement *tee;<br>
GstElement *valve;<br>
GstCaps *caps;<br>
GstPad *encode_src;<br>
GstPad *decode_sink;<br>
<br>
// main loop<br>
GMainLoop *main_loop;<br>
<br>
/* current pipeline type */<br>
PipelineType_t pipeline_type;<br>
PipelineState_t state;<br>
<br>
/* pad probe locks */<br>
gint in_image_capture_probe;<br>
gint in_encode_stop_probe;<br>
<br>
} GstData_t;<br>
<br>
// debug macro controls<br>
#ifndef DEBUG<br>
#define DEBUG<br>
#endif<br>
<br>
// enable function stack trace<br>
#define TRACE<br>
#ifdef TRACE<br>
#define TRACE_ENTRY() g_print("%s entry\n", __FUNCTION__)<br>
#define TRACE_EXIT() g_print("%s exit\n", __FUNCTION__)<br>
#else<br>
#define TRACE_ENTRY()<br>
#define TRACE_EXIT()<br>
#endif<br>
<br>
#define ENABLE_MESSAGE_CB_PRINT<br>
#ifdef ENABLE_MESSAGE_CB_PRINT<br>
#define MESSAGE_CB_PRINT(...) g_print(__VA_ARGS__)<br>
#else<br>
#define MESSAGE_CB_PRINT(...)<br>
#endif<br>
<br>
static const char* s_stateDescription[] = {<br>
"LIVE",<br>
"LIVE_PAUSE",<br>
"NONE" };<br>
<br>
static char filename[65];<br>
GMainLoop *g_client_loop;<br>
GIOChannel *g_io_stdin;<br>
GSource* g_keyboardWatchPipe = NULL;<br>
static guint g_keyboardWatchPipe_id;<br>
GSource* g_keyboardWatch = NULL;<br>
static guint g_keyboardWatch_id;<br>
<br>
gboolean keyboard_gsource_func (GIOChannel *source, GIOCondition condition, GstData_t *data);<br>
static int setState (GstData_t *data, PipelineState_t state);<br>
static inline PipelineState_t getState (GstData_t *data);<br>
static gboolean message_cb (GstBus * bus, GstMessage * message, gpointer data);<br>
static gint initCapture (GstData_t *data);<br>
static gint initDisplay (GstData_t *data);<br>
static gint initImg (GstData_t *data);<br>
static GstPadProbeReturn image_cb (GstPad *pad, GstPadProbeInfo *info, gpointer userdata);<br>
static GstPad* linkTeeDynamic (GstElement *tee, GstElement *sink);<br>
static int linkTee (GstElement *tee, GstElement *sink);<br>
<br>
<br>
/* image encode sink probe callback */<br>
static GstPadProbeReturn image_cb (GstPad *pad, GstPadProbeInfo *info, gpointer userdata) {<br>
GstData_t *data = (GstData_t *) userdata;<br>
TRACE_ENTRY();<br>
<br>
if (!g_atomic_int_compare_and_exchange (&data->in_image_capture_probe, FALSE, TRUE)) {<br>
TRACE_EXIT();<br>
return GST_PAD_PROBE_OK;<br>
}<br>
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(data->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, __FUNCTION__);<br>
<br>
/* drop frames on the upstream valve element */<br>
g_object_set(data->img_valve, "drop", TRUE, NULL);<br>
<br>
TRACE_EXIT();<br>
return GST_PAD_PROBE_PASS;<br>
}<br>
<br>
<br>
/* attach png image encode probe control */<br>
void attach_img_encode_sink_probe (GstData_t *data) {<br>
TRACE_ENTRY();<br>
<br>
/* add pad probe */<br>
data->img_encode_block_pad = gst_element_get_static_pad(data->img_converter, "sink");<br>
data->img_encode_sink_probe_id = gst_pad_add_probe(data->img_encode_block_pad, GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BLOCK, image_cb, data, NULL);<br>
<br>
TRACE_EXIT();<br>
}<br>
<br>
<br>
/* remove png image encode probe control */<br>
void remove_img_encode_sink_probe (GstData_t *data) {<br>
TRACE_ENTRY();<br>
<br>
gst_pad_remove_probe(data->img_encode_block_pad, data->img_encode_sink_probe_id);<br>
data->img_encode_sink_probe_id = 0;<br>
gst_object_unref(data->img_encode_block_pad);<br>
<br>
TRACE_EXIT();<br>
}<br>
<br>
<br>
/* initialize a pipeline which captures/renders v4l2 input and captures/encodes single<br>
png images off the v4l2 streame using a valve/pngenc compination */<br>
int initPipeline (GstData_t * data, PipelineType_t pipeline_type, char *clip_filename) {<br>
TRACE_ENTRY();<br>
<br>
if (pipeline_type == PIPELINE_FLATTENED_LIVE) {<br>
<br>
if (getState(data) != NONE) {<br>
g_printerr("initPipeline() called when pipeline already exists\n");<br>
TRACE_EXIT();<br>
return -1;<br>
}<br>
memset(data, 0, sizeof(GstData_t));<br>
data->pipeline_type = PIPELINE_FLATTENED_LIVE;<br>
<br>
// create specific context<br>
if (data->main_loop) {<br>
g_printerr("data->main_loop should be NULL");<br>
}<br>
GMainContext* context = g_main_context_new();<br>
data->main_loop = g_main_loop_new(context, FALSE);<br>
// attach console command line control in leu of API calls<br>
g_keyboardWatchPipe = g_io_create_watch(g_io_stdin, G_IO_IN);<br>
g_source_set_callback(g_keyboardWatchPipe, (GSourceFunc)keyboard_gsource_func, (gpointer)data, NULL);<br>
g_keyboardWatchPipe_id = g_source_attach(g_keyboardWatchPipe, context);<br>
<br>
g_main_context_unref(context);<br>
<br>
g_print("init PIPELINE_LIVE\n");<br>
<br>
/* Create the empty pipeline */<br>
data->pipeline = gst_pipeline_new("pipeline");<br>
<br>
/* Create the elements */<br>
initCapture(data);<br>
initDisplay(data);<br>
initImg(data);<br>
<br>
data->tee = gst_element_factory_make("tee", "tee");<br>
<br>
setState(data, NONE);<br>
<br>
/* set the capture and decide capabilities */<br>
data->caps = gst_caps_new_simple("video/x-raw",<br>
"format",G_TYPE_STRING, "BGRx",<br>
"width", G_TYPE_INT, CAPTURE_W,<br>
"height", G_TYPE_INT, CAPTURE_H,<br>
"framerate", GST_TYPE_FRACTION, 30, 1,<br>
NULL);<br>
<br>
if (!data->pipeline || !data->tee || !data->caps) {<br>
g_printerr ("Not all elements could be created.\n");<br>
gst_caps_unref(data->caps);<br>
TRACE_EXIT();<br>
return -1;<br>
}<br>
<br>
/* check the links */<br>
<br>
/* add tee to the pipeline */<br>
gst_bin_add_many(GST_BIN(data->pipeline), data->tee, NULL);<br>
<br>
/* Link capture to tee */<br>
if (GST_PAD_LINK_FAILED(gst_element_link_filtered(data->capture_src, data->tee, data->caps))){<br>
g_printerr("Capture could not link tee and capture_src\n");<br>
TRACE_EXIT();<br>
return -1;<br>
}<br>
<br>
/* link the tee to downstream video render and image multifilesink */<br>
if (!linkTee(data->tee, data->video_convert) || !linkTee(data->tee, data->img_queue)) {<br>
g_printerr("Tee could not be linked.\n");<br>
TRACE_EXIT();<br>
return -1;<br>
}<br>
<br>
/* add bus watch */<br>
GstBus *bus;<br>
bus = gst_pipeline_get_bus(GST_PIPELINE(data->pipeline));<br>
if (gst_bus_add_watch(bus, message_cb, (GstData_t*)data) == 0) {<br>
g_print("gst_bus_add_watch() failure: pipe already has bus\n");<br>
}<br>
<br>
gst_caps_unref(data->caps);<br>
gst_object_unref(bus);<br>
<br>
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(data->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "initPipeline-LIVE");<br>
<br>
} else {<br>
g_printerr ("Invalid pipeline type\n");<br>
TRACE_EXIT();<br>
return -1;<br>
}<br>
<br>
TRACE_EXIT();<br>
return 1;<br>
}<br>
<br>
<br>
/* initialize png imaging pipeline elements */<br>
static gint initImg (GstData_t *data) {<br>
GstPad *image_queue_src_pad;<br>
gint retVal = -1;<br>
TRACE_ENTRY();<br>
<br>
data->img_queue = gst_element_factory_make("queue", "img_queue");<br>
data->img_valve = gst_element_factory_make("valve", "img_valve");<br>
data->img_converter = gst_element_factory_make("videoconvert", "img_converter");<br>
data->img_pngEnc = gst_element_factory_make("pngenc", "img_pngEnc");<br>
data->img_sink = gst_element_factory_make("multifilesink", "img_sink");<br>
<br>
image_queue_src_pad = gst_element_get_static_pad(data->img_queue, "src");<br>
gst_pad_use_fixed_caps(image_queue_src_pad);<br>
<br>
if (data->img_queue && data->img_valve && data->img_converter && <br>
data->img_pngEnc && data->img_sink && image_queue_src_pad) {<br>
<br>
g_object_set(data->img_valve, "drop", TRUE, NULL);<br>
g_object_set(data->img_sink, "location", "frame%05d.png", NULL);<br>
g_object_set(data->img_sink, "async", 0, NULL);<br>
g_object_set(data->img_sink, "enable-last-sample", FALSE, NULL);<br>
g_object_set(data->img_converter, "qos", FALSE, NULL);<br>
g_object_set(data->img_pngEnc, "snapshot", FALSE, NULL);<br>
<br>
attach_img_encode_sink_probe(data);<br>
<br>
/* add and link elements */<br>
gst_bin_add_many(GST_BIN(data->pipeline), data->img_queue, data->img_valve, data->img_converter, data->img_pngEnc, data->img_sink, NULL);<br>
gst_element_link_many(data->img_queue, data->img_valve, data->img_converter, data->img_pngEnc, data->img_sink, NULL);<br>
<br>
/* cleanup */<br>
gst_object_unref(GST_OBJECT(image_queue_src_pad));<br>
<br>
retVal = 0;<br>
<br>
TRACE_EXIT();<br>
<br>
} else {<br>
g_print("element construction failure\n");<br>
<br>
if (image_queue_src_pad) gst_object_unref(GST_OBJECT(image_queue_src_pad));<br>
data->img_queue = NULL;<br>
data->img_valve = NULL;<br>
data->img_converter = NULL;<br>
data->img_pngEnc = NULL;<br>
data->img_sink = NULL;<br>
<br>
TRACE_EXIT();<br>
} <br>
<br>
return retVal;<br>
}<br>
<br>
/* initialize video capture pipeline elements */<br>
static gint initCapture (GstData_t *data) {<br>
gint retVal = -1;<br>
TRACE_ENTRY();<br>
<br>
data->capture_src = gst_element_factory_make("v4l2src", "capture_src");<br>
<br>
if (data->capture_src) {<br>
g_object_set(data->capture_src, "device", "/dev/video0", "do-timestamp", TRUE, NULL);<br>
<br>
/* add element to pipeline */<br>
gst_bin_add(GST_BIN(data->pipeline), data->capture_src);<br>
<br>
TRACE_EXIT();<br>
retVal = 0;<br>
} else {<br>
g_print("!data->capture_src\n");<br>
TRACE_EXIT();<br>
return retVal;<br>
}<br>
<br>
return retVal;<br>
}<br>
<br>
<br>
/* initialize video render pipeline elements */<br>
static gint initDisplay (GstData_t *data) {<br>
gint retVal = -1;<br>
TRACE_ENTRY();<br>
<br>
data->video_queue = gst_element_factory_make("queue", "video_queue");<br>
data->video_sink = gst_element_factory_make ("overlaysink", "video_sink");<br>
data->video_convert = gst_element_factory_make ("imxvideoconvert_g2d", "video_convert");<br>
<br>
if (data->video_sink && data->video_convert) {<br>
<br>
g_object_set(data->video_sink, "overlay-top", ((SCREEN_H - VIDEO_H)),<br>
"overlay-left", ((1536 - VIDEO_W) / 2),<br>
"overlay-width", VIDEO_W, <br>
"overlay-height", VIDEO_H,<br>
"display-slave", 1, NULL);<br>
<br>
/* add and link elements */<br>
gst_bin_add_many(GST_BIN(data->pipeline), data->video_convert, data->video_queue, data->video_sink, NULL);<br>
gst_element_link_many(data->video_convert, data->video_queue, data->video_sink, NULL);<br>
<br>
retVal = 0;<br>
TRACE_EXIT();<br>
<br>
} else {<br>
g_print("!data->video_sink || !data->video_convert\n");<br>
data->video_sink = NULL;<br>
data->video_convert = NULL;<br>
TRACE_EXIT();<br>
return retVal;<br>
}<br>
<br>
return retVal;<br>
}<br>
<br>
/* link either the video render or image capture downstream pipeline elements */<br>
static GstPad* linkTeeDynamic (GstElement *tee, GstElement *sink) {<br>
GstPadTemplate *tee_pad_template;<br>
GstPad *tee_pad, *sink_pad;<br>
GstElementClass *klass;<br>
GstPad *ret = NULL;<br>
TRACE_ENTRY();<br>
<br>
if (!GST_IS_ELEMENT(tee)) g_printerr("!GST_IS_ELEMENT(tee)\n");<br>
if (!GST_IS_ELEMENT(sink)) g_printerr("!GST_IS_ELEMENT(sink)\n");<br>
<br>
// check the arguments are valid<br>
klass = GST_ELEMENT_GET_CLASS (tee);<br>
// template for tee pad<br>
tee_pad_template = gst_element_class_get_pad_template(klass, "src_%u");<br>
<br>
/* request the tee pad */<br>
tee_pad = gst_element_request_pad(tee, tee_pad_template, NULL, NULL);<br>
g_print("Obtained request pad %s from %s.\n", gst_pad_get_name(tee_pad), GST_ELEMENT_NAME(tee));<br>
<br>
/* get the sink pad */<br>
sink_pad = gst_element_get_static_pad(sink, "sink");<br>
g_print("Obtained pad %s for branch %s.\n", gst_pad_get_name(sink_pad), GST_ELEMENT_NAME(sink));<br>
<br>
// Link the pads<br>
if (GST_PAD_LINK_FAILED(gst_pad_link(tee_pad, sink_pad))){<br>
g_printerr("%s could not be linked to %s.\n", GST_ELEMENT_NAME(tee), GST_ELEMENT_NAME(sink));<br>
gst_object_unref(tee_pad);<br>
} else {<br>
ret = tee_pad;<br>
}<br>
<br>
// cleanup<br>
gst_object_unref(sink_pad);<br>
<br>
TRACE_EXIT();<br>
return ret;<br>
}<br>
<br>
<br>
/* link either the video render or image capture downstream pipeline elements */<br>
static int linkTee (GstElement *tee, GstElement *sink) {<br>
GstPad *tee_src_pad;<br>
TRACE_ENTRY();<br>
<br>
tee_src_pad = linkTeeDynamic(tee, sink);<br>
if(tee_src_pad) {<br>
gst_object_unref(tee_src_pad);<br>
TRACE_EXIT();<br>
return 1;<br>
} else {<br>
g_printerr("linkTeeDynamic() failure\n");<br>
TRACE_EXIT();<br>
return 0;<br>
}<br>
}<br>
<br>
<br>
int captureImage (GstData_t *data, char* filename) {<br>
TRACE_ENTRY();<br>
<br>
data->in_image_capture_probe = FALSE;<br>
<br>
if (data->pipeline_type == PIPELINE_FLATTENED_LIVE) {<br>
g_object_set(data->img_sink, "location", filename, NULL);<br>
g_object_set(data->img_valve, "drop", FALSE, NULL);<br>
} else {<br>
g_object_set(data->img_filesink, "location", filename, NULL);<br>
g_object_set(data->valve, "drop", FALSE, NULL);<br>
}<br>
<br>
TRACE_EXIT();<br>
return 1;<br>
}<br>
<br>
<br>
int startPipeline (GstData_t *data) {<br>
<br>
PipelineState_t state = getState(data);<br>
int ret = 0;<br>
<br>
TRACE_ENTRY();<br>
<br>
switch(data->pipeline_type) {<br>
<br>
case PIPELINE_FLATTENED_LIVE:<br>
g_print(" PIPELINE_FLATTENED_LIVE \n");<br>
<br>
if (state == NONE) {<br>
setState(data, LIVE);<br>
gst_element_set_state(data->pipeline, GST_STATE_PLAYING);<br>
<br>
g_main_loop_run(data->main_loop);<br>
<br>
gst_object_unref(data->pipeline);<br>
data->pipeline = NULL;<br>
setState(data, NONE);<br>
ret = 1;<br>
} else {<br>
g_print("%s invalid state \n", __FUNCTION__);<br>
}<br>
break;<br>
<br>
default:<br>
g_printerr(" invalid pipeline_type\n");<br>
break;<br>
}<br>
<br>
TRACE_EXIT();<br>
return ret;<br>
}<br>
<br>
/* destroy pipeline and unref its elements */<br>
int destroyPipeline (GstData_t *data) {<br>
TRACE_ENTRY();<br>
<br>
if (data->pipeline && (data->pipeline_type == PIPELINE_FLATTENED_LIVE)) {<br>
<br>
gint device_fd;<br>
if (data->capture_src != NULL) {<br>
g_print("capture_src != NULL\n");<br>
g_object_get(data->capture_src, "device-fd", &device_fd, NULL);<br>
g_print("capture_src::device-fd:%d\n", device_fd);<br>
} else {<br>
g_print("capture_src == NULL\n");<br>
}<br>
<br>
/* inspect pipeline element references */<br>
if (data->capture_src) g_print("capture_src: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->capture_src));<br>
if (data->tee) g_print("tee ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->tee));<br>
if (data->video_queue) g_print("video_queue ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->video_queue));<br>
if (data->video_convert) g_print("video_convert ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->video_convert));<br>
if (data->video_sink) g_print("video_sink ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->video_sink));<br>
if (data->img_queue) g_print("img_queue ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_queue));<br>
if (data->img_valve) g_print("img_valve ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_valve));<br>
if (data->img_converter) g_print("img_converter ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_converter));<br>
if (data->img_pngEnc) g_print("img_pngEnc ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_pngEnc));<br>
if (data->img_sink) g_print("img_sink ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_sink));<br>
<br>
remove_img_encode_sink_probe(data);<br>
<br>
/* terminate pipeline */<br>
if (gst_element_set_state(data->pipeline, GST_STATE_NULL) == GST_STATE_CHANGE_ASYNC) {<br>
g_print("GST_STATE_CHANGE_ASYNC\n");<br>
gboolean waitForNullState = TRUE;<br>
while (waitForNullState) {<br>
sleep(1);<br>
GstState state[2];<br>
int i = 0;<br>
GstStateChangeReturn stateChangeRet = gst_element_get_state(data->pipeline, &state[0], &state[1], 1000000000);<br>
if (stateChangeRet == GST_STATE_CHANGE_SUCCESS) {<br>
MESSAGE_CB_PRINT("***** message: oldstate/newstate/pending: ");<br>
for (i = 0; i < 2; i++) {<br>
switch (state[i]) {<br>
case GST_STATE_VOID_PENDING:<br>
MESSAGE_CB_PRINT(" PENDING ");<br>
break;<br>
case GST_STATE_NULL:<br>
MESSAGE_CB_PRINT(" NULL ");<br>
break; <br>
case GST_STATE_READY:<br>
MESSAGE_CB_PRINT(" READY ");<br>
break; <br>
case GST_STATE_PAUSED:<br>
MESSAGE_CB_PRINT(" PAUSED ");<br>
break; <br>
case GST_STATE_PLAYING:<br>
MESSAGE_CB_PRINT(" PLAYING ");<br>
break;<br>
}<br>
}<br>
}<br>
} // while (waitForNullState)<br>
}<br>
setState(data, NONE); <br>
<br>
g_print("data->pipeline ref_count: %d\n", ((GObject*)(data->pipeline))->ref_count);<br>
<br>
/* inspect pipeline element references */<br>
if (data->capture_src) g_print("capture_src: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->capture_src));<br>
if (data->tee) g_print("tee ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->tee));<br>
if (data->video_queue) g_print("video_queue ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->video_queue));<br>
if (data->video_convert) g_print("video_convert ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->video_convert));<br>
if (data->video_sink) g_print("video_sink ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->video_sink));<br>
if (data->img_queue) g_print("img_queue ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_queue));<br>
if (data->img_valve) g_print("img_valve ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_valve));<br>
if (data->img_converter) g_print("img_converter ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_converter));<br>
if (data->img_pngEnc) g_print("img_pngEnc ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_pngEnc));<br>
if (data->img_sink) g_print("img_sink ref_count: %d\n", GST_OBJECT_REFCOUNT_VALUE(data->img_sink));<br>
<br>
if (data->capture_src != NULL) {<br>
g_print("capture_src != NULL\n");<br>
g_object_get(data->capture_src, "device-fd", &device_fd, NULL);<br>
g_print("capture_src::device-fd:%d\n", device_fd);<br>
} else {<br>
g_print("capture_src == NULL\n");<br>
}<br>
<br>
/* exit gstreamer pipe loop */<br>
g_main_loop_quit(data->main_loop);<br>
g_main_loop_unref(data->main_loop);<br>
data->main_loop = NULL;<br>
<br>
TRACE_EXIT();<br>
return 1;<br>
<br>
} else {<br>
g_print("pipeline does not exist\n");<br>
TRACE_EXIT();<br>
return -1;<br>
}<br>
}<br>
<br>
<br>
static void print_usage() {<br>
g_print("\n");<br>
g_print("************************* usage *************************\n");<br>
g_print("* k: live exam video *\n");<br>
g_print("* h: return to home: *\n");<br>
g_print("* q: exit executable *\n");<br>
g_print("* s: save image *\n");<br>
g_print("* g: save current pipeline graph *\n");<br>
g_print("************************* usage *************************\n");<br>
g_print("\n");<br>
}<br>
<br>
<br>
/* console keyboard control */<br>
static gboolean handle_keyboard (GIOChannel* source, GstData_t* data) {<br>
<br>
gchar *str = NULL;<br>
char timestr[60];<br>
struct tm *t_tm;<br>
time_t t;<br>
TRACE_ENTRY();<br>
<br>
if (g_io_channel_read_line((GIOChannel *)source, &str, NULL, NULL, NULL) != G_IO_STATUS_NORMAL) {<br>
g_printerr("g_io_channel_read_line() != G_IO_STATUS_NORMAL\n");<br>
return TRUE;<br>
}<br>
<br>
switch (g_ascii_tolower (str[0])) {<br>
<br>
case 'k':<br>
<br>
// destroy current pipeline<br>
destroyPipeline(data);<br>
<br>
/* build pipeline */<br>
initPipeline(data, PIPELINE_FLATTENED_LIVE, NULL);<br>
<br>
/* dump pipeline to dot file */<br>
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(data->pipeline),<br>
GST_DEBUG_GRAPH_SHOW_ALL,<br>
"live_flattened-");<br>
<br>
/* Start playing the pipeline */<br>
startPipeline(data);<br>
<br>
break;<br>
<br>
case 'h':<br>
<br>
g_print("navigate home\n");<br>
<br>
/* return to home */<br>
if (getState(data) == LIVE) {<br>
destroyPipeline(data);<br>
} else {<br>
g_print("Invalid cmd\n");<br>
}<br>
break;<br>
<br>
case 'q':<br>
<br>
/* exit app */<br>
g_print("quit\n");<br>
if (data->main_loop != NULL) {<br>
destroyPipeline(data);<br>
} else {<br>
// destroy pipeline management loop<br>
g_main_loop_quit(g_client_loop);<br>
}<br>
break;<br>
<br>
case 's':<br>
<br>
g_print("save image\n");<br>
<br>
/* save image */<br>
time(&t);<br>
t_tm = localtime(&t);<br>
strftime(timestr, 60, "%Y%m%dT%H%M%S", t_tm);<br>
sprintf(filename, "%s.png", timestr);<br>
g_print ("Save image to %s\n", filename);<br>
captureImage(data, filename);<br>
break;<br>
<br>
case 'g':<br>
<br>
g_print("create pipeline dot\n");<br>
<br>
/* dump current pipeline */ <br>
time(&t);<br>
t_tm = localtime(&t);<br>
strftime(timestr, 60, "%Y%m%dT%H%M%S", t_tm);<br>
sprintf(filename, "%s-%s", __FUNCTION__, timestr);<br>
<br>
g_print("Saving pipeline graph to %s.dot\n", filename);<br>
<br>
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(data->pipeline),<br>
GST_DEBUG_GRAPH_SHOW_ALL,<br>
filename);<br>
break;<br>
<br>
case '?':<br>
<br>
print_usage();<br>
break;<br>
<br>
default:<br>
<br>
g_printerr("invalid command\n");<br>
break;<br>
}<br>
<br>
g_free (str);<br>
<br>
TRACE_EXIT();<br>
return TRUE;<br>
}<br>
<br>
<br>
gboolean keyboard_gsource_func (GIOChannel *source, GIOCondition condition, GstData_t *data)<br>
{<br>
gboolean retVal;<br>
TRACE_ENTRY();<br>
<br>
retVal = handle_keyboard(g_io_stdin, data);<br>
<br>
TRACE_EXIT();<br>
return retVal;<br>
}<br>
<br>
<br>
int main (int argc, char *argv[]) {<br>
GstData_t data;<br>
GMainContext* cl_context = NULL;<br>
TRACE_ENTRY();<br>
<br>
/* Initialize GStreamer */<br>
gst_init(&argc, &argv);<br>
memset(&data, 0, sizeof(data));<br>
setState(&data, NONE);<br>
<br>
/* Create a GLib Main Loop and set it to run */<br>
cl_context = g_main_context_new();<br>
g_client_loop = g_main_loop_new(cl_context, FALSE);<br>
/* Add a keyboard watch so we get notified of keystrokes */<br>
g_io_stdin = g_io_channel_unix_new(fileno(stdin));<br>
<br>
// create keyboard watch and add to cl g_client_loop<br>
g_keyboardWatch = g_io_create_watch(g_io_stdin, G_IO_IN);<br>
g_source_set_callback(g_keyboardWatch, (GSourceFunc)keyboard_gsource_func, (gpointer)&data, NULL);<br>
g_keyboardWatch_id = g_source_attach(g_keyboardWatch, cl_context);<br>
<br>
// release contexts<br>
g_main_context_unref(cl_context);<br>
cl_context = NULL;<br>
<br>
print_usage();<br>
<br>
g_main_loop_run(g_client_loop);<br>
<br>
/* command line 'q' will exit g_client_loop */<br>
g_print("g_client_loop exit\n");<br>
<br>
/* Free resources */<br>
/* release keyboard GSource */<br>
g_source_unref(g_keyboardWatch);<br>
g_keyboardWatch = NULL;<br>
<br>
/* unref client loop */<br>
g_main_loop_unref(g_client_loop);<br>
g_client_loop = NULL;<br>
<br>
/* unref keyboard io */<br>
g_io_channel_unref(g_io_stdin);<br>
g_io_stdin = NULL;<br>
<br>
TRACE_EXIT();<br>
return 0;<br>
}<br>
<br>
<br>
/* pipeline bus message handling */<br>
static gboolean message_cb (GstBus * bus, GstMessage * message, gpointer data) {<br>
<br>
GstData_t* gst_data = (GstData_t*)data;<br>
GError *err = NULL;<br>
gchar *name, *debug = NULL;<br>
<br>
name = gst_object_get_path_string(message->src);<br>
<br>
switch (GST_MESSAGE_TYPE(message)) {<br>
<br>
case GST_MESSAGE_STEP_START:<br>
{<br>
MESSAGE_CB_PRINT("***** message: %s\n", "GST_MESSAGE_STEP_START");<br>
gint64 current_time_nsec;<br>
if (gst_element_query_position(gst_data->pipeline, GST_FORMAT_TIME, ¤t_time_nsec)) {<br>
MESSAGE_CB_PRINT("current position: %lld\n", current_time_nsec);<br>
} else {<br>
g_printerr("%d: gst_element_query_position() failure\n", __LINE__);<br>
}<br>
break;<br>
}<br>
<br>
case GST_MESSAGE_STEP_DONE:<br>
{<br>
MESSAGE_CB_PRINT("***** message: %s\n", "GST_MESSAGE_STEP_DONE");<br>
gint64 current_time_nsec;<br>
if (gst_element_query_position(gst_data->pipeline, GST_FORMAT_TIME, ¤t_time_nsec)) {<br>
MESSAGE_CB_PRINT("current position: %lld\n", current_time_nsec);<br>
} else {<br>
g_printerr("%d: gst_element_query_position() failure\n", __LINE__);<br>
}<br>
break;<br>
}<br>
<br>
case GST_MESSAGE_RESET_TIME:<br>
MESSAGE_CB_PRINT("***** message: %s\n", "GST_MESSAGE_RESET_TIME");<br>
<br>
if (GST_IS_ELEMENT(gst_data->pipeline)) {<br>
MESSAGE_CB_PRINT("GST_IS_ELEMENT(gst_data->pipeline)\n");<br>
GstState state[2];<br>
int i = 0;<br>
GstStateChangeReturn stateChangeRet = gst_element_get_state(gst_data->pipeline, &state[0], &state[1], 1000000000);<br>
if (stateChangeRet == GST_STATE_CHANGE_SUCCESS) {<br>
MESSAGE_CB_PRINT("***** message: oldstate/newstate/pending: ");<br>
for (i = 0; i < 2; i++) {<br>
switch (state[i]) {<br>
case GST_STATE_VOID_PENDING:<br>
MESSAGE_CB_PRINT(" PENDING ");<br>
break;<br>
case GST_STATE_NULL:<br>
MESSAGE_CB_PRINT(" NULL ");<br>
break; <br>
case GST_STATE_READY:<br>
MESSAGE_CB_PRINT(" READY ");<br>
break; <br>
case GST_STATE_PAUSED:<br>
MESSAGE_CB_PRINT(" PAUSED ");<br>
break; <br>
case GST_STATE_PLAYING:<br>
MESSAGE_CB_PRINT(" PLAYING ");<br>
break;<br>
}<br>
}<br>
MESSAGE_CB_PRINT("\n");<br>
<br>
} else if (stateChangeRet == GST_STATE_CHANGE_FAILURE) {<br>
MESSAGE_CB_PRINT("GST_STATE_CHANGE_FAILURE\n");<br>
} else if (stateChangeRet == GST_STATE_CHANGE_ASYNC) {<br>
MESSAGE_CB_PRINT("GST_STATE_CHANGE_ASYNC\n");<br>
} else {<br>
MESSAGE_CB_PRINT("unknown gst_element_get_state() failure\n");<br>
}<br>
} else {<br>
g_print("!GST_IS_ELEMENT(gst_data->pipeline)\n");<br>
}<br>
break;<br>
<br>
case GST_MESSAGE_ERROR:<br>
{<br>
g_print("***** message: %s\n", "GST_MESSAGE_ERROR");<br>
gst_message_parse_error (message, &err, &debug);<br>
<br>
g_printerr ("ERROR: from element %s: %s\n", name, err->message);<br>
if (debug != NULL)<br>
g_printerr ("Additional debug info:\n%s\n", debug);<br>
<br>
g_error_free (err);<br>
g_free (debug);<br>
break;<br>
}<br>
<br>
case GST_MESSAGE_WARNING:{<br>
MESSAGE_CB_PRINT("***** message: %s\n", "GST_MESSAGE_WARNING");<br>
gst_message_parse_warning (message, &err, &debug);<br>
<br>
g_printerr ("ERROR: from element %s: %s\n", name, err->message);<br>
if (debug != NULL)<br>
g_printerr ("Additional debug info:\n%s\n", debug);<br>
<br>
g_error_free (err);<br>
g_free (debug);<br>
break;<br>
}<br>
<br>
case GST_MESSAGE_EOS:<br>
MESSAGE_CB_PRINT("***** message: %s\n", "GST_MESSAGE_EOS");<br>
break;<br>
<br>
case GST_MESSAGE_STATE_CHANGED:<br>
{<br>
GstState state[3];<br>
int i = 0;<br>
gst_message_parse_state_changed(message, &state[0], &state[1], &state[2]);<br>
<br>
MESSAGE_CB_PRINT("***** message: oldstate/newstate/pending: ");<br>
for (i = 0; i < 3; i++) {<br>
switch (state[i]) {<br>
case GST_STATE_VOID_PENDING:<br>
MESSAGE_CB_PRINT(" PENDING ");<br>
break;<br>
case GST_STATE_NULL:<br>
MESSAGE_CB_PRINT(" NULL ");<br>
break; <br>
case GST_STATE_READY:<br>
MESSAGE_CB_PRINT(" READY ");<br>
break; <br>
case GST_STATE_PAUSED:<br>
MESSAGE_CB_PRINT(" PAUSED ");<br>
break; <br>
case GST_STATE_PLAYING:<br>
MESSAGE_CB_PRINT(" PLAYING ");<br>
break;<br>
}<br>
}<br>
MESSAGE_CB_PRINT("\n");<br>
break; <br>
}<br>
<br>
case GST_MESSAGE_QOS:<br>
{<br>
GstFormat format = GST_FORMAT_BUFFERS;<br>
guint64 processed, dropped;<br>
gint64 jitter;<br>
gdouble proportion;<br>
gint quality;<br>
<br>
gst_message_parse_qos_stats(message,<br>
&format,<br>
&processed,<br>
&dropped);<br>
gst_message_parse_qos_values(message,<br>
&jitter,<br>
&proportion,<br>
&quality);<br>
<br>
MESSAGE_CB_PRINT("***** message: GST_MESSAGE_QOS, processed=%lld dropped=%lld jitter=%lld proportion=%g quality=%d\n", \<br>
processed, dropped, jitter, proportion, quality);<br>
break;<br>
}<br>
<br>
default:<br>
MESSAGE_CB_PRINT("***** message: %s\n", GST_MESSAGE_TYPE_NAME(message));<br>
break;<br>
<br>
}<br>
<br>
g_free(name);<br>
<br>
return TRUE;<br>
}<br>
<br>
<br>
static int setState (GstData_t *data, PipelineState_t state) {<br>
data->state = state;<br>
if (s_stateDescription[data->state]) {<br>
g_print("state: %s\n", s_stateDescription[data->state]);<br>
}<br>
return 1;<br>
}<br>
static inline PipelineState_t getState (GstData_t *data) {<br>
return data->state;<br>
}<br>
</p>
<p></p>
</div>
</body>
</html>