pix->pixelformat != V4L2_PIX_FMT_MJPEG)
return -EINVAL;
- /* We cannot change width/height in mid mpeg */
- if (atomic_read(&solo_enc->mpeg_readers) > 0) {
- if (pix->width != solo_enc->width ||
- pix->height != solo_enc->height)
- return -EBUSY;
- }
-
if (pix->width < solo_dev->video_hsize ||
pix->height < solo_dev->video_vsize << 1) {
/* Default to CIF 1/2 size */
pix->height = solo_dev->video_vsize << 1;
}
- if (pix->field == V4L2_FIELD_ANY)
- pix->field = V4L2_FIELD_INTERLACED;
- else if (pix->field != V4L2_FIELD_INTERLACED)
+ switch (pix->field) {
+ case V4L2_FIELD_NONE:
+ case V4L2_FIELD_INTERLACED:
+ break;
+ case V4L2_FIELD_ANY:
+ default:
pix->field = V4L2_FIELD_INTERLACED;
+ break;
+ }
/* Just set these */
pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
pix->sizeimage = FRAME_BUF_SIZE;
+ pix->priv = 0;
return 0;
}
mutex_lock(&solo_enc->enable_lock);
ret = solo_enc_try_fmt_cap(file, priv, f);
+ if (ret)
+ return ret;
+
+ /* We cannot change width/height in mid read */
+ if (!ret && atomic_read(&solo_enc->readers) > 0) {
+ if (pix->width != solo_enc->width ||
+ pix->height != solo_enc->height)
+ ret = -EBUSY;
+ }
if (ret) {
mutex_unlock(&solo_enc->enable_lock);
return ret;
V4L2_FIELD_NONE;
pix->sizeimage = FRAME_BUF_SIZE;
pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
+ pix->priv = 0;
return 0;
}
struct solo_enc_fh *fh = priv;
struct solo_dev *solo_dev = fh->enc->solo_dev;
- if (fsize->pixel_format != V4L2_PIX_FMT_MPEG)
+ if (fsize->pixel_format != V4L2_PIX_FMT_MPEG &&
+ fsize->pixel_format != V4L2_PIX_FMT_MJPEG)
return -EINVAL;
switch (fsize->index) {
struct solo_enc_fh *fh = priv;
struct solo_dev *solo_dev = fh->enc->solo_dev;
- if (fintv->pixel_format != V4L2_PIX_FMT_MPEG || fintv->index)
+ if (fintv->pixel_format != V4L2_PIX_FMT_MPEG &&
+ fintv->pixel_format != V4L2_PIX_FMT_MJPEG)
+ return -EINVAL;
+ if (fintv->index)
+ return -EINVAL;
+ if ((fintv->width != solo_dev->video_hsize >> 1 ||
+ fintv->height != solo_dev->video_vsize) &&
+ (fintv->width != solo_dev->video_hsize ||
+ fintv->height != solo_dev->video_vsize << 1))
return -EINVAL;
fintv->type = V4L2_FRMIVAL_TYPE_STEPWISE;
- fintv->stepwise.min.numerator = solo_dev->fps;
- fintv->stepwise.min.denominator = 1;
+ fintv->stepwise.min.denominator = solo_dev->fps;
+ fintv->stepwise.min.numerator = 15;
- fintv->stepwise.max.numerator = solo_dev->fps;
- fintv->stepwise.max.denominator = 15;
+ fintv->stepwise.max.denominator = solo_dev->fps;
+ fintv->stepwise.max.numerator = 1;
fintv->stepwise.step.numerator = 1;
fintv->stepwise.step.denominator = 1;
solo_enc->interval = cp->timeperframe.numerator;
cp->capability = V4L2_CAP_TIMEPERFRAME;
+ cp->readbuffers = 2;
solo_update_mode(solo_enc);
#include "solo6x10.h"
#include "tw28.h"
-#define SOLO_DISP_PIX_FIELD V4L2_FIELD_INTERLACED
-
/* Image size is two fields, SOLO_HW_BPL is one horizontal line in hardware */
#define SOLO_HW_BPL 2048
#define solo_vlines(__solo) (__solo->video_vsize * 2)
videobuf_queue_dma_contig_init(&fh->vidq, &solo_video_qops,
&solo_dev->pdev->dev, &fh->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
- SOLO_DISP_PIX_FIELD,
+ V4L2_FIELD_INTERLACED,
sizeof(struct videobuf_buffer),
fh, NULL);
return 0;
struct v4l2_pix_format *pix = &f->fmt.pix;
int image_size = solo_image_size(solo_dev);
- /* Check supported sizes */
- if (pix->width != solo_dev->video_hsize)
- pix->width = solo_dev->video_hsize;
- if (pix->height != solo_vlines(solo_dev))
- pix->height = solo_vlines(solo_dev);
- if (pix->sizeimage != image_size)
- pix->sizeimage = image_size;
-
- /* Check formats */
- if (pix->field == V4L2_FIELD_ANY)
- pix->field = SOLO_DISP_PIX_FIELD;
-
- if (pix->pixelformat != V4L2_PIX_FMT_UYVY ||
- pix->field != SOLO_DISP_PIX_FIELD ||
- pix->colorspace != V4L2_COLORSPACE_SMPTE170M)
+ if (pix->pixelformat != V4L2_PIX_FMT_UYVY)
return -EINVAL;
+ pix->width = solo_dev->video_hsize;
+ pix->height = solo_vlines(solo_dev);
+ pix->sizeimage = image_size;
+ pix->field = V4L2_FIELD_INTERLACED;
+ pix->pixelformat = V4L2_PIX_FMT_UYVY;
+ pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
+ pix->priv = 0;
return 0;
}
pix->width = solo_dev->video_hsize;
pix->height = solo_vlines(solo_dev);
pix->pixelformat = V4L2_PIX_FMT_UYVY;
- pix->field = SOLO_DISP_PIX_FIELD;
+ pix->field = V4L2_FIELD_INTERLACED;
pix->sizeimage = solo_image_size(solo_dev);
pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
pix->bytesperline = solo_bytesperline(solo_dev);
+ pix->priv = 0;
return 0;
}