Revision e4dd03f3 libavformat/v4l2.c

View differences:

libavformat/v4l2.c
430 430
    int i;
431 431

  
432 432
    if(ap->channel>=0) {
433
    /* set tv video input */
434
    memset (&input, 0, sizeof (input));
435
    input.index = ap->channel;
436
    if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
437
        av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n");
438
        return AVERROR_IO;
439
    }
433
        /* set tv video input */
434
        memset (&input, 0, sizeof (input));
435
        input.index = ap->channel;
436
        if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
437
            av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n");
438
            return AVERROR_IO;
439
        }
440 440

  
441
    av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
442
           ap->channel, input.name);
443
    if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) {
444
        av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
445
            ap->channel);
446
        return AVERROR_IO;
447
    }
441
        av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
442
               ap->channel, input.name);
443
        if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) {
444
            av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
445
                   ap->channel);
446
            return AVERROR_IO;
447
        }
448 448
    }
449 449

  
450 450
    if(ap->standard) {
451
    av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
452
           ap->standard );
453
    /* set tv standard */
454
    memset (&standard, 0, sizeof (standard));
455
    for(i=0;;i++) {
456
        standard.index = i;
457
        if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
451
        av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
452
               ap->standard );
453
        /* set tv standard */
454
        memset (&standard, 0, sizeof (standard));
455
        for(i=0;;i++) {
456
            standard.index = i;
457
            if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
458
                av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
459
                       ap->standard);
460
                return AVERROR_IO;
461
            }
462

  
463
            if(!strcasecmp(standard.name, ap->standard)) {
464
                break;
465
            }
466
        }
467

  
468
        av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
469
               ap->standard, standard.id);
470
        if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
458 471
            av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
459 472
                   ap->standard);
460 473
            return AVERROR_IO;
461 474
        }
462

  
463
        if(!strcasecmp(standard.name, ap->standard)) {
464
            break;
465
        }
466
    }
467

  
468
    av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
469
           ap->standard, standard.id);
470
    if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
471
        av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
472
            ap->standard);
473
        return AVERROR_IO;
474
    }
475 475
    }
476 476

  
477 477
    return 0;

Also available in: Unified diff