<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Ciao, <span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none">Antonio</span><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Thanks for efforts to explain more clear of my perspectives. </div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Per your test results, does that mean gstreamer can produce a bitmap stream file through a video stream, but it does not have capability vice visa?</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
 <font color="#001000" face="arial" size="2" style="background-color: rgb(255, 255, 255);">******test success*********</font><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none"><font face="arial"></font><font size="2"></font><font color="#001000"></font>$ gst-launch-1.0 videotestsrc pattern=ball num-buffers=100 ! 
 avenc_bmp ! filesink location=multi_bmp.bin</span><br style="font-family: &quot; font-size: 14.66px">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none"></span>*****test fail*********<br style="font-family: &quot; font-size: 14.66px">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none">$ gst-launch-1.0 -e filesrc location=multi_bmp.bin ! typefind ! avdec_bmp ! videoconvert ! autovideosink</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Should I have to implement a customized parser to de-mux the unique frame and deliver it to downstream from a
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt; font-size-adjust: none">
still-image</span> bitstream?</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
like:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none">$ cat /dev/myusbdev | gst-launch-1.0  fdsrc ! still-image-parse ! decodebin3 ! videoconvert ! fbdevsink</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none">or can I directly write a C callback function to do the de-mux and delivery the frame to appsrc through g_signal_connect()?</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none"><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none">I am new to gstreamer world and would like to find a solution with less efforts to dig into gstreamer hierarchy.</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none"><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none">Thanks again for your instructions.</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
Weidong</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
www.nxelec.com</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<span style="display: inline !important; background-color: rgb(255, 255, 255); font-size: 11pt; font-size-adjust: none"><br>
</span></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>发件人:</b> Antonio Ospite <ao2@ao2.it><br>
<b>发送时间:</b> 2019年1月8日 0:36<br>
<b>收件人:</b> gstreamer-devel@lists.freedesktop.org<br>
<b>抄送:</b> Zhou Weidong<br>
<b>主题:</b> Re: How to decode a still-image bitstream in MS bitmap format?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Sat, 5 Jan 2019 05:00:07 +0000<br>
Zhou Weidong <weidong.zhou@hotmail.com> wrote:<br>
<br>
> Hello, All<br>
> <br>
> I am a software engineer from NXElec and working in a project with<br>
> bitstream in MS bitmap format.<br>
><br>
> Our target board receives a bitmap bitstream from USB port and we want<br>
> to use gstreamer/decodebin3 to decode it.  The problem/issue we<br>
> currently facing is that decodebin3 hang when the bitstream sent from<br>
> the USB Host, and the log messages:<br>
[...]<br>
<br>
I tried to simulate a test without involving USB:<br>
<br>
$ gst-launch-1.0 videotestsrc pattern=ball num-buffers=100 !  avenc_bmp ! filesink location=multi_bmp.bin<br>
<br>
And tried to decode multi_bmp.bin:<br>
<br>
$ gst-launch-1.0 -e filesrc location=multi_bmp.bin ! typefind ! avdec_bmp ! videoconvert ! autovideosink<br>
<br>
This fails (even for a single frame tho), because avdec_bmp does not get<br>
the full frame:<br>
<br>
ERROR   libav :0:: not enough data (4096 < 307254), trying to decode anyway<br>
ERROR   libav :0:: not enough data (4042 < 307200)<br>
<br>
Using multifilesrc would work for a single file, but not for multiple<br>
BMPs.<br>
<br>
I used avdec_bmp because using decodebin3 (which picks up gdkpixbufdec)<br>
did not work well for me with autovideosink.<br>
<br>
> To compare with a similar situation, we save  an unique still image to<br>
> a bitmap file and use gstreamer filesrc to decode it.  This time,<br>
> decode success. The log messages as below:<br>
[...]<br>
<br>
> I noticed the difference between 2 scenarios is that decodebin3<br>
> detects an EOS signal when it read from a bitmap file. And in USB<br>
> device mode, there is no EOS signal detecting and this leads<br>
> decodebin3 hang...<br>
><br>
<br>
When loading a single frame you can pass it all at once to the decoder<br>
and it will know how to decode it, I think the EOS marks the end of the<br>
frame buffer in your second test.<br>
<br>
When sending multiple frames without a container you need something to<br>
tell when one frame ends or, I guess depending on the decoder, to pass<br>
single full frames one by one to the decoder.<br>
<br>
This is the job of a "parser" element in GStreamer.<br>
<br>
> So the question is how can we use decodebin3 to decode a bitmap<br>
> bitstream?  Bitmap bitstream here means a bitstream that contents<br>
> consequent still images in MS Bitmap format. Currently we send this<br>
> bitmap stream from Windows Host, I guess add some tags/delimiters<br>
> among images in bitstream will let decodebin3 recognize and decode it<br>
> properly. But I do not know how.<br>
><br>
<br>
A possible solution is to write a bmpparse element to split the<br>
bitstream into single frames:<br>
<br>
$ gst-launch-1.0 -e filesrc location=multi_bmp.bin ! bmpparse ! avdec_bmp ! videoconvert ! autovideosink<br>
<br>
I hacked up a proof-of-concept with an hardcoded buffer size in pyhton<br>
and it seems to do the job.<br>
<br>
> Thanks in advance if any suggestions/clues come. The current<br>
> gstreamer/decodebin3 version we are using is 1.10.4.<br>
> <br>
<br>
Try to use the latest stable version if possible.<br>
<br>
Ciao,<br>
   Antonio<br>
<br>
-- <br>
Antonio Ospite<br>
<a href="https://ao2.it">https://ao2.it</a><br>
<a href="https://twitter.com/ao2it">https://twitter.com/ao2it</a><br>
<br>
A: Because it messes up the order in which people normally read text.<br>
   See <a href="http://en.wikipedia.org/wiki/Posting_style">http://en.wikipedia.org/wiki/Posting_style</a><br>
Q: Why is top-posting such a bad thing?<br>
</div>
</span></font></div>
</body>
</html>