[vlc-commits] [Git][videolan/vlc][master] vout: restart if context changes

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Tue May 31 17:05:00 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
1430071b by Rémi Denis-Courmont at 2022-05-31T16:25:58+00:00
vout: restart if context changes

If the video context changes, filter chains and display must be
restarted with the new context.

As the video output object holds a reference to the saved context and
the caller holds a reference to the new context, contexts are
contemporary. Consequently, a pointer comparison is safe.

- - - - -


2 changed files:

- src/video_output/video_output.c
- src/video_output/vout_internal.h


Changes:

=====================================
src/video_output/video_output.c
=====================================
@@ -2027,12 +2027,15 @@ vout_thread_t *vout_Hold( vout_thread_t *vout)
     return vout;
 }
 
-int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original )
+int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original,
+                       const vlc_video_context *vctx )
 {
     vout_thread_sys_t *sys = VOUT_THREAD_TO_SYS(vout);
 
     if (sys->display == NULL)
         return -1;
+    if (sys->filter.src_vctx != vctx)
+        return -1;
 
      /* TODO: If dimensions are equal or slightly smaller, update the aspect
      * ratio and crop settings, instead of recreating a display.
@@ -2100,7 +2103,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
     video_format_t original;
     VoutFixFormat(&original, cfg->fmt);
 
-    if (vout_ChangeSource(cfg->vout, &original) == 0)
+    if (vout_ChangeSource(cfg->vout, &original, vctx) == 0)
     {
         video_format_Clean(&original);
         return 0;


=====================================
src/video_output/vout_internal.h
=====================================
@@ -99,7 +99,8 @@ void vout_StopDisplay(vout_thread_t *);
  * \retval 0 on success
  * \retval -1 on error, the vout needs to be restarted to handle the format
  */
-int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt );
+int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt,
+                       const vlc_video_context * );
 
 enum vout_crop_mode {
     VOUT_CROP_NONE, VOUT_CROP_RATIO, VOUT_CROP_WINDOW, VOUT_CROP_BORDER,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1430071b092c2cdf3c4fc7c1c598240c9d54b53a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1430071b092c2cdf3c4fc7c1c598240c9d54b53a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list