[vlc-devel] [PATCH 2/2] add V4L2 video_output module

Francois Cartegnie fcvlcdev at free.fr
Sat Jan 14 22:55:39 CET 2012


Le 14/01/2012 19:31, Rémi Denis-Courmont a écrit :
> The point is performance, not result. A single writev() system call is faster 
> than many write() calls, and also faster than many memory copies and one 
> write() call.

By same result I meant "not working".
It ends up the same way as doing many writes to the device. I have no
clue on this.
The writev() code was correct as I verified it on the yuv output module.

    int i_total = 0;
    struct iovec *iov;
    int iovcnt = 0;

    for (int i = 0; i < picture->i_planes; i++)
        for( int y = 0; y < picture->p[i].i_visible_lines; y++)
            iovcnt++;

    iov = calloc( iovcnt, sizeof( struct iovec ) );
    int ioc = 0;

    for (int i = 0; i < picture->i_planes; i++)
    {
        const plane_t *plane = &picture->p[i];
        for( int y = 0; y < plane->i_visible_lines; y++)
        {
            iov[ioc].iov_base = &plane->p_pixels[y*plane->i_pitch];
            iov[ioc++].iov_len = plane->i_visible_pitch;
            i_total += plane->i_visible_pitch;
        }
    }
    int i_written = writev( sys->fd, iov, iovcnt );
    if ( i_total != i_written )
        msg_Warn( vd, "can't fully write to device %d %d", i_total,
i_written );


Francois



More information about the vlc-devel mailing list