static void mmap_release_buffer(AVPacket *pkt)

{

    struct v4l2_buffer buf;

    int res, fd;

    struct buff_data *buf_descriptor = pkt->priv;



    if (pkt->data == NULL)

        return;



    memset(&buf, 0, sizeof(struct v4l2_buffer));

    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

    buf.memory = V4L2_MEMORY_MMAP;

    buf.index = buf_descriptor->index;

    fd = buf_descriptor->fd;

    av_free(buf_descriptor);



    res = ioctl(fd, VIDIOC_QBUF, &buf);

    if (res < 0)

        av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",

               strerror(errno));



    pkt->data = NULL;

    pkt->size = 0;

}

static void mmap_release_buffer(AVPacket *pkt)

{

    struct v4l2_buffer buf;

    int res, fd;

    struct buff_data *buf_descriptor = pkt->priv;



    if (pkt->data == NULL)

        return;



    memset(&buf, 0, sizeof(struct v4l2_buffer));

    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

    buf.memory = V4L2_MEMORY_MMAP;

    buf.index = buf_descriptor->index;

    fd = buf_descriptor->fd;

    av_free(buf_descriptor);



    res = ioctl(fd, VIDIOC_QBUF, &buf);

    if (res < 0)

        av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",

               strerror(errno));



    pkt->data = NULL;

    pkt->size = 0;

}

static void FUNC_0(AVPacket *VAR_0)

{

    struct v4l2_buffer VAR_1;

    int VAR_2, VAR_3;

    struct buff_data *VAR_4 = VAR_0->priv;



    if (VAR_0->data == NULL)

        return;



    memset(&VAR_1, 0, sizeof(struct v4l2_buffer));

    VAR_1.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;

    VAR_1.memory = V4L2_MEMORY_MMAP;

    VAR_1.index = VAR_4->index;

    VAR_3 = VAR_4->VAR_3;

    av_free(VAR_4);



    VAR_2 = ioctl(VAR_3, VIDIOC_QBUF, &VAR_1);

    if (VAR_2 < 0)

        av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",

               strerror(errno));



    VAR_0->data = NULL;

    VAR_0->size = 0;

}

static void FUNC_0(AVPacket *VAR_0)
{ struct v4l2_buffer VAR_1; int VAR_2, VAR_3; struct buff_data *VAR_4 = VAR_0->priv; if (VAR_0->data == NULL)
return; memset(&VAR_1, 0, sizeof(struct v4l2_buffer)); VAR_1.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; VAR_1.memory = V4L2_MEMORY_MMAP; VAR_1.index = VAR_4->index; VAR_3 = VAR_4->VAR_3; av_free(VAR_4); VAR_2 = ioctl(VAR_3, VIDIOC_QBUF, &VAR_1); if (VAR_2 < 0)
av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",
strerror(errno)); VAR_0->data = NULL; VAR_0->size = 0; }