diff options
Diffstat (limited to 'drivers/media/video/cx2341x.c')
-rw-r--r-- | drivers/media/video/cx2341x.c | 180 |
1 files changed, 101 insertions, 79 deletions
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index c592899a2317..22847a0444f5 100644 --- a/drivers/media/video/cx2341x.c +++ b/drivers/media/video/cx2341x.c | |||
@@ -77,10 +77,65 @@ const u32 cx2341x_mpeg_ctrls[] = { | |||
77 | }; | 77 | }; |
78 | EXPORT_SYMBOL(cx2341x_mpeg_ctrls); | 78 | EXPORT_SYMBOL(cx2341x_mpeg_ctrls); |
79 | 79 | ||
80 | static const struct cx2341x_mpeg_params default_params = { | ||
81 | /* misc */ | ||
82 | .capabilities = 0, | ||
83 | .port = CX2341X_PORT_MEMORY, | ||
84 | .width = 720, | ||
85 | .height = 480, | ||
86 | .is_50hz = 0, | ||
87 | |||
88 | /* stream */ | ||
89 | .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, | ||
90 | .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE, | ||
91 | .stream_insert_nav_packets = 0, | ||
92 | |||
93 | /* audio */ | ||
94 | .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, | ||
95 | .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | ||
96 | .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, | ||
97 | .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, | ||
98 | .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, | ||
99 | .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, | ||
100 | .audio_crc = V4L2_MPEG_AUDIO_CRC_NONE, | ||
101 | .audio_mute = 0, | ||
102 | |||
103 | /* video */ | ||
104 | .video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2, | ||
105 | .video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, | ||
106 | .video_b_frames = 2, | ||
107 | .video_gop_size = 12, | ||
108 | .video_gop_closure = 1, | ||
109 | .video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, | ||
110 | .video_bitrate = 6000000, | ||
111 | .video_bitrate_peak = 8000000, | ||
112 | .video_temporal_decimation = 0, | ||
113 | .video_mute = 0, | ||
114 | .video_mute_yuv = 0x008080, /* YCbCr value for black */ | ||
115 | |||
116 | /* encoding filters */ | ||
117 | .video_spatial_filter_mode = | ||
118 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, | ||
119 | .video_spatial_filter = 0, | ||
120 | .video_luma_spatial_filter_type = | ||
121 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
122 | .video_chroma_spatial_filter_type = | ||
123 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
124 | .video_temporal_filter_mode = | ||
125 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, | ||
126 | .video_temporal_filter = 8, | ||
127 | .video_median_filter_type = | ||
128 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, | ||
129 | .video_luma_median_filter_top = 255, | ||
130 | .video_luma_median_filter_bottom = 0, | ||
131 | .video_chroma_median_filter_top = 255, | ||
132 | .video_chroma_median_filter_bottom = 0, | ||
133 | }; | ||
134 | |||
80 | 135 | ||
81 | /* Map the control ID to the correct field in the cx2341x_mpeg_params | 136 | /* Map the control ID to the correct field in the cx2341x_mpeg_params |
82 | struct. Return -EINVAL if the ID is unknown, else return 0. */ | 137 | struct. Return -EINVAL if the ID is unknown, else return 0. */ |
83 | static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params, | 138 | static int cx2341x_get_ctrl(const struct cx2341x_mpeg_params *params, |
84 | struct v4l2_ext_control *ctrl) | 139 | struct v4l2_ext_control *ctrl) |
85 | { | 140 | { |
86 | switch (ctrl->id) { | 141 | switch (ctrl->id) { |
@@ -420,7 +475,7 @@ static int cx2341x_ctrl_query_fill(struct v4l2_queryctrl *qctrl, | |||
420 | return 0; | 475 | return 0; |
421 | } | 476 | } |
422 | 477 | ||
423 | int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | 478 | int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, |
424 | struct v4l2_queryctrl *qctrl) | 479 | struct v4l2_queryctrl *qctrl) |
425 | { | 480 | { |
426 | int err; | 481 | int err; |
@@ -430,13 +485,13 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
430 | return v4l2_ctrl_query_fill(qctrl, | 485 | return v4l2_ctrl_query_fill(qctrl, |
431 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | 486 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, |
432 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, | 487 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, |
433 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2); | 488 | default_params.audio_encoding); |
434 | 489 | ||
435 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: | 490 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: |
436 | return v4l2_ctrl_query_fill(qctrl, | 491 | return v4l2_ctrl_query_fill(qctrl, |
437 | V4L2_MPEG_AUDIO_L2_BITRATE_192K, | 492 | V4L2_MPEG_AUDIO_L2_BITRATE_192K, |
438 | V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1, | 493 | V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1, |
439 | V4L2_MPEG_AUDIO_L2_BITRATE_224K); | 494 | default_params.audio_l2_bitrate); |
440 | 495 | ||
441 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: | 496 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: |
442 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: | 497 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: |
@@ -479,17 +534,22 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
479 | return cx2341x_ctrl_query_fill(qctrl, | 534 | return cx2341x_ctrl_query_fill(qctrl, |
480 | V4L2_MPEG_STREAM_VBI_FMT_NONE, | 535 | V4L2_MPEG_STREAM_VBI_FMT_NONE, |
481 | V4L2_MPEG_STREAM_VBI_FMT_NONE, 1, | 536 | V4L2_MPEG_STREAM_VBI_FMT_NONE, 1, |
482 | V4L2_MPEG_STREAM_VBI_FMT_NONE); | 537 | default_params.stream_vbi_fmt); |
538 | |||
539 | case V4L2_CID_MPEG_VIDEO_GOP_SIZE: | ||
540 | return v4l2_ctrl_query_fill(qctrl, 1, 34, 1, | ||
541 | params->is_50hz ? 12 : 15); | ||
483 | 542 | ||
484 | /* CX23415/6 specific */ | 543 | /* CX23415/6 specific */ |
485 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: | 544 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: |
486 | return cx2341x_ctrl_query_fill(qctrl, | 545 | return cx2341x_ctrl_query_fill(qctrl, |
487 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, | 546 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, |
488 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, 1, | 547 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, 1, |
489 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL); | 548 | default_params.video_spatial_filter_mode); |
490 | 549 | ||
491 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER: | 550 | case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER: |
492 | cx2341x_ctrl_query_fill(qctrl, 0, 15, 1, 0); | 551 | cx2341x_ctrl_query_fill(qctrl, 0, 15, 1, |
552 | default_params.video_spatial_filter); | ||
493 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 553 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
494 | if (params->video_spatial_filter_mode == | 554 | if (params->video_spatial_filter_mode == |
495 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) | 555 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) |
@@ -501,7 +561,7 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
501 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF, | 561 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF, |
502 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE, | 562 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE, |
503 | 1, | 563 | 1, |
504 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF); | 564 | default_params.video_luma_spatial_filter_type); |
505 | if (params->video_spatial_filter_mode == | 565 | if (params->video_spatial_filter_mode == |
506 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) | 566 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) |
507 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; | 567 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; |
@@ -512,7 +572,7 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
512 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF, | 572 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF, |
513 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, | 573 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, |
514 | 1, | 574 | 1, |
515 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF); | 575 | default_params.video_chroma_spatial_filter_type); |
516 | if (params->video_spatial_filter_mode == | 576 | if (params->video_spatial_filter_mode == |
517 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) | 577 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) |
518 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; | 578 | qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; |
@@ -522,10 +582,11 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
522 | return cx2341x_ctrl_query_fill(qctrl, | 582 | return cx2341x_ctrl_query_fill(qctrl, |
523 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, | 583 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, |
524 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, 1, | 584 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, 1, |
525 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL); | 585 | default_params.video_temporal_filter_mode); |
526 | 586 | ||
527 | case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER: | 587 | case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER: |
528 | cx2341x_ctrl_query_fill(qctrl, 0, 31, 1, 0); | 588 | cx2341x_ctrl_query_fill(qctrl, 0, 31, 1, |
589 | default_params.video_temporal_filter); | ||
529 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 590 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
530 | if (params->video_temporal_filter_mode == | 591 | if (params->video_temporal_filter_mode == |
531 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO) | 592 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO) |
@@ -536,10 +597,11 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
536 | return cx2341x_ctrl_query_fill(qctrl, | 597 | return cx2341x_ctrl_query_fill(qctrl, |
537 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, | 598 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, |
538 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, 1, | 599 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, 1, |
539 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF); | 600 | default_params.video_median_filter_type); |
540 | 601 | ||
541 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP: | 602 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP: |
542 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 255); | 603 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
604 | default_params.video_luma_median_filter_top); | ||
543 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 605 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
544 | if (params->video_median_filter_type == | 606 | if (params->video_median_filter_type == |
545 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 607 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -547,7 +609,8 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
547 | return 0; | 609 | return 0; |
548 | 610 | ||
549 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM: | 611 | case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM: |
550 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 0); | 612 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
613 | default_params.video_luma_median_filter_bottom); | ||
551 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 614 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
552 | if (params->video_median_filter_type == | 615 | if (params->video_median_filter_type == |
553 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 616 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -555,7 +618,8 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
555 | return 0; | 618 | return 0; |
556 | 619 | ||
557 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP: | 620 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP: |
558 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 255); | 621 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
622 | default_params.video_chroma_median_filter_top); | ||
559 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 623 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
560 | if (params->video_median_filter_type == | 624 | if (params->video_median_filter_type == |
561 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 625 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -563,7 +627,8 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
563 | return 0; | 627 | return 0; |
564 | 628 | ||
565 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM: | 629 | case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM: |
566 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 0); | 630 | cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, |
631 | default_params.video_chroma_median_filter_bottom); | ||
567 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; | 632 | qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; |
568 | if (params->video_median_filter_type == | 633 | if (params->video_median_filter_type == |
569 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) | 634 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) |
@@ -571,7 +636,8 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
571 | return 0; | 636 | return 0; |
572 | 637 | ||
573 | case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS: | 638 | case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS: |
574 | return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1, 0); | 639 | return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1, |
640 | default_params.stream_insert_nav_packets); | ||
575 | 641 | ||
576 | default: | 642 | default: |
577 | return v4l2_ctrl_query_fill_std(qctrl); | 643 | return v4l2_ctrl_query_fill_std(qctrl); |
@@ -580,9 +646,9 @@ int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, | |||
580 | } | 646 | } |
581 | EXPORT_SYMBOL(cx2341x_ctrl_query); | 647 | EXPORT_SYMBOL(cx2341x_ctrl_query); |
582 | 648 | ||
583 | const char **cx2341x_ctrl_get_menu(u32 id) | 649 | const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id) |
584 | { | 650 | { |
585 | static const char *mpeg_stream_type[] = { | 651 | static const char *mpeg_stream_type_without_ts[] = { |
586 | "MPEG-2 Program Stream", | 652 | "MPEG-2 Program Stream", |
587 | "", | 653 | "", |
588 | "MPEG-1 System Stream", | 654 | "MPEG-1 System Stream", |
@@ -592,6 +658,16 @@ const char **cx2341x_ctrl_get_menu(u32 id) | |||
592 | NULL | 658 | NULL |
593 | }; | 659 | }; |
594 | 660 | ||
661 | static const char *mpeg_stream_type_with_ts[] = { | ||
662 | "MPEG-2 Program Stream", | ||
663 | "MPEG-2 Transport Stream", | ||
664 | "MPEG-1 System Stream", | ||
665 | "MPEG-2 DVD-compatible Stream", | ||
666 | "MPEG-1 VCD-compatible Stream", | ||
667 | "MPEG-2 SVCD-compatible Stream", | ||
668 | NULL | ||
669 | }; | ||
670 | |||
595 | static const char *cx2341x_video_spatial_filter_mode_menu[] = { | 671 | static const char *cx2341x_video_spatial_filter_mode_menu[] = { |
596 | "Manual", | 672 | "Manual", |
597 | "Auto", | 673 | "Auto", |
@@ -630,7 +706,8 @@ const char **cx2341x_ctrl_get_menu(u32 id) | |||
630 | 706 | ||
631 | switch (id) { | 707 | switch (id) { |
632 | case V4L2_CID_MPEG_STREAM_TYPE: | 708 | case V4L2_CID_MPEG_STREAM_TYPE: |
633 | return mpeg_stream_type; | 709 | return (p->capabilities & CX2341X_CAP_HAS_TS) ? |
710 | mpeg_stream_type_with_ts : mpeg_stream_type_without_ts; | ||
634 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: | 711 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: |
635 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: | 712 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: |
636 | return NULL; | 713 | return NULL; |
@@ -690,7 +767,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, | |||
690 | if (err) | 767 | if (err) |
691 | break; | 768 | break; |
692 | if (qctrl.type == V4L2_CTRL_TYPE_MENU) | 769 | if (qctrl.type == V4L2_CTRL_TYPE_MENU) |
693 | menu_items = cx2341x_ctrl_get_menu(qctrl.id); | 770 | menu_items = cx2341x_ctrl_get_menu(params, qctrl.id); |
694 | err = v4l2_ctrl_check(ctrl, &qctrl, menu_items); | 771 | err = v4l2_ctrl_check(ctrl, &qctrl, menu_items); |
695 | if (err) | 772 | if (err) |
696 | break; | 773 | break; |
@@ -714,61 +791,6 @@ EXPORT_SYMBOL(cx2341x_ext_ctrls); | |||
714 | 791 | ||
715 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p) | 792 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p) |
716 | { | 793 | { |
717 | static struct cx2341x_mpeg_params default_params = { | ||
718 | /* misc */ | ||
719 | .capabilities = 0, | ||
720 | .port = CX2341X_PORT_MEMORY, | ||
721 | .width = 720, | ||
722 | .height = 480, | ||
723 | .is_50hz = 0, | ||
724 | |||
725 | /* stream */ | ||
726 | .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, | ||
727 | .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE, | ||
728 | .stream_insert_nav_packets = 0, | ||
729 | |||
730 | /* audio */ | ||
731 | .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, | ||
732 | .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | ||
733 | .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, | ||
734 | .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, | ||
735 | .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, | ||
736 | .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, | ||
737 | .audio_crc = V4L2_MPEG_AUDIO_CRC_NONE, | ||
738 | .audio_mute = 0, | ||
739 | |||
740 | /* video */ | ||
741 | .video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2, | ||
742 | .video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, | ||
743 | .video_b_frames = 2, | ||
744 | .video_gop_size = 12, | ||
745 | .video_gop_closure = 1, | ||
746 | .video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, | ||
747 | .video_bitrate = 6000000, | ||
748 | .video_bitrate_peak = 8000000, | ||
749 | .video_temporal_decimation = 0, | ||
750 | .video_mute = 0, | ||
751 | .video_mute_yuv = 0x008080, /* YCbCr value for black */ | ||
752 | |||
753 | /* encoding filters */ | ||
754 | .video_spatial_filter_mode = | ||
755 | V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, | ||
756 | .video_spatial_filter = 0, | ||
757 | .video_luma_spatial_filter_type = | ||
758 | V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
759 | .video_chroma_spatial_filter_type = | ||
760 | V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, | ||
761 | .video_temporal_filter_mode = | ||
762 | V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, | ||
763 | .video_temporal_filter = 8, | ||
764 | .video_median_filter_type = | ||
765 | V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, | ||
766 | .video_luma_median_filter_top = 255, | ||
767 | .video_luma_median_filter_bottom = 0, | ||
768 | .video_chroma_median_filter_top = 255, | ||
769 | .video_chroma_median_filter_bottom = 0, | ||
770 | }; | ||
771 | |||
772 | *p = default_params; | 794 | *p = default_params; |
773 | cx2341x_calc_audio_properties(p); | 795 | cx2341x_calc_audio_properties(p); |
774 | } | 796 | } |
@@ -933,9 +955,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, | |||
933 | } | 955 | } |
934 | EXPORT_SYMBOL(cx2341x_update); | 956 | EXPORT_SYMBOL(cx2341x_update); |
935 | 957 | ||
936 | static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id) | 958 | static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id) |
937 | { | 959 | { |
938 | const char **menu = cx2341x_ctrl_get_menu(id); | 960 | const char **menu = cx2341x_ctrl_get_menu(p, id); |
939 | struct v4l2_ext_control ctrl; | 961 | struct v4l2_ext_control ctrl; |
940 | 962 | ||
941 | if (menu == NULL) | 963 | if (menu == NULL) |
@@ -952,7 +974,7 @@ invalid: | |||
952 | return "<invalid>"; | 974 | return "<invalid>"; |
953 | } | 975 | } |
954 | 976 | ||
955 | void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix) | 977 | void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix) |
956 | { | 978 | { |
957 | int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1; | 979 | int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1; |
958 | int temporal = p->video_temporal_filter; | 980 | int temporal = p->video_temporal_filter; |