include/nuttx/video/video.h: Move global variable declaration out of header file

Move global variable declaration out of include/nuttx/video/video.h and into the file where it is initialized.  With some toolchains/environments, declaring globals in header files results in multiply defined symobl errors at link time.  This corrects that build problem.
This commit is contained in:
Gregory Nutt 2020-06-01 09:19:04 -06:00 committed by Abdelatif Guettouche
parent 1041100948
commit 0e425584b8
2 changed files with 21 additions and 8 deletions

View File

@ -218,6 +218,12 @@ static int video_g_ext_ctrls(FAR struct video_mng_s *priv,
static int video_s_ext_ctrls(FAR struct video_mng_s *priv, static int video_s_ext_ctrls(FAR struct video_mng_s *priv,
FAR struct v4l2_ext_controls *ctrls); FAR struct v4l2_ext_controls *ctrls);
/****************************************************************************
* Public Data
****************************************************************************/
FAR const struct video_devops_s *g_video_devops;
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/

View File

@ -40,8 +40,10 @@
* Included Files * Included Files
****************************************************************************/ ****************************************************************************/
#include <stdint.h> #include <nuttx/compiler.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <stdint.h>
#include "video_controls.h" #include "video_controls.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -220,6 +222,7 @@ extern "C"
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
/* Buffer type. /* Buffer type.
* Currently, support only V4L2_BUF_TYPE_VIDEO_CAPTURE and * Currently, support only V4L2_BUF_TYPE_VIDEO_CAPTURE and
* V4L2_BUF_TYPE_STILL_CAPTURE. * V4L2_BUF_TYPE_STILL_CAPTURE.
@ -388,7 +391,7 @@ struct v4l2_frmsizeenum
uint32_t pixel_format; /* Pixel format */ uint32_t pixel_format; /* Pixel format */
uint32_t type; /* Frame size type the device supports. */ uint32_t type; /* Frame size type the device supports. */
union union
{ /* Frame size */ { /* Frame size */
struct v4l2_frmsize_discrete discrete; /* Use in type = struct v4l2_frmsize_discrete discrete; /* Use in type =
* V4L2_FRMSIZE_TYPE_DISCRETE * V4L2_FRMSIZE_TYPE_DISCRETE
* case * case
@ -403,7 +406,7 @@ struct v4l2_frmsizeenum
uint32_t subimg_type; /* Frame size type of subimage. */ uint32_t subimg_type; /* Frame size type of subimage. */
union union
{ /* Frame size of subimage */ { /* Frame size of subimage */
struct v4l2_frmsize_discrete discrete; /* Use in subimg_type = struct v4l2_frmsize_discrete discrete; /* Use in subimg_type =
* V4L2_FRMSIZE_TYPE_DISCRETE * V4L2_FRMSIZE_TYPE_DISCRETE
* case * case
@ -568,7 +571,7 @@ struct v4l2_query_ext_ctrl
uint32_t dims[V4L2_CTRL_MAX_DIMS]; /* Dimensions */ uint32_t dims[V4L2_CTRL_MAX_DIMS]; /* Dimensions */
}; };
struct v4l2_querymenu begin_packed_struct struct v4l2_querymenu
{ {
uint16_t ctrl_class; /* camera control class */ uint16_t ctrl_class; /* camera control class */
uint16_t id; /* camera control id */ uint16_t id; /* camera control id */
@ -578,7 +581,7 @@ struct v4l2_querymenu
char name[32]; /* name of menu */ char name[32]; /* name of menu */
int64_t value; /* value of menu */ int64_t value; /* value of menu */
}; };
} __attribute__ ((packed)); } end_packed_struct;
struct v4l2_control struct v4l2_control
{ {
@ -590,7 +593,7 @@ struct v4l2_control
* ioctl(VIDIOC_G_EXT_CTRLS / VIDIOC_S_EXT_CTRLS) * ioctl(VIDIOC_G_EXT_CTRLS / VIDIOC_S_EXT_CTRLS)
*/ */
struct v4l2_ext_control begin_packed_struct struct v4l2_ext_control
{ {
uint16_t id; /* camera control id */ uint16_t id; /* camera control id */
uint16_t size; /* size of value(not use) */ uint16_t size; /* size of value(not use) */
@ -604,7 +607,7 @@ struct v4l2_ext_control
uint32_t *p_u32; /* QUERY_EXT_CTRL type = U32 */ uint32_t *p_u32; /* QUERY_EXT_CTRL type = U32 */
void *ptr; void *ptr;
}; };
} __attribute__ ((packed)); } end_packed_struct;
struct v4l2_ext_controls struct v4l2_ext_controls
{ {
@ -618,7 +621,11 @@ struct v4l2_ext_controls
struct v4l2_ext_control *controls; /* each control information */ struct v4l2_ext_control *controls; /* each control information */
}; };
FAR const struct video_devops_s *g_video_devops; /****************************************************************************
* Public Data
****************************************************************************/
extern FAR const struct video_devops_s *g_video_devops;
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes