You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/06/01 19:22:52 UTC
[incubator-nuttx] branch master updated:
include/nuttx/video/video.h: Move global variable declaration out of header
file
This is an automated email from the ASF dual-hosted git repository.
aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 0e42558 include/nuttx/video/video.h: Move global variable declaration out of header file
0e42558 is described below
commit 0e425584b8cd4e28705c6f0cf0da98be067f9ad3
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Mon Jun 1 09:19:04 2020 -0600
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.
---
drivers/video/video.c | 6 ++++++
include/nuttx/video/video.h | 23 +++++++++++++++--------
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/drivers/video/video.c b/drivers/video/video.c
index 260b278..2be1530 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -219,6 +219,12 @@ static int video_s_ext_ctrls(FAR struct video_mng_s *priv,
FAR struct v4l2_ext_controls *ctrls);
/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+FAR const struct video_devops_s *g_video_devops;
+
+/****************************************************************************
* Private Data
****************************************************************************/
diff --git a/include/nuttx/video/video.h b/include/nuttx/video/video.h
index 8c1ff7a..f403281 100644
--- a/include/nuttx/video/video.h
+++ b/include/nuttx/video/video.h
@@ -40,8 +40,10 @@
* Included Files
****************************************************************************/
-#include <stdint.h>
+#include <nuttx/compiler.h>
#include <sys/ioctl.h>
+#include <stdint.h>
+
#include "video_controls.h"
#ifdef __cplusplus
@@ -220,6 +222,7 @@ extern "C"
/****************************************************************************
* Public Types
****************************************************************************/
+
/* Buffer type.
* Currently, support only V4L2_BUF_TYPE_VIDEO_CAPTURE and
* V4L2_BUF_TYPE_STILL_CAPTURE.
@@ -388,7 +391,7 @@ struct v4l2_frmsizeenum
uint32_t pixel_format; /* Pixel format */
uint32_t type; /* Frame size type the device supports. */
union
- { /* Frame size */
+ { /* Frame size */
struct v4l2_frmsize_discrete discrete; /* Use in type =
* V4L2_FRMSIZE_TYPE_DISCRETE
* case
@@ -403,7 +406,7 @@ struct v4l2_frmsizeenum
uint32_t subimg_type; /* Frame size type of subimage. */
union
- { /* Frame size of subimage */
+ { /* Frame size of subimage */
struct v4l2_frmsize_discrete discrete; /* Use in subimg_type =
* V4L2_FRMSIZE_TYPE_DISCRETE
* case
@@ -568,7 +571,7 @@ struct v4l2_query_ext_ctrl
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 id; /* camera control id */
@@ -578,7 +581,7 @@ struct v4l2_querymenu
char name[32]; /* name of menu */
int64_t value; /* value of menu */
};
-} __attribute__ ((packed));
+} end_packed_struct;
struct v4l2_control
{
@@ -590,7 +593,7 @@ struct v4l2_control
* 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 size; /* size of value(not use) */
@@ -604,7 +607,7 @@ struct v4l2_ext_control
uint32_t *p_u32; /* QUERY_EXT_CTRL type = U32 */
void *ptr;
};
-} __attribute__ ((packed));
+} end_packed_struct;
struct v4l2_ext_controls
{
@@ -618,7 +621,11 @@ struct v4l2_ext_controls
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