提交 3eea543b 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

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: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 e281db58
master alk-4.19.24 alk-4.19.30 alk-4.19.34 alk-4.19.36 alk-4.19.43 alk-4.19.48 alk-4.19.57 ck-4.19.67 ck-4.19.81 ck-4.19.91 github/fork/deepanshu1422/fix-typo-in-comment github/fork/haosdent/fix-typo linux-next v4.19.91 v4.19.90 v4.19.89 v4.19.88 v4.19.87 v4.19.86 v4.19.85 v4.19.84 v4.19.83 v4.19.82 v4.19.81 v4.19.80 v4.19.79 v4.19.78 v4.19.77 v4.19.76 v4.19.75 v4.19.74 v4.19.73 v4.19.72 v4.19.71 v4.19.70 v4.19.69 v4.19.68 v4.19.67 v4.19.66 v4.19.65 v4.19.64 v4.19.63 v4.19.62 v4.19.61 v4.19.60 v4.19.59 v4.19.58 v4.19.57 v4.19.56 v4.19.55 v4.19.54 v4.19.53 v4.19.52 v4.19.51 v4.19.50 v4.19.49 v4.19.48 v4.19.47 v4.19.46 v4.19.45 v4.19.44 v4.19.43 v4.19.42 v4.19.41 v4.19.40 v4.19.39 v4.19.38 v4.19.37 v4.19.36 v4.19.35 v4.19.34 v4.19.33 v4.19.32 v4.19.31 v4.19.30 v4.19.29 v4.19.28 v4.19.27 v4.19.26 v4.19.25 v4.19.24 v4.19.23 v4.19.22 v4.19.21 v4.19.20 v4.19.19 v4.19.18 v4.19.17 v4.19.16 v4.19.15 v4.19.14 v4.19.13 v4.19.12 v4.19.11 v4.19.10 v4.19.9 v4.19.8 v4.19.7 v4.19.6 v4.19.5 v4.19.4 v4.19.3 v4.19.2 v4.19.1 v4.19 v4.19-rc8 v4.19-rc7 v4.19-rc6 v4.19-rc5 v4.19-rc4 v4.19-rc3 v4.19-rc2 v4.19-rc1 ck-release-21 ck-release-20 ck-release-19.2 ck-release-19.1 ck-release-19 ck-release-18 ck-release-17.2 ck-release-17.1 ck-release-17 ck-release-16 ck-release-15.1 ck-release-15 ck-release-14 ck-release-13.2 ck-release-13 ck-release-12 ck-release-11 ck-release-10 ck-release-9 ck-release-7 alk-release-15 alk-release-14 alk-release-13.2 alk-release-13 alk-release-12 alk-release-11 alk-release-10 alk-release-9 alk-release-7
无相关合并请求
......@@ -172,6 +172,39 @@ static u8 PMT[] = {
0x00, 0x00, 0x00, 0x00 /* CRC32 */
};
static u8 PMT_AC3[] = {
0xc2, /* i2c register */
0x01, /* table number for encoder(1) */
0x47, /* sync */
0x40, /* transport_error_indicator(0), payload_unit_start(1), transport_priority(0) */
0x10, /* PMT PID (0x0010) */
0x10, /* transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0) */
0x00, /* PSI pointer to start of table */
0x02, /* TID (2) */
0xb0, 0x1a, /* section_syntax_indicator(1), section_length(26) */
0x00, 0x01, /* program_number(1) */
0xc1, /* version_number(0), current_next_indicator(1) */
0x00, 0x00, /* section_number(0), last_section_number(0) */
0xe1, 0x04, /* PCR_PID (0x0104) */
0xf0, 0x00, /* program_info_length(0) */
0x02, 0xe1, 0x00, 0xf0, 0x00, /* video stream type(2), pid */
0x06, 0xe1, 0x03, 0xf0, 0x03, /* audio stream type(6), pid */
0x6a, /* AC3 */
0x01, /* Descriptor_length(1) */
0x00, /* component_type_flag(0), bsid_flag(0), mainid_flag(0), asvc_flag(0), reserved flags(0) */
0xED, 0xDE, 0x2D, 0xF3 /* CRC32 BE */
};
static struct saa6752hs_mpeg_params param_defaults =
{
.ts_pid_pmt = 16,
......@@ -186,7 +219,7 @@ static struct saa6752hs_mpeg_params param_defaults =
.au_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2,
.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K,
.au_ac3_bitrate = V4L2_MPEG_AUDIO_AC3_BITRATE_384K,
.au_ac3_bitrate = V4L2_MPEG_AUDIO_AC3_BITRATE_256K,
};
/* ---------------------------------------------------------------------- */
......@@ -295,10 +328,7 @@ static int saa6752hs_set_bitrate(struct i2c_client* client,
/* set the audio encoding */
buf[0] = 0x93;
if (params->au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3)
buf[1] = 1;
else
buf[1] = 0;
buf[1] = (params->au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3);
i2c_master_send(client, buf, 2);
/* set the audio bitrate */
......@@ -627,6 +657,7 @@ static int saa6752hs_init(struct i2c_client* client)
{
unsigned char buf[9], buf2[4];
struct saa6752hs_state *h;
unsigned size;
u32 crc;
unsigned char localPAT[256];
unsigned char localPMT[256];
......@@ -685,7 +716,13 @@ static int saa6752hs_init(struct i2c_client* client)
localPAT[sizeof(PAT) - 1] = crc & 0xFF;
/* compute PMT */
memcpy(localPMT, PMT, sizeof(PMT));
if (h->params.au_encoding == V4L2_MPEG_AUDIO_ENCODING_AC3) {
size = sizeof(PMT_AC3);
memcpy(localPMT, PMT_AC3, size);
} else {
size = sizeof(PMT);
memcpy(localPMT, PMT, size);
}
localPMT[3] = 0x40 | ((h->params.ts_pid_pmt >> 8) & 0x0f);
localPMT[4] = h->params.ts_pid_pmt & 0xff;
localPMT[15] = 0xE0 | ((h->params.ts_pid_pcr >> 8) & 0x0F);
......@@ -694,11 +731,11 @@ static int saa6752hs_init(struct i2c_client* client)
localPMT[21] = h->params.ts_pid_video & 0xFF;
localPMT[25] = 0xE0 | ((h->params.ts_pid_audio >> 8) & 0x0F);
localPMT[26] = h->params.ts_pid_audio & 0xFF;
crc = crc32_be(~0, &localPMT[7], sizeof(PMT) - 7 - 4);
localPMT[sizeof(PMT) - 4] = (crc >> 24) & 0xFF;
localPMT[sizeof(PMT) - 3] = (crc >> 16) & 0xFF;
localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF;
localPMT[sizeof(PMT) - 1] = crc & 0xFF;
crc = crc32_be(~0, &localPMT[7], size - 7 - 4);
localPMT[size - 4] = (crc >> 24) & 0xFF;
localPMT[size - 3] = (crc >> 16) & 0xFF;
localPMT[size - 2] = (crc >> 8) & 0xFF;
localPMT[size - 1] = crc & 0xFF;
/* Set Audio PID */
buf[0] = 0xC1;
......@@ -719,8 +756,8 @@ static int saa6752hs_init(struct i2c_client* client)
i2c_master_send(client,buf,3);
/* Send SI tables */
i2c_master_send(client,localPAT,sizeof(PAT));
i2c_master_send(client,localPMT,sizeof(PMT));
i2c_master_send(client, localPAT, sizeof(PAT));
i2c_master_send(client, localPMT, size);
/* mute then unmute audio. This removes buzzing artefacts */
buf[0] = 0xa4;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部