aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core/v4l2-ctrls.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-ctrls.c')
-rw-r--r--drivers/media/v4l2-core/v4l2-ctrls.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 631cdc0e0bda..f6ee201d9347 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -384,6 +384,25 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
384 "Extended SAR", 384 "Extended SAR",
385 NULL, 385 NULL,
386 }; 386 };
387 static const char * const h264_fp_arrangement_type[] = {
388 "Checkerboard",
389 "Column",
390 "Row",
391 "Side by Side",
392 "Top Bottom",
393 "Temporal",
394 NULL,
395 };
396 static const char * const h264_fmo_map_type[] = {
397 "Interleaved Slices",
398 "Scattered Slices",
399 "Foreground with Leftover",
400 "Box Out",
401 "Raster Scan",
402 "Wipe Scan",
403 "Explicit",
404 NULL,
405 };
387 static const char * const mpeg_mpeg4_level[] = { 406 static const char * const mpeg_mpeg4_level[] = {
388 "0", 407 "0",
389 "0b", 408 "0b",
@@ -508,6 +527,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
508 return h264_profile; 527 return h264_profile;
509 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: 528 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
510 return vui_sar_idc; 529 return vui_sar_idc;
530 case V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE:
531 return h264_fp_arrangement_type;
532 case V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE:
533 return h264_fmo_map_type;
511 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: 534 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
512 return mpeg_mpeg4_level; 535 return mpeg_mpeg4_level;
513 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: 536 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
@@ -643,6 +666,22 @@ const char *v4l2_ctrl_get_name(u32 id)
643 case V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH: return "Horizontal Size of SAR"; 666 case V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH: return "Horizontal Size of SAR";
644 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: return "Aspect Ratio VUI Enable"; 667 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: return "Aspect Ratio VUI Enable";
645 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: return "VUI Aspect Ratio IDC"; 668 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: return "VUI Aspect Ratio IDC";
669 case V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING: return "H264 Enable Frame Packing SEI";
670 case V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0: return "H264 Set Curr. Frame as Frame0";
671 case V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE: return "H264 FP Arrangement Type";
672 case V4L2_CID_MPEG_VIDEO_H264_FMO: return "H264 Flexible MB Ordering";
673 case V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE: return "H264 Map Type for FMO";
674 case V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP: return "H264 FMO Number of Slice Groups";
675 case V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION: return "H264 FMO Direction of Change";
676 case V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE: return "H264 FMO Size of 1st Slice Grp";
677 case V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH: return "H264 FMO No. of Consecutive MBs";
678 case V4L2_CID_MPEG_VIDEO_H264_ASO: return "H264 Arbitrary Slice Ordering";
679 case V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER: return "H264 ASO Slice Order";
680 case V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING: return "Enable H264 Hierarchical Coding";
681 case V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE: return "H264 Hierarchical Coding Type";
682 case V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER:return "H264 Number of HC Layers";
683 case V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP:
684 return "H264 Set QP Value for HC Layers";
646 case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value"; 685 case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value";
647 case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP: return "MPEG4 P-Frame QP Value"; 686 case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP: return "MPEG4 P-Frame QP Value";
648 case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP: return "MPEG4 B-Frame QP Value"; 687 case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP: return "MPEG4 B-Frame QP Value";
@@ -657,6 +696,7 @@ const char *v4l2_ctrl_get_name(u32 id)
657 case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size"; 696 case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size";
658 case V4L2_CID_MPEG_VIDEO_DEC_PTS: return "Video Decoder PTS"; 697 case V4L2_CID_MPEG_VIDEO_DEC_PTS: return "Video Decoder PTS";
659 case V4L2_CID_MPEG_VIDEO_DEC_FRAME: return "Video Decoder Frame Count"; 698 case V4L2_CID_MPEG_VIDEO_DEC_FRAME: return "Video Decoder Frame Count";
699 case V4L2_CID_MPEG_VIDEO_VBV_DELAY: return "Initial Delay for VBV Control";
660 700
661 /* CAMERA controls */ 701 /* CAMERA controls */
662 /* Keep the order of the 'case's the same as in videodev2.h! */ 702 /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -749,6 +789,7 @@ const char *v4l2_ctrl_get_name(u32 id)
749 case V4L2_CID_IMAGE_PROC_CLASS: return "Image Processing Controls"; 789 case V4L2_CID_IMAGE_PROC_CLASS: return "Image Processing Controls";
750 case V4L2_CID_LINK_FREQ: return "Link Frequency"; 790 case V4L2_CID_LINK_FREQ: return "Link Frequency";
751 case V4L2_CID_PIXEL_RATE: return "Pixel Rate"; 791 case V4L2_CID_PIXEL_RATE: return "Pixel Rate";
792 case V4L2_CID_TEST_PATTERN: return "Test Pattern";
752 793
753 /* DV controls */ 794 /* DV controls */
754 case V4L2_CID_DV_CLASS: return "Digital Video Controls"; 795 case V4L2_CID_DV_CLASS: return "Digital Video Controls";
@@ -853,6 +894,8 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
853 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE: 894 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:
854 case V4L2_CID_MPEG_VIDEO_H264_PROFILE: 895 case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
855 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: 896 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
897 case V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE:
898 case V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE:
856 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: 899 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
857 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: 900 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
858 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: 901 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
@@ -862,6 +905,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
862 case V4L2_CID_DV_TX_MODE: 905 case V4L2_CID_DV_TX_MODE:
863 case V4L2_CID_DV_TX_RGB_RANGE: 906 case V4L2_CID_DV_TX_RGB_RANGE:
864 case V4L2_CID_DV_RX_RGB_RANGE: 907 case V4L2_CID_DV_RX_RGB_RANGE:
908 case V4L2_CID_TEST_PATTERN:
865 *type = V4L2_CTRL_TYPE_MENU; 909 *type = V4L2_CTRL_TYPE_MENU;
866 break; 910 break;
867 case V4L2_CID_LINK_FREQ: 911 case V4L2_CID_LINK_FREQ:
@@ -1648,6 +1692,36 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
1648} 1692}
1649EXPORT_SYMBOL(v4l2_ctrl_new_std_menu); 1693EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
1650 1694
1695/* Helper function for standard menu controls with driver defined menu */
1696struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
1697 const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
1698 s32 mask, s32 def, const char * const *qmenu)
1699{
1700 enum v4l2_ctrl_type type;
1701 const char *name;
1702 u32 flags;
1703 s32 step;
1704 s32 min;
1705
1706 /* v4l2_ctrl_new_std_menu_items() should only be called for
1707 * standard controls without a standard menu.
1708 */
1709 if (v4l2_ctrl_get_menu(id)) {
1710 handler_set_err(hdl, -EINVAL);
1711 return NULL;
1712 }
1713
1714 v4l2_ctrl_fill(id, &name, &type, &min, &max, &step, &def, &flags);
1715 if (type != V4L2_CTRL_TYPE_MENU || qmenu == NULL) {
1716 handler_set_err(hdl, -EINVAL);
1717 return NULL;
1718 }
1719 return v4l2_ctrl_new(hdl, ops, id, name, type, 0, max, mask, def,
1720 flags, qmenu, NULL, NULL);
1721
1722}
1723EXPORT_SYMBOL(v4l2_ctrl_new_std_menu_items);
1724
1651/* Helper function for standard integer menu controls */ 1725/* Helper function for standard integer menu controls */
1652struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl, 1726struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
1653 const struct v4l2_ctrl_ops *ops, 1727 const struct v4l2_ctrl_ops *ops,