Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 366830
b: refs/heads/master
c: 016afda
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 25, 2013
1 parent 55a49d6 commit ee843b6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c813bd3c8dce3564166e2c4f839fd36df7b0ba5d
refs/heads/master: 016afda4fb298aa2e5515048fcba0271ad6f7320
51 changes: 35 additions & 16 deletions trunk/drivers/staging/media/solo6x10/v4l2-enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,13 +1039,6 @@ static int solo_enc_try_fmt_cap(struct file *file, void *priv,
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 */
Expand All @@ -1057,14 +1050,20 @@ static int solo_enc_try_fmt_cap(struct file *file, void *priv,
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;
}
Expand All @@ -1081,6 +1080,15 @@ static int solo_enc_set_fmt_cap(struct file *file, void *priv,
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;
Expand Down Expand Up @@ -1116,6 +1124,7 @@ static int solo_enc_get_fmt_cap(struct file *file, void *priv,
V4L2_FIELD_NONE;
pix->sizeimage = FRAME_BUF_SIZE;
pix->colorspace = V4L2_COLORSPACE_SMPTE170M;
pix->priv = 0;

return 0;
}
Expand Down Expand Up @@ -1205,7 +1214,8 @@ static int solo_enum_framesizes(struct file *file, void *priv,
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) {
Expand All @@ -1232,16 +1242,24 @@ static int solo_enum_frameintervals(struct file *file, void *priv,
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;
Expand Down Expand Up @@ -1298,6 +1316,7 @@ static int solo_s_parm(struct file *file, void *priv,
solo_enc->interval = cp->timeperframe.numerator;

cp->capability = V4L2_CAP_TIMEPERFRAME;
cp->readbuffers = 2;

solo_update_mode(solo_enc);

Expand Down
30 changes: 11 additions & 19 deletions trunk/drivers/staging/media/solo6x10/v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#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)
Expand Down Expand Up @@ -439,7 +437,7 @@ static int solo_v4l2_open(struct file *file)
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;
Expand Down Expand Up @@ -581,23 +579,16 @@ static int solo_try_fmt_cap(struct file *file, void *priv,
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;
}

Expand All @@ -624,10 +615,11 @@ static int solo_get_fmt_cap(struct file *file, void *priv,
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;
}
Expand Down

0 comments on commit ee843b6

Please sign in to comment.