access: bluray: check region chromas
authorFrancois Cartegnie <fcvlcdev@free.fr>
Fri, 6 Mar 2020 16:51:53 +0000 (17:51 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 9 Mar 2020 09:39:56 +0000 (10:39 +0100)
modules/access/bluray.c

index 8abd871..bab725f 100644 (file)
@@ -1914,8 +1914,11 @@ static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const eventov)
     subpicture_region_t *p_last = NULL;
     while (p_reg != NULL) {
         p_last = p_reg;
-        if (p_reg->i_x == eventov->x && p_reg->i_y == eventov->y &&
-                p_reg->fmt.i_width == eventov->w && p_reg->fmt.i_height == eventov->h)
+        if (p_reg->i_x == eventov->x &&
+            p_reg->i_y == eventov->y &&
+            p_reg->fmt.i_width == eventov->w &&
+            p_reg->fmt.i_height == eventov->h &&
+            p_reg->fmt.i_chroma == VLC_CODEC_YUVP)
             break;
         pp_reg = &p_reg->p_next;
         p_reg = p_reg->p_next;
@@ -2039,17 +2042,18 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const
         return;
     vlc_mutex_lock(&ov->lock);
 
+    /* ARGB in word order -> byte order */
+#ifdef WORDS_BIG_ENDIAN
+    const vlc_fourcc_t rgbchroma = VLC_CODEC_ARGB;
+#else
+    const vlc_fourcc_t rgbchroma = VLC_CODEC_BGRA;
+#endif
     if (!ov->p_regions)
     {
         video_format_t fmt;
         video_format_Init(&fmt, 0);
         video_format_Setup(&fmt,
-        /* ARGB in word order -> byte order */
-#ifdef WORDS_BIG_ENDIAN
-                           VLC_CODEC_ARGB,
-#else
-                           VLC_CODEC_BGRA,
-#endif
+                           rgbchroma,
                            eventov->stride, ov->height,
                            ov->width, ov->height, 1, 1);
         ov->p_regions = subpicture_region_New(&fmt);
@@ -2057,7 +2061,7 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const
 
     /* Find a region to update */
     subpicture_region_t *p_reg = ov->p_regions;
-    if (!p_reg) {
+    if (!p_reg || p_reg->fmt.i_chroma != rgbchroma) {
         vlc_mutex_unlock(&ov->lock);
         return;
     }