2019-07-04 15:30:50 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* drivers/video/video_framebuff.h
|
|
|
|
*
|
2021-01-25 10:00:05 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2019-07-04 15:30:50 +02:00
|
|
|
*
|
2021-01-25 10:00:05 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2019-07-04 15:30:50 +02:00
|
|
|
*
|
2021-01-25 10:00:05 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2019-07-04 15:30:50 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#ifndef __DRIVERS_VIDEO_VIDEO_FRAMEBUFF_H
|
|
|
|
#define __DRIVERS_VIDEO_VIDEO_FRAMEBUFF_H
|
2019-07-04 15:30:50 +02:00
|
|
|
|
2021-01-26 09:14:35 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-07-04 15:30:50 +02:00
|
|
|
#include <nuttx/video/video.h>
|
2020-02-01 08:17:32 +01:00
|
|
|
#include <nuttx/semaphore.h>
|
2019-07-04 15:30:50 +02:00
|
|
|
|
2021-01-26 09:14:35 +01:00
|
|
|
/****************************************************************************
|
2021-09-15 05:02:33 +02:00
|
|
|
* Public Types
|
2021-01-26 09:14:35 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
2019-07-04 15:30:50 +02:00
|
|
|
struct vbuf_container_s
|
|
|
|
{
|
2021-01-26 09:14:35 +01:00
|
|
|
struct v4l2_buffer buf; /* Buffer information */
|
2019-07-04 15:30:50 +02:00
|
|
|
struct vbuf_container_s *next; /* pointer to next buffer */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct vbuf_container_s vbuf_container_t;
|
|
|
|
|
|
|
|
struct video_framebuff_s
|
|
|
|
{
|
|
|
|
enum v4l2_buf_mode mode;
|
|
|
|
sem_t lock_empty;
|
|
|
|
int container_size;
|
|
|
|
vbuf_container_t *vbuf_alloced;
|
|
|
|
vbuf_container_t *vbuf_empty;
|
|
|
|
vbuf_container_t *vbuf_top;
|
|
|
|
vbuf_container_t *vbuf_tail;
|
2021-09-15 05:02:33 +02:00
|
|
|
vbuf_container_t *vbuf_curr;
|
|
|
|
vbuf_container_t *vbuf_next;
|
2019-07-04 15:30:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct video_framebuff_s video_framebuff_t;
|
|
|
|
|
2021-09-15 05:02:33 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-07-04 15:30:50 +02:00
|
|
|
/* Buffer access interface. */
|
|
|
|
|
|
|
|
void video_framebuff_init
|
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
void video_framebuff_uninit
|
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
int video_framebuff_realloc_container
|
|
|
|
(video_framebuff_t *fbuf, int sz);
|
|
|
|
vbuf_container_t *video_framebuff_get_container
|
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
void video_framebuff_free_container
|
|
|
|
(video_framebuff_t *fbuf, vbuf_container_t *cnt);
|
|
|
|
void video_framebuff_queue_container
|
|
|
|
(video_framebuff_t *fbuf, vbuf_container_t *tgt);
|
|
|
|
vbuf_container_t *video_framebuff_dq_valid_container
|
|
|
|
(video_framebuff_t *fbuf);
|
2021-09-15 05:02:33 +02:00
|
|
|
vbuf_container_t *video_framebuff_get_vacant_container
|
2019-07-04 15:30:50 +02:00
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
vbuf_container_t *video_framebuff_pop_curr_container
|
|
|
|
(video_framebuff_t *fbuf);
|
2021-09-15 05:02:33 +02:00
|
|
|
void video_framebuff_capture_done
|
2019-07-04 15:30:50 +02:00
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
void video_framebuff_change_mode
|
|
|
|
(video_framebuff_t *fbuf, enum v4l2_buf_mode mode);
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#endif /* __DRIVERS_VIDEO_VIDEO_FRAMEBUFF_H */
|