diff mbox

[2/7] hverkuil/go7007: staging: media: go7007: Add Frameintervals

Message ID 1362924286-23995-2-git-send-email-volokh84@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Volokh Konstantin March 10, 2013, 2:04 p.m. UTC
Signed-off-by: Volokh Konstantin <volokh84@gmail.com>
---
 drivers/staging/media/go7007/go7007-v4l2.c |  123 ++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c
index 4ec9b84..96538f6 100644
--- a/drivers/staging/media/go7007/go7007-v4l2.c
+++ b/drivers/staging/media/go7007/go7007-v4l2.c
@@ -703,6 +703,129 @@  static int vidioc_enum_frameintervals(struct file *filp, void *priv,
 {
 	struct go7007 *go = video_drvdata(filp);
 
+	if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) {
+		switch (fival->pixel_format) {
+		case V4L2_PIX_FMT_MJPEG:
+		case V4L2_PIX_FMT_MPEG:
+		case V4L2_PIX_FMT_H263:
+			switch (go->standard) {
+			case GO7007_STD_NTSC:
+				switch (fival->index) {
+				case 0:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*1;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 1:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*2;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 2:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*3;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 3:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*4;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 4:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*5;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 5:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*6;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 6:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*7;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 7:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*10;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 8:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*15;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 9:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*30;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				default:
+					return -EINVAL;
+				}
+				break;
+			case GO7007_STD_PAL:
+				switch (fival->index) {
+				case 0:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*1;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 1:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*2;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 2:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*3;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 3:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*4;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 4:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*5;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 5:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*6;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 6:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*8;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 7:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*13;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				case 8:
+					fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
+					fival->discrete.numerator = 1001*25;
+					fival->discrete.denominator = go->sensor_framerate;
+					break;
+				default:
+					return -EINVAL;
+				}
+				break;
+			default:
+				return -EINVAL;
+			}
+			break;
+		default:
+			return -EINVAL;
+		}
+		return 0;
+	}
+
 	if (fival->index > 0)
 		return -EINVAL;