Web lists-archives.com

[MPlayer-dev-eng] [PATCH] Fix broken build by checking for used structure definition




Hi,

the attached patch fixes a build error if the header linux/videodev2.h
defines struct v4l2_ext_controls, but not struct v4l2_query_ext_ctrl. This
is the case on Ubuntu 14.04.4 LTS, for example.

Build error:

---8<------8<------8<------8<------8<------8<------8<------8<---

stream/stream_pvr.c: In function 'add_v4l2_ext_control':
stream/stream_pvr.c:1099:10: error: variable 'qctrl' has initializer but incomplete type
   struct v4l2_query_ext_ctrl qctrl = { .id = id };
          ^
stream/stream_pvr.c:1099:10: error: unknown field 'id' specified in initializer
stream/stream_pvr.c:1099:10: warning: excess elements in struct initializer [enabled by default]
stream/stream_pvr.c:1099:10: warning: (near initialization for 'qctrl') [enabled by default]
stream/stream_pvr.c:1099:30: error: storage size of 'qctrl' isn't known
   struct v4l2_query_ext_ctrl qctrl = { .id = id };
                              ^
stream/stream_pvr.c:1102:27: error: 'VIDIOC_QUERY_EXT_CTRL' undeclared (first use in this function)
   if (ioctl (pvr->dev_fd, VIDIOC_QUERY_EXT_CTRL, &qctrl) < 0)
                           ^
stream/stream_pvr.c:1102:27: note: each undeclared identifier is reported only once for each function it appears in
stream/stream_pvr.c:1099:30: warning: unused variable 'qctrl' [-Wunused-variable]
   struct v4l2_query_ext_ctrl qctrl = { .id = id };
                              ^
make: *** [stream/stream_pvr.o] Error 1
make: *** Waiting for unfinished jobs....

---8<------8<------8<------8<------8<------8<------8<------8<---

Thanks,
Erik
-- 
http://www.unix-ag.uni-kl.de/~auerswal/
Index: configure
===================================================================
--- configure	(revision 37778)
+++ configure	(working copy)
@@ -7760,7 +7760,11 @@
   cat > $TMPC <<EOF
 #include <sys/time.h>
 #include <linux/videodev2.h>
-int main(void) { struct v4l2_ext_controls ext; return ext.controls->value; }
+int main(void) {
+  struct v4l2_ext_controls ext;
+  struct v4l2_query_ext_ctrl qctrl;
+  return ext.controls->value;
+}
 EOF
   cc_check && _pvr=yes
 fi
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng