and generally don't bother with it when fetching data
from urls
Change-Id: I51a2601c6fb7d6c32f9e2d1286ee0d3b05b370b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176645
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
we can just take a "const &".
(found by running clang-tidy with the
performance-unnecessary-copy-initialization warning)
Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Move the `toQString` helper function to
include/vcl/qt/QtUtils.hxx where it can be used from
multiple modules, instead of defining
it twice for both, avmedia (avmedia/source/qt6/QtPlayer.cxx)
and vcl (vcl/inc/qt5/QtTools.hxx).
Change-Id: I7ffe06eaa3aaf3e7c8cc7aa1a4ac41b14db5c20c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175526
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Introduce include/vcl/qt/QtUtils.hxx as a new header
for Qt-specific utility functions that can be used
in multiple modules, e.g. avmedia and the Qt VCL
plugins in vcl.
This is meant to be used only by code that already
links in Qt.
There's already vcl/inc/qt{5,6}/QtTools.hxx for
helpers needed in vcl only.
Initially, add a `loadQPixmapIcon` helper function
that can be used to retrieve a QPixmap for an icon name
and is extracted from QtPlayer::createMediaPlayerWidget
in avmedia.
It will be reused to implement the
QtInstanceButton::set_from_icon_name logic in an upcoming
commit.
Change-Id: I9f25aa5ca8f00da97d06ecdd164a8fae10e492dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175524
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
When launching media from Properties -> Media Playback,
no sound is currently playing. This is due to the fact that
there is no fallback URL defined for MediaWindowImpl.
To fix this problem, new methods have been added for
setting and getting the fallback URL, passing the path to
the presentation folder from "unoshap4.cxx" to
"mediawindow_imp.cxx".
Because the setURL method starts the media immediately,
calls to "setFallbackURL" method must be made BEFORE
calling "setURL".
Change-Id: I3054c90c648c5839a2eb3fc463eaefbf97500c05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170644
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
For the gtk4 VCL plugin, require GTK version >= 4.10
and drop code for older versions.
This simplifies maintenance, in particular since
requiring 4.10 ensures that the basic GtkAccessible API
is available.
GTK 4.10 was released on 2023-03-04 [1], so it
will be almost 2 years by the time that LO 25.2
will be released.
Given that the gtk4 VCL plugin is still experimental,
providing support for older GTK 4 releases shouldn't
have to be a concern.
[1] https://gitlab.gnome.org/GNOME/gtk/-/blob/4.10.0/NEWS?ref_type=tags
Change-Id: I6f361b533391225d0e74c174e0479b767b9d827a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169324
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
While opending a slide with a video worked fine for
me with the qt6 VCL plugin and a local Qt development
build on Debian testing (qtbase as of
8915ae3a75c4a356d94962dd9b31e1458f2a506f,
qtwayland as of deae8b9ce9f551b29ef98d0bb827a8543af2797e,
qtmultimedia as of 235ba5f273fbb7dfed8ba3736e4444a85aee5770),
this resulted in a freeze when using Debian's system-provided
Qt packages instead (libqt6multimedia6:amd64 6.4.2-11+b2).
While the self-compiled Qt dev is using `QFFmpegMediaPlayer`
which asynchronously loads media, the system QtMultimedia
is using `QGstreamerMediaPlayer` (s. frame 37 in below backtrace)
that apparently doesn't use multiple threads.
Therefore, using `Qt::BlockingQueuedConnection` is problematic,
as its documentation [1] says:
> Same as Qt::QueuedConnection, except that the signalling thread blocks
> until the slot returns. This connection must not be used if the receiver
> lives in the signalling thread, or else the application will deadlock.
Use `Qt::AutoConnection` (= 0, the default) instead and specify the
`Qt::SingleShotConnection` flag in addition to ensure the slot
gets called only once:
> This is a flag that can be combined with any one of the above connection
> types, using a bitwise OR. When Qt::SingleShotConnection is set, the
> slot is going to be called only once; the connection will be
> automatically broken when the signal is emitted. This flag was
> introduced in Qt 6.0.
Drop the now no longer needed manual disconnect.
This makes the scenario work with both, the custom-compiled
Qt dev using `QFFmpegMediaPlayer` and the system-provided
Qt 6.4.2 using `QGstreamerMediaPlayer`.
Side note: Unrelated to the issue addressed here, using the
system-provided Qt with `QGstreamerMediaPlayer` results
in a crash when started via the soffice shell script wrapper
with a LibreOffice debug build or when using soffice.bin directly
and manually setting `MALLOC_PERTURB_=153`, which indicates
some memory issue. That could be within Qt, though, haven't
analyzed that further.
Backtrace of deadlock:
1 syscall syscall.S 38 0x7f40a83249f9
2 QSemaphore::acquire(int) 0x7f40948714e2
3 ?? 0x7f409477fede
4 QVideoSink::videoFrameChanged(QVideoFrame const&) const 0x7f4095195376
5 ?? 0x7f405c219f5c
6 ?? 0x7f405c21a25b
7 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x7f4093782d62
8 QCoreApplication::notifyInternal2(QObject *, QEvent *) 0x7f40947356d8
9 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *) 0x7f40947358b7
10 ?? 0x7f4094925257
11 ?? 0x7f409ab0de3f
12 ?? 0x7f409ab0fec7
13 g_main_context_iteration 0x7f409ab104e0
14 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 0x7f4094922f60
15 QtInstance::ImplYield QtInstance.cxx 455 0x7f4094e534e0
16 QtInstance::DoYield QtInstance.cxx 464 0x7f4094e568a5
17 ImplYield svapp.cxx 384 0x7f409f3c48cc
18 Scheduler::ProcessEventsToIdle svapp.cxx 419 0x7f409f3c4bc8
19 avmedia::qt::QtFrameGrabber::grabFrame QtFrameGrabber.cxx 106 0x7f405cac5524
20 non-virtual thunk to avmedia::qt::QtFrameGrabber::grabFrame(double) 0x7f405cac564e
21 avmedia::MediaWindow::grabFrame mediawindow.cxx 385 0x7f40a03e41ad
22 SdrMediaObj::getSnapshot() const::$_0::operator()(com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) const svdomedia.cxx 195 0x7f40a249e5b5
23 std::__invoke_impl<void, SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&>(std::__invoke_other, SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) invoke.h 61 0x7f40a249e52d
24 std::__invoke_r<void, SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&>(SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) invoke.h 111 0x7f40a249e4dd
25 std::_Function_handler<void (com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&), SdrMediaObj::getSnapshot() const::$_0>::_M_invoke(std::_Any_data const&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) std_function.h 290 0x7f40a249e345
26 std::function<void (com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&)>::operator()(com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) const std_function.h 591 0x7f40a03e96cd
27 avmedia::PlayerListener::callPlayerWindowSizeAvailable mediawindow.hxx 76 0x7f40a03e6bf1
28 avmedia::PlayerListener::preferredPlayerWindowSizeAvailable mediawindow.cxx 496 0x7f40a03e5055
29 avmedia::qt::QtPlayer::notifyListeners QtPlayer.cxx 395 0x7f405cacfd53
30 avmedia::qt::QtPlayer::notifyIfReady QtPlayer.cxx 326 0x7f405cacfb42
31 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QMediaPlayer::MediaStatus>, void, void (avmedia::qt::QtPlayer:: *)(QMediaPlayer::MediaStatus)>::call qobjectdefs_impl.h 135 0x7f405cad477b
32 QtPrivate::FunctionPointer<void (avmedia::qt::QtPlayer:: *)(QMediaPlayer::MediaStatus)>::call<QtPrivate::List<QMediaPlayer::MediaStatus>, void> qobjectdefs_impl.h 172 0x7f405cad46cd
33 QtPrivate::QSlotObject<void (avmedia::qt::QtPlayer:: *)(QMediaPlayer::MediaStatus), QtPrivate::List<QMediaPlayer::MediaStatus>, void>::impl qobjectdefs_impl.h 383 0x7f405cad4612
34 ?? 0x7f409477fbbe
35 QMediaPlayer::mediaStatusChanged(QMediaPlayer::MediaStatus) 0x7f4095184a05
36 ?? 0x7f405c210740
37 non-virtual thunk to QGstreamerMediaPlayer::processBusMessage(QGstreamerMessage const&) 0x7f405c2009f7
38 ?? 0x7f405c21aa94
39 QObject::event(QEvent *) 0x7f40947723e0
40 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x7f4093782d62
41 QCoreApplication::notifyInternal2(QObject *, QEvent *) 0x7f40947356d8
42 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *) 0x7f40947358b7
43 ?? 0x7f4094925257
44 ?? 0x7f409ab0de3f
45 ?? 0x7f409ab0fec7
46 g_main_context_iteration 0x7f409ab104e0
47 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 0x7f4094922f60
48 QtInstance::ImplYield QtInstance.cxx 455 0x7f4094e534e0
49 QtInstance::DoYield QtInstance.cxx 464 0x7f4094e568a5
50 ImplYield svapp.cxx 384 0x7f409f3c48cc
51 Scheduler::ProcessEventsToIdle svapp.cxx 419 0x7f409f3c4bc8
52 avmedia::qt::QtFrameGrabber::grabFrame QtFrameGrabber.cxx 106 0x7f405cac5524
53 non-virtual thunk to avmedia::qt::QtFrameGrabber::grabFrame(double) 0x7f405cac564e
54 avmedia::MediaWindow::grabFrame mediawindow.cxx 385 0x7f40a03e41ad
55 SdrMediaObj::getSnapshot() const::$_0::operator()(com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) const svdomedia.cxx 195 0x7f40a249e5b5
56 std::__invoke_impl<void, SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&>(std::__invoke_other, SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) invoke.h 61 0x7f40a249e52d
57 std::__invoke_r<void, SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&>(SdrMediaObj::getSnapshot() const::$_0&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) invoke.h 111 0x7f40a249e4dd
58 std::_Function_handler<void (com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&), SdrMediaObj::getSnapshot() const::$_0>::_M_invoke(std::_Any_data const&, com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) std_function.h 290 0x7f40a249e345
59 std::function<void (com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&)>::operator()(com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayer> const&) const std_function.h 591 0x7f40a03e96cd
60 avmedia::PlayerListener::callPlayerWindowSizeAvailable mediawindow.hxx 76 0x7f40a03e6bf1
61 avmedia::PlayerListener::preferredPlayerWindowSizeAvailable mediawindow.cxx 496 0x7f40a03e5055
62 avmedia::qt::QtPlayer::notifyListeners QtPlayer.cxx 395 0x7f405cacfd53
63 avmedia::qt::QtPlayer::notifyIfReady QtPlayer.cxx 326 0x7f405cacfb42
64 QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QMediaPlayer::MediaStatus>, void, void (avmedia::qt::QtPlayer:: *)(QMediaPlayer::MediaStatus)>::call qobjectdefs_impl.h 135 0x7f405cad477b
65 QtPrivate::FunctionPointer<void (avmedia::qt::QtPlayer:: *)(QMediaPlayer::MediaStatus)>::call<QtPrivate::List<QMediaPlayer::MediaStatus>, void> qobjectdefs_impl.h 172 0x7f405cad46cd
66 QtPrivate::QSlotObject<void (avmedia::qt::QtPlayer:: *)(QMediaPlayer::MediaStatus), QtPrivate::List<QMediaPlayer::MediaStatus>, void>::impl qobjectdefs_impl.h 383 0x7f405cad4612
[1] https://doc.qt.io/qt-6/qt.html#ConnectionType-enum
Change-Id: Ia8bfd19b0c0c4f970a5eb200c2a0b45784ef25fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169036
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
So far, `QtPlayer::createPlayerWindow` was unconditionally
creating a video widget.
However, audio-only media files can be used as well,
therefore handle that case, too and create a widget
holding an audio icon as a placeholder instead if
the media doesn't contain video.
(This is the same icon shown when using qt5 that
doesn't use QtMultimedia).
As described in
commit a99575f04f
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sat Jun 1 07:32:22 2024 +0200
tdf#194504 qt avmedia: Don't wait for video frame if there's none
, `QMediaPlayer::hasVideo()` only returns a useful
result once loading media has finished. Therefore,
if the player is still in that state in
`QtPlayer::createPlayerWindow`, defer
creating the widget to when the media status
changes.
With this commit in place, opening an Impress presentation
that contains an audio file (like attachment 194504
from tdf#145735) and starting presentation mode now shows an
"audio icon" as placeholder as expected when using
the qt6 VCL plugin.
(This commit here makes that work for presentation
mode, while the above-mentioned commit already made
the icon show as expected for non-presentation mode.)
Change-Id: I1ff7e8b8659162a748abc3f97a8d2181375c0e7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169009
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
The SfxPoolItem has a new member SfxItemType m_eItemType to
compare types based on enums instead of typeinfo() which
consumes a lot of time e.g. while AutoFormat is running
Change-Id: I033ce67bc9a28ee4790f162380314de85fb4154e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166452
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
If the media doesn't have video, then don't try to
grab a frame, but stop waiting for the
`QVideoSink::videoFrameChanged` signal to be emitted
in `QtFrameGrabber::grabFrame`.
Don't call `QMediaPlayer::hasVideo` while the media
is still being loaded, as the result is only valid once loading
the media has been finished (`false` is returned otherwise
even if the media file contains video), s. the platform
implementation in qtmultimedia's `QFFmpegMediaPlayer::setMedia`,
which loads the media in a separate thread: Once the media
has been loaded, `QFFmpegMediaPlayer::setMediaAsync`
calls `QPlatformMediaPlayer::videoAvailableChanged`
to specify whether video is available.
With this commit in place, opening an Impress presentation
that contains an audio file (like attachment 194504
from tdf#145735) now shows an "audio icon" as placeholder
as expected and the application exits properly on close,
rather than blocking as it's still waiting for a video frame.
Change-Id: I5448a9f7396d4c419d76a2400e3f2a1ef52a7e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168305
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Add a new `QtFrameGrabber` class that implements
the `css::media::XFrameGrabber` interface and
return an instance of it in
`QtPlayer::createFrameGrabber`.
As there seems to be no direct way to retrieve
the image/frame of a video at a certain point
in time, create a separate `QMediaPlayer` instance
for the `QtFrameGrabber`, set a video sink, connect
to its `&QVideoSink::videoFrameChanged` signal and
start playing the video (and stop it again once the
first frame has been received) in order to retrieve
a corresponding frame.
From that `QVideoFrame`, a `QImage` can be retrieved
that can then be converted to an `XGraphic`.
With this in place, a frame from the actual video
is now displaced in Impress in non-presentation
mode instead of just a generic "video icon" placeholder
when opening a presentation containing a video,
(e.g. attachment 145517 from tdf#120452) when the
qt6 VCL plugin is in use.
Change-Id: I3bba3c0fb62a219ac632ceed03ec17f9078f18d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168255
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
In `QtPlayer::getPreferredPlayerWindowSize`, retrieve the
video resolution from the meta data and return that for the
preferred window size if available, instead of always returning
an empty rect.
For the sample presentation referenced in tdf#145735,
the size retrieved this way also matches what
`GtkPlayer::getPreferredPlayerWindowSize` returns
(720x400).
As mentioned in
commit 441d8ed9be
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Mon May 20 16:25:09 2024 +0200
tdf#145735 avmedia qt: Use QtMultimedia for Qt 6 media playback
, the behaviour without this was:
> * In non-presentation mode, the placeholder
> shown until the video gets started using the controls
> in the sidebar is just an "audio icon", not a frame
> from the actual video. (This might be related to the
> fact that `QtPlayer::createFrameGrabber` currently
> returns an empty reference.)
With this in place, the placeholder is now a different
icon, a "video icon" (but still not a frame from the actual
video).
Change-Id: I295abe6b7973fece3fcaf9a38af2602cb08610a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168013
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Similar to the way that GTK 4's native facilities for
video playback are used for the gtk4 VCL plugin, initially
added in commit
commit d0a527ec09
Author: Caolán McNamara <caolanm@redhat.com>
Date: Thu Feb 10 12:55:18 2022 +0000
first cut at using Gtk4 built in video playback
, implement media playback using QtMultimedia for the
Qt 6 based VCL plugins (qt6/kf6) via a new service
"com.sun.star.comp.avmedia.Manager_Qt".
Video playback with the mechanism used for qt5 no
longer works with qt6, as "qwidget5videosink"
that gets used on Wayland for qt5 wasn't ported
to Qt 6 and is unmaintained, s. the commit message of
commit 88d57cf241
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Wed Sep 29 11:09:51 2021 +0200
qt6: Add a qt6 VCL plugin
for more details. Additionally, this also doesn't work
properly any more on X11/with the xcb Qt QPA platform, see
tdf#145735 comment 7.
Instead of using GStreamer directly, let Qt handle
the low-level stuff by using the QtMultimedia module [1]
instead.
This adds a new dependency on QtMultimedia.
For building, this requires installing the Qt 6 QtMultimedia
development headers (e.g. package `qt6-multimedia-dev`
on current Debian testing).
Except for WASM, the use of QtMultimedia is enabled by
default when building with autogen options `--enable-qt6`
or `--enable-kf6`, but can explicitly be disabled using
`--disable-qt6-multimedia`.
In tests with the qt6 VCL plugin on Debian testing, with a
sample presentation containing an embedded
video, attachment 145517 from tdf#120452, video playback
generally works for both, the xcb and the wayland
Qt QPA platforms:
* Video and audio are played as expected on the external
screen in presentation mode when using the presenter
console
* Video and audio playback work in non-presentation
mode by clicking on the video and using the controls
in the Impress sidebar (play, pause,...).
However, the following issues were observed with
the current implementation:
* There's an odd frame/margin around the video.
* In non-presentation mode, the placeholder
shown until the video gets started using the controls
in the sidebar is just an "audio icon", not a frame
from the actual video. (This might be related to the
fact that `QtPlayer::createFrameGrabber` currently
returns an empty reference.)
* At least on Wayland (issue not observed with
QT_QPA_PLATFORM=xcb so far), when using the presenter
console, video playback in the presenter console (i.e. on the
non-presentation screen) is unreliable: The video
sometimes shows, but sometimes doesn't. At least the
(more important) one on the presentation screen was
reliably shown in my tests, however.
Tested with git dev versions of qtbase
(as of commit 8d5e7d50d8dbf1ad79bd8ff9f6ef6028eba481c9),
qtwayland (as of commit 6f0ebd916f176f6fbe35af28caeb52b62768ac94)
and qtmultimedia (as of commit
264b7e8d7d5683252102b5e5149685c8b8a70c2d).
[1] https://doc.qt.io/qt-6/qtmultimedia-index.html
Change-Id: I29c3c7ded01c61b49b192fa5c313d8a92c942185
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167869
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
In the same way that `vcl/Library_vclplug_gtk4.mk` does
it, set the `GTK4_CFLAGS` (which have the includes) via
`gb_Library_set_include`, not `gb_Library_add_cxxflags`.
This makes sure that they end up in the `INCLUDE`
section in `workdir/GbuildToJson/Library/libavmediagtk.so`
and thus end up in the IDE integrations as includes,
which makes Qt Creator's Clang Code Model find them
instead of showing an error
("gtkplayer.cxx:28:10: 'gtk/gtk.h' file not found").
See also this similar commit for more details:
commit 6a53832080
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Mon Dec 17 15:35:58 2018 +0100
Use 'gb_Library_set_include' for GTK3_CFLAGS
Change-Id: I5ef01aff32073d37b8add0b2250402ccaa48b2dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167857
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
There are some CrashReports in 7.6 which have
DeleteItemOnIdle on the stack, but there is nothing
reproducable. So I took a look...
I first thought it's a MCGR regression, due to classes
on the stack. But the Item involved is just random, can
happen with any Item.
Then I thought it may have to do with ITEM refactorings,
but it happens with DeleteItemOnIdle involved, so also
not the case. I already saw DeleteItemOnIdle when doing
these and qualified as 'hack' in the way. already
It is only on Windows and DeleteItemOnIdle is involved.
This again (took a deeper look now) is an old hack to
keep an SfxPoolItem 'alive' for some 'time'. For that,
it triggers an async reschedule which then deletes the
Item when being called. If the Item will be used after
that is pure coincidence - seems to work in most cases.
It seems as if for Windows the timing slightly changed
for some scenarios, so a reschedule is too early. This
can happen with this hack anytime.
DeleteItemOnIdle is used in scenarios where SfxPoolItem*
is e.g. returned, but is *not* anchored, so e.g. not
member of an SfxItemSet. Or in short: Lifetime is not
safe.
DeleteItemOnIdle exists since 1st import, but was
changed to AsyncEvent ca. 4 months ago (see
57145acf9e), so that may
have caused it. It is possible that these errors happen
on Windows since then. Before something more complicated
was used to delete it late, but surely also not really
safe.
Due to ITEM refactor I have the knowledge/tooling to
solve this. It will not be a 1-5 lines fix, but it is
a hack and in the way for further ITEM refactor anyways.
What we have nowadays is a SfxPoolItemHolder -> it's
like an SfxItemSet for a single Item. It safely holds/
controls the lifetime of an SfxPoolItem. It is already
used in quite some places. It helps to solve many hacks,
also the ones putting Items directly to the Pool - due
to there never was an alternative for that. In principle
the ItemPool/ItemSet/Item paradigm was never complete
without SfxPoolItemHolder.
Thus I started to fix that (and remove that hack for
good, sooo many changes over the years, sigh), but as
said is not straightforward. Will have to change
retvals of involved stuff to SfxPoolItemHolder - it's
just two pointers and designed to be copied (one is a
Pool, needed to cleanup when destructing).
CopyConstruct/destroy just counts the RefCnt up/down,
so cheap.
1st version compiling, let's check on gerrit...
Corrected one error in QueryState for securitypage, also
added some security features/asserts.
Change-Id: Ida49fd35ca88ead84b11d93e18b978cb9e395090
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161083
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
...in include files. This is a mix of automatic rewriting in include files and
manual fixups (mostly addressing loplugin:redundantfcast) in source files that
include those.
Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
...by moving the char8_t -> char reinterpret_cast out of any potential constexpr
paths into a new TranslateId::getId. And demonstrate constexpr'ability by
making the aCategories var in OApplicationIconControl::Fill
(dbaccess/source/ui/app/AppIconControl.cxx) constexpr. (And there might be more
such cases that could now be made constexpr.)
Change-Id: I0b4e3292faf8f6b901f9b9e934e1aa6bf0f583ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157862
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
that can be initialised at compile-time instead of runtime
Change-Id: I08d516fdc13a3a79f93c079f89ac44cbc7a1ed71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153620
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
.. at least for the most popular types, and do it automatically in
MediaItem::setURL().
This should work in practice in most cases and is much simpler than
adding some type detection or calling into platform dependent avmedia
backends.
Remove the parameter that was only ever set to
"application/vnd.sun.star.media" anyway, the same value that would be
used if it's missing.
Stop using that silly type for everything, only use it when guessing
fails.
In case an ODF document is loaded, it will use the mime type loaded from
the file (see setting of MediaMimeType in SdXMLPluginShapeContext) and
not guess it because that would require updating the entry in
manifest.xml as well.
Change-Id: I8ce29cf7425678ae11dda1d8c875be818f8623af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150049
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Standardize on OUString, which is the main internal string class.
Convert from/to OUString only when communicating with respective
external APIs.
Removes about 200 conversions from the code.
Change-Id: I96ecee7c6fd271bb76639220e96d69d2964bed26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149930
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
on modern hardware, these are less efficient than regular alpha
channels.
Also, this greatly simplies the range of stuff that vcl needs to deal
with, which will make the upcoming transparency->alpha patch easier to
deal with.
Enhance vcl::CreateFromData to convert incoming 1-bit data to 8-bit
image.
Change-Id: I35829da750029fe373d0d2911a669d10bab6ad23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145321
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Graphic is just a wrapper around shared_ptr, so no need to
allocate this separately
Change-Id: Ie657dea1c021e66a6876e814090a44cb6f995b91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139739
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
If a media shape had cropping defined, we already took that into account
when presenting a preview for it, but not during video playback.
The reason for this is that the preview may be set by a file importer
(e.g. PPTX) explicitly, in which case the preview is a bitmap we get
without any video processing.
As a start, implement video crop for the gstreamer backend (used on
Linux), and also pass in the media item (containing crop and other
properties) both during the edit view (MediaWindowImpl) and presenting
(ViewMediaShape). We pass in the whole media item, so in case later
other filters (e.g. black-and-white) are wanted, we have all that info
in the backends already.
Other backends (avmediaMacAVF and avmediawin) are untouched so far.
svx/qa/unit/data/video-snapshot.pptx is modified to have a yellow border
when cropping is unimplemented, which is now not visible with the
gtreamer backend, matching PowerPoint behavior. PPTX export was working
out of the box already.
Change-Id: If26b7a4391bcffe9cbddd9933e1bab69be52924e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138867
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
It is possible to provide an explicit preview of media objects since
commit 8fa1d453c9 (Related: tdf#149971
svx: support explicitly provided snapshots for media shapes,
2022-08-24), however they can't be cropped.
This means that media shapes from PPTX with cropping show unexpected
content and can also have a buggy aspect ratio.
Extend avmedia::MediaItem to store cropping and take it into account
when returning the preview bitmap in SdrMediaObj::getSnapshot(). PPTX
import works out of the box, as oox/ already tried to set a cropping
property on the media shape.
This is just the preview, the cropping of the video itself is not yet
implemented.
Change-Id: I8db3e0dcf252613d56eb0e6139adf097e53b15cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138808
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Failed like this:
.../libreoffice/avmedia/source/gtk/gtkplayer.cxx: In member function ‘virtual com::sun:⭐:uno::Reference<com::sun:⭐:media::XPlayerWindow> avmedia::gtk::GtkPlayer::createPlayerWindow(const com::sun:⭐:uno::Sequence<com::sun:⭐:uno::Any>&)’:
.../libreoffice/avmedia/source/gtk/gtkplayer.cxx:346:38: error: ‘void gtk_picture_set_keep_aspect_ratio(GtkPicture*, gboolean)’ is deprecated: Use 'gtk_picture_set_content_fit' instead [-Werror=deprecated-declarations]
346 | gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(m_pVideo), false);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/gtk-4.0/gtk/gtk.h:196,
from .../libreoffice/avmedia/source/gtk/gtkplayer.cxx:28:
/usr/include/gtk-4.0/gtk/gtkpicture.h:73:17: note: declared here
73 | void gtk_picture_set_keep_aspect_ratio (GtkPicture *self,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [.../libreoffice/solenv/gbuild/LinkTarget.mk:337: .../libreoffice/workdir/CxxObject/avmedia/source/gtk/gtkplayer.o] Error 1
make: *** [Makefile:289: build] Error 2
Corresponding Gtk commit [1]:
commit d8a73cbd03118e94bd75f5fa183a646fecb053ce
Author: Marco Melorio <marco.melorio@protonmail.com>
Date: Fri Jul 15 18:18:26 2022 +0200
picture: Add content-fit property
It allows to specify the resize mode of the paintable inside the
GtkPicture allocation. This also deprecates the keep-aspect-ratio
property.
Fixes#5027.
While the doc [2] says its deprecated for 4.8, that sems to refer to stable
Gtk version only and it's already the case for the unstable version
4.7.2 (as packaged in Debian testing now):
$ git tag --contains d8a73cbd03118e94bd75f5fa183a646fecb053ce
4.7.2
Use `gtk_picture_set_content_fit` with `GTK_CONTENT_FIT_FILL`
that results in the same behavior for Gtk >= 4.7.2.
[1] d8a73cbd03
[2] https://docs.gtk.org/gtk4/method.Picture.set_keep_aspect_ratio.html
Change-Id: I9fc527e6674cb8e4774adbe7d14cce2a264a5a67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138797
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>