[FFmpeg-devel] libavformat and video4linux2 acquire problems
Luca Abeni
lucabe72
Wed May 9 17:21:31 CEST 2007
Hi Limin,
Limin Wang wrote:
[...]
>> If you provide a patch, and it does not break dv capturing or similar
>> things, I'll be very happy to apply it.
>
> Please review the attached patch
Thanks. I'll have a look tonight, and I'll commit tomorrow.
> I have check dv1394, it'll not break if standard is NULL and input is -1 case.
Uhmm... I did not try, but I see this code in dv1394.c:
if (ap->standard && !strcasecmp(ap->standard, "pal"))
dv->format = DV1394_PAL;
else
dv->format = DV1394_NTSC;
if (ap->channel)
dv->channel = ap->channel;
else
dv->channel = DV1394_DEFAULT_CHANNEL;
So, standard==NULL should not be a problem (unless strcasecmp() crashes
if the first parameter is NULL --- I'll check that), but channel == -1
can be a problem, because dv->channel will be set to -1 instead of
DV1394_DEFAULT_CHANNEL. But I do not know what this would imply...
So, maybe the safest thing is to remove the "video_channel = -1" part
from your patch... I'll think about it later.
Thanks,
Luca
>
>
> Thanks,
> Limin
>
>
>
>
> ------------------------------------------------------------------------
>
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c (revision 8950)
> +++ ffmpeg.c (working copy)
> @@ -181,8 +181,8 @@
>
> static int rate_emu = 0;
>
> -static int video_channel = 0;
> -static char *video_standard = "ntsc";
> +static int video_channel = -1;
> +static char *video_standard;
>
> static int audio_volume = 256;
>
> @@ -3833,7 +3833,8 @@
> av_free(vstats_filename);
>
> av_free(opt_names);
> -
> + av_free(video_standard);
> +
> #ifdef CONFIG_POWERPC_PERF
> extern void powerpc_display_perf_report(void);
> powerpc_display_perf_report();
> Index: libavformat/v4l2.c
> ===================================================================
> --- libavformat/v4l2.c (revision 8950)
> +++ libavformat/v4l2.c (working copy)
> @@ -429,47 +429,51 @@
> struct v4l2_standard standard;
> int i;
>
> - /* set tv video input */
> - memset (&input, 0, sizeof (input));
> - input.index = ap->channel;
> - if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
> - av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n");
> - return AVERROR_IO;
> - }
> + if(ap->channel>=0) {
> + /* set tv video input */
> + memset (&input, 0, sizeof (input));
> + input.index = ap->channel;
> + if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
> + av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n");
> + return AVERROR_IO;
> + }
>
> - av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
> - ap->channel, input.name);
> - if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) {
> - av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
> - ap->channel);
> - return AVERROR_IO;
> + av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
> + ap->channel, input.name);
> + if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) {
> + av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
> + ap->channel);
> + return AVERROR_IO;
> + }
> }
>
> - av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
> - ap->standard );
> - /* set tv standard */
> - memset (&standard, 0, sizeof (standard));
> - for(i=0;;i++) {
> - standard.index = i;
> - if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
> + if(ap->standard) {
> + av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
> + ap->standard );
> + /* set tv standard */
> + memset (&standard, 0, sizeof (standard));
> + for(i=0;;i++) {
> + standard.index = i;
> + if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
> + av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
> + ap->standard);
> + return AVERROR_IO;
> + }
> +
> + if(!strcasecmp(standard.name, ap->standard)) {
> + break;
> + }
> + }
> +
> + av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
> + ap->standard, standard.id);
> + if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
> av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
> ap->standard);
> return AVERROR_IO;
> }
> -
> - if(!strcasecmp(standard.name, ap->standard)) {
> - break;
> - }
> }
>
> - av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
> - ap->standard, standard.id);
> - if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
> - av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
> - ap->standard);
> - return AVERROR_IO;
> - }
> -
> return 0;
> }
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list