[RFC] Video-lite#1463
Conversation
Import a video icon from the KDE breeze theme, which is licensed under the LGPL. This icon will be used as a dummy-placeholder for video files. Source: https://github.com/KDE/breeze-icons Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Sure, that's why I took an icon of the LPGLed Breeze KDE theme. We already use them for mobile.
Definitely not an option if I am supposed to draw it. |
|
Definitely a good start. I haven't stared at the code long enough, but conceptionally I like this much better. For the record, I'm not saying NO to video playback, I am voicing concerns. I am still open to being convinced that this is manageable from a packaging perspective. |
| // codecs? Do we have to query them by hand using QMediaPlayer::hasSupport()? | ||
| const QStringList videoExtensionsList = { | ||
| ".avi", ".mp4", ".mpeg", ".mpg", ".wmv" | ||
| }; |
There was a problem hiding this comment.
the list of extensions looks fine to me, as is.
re: "dodging the bullet"
the point is that we shouldn't care about codecs.
obsolete member to list the MIMEs:
http://doc.qt.io/qt-5/qmediaplayer-obsolete.html
support is only an estimate:
http://doc.qt.io/qt-5/qmultimedia.html#SupportEstimate-enum
| return res; | ||
|
|
||
| // Thumbnails of videos currently not supported - replace by dummy | ||
| // TODO: Correctly extract thumbnails |
There was a problem hiding this comment.
should we really keep this TODO?
There was a problem hiding this comment.
Maybe tone it down to
// TODO: Possibly extract thumbnail
?
| if (!fi.exists() && !fi.isFile()) | ||
| return false; | ||
| metadata md; | ||
| return get_metadata(qPrintable(filename), &md) == MEDIATYPE_VIDEO; |
There was a problem hiding this comment.
not sure if this would work for all containers out there.
might as well just assume by extension and throw the file to the external player.
There was a problem hiding this comment.
If you look at https://github.com/Subsurface-divelog/subsurface/blob/master/core/metadata.cpp#L208 we try to parse the MP4 container - so this seems like a reasonable thing to do for us? This at least doesn't blindly accept any extension.
(Of course I worry about the security implications here... reading that code it should be fairly easy to fool us and to at least crash Subsurface if not worse)
There was a problem hiding this comment.
@neolit123 is in principle right - it will parse MP4s, but not AVI. So if that fails, we can still go after extension.
But: even if we fail to identify a video as such, it will simply show a broken icon (we could refine to a format unknown icon). Clicking on it will still open the system video player.
Of course I worry about the security implications here... reading that code it should be fairly easy to fool us and to at least crash Subsurface if not worse)
I tried to make it at most a denial-of-service, which you can do in various ways anyway. If you think this is unsafe, I'll give it a second look in the next few days.
There was a problem hiding this comment.
No, I didn't see anything that glaringly unsafe. This was more an idle comment...
| { | ||
| QImage thumb; | ||
| bool stillLoading = false; | ||
| mediatype_t type = MEDIATYPE_UNKNOWN; |
There was a problem hiding this comment.
we set type here to UNKNOWN and a few lines later we test if it is != STILL LOADING. What am I missing?
There was a problem hiding this comment.
never mind. std::tie confused me
There was a problem hiding this comment.
As I said in a previous PR:
We can replace std::pair<QImage, mediatype_t> by
struct SomeSensibleClassName {
QImage thumbnail;
mediatype_t type;
};
Then the tie will become:
SomeSensibleClassName some_sensible_variable_name = fetchImage(localFilename, filename, tryDownload);
So far I was simply too lazy.
There was a problem hiding this comment.
Yeah, that would have more matched my experience.
I keep thinking this is just a sign that I'm not really a C++ developer. But realistically, the struct way of doing this does allow you to call a function like this from C as well (assuming it's linked with C bindings)
There was a problem hiding this comment.
But realistically, the struct way of doing this does allow you to call a function like this from C as well (assuming it's linked with C bindings)
Except that C will not be happy about the QImage... :(
If you prefer the struct-version, that's fine by me. The hardest part will be coming up with a sensible name. Perhaps simply struct Thumbnail?
There was a problem hiding this comment.
So here's the struct version.
|
It is so embarrassing how much this is already pushing my comfort zone reading code. |
When generating thumbnails, test for video files. If it is, use a dummy-thumbnail. Write only the type (video), but no image to the thumbnail cache, for forward-compatibility. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
|
@bstoeger May I make a few suggestion (again) for fine tuning of the UI:
I can submit a PR for this in a few days or maybe you like to do it but let's first discuss how we want to change it. BTW: I also would not give up video playback in the profile immediately. I want to try once to recompile my Qt/MXE with the "-wmf-backend" option to see if this leads to s.th. |
As you wish. I think the discussion would be ideally conducted at the mailing list, not in a closed PR. My personal opinion: "Media" is fine.
I opened a new PR with the video-playback. Perhaps this helps you with these experiments. |
Describe the pull request:
Pull request long description:
Because video-playback in #1456 was received with reservations, here is the lite-version: Import videos, but only show a dummy icon. On clicking the icon, the video is shown in the system viewer.
I hope we agree that nowadays this is a must-have feature.
Changes made: