diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-08-08 06:38:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:48 -0400 |
commit | e6b5da88fb24c5c1e52707faea7c46df09da42f0 (patch) | |
tree | 0ddf04f57c6c1c4da9d986d66f2869250d93a0a5 | |
parent | 188919ac57810e39138749338d5a33ba1e970e23 (diff) |
V4L/DVB (8635): v4l: add AC-3 audio support to the MPEG Encoding API
Some models of the saa6752hs support AC-3. Extend the API with the
necessary controls for AC-3.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/v4l2-common.c | 42 | ||||
-rw-r--r-- | include/linux/videodev2.h | 23 |
2 files changed, 60 insertions, 5 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 893ac496c4b4..0a96cc35738c 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -187,10 +187,11 @@ const char **v4l2_ctrl_get_menu(u32 id) | |||
187 | NULL | 187 | NULL |
188 | }; | 188 | }; |
189 | static const char *mpeg_audio_encoding[] = { | 189 | static const char *mpeg_audio_encoding[] = { |
190 | "MPEG-1 Layer I", | 190 | "MPEG-1/2 Layer I", |
191 | "MPEG-1 Layer II", | 191 | "MPEG-1/2 Layer II", |
192 | "MPEG-1 Layer III", | 192 | "MPEG-1/2 Layer III", |
193 | "MPEG-4 AAC", | 193 | "MPEG-2/4 AAC", |
194 | "AC-3", | ||
194 | NULL | 195 | NULL |
195 | }; | 196 | }; |
196 | static const char *mpeg_audio_l1_bitrate[] = { | 197 | static const char *mpeg_audio_l1_bitrate[] = { |
@@ -244,6 +245,28 @@ const char **v4l2_ctrl_get_menu(u32 id) | |||
244 | "320 kbps", | 245 | "320 kbps", |
245 | NULL | 246 | NULL |
246 | }; | 247 | }; |
248 | static const char *mpeg_audio_ac3_bitrate[] = { | ||
249 | "32 kbps", | ||
250 | "40 kbps", | ||
251 | "48 kbps", | ||
252 | "56 kbps", | ||
253 | "64 kbps", | ||
254 | "80 kbps", | ||
255 | "96 kbps", | ||
256 | "112 kbps", | ||
257 | "128 kbps", | ||
258 | "160 kbps", | ||
259 | "192 kbps", | ||
260 | "224 kbps", | ||
261 | "256 kbps", | ||
262 | "320 kbps", | ||
263 | "384 kbps", | ||
264 | "448 kbps", | ||
265 | "512 kbps", | ||
266 | "576 kbps", | ||
267 | "640 kbps", | ||
268 | NULL | ||
269 | }; | ||
247 | static const char *mpeg_audio_mode[] = { | 270 | static const char *mpeg_audio_mode[] = { |
248 | "Stereo", | 271 | "Stereo", |
249 | "Joint Stereo", | 272 | "Joint Stereo", |
@@ -313,6 +336,8 @@ const char **v4l2_ctrl_get_menu(u32 id) | |||
313 | return mpeg_audio_l2_bitrate; | 336 | return mpeg_audio_l2_bitrate; |
314 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: | 337 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: |
315 | return mpeg_audio_l3_bitrate; | 338 | return mpeg_audio_l3_bitrate; |
339 | case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: | ||
340 | return mpeg_audio_ac3_bitrate; | ||
316 | case V4L2_CID_MPEG_AUDIO_MODE: | 341 | case V4L2_CID_MPEG_AUDIO_MODE: |
317 | return mpeg_audio_mode; | 342 | return mpeg_audio_mode; |
318 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: | 343 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: |
@@ -364,6 +389,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste | |||
364 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: name = "Audio Layer I Bitrate"; break; | 389 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: name = "Audio Layer I Bitrate"; break; |
365 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: name = "Audio Layer II Bitrate"; break; | 390 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: name = "Audio Layer II Bitrate"; break; |
366 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: name = "Audio Layer III Bitrate"; break; | 391 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: name = "Audio Layer III Bitrate"; break; |
392 | case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: name = "Audio AC-3 Bitrate"; break; | ||
367 | case V4L2_CID_MPEG_AUDIO_MODE: name = "Audio Stereo Mode"; break; | 393 | case V4L2_CID_MPEG_AUDIO_MODE: name = "Audio Stereo Mode"; break; |
368 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: name = "Audio Stereo Mode Extension"; break; | 394 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: name = "Audio Stereo Mode Extension"; break; |
369 | case V4L2_CID_MPEG_AUDIO_EMPHASIS: name = "Audio Emphasis"; break; | 395 | case V4L2_CID_MPEG_AUDIO_EMPHASIS: name = "Audio Emphasis"; break; |
@@ -409,6 +435,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste | |||
409 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: | 435 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: |
410 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: | 436 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: |
411 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: | 437 | case V4L2_CID_MPEG_AUDIO_L3_BITRATE: |
438 | case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: | ||
412 | case V4L2_CID_MPEG_AUDIO_MODE: | 439 | case V4L2_CID_MPEG_AUDIO_MODE: |
413 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: | 440 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: |
414 | case V4L2_CID_MPEG_AUDIO_EMPHASIS: | 441 | case V4L2_CID_MPEG_AUDIO_EMPHASIS: |
@@ -495,7 +522,7 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl) | |||
495 | case V4L2_CID_MPEG_AUDIO_ENCODING: | 522 | case V4L2_CID_MPEG_AUDIO_ENCODING: |
496 | return v4l2_ctrl_query_fill(qctrl, | 523 | return v4l2_ctrl_query_fill(qctrl, |
497 | V4L2_MPEG_AUDIO_ENCODING_LAYER_1, | 524 | V4L2_MPEG_AUDIO_ENCODING_LAYER_1, |
498 | V4L2_MPEG_AUDIO_ENCODING_AAC, 1, | 525 | V4L2_MPEG_AUDIO_ENCODING_AC3, 1, |
499 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2); | 526 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2); |
500 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: | 527 | case V4L2_CID_MPEG_AUDIO_L1_BITRATE: |
501 | return v4l2_ctrl_query_fill(qctrl, | 528 | return v4l2_ctrl_query_fill(qctrl, |
@@ -512,6 +539,11 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl) | |||
512 | V4L2_MPEG_AUDIO_L3_BITRATE_32K, | 539 | V4L2_MPEG_AUDIO_L3_BITRATE_32K, |
513 | V4L2_MPEG_AUDIO_L3_BITRATE_320K, 1, | 540 | V4L2_MPEG_AUDIO_L3_BITRATE_320K, 1, |
514 | V4L2_MPEG_AUDIO_L3_BITRATE_192K); | 541 | V4L2_MPEG_AUDIO_L3_BITRATE_192K); |
542 | case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: | ||
543 | return v4l2_ctrl_query_fill(qctrl, | ||
544 | V4L2_MPEG_AUDIO_AC3_BITRATE_32K, | ||
545 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K, 1, | ||
546 | V4L2_MPEG_AUDIO_AC3_BITRATE_384K); | ||
515 | case V4L2_CID_MPEG_AUDIO_MODE: | 547 | case V4L2_CID_MPEG_AUDIO_MODE: |
516 | return v4l2_ctrl_query_fill(qctrl, | 548 | return v4l2_ctrl_query_fill(qctrl, |
517 | V4L2_MPEG_AUDIO_MODE_STEREO, | 549 | V4L2_MPEG_AUDIO_MODE_STEREO, |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 350aba2714fc..9054764f4cde 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -911,6 +911,7 @@ enum v4l2_mpeg_audio_encoding { | |||
911 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, | 911 | V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, |
912 | V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, | 912 | V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, |
913 | V4L2_MPEG_AUDIO_ENCODING_AAC = 3, | 913 | V4L2_MPEG_AUDIO_ENCODING_AAC = 3, |
914 | V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, | ||
914 | }; | 915 | }; |
915 | #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) | 916 | #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) |
916 | enum v4l2_mpeg_audio_l1_bitrate { | 917 | enum v4l2_mpeg_audio_l1_bitrate { |
@@ -989,6 +990,28 @@ enum v4l2_mpeg_audio_crc { | |||
989 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, | 990 | V4L2_MPEG_AUDIO_CRC_CRC16 = 1, |
990 | }; | 991 | }; |
991 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) | 992 | #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) |
993 | #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+110) | ||
994 | enum v4l2_mpeg_audio_ac3_bitrate { | ||
995 | V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, | ||
996 | V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, | ||
997 | V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, | ||
998 | V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, | ||
999 | V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, | ||
1000 | V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, | ||
1001 | V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, | ||
1002 | V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, | ||
1003 | V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, | ||
1004 | V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, | ||
1005 | V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, | ||
1006 | V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, | ||
1007 | V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, | ||
1008 | V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, | ||
1009 | V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, | ||
1010 | V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, | ||
1011 | V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, | ||
1012 | V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, | ||
1013 | V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, | ||
1014 | }; | ||
992 | 1015 | ||
993 | /* MPEG video */ | 1016 | /* MPEG video */ |
994 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) | 1017 | #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) |