[vlc-commits] [Git][videolan/vlc][3.0.x] 4 commits: goom: keep track of video format

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Feb 15 16:25:32 UTC 2023



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
c969cbf9 by Rémi Denis-Courmont at 2023-02-15T16:00:24+00:00
goom: keep track of video format

(cherry picked from commit d7aca8699eadccb7b57491b8e202cfc77ebccb01)

- - - - -
93bd3afc by Steve Lhomme at 2023-02-15T16:00:24+00:00
goom: use plane_CopyPixels()

The destination stribe may not be the same as the source.

(cherry picked from commit 82bca6ae86ffff4f4006f301249f6f7e6f13a8b7)

- - - - -
8bf721b9 by Steve Lhomme at 2023-02-15T16:00:24+00:00
goom: explicitely set the output as full range

(cherry picked from commit 6dc1c5a457b44aa3850aca8c611f7bc2125a5701)

- - - - -
62ccae7d by Steve Lhomme at 2023-02-15T16:00:24+00:00
goom: initialize the video format with video_format_Init()

Do not rely on calloc to get proper values.

(cherry picked from commit 61c9cbe24f6830cd745469e089470022e8a1892a)

- - - - -


1 changed file:

- modules/visualization/goom.c


Changes:

=====================================
modules/visualization/goom.c
=====================================
@@ -79,9 +79,8 @@ vlc_module_end ()
 typedef struct
 {
     vlc_thread_t  thread;
+    video_format_t fmt;
 
-    int           i_width;
-    int           i_height;
     vout_thread_t *p_vout;
     int           i_speed;
 
@@ -118,7 +117,6 @@ static int Open( vlc_object_t *p_this )
     filter_t       *p_filter = (filter_t *)p_this;
     filter_sys_t   *p_sys;
     goom_thread_t  *p_thread;
-    video_format_t fmt;
 
     /* Allocate structure */
     p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
@@ -126,20 +124,21 @@ static int Open( vlc_object_t *p_this )
     /* Create goom thread */
     p_sys->p_thread = p_thread = calloc( 1, sizeof(*p_thread) );
 
-    const int width  = p_thread->i_width  = var_InheritInteger( p_filter, "goom-width" );
-    const int height = p_thread->i_height = var_InheritInteger( p_filter, "goom-height" );
-
-    memset( &fmt, 0, sizeof(video_format_t) );
+    const int width  = var_InheritInteger( p_filter, "goom-width" );
+    const int height = var_InheritInteger( p_filter, "goom-height" );
 
-    fmt.i_width = fmt.i_visible_width = width;
-    fmt.i_height = fmt.i_visible_height = height;
-    fmt.i_chroma = VLC_CODEC_RGB32;
-    fmt.i_sar_num = fmt.i_sar_den = 1;
+    video_format_Init(&p_thread->fmt, VLC_CODEC_RGB32);
+    p_thread->fmt.i_width = p_thread->fmt.i_visible_width = width;
+    p_thread->fmt.i_height = p_thread->fmt.i_visible_height = height;
+    p_thread->fmt.i_sar_num = p_thread->fmt.i_sar_den = 1;
+    p_thread->fmt.b_color_range_full = true;
 
-    p_thread->p_vout = aout_filter_RequestVout( p_filter, NULL, &fmt );
+    p_thread->p_vout = aout_filter_RequestVout( p_filter, NULL,
+                                                &p_thread->fmt );
     if( p_thread->p_vout == NULL )
     {
         msg_Err( p_filter, "no suitable vout module" );
+        video_format_Clean(&p_thread->fmt);
         free( p_thread );
         free( p_sys );
         return VLC_EGENERIC;
@@ -164,6 +163,7 @@ static int Open( vlc_object_t *p_this )
         vlc_mutex_destroy( &p_thread->lock );
         vlc_cond_destroy( &p_thread->wait );
         aout_filter_RequestVout( p_filter, p_thread->p_vout, NULL );
+        video_format_Clean(&p_thread->fmt);
         free( p_thread );
         free( p_sys );
         return VLC_EGENERIC;
@@ -292,7 +292,13 @@ static void *Thread( void *p_thread_data )
     PluginInfo *p_plugin_info;
     int canc = vlc_savecancel ();
 
-    p_plugin_info = goom_init( p_thread->i_width, p_thread->i_height );
+    p_plugin_info = goom_init( p_thread->fmt.i_width, p_thread->fmt.i_height );
+
+    plane_t src;
+    src.i_lines = p_thread->fmt.i_height;
+    src.i_pitch = p_thread->fmt.i_width * 4;
+    src.i_visible_lines = p_thread->fmt.i_height;
+    src.i_visible_pitch = p_thread->fmt.i_width * 4;
 
     for( ;; )
     {
@@ -331,7 +337,8 @@ static void *Thread( void *p_thread_data )
         if( unlikely(p_pic == NULL) )
             continue;
 
-        memcpy( p_pic->p[0].p_pixels, plane, p_thread->i_width * p_thread->i_height * 4 );
+        src.p_pixels = (uint8_t*)plane;
+        plane_CopyPixels(&p_pic->p[0], &src);
 
         p_pic->date = date_Get( &i_pts ) + GOOM_DELAY;
         vout_PutPicture( p_thread->p_vout, p_pic );
@@ -368,8 +375,8 @@ static void Close( vlc_object_t *p_this )
         block_Release( p_sys->p_thread->pp_blocks[p_sys->p_thread->i_blocks] );
     }
 
+    video_format_Clean(&p_sys->p_thread->fmt);
     free( p_sys->p_thread );
-
     free( p_sys );
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4b8069d7a2ad688ba7686a804a06072d392b12a0...62ccae7d09fa58cd65c5c2d2cab8f58017157468

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4b8069d7a2ad688ba7686a804a06072d392b12a0...62ccae7d09fa58cd65c5c2d2cab8f58017157468
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