408 views
in System Integration by

Hello,
I decided to make a video player on Raspberry Pi 3B+ by Embedded Wizard combined with libvlc(VLC Player).
At first I chose to use "Extern Bitmap" reloaded every frames to make it. 
But I found that it is too low efficiency of opening files and load the bitmaps, 
which will cause a large reduction in the number of frames.
So I tried to use "Applet Interface". However, I get some problems on it.

here's my c code below:

vlc_functions.c

vlc_functions.h

and my code in Embedded Wizard:

Applet Codes=>

VLC Driver=>


Most of the video processing work is done automatically by VLC.
And I set callback function to let the VLC instance Automatically decode the frames during video playing.
I also used double buffer space ,try to display the bitmap i have get from the call backs.
It seems that everything is running correctly, but I don't get the video frame displayed...

I have seen the following article

Embedded Wizard with Camera

but i still have some questions:
(1)Will "Applet" automatically draw the data output to the "Applet" frame(Canvas?) according to the rect range returned by OnUpdate 
   after obtaining the Xbitmap by running the function OnGetBitMap?
(2)Error code 335 will appear from time to time during operation.
(3)In addition to getting bitmap directly from VLC decoding call backs and transform to XBitmap type manually,
   it seems that VLC functions can directly specify the rendering window. 
   If I can get the specific window id (XWindow) of applet, 
   then maybe it can achieve the rendering of the video more effectively.
 

 

 

 

 

1 Answer

0 votes
by
Hello k10183131,

regarding your questions:
(1)Will "Applet" automatically draw the data output to the "Applet" frame(Canvas?) according to the rect range returned by OnUpdate
   after obtaining the Xbitmap by running the function OnGetBitMap?

Yes, Applet will draw the bitmap area returned by OnUpdate() of the bitmap returned by OnGetBitmap().
Please note, that OnUpdate() is triggered by ProgressTimer. Its default period is 100ms. To increase update frequency, please override ProgressTimer and set another period.

(2)Error code 335 will appear from time to time during operation.

This should never happen! It means, that the heap structure of Embedded Wizard is corrupted.
One reason for that could be, that Embedded Wizard methods are called from another thread, which is not allowed!
Even calls like EwPrint(), EWAlloc() of EwLockBitmap() are not allowed from other threads.
I assume, that VLC and its callbacks are running in a separate thread.

(3)In addition to getting bitmap directly from VLC decoding call backs and transform to XBitmap type manually,
   it seems that VLC functions can directly specify the rendering window.
   If I can get the specific window id (XWindow) of applet,
   then maybe it can achieve the rendering of the video more effectively.

I think one possible solution could be to lock one of the video frame bitmaps and pass the resulting pixel buffer to VLC for rendering. After VLC has rendered one frame this video frame bitmap can be unlocked again within the Embedded Wizard thread and returned by OnGetBitmap();

I assume, that color format RGBA8888 is used. So one reason, that the video frames are still not visible could be that the alpha channel of each pixel is set to 0 by VLC.

Regards,
Martin

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...