[vlc-commits] [Git][videolan/vlc][master] 2 commits: medialibrary: Update to 0.11.x API
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Feb 19 16:39:20 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
0102a531 by Hugo Beauzée-Luyssen at 2022-02-19T15:47:05+00:00
medialibrary: Update to 0.11.x API
Fix #26491
- - - - -
937a1d62 by Hugo Beauzée-Luyssen at 2022-02-19T15:47:05+00:00
contrib: Bump medialibrary to 0.11.0
- - - - -
13 changed files:
- configure.ac
- + contrib/src/medialibrary/SHA512SUMS
- contrib/src/medialibrary/rules.mak
- include/vlc_media_library.h
- modules/gui/macosx/library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/VLCLibraryDataTypes.h
- modules/gui/macosx/library/VLCLibraryDataTypes.m
- modules/misc/medialibrary/MetadataExtractor.cpp
- modules/misc/medialibrary/entities.cpp
- modules/misc/medialibrary/fs/fs.cpp
- modules/misc/medialibrary/fs/fs.h
- modules/misc/medialibrary/medialibrary.cpp
- modules/misc/medialibrary/medialibrary.h
Changes:
=====================================
configure.ac
=====================================
@@ -4349,7 +4349,7 @@ dnl Libnotify notification plugin
dnl
PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify], [libnotify notification], [auto])
-PKG_ENABLE_MODULES_VLC([MEDIALIBRARY], [medialibrary], [medialibrary >= 0.9.3], (medialibrary support), [auto])
+PKG_ENABLE_MODULES_VLC([MEDIALIBRARY], [medialibrary], [medialibrary >= 0.11.0], (medialibrary support), [auto])
dnl
dnl Endianness check
=====================================
contrib/src/medialibrary/SHA512SUMS
=====================================
@@ -0,0 +1 @@
+6e299909c7c8945b6a3f53ea0851cc2ae6929012ba5b99454f895247b8398495dd90daca66a9377b9462f49b0df4ae001df31b534b7b222441519c6dfa940928 medialibrary-0.11.0.tar.bz2
=====================================
contrib/src/medialibrary/rules.mak
=====================================
@@ -1,34 +1,25 @@
-MEDIALIBRARY_HASH := 363bb8fcf50851a0ce7438ee5a9ad35f6f8954d0
-MEDIALIBRARY_VERSION := git-$(MEDIALIBRARY_HASH)
-MEDIALIBRARY_GITURL := https://code.videolan.org/videolan/medialibrary.git
+MEDIALIBRARY_VERSION := 0.11.0
+MEDIALIBRARY_URL := https://code.videolan.org/videolan/medialibrary/-/archive/$(MEDIALIBRARY_VERSION)/medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2
PKGS += medialibrary
-ifeq ($(call need_pkg,"medialibrary >= 0.9.3"),)
+ifeq ($(call need_pkg,"medialibrary >= 0.11.0"),)
PKGS_FOUND += medialibrary
endif
DEPS_medialibrary = sqlite $(DEPS_sqlite)
-$(TARBALLS)/medialibrary-$(MEDIALIBRARY_VERSION).tar.xz:
- $(call download_git,$(MEDIALIBRARY_GITURL),,$(MEDIALIBRARY_HASH))
+$(TARBALLS)/medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2:
+ $(call download_pkg,$(MEDIALIBRARY_URL),medialibrary)
-.sum-medialibrary: medialibrary-$(MEDIALIBRARY_VERSION).tar.xz
- $(call check_githash,$(MEDIALIBRARY_HASH))
- touch $@
+.sum-medialibrary: medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2
-medialibrary: medialibrary-$(MEDIALIBRARY_VERSION).tar.xz .sum-medialibrary
+medialibrary: medialibrary-$(MEDIALIBRARY_VERSION).tar.bz2 .sum-medialibrary
$(UNPACK)
$(MOVE)
.medialibrary: medialibrary
- cd $< && $(HOSTVARS_MESON) $(MESON) -Dlibvlc=disabled build
+ cd $< && $(HOSTVARS_MESON) $(MESON) -Dlibvlc=disabled -Dlibtool_workaround=true build
ninja -C $</build
-ifdef HAVE_LINUX
-ifndef HAVE_ANDROID
- sed -e 's,^Libs\(.*\)-pthread,Libs\1-pthread -latomic,' \
- -i $</build/meson-private/medialibrary.pc
-endif
-endif
cd $< && cd build && ninja install
touch $@
=====================================
include/vlc_media_library.h
=====================================
@@ -125,16 +125,6 @@ typedef struct vlc_ml_show_t
uint32_t i_nb_seasons;
} vlc_ml_show_t;
-typedef struct vlc_ml_album_track_t
-{
- int64_t i_artist_id;
- int64_t i_album_id;
- int64_t i_genre_id;
-
- int i_track_nb;
- int i_disc_nb;
-} vlc_ml_album_track_t;
-
typedef struct vlc_ml_label_t
{
int64_t i_id;
@@ -224,7 +214,15 @@ typedef struct vlc_ml_media_t
{
vlc_ml_show_episode_t show_episode;
vlc_ml_movie_t movie;
- vlc_ml_album_track_t album_track;
+ struct
+ {
+ int64_t i_artist_id;
+ int64_t i_album_id;
+ int64_t i_genre_id;
+
+ int i_track_nb;
+ int i_disc_nb;
+ } album_track;
};
} vlc_ml_media_t;
=====================================
modules/gui/macosx/library/VLCLibraryAudioDataSource.m
=====================================
@@ -230,12 +230,9 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
NSString *title = mediaItem.title;
NSString *nameOfArtist;
- VLCMediaLibraryAlbumTrack *albumTrack = mediaItem.albumTrack;
- if (albumTrack) {
- VLCMediaLibraryArtist *artist = [VLCMediaLibraryArtist artistWithID:albumTrack.artistID];
- if (artist) {
- nameOfArtist = artist.name;
- }
+ VLCMediaLibraryArtist *artist = [VLCMediaLibraryArtist artistWithID:mediaItem.artistID];
+ if (artist) {
+ nameOfArtist = artist.name;
}
if (title && nameOfArtist) {
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.h
=====================================
@@ -126,19 +126,6 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@end
- at interface VLCMediaLibraryAlbumTrack : NSObject
-
-- (instancetype)initWithAlbumTrack:(struct vlc_ml_album_track_t *)p_albumTrack;
-
- at property (readonly) int64_t artistID;
- at property (readonly) int64_t albumID;
- at property (readonly) int64_t genreID;
-
- at property (readonly) int trackNumber;
- at property (readonly) int discNumber;
-
- at end
-
@interface VLCMediaLibraryGenre : NSObject
- (instancetype)initWithGenre:(struct vlc_ml_genre_t *)p_genre;
@@ -183,7 +170,6 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readonly, nullable) VLCMediaLibraryShowEpisode *showEpisode;
@property (readonly, nullable) VLCMediaLibraryMovie *movie;
- at property (readonly, nullable) VLCMediaLibraryAlbumTrack *albumTrack;
@property (readwrite) int rating;
@property (readwrite) float lastPlaybackRate;
@@ -202,6 +188,14 @@ extern const long long int VLCMediaLibraryMediaItemDurationDenominator;
@property (readwrite) int lastSubtitleTrack;
@property (readwrite) int lastSubtitleDelay;
+ at property (readonly) int64_t artistID;
+ at property (readonly) int64_t albumID;
+ at property (readonly) int64_t genreID;
+
+ at property (readonly) int trackNumber;
+ at property (readonly) int discNumber;
+
+
@end
@interface VLCMediaLibraryEntryPoint : NSObject
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -256,24 +256,6 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
@end
- at implementation VLCMediaLibraryAlbumTrack
-
-- (instancetype)initWithAlbumTrack:(struct vlc_ml_album_track_t *)p_albumTrack
-{
- self = [super init];
- if (self && p_albumTrack != NULL) {
- _artistID = p_albumTrack->i_artist_id;
- _albumID = p_albumTrack->i_album_id;
- _genreID = p_albumTrack->i_genre_id;
-
- _trackNumber = p_albumTrack->i_track_nb;
- _discNumber = p_albumTrack->i_disc_nb;
- }
- return self;
-}
-
- at end
-
@implementation VLCMediaLibraryGenre
- (instancetype)initWithGenre:(struct vlc_ml_genre_t *)p_genre
@@ -403,7 +385,11 @@ NSString *VLCMediaLibraryMediaItemLibraryID = @"VLCMediaLibraryMediaItemLibraryI
break;
case VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK:
- _albumTrack = [[VLCMediaLibraryAlbumTrack alloc] initWithAlbumTrack:&p_mediaItem->album_track];
+ _artistID = p_mediaItem->album_track.i_artist_id;
+ _albumID = p_mediaItem->album_track.i_album_id;
+ _genreID = p_mediaItem->album_track.i_genre_id;
+ _trackNumber = p_mediaItem->album_track.i_track_nb;
+ _discNumber = p_mediaItem->album_track.i_disc_nb;
break;
default:
=====================================
modules/misc/medialibrary/MetadataExtractor.cpp
=====================================
@@ -142,17 +142,17 @@ void MetadataExtractor::populateItem( medialibrary::parser::IItem& item, input_i
{
case AUDIO_ES:
t.type = medialibrary::parser::IItem::Track::Type::Audio;
- t.a.nbChannels = p_es->audio.i_channels;
- t.a.rate = p_es->audio.i_rate;
+ t.u.a.nbChannels = p_es->audio.i_channels;
+ t.u.a.rate = p_es->audio.i_rate;
break;
case VIDEO_ES:
t.type = medialibrary::parser::IItem::Track::Type::Video;
- t.v.fpsNum = p_es->video.i_frame_rate;
- t.v.fpsDen = p_es->video.i_frame_rate_base;
- t.v.width = p_es->video.i_width;
- t.v.height = p_es->video.i_height;
- t.v.sarNum = p_es->video.i_sar_num;
- t.v.sarDen = p_es->video.i_sar_den;
+ t.u.v.fpsNum = p_es->video.i_frame_rate;
+ t.u.v.fpsDen = p_es->video.i_frame_rate_base;
+ t.u.v.width = p_es->video.i_width;
+ t.u.v.height = p_es->video.i_height;
+ t.u.v.sarNum = p_es->video.i_sar_num;
+ t.u.v.sarDen = p_es->video.i_sar_den;
break;
default:
continue;
=====================================
modules/misc/medialibrary/entities.cpp
=====================================
@@ -31,7 +31,6 @@
#include <medialibrary/IShowEpisode.h>
#include <medialibrary/IArtist.h>
#include <medialibrary/IAlbum.h>
-#include <medialibrary/IAlbumTrack.h>
#include <medialibrary/IGenre.h>
#include <medialibrary/ILabel.h>
#include <medialibrary/IMediaGroup.h>
@@ -100,16 +99,6 @@ static bool convertThumbnails( const T input, vlc_ml_thumbnail_t *output )
return true;
}
-bool Convert( const medialibrary::IAlbumTrack* input, vlc_ml_album_track_t& output )
-{
- output.i_artist_id = input->artistId();
- output.i_album_id = input->albumId();
- output.i_disc_nb = input->discNumber();
- output.i_genre_id = input->genreId();
- output.i_track_nb = input->trackNumber();
- return true;
-}
-
bool Convert( const medialibrary::IShowEpisode* input, vlc_ml_show_episode_t& output )
{
output.i_episode_nb = input->episodeId();
@@ -194,11 +183,11 @@ bool Convert( const medialibrary::IMedia* input, vlc_ml_media_t& output )
case medialibrary::IMedia::SubType::AlbumTrack:
{
output.i_subtype = VLC_ML_MEDIA_SUBTYPE_ALBUMTRACK;
- auto albumTrack = input->albumTrack();
- if ( albumTrack == nullptr )
- return false;
- if ( Convert( albumTrack.get(), output.album_track ) == false )
- return false;
+ output.album_track.i_artist_id = input->artistId();
+ output.album_track.i_album_id = input->albumId();
+ output.album_track.i_disc_nb = input->discNumber();
+ output.album_track.i_genre_id = input->genreId();
+ output.album_track.i_track_nb = input->trackNumber();
break;
}
case medialibrary::IMedia::SubType::Unknown:
@@ -533,21 +522,18 @@ input_item_t* MediaToInputItem( const medialibrary::IMedia* media )
{
if ( media->subType() != medialibrary::IMedia::SubType::AlbumTrack )
break;
- auto track = media->albumTrack();
- if ( track == nullptr )
- return nullptr;
- auto album = track->album();
+ auto album = media->album();
if ( album == nullptr )
return nullptr;
- auto artist = track->artist();
+ auto artist = media->artist();
if ( artist == nullptr )
return nullptr;
// From the track itself:
input_item_SetTitle( inputItem.get(), media->title().c_str() );
input_item_SetDiscNumber( inputItem.get(),
- std::to_string( track->discNumber() ).c_str() );
+ std::to_string( media->discNumber() ).c_str() );
input_item_SetTrackNumber( inputItem.get(),
- std::to_string( track->trackNumber() ).c_str() );
+ std::to_string( media->trackNumber() ).c_str() );
// From the album:
input_item_SetTrackTotal( inputItem.get(),
=====================================
modules/misc/medialibrary/fs/fs.cpp
=====================================
@@ -39,18 +39,21 @@ namespace vlc {
using namespace ::medialibrary;
SDFileSystemFactory::SDFileSystemFactory(vlc_object_t *parent,
- IMediaLibrary* ml,
const std::string &scheme)
: m_parent(parent)
- , m_ml( ml )
, m_scheme(scheme)
- , m_deviceLister( m_ml->deviceLister( scheme ) )
, m_callbacks( nullptr )
{
m_isNetwork = strncasecmp( m_scheme.c_str(), "file://",
m_scheme.length() ) != 0;
}
+bool SDFileSystemFactory::initialize(const IMediaLibrary* ml)
+{
+ m_deviceLister = ml->deviceLister(m_scheme);
+ return m_deviceLister != nullptr;
+}
+
std::shared_ptr<fs::IDirectory>
SDFileSystemFactory::createDirectory(const std::string &mrl)
{
=====================================
modules/misc/medialibrary/fs/fs.h
=====================================
@@ -45,9 +45,11 @@ using namespace ::medialibrary::fs;
class SDFileSystemFactory : public IFileSystemFactory, private IDeviceListerCb {
public:
SDFileSystemFactory(vlc_object_t *m_parent,
- IMediaLibrary* ml,
const std::string &scheme);
+ bool
+ initialize( const IMediaLibrary* ml ) override;
+
std::shared_ptr<IDirectory>
createDirectory(const std::string &mrl) override;
@@ -100,7 +102,6 @@ private:
private:
vlc_object_t *const m_parent;
- IMediaLibrary* m_ml;
const std::string m_scheme;
std::shared_ptr<IDeviceLister> m_deviceLister;
IFileSystemFactoryCb *m_callbacks;
=====================================
modules/misc/medialibrary/medialibrary.cpp
=====================================
@@ -32,7 +32,6 @@
#include "fs/devicelister.h"
#include <medialibrary/IMedia.h>
-#include <medialibrary/IAlbumTrack.h>
#include <medialibrary/IAlbum.h>
#include <medialibrary/IArtist.h>
#include <medialibrary/IGenre.h>
@@ -252,6 +251,21 @@ void MediaLibrary::onBookmarksDeleted( std::set<int64_t> bookmarkIds )
VLC_ML_EVENT_BOOKMARKS_DELETED );
}
+void MediaLibrary::onFoldersAdded( std::vector<medialibrary::FolderPtr> )
+{
+
+}
+
+void MediaLibrary::onFoldersModified( std::set<int64_t> )
+{
+
+}
+
+void MediaLibrary::onFoldersDeleted( std::set<int64_t> )
+{
+
+}
+
void MediaLibrary::onDiscoveryStarted()
{
vlc_ml_event_t ev;
@@ -385,7 +399,21 @@ MediaLibrary* MediaLibrary::create( vlc_medialibrary_module_t* vlc_ml )
auto mlDir = std::string{ userDir.get() } + "/ml/";
auto dbPath = mlDir + "ml.db";
auto mlFolderPath = mlDir + "mlstorage/";
- auto ml = NewMediaLibrary( dbPath.c_str(), mlFolderPath.c_str(), true );
+ medialibrary::SetupConfig cfg;
+ cfg.deviceListers = { { "smb://", std::make_shared<vlc::medialibrary::DeviceLister>(
+ VLC_OBJECT(vlc_ml) ) } };
+ cfg.fsFactories = {
+ std::make_shared<vlc::medialibrary::SDFileSystemFactory>(
+ VLC_OBJECT( vlc_ml ), "file://"),
+ std::make_shared<vlc::medialibrary::SDFileSystemFactory>(
+ VLC_OBJECT( vlc_ml ), "smb://")
+ };
+
+ cfg.parserServices = {
+ std::make_shared<MetadataExtractor>( VLC_OBJECT( vlc_ml ) )
+ };
+
+ auto ml = NewMediaLibrary( dbPath.c_str(), mlFolderPath.c_str(), true, &cfg );
if ( !ml )
return nullptr;
@@ -409,12 +437,6 @@ bool MediaLibrary::Init()
if( m_initialized )
return true;
- m_ml->registerDeviceLister( std::make_shared<vlc::medialibrary::DeviceLister>(
- VLC_OBJECT(m_vlc_ml) ), "smb://" );
- m_ml->addFileSystemFactory( std::make_shared<vlc::medialibrary::SDFileSystemFactory>(
- VLC_OBJECT( m_vlc_ml ), m_ml.get(), "file://") );
- m_ml->addFileSystemFactory( std::make_shared<vlc::medialibrary::SDFileSystemFactory>(
- VLC_OBJECT( m_vlc_ml ), m_ml.get(), "smb://") );
auto initStatus = m_ml->initialize( this );
switch ( initStatus )
{
@@ -453,7 +475,6 @@ bool MediaLibrary::Init()
}
}
- m_ml->addParserService( std::make_shared<MetadataExtractor>( VLC_OBJECT( m_vlc_ml ) ) );
try
{
m_ml->addThumbnailer( std::make_shared<Thumbnailer>( m_vlc_ml ) );
@@ -1369,7 +1390,8 @@ int MediaLibrary::controlMedia( int query, va_list args )
switch( query )
{
case VLC_ML_MEDIA_UPDATE_PROGRESS:
- if ( m->setLastPosition( va_arg( args, double ) ) == false )
+ if ( m->setLastPosition( va_arg( args, double ) ) ==
+ medialibrary::IMedia::ProgressResult::Error )
return VLC_EGENERIC;
return VLC_SUCCESS;
case VLC_ML_MEDIA_GET_MEDIA_PLAYBACK_STATE:
@@ -1857,7 +1879,7 @@ int MediaLibrary::listPlaylist( int listQuery, const medialibrary::QueryParamete
if ( pattern != nullptr )
query = m_ml->searchPlaylists( pattern, paramsPtr );
else
- query = m_ml->playlists( paramsPtr );
+ query = m_ml->playlists( medialibrary::PlaylistType::All, paramsPtr );
if ( query == nullptr )
return VLC_EGENERIC;
switch ( listQuery )
=====================================
modules/misc/medialibrary/medialibrary.h
=====================================
@@ -217,6 +217,9 @@ public:
virtual void onBookmarksAdded( std::vector<medialibrary::BookmarkPtr> bookmarks ) override;
virtual void onBookmarksModified( std::set<int64_t> bookmarksIds ) override;
virtual void onBookmarksDeleted( std::set<int64_t> bookmarksIds ) override;
+ virtual void onFoldersAdded( std::vector<medialibrary::FolderPtr> folders ) override;
+ virtual void onFoldersModified( std::set<int64_t> foldersIds ) override;
+ virtual void onFoldersDeleted( std::set<int64_t> foldersIds ) override;
virtual void onDiscoveryStarted() override;
virtual void onDiscoveryProgress(const std::string& entryPoint) override;
virtual void onDiscoveryCompleted() override;
@@ -238,7 +241,6 @@ bool Convert( const medialibrary::IMedia* input, vlc_ml_media_t& output );
bool Convert( const medialibrary::IFile* input, vlc_ml_file_t& output );
bool Convert( const medialibrary::IMovie* input, vlc_ml_movie_t& output );
bool Convert( const medialibrary::IShowEpisode* input, vlc_ml_show_episode_t& output );
-bool Convert( const medialibrary::IAlbumTrack* input, vlc_ml_album_track_t& output );
bool Convert( const medialibrary::IAlbum* input, vlc_ml_album_t& output );
bool Convert( const medialibrary::IArtist* input, vlc_ml_artist_t& output );
bool Convert( const medialibrary::IGenre* input, vlc_ml_genre_t& output );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/54088315e19f6274580bc82734f3037ebd29e6ce...937a1d629b48e12521f92bf98ac6c74a23f6a8e3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/54088315e19f6274580bc82734f3037ebd29e6ce...937a1d629b48e12521f92bf98ac6c74a23f6a8e3
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list