diff options
-rw-r--r-- | linux/drivers/media/video/ivtv/ivtv-cards.h | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/ivtv/ivtv-ioctl.c | 81 | ||||
-rw-r--r-- | linux/drivers/media/video/zoran_driver.c | 6 | ||||
-rw-r--r-- | linux/include/linux/videodev2.h | 21 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-ctl.cpp | 45 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-dbg.cpp | 2 |
6 files changed, 72 insertions, 85 deletions
diff --git a/linux/drivers/media/video/ivtv/ivtv-cards.h b/linux/drivers/media/video/ivtv/ivtv-cards.h index 15012f88b..91e9e90c1 100644 --- a/linux/drivers/media/video/ivtv/ivtv-cards.h +++ b/linux/drivers/media/video/ivtv/ivtv-cards.h @@ -86,7 +86,7 @@ V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ V4L2_CAP_SLICED_VBI_CAPTURE) #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ - V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY | V4L2_CAP_VIDEO_OUTPUT_POS) + V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY) struct ivtv_card_video_input { u8 video_type; /* video input type */ diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c index 5b799f016..15c2c9f5c 100644 --- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c @@ -362,56 +362,46 @@ static int ivtv_get_fmt(struct ivtv *itv, int streamtype, struct v4l2_format *fm case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return -EINVAL; -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fmt->fmt.pix.left = itv->main_rect.left; - fmt->fmt.pix.top = itv->main_rect.top; -#endif - fmt->fmt.pix.width = itv->main_rect.width; - fmt->fmt.pix.height = itv->main_rect.height; - fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; - fmt->fmt.pix.field = V4L2_FIELD_INTERLACED; + fmt->fmt.pix_out.left = itv->main_rect.left; + fmt->fmt.pix_out.top = itv->main_rect.top; + fmt->fmt.pix_out.width = itv->main_rect.width; + fmt->fmt.pix_out.height = itv->main_rect.height; + fmt->fmt.pix_out.colorspace = V4L2_COLORSPACE_SMPTE170M; + fmt->fmt.pix_out.field = V4L2_FIELD_INTERLACED; if (itv->output_mode == OUT_UDMA_YUV) { switch (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) { case IVTV_YUV_MODE_INTERLACED: - fmt->fmt.pix.field = (itv->yuv_info.lace_mode & IVTV_YUV_SYNC_MASK) ? + fmt->fmt.pix_out.field = (itv->yuv_info.lace_mode & IVTV_YUV_SYNC_MASK) ? V4L2_FIELD_INTERLACED_BT : V4L2_FIELD_INTERLACED_TB; break; case IVTV_YUV_MODE_PROGRESSIVE: - fmt->fmt.pix.field = V4L2_FIELD_NONE; + fmt->fmt.pix_out.field = V4L2_FIELD_NONE; break; default: - fmt->fmt.pix.field = V4L2_FIELD_ANY; + fmt->fmt.pix_out.field = V4L2_FIELD_ANY; break; } - fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_HM12; + fmt->fmt.pix_out.pixelformat = V4L2_PIX_FMT_HM12; /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */ - fmt->fmt.pix.sizeimage = + fmt->fmt.pix_out.sizeimage = fmt->fmt.pix.height * fmt->fmt.pix.width + fmt->fmt.pix.height * (fmt->fmt.pix.width / 2); } else if (itv->output_mode == OUT_YUV || streamtype == IVTV_ENC_STREAM_TYPE_YUV || streamtype == IVTV_DEC_STREAM_TYPE_YUV) { - fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_HM12; + fmt->fmt.pix_out.pixelformat = V4L2_PIX_FMT_HM12; /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */ - fmt->fmt.pix.sizeimage = - fmt->fmt.pix.height * fmt->fmt.pix.width + - fmt->fmt.pix.height * (fmt->fmt.pix.width / 2); + fmt->fmt.pix_out.sizeimage = + fmt->fmt.pix_out.height * fmt->fmt.pix_out.width + + fmt->fmt.pix_out.height * (fmt->fmt.pix_out.width / 2); } else { - fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; - fmt->fmt.pix.sizeimage = 128 * 1024; + fmt->fmt.pix_out.pixelformat = V4L2_PIX_FMT_MPEG; + fmt->fmt.pix_out.sizeimage = 128 * 1024; } break; case V4L2_BUF_TYPE_VIDEO_CAPTURE: -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fmt->fmt.pix.left = 0; - fmt->fmt.pix.top = 0; -#endif fmt->fmt.pix.width = itv->params.width; fmt->fmt.pix.height = itv->params.height; fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; @@ -505,33 +495,22 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return -EINVAL; - field = fmt->fmt.pix.field; -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - r.top = fmt->fmt.pix.top; - r.left = fmt->fmt.pix.left; -#else - r.top = 0; - r.left = 0; -#endif - r.width = fmt->fmt.pix.width; - r.height = fmt->fmt.pix.height; + field = fmt->fmt.pix_out.field; + r.top = fmt->fmt.pix_out.top; + r.left = fmt->fmt.pix_out.left; + r.width = fmt->fmt.pix_out.width; + r.height = fmt->fmt.pix_out.height; ivtv_get_fmt(itv, streamtype, fmt); if (itv->output_mode != OUT_UDMA_YUV) { /* TODO: would setting the rect also be valid for this mode? */ -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fmt->fmt.pix.top = r.top; - fmt->fmt.pix.left = r.left; -#endif - fmt->fmt.pix.width = r.width; - fmt->fmt.pix.height = r.height; + fmt->fmt.pix_out.top = r.top; + fmt->fmt.pix_out.left = r.left; + fmt->fmt.pix_out.width = r.width; + fmt->fmt.pix_out.height = r.height; } if (itv->output_mode == OUT_UDMA_YUV) { /* TODO: add checks for validity */ - fmt->fmt.pix.field = field; + fmt->fmt.pix_out.field = field; } if (set_fmt) { if (itv->output_mode == OUT_UDMA_YUV) { @@ -1172,12 +1151,6 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void fb->fmt.pixelformat = itv->osd_pixelformat; fb->fmt.width = itv->osd_rect.width; fb->fmt.height = itv->osd_rect.height; -#if 0 - /* Temporarily removed until a better solution is in place that does not - break the ABI */ - fb->fmt.left = itv->osd_rect.left; - fb->fmt.top = itv->osd_rect.top; -#endif fb->base = (void *)itv->osd_video_pbase; if (itv->osd_global_alpha_state) fb->flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA; diff --git a/linux/drivers/media/video/zoran_driver.c b/linux/drivers/media/video/zoran_driver.c index de85abc45..38c1c5978 100644 --- a/linux/drivers/media/video/zoran_driver.c +++ b/linux/drivers/media/video/zoran_driver.c @@ -2894,8 +2894,12 @@ zoran_do_ioctl (struct inode *inode, return res; break; - case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: + /* Clear v4l2_pix_out_format fields, the position is always 0. */ + fmt->fmt.pix_out.top = 0; + fmt->fmt.pix_out.left = 0; + /* fall through */ + case V4L2_BUF_TYPE_VIDEO_CAPTURE: printformat = __cpu_to_le32(fmt->fmt.pix.pixelformat); diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h index 8e46a2029..3d92c6b69 100644 --- a/linux/include/linux/videodev2.h +++ b/linux/include/linux/videodev2.h @@ -243,8 +243,7 @@ struct v4l2_capability #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */ -#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */ +#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ @@ -1274,6 +1273,23 @@ struct v4l2_encoder_cmd { * Data services API by Michael Schimek */ +/* Video output format */ +/* The first part of this structure is identical to the v4l2_pix_format + structure, the fields after 'priv' are specific to the video output format. */ +struct v4l2_pix_out_format +{ + __u32 width; + __u32 height; + __u32 pixelformat; + enum v4l2_field field; + __u32 bytesperline; /* for padding, zero if unused */ + __u32 sizeimage; + enum v4l2_colorspace colorspace; + __u32 priv; /* private data, depends on pixelformat */ + __u32 top; + __u32 left; +}; + /* Raw VBI */ struct v4l2_vbi_format { @@ -1356,6 +1372,7 @@ struct v4l2_format union { struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE + struct v4l2_pix_out_format pix_out; // V4L2_BUF_TYPE_VIDEO_OUTPUT struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE diff --git a/v4l2-apps/util/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp index 35d9f466b..0ce63bb1a 100644 --- a/v4l2-apps/util/v4l2-ctl.cpp +++ b/v4l2-apps/util/v4l2-ctl.cpp @@ -678,7 +678,6 @@ static int printfmt(struct v4l2_format vfmt) switch (vfmt.type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - case V4L2_BUF_TYPE_VIDEO_OUTPUT: printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); printf("\tWidth/Height : %u/%u\n", vfmt.fmt.pix.width, vfmt.fmt.pix.height); printf("\tPixel Format : %s\n", fcc2s(vfmt.fmt.pix.pixelformat).c_str()); @@ -686,17 +685,21 @@ static int printfmt(struct v4l2_format vfmt) printf("\tBytes per Line: %u\n", vfmt.fmt.pix.bytesperline); printf("\tSize Image : %u\n", vfmt.fmt.pix.sizeimage); printf("\tColorspace : %s\n", colorspace2s(vfmt.fmt.pix.colorspace).c_str()); -#if 0 - /* Comment out until ABI breakage is resolved */ - if (vfmt.type == V4L2_BUF_TYPE_VIDEO_OUTPUT && - (capabilities & V4L2_CAP_VIDEO_OUTPUT_POS)) { - printf("\tLeft/Top : %d/%d\n", - vfmt.fmt.pix.left, vfmt.fmt.pix.top); - } -#endif if (vfmt.fmt.pix.priv) printf("\tCustom Info : %08x\n", vfmt.fmt.pix.priv); break; + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); + printf("\tWidth/Height : %u/%u\n", vfmt.fmt.pix_out.width, vfmt.fmt.pix_out.height); + printf("\tPixel Format : %s\n", fcc2s(vfmt.fmt.pix_out.pixelformat).c_str()); + printf("\tField : %s\n", field2s(vfmt.fmt.pix_out.field).c_str()); + printf("\tBytes per Line: %u\n", vfmt.fmt.pix_out.bytesperline); + printf("\tSize Image : %u\n", vfmt.fmt.pix_out.sizeimage); + printf("\tColorspace : %s\n", colorspace2s(vfmt.fmt.pix_out.colorspace).c_str()); + printf("\tLeft/Top : %d/%d\n", vfmt.fmt.pix_out.left, vfmt.fmt.pix_out.top); + if (vfmt.fmt.pix_out.priv) + printf("\tCustom Info : %08x\n", vfmt.fmt.pix_out.priv); + break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: case V4L2_BUF_TYPE_VIDEO_OVERLAY: printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); @@ -860,8 +863,6 @@ static std::string cap2s(unsigned cap) s += "\t\tSliced VBI Output\n"; if (cap & V4L2_CAP_RDS_CAPTURE) s += "\t\tRDS Capture\n"; - if (cap & V4L2_CAP_VIDEO_OUTPUT_POS) - s += "\t\tVideo Output Position\n"; if (cap & V4L2_CAP_TUNER) s += "\t\tTuner\n"; if (cap & V4L2_CAP_AUDIO) @@ -1158,23 +1159,20 @@ int main(int argc, char **argv) }; switch (parse_subopt(&subs, subopts, &value)) { -#if 0 - /* Comment out until ABI breakage is resolved */ case 0: - vfmt_out.fmt.pix.top = strtol(value, 0L, 0); + vfmt_out.fmt.pix_out.top = strtol(value, 0L, 0); set_fmts_out |= FmtTop; break; case 1: - vfmt_out.fmt.pix.left = strtol(value, 0L, 0); + vfmt_out.fmt.pix_out.left = strtol(value, 0L, 0); set_fmts_out |= FmtLeft; break; -#endif case 2: - vfmt_out.fmt.pix.width = strtol(value, 0L, 0); + vfmt_out.fmt.pix_out.width = strtol(value, 0L, 0); set_fmts_out |= FmtWidth; break; case 3: - vfmt_out.fmt.pix.height = strtol(value, 0L, 0); + vfmt_out.fmt.pix_out.height = strtol(value, 0L, 0); set_fmts_out |= FmtHeight; break; } @@ -1558,17 +1556,14 @@ int main(int argc, char **argv) if (ioctl(fd, VIDIOC_G_FMT, &in_vfmt) < 0) fprintf(stderr, "ioctl: VIDIOC_G_FMT failed\n"); else { -#if 0 - /* Comment out until ABI breakage is resolved */ if (set_fmts_out & FmtTop) - in_vfmt.fmt.pix.top = vfmt_out.fmt.pix.top; + in_vfmt.fmt.pix_out.top = vfmt_out.fmt.pix_out.top; if (set_fmts_out & FmtLeft) - in_vfmt.fmt.pix.left = vfmt_out.fmt.pix.left; -#endif + in_vfmt.fmt.pix_out.left = vfmt_out.fmt.pix_out.left; if (set_fmts_out & FmtWidth) - in_vfmt.fmt.pix.width = vfmt_out.fmt.pix.width; + in_vfmt.fmt.pix_out.width = vfmt_out.fmt.pix_out.width; if (set_fmts_out & FmtHeight) - in_vfmt.fmt.pix.height = vfmt_out.fmt.pix.height; + in_vfmt.fmt.pix_out.height = vfmt_out.fmt.pix_out.height; if (ioctl(fd, VIDIOC_S_FMT, &in_vfmt) < 0) fprintf(stderr, "ioctl: VIDIOC_S_FMT failed\n"); } diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp index 6f373281e..10c9a8927 100644 --- a/v4l2-apps/util/v4l2-dbg.cpp +++ b/v4l2-apps/util/v4l2-dbg.cpp @@ -160,8 +160,6 @@ static std::string cap2s(unsigned cap) s += "\t\tSliced VBI Output\n"; if (cap & V4L2_CAP_RDS_CAPTURE) s += "\t\tRDS Capture\n"; - if (cap & V4L2_CAP_VIDEO_OUTPUT_POS) - s += "\t\tVideo Output Position\n"; if (cap & V4L2_CAP_TUNER) s += "\t\tTuner\n"; if (cap & V4L2_CAP_AUDIO) |