GNUnet Messenger API: August

Hi again,

I finally managed to get some more time working on the Messenger project and there have actually been quite some changes. First of all I added multiple views with sub-windows in the messenger-cli application. So essentially a really awesome aspect of ncurses was that you could draw content inside a so called window but also create sub-windows inside of another window.

That means the whole implementation I’ve worked on before could be reused to merge multiple views in a custom layout, I just had to implement. So the results looks like this:

image of messenger-cli in group chat

The layout depends on the size/resolution of your terminal and will adjust dynamically if you resize it. So for example if you decrease the width the list of members in a chat will hide but it’s still accessible via pressing TAB. I tried to make the experience pretty smooth and used a lot of knowledge from working with libhandy on the convergent GUI from the messenger-gtk application. So I hope WM users are happy with the results.

Also I added some remaining features like:

  • Invitations can now be accepted by selecting their message and hitting ENTER.
  • Shared files are shown with a progress indication and you can download them by selecting their message and hitting ENTER.
  • Open lobbies can now be joined by entering their URI as text into a dialog and confirming with ENTER.
  • New lobbies can be opened by selecting a custom delay for its expiration from a list and hitting ENTER. You can copy its uri from the terminal.

There are still some parts which should be refined visually and sending/sharing files is still missing. But otherwise the core functionality is complete. So the final post is expected to arrive next month.

Then I didn’t just improved the CLI application but I continued working on the GUI application as well. Because some day I played around with the cameras on my Pinephone Pro. I tested whether the sensors could work with megi’s cam testing app which he published via his blog. So when I got some pictures from both sensors I remembered that I still had issues scanning QR codes with the original Pinephone.

This issue relies on me using zbar for retrieving an image which uses v4l2 internally. The problem is that the cameras on devices like the Pinephone are weird and not like your typical webcam which would not be an issue (more information on the repository from megapixels).

That is why from my understanding it is planned to utilize libcamera in the close future with your applications instead of something like v4l2 or zbar. The problem is that it is still very much in development and I didn’t find much documentation of an API. But the website tells you that it can be used via gstreamer.

So I thought: I have used gstreamer for the voice messages before. That shouldn’t be an issue. Well, it turned out to be a little hassle but I could replace the dependency on zbar completely by using gstreamer together with some plugins. The video will now be captured by some video source, processed by the zbar gstreamer plugin and it will be drawn in a similar way into the applications surface as previously.

Note to everyone who wants to work with gstreamer:

I recommend to not use the GstVideoOverlay. First I tried that but it was a total mess. I had to search for example snippets through the web which somewhat worked. But it does not reliably work with Wayland yet nor does it work with all Gtk surfaces properly. For example a tutorial code worked properly with a GtkWindow but it didn’t work with a GtkDialog. So instead I would recommend to use an GstAppSink like I did, pull the current frame and map its content directly to create a GdkPixmap you can draw. GStreamer offers really good format conversion to make this quite fool proof. I just don’t understand why rendering a video via GStreamer was so difficult… it would have helped a lot if the tutorial code was using a custom pipeline instead of the GstPlayBin. But feel free to use my code as inspiration…

…I hope there’s a better gstreamer integration in GTK4. I haven’t checked that but it would be pretty neat to have it.

Despite the hassle to learn how to get everything working, I really like the concept of gstreamer. Because you can actually debug your processing pipelines from the terminal first and include it in your application afterwards. This eases experimenting with changes as well.

In theory I can adjust the code to use the libcamera gstreamer plugin in the future which should support the Pinephone, Pinephone Pro and more. Otherwise it works as before but the code is more future-proof.

Kind regards,
Jacki

Read original article

Popular posts from this blog

GNUnet Messenger API: March

GNUnet Messenger API: September

GNUnet Messenger API: December