aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx2341x.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-21 16:47:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:54 -0400
commit10afbef15e7bba5e1008f583852077743d28c395 (patch)
tree73dbfe2a3ccde6ef75c3403fb189274247740003 /drivers/media/video/cx2341x.c
parent1df795370c1392a026c63816368108187aec2ec1 (diff)
V4L/DVB (10698): v4l2-common: remove v4l2_ctrl_query_fill_std
The v4l2_ctrl_query_fill_std() function wasn't one the best idea I ever had. It doesn't add anything valuable that cannot be expressed equally well with v4l2_ctrl_query_fill and only adds overhead. Replace it with v4l2_ctrl_query_fill() everywhere it is used and remove it from v4l2_common.c. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx2341x.c')
-rw-r--r--drivers/media/video/cx2341x.c108
1 files changed, 85 insertions, 23 deletions
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index b36f522d2c55..8ded52946334 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -500,6 +500,29 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
500 int err; 500 int err;
501 501
502 switch (qctrl->id) { 502 switch (qctrl->id) {
503 case V4L2_CID_MPEG_STREAM_TYPE:
504 return v4l2_ctrl_query_fill(qctrl,
505 V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
506 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD, 1,
507 V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
508
509 case V4L2_CID_MPEG_STREAM_VBI_FMT:
510 if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI)
511 return v4l2_ctrl_query_fill(qctrl,
512 V4L2_MPEG_STREAM_VBI_FMT_NONE,
513 V4L2_MPEG_STREAM_VBI_FMT_IVTV, 1,
514 V4L2_MPEG_STREAM_VBI_FMT_NONE);
515 return cx2341x_ctrl_query_fill(qctrl,
516 V4L2_MPEG_STREAM_VBI_FMT_NONE,
517 V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
518 default_params.stream_vbi_fmt);
519
520 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
521 return v4l2_ctrl_query_fill(qctrl,
522 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100,
523 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000, 1,
524 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000);
525
503 case V4L2_CID_MPEG_AUDIO_ENCODING: 526 case V4L2_CID_MPEG_AUDIO_ENCODING:
504 if (params->capabilities & CX2341X_CAP_HAS_AC3) { 527 if (params->capabilities & CX2341X_CAP_HAS_AC3) {
505 /* 528 /*
@@ -531,9 +554,36 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
531 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 554 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
532 return 0; 555 return 0;
533 556
534 case V4L2_CID_MPEG_AUDIO_L1_BITRATE: 557 case V4L2_CID_MPEG_AUDIO_MODE:
535 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: 558 return v4l2_ctrl_query_fill(qctrl,
536 return -EINVAL; 559 V4L2_MPEG_AUDIO_MODE_STEREO,
560 V4L2_MPEG_AUDIO_MODE_MONO, 1,
561 V4L2_MPEG_AUDIO_MODE_STEREO);
562
563 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
564 err = v4l2_ctrl_query_fill(qctrl,
565 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4,
566 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16, 1,
567 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4);
568 if (err == 0 &&
569 params->audio_mode != V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
570 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
571 return err;
572
573 case V4L2_CID_MPEG_AUDIO_EMPHASIS:
574 return v4l2_ctrl_query_fill(qctrl,
575 V4L2_MPEG_AUDIO_EMPHASIS_NONE,
576 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17, 1,
577 V4L2_MPEG_AUDIO_EMPHASIS_NONE);
578
579 case V4L2_CID_MPEG_AUDIO_CRC:
580 return v4l2_ctrl_query_fill(qctrl,
581 V4L2_MPEG_AUDIO_CRC_NONE,
582 V4L2_MPEG_AUDIO_CRC_CRC16, 1,
583 V4L2_MPEG_AUDIO_CRC_NONE);
584
585 case V4L2_CID_MPEG_AUDIO_MUTE:
586 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
537 587
538 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: 588 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
539 err = v4l2_ctrl_query_fill(qctrl, 589 err = v4l2_ctrl_query_fill(qctrl,
@@ -550,13 +600,6 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
550 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED; 600 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED;
551 return 0; 601 return 0;
552 602
553 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
554 err = v4l2_ctrl_query_fill_std(qctrl);
555 if (err == 0 &&
556 params->audio_mode != V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
557 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
558 return err;
559
560 case V4L2_CID_MPEG_VIDEO_ENCODING: 603 case V4L2_CID_MPEG_VIDEO_ENCODING:
561 /* this setting is read-only for the cx2341x since the 604 /* this setting is read-only for the cx2341x since the
562 V4L2_CID_MPEG_STREAM_TYPE really determines the 605 V4L2_CID_MPEG_STREAM_TYPE really determines the
@@ -569,32 +612,51 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
569 qctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; 612 qctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
570 return err; 613 return err;
571 614
615 case V4L2_CID_MPEG_VIDEO_ASPECT:
616 return v4l2_ctrl_query_fill(qctrl,
617 V4L2_MPEG_VIDEO_ASPECT_1x1,
618 V4L2_MPEG_VIDEO_ASPECT_221x100, 1,
619 V4L2_MPEG_VIDEO_ASPECT_4x3);
620
621 case V4L2_CID_MPEG_VIDEO_B_FRAMES:
622 return v4l2_ctrl_query_fill(qctrl, 0, 33, 1, 2);
623
624 case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
625 return v4l2_ctrl_query_fill(qctrl, 1, 34, 1,
626 params->is_50hz ? 12 : 15);
627
628 case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE:
629 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 1);
630
572 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: 631 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
573 err = v4l2_ctrl_query_fill_std(qctrl); 632 err = v4l2_ctrl_query_fill(qctrl,
633 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
634 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 1,
635 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
574 if (err == 0 && 636 if (err == 0 &&
575 params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1) 637 params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
576 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 638 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
577 return err; 639 return err;
578 640
641 case V4L2_CID_MPEG_VIDEO_BITRATE:
642 return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 6000000);
643
579 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: 644 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
580 err = v4l2_ctrl_query_fill_std(qctrl); 645 err = v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 8000000);
581 if (err == 0 && 646 if (err == 0 &&
582 params->video_bitrate_mode == 647 params->video_bitrate_mode ==
583 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) 648 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
584 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 649 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
585 return err; 650 return err;
586 651
587 case V4L2_CID_MPEG_STREAM_VBI_FMT: 652 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION:
588 if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI) 653 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
589 return v4l2_ctrl_query_fill_std(qctrl);
590 return cx2341x_ctrl_query_fill(qctrl,
591 V4L2_MPEG_STREAM_VBI_FMT_NONE,
592 V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
593 default_params.stream_vbi_fmt);
594 654
595 case V4L2_CID_MPEG_VIDEO_GOP_SIZE: 655 case V4L2_CID_MPEG_VIDEO_MUTE:
596 return v4l2_ctrl_query_fill(qctrl, 1, 34, 1, 656 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
597 params->is_50hz ? 12 : 15); 657
658 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: /* Init YUV (really YCbCr) to black */
659 return v4l2_ctrl_query_fill(qctrl, 0, 0xffffff, 1, 0x008080);
598 660
599 /* CX23415/6 specific */ 661 /* CX23415/6 specific */
600 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: 662 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
@@ -696,7 +758,7 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
696 default_params.stream_insert_nav_packets); 758 default_params.stream_insert_nav_packets);
697 759
698 default: 760 default:
699 return v4l2_ctrl_query_fill_std(qctrl); 761 return -EINVAL;
700 762
701 } 763 }
702} 764}