diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-08-08 12:27:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:48 -0400 |
commit | 3eea543b7282bea38970f20840acff9e230d0c2a (patch) | |
tree | 43588d1a34fff86d940bbb94a35ed768e7eaf8f3 /drivers/media/video | |
parent | e281db5862743dbe1dab7f8fb423e699537036ee (diff) |
V4L/DVB (8640): saa6752hs: add PMT table for AC3
The PMT table for AC3 audio is different.
Thanks to Dmitry Belimov for providing the table data.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index ca725a74ce6a..28499e591925 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -172,6 +172,39 @@ static u8 PMT[] = { | |||
172 | 0x00, 0x00, 0x00, 0x00 /* CRC32 */ | 172 | 0x00, 0x00, 0x00, 0x00 /* CRC32 */ |
173 | }; | 173 | }; |
174 | 174 | ||
175 | static u8 PMT_AC3[] = { | ||
176 | 0xc2, /* i2c register */ | ||
177 | 0x01, /* table number for encoder(1) */ | ||
178 | 0x47, /* sync */ | ||
179 | |||
180 | 0x40, /* transport_error_indicator(0), payload_unit_start(1), transport_priority(0) */ | ||
181 | 0x10, /* PMT PID (0x0010) */ | ||
182 | 0x10, /* transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) */ | ||
183 | |||
184 | 0x00, /* PSI pointer to start of table */ | ||
185 | |||
186 | 0x02, /* TID (2) */ | ||
187 | 0xb0, 0x1a, /* section_syntax_indicator(1), section_length(26) */ | ||
188 | |||
189 | 0x00, 0x01, /* program_number(1) */ | ||
190 | |||
191 | 0xc1, /* version_number(0), current_next_indicator(1) */ | ||
192 | |||
193 | 0x00, 0x00, /* section_number(0), last_section_number(0) */ | ||
194 | |||
195 | 0xe1, 0x04, /* PCR_PID (0x0104) */ | ||
196 | |||
197 | 0xf0, 0x00, /* program_info_length(0) */ | ||
198 | |||
199 | 0x02, 0xe1, 0x00, 0xf0, 0x00, /* video stream type(2), pid */ | ||
200 | 0x06, 0xe1, 0x03, 0xf0, 0x03, /* audio stream type(6), pid */ | ||
201 | 0x6a, /* AC3 */ | ||
202 | 0x01, /* Descriptor_length(1) */ | ||
203 | 0x00, /* component_type_flag(0), bsid_flag(0), mainid_flag(0), asvc_flag(0), reserved flags(0) */ | ||
204 | |||
205 | 0xED, 0xDE, 0x2D, 0xF3 /* CRC32 BE */ | ||
206 | }; | ||
207 | |||
175 | static struct saa6752hs_mpeg_params param_defaults = | 208 | static struct saa6752hs_mpeg_params param_defaults = |
176 | { | 209 | { |
177 | .ts_pid_pmt = 16, | 210 | .ts_pid_pmt = 16, |
@@ -186,7 +219,7 @@ static struct saa6752hs_mpeg_params param_defaults = | |||
186 | 219 | ||
187 | .au_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, | 220 | .au_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, |
188 | .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K, | 221 | .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K, |
189 | .au_ac3_bitrate = V4L2_MPEG_AUDIO_AC3_BITRATE_384K, | 222 | .au_ac3_bitrate = V4L2_MPEG_AUDIO_AC3_BITRATE_256K, |
190 | }; | 223 | }; |
191 | 224 | ||
192 | /* ---------------------------------------------------------------------- */ | 225 | /* ---------------------------------------------------------------------- */ |
@@ -295,10 +328,7 @@ static int saa6752hs_set_bitrate(struct i2c_client* client, | |||
295 | 328 | ||
296 | /* set the audio encoding */ | 329 | /* set the audio encoding */ |
297 | buf[0] = 0x93; | 330 | buf[0] = 0x93; |
298 | if (params->au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3) | 331 | buf[1] = (params->au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3); |
299 | buf[1] = 1; | ||
300 | else | ||
301 | buf[1] = 0; | ||
302 | i2c_master_send(client, buf, 2); | 332 | i2c_master_send(client, buf, 2); |
303 | 333 | ||
304 | /* set the audio bitrate */ | 334 | /* set the audio bitrate */ |
@@ -627,6 +657,7 @@ static int saa6752hs_init(struct i2c_client* client) | |||
627 | { | 657 | { |
628 | unsigned char buf[9], buf2[4]; | 658 | unsigned char buf[9], buf2[4]; |
629 | struct saa6752hs_state *h; | 659 | struct saa6752hs_state *h; |
660 | unsigned size; | ||
630 | u32 crc; | 661 | u32 crc; |
631 | unsigned char localPAT[256]; | 662 | unsigned char localPAT[256]; |
632 | unsigned char localPMT[256]; | 663 | unsigned char localPMT[256]; |
@@ -685,7 +716,13 @@ static int saa6752hs_init(struct i2c_client* client) | |||
685 | localPAT[sizeof(PAT) - 1] = crc & 0xFF; | 716 | localPAT[sizeof(PAT) - 1] = crc & 0xFF; |
686 | 717 | ||
687 | /* compute PMT */ | 718 | /* compute PMT */ |
688 | memcpy(localPMT, PMT, sizeof(PMT)); | 719 | if (h->params.au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3) { |
720 | size = sizeof(PMT_AC3); | ||
721 | memcpy(localPMT, PMT_AC3, size); | ||
722 | } else { | ||
723 | size = sizeof(PMT); | ||
724 | memcpy(localPMT, PMT, size); | ||
725 | } | ||
689 | localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f); | 726 | localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f); |
690 | localPMT[4] = h->params.ts_pid_pmt & 0xff; | 727 | localPMT[4] = h->params.ts_pid_pmt & 0xff; |
691 | localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F); | 728 | localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F); |
@@ -694,11 +731,11 @@ static int saa6752hs_init(struct i2c_client* client) | |||
694 | localPMT[21] = h->params.ts_pid_video & 0xFF; | 731 | localPMT[21] = h->params.ts_pid_video & 0xFF; |
695 | localPMT[25] = 0xE0 | ((h->params.ts_pid_audio >> 8) & 0x0F); | 732 | localPMT[25] = 0xE0 | ((h->params.ts_pid_audio >> 8) & 0x0F); |
696 | localPMT[26] = h->params.ts_pid_audio & 0xFF; | 733 | localPMT[26] = h->params.ts_pid_audio & 0xFF; |
697 | crc = crc32_be(~0, &localPMT[7], sizeof(PMT) - 7 - 4); | 734 | crc = crc32_be(~0, &localPMT[7], size - 7 - 4); |
698 | localPMT[sizeof(PMT) - 4] = (crc >> 24) & 0xFF; | 735 | localPMT[size - 4] = (crc >> 24) & 0xFF; |
699 | localPMT[sizeof(PMT) - 3] = (crc >> 16) & 0xFF; | 736 | localPMT[size - 3] = (crc >> 16) & 0xFF; |
700 | localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF; | 737 | localPMT[size - 2] = (crc >> 8) & 0xFF; |
701 | localPMT[sizeof(PMT) - 1] = crc & 0xFF; | 738 | localPMT[size - 1] = crc & 0xFF; |
702 | 739 | ||
703 | /* Set Audio PID */ | 740 | /* Set Audio PID */ |
704 | buf[0] = 0xC1; | 741 | buf[0] = 0xC1; |
@@ -719,8 +756,8 @@ static int saa6752hs_init(struct i2c_client* client) | |||
719 | i2c_master_send(client,buf,3); | 756 | i2c_master_send(client,buf,3); |
720 | 757 | ||
721 | /* Send SI tables */ | 758 | /* Send SI tables */ |
722 | i2c_master_send(client,localPAT,sizeof(PAT)); | 759 | i2c_master_send(client, localPAT, sizeof(PAT)); |
723 | i2c_master_send(client,localPMT,sizeof(PMT)); | 760 | i2c_master_send(client, localPMT, size); |
724 | 761 | ||
725 | /* mute then unmute audio. This removes buzzing artefacts */ | 762 | /* mute then unmute audio. This removes buzzing artefacts */ |
726 | buf[0] = 0xa4; | 763 | buf[0] = 0xa4; |