Skip to content
Snippets Groups Projects
  1. Sep 13, 2024
  2. Apr 13, 2024
  3. Sep 16, 2023
  4. Sep 03, 2023
  5. Jun 12, 2023
  6. Apr 21, 2023
  7. Jun 11, 2022
  8. May 21, 2022
  9. Mar 31, 2022
  10. Feb 27, 2022
  11. Dec 23, 2021
    • Pierre Lamot's avatar
      qt: move mlitem function on the ML thread · 9958d3db
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      9958d3db
    • Pierre Lamot's avatar
      qt: remove direct accessor to vlc_medialibrary_t instance · 8b7d73d4
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      8b7d73d4
    • Pierre Lamot's avatar
      qt: remove unused QThreadPool in MediaLib · 7756812d
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      7756812d
    • Pierre Lamot's avatar
      qt: use runOnMLThread to count and load data · 16d6631c
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      this allows not depending on vlc_medialibrary_t being present in MLBase
      16d6631c
    • Pierre Lamot's avatar
      qt: run ml playlist insertion on ML thread · 162a474d
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      162a474d
    • Pierre Lamot's avatar
      qt: provide runOnMLThread function · cace21e2
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      this function allows to run lambdas on the ML thread, this should be used to
      perform operation that requires to call vlc_ml_xxx functions as vlc_ml_xxx
      should *not* be called from the UI thread
      
      obj: this is the instance of the calling QObject, we ensure that this object is
      still live when calling the ui callback, if this object gets destroyed the task
      is canceled
      
      mlCb: this callback is executed in a background thread (thread pool), it takes
      as arguments the instance of the medialibrary, and a context, the context can be
      modified to pass data to the UI callback
      
      uiCB: this callback is executed on the Qt thread, it takes as first argument the
      id of the tasks, and as second argument the context that was created for the ML
      callback
      
      queue: this allow the task to be ran on a specific thread, when this parameter
      isn't provided, the task can be scheduled on any thread.
      
      Ctx is the type of context, this context is created by the runner and passed
      sequentially to the ML callback then to UI callback, the ML callback may modify
      its properties as a way to pass data to the UI callback
      
      :warning: the ml callback **SHOULD NOT** capture the obj object or point to its
      properties by reference, as the obj object may potentially be destroyed when the
      function is called
      
      the ui callback **MAY** capture the object obj as we will ensure that the object
      still exists before calling the callback
      
      the uiCb **MAY NOT** be called if the object obj is released earlier
      
      anything stored int the context Ctx **MUST** auto release when the context is
      destroyed
      
      sample usage:
      
      ```
          //structure used to pass data from the ML thread to the UI thread
          struct Ctx {
              bool success;
          };
          m_mediaLib->runOnMLThread<Ctx>(
          //reference to the object making the call, this is used to ensure that
          //the caller still exists before calling the UI callback
          this,
          //ML thread, data needed from the caller are passed in the capture of the lambda
          //capturing this or any of its member is not allowed here
          //the callback have in parametters the ml instance and a context that will be shared with
          //the UI callback
          [url, indexed](vlc_medialibrary_t* ml, Ctx& ctx)
          {
              int res;
              if ( indexed )
                  res = vlc_ml_add_folder(  ml, qtu( url ) );
              else
                  res = vlc_ml_remove_folder( ml, qtu( url ) );
              ctx.success = (res == VLC_SUCCESS);
          },
          //UI callback, capturing this is allowed, (runOnMLThread will ensure that `this`
          //still exists at this point
          //the callback has as parametters the request id and the shared context
          [this, indexed](quint64, Ctx& ctx){
              if (ctx.success)
              {
                  m_indexed = indexed;
                  emit isIndexedChanged();
              }
          },
          //allow to specify if the task should be run on a specific thread, null (default) will run on any thread
          "ML_FOLDER_ADD_QUEUE");
      ```
      cace21e2
    • Pierre Lamot's avatar
      qt: allow to register ml event callback on MediaLib instance · 1b1a5e76
      Pierre Lamot authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
      1b1a5e76
  12. Dec 03, 2021
  13. Oct 03, 2021
  14. Jul 30, 2021
  15. Jun 12, 2021
  16. Jun 04, 2021
  17. May 01, 2021
  18. Dec 10, 2020
  19. Dec 08, 2020
    • Romain Vimont's avatar
      qt: medialib: rename MLParentId to MLItemId · 7fa1de99
      Romain Vimont authored and Pierre Lamot's avatar Pierre Lamot committed
      
      The item id sometimes represents the id of the "current" item, sometimes
      the id of the "parent" item. Therefore, the fact that it is a "parent"
      id depends on the context, and is not intrinsic to the type.
      
      This caused confusion when getId() returned a MLParentId, representing
      the id of the current item.
      
      Rename to MLItemId to clarify.
      
      Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
      7fa1de99
  20. Dec 02, 2020
    • Romain Vimont's avatar
      qt: medialib: define a medialib thread pool · dc787ba5
      Romain Vimont authored and Pierre Lamot's avatar Pierre Lamot committed
      
      The database queries, initiated by list models, must be executed
      asynchronously (on a thread different from the UI thread).
      
      When a list model is destroyed (from the UI thread), some database
      queries might still be executing. It would be incorrect for the list
      model to wait for them (it would block the UI thread), so they must be
      executed on an external thread pool.
      
      Since the queries themselves require the medialib to be executed, they
      must not outlive it (or the asynchronous code might crash). Therefore,
      the right scope for executing asynchronous queries is the MediaLib
      instance.
      
      Signed-off-by: default avatarPierre Lamot <pierre@videolabs.io>
      dc787ba5
  21. Oct 28, 2020
  22. Sep 28, 2020
  23. Jan 09, 2020
  24. Dec 17, 2019
  25. Aug 29, 2019
  26. Jul 05, 2019
  27. Apr 10, 2019
Loading