Skip to content

Commit

Permalink
qt: store the parser internally
Browse files Browse the repository at this point in the history
  • Loading branch information
tguillem authored and robUx4 committed Oct 9, 2024
1 parent cb5ee63 commit d3c65e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions modules/gui/qt/maininterface/mainctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#endif

#include <vlc_interface.h>
#include <vlc_preparser.h>

#define VLC_REFERENCE_SCALE_FACTOR 96.

Expand Down Expand Up @@ -221,6 +222,7 @@ MainCtx::MainCtx(qt_intf_t *_p_intf)
QMetaObject::invokeMethod(m_medialib, &MediaLib::reload, Qt::QueuedConnection);
}

m_preparser = libvlc_GetMainPreparser(libvlc);

#ifdef UPDATE_CHECK
/* Checking for VLC updates */
Expand Down
3 changes: 3 additions & 0 deletions modules/gui/qt/maininterface/mainctx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class VLCVarChoiceModel;
#ifdef UPDATE_CHECK
class UpdateModel;
#endif
struct vlc_preparser_t;

namespace vlc {
namespace playlist {
Expand Down Expand Up @@ -166,6 +167,7 @@ class MainCtx : public QObject
public:
/* Getters */
inline qt_intf_t* getIntf() const { return p_intf; }
inline vlc_preparser_t *getPreparser() const { return m_preparser; };
bool smoothScroll() const { return m_smoothScroll; }

VLCSystray* getSysTray() { return m_systray.get(); }
Expand Down Expand Up @@ -319,6 +321,7 @@ class MainCtx : public QObject
void initSystray();

qt_intf_t* p_intf = nullptr;
vlc_preparser_t *m_preparser = nullptr;

bool m_hasEmbededVideo = false;
VideoSurfaceProvider* m_videoSurfaceProvider = nullptr;
Expand Down
6 changes: 2 additions & 4 deletions modules/gui/qt/network/networkmediamodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,7 @@ class NetworkMediaModelPrivate
if (!q->m_ctx || !m_hasTree || m_qmlInitializing)
return false;

auto libvlc = vlc_object_instance(q->m_ctx->getIntf());
auto parser = libvlc_GetMainPreparser(libvlc);
auto parser = q->m_ctx->getPreparser();
if (unlikely(parser == NULL))
return false;

Expand Down Expand Up @@ -495,8 +494,7 @@ NetworkMediaModel::~NetworkMediaModel()
//this can only be acquired from UI thread
if (!d->m_preparseSem.tryAcquire())
{
auto libvlc = vlc_object_instance(m_ctx->getIntf());
auto parser = libvlc_GetMainPreparser(libvlc);
auto parser = m_ctx->getPreparser();
if (likely(parser != NULL))
{
vlc_preparser_Cancel( parser, this );
Expand Down

0 comments on commit d3c65e6

Please sign in to comment.