aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-common.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-08 06:55:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:48 -0400
commit69028d7096a6092812f0482833f0820593f1cafd (patch)
tree3c3e260a44345ea3f0d2989c3ea641cafbb30631 /drivers/media/video/v4l2-common.c
parente6b5da88fb24c5c1e52707faea7c46df09da42f0 (diff)
V4L/DVB (8636): v4l2: add v4l2_ctrl_get_name control support function.
Add function that returns the control name. Allows this to be used in places where the normal v4l2_ctrl_query_fill() function cannot be used (e.g. uvc). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r--drivers/media/video/v4l2-common.c109
1 files changed, 59 insertions, 50 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 0a96cc35738c..da4791de7050 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -362,63 +362,72 @@ const char **v4l2_ctrl_get_menu(u32 id)
362} 362}
363EXPORT_SYMBOL(v4l2_ctrl_get_menu); 363EXPORT_SYMBOL(v4l2_ctrl_get_menu);
364 364
365/* Fill in a struct v4l2_queryctrl */ 365/* Return the control name. */
366int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def) 366const char *v4l2_ctrl_get_name(u32 id)
367{ 367{
368 const char *name; 368 switch (id) {
369
370 qctrl->flags = 0;
371 switch (qctrl->id) {
372 /* USER controls */ 369 /* USER controls */
373 case V4L2_CID_USER_CLASS: name = "User Controls"; break; 370 case V4L2_CID_USER_CLASS: return "User Controls";
374 case V4L2_CID_AUDIO_VOLUME: name = "Volume"; break; 371 case V4L2_CID_AUDIO_VOLUME: return "Volume";
375 case V4L2_CID_AUDIO_MUTE: name = "Mute"; break; 372 case V4L2_CID_AUDIO_MUTE: return "Mute";
376 case V4L2_CID_AUDIO_BALANCE: name = "Balance"; break; 373 case V4L2_CID_AUDIO_BALANCE: return "Balance";
377 case V4L2_CID_AUDIO_BASS: name = "Bass"; break; 374 case V4L2_CID_AUDIO_BASS: return "Bass";
378 case V4L2_CID_AUDIO_TREBLE: name = "Treble"; break; 375 case V4L2_CID_AUDIO_TREBLE: return "Treble";
379 case V4L2_CID_AUDIO_LOUDNESS: name = "Loudness"; break; 376 case V4L2_CID_AUDIO_LOUDNESS: return "Loudness";
380 case V4L2_CID_BRIGHTNESS: name = "Brightness"; break; 377 case V4L2_CID_BRIGHTNESS: return "Brightness";
381 case V4L2_CID_CONTRAST: name = "Contrast"; break; 378 case V4L2_CID_CONTRAST: return "Contrast";
382 case V4L2_CID_SATURATION: name = "Saturation"; break; 379 case V4L2_CID_SATURATION: return "Saturation";
383 case V4L2_CID_HUE: name = "Hue"; break; 380 case V4L2_CID_HUE: return "Hue";
384 381
385 /* MPEG controls */ 382 /* MPEG controls */
386 case V4L2_CID_MPEG_CLASS: name = "MPEG Encoder Controls"; break; 383 case V4L2_CID_MPEG_CLASS: return "MPEG Encoder Controls";
387 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: name = "Audio Sampling Frequency"; break; 384 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: return "Audio Sampling Frequency";
388 case V4L2_CID_MPEG_AUDIO_ENCODING: name = "Audio Encoding"; break; 385 case V4L2_CID_MPEG_AUDIO_ENCODING: return "Audio Encoding";
389 case V4L2_CID_MPEG_AUDIO_L1_BITRATE: name = "Audio Layer I Bitrate"; break; 386 case V4L2_CID_MPEG_AUDIO_L1_BITRATE: return "Audio Layer I Bitrate";
390 case V4L2_CID_MPEG_AUDIO_L2_BITRATE: name = "Audio Layer II Bitrate"; break; 387 case V4L2_CID_MPEG_AUDIO_L2_BITRATE: return "Audio Layer II Bitrate";
391 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: name = "Audio Layer III Bitrate"; break; 388 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: return "Audio Layer III Bitrate";
392 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: name = "Audio AC-3 Bitrate"; break; 389 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: return "Audio AC-3 Bitrate";
393 case V4L2_CID_MPEG_AUDIO_MODE: name = "Audio Stereo Mode"; break; 390 case V4L2_CID_MPEG_AUDIO_MODE: return "Audio Stereo Mode";
394 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: name = "Audio Stereo Mode Extension"; break; 391 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: return "Audio Stereo Mode Extension";
395 case V4L2_CID_MPEG_AUDIO_EMPHASIS: name = "Audio Emphasis"; break; 392 case V4L2_CID_MPEG_AUDIO_EMPHASIS: return "Audio Emphasis";
396 case V4L2_CID_MPEG_AUDIO_CRC: name = "Audio CRC"; break; 393 case V4L2_CID_MPEG_AUDIO_CRC: return "Audio CRC";
397 case V4L2_CID_MPEG_AUDIO_MUTE: name = "Audio Mute"; break; 394 case V4L2_CID_MPEG_AUDIO_MUTE: return "Audio Mute";
398 case V4L2_CID_MPEG_VIDEO_ENCODING: name = "Video Encoding"; break; 395 case V4L2_CID_MPEG_VIDEO_ENCODING: return "Video Encoding";
399 case V4L2_CID_MPEG_VIDEO_ASPECT: name = "Video Aspect"; break; 396 case V4L2_CID_MPEG_VIDEO_ASPECT: return "Video Aspect";
400 case V4L2_CID_MPEG_VIDEO_B_FRAMES: name = "Video B Frames"; break; 397 case V4L2_CID_MPEG_VIDEO_B_FRAMES: return "Video B Frames";
401 case V4L2_CID_MPEG_VIDEO_GOP_SIZE: name = "Video GOP Size"; break; 398 case V4L2_CID_MPEG_VIDEO_GOP_SIZE: return "Video GOP Size";
402 case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: name = "Video GOP Closure"; break; 399 case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: return "Video GOP Closure";
403 case V4L2_CID_MPEG_VIDEO_PULLDOWN: name = "Video Pulldown"; break; 400 case V4L2_CID_MPEG_VIDEO_PULLDOWN: return "Video Pulldown";
404 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: name = "Video Bitrate Mode"; break; 401 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: return "Video Bitrate Mode";
405 case V4L2_CID_MPEG_VIDEO_BITRATE: name = "Video Bitrate"; break; 402 case V4L2_CID_MPEG_VIDEO_BITRATE: return "Video Bitrate";
406 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: name = "Video Peak Bitrate"; break; 403 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: return "Video Peak Bitrate";
407 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: name = "Video Temporal Decimation"; break; 404 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: return "Video Temporal Decimation";
408 case V4L2_CID_MPEG_VIDEO_MUTE: name = "Video Mute"; break; 405 case V4L2_CID_MPEG_VIDEO_MUTE: return "Video Mute";
409 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: name = "Video Mute YUV"; break; 406 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: return "Video Mute YUV";
410 case V4L2_CID_MPEG_STREAM_TYPE: name = "Stream Type"; break; 407 case V4L2_CID_MPEG_STREAM_TYPE: return "Stream Type";
411 case V4L2_CID_MPEG_STREAM_PID_PMT: name = "Stream PMT Program ID"; break; 408 case V4L2_CID_MPEG_STREAM_PID_PMT: return "Stream PMT Program ID";
412 case V4L2_CID_MPEG_STREAM_PID_AUDIO: name = "Stream Audio Program ID"; break; 409 case V4L2_CID_MPEG_STREAM_PID_AUDIO: return "Stream Audio Program ID";
413 case V4L2_CID_MPEG_STREAM_PID_VIDEO: name = "Stream Video Program ID"; break; 410 case V4L2_CID_MPEG_STREAM_PID_VIDEO: return "Stream Video Program ID";
414 case V4L2_CID_MPEG_STREAM_PID_PCR: name = "Stream PCR Program ID"; break; 411 case V4L2_CID_MPEG_STREAM_PID_PCR: return "Stream PCR Program ID";
415 case V4L2_CID_MPEG_STREAM_PES_ID_AUDIO: name = "Stream PES Audio ID"; break; 412 case V4L2_CID_MPEG_STREAM_PES_ID_AUDIO: return "Stream PES Audio ID";
416 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO: name = "Stream PES Video ID"; break; 413 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO: return "Stream PES Video ID";
417 case V4L2_CID_MPEG_STREAM_VBI_FMT: name = "Stream VBI Format"; break; 414 case V4L2_CID_MPEG_STREAM_VBI_FMT: return "Stream VBI Format";
418 415
419 default: 416 default:
420 return -EINVAL; 417 return NULL;
421 } 418 }
419}
420EXPORT_SYMBOL(v4l2_ctrl_get_name);
421
422/* Fill in a struct v4l2_queryctrl */
423int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def)
424{
425 const char *name = v4l2_ctrl_get_name(qctrl->id);
426
427 qctrl->flags = 0;
428 if (name == NULL)
429 return -EINVAL;
430
422 switch (qctrl->id) { 431 switch (qctrl->id) {
423 case V4L2_CID_AUDIO_MUTE: 432 case V4L2_CID_AUDIO_MUTE:
424 case V4L2_CID_AUDIO_LOUDNESS: 433 case V4L2_CID_AUDIO_LOUDNESS: