diff options
author | Pete Eberlein <pete@sensoray.com> | 2009-09-18 20:36:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:53:52 -0400 |
commit | 669022a21662b9c8182a00c22c27afc8757f3481 (patch) | |
tree | 785eb9b859485f9231854e278bb42f1f8809445a | |
parent | f4a7d6e4ef5ae06dc81803d3e69df3c959207d1c (diff) |
V4L/DVB (13022): go7007: Fix mpeg controls
MPEG controls were disabled by Mauro's ioctl conversion patch. They are now
re-enabled and cleaned up.
Signed-off-by: Pete Eberlein <pete@sensoray.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/staging/go7007/go7007-v4l2.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/drivers/staging/go7007/go7007-v4l2.c b/drivers/staging/go7007/go7007-v4l2.c index 1098cffb6a52..0c32533e31fa 100644 --- a/drivers/staging/go7007/go7007-v4l2.c +++ b/drivers/staging/go7007/go7007-v4l2.c | |||
@@ -383,13 +383,10 @@ static int clip_to_modet_map(struct go7007 *go, int region, | |||
383 | } | 383 | } |
384 | return 0; | 384 | return 0; |
385 | } | 385 | } |
386 | #endif | ||
386 | 387 | ||
387 | static int mpeg_queryctrl(u32 id, struct v4l2_queryctrl *ctrl) | 388 | static int mpeg_queryctrl(struct v4l2_queryctrl *ctrl) |
388 | { | 389 | { |
389 | static const u32 user_ctrls[] = { | ||
390 | V4L2_CID_USER_CLASS, | ||
391 | 0 | ||
392 | }; | ||
393 | static const u32 mpeg_ctrls[] = { | 390 | static const u32 mpeg_ctrls[] = { |
394 | V4L2_CID_MPEG_CLASS, | 391 | V4L2_CID_MPEG_CLASS, |
395 | V4L2_CID_MPEG_STREAM_TYPE, | 392 | V4L2_CID_MPEG_STREAM_TYPE, |
@@ -401,26 +398,15 @@ static int mpeg_queryctrl(u32 id, struct v4l2_queryctrl *ctrl) | |||
401 | 0 | 398 | 0 |
402 | }; | 399 | }; |
403 | static const u32 *ctrl_classes[] = { | 400 | static const u32 *ctrl_classes[] = { |
404 | user_ctrls, | ||
405 | mpeg_ctrls, | 401 | mpeg_ctrls, |
406 | NULL | 402 | NULL |
407 | }; | 403 | }; |
408 | 404 | ||
409 | /* The ctrl may already contain the queried i2c controls, | 405 | ctrl->id = v4l2_ctrl_next(ctrl_classes, ctrl->id); |
410 | * query the mpeg controls if the existing ctrl id is | ||
411 | * greater than the next mpeg ctrl id. | ||
412 | */ | ||
413 | id = v4l2_ctrl_next(ctrl_classes, id); | ||
414 | if (id >= ctrl->id && ctrl->name[0]) | ||
415 | return 0; | ||
416 | |||
417 | memset(ctrl, 0, sizeof(*ctrl)); | ||
418 | ctrl->id = id; | ||
419 | 406 | ||
420 | switch (ctrl->id) { | 407 | switch (ctrl->id) { |
421 | case V4L2_CID_USER_CLASS: | ||
422 | case V4L2_CID_MPEG_CLASS: | 408 | case V4L2_CID_MPEG_CLASS: |
423 | return v4l2_ctrl_query_fill_std(ctrl); | 409 | return v4l2_ctrl_query_fill(ctrl, 0, 0, 0, 0); |
424 | case V4L2_CID_MPEG_STREAM_TYPE: | 410 | case V4L2_CID_MPEG_STREAM_TYPE: |
425 | return v4l2_ctrl_query_fill(ctrl, | 411 | return v4l2_ctrl_query_fill(ctrl, |
426 | V4L2_MPEG_STREAM_TYPE_MPEG2_DVD, | 412 | V4L2_MPEG_STREAM_TYPE_MPEG2_DVD, |
@@ -437,20 +423,21 @@ static int mpeg_queryctrl(u32 id, struct v4l2_queryctrl *ctrl) | |||
437 | V4L2_MPEG_VIDEO_ASPECT_16x9, 1, | 423 | V4L2_MPEG_VIDEO_ASPECT_16x9, 1, |
438 | V4L2_MPEG_VIDEO_ASPECT_1x1); | 424 | V4L2_MPEG_VIDEO_ASPECT_1x1); |
439 | case V4L2_CID_MPEG_VIDEO_GOP_SIZE: | 425 | case V4L2_CID_MPEG_VIDEO_GOP_SIZE: |
426 | return v4l2_ctrl_query_fill(ctrl, 0, 34, 1, 15); | ||
440 | case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: | 427 | case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: |
441 | return v4l2_ctrl_query_fill_std(ctrl); | 428 | return v4l2_ctrl_query_fill(ctrl, 0, 1, 1, 0); |
442 | case V4L2_CID_MPEG_VIDEO_BITRATE: | 429 | case V4L2_CID_MPEG_VIDEO_BITRATE: |
443 | return v4l2_ctrl_query_fill(ctrl, | 430 | return v4l2_ctrl_query_fill(ctrl, |
444 | 64000, | 431 | 64000, |
445 | 10000000, 1, | 432 | 10000000, 1, |
446 | 9800000); | 433 | 1500000); |
447 | default: | 434 | default: |
448 | break; | 435 | return -EINVAL; |
449 | } | 436 | } |
450 | return -EINVAL; | 437 | return 0; |
451 | } | 438 | } |
452 | 439 | ||
453 | static int mpeg_s_control(struct v4l2_control *ctrl, struct go7007 *go) | 440 | static int mpeg_s_ctrl(struct v4l2_control *ctrl, struct go7007 *go) |
454 | { | 441 | { |
455 | /* pretty sure we can't change any of these while streaming */ | 442 | /* pretty sure we can't change any of these while streaming */ |
456 | if (go->streaming) | 443 | if (go->streaming) |
@@ -528,6 +515,8 @@ static int mpeg_s_control(struct v4l2_control *ctrl, struct go7007 *go) | |||
528 | } | 515 | } |
529 | break; | 516 | break; |
530 | case V4L2_CID_MPEG_VIDEO_GOP_SIZE: | 517 | case V4L2_CID_MPEG_VIDEO_GOP_SIZE: |
518 | if (ctrl->value < 0 || ctrl->value > 34) | ||
519 | return -EINVAL; | ||
531 | go->gop_size = ctrl->value; | 520 | go->gop_size = ctrl->value; |
532 | break; | 521 | break; |
533 | case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: | 522 | case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: |
@@ -547,7 +536,7 @@ static int mpeg_s_control(struct v4l2_control *ctrl, struct go7007 *go) | |||
547 | return 0; | 536 | return 0; |
548 | } | 537 | } |
549 | 538 | ||
550 | static int mpeg_g_control(struct v4l2_control *ctrl, struct go7007 *go) | 539 | static int mpeg_g_ctrl(struct v4l2_control *ctrl, struct go7007 *go) |
551 | { | 540 | { |
552 | switch (ctrl->id) { | 541 | switch (ctrl->id) { |
553 | case V4L2_CID_MPEG_STREAM_TYPE: | 542 | case V4L2_CID_MPEG_STREAM_TYPE: |
@@ -600,7 +589,6 @@ static int mpeg_g_control(struct v4l2_control *ctrl, struct go7007 *go) | |||
600 | } | 589 | } |
601 | return 0; | 590 | return 0; |
602 | } | 591 | } |
603 | #endif | ||
604 | 592 | ||
605 | static int vidioc_querycap(struct file *file, void *priv, | 593 | static int vidioc_querycap(struct file *file, void *priv, |
606 | struct v4l2_capability *cap) | 594 | struct v4l2_capability *cap) |
@@ -996,7 +984,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, | |||
996 | 984 | ||
997 | i2c_clients_command(&go->i2c_adapter, VIDIOC_QUERYCTRL, query); | 985 | i2c_clients_command(&go->i2c_adapter, VIDIOC_QUERYCTRL, query); |
998 | 986 | ||
999 | return (!query->name[0]) ? -EINVAL : 0; | 987 | return (!query->name[0]) ? mpeg_queryctrl(query) : 0; |
1000 | } | 988 | } |
1001 | 989 | ||
1002 | static int vidioc_g_ctrl(struct file *file, void *priv, | 990 | static int vidioc_g_ctrl(struct file *file, void *priv, |
@@ -1013,7 +1001,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, | |||
1013 | query.id = ctrl->id; | 1001 | query.id = ctrl->id; |
1014 | i2c_clients_command(&go->i2c_adapter, VIDIOC_QUERYCTRL, &query); | 1002 | i2c_clients_command(&go->i2c_adapter, VIDIOC_QUERYCTRL, &query); |
1015 | if (query.name[0] == 0) | 1003 | if (query.name[0] == 0) |
1016 | return -EINVAL; | 1004 | return mpeg_g_ctrl(ctrl, go); |
1017 | i2c_clients_command(&go->i2c_adapter, VIDIOC_G_CTRL, ctrl); | 1005 | i2c_clients_command(&go->i2c_adapter, VIDIOC_G_CTRL, ctrl); |
1018 | 1006 | ||
1019 | return 0; | 1007 | return 0; |
@@ -1033,7 +1021,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
1033 | query.id = ctrl->id; | 1021 | query.id = ctrl->id; |
1034 | i2c_clients_command(&go->i2c_adapter, VIDIOC_QUERYCTRL, &query); | 1022 | i2c_clients_command(&go->i2c_adapter, VIDIOC_QUERYCTRL, &query); |
1035 | if (query.name[0] == 0) | 1023 | if (query.name[0] == 0) |
1036 | return -EINVAL; | 1024 | return mpeg_s_ctrl(ctrl, go); |
1037 | i2c_clients_command(&go->i2c_adapter, VIDIOC_S_CTRL, ctrl); | 1025 | i2c_clients_command(&go->i2c_adapter, VIDIOC_S_CTRL, ctrl); |
1038 | 1026 | ||
1039 | return 0; | 1027 | return 0; |