[vlc-commits] commit: Fixed fourcc selection used for video extraction from vaapi. ( Laurent Aimar )

git at videolan.org git at videolan.org
Mon Jul 19 19:28:36 CEST 2010


vlc/vlc-1.1 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Jul 11 18:42:07 2010 +0200| [904850433ff4eb9152fdfc94e565a17acaccf83a] | committer: Rémi Duraffort 

Fixed fourcc selection used for video extraction from vaapi.

We now test that the selected fourcc actually works by calling vaGetImage.
Initial patch from Gwenole Beauchesne.
(cherry picked from commit 84f1839b2318ac0963bc37d43b078d5992e9e8db)

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=904850433ff4eb9152fdfc94e565a17acaccf83a
---

 modules/codec/avcodec/vaapi.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index cd891d1..f9a64b7 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -236,7 +236,7 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
         goto error;
     }
 
-    /* Find a supported image chroma */
+    /* Find and create a supported image chroma */
     int i_fmt_count = vaMaxNumImageFormats( p_va->p_display );
     VAImageFormat *p_fmt = calloc( i_fmt_count, sizeof(*p_fmt) );
     if( !p_fmt )
@@ -256,6 +256,21 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
             p_fmt[i].fourcc == VA_FOURCC( 'I', '4', '2', '0' ) ||
             p_fmt[i].fourcc == VA_FOURCC( 'N', 'V', '1', '2' ) )
         {
+            if( vaCreateImage(  p_va->p_display, &p_fmt[i], i_width, i_height, &p_va->image ) )
+            {
+                p_va->image.image_id = 0;
+                continue;
+            }
+            /* Validate that vaGetImage works with this format */
+            if( vaGetImage( p_va->p_display, pi_surface_id[0],
+                            0, 0, i_width, i_height,
+                            p_va->image.image_id) )
+            {
+                vaDestroyImage( p_va->p_display, p_va->image.image_id );
+                p_va->image.image_id = 0;
+                continue;
+            }
+
             i_chroma = VLC_CODEC_YV12;
             fmt = p_fmt[i];
             break;
@@ -266,12 +281,6 @@ static int CreateSurfaces( vlc_va_vaapi_t *p_va, void **pp_hw_ctx, vlc_fourcc_t
         goto error;
     *pi_chroma = i_chroma;
 
-    /* Create an image for surface extraction */
-    if( vaCreateImage(  p_va->p_display, &fmt, i_width, i_height, &p_va->image ) )
-    {
-        p_va->image.image_id = 0;
-        goto error;
-    }
     CopyInitCache( &p_va->image_cache, i_width );
 
     /* Setup the ffmpeg hardware context */



More information about the vlc-commits mailing list