2019-07-04 21:30:50 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* drivers/video/video_framebuff.h
|
|
|
|
*
|
2021-01-25 17:00:05 +08: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 21:30:50 +08:00
|
|
|
*
|
2021-01-25 17:00:05 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2019-07-04 21:30:50 +08:00
|
|
|
*
|
2021-01-25 17:00:05 +08: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 21:30:50 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-15 10:44:35 +08:00
|
|
|
#ifndef __DRIVERS_VIDEO_VIDEO_FRAMEBUFF_H
|
|
|
|
#define __DRIVERS_VIDEO_VIDEO_FRAMEBUFF_H
|
2019-07-04 21:30:50 +08:00
|
|
|
|
2021-01-26 16:14:35 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-07-04 21:30:50 +08:00
|
|
|
#include <nuttx/video/video.h>
|
2022-09-06 14:18:45 +08:00
|
|
|
#include <nuttx/mutex.h>
|
2019-07-04 21:30:50 +08:00
|
|
|
|
2021-01-26 16:14:35 +08:00
|
|
|
/****************************************************************************
|
2021-09-15 11:02:33 +08:00
|
|
|
* Public Types
|
2021-01-26 16:14:35 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
2019-07-04 21:30:50 +08:00
|
|
|
struct vbuf_container_s
|
|
|
|
{
|
2021-01-26 16:14:35 +08:00
|
|
|
struct v4l2_buffer buf; /* Buffer information */
|
2022-12-04 03:46:15 +08:00
|
|
|
struct vbuf_container_s *next; /* Pointer to next buffer */
|
2019-07-04 21:30:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct vbuf_container_s vbuf_container_t;
|
|
|
|
|
|
|
|
struct video_framebuff_s
|
|
|
|
{
|
|
|
|
enum v4l2_buf_mode mode;
|
2022-09-06 14:18:45 +08:00
|
|
|
mutex_t lock_empty;
|
2019-07-04 21:30:50 +08:00
|
|
|
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 11:02:33 +08:00
|
|
|
vbuf_container_t *vbuf_curr;
|
|
|
|
vbuf_container_t *vbuf_next;
|
2019-07-04 21:30:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct video_framebuff_s video_framebuff_t;
|
|
|
|
|
2021-09-15 11:02:33 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-07-04 21:30:50 +08: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);
|
2023-01-31 17:23:28 +08:00
|
|
|
int video_framebuff_is_empty
|
|
|
|
(video_framebuff_t *fbuf);
|
2019-07-04 21:30:50 +08:00
|
|
|
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 11:02:33 +08:00
|
|
|
vbuf_container_t *video_framebuff_get_vacant_container
|
2019-07-04 21:30:50 +08:00
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
vbuf_container_t *video_framebuff_pop_curr_container
|
|
|
|
(video_framebuff_t *fbuf);
|
2021-09-15 11:02:33 +08:00
|
|
|
void video_framebuff_capture_done
|
2019-07-04 21:30:50 +08:00
|
|
|
(video_framebuff_t *fbuf);
|
|
|
|
void video_framebuff_change_mode
|
|
|
|
(video_framebuff_t *fbuf, enum v4l2_buf_mode mode);
|
|
|
|
|
2022-01-15 10:44:35 +08:00
|
|
|
#endif /* __DRIVERS_VIDEO_VIDEO_FRAMEBUFF_H */
|