aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-12-15 08:46:16 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-02-14 10:43:49 -0500
commit24c19a217e543b6b4a7715229f0e1fcf4bbd2659 (patch)
treeb3eab287a0b61ff3750ade822b5ac82ffb6c06c2
parentda8ec560e3b4e25d73c64a9e08f9f90ebfbfbf7c (diff)
[media] v4l2-ctrls: add new controls for MPEG decoder devices
As discussed during the 2011 V4L-DVB workshop we want to create a proper V4L2 decoder API that replaces the DVBv5 API that has been used until now. This adds the four controls necessary to be able to switch ivtv over to this new API. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/v4l2-ctrls.c23
-rw-r--r--include/linux/videodev2.h13
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index cccd42be718a..94fbb5b50c74 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -175,6 +175,15 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
175 "16-bit CRC", 175 "16-bit CRC",
176 NULL 176 NULL
177 }; 177 };
178 static const char * const mpeg_audio_dec_playback[] = {
179 "Auto",
180 "Stereo",
181 "Left",
182 "Right",
183 "Mono",
184 "Swapped Stereo",
185 NULL
186 };
178 static const char * const mpeg_video_encoding[] = { 187 static const char * const mpeg_video_encoding[] = {
179 "MPEG-1", 188 "MPEG-1",
180 "MPEG-2", 189 "MPEG-2",
@@ -374,6 +383,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
374 return mpeg_audio_emphasis; 383 return mpeg_audio_emphasis;
375 case V4L2_CID_MPEG_AUDIO_CRC: 384 case V4L2_CID_MPEG_AUDIO_CRC:
376 return mpeg_audio_crc; 385 return mpeg_audio_crc;
386 case V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK:
387 case V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK:
388 return mpeg_audio_dec_playback;
377 case V4L2_CID_MPEG_VIDEO_ENCODING: 389 case V4L2_CID_MPEG_VIDEO_ENCODING:
378 return mpeg_video_encoding; 390 return mpeg_video_encoding;
379 case V4L2_CID_MPEG_VIDEO_ASPECT: 391 case V4L2_CID_MPEG_VIDEO_ASPECT:
@@ -492,6 +504,8 @@ const char *v4l2_ctrl_get_name(u32 id)
492 case V4L2_CID_MPEG_AUDIO_MUTE: return "Audio Mute"; 504 case V4L2_CID_MPEG_AUDIO_MUTE: return "Audio Mute";
493 case V4L2_CID_MPEG_AUDIO_AAC_BITRATE: return "Audio AAC Bitrate"; 505 case V4L2_CID_MPEG_AUDIO_AAC_BITRATE: return "Audio AAC Bitrate";
494 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: return "Audio AC-3 Bitrate"; 506 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: return "Audio AC-3 Bitrate";
507 case V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK: return "Audio Playback";
508 case V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK: return "Audio Multilingual Playback";
495 case V4L2_CID_MPEG_VIDEO_ENCODING: return "Video Encoding"; 509 case V4L2_CID_MPEG_VIDEO_ENCODING: return "Video Encoding";
496 case V4L2_CID_MPEG_VIDEO_ASPECT: return "Video Aspect"; 510 case V4L2_CID_MPEG_VIDEO_ASPECT: return "Video Aspect";
497 case V4L2_CID_MPEG_VIDEO_B_FRAMES: return "Video B Frames"; 511 case V4L2_CID_MPEG_VIDEO_B_FRAMES: return "Video B Frames";
@@ -546,6 +560,8 @@ const char *v4l2_ctrl_get_name(u32 id)
546 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB: return "Number of MBs in a Slice"; 560 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB: return "Number of MBs in a Slice";
547 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return "Slice Partitioning Method"; 561 case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return "Slice Partitioning Method";
548 case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size"; 562 case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size";
563 case V4L2_CID_MPEG_VIDEO_DEC_PTS: return "Video Decoder PTS";
564 case V4L2_CID_MPEG_VIDEO_DEC_FRAME: return "Video Decoder Frame Count";
549 565
550 /* CAMERA controls */ 566 /* CAMERA controls */
551 /* Keep the order of the 'case's the same as in videodev2.h! */ 567 /* Keep the order of the 'case's the same as in videodev2.h! */
@@ -674,6 +690,8 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
674 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: 690 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
675 case V4L2_CID_MPEG_AUDIO_EMPHASIS: 691 case V4L2_CID_MPEG_AUDIO_EMPHASIS:
676 case V4L2_CID_MPEG_AUDIO_CRC: 692 case V4L2_CID_MPEG_AUDIO_CRC:
693 case V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK:
694 case V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK:
677 case V4L2_CID_MPEG_VIDEO_ENCODING: 695 case V4L2_CID_MPEG_VIDEO_ENCODING:
678 case V4L2_CID_MPEG_VIDEO_ASPECT: 696 case V4L2_CID_MPEG_VIDEO_ASPECT:
679 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: 697 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
@@ -724,6 +742,11 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
724 *type = V4L2_CTRL_TYPE_INTEGER; 742 *type = V4L2_CTRL_TYPE_INTEGER;
725 *flags |= V4L2_CTRL_FLAG_READ_ONLY; 743 *flags |= V4L2_CTRL_FLAG_READ_ONLY;
726 break; 744 break;
745 case V4L2_CID_MPEG_VIDEO_DEC_FRAME:
746 case V4L2_CID_MPEG_VIDEO_DEC_PTS:
747 *type = V4L2_CTRL_TYPE_INTEGER64;
748 *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_VOLATILE;
749 break;
727 default: 750 default:
728 *type = V4L2_CTRL_TYPE_INTEGER; 751 *type = V4L2_CTRL_TYPE_INTEGER;
729 break; 752 break;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index e4ba8d77196d..b739d7d6f7e7 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1407,6 +1407,16 @@ enum v4l2_mpeg_audio_ac3_bitrate {
1407 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, 1407 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1408 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, 1408 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1409}; 1409};
1410#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
1411enum v4l2_mpeg_audio_dec_playback {
1412 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
1413 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
1414 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
1415 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
1416 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
1417 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
1418};
1419#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
1410 1420
1411/* MPEG video controls specific to multiplexed streams */ 1421/* MPEG video controls specific to multiplexed streams */
1412#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1422#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
@@ -1457,6 +1467,9 @@ enum v4l2_mpeg_video_multi_slice_mode {
1457 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, 1467 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1458}; 1468};
1459#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) 1469#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1470#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
1471#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
1472
1460#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 1473#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1461#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 1474#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1462#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) 1475#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)