[vlc-commits] [Git][videolan/vlc][master] 2 commits: VLCSampleBufferDisplay: pass fmt for internal filter

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Mar 1 14:33:57 UTC 2025


Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b6b14cbb by Alexandre Janniaux at 2025-03-01T14:07:21+00:00
VLCSampleBufferDisplay: pass fmt for internal filter

- - - - -
7e31157b by Alexandre Janniaux at 2025-03-01T14:07:21+00:00
VLCSampleBufferDisplay: add support for update_format

- - - - -


1 changed file:

- modules/video_output/apple/VLCSampleBufferDisplay.m


Changes:

=====================================
modules/video_output/apple/VLCSampleBufferDisplay.m
=====================================
@@ -418,7 +418,7 @@ static vlc_decoder_device * CVPXHoldDecoderDevice(vlc_object_t *o, void *sys)
 }
 
 static filter_t *
-CreateCVPXConverter(vout_display_t *vd)
+CreateCVPXConverter(vout_display_t *vd, const video_format_t *fmt)
 {
     filter_t *converter = vlc_object_create(vd, sizeof(filter_t));
     if (!converter)
@@ -432,8 +432,8 @@ CreateCVPXConverter(vout_display_t *vd)
     converter->owner.video = &cbs;
     converter->owner.sys = vd;
 
-    es_format_InitFromVideo( &converter->fmt_in,  vd->fmt );
-    es_format_InitFromVideo( &converter->fmt_out,  vd->fmt );
+    es_format_InitFromVideo(&converter->fmt_in, fmt);
+    es_format_InitFromVideo(&converter->fmt_out, fmt);
 
     converter->fmt_out.video.i_chroma =
     converter->fmt_out.i_codec = VLC_CODEC_CVPX_BGRA;
@@ -1101,6 +1101,25 @@ static void DeletePipController( pip_controller_t * pip_controller )
     vlc_object_delete(pip_controller);
 }
 
+static int UpdateFormat(vout_display_t *vd, const video_format_t *fmt,
+                        vlc_video_context *vctx)
+{
+    VLCSampleBufferDisplay *sys = (__bridge VLCSampleBufferDisplay*)vd->sys;
+    msg_Dbg(vd, "Update format! from %4.4s to %4.4s", &vd->fmt->i_chroma, &fmt->i_chroma);
+
+    // Display will only work with CVPX video context
+    filter_t *converter = NULL;
+    if (!vlc_video_context_GetPrivate(vctx, VLC_VIDEO_CONTEXT_CVPX)) {
+        converter = CreateCVPXConverter(vd, fmt);
+        if (!converter)
+            return VLC_EGENERIC;
+    }
+
+    DeleteCVPXConverter(sys->converter);
+    sys->converter = converter;
+    return VLC_SUCCESS;
+}
+
 static int Open (vout_display_t *vd,
                  video_format_t *fmt, vlc_video_context *context)
 {
@@ -1116,7 +1135,7 @@ static int Open (vout_display_t *vd,
     // Display will only work with CVPX video context
     filter_t *converter = NULL;
     if (!vlc_video_context_GetPrivate(context, VLC_VIDEO_CONTEXT_CVPX)) {
-        converter = CreateCVPXConverter(vd);
+        converter = CreateCVPXConverter(vd, fmt);
         if (!converter)
             return VLC_EGENERIC;
     }
@@ -1139,6 +1158,7 @@ static int Open (vout_display_t *vd,
             .prepare = Prepare,
             .display = Display,
             .control = Control,
+            .update_format = UpdateFormat,
         };
         
         vd->ops = &ops;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e33e383fde533c17032614bd0cbf5be1d364917a...7e31157bce85ac53a903d57746a564a677fb69fe

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e33e383fde533c17032614bd0cbf5be1d364917a...7e31157bce85ac53a903d57746a564a677fb69fe
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