Allow medialibrary queries to process and list public media.
Public media are a new addition of the medialibrary 0.13 version. With
this, the users will have the opportunity to allow a subset of the
medialibrary to be exposed on network interfaces (notably the upnp
server and the HTTP remote control).
Community discussions around the subject can be found here:
https://code.videolan.org/videolan/vlc/-/merge_requests/269#note_274345
The condition was flawed. `strdup_helper` allocation success made the
condition pass to the `else` statement, thus erasing the previously
allocated value and causing a leak.
This patch reworks the condition to properly succeed when the string
duplication is done.
MediaLibrary 0.13 allows to list and search on playlist that contains at
least one element of a certain media type.
This is mostly useful to consider playlists with at least one audio file
to be treated as music playlists.
To reflect the latest changes in medialibrary 0.13. There is a listing
function for both audio and video now. This avoids bad combinations of
mediatype and history type.
../../modules/misc/medialibrary/MetadataExtractor.cpp:139:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
139 | for ( auto i = 0; i < inputItem->es_vec.size; ++i )
| ~~^~~~~~~~~~~~~~~~~~~~~~~~
These needs to be more explicit to match the actual medialibrary
behavior. Currently, filtering asking for video or audio playlists will
return playlists that contain exclusively the designated entity type.
The next medialibrary release introduce new filtering types allowing
finer filtering.
Move the media_provider.get_next callback to
vlc_player_cbs.request_next_media.
This callback does not need a special handling since it doesn't
wait for a result anymore.
Thumbnail requests must always be released since ca3b131594.
A failing thumbnail also need to have its request destroyed.
Moving the release call before the null thumbnail condition allow for a
systematic release of the request. Removing the release call from the
`stop()` method is also necessary now, as it would otherwise cause a double
free. The condition variable triggering the request deletion is signaled in
`stop()`.
It should not be assumed that the thumbnail was saved properly when
`fclose` fails.
The RAII wrapper here does not improve readability or shorten the code.
Removing it also works around a GCC `-Wignored-attributes` warning that
was triggered due to `fclose` being tagged as `__nonnull((1))`:
```text
modules/misc/medialibrary/MetadataExtractor.cpp: In member function ‘virtual bool EmbeddedThumbnail::save(const std::string&)’:
modules/misc/medialibrary/MetadataExtractor.cpp:44:44: warning: ignoring attributes on template argument ‘int (*)(FILE*)’ [-Wignored-attributes]
44 | std::unique_ptr<FILE, decltype(&fclose)> f{ vlc_fopen( path.c_str(), "wb" ),
| ^
```
Co-authored-by: Alexandre Janniaux <ajanni@videolabs.io>
The providerList can be NULL if `vlc_media_source_provider_List` returns
a NULL value if no results is returned by vlc_sd_GetNames.
For instance, it means that if no service discovery modules are
available, opening the Qt interface with the medialibrary enabled will
lead to such crash.
json_parse_ex() now requires the length of the JSON string to parse.
The following changes are integrated:
* 672dd79c40 (int64 on Windows),
* ecb7c84719 (proper include guards),
* c8edcab8cd (null deref),
* 894bab1c0a (fallthrough warning)
The (unused) json_relaxed_commas flag is gone.
We may also use it as a contrib.
Ensure the client calling the export to block_t is also responsible for
releasing the picture it exports.
Previous commits were adding the release to match behaviour of the
converter before refactoring everything, but it was a mistake and led to
issues with other parts of the pipeline, in particular the transcoder,
and some clients were more adapted to the converter path + hold of
original rather than the non-conversion path, which would then have been
simpler to do from the start.
This MR adds the necessary hold and release to remove those from the
encoders and the clients, and is tested against the unmerged
libvlc/media.c test for thumbnailing too.
Revert "png: fix picture release on encoder"
This reverts commit d4c93a29a2.
Revert "jpeg: fix picture release on encoder"
This reverts commit cccc085e30.
Revert "avcodec: encoder: fix picture release"
This reverts commit 5a145f34fa.
Revert "codec: vpx: fix picture release on encoder"
This reverts commit 5dde7db39c.
Revert "image: fix picture leak in case of error"
This reverts commit 1bf09fe8d6.
Revert "misc: thumbnailer: release picture when interrupted"
This reverts commit 004b9900f8.
If we were interrupted, we cannot notify the picture anymore so it needs
to be dropped. The behaviour is the same as if using picture_Export
here, and might not be kept in the future, but the goal is to have the
tests working and checking memory leaks before changing the behaviour,
which is also the same as the encoders currently.