예제 #1
0
파일: fb.c 프로젝트: shanewfx/vlc-arib
static picture_t *Get(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    if (!sys->pool) {
        if (!sys->picture) {
            picture_resource_t rsc;

            memset(&rsc, 0, sizeof(rsc));
            rsc.p[0].p_pixels = sys->video_ptr;
            rsc.p[0].i_lines  = sys->var_info.yres;
            if (sys->var_info.xres_virtual)
                rsc.p[0].i_pitch = sys->var_info.xres_virtual *
                                   sys->bytes_per_pixel;
            else
                rsc.p[0].i_pitch = sys->var_info.xres *
                                   sys->bytes_per_pixel;

            sys->picture = picture_NewFromResource(&vd->fmt, &rsc);
            if (!sys->picture)
                return NULL;
        }

        if (sys->is_hw_accel)
            sys->pool = picture_pool_New(1, &sys->picture);
        else
            sys->pool = picture_pool_NewFromFormat(&vd->fmt, 1);
        if (!sys->pool)
            return NULL;
    }
    return picture_pool_Get(sys->pool);
}
예제 #2
0
static picture_t *Get(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    if (!sys->pool) {
        sys->pool = picture_pool_NewFromFormat(&vd->fmt, 1);
        if (!sys->pool)
            return NULL;
    }
    return picture_pool_Get(sys->pool);
}
예제 #3
0
파일: sdl.c 프로젝트: shanewfx/vlc-arib
/**
 * Return a direct buffer
 */
static picture_t *Get(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    if (!sys->pool) {
        picture_resource_t rsc;

        memset(&rsc, 0, sizeof(rsc));

        if (sys->overlay) {
            SDL_Overlay *ol = sys->overlay;

            for (int i = 0; i < ol->planes; i++) {
                rsc.p[i].p_pixels = ol->pixels[ i > 0 && sys->is_uv_swapped ? (3-i) : i];
                rsc.p[i].i_pitch  = ol->pitches[i > 0 && sys->is_uv_swapped ? (3-i) : i];
                rsc.p[i].i_lines  = ol->h;
                if (ol->format == SDL_YV12_OVERLAY ||
                    ol->format == SDL_IYUV_OVERLAY)
                    rsc.p[i].i_lines /= 2;

            }
        } else {
            const int x = sys->place.x;
            const int y = sys->place.y;

            SDL_Surface *sf = sys->display;
            SDL_FillRect(sf, NULL, 0);

            assert(x >= 0 && y >= 0);
            rsc.p[0].p_pixels = (uint8_t*)sf->pixels + y * sf->pitch + x * ((sf->format->BitsPerPixel + 7) / 8);
            rsc.p[0].i_pitch  = sf->pitch;
            rsc.p[0].i_lines  = vd->fmt.i_height;
        }

        picture_t *picture = picture_NewFromResource(&vd->fmt, &rsc);;
        if (!picture)
            return NULL;

        sys->pool = picture_pool_New(1, &picture);
        if (!sys->pool)
            return NULL;
    }

    return picture_pool_Get(sys->pool);
}
예제 #4
0
파일: opengl.c 프로젝트: paa/vlc
/*****************************************************************************
 * Render: render previously calculated output
 *****************************************************************************/
static void Render( vout_thread_t *p_vout, picture_t *p_pic )
{
    vout_sys_t *p_sys = p_vout->p_sys;

    picture_t *p_next = p_sys->p_current;

    if( VLCGL_TEXTURE_COUNT > 1 )
    {
        /* Get the next picture to display */
        p_next = picture_pool_Get( p_sys->p_pool );
        assert( p_next );
    }

    if( p_sys->p_current )
    {
        assert( p_sys->p_current->p[0].p_pixels == p_pic->p[0].p_pixels );

        /* Make sure we have the prepare after the picture_pool_Get,
         * because picture_pool_Get() will bind the new picture texture,
         * and vout_display_opengl_Prepare() bind the current rendered picture
         * texture.
         * DisplayVideo() will effectively use the last binded texture. */

        vout_display_opengl_Prepare( &p_sys->vgl, p_sys->p_current );
    }

    if( p_sys->p_current != p_next ) {
        if( p_sys->p_current )
            picture_Release( p_sys->p_current );

        /* Swap the picture texture on opengl vout side. */
        p_sys->p_current = p_next;

        /* Now, switch the only picture that is being used
         * to render in the backend to point to our "next"
         * picture texture */
        p_pic->p[0].p_pixels = p_sys->p_current->p[0].p_pixels;
    }

    VLC_UNUSED( p_pic );
}
예제 #5
0
picture_pool_t *picture_pool_Reserve(picture_pool_t *master, unsigned count)
{
    picture_t *picture[count ? count : 1];
    unsigned i;

    for (i = 0; i < count; i++) {
        picture[i] = picture_pool_Get(master);
        if (picture[i] == NULL)
            goto error;
    }

    picture_pool_t *pool = picture_pool_New(count, picture);
    if (!pool)
        goto error;

    return pool;

error:
    while (i > 0)
        picture_Release(picture[--i]);
    return NULL;
}
예제 #6
0
파일: aa.c 프로젝트: FLYKingdom/vlc
/**
 * Return a direct buffer
 */
static picture_t *Get(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    if (!sys->pool) {
        picture_resource_t rsc;

        memset(&rsc, 0, sizeof(rsc));
        rsc.p[0].p_pixels = aa_image(sys->aa_context);
        rsc.p[0].i_pitch = aa_imgwidth(sys->aa_context);
        rsc.p[0].i_lines = aa_imgheight(sys->aa_context);

        picture_t *p_picture = picture_NewFromResource(&vd->fmt, &rsc);
        if (!p_picture)
            return NULL;

        sys->pool = picture_pool_New(1, &p_picture);
        if (!sys->pool)
            return NULL;
    }

    return picture_pool_Get(sys->pool);
}
예제 #7
0
파일: caca.c 프로젝트: FLYKingdom/vlc
/**
 * Return a direct buffer
 */
static picture_t *Get(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    return picture_pool_Get(sys->pool);
}
예제 #8
0
파일: opengl.c 프로젝트: paa/vlc
/*****************************************************************************
 * Init: initialize the OpenGL video thread output method
 *****************************************************************************/
static int Init( vout_thread_t *p_vout )
{
    vout_sys_t *p_sys = p_vout->p_sys;

    p_sys->p_vout->pf_init( p_sys->p_vout );

    p_sys->gl.lock = OpenglLock;
    p_sys->gl.unlock = OpenglUnlock;
    p_sys->gl.swap = OpenglSwap;
    p_sys->gl.sys = p_sys->p_vout;

    video_format_t fmt;
    video_format_Init( &fmt, 0 );
    video_format_Setup( &fmt,
                        p_vout->render.i_chroma,
                        p_vout->render.i_width,
                        p_vout->render.i_height,
                        p_vout->render.i_aspect * p_vout->render.i_height,
                        VOUT_ASPECT_FACTOR      * p_vout->render.i_width );


    if( vout_display_opengl_Init( &p_sys->vgl, &fmt, &p_sys->gl ) )
    {
        I_OUTPUTPICTURES = 0;
        return VLC_EGENERIC;
    }
    p_sys->p_pool = vout_display_opengl_GetPool( &p_sys->vgl );
    if( !p_sys->p_pool )
    {
        vout_display_opengl_Clean( &p_sys->vgl );
        I_OUTPUTPICTURES = 0;
        return VLC_EGENERIC;
    }

    /* */
    p_vout->output.i_chroma = fmt.i_chroma;
    p_vout->output.i_rmask  = fmt.i_rmask;
    p_vout->output.i_gmask  = fmt.i_gmask;
    p_vout->output.i_bmask  = fmt.i_bmask;

    /* Since OpenGL can do rescaling for us, stick to the default
     * coordinates and aspect. */
    p_vout->output.i_width  = p_vout->render.i_width;
    p_vout->output.i_height = p_vout->render.i_height;
    p_vout->output.i_aspect = p_vout->render.i_aspect;

    p_vout->fmt_out = p_vout->fmt_in;
    p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;

    /* */
    p_sys->p_current = picture_pool_Get( p_sys->p_pool );
    p_vout->p_picture[0] = *p_sys->p_current;
    p_vout->p_picture[0].i_status = DESTROYED_PICTURE;
    p_vout->p_picture[0].i_type   = DIRECT_PICTURE;
    p_vout->p_picture[0].i_refcount = 0;
    p_vout->p_picture[0].p_sys = NULL;
    PP_OUTPUTPICTURE[0] = &p_vout->p_picture[0];

    I_OUTPUTPICTURES = 1;

    return VLC_SUCCESS;
}