aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-ctrls.c
diff options
context:
space:
mode:
authorKamil Debski <k.debski@samsung.com>2011-06-14 09:46:22 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:55:40 -0400
commit064f50966eb65e89c2434b57b2d2326dfee2b50c (patch)
treeb072f668e8491cb7cb4ed88c59a0d0eb9ce13d83 /drivers/media/video/v4l2-ctrls.c
parente65e4f134db36c70f13e9703d8e253e6b196ca47 (diff)
[media] v4l2-ctrl: add codec controls support to the control framework
Add support for the codec controls to the v4l2 control framework. [mchehab@redhat.com: Fix merge conflicts and removed some hunks that were adding blank lines without a good reason] Signed-off-by: Kamil Debski <k.debski@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.c196
1 files changed, 191 insertions, 5 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 37c064829ea5..b3ed33053584 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -203,7 +203,7 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
203 }; 203 };
204 static const char * const mpeg_stream_vbi_fmt[] = { 204 static const char * const mpeg_stream_vbi_fmt[] = {
205 "No VBI", 205 "No VBI",
206 "Private packet, IVTV format", 206 "Private Packet, IVTV Format",
207 NULL 207 NULL
208 }; 208 };
209 static const char * const camera_power_line_frequency[] = { 209 static const char * const camera_power_line_frequency[] = {
@@ -226,18 +226,121 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
226 "Negative", 226 "Negative",
227 "Emboss", 227 "Emboss",
228 "Sketch", 228 "Sketch",
229 "Sky blue", 229 "Sky Blue",
230 "Grass green", 230 "Grass Green",
231 "Skin whiten", 231 "Skin Whiten",
232 "Vivid", 232 "Vivid",
233 NULL 233 NULL
234 }; 234 };
235 static const char * const tune_preemphasis[] = { 235 static const char * const tune_preemphasis[] = {
236 "No preemphasis", 236 "No Preemphasis",
237 "50 useconds", 237 "50 useconds",
238 "75 useconds", 238 "75 useconds",
239 NULL, 239 NULL,
240 }; 240 };
241 static const char * const header_mode[] = {
242 "Separate Buffer",
243 "Joined With 1st Frame",
244 NULL,
245 };
246 static const char * const multi_slice[] = {
247 "Single",
248 "Max Macroblocks",
249 "Max Bytes",
250 NULL,
251 };
252 static const char * const entropy_mode[] = {
253 "CAVLC",
254 "CABAC",
255 NULL,
256 };
257 static const char * const mpeg_h264_level[] = {
258 "1",
259 "1b",
260 "1.1",
261 "1.2",
262 "1.3",
263 "2",
264 "2.1",
265 "2.2",
266 "3",
267 "3.1",
268 "3.2",
269 "4",
270 "4.1",
271 "4.2",
272 "5",
273 "5.1",
274 NULL,
275 };
276 static const char * const h264_loop_filter[] = {
277 "Enabled",
278 "Disabled",
279 "Disabled at Slice Boundary",
280 NULL,
281 };
282 static const char * const h264_profile[] = {
283 "Baseline",
284 "Constrained Baseline",
285 "Main",
286 "Extended",
287 "High",
288 "High 10",
289 "High 422",
290 "High 444 Predictive",
291 "High 10 Intra",
292 "High 422 Intra",
293 "High 444 Intra",
294 "CAVLC 444 Intra",
295 "Scalable Baseline",
296 "Scalable High",
297 "Scalable High Intra",
298 "Multiview High",
299 NULL,
300 };
301 static const char * const vui_sar_idc[] = {
302 "Unspecified",
303 "1:1",
304 "12:11",
305 "10:11",
306 "16:11",
307 "40:33",
308 "24:11",
309 "20:11",
310 "32:11",
311 "80:33",
312 "18:11",
313 "15:11",
314 "64:33",
315 "160:99",
316 "4:3",
317 "3:2",
318 "2:1",
319 "Extended SAR",
320 NULL,
321 };
322 static const char * const mpeg_mpeg4_level[] = {
323 "0",
324 "0b",
325 "1",
326 "2",
327 "3",
328 "3b",
329 "4",
330 "5",
331 NULL,
332 };
333 static const char * const mpeg4_profile[] = {
334 "Simple",
335 "Adcanved Simple",
336 "Core",
337 "Simple Scalable",
338 "Advanced Coding Efficency",
339 NULL,
340 };
341
342 switch (id) {
343 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
241 static const char * const flash_led_mode[] = { 344 static const char * const flash_led_mode[] = {
242 "Off", 345 "Off",
243 "Flash", 346 "Flash",
@@ -293,6 +396,24 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
293 return flash_led_mode; 396 return flash_led_mode;
294 case V4L2_CID_FLASH_STROBE_SOURCE: 397 case V4L2_CID_FLASH_STROBE_SOURCE:
295 return flash_strobe_source; 398 return flash_strobe_source;
399 case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
400 return header_mode;
401 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE:
402 return multi_slice;
403 case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
404 return entropy_mode;
405 case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
406 return mpeg_h264_level;
407 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:
408 return h264_loop_filter;
409 case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
410 return h264_profile;
411 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
412 return vui_sar_idc;
413 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
414 return mpeg_mpeg4_level;
415 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
416 return mpeg4_profile;
296 default: 417 default:
297 return NULL; 418 return NULL;
298 } 419 }
@@ -344,6 +465,8 @@ const char *v4l2_ctrl_get_name(u32 id)
344 case V4L2_CID_CHROMA_GAIN: return "Chroma Gain"; 465 case V4L2_CID_CHROMA_GAIN: return "Chroma Gain";
345 case V4L2_CID_ILLUMINATORS_1: return "Illuminator 1"; 466 case V4L2_CID_ILLUMINATORS_1: return "Illuminator 1";
346 case V4L2_CID_ILLUMINATORS_2: return "Illuminator 2"; 467 case V4L2_CID_ILLUMINATORS_2: return "Illuminator 2";
468 case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: return "Minimum Number of Capture Buffers";
469 case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: return "Minimum Number of Output Buffers";
347 470
348 /* MPEG controls */ 471 /* MPEG controls */
349 /* Keep the order of the 'case's the same as in videodev2.h! */ 472 /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -380,6 +503,48 @@ const char *v4l2_ctrl_get_name(u32 id)
380 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: return "Video Temporal Decimation"; 503 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: return "Video Temporal Decimation";
381 case V4L2_CID_MPEG_VIDEO_MUTE: return "Video Mute"; 504 case V4L2_CID_MPEG_VIDEO_MUTE: return "Video Mute";
382 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: return "Video Mute YUV"; 505 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: return "Video Mute YUV";
506 case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: return "Decoder Slice Interface";
507 case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: return "MPEG4 Loop Filter Enable";
508 case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "The Number of Intra Refresh MBs";
509 case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: return "Frame Level Rate Control Enable";
510 case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control";
511 case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return "Sequence Header Mode";
512 case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "The Max Number of Reference Picture";
513 case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP: return "H263 I-Frame QP Value";
514 case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P frame QP Value";
515 case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B frame QP Value";
516 case V4L2_CID_MPEG_VIDEO_H263_MIN_QP: return "H263 Minimum QP Value";
517 case V4L2_CID_MPEG_VIDEO_H263_MAX_QP: return "H263 Maximum QP Value";
518 case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP: return "H264 I-Frame QP Value";
519 case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP: return "H264 P frame QP Value";
520 case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP: return "H264 B frame QP Value";
521 case V4L2_CID_MPEG_VIDEO_H264_MAX_QP: return "H264 Maximum QP Value";
522 case V4L2_CID_MPEG_VIDEO_H264_MIN_QP: return "H264 Minimum QP Value";
523 case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM: return "H264 8x8 Transform Enable";
524 case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE: return "H264 CPB Buffer Size";
525 case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: return "H264 Entorpy Mode";
526 case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD: return "H264 I Period";
527 case V4L2_CID_MPEG_VIDEO_H264_LEVEL: return "H264 Level";
528 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA: return "H264 Loop Filter Alpha Offset";
529 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA: return "H264 Loop Filter Beta Offset";
530 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE: return "H264 Loop Filter Mode";
531 case V4L2_CID_MPEG_VIDEO_H264_PROFILE: return "H264 Profile";
532 case V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT: return "Vertical Size of SAR";
533 case V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH: return "Horizontal Size of SAR";
534 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: return "Aspect Ratio VUI Enable";
535 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: return "VUI Aspect Ratio IDC";
536 case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value";
537 case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP: return "MPEG4 P frame QP Value";
538 case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP: return "MPEG4 B frame QP Value";
539 case V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP: return "MPEG4 Minimum QP Value";
540 case V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP: return "MPEG4 Maximum QP Value";
541 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: return "MPEG4 Level";
542 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: return "MPEG4 Profile";
543 case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL: return "Quarter Pixel Search Enable";
544 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES: return "The Maximum Bytes Per Slice";
545 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB: return "The Number of MB in a Slice";
546 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return "The Slice Partitioning Method";
547 case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size";
383 548
384 /* CAMERA controls */ 549 /* CAMERA controls */
385 /* Keep the order of the 'case's the same as in videodev2.h! */ 550 /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -478,6 +643,13 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
478 case V4L2_CID_FLASH_STROBE_STATUS: 643 case V4L2_CID_FLASH_STROBE_STATUS:
479 case V4L2_CID_FLASH_CHARGE: 644 case V4L2_CID_FLASH_CHARGE:
480 case V4L2_CID_FLASH_READY: 645 case V4L2_CID_FLASH_READY:
646 case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
647 case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE:
648 case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:
649 case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE:
650 case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
651 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
652 case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
481 *type = V4L2_CTRL_TYPE_BOOLEAN; 653 *type = V4L2_CTRL_TYPE_BOOLEAN;
482 *min = 0; 654 *min = 0;
483 *max = *step = 1; 655 *max = *step = 1;
@@ -511,6 +683,15 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
511 case V4L2_CID_TUNE_PREEMPHASIS: 683 case V4L2_CID_TUNE_PREEMPHASIS:
512 case V4L2_CID_FLASH_LED_MODE: 684 case V4L2_CID_FLASH_LED_MODE:
513 case V4L2_CID_FLASH_STROBE_SOURCE: 685 case V4L2_CID_FLASH_STROBE_SOURCE:
686 case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
687 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE:
688 case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
689 case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
690 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:
691 case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
692 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC:
693 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
694 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
514 *type = V4L2_CTRL_TYPE_MENU; 695 *type = V4L2_CTRL_TYPE_MENU;
515 break; 696 break;
516 case V4L2_CID_RDS_TX_PS_NAME: 697 case V4L2_CID_RDS_TX_PS_NAME:
@@ -537,6 +718,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
537 case V4L2_CID_FLASH_FAULT: 718 case V4L2_CID_FLASH_FAULT:
538 *type = V4L2_CTRL_TYPE_BITMASK; 719 *type = V4L2_CTRL_TYPE_BITMASK;
539 break; 720 break;
721 case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
722 case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:
723 *type = V4L2_CTRL_TYPE_INTEGER;
724 *flags |= V4L2_CTRL_FLAG_READ_ONLY;
725 break;
540 default: 726 default:
541 *type = V4L2_CTRL_TYPE_INTEGER; 727 *type = V4L2_CTRL_TYPE_INTEGER;
542 break; 728 break;