On 08/25/2017 05:35 PM, wm4 wrote:
+
+#define SET_V4L2_EXT_CTRL(TYPE, ID, VALUE, NAME)                    \
+{                                                                   \
+    struct v4l2_ext_control ctrl = { 0 };                           \
+    struct v4l2_ext_controls ctrls = { 0 };                         \
+    ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;                        \
+    ctrls.controls = &ctrl;                                         \
+    ctrl.TYPE = VALUE ;                                             \
+    ctrl.id = ID ;                                                  \
+    ctrls.count = 1;                                                \
+                                                                    \
+    if ((ret = ioctl(s->fd, VIDIOC_S_EXT_CTRLS, &ctrls)) < 0)       \
+        av_log(avctx, AV_LOG_WARNING, "Failed to set " NAME "%s\n", STR(ID));  
\
+}
+
+#define SET_V4L2_TIME_PER_FRAME(NUM, DEN)                           \
+{                                                                   \
+    struct v4l2_streamparm parm = { 0 };                            \
+    parm.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;                  \
+    parm.parm.output.timeperframe.numerator = NUM;                  \
+    parm.parm.output.timeperframe.denominator = DEN;                \
+                                                                    \
+    if ((ret = ioctl(s->fd, VIDIOC_S_PARM, &parm)) < 0)             \
+        av_log(avctx, AV_LOG_WARNING, "Failed to set  timeperframe");  \
+}
I think those should be functions. ctrl has only 3 fields, so it's ok
to have the caller set it up. (If you use C99 struct literals it won't
be more code than before, maybe.)


ok.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to