fix teletext detection by parsing all desc tag

Fix #20
This commit is contained in:
Anshul
2014-05-10 06:06:13 +05:30
parent c027956032
commit cfba1a11c5
2 changed files with 24 additions and 6 deletions

View File

@@ -126,6 +126,7 @@ enum ccx_mpeg_descriptor
CCX_MPEG_DSC_DVB_SUBTITLE = 0x59,
};
enum
{
CCX_MESSAGES_QUIET = 0,
@@ -218,7 +219,20 @@ enum cxx_code_type
CCX_CODEC_DVB,
CCX_CODEC_NONE,
};
/*
* This Macro check whether descriptor tag is valid for teletext
* codec or not.
*
* @param desc descriptor tag given for each stream
*
* @return if descriptor tag is valid then it return 1 otherwise 0
*
*/
#define IS_VALID_TELETEXT_DESC(desc) ( ((desc) == CCX_MPEG_DSC_VBI_DATA_DESCRIPTOR )|| \
( (desc) == CCX_MPEG_DSC_VBI_TELETEXT_DESCRIPTOR ) || \
( (desc) == CCX_MPEG_DSC_TELETEXT_DESCRIPTOR ) )
/*
* This macro to be used when you want to find out whether you
* should parse f_sel subtitle codec type or not

View File

@@ -233,15 +233,18 @@ int parse_PMT (int pos)
}
}
if (IS_FEASIBLE(ccx_options.codec,ccx_options.nocodec,CCX_CODEC_TELETEXT) && (ccx_options.teletext_mode==CCX_TXT_AUTO_NOT_YET_FOUND ||
(ccx_options.teletext_mode==CCX_TXT_IN_USE && !ccx_options.ts_cappid)) // Want teletext but don't know the PID yet
&& ES_info_length
&& ccx_stream_type == CCX_STREAM_TYPE_PRIVATE_MPEG2) // MPEG-2 Packetized Elementary Stream packets containing private data
{
// descriptor_tag: 0x45 = VBI_data_descriptor, 0x46 = VBI_teletext_descriptor, 0x56 = teletext_descriptor
unsigned descriptor_tag = payload_start[i + 5];
if ((descriptor_tag == 0x45) || (descriptor_tag == 0x46) || (descriptor_tag == 0x56))
{
unsigned char *es_info = payload_start + i + 5;
for (desc_len = 0;(payload_start + i + 5 + ES_info_length) - es_info ;es_info += desc_len)
{
enum ccx_mpeg_descriptor descriptor_tag = (enum ccx_mpeg_descriptor)(*es_info++);
desc_len = (*es_info++);
if(!IS_VALID_TELETEXT_DESC(descriptor_tag))
continue;
telxcc_init();
if (!ccx_options.ts_forced_cappid)
{
@@ -251,7 +254,8 @@ int parse_PMT (int pos)
ccx_options.teletext_mode =CCX_TXT_IN_USE;
mprint ("VBI/teletext stream ID %u (0x%x) for SID %u (0x%x)\n",
elementary_PID, elementary_PID, program_number, program_number);
}
}
}
if (ccx_options.teletext_mode==CCX_TXT_FORBIDDEN &&
ccx_stream_type == CCX_STREAM_TYPE_PRIVATE_MPEG2) // MPEG-2 Packetized Elementary Stream packets containing private data