[vlc-devel] [PATCH 10/11] Add KVA video output module for OS/2

KO Myung-Hun komh78 at gmail.com
Mon Nov 21 14:53:13 CET 2011



Rémi Denis-Courmont wrote:
> Inline.
> 
> diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
> new file mode 100644
> index 0000000..3a8adca
> --- /dev/null
> +++ b/modules/video_output/kva.c
> @@ -0,0 +1,1316 @@
> +/*****************************************************************************
> + * kva.c: KVA video output plugin for vlc
> + *****************************************************************************
> + * Copyright (C) 2010, 2011 the VideoLAN team
> + *
> + * Authors: KO Myung-Hun <komh at chollian.net>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> + *****************************************************************************/
> +
> +/*****************************************************************************
> + * Preamble
> + *****************************************************************************/
> +#ifdef HAVE_CONFIG_H
> +# include "config.h"
> +#endif
> +
> +#include <vlc_common.h>
> +#include <vlc_plugin.h>
> +#include <vlc_vout_display.h>
> +#include <vlc_picture_pool.h>
> +
> +#include <ctype.h>
> +#include <float.h>
> +#include <assert.h>
> +
> +#include <fourcc.h>
> +
> +#include <kva.h>
> +
> +/*****************************************************************************
> + * Module descriptor
> + *****************************************************************************/
> +static int  Open ( vlc_object_t * );
> +static void Close( vlc_object_t * );
> +
> +#define KVA_FIXT23_TEXT N_( \
> +    "Enable a workaround for T23" )
> +#define KVA_FIXT23_LONGTEXT N_( \
> +    "Enable this option if the diagonal stripes are displayed " \
> +    "when the window size is equal to or smaller than the movie size" )
> 
> Missing full point.
> 

Ok.

> +#define KVA_VIDEO_MODE_TEXT N_( \
> +    "Video mode" )
> +#define KVA_VIDEO_MODE_LONGTEXT N_( \
> +    "Select a proper video mode to be used by KVA" )
> 
> Same as above.
> 

Ok.

> +
> +static const char *const ppsz_kva_video_mode[] = {
> +    "auto", "snap", "wo", "dive" };
> +static const char *const ppsz_kva_video_mode_text[] = {
> +    N_("Auto"), N_("SNAP"), N_("WarpOverlay!"), N_("DIVE") };
> +
> +vlc_module_begin ()
> +    set_shortname( "KVA" )
> +    set_category( CAT_VIDEO )
> +    set_subcategory( SUBCAT_VIDEO_VOUT )
> +    add_string( "kva-video-mode", ppsz_kva_video_mode[0], KVA_VIDEO_MODE_TEXT,
> +                KVA_VIDEO_MODE_LONGTEXT, false )
> +        change_string_list( ppsz_kva_video_mode, ppsz_kva_video_mode_text, 0 )
> +    add_bool( "kva-fixt23", false, KVA_FIXT23_TEXT, KVA_FIXT23_LONGTEXT, true );
> +    set_description( N_("K Video Acceleration video output") )
> +    set_capability( "vout display", 100 )
> +    add_shortcut( "kva" )
> +    set_callbacks( Open, Close )
> +vlc_module_end ()
> +
> +typedef struct image_t
> +{
> +    int      w, h;
> +    int      i_bpp;
> +    int      i_chroma_shift;
> +    uint8_t *data[4];       /* y = 0, v = 1, u = 2 */
> +    int      linesize[4];
> +    uint8_t *p;
> +} image_t;
> 
> You should use picture_resource_t for this. If you need private data,
> then there is picture_sys_t.
> 

I'll try.

> +
> +/*****************************************************************************
> + * vout_display_sys_t: video output method descriptor
> + *****************************************************************************
> + * This structure is part of the video output thread descriptor.
> + * It describes the module specific properties of an output thread.
> + *****************************************************************************/
> +struct vout_display_sys_t
> +{
> +    TID             tid;
> +    HEV             ack_event;
> +    int             i_result;
> +    HAB             hab;
> +    HMQ             hmq;
> +    HWND            frame;
> +    HWND            client;
> +    KVASETUP        kvas;
> +    KVACAPS         kvac;
> +    LONG            i_screen_width;
> +    LONG            i_screen_height;
> +    bool            b_fixt23;
> +    PFNWP           p_old_frame;
> +    RECTL           client_rect;
> +    vout_window_t  *parent_window;
> +    HWND            parent;
> +    RECTL           parent_rect;
> +    image_t        *p_image;
> 
> If you have a fixed number of pictures (1), you do not need this
> indirection.
> 

Ok. I'm investigating other sources for this. ^^

> [...]
> +/*****************************************************************************
> + * OpenDisplay: open and initialize KVA device
> + *****************************************************************************
> + * Open and initialize display according to preferences specified in the vout
> + * thread fields.
> + *****************************************************************************/
> +static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
> +{
> +    vout_display_sys_t * sys = vd->sys;
> +    bool b_hw_accel;
> +    FOURCC i_kva_fourcc;
> +    char sz_title[ 256 ];
> +    RECTL rcl;
> +    int w, h;
> +
> +    msg_Dbg( vd, "render chroma = %4.4s", ( const char * )&fmt->i_chroma );
> +
> +    switch( fmt->i_chroma )
> +    {
> +        case VLC_CODEC_RGB15:
> +            b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR15;
> +            i_kva_fourcc = FOURCC_R555;
> +            break;
> +
> +        case VLC_CODEC_RGB16:
> +            b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR16;
> +            i_kva_fourcc = FOURCC_R565;
> +            break;
> +
> +        case VLC_CODEC_RGB24:
> +        case VLC_CODEC_RGB32:
> +            b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_BGR24;
> +            i_kva_fourcc = FOURCC_BGR3;
> +            fmt->i_chroma = VLC_CODEC_RGB32;
> +            break;
> +
> +        case VLC_CODEC_YUYV:
> +            b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_YUY2;
> +            i_kva_fourcc = FOURCC_Y422;
> +            break;
> +
> +        case VLC_CODEC_YV9:
> +            b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_YVU9;
> +            i_kva_fourcc = FOURCC_YVU9;
> +            break;
> +
> +        case VLC_CODEC_YV12:
> +        default:
> 
> This makes sense for VLC_CODEC_I420 and VLC_CODEC_J420, but none else.
> 

VLC does not convert a chroma automatically if it is different from a
input chroma ?

> +            b_hw_accel = sys->kvac.ulInputFormatFlags & KVAF_YV12;
> +            i_kva_fourcc = FOURCC_YV12;
> +            fmt->i_chroma = VLC_CODEC_YV12;
> +            break;
> +    }
> +
> +    if( !b_hw_accel )
> 
> You should probably use vlc_fourcc_GetYUVFallback() (or
> vlc_fourcc_GetRGBFallback()) instead of these two passes.
> 

I'll try.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.0.14
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1GHz with 512 MB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr




More information about the vlc-devel mailing list