Ticket #1074: use_specified_webcam_resolution.patch

File use_specified_webcam_resolution.patch, 1.9 KB (added by mplayerbugzilla@…, 18 years ago)

Allows mplayer to use the specified resolutions for UVC webcams

  • stream/tvi_v4l2.c

     
    780780        return TVI_CONTROL_TRUE;
    781781    case TVI_CONTROL_VID_CHK_WIDTH:
    782782        return TVI_CONTROL_TRUE;
     783    case TVI_CONTROL_VID_SET_WIDTH_HEIGHT:
     784        if (getfmt(priv) < 0) return TVI_CONTROL_FALSE;
     785        priv->format.fmt.pix.width = ((int *)arg)[0];
     786        priv->format.fmt.pix.height = ((int *)arg)[1];
     787        priv->format.fmt.pix.field = V4L2_FIELD_ANY;
     788        if (ioctl(priv->video_fd, VIDIOC_S_FMT, &priv->format) < 0)
     789          return TVI_CONTROL_FALSE;
     790        return TVI_CONTROL_TRUE;
    783791    case TVI_CONTROL_VID_SET_WIDTH:
    784792        if (getfmt(priv) < 0) return TVI_CONTROL_FALSE;
    785793        priv->format.fmt.pix.width = *(int *)arg;
  • stream/tv.c

     
    439439#endif
    440440
    441441    /* limits on w&h are norm-dependent -- JM */
     442    if (tvh->tv_param->width != -1 && tvh->tv_param->height != -1) {
     443      // first tell the driver both width and height, some drivers do not support setting them independently.
     444      int dim[2];
     445      dim[0] = tvh->tv_param->width; dim[1] = tvh->tv_param->height;
     446      funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH_HEIGHT, dim);
     447    }
    442448    /* set width */
    443449    if (tvh->tv_param->width != -1)
    444450    {
  • stream/tv.h

     
    177177#define TVI_CONTROL_VID_GET_GAIN        0x120
    178178
    179179/* TUNER controls */
     180#define TVI_CONTROL_VID_SET_WIDTH_HEIGHT 0x121
    180181#define TVI_CONTROL_TUN_GET_FREQ        0x201
    181182#define TVI_CONTROL_TUN_SET_FREQ        0x202
    182183#define TVI_CONTROL_TUN_GET_TUNER       0x203   /* update priv->tuner struct for used input */