I am using Qt4.8 Windows version to develope an application to stream video using libvlc 2.2.1. When I use libvlc_media_player_set_hwnd() to render the video on my QWidget, its rather creating a separate window to display the video.
libvlc_media_player_set_hwnd(m_player, (void*)videoWidget->winId());
I have tried all versions of libvlc and all the examples related to libvlc with Qt. Also followed the steps given in https://wiki.videolan.org/LibVLC_SampleCode_Qt/
But I am not sure if I m missing anything.
It looks like as if libvlc_media_player_set_hwnd() is not able to take the QWidget WinId and creating its own window. However the value of (void*)videoWidget->winId() seems to be a valid one. (I got the value as 0x65).
Please let me know if I am missing anything.
You need to make sure you are configuring your VLC instance correctly first, so that it uses the dummy interface, for example:
/* Load the VLC engine */
std::vector<const char*> options;
options.push_back("--intf=dummy");
return libvlc_new(int(options.size()), options.data());
Also, are you sure you are passing the handle to the correct widget to render on? Also, make sure to set some size on the parent widget, otherwise you may not see anything render at all. Finally, check what media options you are setting to your media player instance, you may be inadvertently telling it to render to generated window.
I've been able to get VLC to work in my own Qt application using the following example as a starting point, even though it is for VLC 1.X:
LibVLC SampleCode Qt - VideoLAN Wiki
Related
Is there any way to zoom in a video with VLCJ like VLC has this feature. I think it is called magnify or interactive zoom.
It is under Tools >> Effects and filters >> Video >> Geometry >> Magnify
I use vlcj with javafx 9, rendering frames to a canvas with an EmbeddedMediaPlayer.
I also try to add this magnify filter to MediaPlayerFactory like new MediaPlayerFactory("--video-filter=magnify") but i have no idea, how to navigate this feature or set zoom level since "-zoom 2.0" is not working.
I tried cropping, but that havent worked for me, or i tried really badly.
Thank you for your help!
As a bare minimum this should work for zooming:
mediaPlayer.video().setScale(float factor);
Where factor is like 2.0 for double, 0.5 for half and so on.
In my experience, it can be a bit glitchy, and you probably do need to use it in conjunction with crop - and by the way, cropping does work.
But if you want an interactive zoom, then you build that yourself invoking setCrop and setScale depending on some UI interactions you control.
For the picture-in-picture type of zoom, if you're using VLC itself you do something like this:
vlc --video-filter=magnify --avcodec-hw=none your-filename.mp4
It shows a small overlay where you can drag a rectangle and change the zoom setting.
In theory, that would have been possible to use in your vlcj application by passing arguments to the MediaPlayerFactory:
List<String> vlcArgs = new ArrayList<String>();
vlcArgs.add("--avcodec-hw=none");
vlcArgs.add("--video-filter=magnify");
MediaPlayerFactory factory = new MediaPlayerFactory(args);
The problem is that it seems like you need "--avcodec-hw=none" (to disable hardware decoding) for the magnify filter to work - BUT that option is not supported (and does not work) in a LibVLC application.
So unfortunately you can't get that native "magnify" working with a vlcj application.
A final point - you can actually enable the magnify filter if you use LibVLC's callback rendering API (in vlcj this is the CallbackMediaPlayer) as this does not use hardware decoding. However, what you would see is the video with the magnify overlays painted on top but they are not interactive and your clicks will have no effect.
So in short, there's no satisfactory solution for this really.
In theory you could build something yourself, but I suspect it would not be easy.
I'm looking for a way to take website screenshots with QWebEngineView. The main goal is to develop a headless screencapture application that runs in the background.
I've managed to get a minimal working example to work (see this for example). However, these examples require that the QWebEngineView widget is made visible, either with calls to QWebEngineView::show(), QWebEngineView::showMinimized() or even QWebEngineView::setVisible(true), to be able to take a screen capture of a website. As this results in opening a series of windows, this solution is less than perfect.
Does anyone know of a way to use QWebEngineView to take screenshots of websites without having windows popping open?
The solution is rather easy: configure the QWebEngineView widget to not show onscreen by setting the Qt::WA_DontShowOnScreen attribute through a call to QWidget::setAttribute(Qt::WA_DontShowOnScreen).
http://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum
This is QT5. Its on an embedded Yocto system, with QT drawing to the framebuffer, no X11. The problem is this. I want to play a video using gstreamer. So, I tried to launch gstreamer with gst-launch-1.0 linked to a touch event in QT. Problem is, it flickers as QT also tries to render frames.
Next, we tried Q media player. However, this proprietary gstreamer doesn't support playbin, so, I went into QGstreamerPlayerSession and modified the constructor to use gst_parse_launch to set up my pipeline instead of playbin.
This works, in that my video plays. However, there is still the same flickering! I tried to throw up a white rectangle before launching the video, but it still flickers.
How could I prevent QT from redrawing? Do I need an empty scene before playing the video? Or is there a function call to pause redrawing?
I could of course send a SIGSTOP to QT, play the video in an external application, then resume with a SIGCONT. That works, but is obviously a very inelegant and restrictive solution (I need the app to be processing in the background still as its controlling other things as well).
I would like to create an application using Qt (PyQt5 specifically) that has a photo editor like interface. More specifically, I would like it to have:
No main window
Free-floating toolbar
Free-floating context window
Startup dialog
Edit-windows
The idea is to have the toolbar and context window persist for as along as the application is running. The user then opens one or multiple documents (e.g. images in the photo editor example) and uses the options in the toolbar to modify the document(s).
My first question is; does this type of application interface have a specific name, something akin to MDI or SDI? I've been searching for "photo editor interface" and variations on that, but haven't been able to find a search string that seems to hit the mark. For instance, I've tried "build a photo editor type interface with Qt" but it doesn't yield anything useful.
The second question I have is, what is the best way to build a Qt application that doesn't spawn a main window? It seems like I could kludge an assortment of dialogs together to make this happen, but I would really like to use a lot of the functionality of QMainWindow (toolbars, menus, top-level management of the application). Is there a way to launch QMainWindow, display the menu and toolbar, but suppress the main window?
I plan to primarily use this application on OSX, but would also like it to perform well on Windows and Linux.
QMenuBar has explicit support for OSX to have the menu bar behave as expected: http://doc.qt.io/qt-5/qmenubar.html#qmenubar-on-os-x
I think it'll also work on Ubuntu's Unity, which tries to have similar style, but there may be some details you need to take care of. Other desktops should work as expected.
As to how to have individual windows: any Qt widget will be a top level window if it has no parent, so that is an easy way to create windows. If you want to have parent windows (for example to control window stacking order automatically), there's a window flag for that. So you don't need to use QDialog (not sure if you were implying that in your question).
You want to read QWidget documentation carefully to get an idea how all this works.
Let's say that you're using some black box library (i.e. no source code) that sets your cursor to something when rolling over a certain sprite. You can override that by catching rollOver and rollOut events, blocking propagation and using the CursorManager.
Question: is there a way to tell the CursorManager to use the system cursor?
Obviously, I could feed the CursorManager some "system like" cursor, but this would look weird if the local settings are different from that icon, which is likely to be always.
thank you!
f
You can create your own version of CursorManager - just create file mx/managers/CursorManager.as, copy it's content from default manager (use Ctrl+Shift+T to navigate to it) and change the code.
If you use RSLs then you need to create monkey-patch and load it BEFORE RSLs.
if you embed SDK into code then you can simply compile the app and class will be replaced.