Projects
Staging
vlc-beta
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 384
View file
vlc-beta.spec
Changed
@@ -86,13 +86,6 @@ Provides: vlc-beta-qt-debuginfo = %version-%release BuildRequires: bash -%if 0%{?suse_version} > 1500 -BuildRequires: gcc -BuildRequires: gcc-c++ -%else -BuildRequires: gcc10 -BuildRequires: gcc10-c++ -%endif BuildRequires: flex BuildRequires: bison %if 0%{?suse_version} > 1500 @@ -119,7 +112,7 @@ BuildRequires: pkgconfig(dvdread) >= 6.0.0 BuildRequires: pkgconfig(libplacebo) BuildRequires: pkgconfig(vulkan) >= 1.0.26 -BuildRequires: pkgconfig(libbluray) >= 0.6.2 +BuildRequires: pkgconfig(libbluray) %if %{with vlc_opencv} BuildRequires: pkgconfig(opencv) > 2.0 %endif
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/extras/ci/gitlab-ci.yml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/extras/ci/gitlab-ci.yml
Changed
@@ -20,10 +20,10 @@ variables: VLC_TEST_TIMEOUT: 60 - VLC_WIN64_IMAGE: registry.videolan.org/vlc-debian-win64-posix:20240805192413 + VLC_WIN64_IMAGE: registry.videolan.org/vlc-debian-win64-posix:20240808131936 VLC_WIN_LLVM_MSVCRT_IMAGE: registry.videolan.org/vlc-debian-llvm-msvcrt:20240731083648 VLC_WIN_LLVM_UCRT_IMAGE: registry.videolan.org/vlc-debian-llvm-ucrt:20240731083648 - VLC_DEBIAN_IMAGE: registry.videolan.org/vlc-debian-unstable:20240402131352 + VLC_DEBIAN_IMAGE: registry.videolan.org/vlc-debian-unstable:20240723100046 VLC_ANDROID_IMAGE: registry.videolan.org/vlc-debian-android:20240731083648 VLC_SNAP_IMAGE: registry.videolan.org/vlc-ubuntu-focal:20231013031754 VLC_RASPBIAN_IMAGE: registry.videolan.org/vlc-ubuntu-raspberry:20240806085528
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/include/vlc_meta.h -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/include/vlc_meta.h
Changed
@@ -62,6 +62,13 @@ #define VLC_META_TYPE_COUNT 27 +typedef enum +{ + VLC_META_PRIORITY_BASIC, + VLC_META_PRIORITY_PLAYLIST, + VLC_META_PRIORITY_INBAND +} vlc_meta_priority_t; + #define ITEM_PREPARSED 1 #define ITEM_ART_FETCHED 2 #define ITEM_ART_NOTFOUND 4 @@ -73,7 +80,7 @@ VLC_API vlc_meta_t * vlc_meta_New( void ) VLC_USED; VLC_API void vlc_meta_Delete( vlc_meta_t *m ); -VLC_API void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val ); +VLC_API void vlc_meta_SetWithPriority( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val, vlc_meta_priority_t priority ); VLC_API const char * vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type ); /** @@ -83,8 +90,9 @@ * \param psz_name meta extra name (nonnullable) * \param psz_value meta extra value (nullable) * Removed from meta extra if set to NULL + * \param priority metadata priority (in terms of vlc_meta_priority_t) */ -VLC_API void vlc_meta_SetExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value ); +VLC_API void vlc_meta_SetExtraWithPriority( vlc_meta_t *m, const char *psz_name, const char *psz_value, vlc_meta_priority_t priority ); VLC_API const char * vlc_meta_GetExtra( const vlc_meta_t *m, const char *psz_name ); VLC_API unsigned vlc_meta_GetExtraCount( const vlc_meta_t *m ); @@ -115,6 +123,9 @@ VLC_API int input_item_WriteMeta(vlc_object_t *, input_item_t *); +#define vlc_meta_Set( meta, meta_type, b ) vlc_meta_SetWithPriority( meta, meta_type, b, VLC_META_PRIORITY_BASIC ) +#define vlc_meta_SetExtra( meta, psz_name, psz_value ) vlc_meta_SetExtraWithPriority( meta, psz_name, psz_value, VLC_META_PRIORITY_BASIC ) + /* Setters for meta. * Warning: Make sure to use the input_item meta setters (defined in vlc_input_item.h) * instead of those one. */
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/audio_output/apple/avsamplebuffer.m -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/audio_output/apple/avsamplebuffer.m
Changed
@@ -253,6 +253,12 @@ _outChainLast = &_outChain; CMSampleBufferRef buffer = self wrapBuffer:█ + if (buffer == nil) + { + vlc_mutex_unlock(&_bufferLock); + return; + } + _ptsSamples += CMSampleBufferGetNumSamples(buffer); _renderer enqueueSampleBuffer:buffer; @@ -298,6 +304,12 @@ vlc_cond_signal(&_bufferWait); vlc_mutex_unlock(&_bufferLock); + + if (_renderer.status == AVQueuedSampleBufferRenderingStatusFailed) + { + msg_Err(_aout, "AVQueuedSampleBufferRenderingStatusFailed, restarting"); + aout_RestartRequest(_aout, false); + } } - (void)stopSyncRenderer @@ -305,9 +317,6 @@ _sync.rate = 0.0f; _sync removeTimeObserver:_observer; - /* From the doc: "Call dispatch_sync after removeTimeObserver: to wait for - * any in-flight blocks to finish executing." */ - dispatch_sync(_timeQueue, ^{}); _renderer stopRequestingMediaData; _renderer flush; @@ -321,6 +330,14 @@ vlc_cond_signal(&_bufferWait); vlc_mutex_unlock(&_bufferLock); + + /* From the doc: "Call dispatch_sync after removeTimeObserver: to wait for + * any in-flight blocks to finish executing." */ + dispatch_sync(_timeQueue, ^{}); + + /* Not in any doc:, stopRequestingMediaData() and flush() won't wait for + * any blocks to finish executing, so wait here. */ + dispatch_sync(_dataQueue, ^{}); } - (void)stop
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/Makefile.am -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/Makefile.am
Changed
@@ -246,6 +246,8 @@ network/mediatreelistener.hpp \ network/devicesourceprovider.cpp \ network/devicesourceprovider.hpp \ + network/networkbasemodel.cpp \ + network/networkbasemodel.hpp \ network/networkdevicemodel.cpp \ network/networkdevicemodel.hpp \ network/networksourcesmodel.cpp \ @@ -442,6 +444,7 @@ menus/menus.moc.cpp \ network/devicesourceprovider.moc.cpp \ network/networkdevicemodel.moc.cpp \ + network/networkbasemodel.moc.cpp \ network/networksourcesmodel.moc.cpp \ network/networkmediamodel.moc.cpp \ network/servicesdiscoverymodel.moc.cpp \
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/compositor.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/compositor.cpp
Changed
@@ -200,12 +200,23 @@ p_wnd->sys = this; p_wnd->ops = &ops; p_wnd->info.has_double_click = true; + + // These need to be connected here, since the compositor might not be ready when + // these signals are emitted. VOut window might not be set, or worse, compositor's + // internal preparations might not be completed yet: + connect(m_videoSurfaceProvider.get(), &VideoSurfaceProvider::surfacePositionChanged, + this, &CompositorVideo::onSurfacePositionChanged, Qt::UniqueConnection); + connect(m_videoSurfaceProvider.get(), &VideoSurfaceProvider::surfaceSizeChanged, + this, &CompositorVideo::onSurfaceSizeChanged, Qt::UniqueConnection); } void CompositorVideo::windowDestroy() { if (m_destroyCb) m_destroyCb(m_wnd); + + m_videoSurfaceProvider.reset(); + m_videoWindowHandler.reset(); } void CompositorVideo::windowResize(unsigned width, unsigned height) @@ -252,10 +263,6 @@ if (flags & CompositorVideo::CAN_SHOW_PIP) { m_mainCtx->setCanShowVideoPIP(true); - connect(m_videoSurfaceProvider.get(), &VideoSurfaceProvider::surfacePositionChanged, - this, &CompositorVideo::onSurfacePositionChanged); - connect(m_videoSurfaceProvider.get(), &VideoSurfaceProvider::surfaceSizeChanged, - this, &CompositorVideo::onSurfaceSizeChanged); } if (flags & CompositorVideo::HAS_ACRYLIC) { @@ -316,8 +323,6 @@ void CompositorVideo::commonIntfDestroy() { - m_videoWindowHandler.reset(); - m_videoSurfaceProvider.reset(); unloadGUI(); }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/mainctx.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/mainctx.cpp
Changed
@@ -552,16 +552,6 @@ return urlToDisplayString(mrl); } -void MainCtx::setMediaLibraryVisible( bool visible ) -{ - if (m_mediaLibraryVisible == visible) - return; - - m_mediaLibraryVisible = visible; - - emit mediaLibraryVisibleChanged(visible); -} - void MainCtx::setPlaylistDocked( bool docked ) { b_playlistDocked = docked;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/mainctx.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/mainctx.hpp
Changed
@@ -45,6 +45,7 @@ Q_MOC_INCLUDE( "util/csdbuttonmodel.hpp" ) Q_MOC_INCLUDE( "playlist/playlist_controller.hpp" ) Q_MOC_INCLUDE( "maininterface/mainctx_submodels.hpp" ) +Q_MOC_INCLUDE( "maininterface/videosurface.hpp" ) class CSDButtonModel; class QSettings; @@ -94,8 +95,6 @@ { Q_OBJECT - Q_PROPERTY(bool mediaLibraryVisible READ isMediaLibraryVisible WRITE setMediaLibraryVisible - NOTIFY mediaLibraryVisibleChanged FINAL) Q_PROPERTY(bool playlistDocked READ isPlaylistDocked WRITE setPlaylistDocked NOTIFY playlistDockedChanged FINAL) Q_PROPERTY(bool playlistVisible READ isPlaylistVisible WRITE setPlaylistVisible NOTIFY playlistVisibleChanged FINAL) Q_PROPERTY(double playlistWidthFactor READ getPlaylistWidthFactor WRITE setPlaylistWidthFactor NOTIFY playlistWidthFactorChanged FINAL) @@ -127,6 +126,7 @@ Q_PROPERTY(bool useGlobalShortcuts READ getUseGlobalShortcuts WRITE setUseGlobalShortcuts NOTIFY useGlobalShortcutsChanged FINAL) Q_PROPERTY(int maxVolume READ maxVolume NOTIFY maxVolumeChanged FINAL) Q_PROPERTY(float safeArea READ safeArea NOTIFY safeAreaChanged FINAL) + Q_PROPERTY(VideoSurfaceProvider* videoSurfaceProvider READ getVideoSurfaceProvider WRITE setVideoSurfaceProvider NOTIFY hasEmbededVideoChanged FINAL) Q_PROPERTY(CSDButtonModel *csdButtonModel READ csdButtonModel CONSTANT FINAL) @@ -191,7 +191,6 @@ Q_ENUM(OsType) inline QWindow::Visibility interfaceVisibility() const { return m_windowVisibility; } - bool isMediaLibraryVisible() { return m_mediaLibraryVisible; } bool isPlaylistDocked() { return b_playlistDocked; } bool isPlaylistVisible() { return m_playlistVisible; } inline double getPlaylistWidthFactor() const { return m_playlistWidthFactor; } @@ -339,7 +338,6 @@ QUrl m_dialogFilepath; /* Last path used in dialogs */ /* States */ - bool m_mediaLibraryVisible = true; bool m_playlistVisible = false; ///< Is the playlist visible ? double m_playlistWidthFactor = 4.; ///< playlist size: root.width / playlistScaleFactor double m_playerPlaylistWidthFactor = 4.; @@ -375,7 +373,6 @@ public slots: void toggleToolbarMenu(); void toggleInterfaceFullScreen(); - void setMediaLibraryVisible( bool ); void setPlaylistDocked( bool ); void setPlaylistVisible( bool ); void setPlaylistWidthFactor( double ); @@ -419,7 +416,6 @@ void askRaise(); void kc_pressed(); /* easter eggs */ - void mediaLibraryVisibleChanged(bool); void playlistDockedChanged(bool); void playlistVisibleChanged(bool); void playlistWidthFactorChanged(double); @@ -467,6 +463,9 @@ void windowSuportExtendedFrameChanged(); void windowExtendedMarginChanged(unsigned margin); + void requestShowMainView(); + void requestShowPlayerView(); + private: void loadPrefs(bool callSignals); void loadFromSettingsImpl(bool callSignals);
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/qml/BannerSources.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/qml/BannerSources.qml
Changed
@@ -475,6 +475,7 @@ Menus.QmlGlobalMenu { id: contextMenu ctx: MainCtx + playerViewVisible: History.match(History.viewPath, "player") } } }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/qml/MainDisplay.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/qml/MainDisplay.qml
Changed
@@ -83,6 +83,11 @@ _showMiniPlayer = true } + Component.onCompleted: { + if (MainCtx.canShowVideoPIP) + pipPlayerComponent.createObject(this) + } + Navigation.cancelAction: function() { History.previous(Qt.BacktabFocusReason) } @@ -465,36 +470,40 @@ } } - PIPPlayer { - id: playerPip - anchors { - bottom: miniPlayer.top - left: parent.left - bottomMargin: VLCStyle.margin_normal - leftMargin: VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin - } + Component { + id: pipPlayerComponent - width: VLCStyle.dp(320, VLCStyle.scale) - height: VLCStyle.dp(180, VLCStyle.scale) - z: 2 - visible: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo - enabled: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo - - dragXMin: 0 - dragXMax: g_mainDisplay.width - playerPip.width - dragYMin: sourcesBanner.y + sourcesBanner.height - dragYMax: miniPlayer.y - playerPip.height - - //keep the player visible on resize - Connections { - target: g_mainDisplay - function onWidthChanged() { - if (playerPip.x > playerPip.dragXMax) - playerPip.x = playerPip.dragXMax + PIPPlayer { + id: playerPip + anchors { + bottom: miniPlayer.top + left: parent.left + bottomMargin: VLCStyle.margin_normal + leftMargin: VLCStyle.margin_normal + VLCStyle.applicationHorizontalMargin } - function onHeightChanged() { - if (playerPip.y > playerPip.dragYMax) - playerPip.y = playerPip.dragYMax + + width: VLCStyle.dp(320, VLCStyle.scale) + height: VLCStyle.dp(180, VLCStyle.scale) + z: 2 + visible: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo + enabled: g_mainDisplay._showMiniPlayer && MainCtx.hasEmbededVideo + + dragXMin: 0 + dragXMax: g_mainDisplay.width - playerPip.width + dragYMin: sourcesBanner.y + sourcesBanner.height + dragYMax: miniPlayer.y - playerPip.height + + //keep the player visible on resize + Connections { + target: g_mainDisplay + function onWidthChanged() { + if (playerPip.x > playerPip.dragXMax) + playerPip.x = playerPip.dragXMax + } + function onHeightChanged() { + if (playerPip.y > playerPip.dragYMax) + playerPip.y = playerPip.dragYMax + } } } }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/qml/MainInterface.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/qml/MainInterface.qml
Changed
@@ -167,31 +167,21 @@ Connections { target: MainCtx - function onMediaLibraryVisibleChanged() { - if (MainCtx.mediaLibraryVisible) { - if (History.match(History.viewPath, "mc")) - return - - // NOTE: Useful when we started the application on the 'player' view. - if (History.previousEmpty) { - if (MainCtx.hasEmbededVideo && MainCtx.canShowVideoPIP === false) - MainPlaylistController.stop() + function onRequestShowMainView() { + if (History.match(History.viewPath, "mc")) + return - _pushHome() - - return - } + if (MainCtx.hasEmbededVideo && MainCtx.canShowVideoPIP === false) + MainPlaylistController.stop() - if (MainCtx.hasEmbededVideo && MainCtx.canShowVideoPIP === false) - MainPlaylistController.stop() + _pushHome() + } - History.previous() - } else { - if (History.match(History.viewPath, "player")) - return + function onRequestShowPlayerView() { + if (History.match(History.viewPath, "player")) + return - History.push("player") - } + History.push("player") } }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/videosurface.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/videosurface.cpp
Changed
@@ -209,18 +209,14 @@ setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::AllButtons); setFlag(ItemAcceptsInputMethod, true); - setFlag(ItemHasContents, true); -} -MainCtx* VideoSurface::getCtx() -{ - return m_ctx; -} + { + connect(this, &QQuickItem::widthChanged, this, &VideoSurface::updateSurfaceSize); + connect(this, &QQuickItem::heightChanged, this, &VideoSurface::updateSurfaceSize); -void VideoSurface::setCtx(MainCtx* ctx) -{ - m_ctx = ctx; - emit ctxChanged(ctx); + connect(this, &QQuickItem::xChanged, this, &VideoSurface::updateSurfacePosition); + connect(this, &QQuickItem::yChanged, this, &VideoSurface::updateSurfacePosition); + } } int VideoSurface::qtMouseButton2VLC( Qt::MouseButton qtButton ) @@ -306,12 +302,6 @@ event->ignore(); } -void VideoSurface::geometryChange(const QRectF& newGeometry, const QRectF& oldGeometry) -{ - QQuickItem::geometryChange(newGeometry, oldGeometry); - onSurfaceSizeChanged(); -} - #if QT_CONFIG(wheelevent) void VideoSurface::wheelEvent(QWheelEvent *event) { @@ -330,97 +320,75 @@ setCursor(shape); } -QSGNode*VideoSurface::updatePaintNode(QSGNode* oldNode, QQuickItem::UpdatePaintNodeData* data) +void VideoSurface::updatePolish() { - const auto node = ViewBlockingRectangle::updatePaintNode(oldNode, data); + QQuickItem::updatePolish(); - if (m_provider == nullptr) + if (m_sizeDirty) { - if (m_ctx == nullptr) - return node; - m_provider = m_ctx->getVideoSurfaceProvider(); - if (!m_provider) - return node; - - //forward signal to the provider - connect(this, &VideoSurface::mouseMoved, m_provider, &VideoSurfaceProvider::onMouseMoved); - connect(this, &VideoSurface::mousePressed, m_provider, &VideoSurfaceProvider::onMousePressed); - connect(this, &VideoSurface::mouseDblClicked, m_provider, &VideoSurfaceProvider::onMouseDoubleClick); - connect(this, &VideoSurface::mouseReleased, m_provider, &VideoSurfaceProvider::onMouseReleased); - connect(this, &VideoSurface::mouseWheeled, m_provider, &VideoSurfaceProvider::onMouseWheeled); - connect(this, &VideoSurface::keyPressed, m_provider, &VideoSurfaceProvider::onKeyPressed); - connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::onSurfaceSizeChanged); - connect(this, &VideoSurface::surfacePositionChanged, m_provider, &VideoSurfaceProvider::surfacePositionChanged); - - connect(m_provider, &VideoSurfaceProvider::hasVideoEmbedChanged, this, &VideoSurface::onProviderVideoChanged); - + emit surfaceSizeChanged(size() * window()->effectiveDevicePixelRatio()); + m_sizeDirty = false; } - updatePositionAndSize(); - return node; -} - -void VideoSurface::componentComplete() -{ - ViewBlockingRectangle::componentComplete(); - connect(this, &QQuickItem::xChanged, this, &VideoSurface::onSurfacePositionChanged); - connect(this, &QQuickItem::yChanged, this, &VideoSurface::onSurfacePositionChanged); - connect(this, &QQuickItem::widthChanged, this, &VideoSurface::onSurfaceSizeChanged); - connect(this, &QQuickItem::heightChanged, this, &VideoSurface::onSurfaceSizeChanged); - connect(this, &VideoSurface::enabledChanged, this, &VideoSurface::updatePositionAndSize); + if (m_positionDirty) + { + QPointF scenePosition = this->mapToScene(QPointF(0,0)); - updatePositionAndSize(); + emit surfacePositionChanged(scenePosition * window()->effectiveDevicePixelRatio()); + m_positionDirty = false; + } } -void VideoSurface::onProviderVideoChanged(bool hasVideo) +void VideoSurface::updateSurfacePosition() { - if (!hasVideo) - return; - updatePositionAndSize(); + m_positionDirty = true; + polish(); } -static qreal dprForWindow(QQuickWindow* quickWindow) +void VideoSurface::updateSurfaceSize() { - if (!quickWindow) - return 1.0; - - QWindow* window = QQuickRenderControl::renderWindowFor(quickWindow); - if (!window) - window = quickWindow; - - return window->devicePixelRatio(); + m_sizeDirty = true; + polish(); } -void VideoSurface::onSurfaceSizeChanged() +void VideoSurface::updateSurfacePositionAndSize() { - if (!isEnabled()) - return; - - qreal dpr = dprForWindow(window()); - - emit surfaceSizeChanged(size() * dpr); + updateSurfacePosition(); + updateSurfaceSize(); } -void VideoSurface::onSurfacePositionChanged() +void VideoSurface::setVideoSurfaceProvider(VideoSurfaceProvider *newVideoSurfaceProvider) { - if (!isEnabled()) + if (m_provider == newVideoSurfaceProvider) return; - qreal dpr = dprForWindow(window()); + if (m_provider) + { + disconnect(m_provider, nullptr, this, nullptr); + } - QPointF scenePosition = this->mapToScene(QPointF(0,0)); + m_provider = newVideoSurfaceProvider; - emit surfacePositionChanged(scenePosition * dpr); -} + if (m_provider) + { + connect(this, &VideoSurface::mouseMoved, m_provider, &VideoSurfaceProvider::onMouseMoved); + connect(this, &VideoSurface::mousePressed, m_provider, &VideoSurfaceProvider::onMousePressed); + connect(this, &VideoSurface::mouseDblClicked, m_provider, &VideoSurfaceProvider::onMouseDoubleClick); + connect(this, &VideoSurface::mouseReleased, m_provider, &VideoSurfaceProvider::onMouseReleased); + connect(this, &VideoSurface::mouseWheeled, m_provider, &VideoSurfaceProvider::onMouseWheeled); + connect(this, &VideoSurface::keyPressed, m_provider, &VideoSurfaceProvider::onKeyPressed); + connect(this, &VideoSurface::surfaceSizeChanged, m_provider, &VideoSurfaceProvider::onSurfaceSizeChanged); + connect(this, &VideoSurface::surfacePositionChanged, m_provider, &VideoSurfaceProvider::surfacePositionChanged); -void VideoSurface::updatePositionAndSize() -{ - if (!isEnabled()) - return; + connect(m_provider, &VideoSurfaceProvider::videoEnabledChanged, this, &VideoSurface::updateSurfacePositionAndSize); - qreal dpr = dprForWindow(window()); + setFlag(ItemHasContents, true); + updateSurfacePositionAndSize(); // Polish is queued anyway, updatePolish() should be called when the initial size is set. + } + else + { + setFlag(ItemHasContents, false); + } - emit surfaceSizeChanged(size() * dpr); - QPointF scenePosition = this->mapToScene(QPointF(0, 0)); - emit surfacePositionChanged(scenePosition * dpr); + emit videoSurfaceProviderChanged(); }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/maininterface/videosurface.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/maininterface/videosurface.hpp
Changed
@@ -98,14 +98,14 @@ class VideoSurface : public ViewBlockingRectangle { Q_OBJECT - Q_PROPERTY(MainCtx* ctx READ getCtx WRITE setCtx NOTIFY ctxChanged FINAL) + Q_PROPERTY(VideoSurfaceProvider* videoSurfaceProvider READ videoSurfaceProvider WRITE setVideoSurfaceProvider NOTIFY videoSurfaceProviderChanged FINAL) Q_PROPERTY(Qt::CursorShape cursorShape READ getCursorShape WRITE setCursorShape RESET unsetCursor FINAL) public: VideoSurface( QQuickItem* parent = nullptr ); - MainCtx* getCtx(); - void setCtx(MainCtx* ctx); + VideoSurfaceProvider* videoSurfaceProvider() const { return m_provider; }; + void setVideoSurfaceProvider(VideoSurfaceProvider *newVideoSurfaceProvider); protected: int qtMouseButton2VLC( Qt::MouseButton qtButton ); @@ -120,18 +120,12 @@ void wheelEvent(QWheelEvent *event) override; #endif - void geometryChange(const QRectF &newGeometry, - const QRectF &oldGeometry) override; - Qt::CursorShape getCursorShape() const; void setCursorShape(Qt::CursorShape); - QSGNode* updatePaintNode(QSGNode *, QQuickItem::UpdatePaintNodeData *) override; - - void componentComplete() override; + void updatePolish() override; signals: - void ctxChanged(MainCtx*); void surfaceSizeChanged(QSizeF); void surfacePositionChanged(QPointF); @@ -142,18 +136,20 @@ void keyPressed(int key, Qt::KeyboardModifiers modifier); void mouseWheeled(const QWheelEvent& event); + void videoSurfaceProviderChanged(); + protected slots: - void onProviderVideoChanged(bool); - void onSurfaceSizeChanged(); - void onSurfacePositionChanged(); - void updatePositionAndSize(); + void updateSurfacePosition(); + void updateSurfaceSize(); + void updateSurfacePositionAndSize(); private: - MainCtx* m_ctx = nullptr; - QPointF m_oldHoverPos; QPointer<VideoSurfaceProvider> m_provider; + + bool m_sizeDirty = false; + bool m_positionDirty = false; }; #endif // VIDEOSURFACE_HPP
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlalbummodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlalbummodel.cpp
Changed
@@ -17,18 +17,10 @@ *****************************************************************************/ #include "mlalbummodel.hpp" +#include "mlhelper.hpp" #include "util/vlctick.hpp" -QHash<QByteArray, vlc_ml_sorting_criteria_t> MLAlbumModel::M_names_to_criteria = { - {"id", VLC_ML_SORTING_DEFAULT}, - {"title", VLC_ML_SORTING_ALPHA}, - {"release_year", VLC_ML_SORTING_RELEASEDATE}, - {"main_artist", VLC_ML_SORTING_ARTIST}, - //{"nb_tracks"}, - {"duration", VLC_ML_SORTING_DURATION} -}; - MLAlbumModel::MLAlbumModel(QObject *parent) : MLBaseModel(parent) { @@ -52,12 +44,14 @@ vlc_ml_sorting_criteria_t MLAlbumModel::nameToCriteria(QByteArray name) const { - return M_names_to_criteria.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLAlbumModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -{ - return M_names_to_criteria.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + {"id", VLC_ML_SORTING_DEFAULT}, + {"title", VLC_ML_SORTING_ALPHA}, + {"release_year", VLC_ML_SORTING_RELEASEDATE}, + {"main_artist", VLC_ML_SORTING_ARTIST}, + // {"nb_tracks"}, + {"duration", VLC_ML_SORTING_DURATION}, + }.value(name, VLC_ML_SORTING_DEFAULT); } void MLAlbumModel::onVlcMlEvent(const MLEvent &event) @@ -98,23 +92,6 @@ MLBaseModel::onVlcMlEvent( event ); } -vlc_ml_sorting_criteria_t MLAlbumModel::roleToCriteria(int role) const -{ - switch (role) - { - case ALBUM_TITLE : - return VLC_ML_SORTING_ALPHA; - case ALBUM_RELEASE_YEAR : - return VLC_ML_SORTING_RELEASEDATE; - case ALBUM_MAIN_ARTIST : - return VLC_ML_SORTING_ARTIST; - case ALBUM_DURATION: - return VLC_ML_SORTING_DURATION; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - QVariant MLAlbumModel::itemRoleData(MLItem *item, const int role) const { auto ml_item = static_cast<MLAlbum *>(item);
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlalbummodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlalbummodel.hpp
Changed
@@ -60,13 +60,9 @@ std::unique_ptr<MLListCacheLoader> createMLLoader() const override; private: - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; void onVlcMlEvent( const MLEvent &event ) override; - static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria; - struct Loader : public MLListCacheLoader::MLOp { using MLListCacheLoader::MLOp::MLOp;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlalbumtrackmodel.cpp
Changed
@@ -20,16 +20,6 @@ #include "util/vlctick.hpp" #include "mlhelper.hpp" -QHash<QByteArray, vlc_ml_sorting_criteria_t> MLAlbumTrackModel::M_names_to_criteria = { - {"id", VLC_ML_SORTING_DEFAULT}, - {"title", VLC_ML_SORTING_ALPHA}, - {"album_title", VLC_ML_SORTING_ALBUM}, - {"track_number", VLC_ML_SORTING_TRACKNUMBER}, - {"release_year", VLC_ML_SORTING_RELEASEDATE}, - {"main_artist", VLC_ML_SORTING_ARTIST}, - {"duration", VLC_ML_SORTING_DURATION} -}; - MLAlbumTrackModel::MLAlbumTrackModel(QObject *parent) : MLBaseModel(parent) { @@ -93,28 +83,17 @@ }; } -vlc_ml_sorting_criteria_t MLAlbumTrackModel::roleToCriteria(int role) const -{ - switch (role) { - case TRACK_TITLE : - return VLC_ML_SORTING_ALPHA; - case TRACK_NUMBER : - return VLC_ML_SORTING_TRACKNUMBER; - case TRACK_DURATION : - return VLC_ML_SORTING_DURATION; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLAlbumTrackModel::nameToCriteria(QByteArray name) const { - return M_names_to_criteria.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLAlbumTrackModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -{ - return M_names_to_criteria.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + {"id", VLC_ML_SORTING_DEFAULT}, + {"title", VLC_ML_SORTING_ALPHA}, + {"album_title", VLC_ML_SORTING_ALBUM}, + {"track_number", VLC_ML_SORTING_TRACKNUMBER}, + {"release_year", VLC_ML_SORTING_RELEASEDATE}, + {"main_artist", VLC_ML_SORTING_ARTIST}, + {"duration", VLC_ML_SORTING_DURATION}, + }.value(name, VLC_ML_SORTING_DEFAULT); } void MLAlbumTrackModel::onVlcMlEvent(const MLEvent &event)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlalbumtrackmodel.hpp
Changed
@@ -62,13 +62,9 @@ std::unique_ptr<MLListCacheLoader> createMLLoader() const override; private: - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; void onVlcMlEvent( const MLEvent &event ) override; - static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria; - struct Loader : public MLListCacheLoader::MLOp { using MLListCacheLoader::MLOp::MLOp;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlartistmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlartistmodel.cpp
Changed
@@ -18,11 +18,6 @@ #include "mlartistmodel.hpp" -QHash<QByteArray, vlc_ml_sorting_criteria_t> MLArtistModel::M_names_to_criteria = { - {"name", VLC_ML_SORTING_ALPHA}, - {"nb_tracks", VLC_ML_SORTING_TRACKNUMBER}, -}; - MLArtistModel::MLArtistModel(QObject *parent) : MLBaseModel(parent) { @@ -64,25 +59,12 @@ }; } -vlc_ml_sorting_criteria_t MLArtistModel::roleToCriteria(int role) const -{ - switch (role) - { - case ARTIST_NAME : - return VLC_ML_SORTING_ALPHA; - default : - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLArtistModel::nameToCriteria(QByteArray name) const { - return M_names_to_criteria.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLArtistModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -{ - return M_names_to_criteria.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + {"name", VLC_ML_SORTING_ALPHA}, + {"nb_tracks", VLC_ML_SORTING_TRACKNUMBER}, + }.value(name, VLC_ML_SORTING_DEFAULT); } void MLArtistModel::onVlcMlEvent(const MLEvent &event)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlartistmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlartistmodel.hpp
Changed
@@ -52,13 +52,9 @@ std::unique_ptr<MLListCacheLoader> createMLLoader() const override; private: - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; void onVlcMlEvent(const MLEvent &event) override; - static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria; - struct Loader : public MLListCacheLoader::MLOp { using MLListCacheLoader::MLOp::MLOp;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlbasemodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlbasemodel.cpp
Changed
@@ -278,14 +278,6 @@ } } -QString MLBaseModel::getFirstSymbol(QString str) -{ - QString ret("#"); - if ( str.length() > 0 && str0.isLetter() ) - ret = str0.toUpper(); - return ret; -} - void MLBaseModel::onVlcMlEvent(void* data, const vlc_ml_event_t* event) { auto self = static_cast<MLBaseModel*>(data);
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlbasemodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlbasemodel.hpp
Changed
@@ -91,14 +91,9 @@ protected: virtual std::unique_ptr<MLListCacheLoader> createMLLoader() const = 0; - virtual vlc_ml_sorting_criteria_t roleToCriteria(int role) const = 0; - static QString getFirstSymbol(QString str); - virtual vlc_ml_sorting_criteria_t nameToCriteria(QByteArray) const { - return VLC_ML_SORTING_DEFAULT; - } - virtual QByteArray criteriaToName(vlc_ml_sorting_criteria_t ) const + virtual vlc_ml_sorting_criteria_t nameToCriteria(QByteArray /* name */) const { - return ""; + return VLC_ML_SORTING_DEFAULT; } MLItem *item(int signedidx) const;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlgenremodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlgenremodel.cpp
Changed
@@ -39,10 +39,6 @@ //------------------------------------------------------------------------------------------------- -QHash<QByteArray, vlc_ml_sorting_criteria_t> MLGenreModel::M_names_to_criteria = { - {"name", VLC_ML_SORTING_ALPHA} -}; - MLGenreModel::MLGenreModel(QObject *parent) : MLBaseModel(parent) { @@ -121,25 +117,11 @@ MLBaseModel::onVlcMlEvent(event); } -vlc_ml_sorting_criteria_t MLGenreModel::roleToCriteria(int role) const -{ - switch (role) - { - case GENRE_NAME: - return VLC_ML_SORTING_ALPHA; - default : - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLGenreModel::nameToCriteria(QByteArray name) const { - return M_names_to_criteria.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLGenreModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -{ - return M_names_to_criteria.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + {"name", VLC_ML_SORTING_ALPHA}, + }.value(name, VLC_ML_SORTING_DEFAULT); } QString MLGenreModel::getCover(MLGenre * genre) const
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlgenremodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlgenremodel.hpp
Changed
@@ -65,9 +65,7 @@ private: void onVlcMlEvent(const MLEvent &event) override; - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; QString getCover(MLGenre * genre) const; @@ -81,9 +79,6 @@ std::vector<std::unique_ptr<MLItem>> load(vlc_medialibrary_t* ml, const vlc_ml_query_params_t* queryParams) const override; std::unique_ptr<MLItem> loadItemById(vlc_medialibrary_t* ml, MLItemId itemId) const override; }; - -private: // Variables - static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria; };
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlhelper.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlhelper.cpp
Changed
@@ -18,9 +18,6 @@ #include "mlhelper.hpp" -// MediaLibrary includes -#include "mlbasemodel.hpp" - #include <QDir> QString toValidLocalFile(const char *mrl) @@ -37,3 +34,11 @@ return displayString; } + +QString getFirstSymbol(const QString &str) +{ + QString ret("#"); + if ( str.length() > 0 && str0.isLetter() ) + ret = str0.toUpper(); + return ret; +}
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlhelper.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlhelper.hpp
Changed
@@ -19,23 +19,17 @@ #ifndef MLHELPER_HPP #define MLHELPER_HPP -#include <memory> - #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include <memory> + #include <vlc_media_library.h> + #include <QString> #include <QUrl> -// Forward declarations -class MLBaseModel; -class MLItem; -class MLItemId; -class CoverGenerator; -class QUrl; - template<typename T> class MLDeleter { @@ -116,4 +110,6 @@ return parentDirUrl; } +QString getFirstSymbol(const QString &); + #endif // MLHELPER_HPP
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlplaylistlistmodel.cpp
Changed
@@ -323,14 +323,6 @@ // Protected MLBaseModel implementation //------------------------------------------------------------------------------------------------- -vlc_ml_sorting_criteria_t MLPlaylistListModel::roleToCriteria(int role) const /* override */ -{ - if (role == PLAYLIST_NAME) - return VLC_ML_SORTING_ALPHA; - else - return VLC_ML_SORTING_DEFAULT; -} - std::unique_ptr<MLListCacheLoader> MLPlaylistListModel::createMLLoader() const /* override */ { return std::make_unique<MLListCacheLoader>(m_mediaLib, std::make_shared<MLPlaylistListModel::Loader>(*this, m_playlistType));
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlplaylistlistmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlplaylistlistmodel.hpp
Changed
@@ -86,8 +86,6 @@ protected: // MLBaseModel implementation QVariant itemRoleData(MLItem* item, int role = Qt::DisplayRole) const override; - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; - std::unique_ptr<MLListCacheLoader> createMLLoader() const override; private: // Functions
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlplaylistmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlplaylistmodel.cpp
Changed
@@ -33,17 +33,6 @@ #include "playlist/playlist_controller.hpp" #include "playlist/media.hpp" -//------------------------------------------------------------------------------------------------- -// Static variables - -static const QHash<QByteArray, vlc_ml_sorting_criteria_t> criterias = -{ - {"id", VLC_ML_SORTING_DEFAULT}, - {"title", VLC_ML_SORTING_ALPHA}, - {"duration", VLC_ML_SORTING_DURATION}, - {"playcount", VLC_ML_SORTING_PLAYCOUNT}, -}; - //================================================================================================= // MLPlaylistModel //================================================================================================= @@ -384,29 +373,14 @@ // Protected MLBaseModel implementation //------------------------------------------------------------------------------------------------- -vlc_ml_sorting_criteria_t MLPlaylistModel::roleToCriteria(int role) const /* override */ -{ - switch (role) - { - case MEDIA_TITLE: - return VLC_ML_SORTING_ALPHA; - case MEDIA_DURATION: - return VLC_ML_SORTING_DURATION; - case MEDIA_PLAYCOUNT: - return VLC_ML_SORTING_PLAYCOUNT; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLPlaylistModel::nameToCriteria(QByteArray name) const /* override */ { - return criterias.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLPlaylistModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const /* override */ -{ - return criterias.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + {"id", VLC_ML_SORTING_DEFAULT}, + {"title", VLC_ML_SORTING_ALPHA}, + {"duration", VLC_ML_SORTING_DURATION}, + {"playcount", VLC_ML_SORTING_PLAYCOUNT}, + }.value(name, VLC_ML_SORTING_DEFAULT); } //-------------------------------------------------------------------------------------------------
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlplaylistmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlplaylistmodel.hpp
Changed
@@ -68,12 +68,8 @@ protected: // MLBaseModel implementation QVariant itemRoleData(MLItem *item, int role = Qt::DisplayRole) const override; - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; - vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; - std::unique_ptr<MLListCacheLoader> createMLLoader() const override; protected: // MLBaseModel reimplementation
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlrecentsmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlrecentsmodel.hpp
Changed
@@ -68,12 +68,6 @@ std::unique_ptr<MLListCacheLoader> createMLLoader() const override; private: - vlc_ml_sorting_criteria_t roleToCriteria( int /* role */ ) const override{ - return VLC_ML_SORTING_DEFAULT; - } - vlc_ml_sorting_criteria_t nameToCriteria( QByteArray /* name */ ) const override{ - return VLC_ML_SORTING_DEFAULT; - } void onVlcMlEvent( const MLEvent &event ) override; struct Loader : public MLListCacheLoader::MLOp
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlurlmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlurlmodel.cpp
Changed
@@ -106,18 +106,6 @@ }); } -vlc_ml_sorting_criteria_t MLUrlModel::roleToCriteria(int role) const -{ - switch (role) { - case URL_URL : - return VLC_ML_SORTING_DEFAULT; - case URL_LAST_PLAYED_DATE : - return VLC_ML_SORTING_LASTMODIFICATIONDATE; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - void MLUrlModel::onVlcMlEvent(const MLEvent &event) { switch (event.i_type)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlurlmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlurlmodel.hpp
Changed
@@ -71,7 +71,6 @@ std::unique_ptr<MLListCacheLoader> createMLLoader() const override; private: - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; void onVlcMlEvent( const MLEvent &event ) override; struct Loader : public MLListCacheLoader::MLOp
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlvideofoldersmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlvideofoldersmodel.cpp
Changed
@@ -42,12 +42,6 @@ static const int MLVIDEOFOLDERSMODEL_COVER_WIDTH = 260 * 3; // 16 / 10 ratio static const int MLVIDEOFOLDERSMODEL_COVER_HEIGHT = 162 * 3; -static const QHash<QByteArray, vlc_ml_sorting_criteria_t> criterias = -{ - { "title", VLC_ML_SORTING_ALPHA }, - { "duration", VLC_ML_SORTING_DURATION } -}; - // Ctor / dtor /* explicit */ MLVideoFoldersModel::MLVideoFoldersModel(QObject * parent) : MLBaseModel(parent) {} @@ -102,28 +96,12 @@ } } -vlc_ml_sorting_criteria_t MLVideoFoldersModel::roleToCriteria(int role) const /* override */ -{ - switch (role) - { - case FOLDER_TITLE: - return VLC_ML_SORTING_ALPHA; - case FOLDER_DURATION: - return VLC_ML_SORTING_DURATION; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLVideoFoldersModel::nameToCriteria(QByteArray name) const /* override */ { - return criterias.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLVideoFoldersModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -/* override */ -{ - return criterias.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + { "title", VLC_ML_SORTING_ALPHA }, + { "duration", VLC_ML_SORTING_DURATION }, + }.value(name, VLC_ML_SORTING_DEFAULT); } std::unique_ptr<MLListCacheLoader>
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlvideofoldersmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlvideofoldersmodel.hpp
Changed
@@ -51,12 +51,8 @@ protected: QVariant itemRoleData(MLItem *item, int role = Qt::DisplayRole) const override; - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; - vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; - std::unique_ptr<MLListCacheLoader> createMLLoader() const override; protected: // MLBaseModel reimplementation
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp
Changed
@@ -44,13 +44,6 @@ static const int MLVIDEOGROUPSMODEL_COVER_WIDTH = 260 * 3; // 16 / 10 ratio static const int MLVIDEOGROUPSMODEL_COVER_HEIGHT = 162 * 3; -static const QHash<QByteArray, vlc_ml_sorting_criteria_t> criterias = -{ - { "title", VLC_ML_SORTING_ALPHA }, - { "duration", VLC_ML_SORTING_DURATION }, - { "date", VLC_ML_SORTING_INSERTIONDATE } -}; - //================================================================================================= // MLVideoGroupsModel //================================================================================================= @@ -144,30 +137,13 @@ } } -vlc_ml_sorting_criteria_t MLVideoGroupsModel::roleToCriteria(int role) const /* override */ -{ - switch (role) - { - case VIDEO_TITLE: - return VLC_ML_SORTING_ALPHA; - case VIDEO_DURATION: - return VLC_ML_SORTING_DURATION; - case GROUP_DATE: - return VLC_ML_SORTING_INSERTIONDATE; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLVideoGroupsModel::nameToCriteria(QByteArray name) const /* override */ { - return criterias.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLVideoGroupsModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -/* override */ -{ - return criterias.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + { "title", VLC_ML_SORTING_ALPHA }, + { "duration", VLC_ML_SORTING_DURATION }, + { "date", VLC_ML_SORTING_INSERTIONDATE }, + }.value(name, VLC_ML_SORTING_DEFAULT); } std::unique_ptr<MLListCacheLoader> MLVideoGroupsModel::createMLLoader() const /* override */
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlvideogroupsmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlvideogroupsmodel.hpp
Changed
@@ -50,12 +50,8 @@ protected: // MLVideoModel reimplementation QVariant itemRoleData(MLItem *item, int role = Qt::DisplayRole) const override; - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; - vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; - std::unique_ptr<MLListCacheLoader> createMLLoader() const override; void onVlcMlEvent(const MLEvent & event) override;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlvideomodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlvideomodel.cpp
Changed
@@ -33,12 +33,6 @@ return list; } -QHash<QByteArray, vlc_ml_sorting_criteria_t> MLVideoModel::M_names_to_criteria = { - {"title", VLC_ML_SORTING_ALPHA}, - {"duration", VLC_ML_SORTING_DURATION}, - {"playcount", VLC_ML_SORTING_PLAYCOUNT}, -}; - MLVideoModel::MLVideoModel(QObject* parent) : MLBaseModel(parent) { @@ -177,29 +171,13 @@ }; } -vlc_ml_sorting_criteria_t MLVideoModel::roleToCriteria(int role) const -{ - switch(role) - { - case VIDEO_TITLE: - return VLC_ML_SORTING_ALPHA; - case VIDEO_DURATION: - return VLC_ML_SORTING_DURATION; - case VIDEO_PLAYCOUNT: - return VLC_ML_SORTING_PLAYCOUNT; - default: - return VLC_ML_SORTING_DEFAULT; - } -} - vlc_ml_sorting_criteria_t MLVideoModel::nameToCriteria(QByteArray name) const { - return M_names_to_criteria.value(name, VLC_ML_SORTING_DEFAULT); -} - -QByteArray MLVideoModel::criteriaToName(vlc_ml_sorting_criteria_t criteria) const -{ - return M_names_to_criteria.key(criteria, ""); + return QHash<QByteArray, vlc_ml_sorting_criteria_t> { + {"title", VLC_ML_SORTING_ALPHA}, + {"duration", VLC_ML_SORTING_DURATION}, + {"playcount", VLC_ML_SORTING_PLAYCOUNT}, + }.value(name, VLC_ML_SORTING_DEFAULT); } // Protected MLBaseModel reimplementation
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/medialibrary/mlvideomodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/medialibrary/mlvideomodel.hpp
Changed
@@ -88,12 +88,8 @@ private: void generateThumbnail(uint64_t id) const; - vlc_ml_sorting_criteria_t roleToCriteria(int role) const override; vlc_ml_sorting_criteria_t nameToCriteria(QByteArray name) const override; - static QHash<QByteArray, vlc_ml_sorting_criteria_t> M_names_to_criteria; - QByteArray criteriaToName(vlc_ml_sorting_criteria_t criteria) const override; - struct Loader : public MLListCacheLoader::MLOp { using MLListCacheLoader::MLOp::MLOp;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/menus/menus.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/menus/menus.cpp
Changed
@@ -281,7 +281,7 @@ * Interface modification, load other interfaces, activate Extensions * \param current, set to NULL for menu creation, else for menu update **/ -void VLCMenuBar::ViewMenu( qt_intf_t *p_intf, QMenu *menu ) +void VLCMenuBar::ViewMenu(qt_intf_t *p_intf, QMenu *menu, std::optional<bool> playerViewVisible) { QAction *action; @@ -300,21 +300,20 @@ if( m && m->parent() == menu ) delete m; } - QString title; + if (playerViewVisible.has_value()) + { + QString title; - if (mi->hasMediaLibrary()) - title = qtr("Media Library"); - else - title = qtr("Browse and Discover"); + if (*playerViewVisible) + title = qtr("Show &main view"); + else + title = qtr("Show &player view"); - action = menu->addAction( -#ifndef __APPLE__ - QIcon( ":/menu/media_library.svg" ), -#endif - title); - action->setCheckable( true ); - connect( action, &QAction::triggered, mi, &MainCtx::setMediaLibraryVisible ); - action->setChecked( mi->isMediaLibraryVisible() ); + action = menu->addAction(title); + + connect( action, &QAction::triggered, mi, *playerViewVisible ? &MainCtx::requestShowMainView + : &MainCtx::requestShowPlayerView ); + } action = menu->addAction( #ifndef __APPLE__
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/menus/menus.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/menus/menus.hpp
Changed
@@ -80,7 +80,7 @@ static void ToolsMenu( qt_intf_t *, QMenu * ); - static void ViewMenu( qt_intf_t *, QMenu *); + static void ViewMenu( qt_intf_t *, QMenu *, std::optional<bool> playerViewVisible = std::nullopt ); static void InterfacesMenu( qt_intf_t *p_intf, QMenu * ); static void ExtensionsMenu( qt_intf_t *p_intf, QMenu * );
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/menus/qml/Menubar.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/menus/qml/Menubar.qml
Changed
@@ -83,6 +83,7 @@ id: menubar ctx: MainCtx menubar: menubarLayout + playerViewVisible: History.match(History.viewPath, "player") onMenuClosed: _menuIndex = -1 onNavigateMenu: (direction) => {
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/menus/qml_menu_wrapper.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/menus/qml_menu_wrapper.cpp
Changed
@@ -235,7 +235,7 @@ /* View menu, a bit different */ submenu = m_menu->addMenu(qtr( "V&iew" )); - ViewMenu( p_intf, submenu ); + ViewMenu( p_intf, submenu, m_playerViewVisible ); submenu = m_menu->addMenu(qtr( "&Help" )); HelpMenu(submenu); @@ -348,11 +348,11 @@ }); } -void QmlMenuBar::popupViewMenu( QQuickItem* button ) +void QmlMenuBar::popupViewMenu(QQuickItem* button ) { popupMenuCommon(button, this(QMenu* menu) { qt_intf_t* p_intf = m_ctx->getIntf(); - ViewMenu( p_intf, menu ); + ViewMenu( p_intf, menu, m_playerViewVisible ); }); }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/menus/qml_menu_wrapper.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/menus/qml_menu_wrapper.hpp
Changed
@@ -117,6 +117,7 @@ { Q_OBJECT SIMPLE_MENU_PROPERTY(MainCtx*, ctx, nullptr) + SIMPLE_MENU_PROPERTY(bool, playerViewVisible, false) Q_PROPERTY(bool shown READ isShown NOTIFY shownChanged FINAL) @@ -131,7 +132,7 @@ void shownChanged(); public slots: - void popup( QPoint pos ); + void popup(QPoint pos); private: std::unique_ptr<QMenu> m_menu; bool m_shown = false; @@ -145,6 +146,7 @@ SIMPLE_MENU_PROPERTY(MainCtx*, ctx, nullptr) SIMPLE_MENU_PROPERTY(QQuickItem*, menubar, nullptr) SIMPLE_MENU_PROPERTY(bool, openMenuOnHover, false) + SIMPLE_MENU_PROPERTY(bool, playerViewVisible, false) public: explicit QmlMenuBar(QObject *parent = nullptr);
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/meson.build -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/meson.build
Changed
@@ -104,6 +104,7 @@ 'menus/qml_menu_wrapper.hpp', 'menus/menus.hpp', 'network/devicesourceprovider.hpp', + 'network/networkbasemodel.hpp', 'network/networkdevicemodel.hpp', 'network/networksourcesmodel.hpp', 'network/networkmediamodel.hpp', @@ -374,6 +375,8 @@ 'network/mediatreelistener.hpp', 'network/devicesourceprovider.cpp', 'network/devicesourceprovider.hpp', + 'network/networkbasemodel.cpp', + 'network/networkbasemodel.hpp', 'network/networkdevicemodel.cpp', 'network/networkdevicemodel.hpp', 'network/networksourcesmodel.cpp',
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/devicesourceprovider.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/devicesourceprovider.hpp
Changed
@@ -32,18 +32,19 @@ #include "mediatreelistener.hpp" //represents an entry of the model -struct NetworkDeviceItem +struct NetworkDeviceItem : public NetworkBaseItem { - NetworkDeviceItem(const SharedInputItem& item, const NetworkDeviceModel::MediaSourcePtr& mediaSource) - : name(qfu(item->psz_name)) - , mainMrl(QUrl::fromEncoded(item->psz_uri)) - , protocol(mainMrl.scheme()) - , type( static_cast<NetworkDeviceModel::ItemType>(item->i_type)) - , mediaSource(mediaSource) - , inputItem(item) + NetworkDeviceItem(const SharedInputItem& item, const NetworkDeviceModel::MediaSourcePtr& source) { + name = qfu(item->psz_name); + mainMrl = QUrl::fromEncoded(item->psz_uri); + protocol = mainMrl.scheme(); + type = static_cast<NetworkDeviceModel::ItemType>(item->i_type); + mediaSource = source; + inputItem = item; + id = qHash(name) ^ qHash(protocol); - mrls.push_back(std::make_pair(mainMrl, mediaSource)); + mrls.push_back(std::make_pair(mainMrl, source)); char* artworkUrl = input_item_GetArtworkURL(inputItem.get()); if (artworkUrl) @@ -54,15 +55,10 @@ } uint id; - QString name; - QUrl mainMrl; std::vector<std::pair<QUrl, NetworkDeviceModel::MediaSourcePtr>> mrls; - QString protocol; - NetworkDeviceModel::ItemType type; NetworkDeviceModel::MediaSourcePtr mediaSource; SharedInputItem inputItem; - QString artwork; -}; + }; using NetworkDeviceItemPtr =std::shared_ptr<NetworkDeviceItem>;
View file
_service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/networkbasemodel.cpp
Added
@@ -0,0 +1,69 @@ +/***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * ( at your option ) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ +#include "networkbasemodel.hpp" + +QVariant NetworkBaseModel::basedata(const NetworkBaseItem& item, int role) const +{ + switch (role) + { + case NETWORK_BASE_NAME: + return item.name; + case NETWORK_BASE_MRL: + return item.mainMrl; + case NETWORK_BASE_TYPE: + return item.type; + case NETWORK_BASE_PROTOCOL: + return item.protocol; + case NETWORK_BASE_ARTWORK: + return item.artwork; + case NETWORK_BASE_ARTWORK_FALLBACK: + return artworkFallbackForType(item.type); + default: + return {}; + }; +} + +QString NetworkBaseModel::artworkFallbackForType(const ItemType type) const +{ + switch (type) { + case TYPE_DISC: + return "qrc:///sd/disc.svg"; + case TYPE_CARD: + return "qrc:///sd/capture-card.svg"; + case TYPE_STREAM: + return "qrc:///sd/stream.svg"; + case TYPE_PLAYLIST: + return "qrc:///sd/playlist.svg"; + case TYPE_FILE: + return "qrc:///sd/file.svg"; + default: + return "qrc:///sd/directory.svg"; + } +} + +QHash<int, QByteArray> NetworkBaseModel::roleNames() const +{ + return { + { NETWORK_BASE_NAME, "name" }, + { NETWORK_BASE_MRL, "mrl" }, + { NETWORK_BASE_TYPE, "type" }, + { NETWORK_BASE_PROTOCOL, "protocol" }, + { NETWORK_BASE_ARTWORK, "artwork" }, + { NETWORK_BASE_ARTWORK_FALLBACK, "artworkFallback" }, + }; +}
View file
_service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/networkbasemodel.hpp
Added
@@ -0,0 +1,80 @@ +/***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * ( at your option ) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifndef NETWORKBASEMODEL_HPP +#define NETWORKBASEMODEL_HPP + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "util/base_model.hpp" +#include <vlc_media_source.h> + +#include <QString> +#include <QUrl> + +struct NetworkBaseItem; +class NetworkBaseModel: public BaseModel +{ + Q_OBJECT + +public: + enum Role { + NETWORK_BASE_NAME = Qt::UserRole + 1, + NETWORK_BASE_MRL, + NETWORK_BASE_TYPE, + NETWORK_BASE_PROTOCOL, + NETWORK_BASE_ARTWORK, + NETWORK_BASE_ARTWORK_FALLBACK, + NETWORK_BASE_MAX + }; + + enum ItemType{ + // qt version of input_item_type_e + TYPE_UNKNOWN = ITEM_TYPE_UNKNOWN, + TYPE_FILE, + TYPE_DIRECTORY, + TYPE_DISC, + TYPE_CARD, + TYPE_STREAM, + TYPE_PLAYLIST, + TYPE_NODE, + }; + Q_ENUM( ItemType ) + + using BaseModel::BaseModel; + + QHash<int, QByteArray> roleNames() const override; + + Q_INVOKABLE QString artworkFallbackForType(const ItemType type) const; + +protected: + QVariant basedata(const NetworkBaseItem& item, int role) const; +}; + +struct NetworkBaseItem +{ + QString name; + QUrl mainMrl; + QString protocol; + NetworkBaseModel::ItemType type; + QString artwork; +}; + +#endif /* NETWORKBASEMODEL_HPP */
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/networkdevicemodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/networkdevicemodel.cpp
Changed
@@ -221,7 +221,7 @@ } NetworkDeviceModel::NetworkDeviceModel( NetworkDeviceModelPrivate* priv, QObject* parent) - : BaseModel(priv, parent) + : NetworkBaseModel(priv, parent) { } @@ -237,36 +237,21 @@ switch ( role ) { - case NETWORK_NAME: - return item->name; - case NETWORK_MRL: - return item->mainMrl; - case NETWORK_TYPE: - return item->type; - case NETWORK_PROTOCOL: - return item->protocol; case NETWORK_SOURCE: return item->mediaSource->description; case NETWORK_TREE: return QVariant::fromValue( NetworkTreeItem(MediaTreePtr{ item->mediaSource->tree }, item->inputItem.get()) ); - case NETWORK_ARTWORK: - return item->artwork; default: - return {}; + return NetworkBaseModel::basedata(*item, role); } } QHash<int, QByteArray> NetworkDeviceModel::roleNames() const { - return { - { NETWORK_NAME, "name" }, - { NETWORK_MRL, "mrl" }, - { NETWORK_TYPE, "type" }, - { NETWORK_PROTOCOL, "protocol" }, - { NETWORK_SOURCE, "source" }, - { NETWORK_TREE, "tree" }, - { NETWORK_ARTWORK, "artwork" }, - }; + QHash<int, QByteArray> roles = NetworkBaseModel::roleNames(); + rolesNETWORK_SOURCE = "source"; + rolesNETWORK_TREE = "tree"; + return roles; } void NetworkDeviceModel::setCtx(MainCtx* ctx)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/networkdevicemodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/networkdevicemodel.hpp
Changed
@@ -28,7 +28,7 @@ #include <vlc_media_source.h> -#include "util/base_model.hpp" +#include "networkbasemodel.hpp" #include "util/shared_input_item.hpp" #include <memory> @@ -38,7 +38,7 @@ class MainCtx; class NetworkDeviceModelPrivate; -class NetworkDeviceModel : public BaseModel +class NetworkDeviceModel : public NetworkBaseModel { Q_OBJECT @@ -49,28 +49,10 @@ public: // Enums enum Role { - NETWORK_NAME = Qt::UserRole + 1, - NETWORK_MRL, - NETWORK_TYPE, - NETWORK_PROTOCOL, - NETWORK_SOURCE, + NETWORK_SOURCE = NetworkBaseModel::NETWORK_BASE_MAX, NETWORK_TREE, - NETWORK_ARTWORK, }; - enum ItemType{ - // qt version of input_item_type_e - TYPE_UNKNOWN = ITEM_TYPE_UNKNOWN, - TYPE_FILE, - TYPE_DIRECTORY, - TYPE_DISC, - TYPE_CARD, - TYPE_STREAM, - TYPE_PLAYLIST, - TYPE_NODE, - }; - Q_ENUM( ItemType ) - enum SDCatType{ // qt version of input_item_type_e CAT_UNDEFINED = 0,
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/networkmediamodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/networkmediamodel.cpp
Changed
@@ -40,17 +40,12 @@ //use the same queue as in mlfoldermodel static const char* const ML_FOLDER_ADD_QUEUE = "ML_FOLDER_ADD_QUEUE"; -struct NetworkMediaItem +struct NetworkMediaItem : public NetworkBaseItem { - QString name; QString uri; - QUrl mainMrl; - QString protocol; bool indexed; - NetworkMediaModel::ItemType type; bool canBeIndexed; NetworkTreeItem tree; - QString artwork; qint64 fileSize; QDateTime fileModified; MLMedia media; @@ -487,7 +482,7 @@ // NetworkMediaModel implementation NetworkMediaModel::NetworkMediaModel( QObject* parent ) - : BaseModel( new NetworkMediaModelPrivate(this), parent ) + : NetworkBaseModel( new NetworkMediaModelPrivate(this), parent ) { } @@ -515,21 +510,13 @@ switch ( role ) { - case NETWORK_NAME: - return item->name; - case NETWORK_MRL: - return item->mainMrl; case NETWORK_INDEXED: return item->indexed; case NETWORK_CANINDEX: return item->canBeIndexed; - case NETWORK_TYPE: - return item->type; - case NETWORK_PROTOCOL: - return item->protocol; case NETWORK_TREE: return QVariant::fromValue( item->tree ); - case NETWORK_ARTWORK: + case NETWORK_BASE_ARTWORK: { if (!item->artwork.isEmpty()) return item->artwork; @@ -570,27 +557,24 @@ return {}; } default: - return {}; + return basedata(*item, role); } } QHash<int, QByteArray> NetworkMediaModel::roleNames() const { - return { - { NETWORK_NAME, "name" }, - { NETWORK_MRL, "mrl" }, - { NETWORK_INDEXED, "indexed" }, - { NETWORK_CANINDEX, "can_index" }, - { NETWORK_TYPE, "type" }, - { NETWORK_PROTOCOL, "protocol" }, - { NETWORK_TREE, "tree" }, - { NETWORK_ARTWORK, "artwork" }, - { NETWORK_FILE_SIZE, "fileSizeRaw64" }, - { NETWORK_FILE_MODIFIED, "fileModified" }, - { NETWORK_MEDIA, "media" }, - { NETWORK_MEDIA_PROGRESS, "progress" }, - { NETWORK_MEDIA_DURATION, "duration" } - }; + auto roles = NetworkBaseModel::roleNames(); + + rolesNETWORK_INDEXED = "indexed"; + rolesNETWORK_CANINDEX = "can_index"; + rolesNETWORK_TREE = "tree"; + rolesNETWORK_FILE_SIZE = "fileSizeRaw64"; + rolesNETWORK_FILE_MODIFIED = "fileModified"; + rolesNETWORK_MEDIA = "media"; + rolesNETWORK_MEDIA_PROGRESS = "progress"; + rolesNETWORK_MEDIA_DURATION = "duration"; + + return roles; } Qt::ItemFlags NetworkMediaModel::flags( const QModelIndex& idx ) const
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/networkmediamodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/networkmediamodel.hpp
Changed
@@ -30,7 +30,7 @@ #include <vlc_cxx_helpers.hpp> #include "util/shared_input_item.hpp" -#include "util/base_model.hpp" +#include "networkbasemodel.hpp" #include <memory> @@ -101,20 +101,15 @@ }; class NetworkMediaModelPrivate; -class NetworkMediaModel : public BaseModel +class NetworkMediaModel : public NetworkBaseModel { Q_OBJECT public: enum Role { - NETWORK_NAME = Qt::UserRole + 1, - NETWORK_MRL, - NETWORK_INDEXED, + NETWORK_INDEXED = NETWORK_BASE_MAX, NETWORK_CANINDEX, - NETWORK_TYPE, - NETWORK_PROTOCOL, NETWORK_TREE, - NETWORK_ARTWORK, NETWORK_FILE_SIZE, NETWORK_FILE_MODIFIED, NETWORK_MEDIA, @@ -122,19 +117,6 @@ NETWORK_MEDIA_DURATION, }; - enum ItemType{ - // qt version of input_item_type_e - TYPE_UNKNOWN = ITEM_TYPE_UNKNOWN, - TYPE_FILE, - TYPE_DIRECTORY, - TYPE_DISC, - TYPE_CARD, - TYPE_STREAM, - TYPE_PLAYLIST, - TYPE_NODE, - }; - Q_ENUM( ItemType ) - Q_PROPERTY(MainCtx* ctx READ getCtx WRITE setCtx NOTIFY ctxChanged) Q_PROPERTY(QVariant tree READ getTree WRITE setTree NOTIFY treeChanged) Q_PROPERTY(QVariantList path READ getPath NOTIFY pathChanged)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/qml/BrowseDeviceView.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/qml/BrowseDeviceView.qml
Changed
@@ -248,7 +248,7 @@ text: qsTr("Name"), - headerDelegate: artworkHeader, + headerDelegate: tableColumns.titleHeaderDelegate, colDelegate: artworkColumn }) } @@ -263,7 +263,7 @@ isSortable: false, - headerDelegate: artworkHeader, + headerDelegate: tableColumns.titleHeaderDelegate, colDelegate: artworkColumn } }, { @@ -309,25 +309,13 @@ onItemDoubleClicked: (index, model) => root.onDoubleClicked(model, index) - Component { - id: artworkHeader - - Widgets.TableHeaderDelegate { - Widgets.IconLabel { - - height: VLCStyle.listAlbumCover_height - width: VLCStyle.listAlbumCover_width - anchors.centerIn: parent + Widgets.TableColumns { + id: tableColumns - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: VLCStyle.icon_tableHeader + titleCover_width: VLCStyle.listAlbumCover_width + titleCover_height: VLCStyle.listAlbumCover_height - text: VLCIcons.album_cover - - color: parent.colorContext.fg.secondary - } - } + showTitleText: false } Component {
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/qml/BrowseTreeDisplay.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/qml/BrowseTreeDisplay.qml
Changed
@@ -94,24 +94,7 @@ defaultText: qsTr("Unknown Share") coverProvider: function(index, data) { - function _baseUri(type) { - switch (type) { - case NetworkMediaModel.TYPE_DISC: - return "qrc:///sd/disc.svg" - case NetworkMediaModel.TYPE_CARD: - return "qrc:///sd/capture-card.svg" - case NetworkMediaModel.TYPE_STREAM: - return "qrc:///sd/stream.svg" - case NetworkMediaModel.TYPE_PLAYLIST: - return "qrc:///sd/playlist.svg" - case NetworkMediaModel.TYPE_FILE: - return "qrc:///sd/file.svg" - default: - return "qrc:///sd/directory.svg" - } - } - - const fallbackImage = SVGColorImage.colorize(_baseUri(data.type)) + const fallbackImage = SVGColorImage.colorize(data.artworkFallback) .background(networkDragItem.colorContext.bg.secondary) .color1(networkDragItem.colorContext.fg.primary) .accent(networkDragItem.colorContext.accent) @@ -209,21 +192,6 @@ MainTableView { id: tableView - property Component thumbnailHeader: Widgets.TableHeaderDelegate { - Widgets.IconLabel { - height: VLCStyle.listAlbumCover_height - width: VLCStyle.listAlbumCover_width - - anchors.centerIn: parent - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font.pixelSize: VLCStyle.icon_tableHeader - text: VLCIcons.album_cover - color: parent.colorContext.fg.secondary - } - } - property Component thumbnailColumn: NetworkThumbnailItem { onPlayClicked: index => playAt(index) } @@ -240,7 +208,7 @@ text: qsTr("Name"), - headerDelegate: thumbnailHeader, + headerDelegate: tableColumns.titleHeaderDelegate, colDelegate: thumbnailColumn }) } @@ -255,7 +223,7 @@ isSortable: false, - headerDelegate: thumbnailHeader, + headerDelegate: tableColumns.titleHeaderDelegate, colDelegate: thumbnailColumn } }, { @@ -331,6 +299,11 @@ Widgets.TableColumns { id: tableColumns + + titleCover_width: VLCStyle.listAlbumCover_width + titleCover_height: VLCStyle.listAlbumCover_height + + showTitleText: false } } }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/qml/NetworkCustomCover.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/qml/NetworkCustomCover.qml
Changed
@@ -45,25 +45,6 @@ // currently shown image property var _image: typeImage.visible ? typeImage : artwork - - function _baseUri(type) { - switch (type) { - case NetworkMediaModel.TYPE_DISC: - return "qrc:///sd/disc.svg" - case NetworkMediaModel.TYPE_CARD: - return "qrc:///sd/capture-card.svg" - case NetworkMediaModel.TYPE_STREAM: - return "qrc:///sd/stream.svg" - case NetworkMediaModel.TYPE_PLAYLIST: - return "qrc:///sd/playlist.svg" - case NetworkMediaModel.TYPE_FILE: - return "qrc:///sd/file.svg" - default: - return "qrc:///sd/directory.svg" - } - } - - Widgets.ScaledImage { // failsafe cover, we show this while loading artwork or if loading fails @@ -83,7 +64,7 @@ if (!networkModel || !visible) return "" - const img = SVGColorImage.colorize(_baseUri(networkModel.type)) + const img = SVGColorImage.colorize(networkModel.artworkFallback) .color1(root.color1) .accent(root.accent)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/qml/NetworkGridItem.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/qml/NetworkGridItem.qml
Changed
@@ -49,24 +49,7 @@ cacheImage: true // we may have network thumbnail fallbackImage: { - const f = function(type) { - switch (type) { - case NetworkMediaModel.TYPE_DISC: - return "qrc:///sd/disc.svg" - case NetworkMediaModel.TYPE_CARD: - return "qrc:///sd/capture-card.svg" - case NetworkMediaModel.TYPE_STREAM: - return "qrc:///sd/stream.svg" - case NetworkMediaModel.TYPE_PLAYLIST: - return "qrc:///sd/playlist.svg" - case NetworkMediaModel.TYPE_FILE: - return "qrc:///sd/file.svg" - default: - return "qrc:///sd/directory.svg" - } - } - - return SVGColorImage.colorize(f(model.type)) + return SVGColorImage.colorize(model.artworkFallback) .color1(root.colorContext.fg.primary) .accent(root.colorContext.accent) .uri()
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/standardpathmodel.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/standardpathmodel.cpp
Changed
@@ -38,19 +38,10 @@ vlc_media_tree_Hold, vlc_media_tree_Release); -struct StandardPathItem +struct StandardPathItem : public NetworkBaseItem { - QString name; - QUrl mrl; - - QString protocol; - - NetworkDeviceModel::ItemType type; - SharedInputItem inputItem; MediaTreePtr tree; - - QUrl artwork; }; using StandardPathItemPtr = std::shared_ptr<StandardPathItem>; @@ -79,7 +70,7 @@ bool ascendingMrl(const StandardPathItemPtr& a, const StandardPathItemPtr& b) { - return (QString::compare(a->mrl.toString(), b->mrl.toString(), Qt::CaseInsensitive) <= 0); + return (QString::compare(a->mainMrl.toString(), b->mainMrl.toString(), Qt::CaseInsensitive) <= 0); } bool descendingName(const StandardPathItemPtr& a, @@ -91,7 +82,7 @@ bool descendingMrl(const StandardPathItemPtr& a, const StandardPathItemPtr& b) { - return (QString::compare(a->mrl.toString(), b->mrl.toString(), Qt::CaseInsensitive) >= 0); + return (QString::compare(a->mainMrl.toString(), b->mainMrl.toString(), Qt::CaseInsensitive) >= 0); } } @@ -130,13 +121,13 @@ Q_Q(StandardPathModel); assert(m_qmlInitializing == false); #ifdef Q_OS_UNIX - addItem(QVLCUserDir(VLC_HOME_DIR), qtr("Home"), QUrl()); + addItem(QVLCUserDir(VLC_HOME_DIR), qtr("Home"), {}); #endif - addItem(QVLCUserDir(VLC_DESKTOP_DIR), qtr("Desktop"), QUrl()); - addItem(QVLCUserDir(VLC_DOCUMENTS_DIR), qtr("Documents"), QUrl()); - addItem(QVLCUserDir(VLC_MUSIC_DIR), qtr("Music"), QUrl()); - addItem(QVLCUserDir(VLC_VIDEOS_DIR), qtr("Videos"), QUrl()); - addItem(QVLCUserDir(VLC_DOWNLOAD_DIR), qtr("Download"), QUrl()); + addItem(QVLCUserDir(VLC_DESKTOP_DIR), qtr("Desktop"), {}); + addItem(QVLCUserDir(VLC_DOCUMENTS_DIR), qtr("Documents"), {}); + addItem(QVLCUserDir(VLC_MUSIC_DIR), qtr("Music"), {}); + addItem(QVLCUserDir(VLC_VIDEOS_DIR), qtr("Videos"), {}); + addItem(QVLCUserDir(VLC_DOWNLOAD_DIR), qtr("Download"), {}); //model is never updated, but this is still needed to fit the LocalListBaseModelPrivate requirements ++m_revision; m_loading = false; @@ -152,14 +143,14 @@ return nullptr; } - void addItem(const QString & path, const QString & name, const QUrl & artwork) + void addItem(const QString & path, const QString & name, const QString& artwork) { QUrl url = QUrl::fromLocalFile(path); auto item = std::make_shared<StandardPathItem>(); item->name = name; - item->mrl = url; + item->mainMrl = url; item->protocol = url.scheme(); item->type = NetworkDeviceModel::TYPE_DIRECTORY; @@ -200,7 +191,7 @@ // Ctor / dtor StandardPathModel::StandardPathModel(QObject * parent) - : BaseModel(new StandardPathModelPrivate(this), parent) + : NetworkBaseModel(new StandardPathModelPrivate(this), parent) { } @@ -208,16 +199,10 @@ QHash<int, QByteArray> StandardPathModel::roleNames() const /* override */ { - return - { - { PATH_NAME, "name" }, - { PATH_MRL, "mrl" }, - { PATH_PROTOCOL, "protocol" }, - { PATH_TYPE, "type" }, - { PATH_SOURCE, "source" }, - { PATH_TREE, "tree" }, - { PATH_ARTWORK, "artwork" } - }; + auto roles = NetworkBaseModel::roleNames(); + rolesPATH_SOURCE = "source"; + rolesPATH_TREE = "tree"; + return roles; } QVariant StandardPathModel::data(const QModelIndex & index, int role) const /* override */ @@ -230,19 +215,9 @@ switch (role) { - case PATH_NAME: - return item->name; - case PATH_MRL: - return item->mrl; - case PATH_PROTOCOL: - return item->protocol; - case PATH_TYPE: - return item->type; case PATH_TREE: return QVariant::fromValue(NetworkTreeItem(item->tree, item->inputItem.get())); - case PATH_ARTWORK: - return item->artwork; default: - return QVariant(); + return NetworkBaseModel::basedata(*item, role); } }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/network/standardpathmodel.hpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/network/standardpathmodel.hpp
Changed
@@ -26,10 +26,10 @@ #endif // VLC includes -#include "util/base_model.hpp" +#include "networkbasemodel.hpp" class StandardPathModelPrivate; -class StandardPathModel : public BaseModel +class StandardPathModel : public NetworkBaseModel { Q_OBJECT @@ -37,11 +37,7 @@ // NOTE: Roles should be aligned with the NetworkDeviceModel. enum Role { - PATH_NAME = Qt::UserRole + 1, - PATH_MRL, - PATH_TYPE, - PATH_PROTOCOL, - PATH_SOURCE, + PATH_SOURCE = NetworkBaseModel::NETWORK_BASE_MAX, PATH_TREE, PATH_ARTWORK };
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/player/qml/PIPPlayer.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/player/qml/PIPPlayer.qml
Changed
@@ -31,8 +31,8 @@ height: VLCStyle.dp(180, VLCStyle.scale) //VideoSurface x,y won't update - onXChanged: videoSurface.onSurfacePositionChanged() - onYChanged: videoSurface.onSurfacePositionChanged() + onXChanged: videoSurface.updateSurfacePosition() + onYChanged: videoSurface.updateSurfacePosition() objectName: "pip window" @@ -93,7 +93,7 @@ background: VideoSurface { id: videoSurface - ctx: MainCtx + videoSurfaceProvider: MainCtx.videoSurfaceProvider } contentItem: Rectangle {
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/player/qml/Player.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/player/qml/Player.qml
Changed
@@ -191,9 +191,10 @@ VideoSurface { id: videoSurface - ctx: MainCtx + videoSurfaceProvider: MainCtx.videoSurfaceProvider + visible: rootPlayer.hasEmbededVideo - enabled: rootPlayer.hasEmbededVideo + anchors.fill: parent anchors.topMargin: rootPlayer._controlsUnderVideo ? topBar.height : 0 anchors.bottomMargin: rootPlayer._controlsUnderVideo ? controlBar.height : 0
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/player/qml/TopBar.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/player/qml/TopBar.qml
Changed
@@ -440,6 +440,7 @@ id: contextMenu ctx: MainCtx + playerViewVisible: History.match(History.viewPath, "player") onAboutToShow: root.requestLockUnlockAutoHide(true) onAboutToHide: root.requestLockUnlockAutoHide(false)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
Changed
@@ -107,13 +107,29 @@ indexes: 0 } - DragHandler { - target: null - onActiveChanged: { - if (active) { - dragItem.Drag.active = true - } else { - dragItem.Drag.drop() + // TODO: Qt bug 6.2: QTBUG-103604 + Item { + anchors.fill: parent + + TapHandler { + gesturePolicy: TapHandler.ReleaseWithinBounds // TODO: Qt 6.2 bug: Use TapHandler.DragThreshold + + grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything + + onTapped: History.push("player") + } + + DragHandler { + target: null + + grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything + + onActiveChanged: { + if (active) { + dragItem.Drag.active = true + } else { + dragItem.Drag.drop() + } } } }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/player/qml/controlbarcontrols/MenuButton.qml -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/player/qml/controlbarcontrols/MenuButton.qml
Changed
@@ -38,6 +38,7 @@ id: contextMenu ctx: MainCtx + playerViewVisible: History.match(History.viewPath, "player") onAboutToShow: menuBtn.requestLockUnlockAutoHide(true) onAboutToHide: menuBtn.requestLockUnlockAutoHide(false)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/gui/qt/qt.cpp -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/gui/qt/qt.cpp
Changed
@@ -902,7 +902,7 @@ // Windows 7 and Windows 8, since it may not support // the default graphics api (Direct3D 11.2). - if (qEnvironmentVariableIsEmpty("QSG_RHI_BACKEND")) + if (qEnvironmentVariableIsEmpty("QSG_RHI_BACKEND") && qEnvironmentVariableIsEmpty("QT_QUICK_BACKEND")) { if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1) {
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/lua/vlc.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/lua/vlc.c
Changed
@@ -95,6 +95,18 @@ return strcmp( *a, *b ); } +/* Function to parse the trusted property of a file */ +static bool file_is_playlist( lua_State *L ) +{ + bool trusted = false; + lua_getfield(L, -1, "trusted"); + if( !lua_isnil(L, -1) && lua_isboolean(L, -1) ) + trusted = lua_toboolean(L, -1); + + lua_pop( L, 1 ); + return trusted; +} + static char **vlclua_dir_list_append( char **restrict list, char *basedir, const char *luadirname ) { @@ -246,6 +258,8 @@ void vlclua_read_meta_data( vlc_object_t *p_this, lua_State *L, input_item_t *p_input ) { + vlc_meta_priority_t priority = file_is_playlist( L )? VLC_META_PRIORITY_PLAYLIST: + VLC_META_PRIORITY_BASIC; #define TRY_META( a, b ) \ lua_getfield( L, -1, a ); \ if( lua_isstring( L, -1 ) && \ @@ -254,16 +268,20 @@ char *psz_value = strdup( lua_tostring( L, -1 ) ); \ EnsureUTF8( psz_value ); \ msg_Dbg( p_this, #b ": %s", psz_value ); \ - input_item_Set ## b ( p_input, psz_value ); \ + vlc_meta_SetWithPriority( p_input->p_meta, \ + vlc_meta_ ## b, \ + psz_value, \ + priority ); \ free( psz_value ); \ } \ lua_pop( L, 1 ); /* pop a */ + vlc_mutex_lock( &p_input->lock ); TRY_META( "title", Title ); TRY_META( "artist", Artist ); TRY_META( "genre", Genre ); TRY_META( "copyright", Copyright ); TRY_META( "album", Album ); - TRY_META( "tracknum", TrackNum ); + TRY_META( "tracknum", TrackNumber ); TRY_META( "description", Description ); TRY_META( "rating", Rating ); TRY_META( "date", Date ); @@ -273,13 +291,14 @@ TRY_META( "nowplaying", NowPlaying ); TRY_META( "publisher", Publisher ); TRY_META( "encodedby", EncodedBy ); - TRY_META( "arturl", ArtURL ); + TRY_META( "arturl", ArtworkURL ); TRY_META( "trackid", TrackID ); TRY_META( "director", Director ); TRY_META( "season", Season ); TRY_META( "episode", Episode ); TRY_META( "show_name", ShowName ); TRY_META( "actors", Actors ); + vlc_mutex_unlock( &p_input->lock ); } #undef vlclua_read_custom_meta_data @@ -311,7 +330,9 @@ const char *psz_key = lua_tostring( L, -2 ); const char *psz_value = lua_tostring( L, -1 ); - vlc_meta_SetExtra( p_input->p_meta, psz_key, psz_value ); + vlc_meta_priority_t priority = file_is_playlist( L )? VLC_META_PRIORITY_PLAYLIST: + VLC_META_PRIORITY_BASIC; + vlc_meta_SetExtraWithPriority( p_input->p_meta, psz_key, psz_value, priority ); lua_pop( L, 1 ); /* pop "value" */ }
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/mux/asf.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/mux/asf.c
Changed
@@ -840,6 +840,7 @@ vlc_tick_t i_duration = 0; int i_size, i_header_ext_size; int i_ci_size, i_cm_size = 0, i_cd_size = 0; + int i_subo_count = 0; /* header sub object count */ block_t *out; bo_t bo; @@ -912,11 +913,17 @@ bo_init( &bo, out->p_buffer, i_size + 50 ); } + /* calculate header sub object count */ + i_subo_count += 1; /* file properties */ + i_subo_count += 1; /* header extension */ + i_subo_count += vlc_array_count( &p_sys->tracks ); /* stream info */ + i_subo_count += 1; /* codec info */ + i_subo_count += (i_cd_size ? 1 : 0); /* content description if any */ + /* header object */ bo_add_guid ( &bo, &asf_object_header_guid ); bo_addle_u64( &bo, i_size ); - bo_addle_u32( &bo, 2 + vlc_array_count( &p_sys->tracks ) + 1 + - (i_cd_size ? 1 : 0) + (i_cm_size ? 1 : 0) ); + bo_addle_u32( &bo, i_subo_count ); bo_add_u8 ( &bo, 1 ); bo_add_u8 ( &bo, 2 );
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/packetizer/h264_slice.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/packetizer/h264_slice.c
Changed
@@ -181,7 +181,7 @@ p_pps->num_ref_idx_l01_default_active_minus11 }; if( i_slice_type == 1 || i_slice_type == 6 ) /* B slices */ - bs_read1( &s ); /* direct_spatial_mv_pred_flag */ + bs_skip( &s, 1 ); /* direct_spatial_mv_pred_flag */ if( i_slice_type == 0 || i_slice_type == 5 || i_slice_type == 3 || i_slice_type == 8 || i_slice_type == 1 || i_slice_type == 6 ) /* P SP B slices */
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/modules/packetizer/mpeg4video.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/modules/packetizer/mpeg4video.c
Changed
@@ -409,7 +409,7 @@ { /* vol control parameter */ bs_skip( &s, 2 ); /* chroma_format */ - bs_read1( &s ); /* low_delay */ + bs_skip( &s, 1 ); /* low_delay */ if( bs_read1( &s ) ) {
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/share/lua/playlist/cue.lua -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/share/lua/playlist/cue.lua
Changed
@@ -74,6 +74,7 @@ t.date = track.date or global.date t.description = global.comment t.tracknum = track.num + t.trusted = true t.options = { ":start-time=" .. track.index01} return t
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/clock/input_clock.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/clock/input_clock.c
Changed
@@ -220,12 +220,15 @@ * i_ck_system: date in system clock *****************************************************************************/ vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log, - bool b_can_pace_control, bool b_buffering_allowed, + bool b_can_pace_control, bool b_buffering, + bool b_extra_buffering_allowed, vlc_tick_t i_ck_stream, vlc_tick_t i_ck_system ) { bool b_reset_reference = false; bool discontinuity = false; + b_can_pace_control |= b_buffering; + assert( i_ck_stream != VLC_TICK_INVALID && i_ck_system != VLC_TICK_INVALID ); if( !cl->b_has_reference ) @@ -233,8 +236,7 @@ /* */ b_reset_reference= true; } - /* Don't check discontinuities if the origin has just been changed */ - else if (cl->last.stream != VLC_TICK_INVALID && !cl->b_origin_changed) + else if (!b_buffering && cl->last.stream != VLC_TICK_INVALID) { assert(cl->last.system != VLC_TICK_INVALID); @@ -245,8 +247,9 @@ vlc_tick_t diff = stream_diff - system_diff; /* A discontinuity happen if stream timings increase much more than - * system timings or if the stream is going backward. */ - if (diff > CR_MAX_GAP || stream_diff < 0) + * system timings or if the stream is going backward. + * Don't compare system timings if the origin has just been changed */ + if ((!cl->b_origin_changed && diff > CR_MAX_GAP) || stream_diff < 0) { /* Stream discontinuity, for which we haven't received a * warning from the stream control facilities (dd-edited @@ -292,7 +295,7 @@ { cl->i_buffering_duration = 0; } - else if( b_buffering_allowed ) + else if( b_extra_buffering_allowed ) { /* Try to bufferize more than necessary by reading * CR_BUFFERING_RATE/256 faster until we have CR_BUFFERING_TARGET. @@ -303,7 +306,7 @@ if( cl->i_buffering_duration > CR_BUFFERING_TARGET ) cl->i_buffering_duration = CR_BUFFERING_TARGET; } - //fprintf( stderr, "input_clock_Update: %d :: %lld\n", b_buffering_allowed, cl->i_buffering_duration/1000 ); + //fprintf( stderr, "input_clock_Update: %d :: %lld\n", b_extra_buffering_allowed, cl->i_buffering_duration/1000 ); /* */ cl->last = clock_point_Create( i_ck_system, i_ck_stream );
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/clock/input_clock.h -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/clock/input_clock.h
Changed
@@ -100,15 +100,17 @@ * \param clock the input clock object to update with the new point * \param p_log the logger object to use * \param b_can_pace_control whether the input can control the speed of playback - * \param b_buffering_allowed tells if we are allowed to bufferize more data in - advanced (if possible). + * \param b_buffering whether the input is buffering + * \param b_extra_buffering_allowed tells if we are allowed to bufferize more + * data in advance (if possible). * \param i_clock the new clock reference value * \param i_system the timestmap at which the new reference has been reported * * \return clock update delay */ vlc_tick_t input_clock_Update( input_clock_t *clock, vlc_object_t *p_log, - bool b_can_pace_control, bool b_buffering_allowed, + bool b_can_pace_control, bool b_buffering, + bool b_extra_buffering_allowed, vlc_tick_t i_clock, vlc_tick_t i_system ); /**
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/input/es_out.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/input/es_out.c
Changed
@@ -3365,7 +3365,7 @@ bool b_extra_buffering_allowed = !b_low_delay && EsOutIsExtraBufferingAllowed(p_sys); vlc_tick_t i_late = input_clock_Update( p_pgrm->p_input_clock, VLC_OBJECT(p_sys->p_input), - input_CanPaceControl(p_sys->p_input) || p_sys->b_buffering, + input_CanPaceControl(p_sys->p_input), p_sys->b_buffering, b_extra_buffering_allowed, i_pcr, vlc_tick_now() );
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/input/input.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/input/input.c
Changed
@@ -897,6 +897,11 @@ priv->master->i_seekpoint_offset; if( val.i_int > 0 /* TODO: check upper boundary */ ) input_ControlPushHelper( p_input, INPUT_CONTROL_SET_SEEKPOINT, &val ); +} + +static void SetStopStart( input_thread_t * p_input ) +{ + input_thread_private_t *priv = input_priv(p_input); /* Start/stop/run time */ priv->i_start = llroundl(CLOCK_FREQ * @@ -1335,6 +1340,7 @@ InitTitle( p_input, false ); + SetStopStart( p_input ); /* Load master infos */ InputSourceStatistics( master, priv->p_item, priv->p_es_out ); @@ -3477,3 +3483,16 @@ input_thread_private_t *priv = input_priv(input); return priv->master->b_can_pace_control; } + +void input_SetItemDuration(input_thread_t *input, vlc_tick_t duration) +{ + input_thread_private_t *priv = input_priv(input); + input_item_t *item = input_GetItem(input); + + if( priv->i_stop == 0 ) /* consider `duration` as stop time, if stop-time not set */ + duration -= priv->i_start; + else /* calculate duration based on start-time and stop-time */ + duration = priv->i_stop - priv->i_start; + + input_item_SetDuration(item, duration); +} \ No newline at end of file
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/input/input_internal.h -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/input/input_internal.h
Changed
@@ -639,6 +639,17 @@ bool input_CanPaceControl(input_thread_t *input); +/** + * Set the duration of the input item. + * + * This function sets the duration of the input item associated with the input thread. + * It uses the 'start-time' and 'stop-time' values to calculate the track duration. + * + * @param input The input thread object. + * @param duration The duration to be set, in vlc_tick_t units. + */ +void input_SetItemDuration(input_thread_t *input, vlc_tick_t duration); + /* Bound pts_delay */ #define INPUT_PTS_DELAY_MAX VLC_TICK_FROM_SEC(60)
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/input/meta.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/input/meta.c
Changed
@@ -36,9 +36,15 @@ #include "../preparser/art.h" #include <vlc_charset.h> +struct vlc_meta_value +{ + vlc_meta_priority_t priority; + char *value; +}; + struct vlc_meta_t { - char * ppsz_metaVLC_META_TYPE_COUNT; + struct vlc_meta_value metaVLC_META_TYPE_COUNT; vlc_dictionary_t extra_tags; @@ -99,23 +105,41 @@ vlc_meta_t *m = (vlc_meta_t*)malloc( sizeof(*m) ); if( !m ) return NULL; - memset( m->ppsz_meta, 0, sizeof(m->ppsz_meta) ); + for( int i = 0; i < VLC_META_TYPE_COUNT ; i++ ) + { + m->metai.value = NULL; + m->metai.priority = VLC_META_PRIORITY_BASIC; + } m->i_status = 0; vlc_dictionary_init( &m->extra_tags, 0 ); return m; } -/* Free a dictionary key allocated by strdup() in vlc_meta_SetExtra() */ +/* Allocate and insert the new value in the dictionary key `psz_name` */ +static void vlc_meta_InsertExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value, vlc_meta_priority_t priority ) +{ + struct vlc_meta_value *meta_value = malloc( sizeof(*meta_value) ); + if( meta_value ) + { + meta_value->value = strdup(psz_value); + meta_value->priority = priority; + vlc_dictionary_insert( &m->extra_tags, psz_name, meta_value ); + } +} + +/* Free a dictionary key allocated by strdup() in vlc_meta_SetExtraWithPriority() */ static void vlc_meta_FreeExtraKey( void *p_data, void *p_obj ) { VLC_UNUSED( p_obj ); - free( p_data ); + struct vlc_meta_value *meta_value = p_data; + free( meta_value->value ); + free( meta_value ); } void vlc_meta_Delete( vlc_meta_t *m ) { for( int i = 0; i < VLC_META_TYPE_COUNT ; i++ ) - free( m->ppsz_metai ); + free( m->metai.value ); vlc_dictionary_clear( &m->extra_tags, vlc_meta_FreeExtraKey, NULL ); free( m ); } @@ -126,32 +150,36 @@ * FIXME - Why don't we merge those two? */ -void vlc_meta_Set( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val ) +void vlc_meta_SetWithPriority( vlc_meta_t *p_meta, vlc_meta_type_t meta_type, const char *psz_val, vlc_meta_priority_t priority ) { - free( p_meta->ppsz_metameta_type ); + free( p_meta->metameta_type.value ); assert( psz_val == NULL || IsUTF8( psz_val ) ); - p_meta->ppsz_metameta_type = psz_val ? strdup( psz_val ) : NULL; + p_meta->metameta_type.value = psz_val ? strdup( psz_val ) : NULL; + p_meta->metameta_type.priority = priority; } const char *vlc_meta_Get( const vlc_meta_t *p_meta, vlc_meta_type_t meta_type ) { - return p_meta->ppsz_metameta_type; + return p_meta->metameta_type.value; } -void vlc_meta_SetExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value ) +void vlc_meta_SetExtraWithPriority( vlc_meta_t *m, const char *psz_name, const char *psz_value, vlc_meta_priority_t priority ) { assert( psz_name ); - char *psz_oldvalue = (char *)vlc_dictionary_value_for_key( &m->extra_tags, psz_name ); - if( psz_oldvalue != kVLCDictionaryNotFound ) + struct vlc_meta_value *old_meta_value = vlc_dictionary_value_for_key( &m->extra_tags, psz_name ); + if( old_meta_value != kVLCDictionaryNotFound ) vlc_dictionary_remove_value_for_key( &m->extra_tags, psz_name, vlc_meta_FreeExtraKey, NULL ); if ( psz_value ) - vlc_dictionary_insert( &m->extra_tags, psz_name, strdup(psz_value) ); + vlc_meta_InsertExtra( m, psz_name, psz_value, priority ); } const char * vlc_meta_GetExtra( const vlc_meta_t *m, const char *psz_name ) { - return (char *)vlc_dictionary_value_for_key(&m->extra_tags, psz_name); + struct vlc_meta_value *meta_value = vlc_dictionary_value_for_key(&m->extra_tags, psz_name); + if( !meta_value ) + return NULL; + return meta_value->value; } unsigned vlc_meta_GetExtraCount( const vlc_meta_t *m ) @@ -188,10 +216,13 @@ for( int i = 0; i < VLC_META_TYPE_COUNT; i++ ) { - if( src->ppsz_metai ) + /* overwrite metadata only when priority of src is + greater than or equal to the priority of dst */ + if( src->metai.value && src->metai.priority >= dst->metai.priority ) { - free( dst->ppsz_metai ); - dst->ppsz_metai = strdup( src->ppsz_metai ); + free( dst->metai.value ); + dst->metai.value = strdup( src->metai.value ); + dst->metai.priority = src->metai.priority; } } @@ -200,10 +231,20 @@ for( int i = 0; ppsz_all_keys && ppsz_all_keysi; i++ ) { /* Always try to remove the previous value */ - vlc_dictionary_remove_value_for_key( &dst->extra_tags, ppsz_all_keysi, vlc_meta_FreeExtraKey, NULL ); + struct vlc_meta_value *dst_meta_value = vlc_dictionary_value_for_key( &dst->extra_tags, ppsz_all_keysi ); + struct vlc_meta_value *src_meta_value = vlc_dictionary_value_for_key( &src->extra_tags, ppsz_all_keysi ); + if( dst_meta_value ) + { + /* overwrite metadata only when priority of src is + greater than or equal to the priority of dst */ + if( src_meta_value->priority < dst_meta_value->priority ) + continue; + + vlc_dictionary_remove_value_for_key( &dst->extra_tags, ppsz_all_keysi, vlc_meta_FreeExtraKey, NULL ); + } + + vlc_meta_InsertExtra( dst, ppsz_all_keysi, src_meta_value->value, src_meta_value->priority ); - void *p_value = vlc_dictionary_value_for_key( &src->extra_tags, ppsz_all_keysi ); - vlc_dictionary_insert( &dst->extra_tags, ppsz_all_keysi, strdup( (const char*)p_value ) ); free( ppsz_all_keysi ); } free( ppsz_all_keys );
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/input/parse.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/input/parse.c
Changed
@@ -56,7 +56,7 @@ switch (event->type) { case INPUT_EVENT_TIMES: - input_item_SetDuration(input_GetItem(input), event->times.length); + input_SetItemDuration(input, event->times.length); break; case INPUT_EVENT_STATE: parser->state = event->state.value;
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/libvlccore.sym -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/libvlccore.sym
Changed
@@ -668,7 +668,7 @@ vlc_join vlc_thread_set_name vlc_list_children -vlc_meta_SetExtra +vlc_meta_SetExtraWithPriority vlc_meta_CopyExtraNames vlc_meta_Delete vlc_meta_Get @@ -677,7 +677,7 @@ vlc_meta_GetStatus vlc_meta_Merge vlc_meta_New -vlc_meta_Set +vlc_meta_SetWithPriority vlc_meta_SetStatus vlc_meta_TypeToLocalizedString vlc_meta_TypeToString
View file
_service:obs_scm:vlc-beta-20240809.4c595eebe8.obscpio/src/player/input.c -> _service:obs_scm:vlc-beta-20240812.9b737741e3.obscpio/src/player/input.c
Changed
@@ -933,7 +933,7 @@ if (input->length != event->times.length) { input->length = event->times.length; - input_item_SetDuration(input_GetItem(input->thread), event->times.length); + input_SetItemDuration(input->thread, event->times.length); vlc_player_SendEvent(player, on_length_changed, input->length); changed = true; }
View file
_service:obs_scm:vlc-beta.obsinfo
Changed
@@ -1,4 +1,4 @@ name: vlc-beta -version: 20240809.4c595eebe8 -mtime: 1723204896 -commit: 4c595eebe8144d3d4537e72d98e2d1f0e5e028aa +version: 20240812.9b737741e3 +mtime: 1723476025 +commit: 9b737741e3afa3cd58e6804e7a33283839276fb8
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.