Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dvb psi: add another AC-3 detection hack, fixes #2647
  • Loading branch information
perexg committed Jan 28, 2015
1 parent ebdd85f commit 927ebf2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/input/mpegts.h
Expand Up @@ -331,6 +331,13 @@ enum mpegts_mux_epg_flag
};
#define MM_EPG_LAST MM_EPG_ONLY_OPENTV_SKY_AUSAT

enum mpegts_mux_ac3_flag
{
MM_AC3_STANDARD,
MM_AC3_PMT_06,
MM_AC3_PMT_N05,
};

typedef struct tsdebug_packet {
TAILQ_ENTRY(tsdebug_packet) link;
uint8_t pkt[188];
Expand Down Expand Up @@ -428,7 +435,7 @@ struct mpegts_mux
int mm_enabled;
int mm_epg;
char *mm_charset;
int mm_pmt_06_ac3;
int mm_pmt_ac3;

/*
* TSDEBUG
Expand Down
4 changes: 2 additions & 2 deletions src/input/mpegts/dvb_psi.c
Expand Up @@ -2294,7 +2294,7 @@ psi_parse_pmt
case 0x06:
/* 0x06 is Chinese Cable TV AC-3 audio track */
/* but mark it so only when no more descriptors exist */
if (dllen > 1 || !mux || !mux->mm_pmt_06_ac3)
if (dllen > 1 || !mux || mux->mm_pmt_ac3 != MM_AC3_PMT_06)
break;
/* fall through to SCT_AC3 */
case 0x81:
Expand Down Expand Up @@ -2336,7 +2336,7 @@ psi_parse_pmt
break;

case DVB_DESC_REGISTRATION:
if(dlen == 4 &&
if(mux->mm_pmt_ac3 != MM_AC3_PMT_N05 && dlen == 4 &&
ptr[0] == 'A' && ptr[1] == 'C' && ptr[2] == '-' && ptr[3] == '3')
hts_stream_type = SCT_AC3;
/* seen also these formats: */
Expand Down
20 changes: 16 additions & 4 deletions src/input/mpegts/mpegts_mux.c
Expand Up @@ -447,6 +447,17 @@ mpegts_mux_epg_list ( void *o )
return strtab2htsmsg(tab);
}

static htsmsg_t *
mpegts_mux_ac3_list ( void *o )
{
static const struct strtab tab[] = {
{ "Standard", MM_AC3_STANDARD },
{ "AC-3 = descriptor 6", MM_AC3_PMT_06 },
{ "Ignore descriptor 5", MM_AC3_PMT_N05 },
};
return strtab2htsmsg(tab);
}

const idclass_t mpegts_mux_class =
{
.ic_class = "mpegts_mux",
Expand Down Expand Up @@ -548,11 +559,12 @@ const idclass_t mpegts_mux_class =
.get = mpegts_mux_class_get_num_chn,
},
{
.type = PT_BOOL,
.type = PT_INT,
.id = "pmt_06_ac3",
.name = "PMT Descriptor 0x06 = AC-3",
.off = offsetof(mpegts_mux_t, mm_pmt_06_ac3),
.opts = PO_ADVANCED,
.name = "AC-3 Detection",
.off = offsetof(mpegts_mux_t, mm_pmt_ac3),
.def.i = MM_EPG_ENABLE,
.list = mpegts_mux_ac3_list,
},
{}
}
Expand Down

0 comments on commit 927ebf2

Please sign in to comment.