aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-ctrls.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-01-20 13:37:44 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-02-28 16:53:16 -0500
commitc7361ae1e7a5a5395693f1f978af032c41cdb10d (patch)
treed17eede7e66e85e5eb836fa5755c18bb8053c802 /drivers/media/video/v4l2-ctrls.c
parente8ca6d20a65d9d94693a0ed99b12d95b882dc859 (diff)
[media] V4L: Add JPEG compression control class
The V4L2_CID_JPEG_CLASS control class is intended to expose various adjustable parameters of JPEG encoders and decoders. Following controls are defined: - V4L2_CID_JPEG_CHROMA_SUBSAMPLING, - V4L2_CID_JPEG_RESTART_INTERVAL, - V4L2_CID_JPEG_COMPRESSION_QUALITY, - V4L2_CID_JPEG_ACTIVE_MARKER. This covers only a part of relevant standard specifications. More controls should be added in future if required. The purpose of V4L2_CID_JPEG_CLASS class is also to replace some functionality covered by VIDIOC_S/G_JPEGCOMP ioctls, i.e. the JPEG markers presence and compression quality control. The applications and drivers should switch from the ioctl to control based API, as described in the subsequent patches for the Media API DocBook. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ctrls.c')
-rw-r--r--drivers/media/video/v4l2-ctrls.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 909117203610..e6c7c8e8cc4e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -362,6 +362,16 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
362 NULL, 362 NULL,
363 }; 363 };
364 364
365 static const char * const jpeg_chroma_subsampling[] = {
366 "4:4:4",
367 "4:2:2",
368 "4:2:0",
369 "4:1:1",
370 "4:1:0",
371 "Gray",
372 NULL,
373 };
374
365 switch (id) { 375 switch (id) {
366 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: 376 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
367 return mpeg_audio_sampling_freq; 377 return mpeg_audio_sampling_freq;
@@ -426,6 +436,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
426 return mpeg_mpeg4_level; 436 return mpeg_mpeg4_level;
427 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: 437 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
428 return mpeg4_profile; 438 return mpeg4_profile;
439 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
440 return jpeg_chroma_subsampling;
441
429 default: 442 default:
430 return NULL; 443 return NULL;
431 } 444 }
@@ -623,6 +636,14 @@ const char *v4l2_ctrl_get_name(u32 id)
623 case V4L2_CID_FLASH_CHARGE: return "Charge"; 636 case V4L2_CID_FLASH_CHARGE: return "Charge";
624 case V4L2_CID_FLASH_READY: return "Ready to Strobe"; 637 case V4L2_CID_FLASH_READY: return "Ready to Strobe";
625 638
639 /* JPEG encoder controls */
640 /* Keep the order of the 'case's the same as in videodev2.h! */
641 case V4L2_CID_JPEG_CLASS: return "JPEG Compression Controls";
642 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING: return "Chroma Subsampling";
643 case V4L2_CID_JPEG_RESTART_INTERVAL: return "Restart Interval";
644 case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
645 case V4L2_CID_JPEG_ACTIVE_MARKER: return "Active Markers";
646
626 default: 647 default:
627 return NULL; 648 return NULL;
628 } 649 }
@@ -711,6 +732,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
711 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: 732 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
712 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: 733 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
713 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: 734 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
735 case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
714 *type = V4L2_CTRL_TYPE_MENU; 736 *type = V4L2_CTRL_TYPE_MENU;
715 break; 737 break;
716 case V4L2_CID_RDS_TX_PS_NAME: 738 case V4L2_CID_RDS_TX_PS_NAME:
@@ -722,6 +744,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
722 case V4L2_CID_MPEG_CLASS: 744 case V4L2_CID_MPEG_CLASS:
723 case V4L2_CID_FM_TX_CLASS: 745 case V4L2_CID_FM_TX_CLASS:
724 case V4L2_CID_FLASH_CLASS: 746 case V4L2_CID_FLASH_CLASS:
747 case V4L2_CID_JPEG_CLASS:
725 *type = V4L2_CTRL_TYPE_CTRL_CLASS; 748 *type = V4L2_CTRL_TYPE_CTRL_CLASS;
726 /* You can neither read not write these */ 749 /* You can neither read not write these */
727 *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY; 750 *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
@@ -735,6 +758,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
735 *max = 0xFFFFFF; 758 *max = 0xFFFFFF;
736 break; 759 break;
737 case V4L2_CID_FLASH_FAULT: 760 case V4L2_CID_FLASH_FAULT:
761 case V4L2_CID_JPEG_ACTIVE_MARKER:
738 *type = V4L2_CTRL_TYPE_BITMASK; 762 *type = V4L2_CTRL_TYPE_BITMASK;
739 break; 763 break;
740 case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: 764 case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: