[FFmpeg-user] ffmpeg - equivalent of mencoder's immediatemode=0

Mike F paziu at yahoo.com
Wed Jul 11 20:29:03 CEST 2012


> 
>>  You do not know how much I would like to send a patch 
>>  instead writing this message, I am simply not good enough in C
> 
> Then please open a ticket on trac, do not simply link to this thread, 
> but please add all necessary information there.
> (For several weeks, I will not have access to a computer with v4l2, 
> so I currently cannot work on that.)
> 
> Carl Eugen


Carl, 

My C programming knowledge is very poor, but I decided to spend some time ( whopping 8 hours ) to see if I can at least attempt to see what "could be done"
this is the "patch" I came up with:
================================================================================
--- libavdevice/v4l2.c.orig     2012-07-11 14:10:56.000000000 -0400
+++ libavdevice/v4l2.c  2012-07-11 14:14:23.000000000 -0400
@@ -55,6 +55,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/avstring.h"
+#include <stdbool.h>

 #if CONFIG_LIBV4L2
 #include <libv4l2.h>
@@ -646,6 +647,17 @@
     av_free(s->buf_len);
 }

+/* un-mute audio */
+static int v4l2_setmute_control(AVFormatContext *s1)
+{
+    struct video_data *s = s1->priv_data;
+    struct v4l2_control control;
+    control.id = V4L2_CID_AUDIO_MUTE;
+    control.value = false;
+    v4l2_ioctl(s->fd, VIDIOC_S_CTRL, &control);
+    return 0;
+}
+
 static int v4l2_set_parameters(AVFormatContext *s1)
 {
     struct video_data *s = s1->priv_data;
@@ -849,6 +861,10 @@
         res = AVERROR(EIO);
         goto out;
     }
+
+    if ((res = v4l2_setmute_control(s1)) < 0)
+         goto out;
+
     if ((res = av_image_check_size(s->width, s->height, 0, s1)) < 0)
         goto out;

============================================================================
It un-mutes the input via V4L2_CID_AUDIO_MUTE control
I understand that the code needs to be written properly ( it is not enough that it "works" - >return 0< for example, etc... )
So please take a look when you get a chance... Would you like me still to open the ticket?

Thanks,

Mike


More information about the ffmpeg-user mailing list