diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-06-27 20:18:15 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:14:23 -0400 |
commit | 8b53b39d6228cda41b7ddfc9d094a072afca6655 (patch) | |
tree | b6ad8f7d5708e5ef4021895342c91af378f04097 /drivers/media/video/saa7134/saa6752hs.c | |
parent | e5e4cd8df61e602202f588dd545364dba37b4cc7 (diff) |
V4L/DVB (8151): saa7134-empress: fix MPEG control support
The MPEG controls could not be enumerated and so could not be read or set
through the v4l2-ctl utility or shown in control panels.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa6752hs.c')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 002e70a33a4f..fc32c3f68af1 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -448,6 +448,104 @@ static int handle_ctrl(struct saa6752hs_mpeg_params *params, | |||
448 | return 0; | 448 | return 0; |
449 | } | 449 | } |
450 | 450 | ||
451 | static int saa6752hs_qctrl(struct saa6752hs_mpeg_params *params, | ||
452 | struct v4l2_queryctrl *qctrl) | ||
453 | { | ||
454 | int err; | ||
455 | |||
456 | switch (qctrl->id) { | ||
457 | case V4L2_CID_MPEG_AUDIO_ENCODING: | ||
458 | return v4l2_ctrl_query_fill(qctrl, | ||
459 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | ||
460 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, | ||
461 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2); | ||
462 | |||
463 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: | ||
464 | return v4l2_ctrl_query_fill(qctrl, | ||
465 | V4L2_MPEG_AUDIO_L2_BITRATE_256K, | ||
466 | V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1, | ||
467 | V4L2_MPEG_AUDIO_L2_BITRATE_256K); | ||
468 | |||
469 | case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: | ||
470 | return v4l2_ctrl_query_fill(qctrl, | ||
471 | V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, | ||
472 | V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, 1, | ||
473 | V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000); | ||
474 | |||
475 | case V4L2_CID_MPEG_VIDEO_ENCODING: | ||
476 | return v4l2_ctrl_query_fill(qctrl, | ||
477 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2, | ||
478 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2, 1, | ||
479 | V4L2_MPEG_VIDEO_ENCODING_MPEG_2); | ||
480 | |||
481 | case V4L2_CID_MPEG_VIDEO_ASPECT: | ||
482 | return v4l2_ctrl_query_fill(qctrl, | ||
483 | V4L2_MPEG_VIDEO_ASPECT_4x3, | ||
484 | V4L2_MPEG_VIDEO_ASPECT_16x9, 1, | ||
485 | V4L2_MPEG_VIDEO_ASPECT_4x3); | ||
486 | |||
487 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | ||
488 | err = v4l2_ctrl_query_fill_std(qctrl); | ||
489 | if (err == 0 && | ||
490 | params->vi_bitrate_mode == | ||
491 | V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) | ||
492 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; | ||
493 | return err; | ||
494 | |||
495 | case V4L2_CID_MPEG_STREAM_TYPE: | ||
496 | return v4l2_ctrl_query_fill(qctrl, | ||
497 | V4L2_MPEG_STREAM_TYPE_MPEG2_TS, | ||
498 | V4L2_MPEG_STREAM_TYPE_MPEG2_TS, 1, | ||
499 | V4L2_MPEG_STREAM_TYPE_MPEG2_TS); | ||
500 | |||
501 | case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: | ||
502 | case V4L2_CID_MPEG_VIDEO_BITRATE: | ||
503 | case V4L2_CID_MPEG_STREAM_PID_PMT: | ||
504 | case V4L2_CID_MPEG_STREAM_PID_AUDIO: | ||
505 | case V4L2_CID_MPEG_STREAM_PID_VIDEO: | ||
506 | case V4L2_CID_MPEG_STREAM_PID_PCR: | ||
507 | return v4l2_ctrl_query_fill_std(qctrl); | ||
508 | |||
509 | default: | ||
510 | break; | ||
511 | } | ||
512 | return -EINVAL; | ||
513 | } | ||
514 | |||
515 | static int saa6752hs_qmenu(struct saa6752hs_mpeg_params *params, | ||
516 | struct v4l2_querymenu *qmenu) | ||
517 | { | ||
518 | static const char *mpeg_audio_l2_bitrate[] = { | ||
519 | "", | ||
520 | "", | ||
521 | "", | ||
522 | "", | ||
523 | "", | ||
524 | "", | ||
525 | "", | ||
526 | "", | ||
527 | "", | ||
528 | "", | ||
529 | "", | ||
530 | "256 kbps", | ||
531 | "", | ||
532 | "384 kbps", | ||
533 | NULL | ||
534 | }; | ||
535 | struct v4l2_queryctrl qctrl; | ||
536 | int err; | ||
537 | |||
538 | qctrl.id = qmenu->id; | ||
539 | err = saa6752hs_qctrl(params, &qctrl); | ||
540 | if (err) | ||
541 | return err; | ||
542 | if (qmenu->id == V4L2_CID_MPEG_AUDIO_L2_BITRATE) | ||
543 | return v4l2_ctrl_query_menu(qmenu, &qctrl, | ||
544 | mpeg_audio_l2_bitrate); | ||
545 | return v4l2_ctrl_query_menu(qmenu, &qctrl, | ||
546 | v4l2_ctrl_get_menu(qmenu->id)); | ||
547 | } | ||
548 | |||
451 | static int saa6752hs_init(struct i2c_client* client) | 549 | static int saa6752hs_init(struct i2c_client* client) |
452 | { | 550 | { |
453 | unsigned char buf[9], buf2[4]; | 551 | unsigned char buf[9], buf2[4]; |
@@ -662,6 +760,10 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
662 | } | 760 | } |
663 | h->params = params; | 761 | h->params = params; |
664 | break; | 762 | break; |
763 | case VIDIOC_QUERYCTRL: | ||
764 | return saa6752hs_qctrl(&h->params, arg); | ||
765 | case VIDIOC_QUERYMENU: | ||
766 | return saa6752hs_qmenu(&h->params, arg); | ||
665 | case VIDIOC_G_FMT: | 767 | case VIDIOC_G_FMT: |
666 | { | 768 | { |
667 | struct v4l2_format *f = arg; | 769 | struct v4l2_format *f = arg; |