Exemple #1
0
static int InitScanData(  TS_CHANNEL_PARSER *pTSChannelParser, int nStreamType, int nSubType )
{
	pTSChannelParser->stream_format = nStreamType;
	pTSChannelParser->sub_format = nSubType;
	pTSChannelParser->tune_list.stream_format = nStreamType;
	pTSChannelParser->tune_list.sub_format = nSubType;
	pTSChannelParser->channel_list.stream_format = nStreamType;
	pTSChannelParser->channel_list.sub_format = nSubType;
	pTSChannelParser->program_list.stream_format = nStreamType;
	pTSChannelParser->program_list.sub_format = nSubType;
	//pTSChannelParser->maxium_psi_checking_bytes = MaxPSICheckBytes( nStreamType, nSubType );
	//pTSChannelParser->psi_timeout = MaxPSICheckTimeOut( nStreamType, nSubType );
	pTSChannelParser->channel_list.channel_num = 0;
	pTSChannelParser->program_list.program_num = 0;
	pTSChannelParser->program_list.drop_program_num = 0;
	pTSChannelParser->program_list.flag = 0;

	if ( nStreamType == DVB_STREAM )
	{
		SageLog((  _LOG_ERROR, 3, "DVB Stream isn't support yet" ));
	} else
	if ( nStreamType == ATSC_STREAM )
	{
		if ( nSubType == TERRESTRIAL ) //ATSC
		{
			if ( pTSChannelParser->channel_list.channel == NULL )
			{
				pTSChannelParser->channel_list.total_list_num = MAX_ATSC_CHANNEL_NUM;
				pTSChannelParser->channel_list.channel = SAGETV_MALLOC( sizeof(CHANNEL_DAT)*pTSChannelParser->channel_list.total_list_num );
				pTSChannelParser->program_list.total_list_num = MAX_ATSC_CHANNEL_NUM+10;
				pTSChannelParser->program_list.program = SAGETV_MALLOC( sizeof(PROGRAM_DAT)*pTSChannelParser->program_list.total_list_num );
				return 1;
			}

		} else
		if ( nSubType == CABLE ) //QAM
		{
			if ( pTSChannelParser->channel_list.channel == NULL )
			{
				pTSChannelParser->channel_list.total_list_num = MAX_QAM_CHANNEL_NUM ;
				pTSChannelParser->channel_list.channel = SAGETV_MALLOC( sizeof(CHANNEL_DAT)*pTSChannelParser->channel_list.total_list_num );
				pTSChannelParser->program_list.total_list_num = MAX_QAM_CHANNEL_NUM +10;
				pTSChannelParser->program_list.program = SAGETV_MALLOC( sizeof(PROGRAM_DAT)*pTSChannelParser->program_list.total_list_num );
				return 1;
			}
		} 
	}

	return 0;
}
Exemple #2
0
TRACKS *CreateTracks( int nTrackNum )
{
	int i;
	TRACKS *pTracks;
	pTracks = SAGETV_MALLOC( sizeof(TRACKS) );
	pTracks->track = SAGETV_MALLOC( sizeof(TRACK)* nTrackNum );
	pTracks->total_track = nTrackNum;
	for ( i = 0; i <nTrackNum; i++ )
	{
		pTracks->track[i].channel_index = i;
	}
	pTracks->main_video_index = 0xffff;
	pTracks->main_audio_index = 0xffff;
	return pTracks;
}
Exemple #3
0
static REMUXER* CreateRemuxer( int nStreamType, int nTrackNum, int nESBlockSize )
{
	REMUXER* pRemuxer = NULL;
	//DEMUXER* pDemuxer = NULL;
	pRemuxer = SAGETV_MALLOC( sizeof(REMUXER) );
	pRemuxer->demuxer = CreateDemuxer( nStreamType, nTrackNum, nESBlockSize );
	return pRemuxer;
}
Exemple #4
0
inline static void ExpendChannelList( CHANNEL_LIST *pChannelList, int nExpendNum )
{
	CHANNEL_DAT *old_channel_p = pChannelList->channel;
	int total_num = pChannelList->total_list_num + nExpendNum;
	pChannelList->channel = SAGETV_MALLOC( total_num * sizeof(CHANNEL_DAT) );
	if ( pChannelList->channel )
	{
		if ( old_channel_p )
		{
			memcpy( pChannelList->channel, old_channel_p, 
				    pChannelList->total_list_num * sizeof(CHANNEL_DAT) );
			SAGETV_FREE( old_channel_p );
		}
		pChannelList->total_list_num = total_num;
	} 
}
Exemple #5
0
static int SystemTimeDumper( void* pContext, unsigned char* pData, int nSize )
{
	TS_INFO_PARSER *pTSInfoParser = SAGETV_MALLOC( sizeof(TS_INFO_PARSER) );
	TIME_DATA *time_data = (TIME_DATA*)pData;

	if ( time_data->gps_sec )
		pTSInfoParser->utc_sec = time_data->gps_sec + 315993600;  //GPS start 1/6 0:0:0 1980, GMT UTC start 1/1 0:0:0 1970
	else
		pTSInfoParser->utc_sec = time_data->utc_sec;
		
	if ( pTSInfoParser->utc_sec_start == 0 )
		pTSInfoParser->utc_sec_start = pTSInfoParser->utc_sec;
	
	if ( pTSInfoParser->dumper.time_dumper != NULL )
		pTSInfoParser->dumper.time_dumper( pTSInfoParser->dumper.time_dumper_context, &pTSInfoParser->utc_sec_start, sizeof(pTSInfoParser->utc_sec_start) );
		
	return 1;
}
Exemple #6
0
TS_INFO_PARSER* CreateTSInfoParser( int nMaxStreamNum, int nStreamFormat, int nSubFormat )
{
	int i;
	TS_INFO_PARSER *pTSInfoParser = SAGETV_MALLOC( sizeof(TS_INFO_PARSER) );
	pTSInfoParser->ts_filter = CreateTSFilter( DEFAULT_PAT_NUM, DEFAULT_PMT_NUM, nStreamFormat, nSubFormat ); //ATSC_STREAM, TERRESTRIAL;
	pTSInfoParser->max_stream_num = nMaxStreamNum;
	pTSInfoParser->ts_streams.ts_element = SAGETV_MALLOC( nMaxStreamNum*sizeof(TS_ELEMENT) );
	pTSInfoParser->ts_streams.total_streams = nMaxStreamNum;
	pTSInfoParser->es_streams.es_element = SAGETV_MALLOC( nMaxStreamNum*sizeof(ES_ELEMENT) );
	pTSInfoParser->es_streams.total_streams = nMaxStreamNum;
	pTSInfoParser->av_streams.av_element = SAGETV_MALLOC( nMaxStreamNum*sizeof(AV_ELEMENT) );
	pTSInfoParser->av_streams.total_streams = nMaxStreamNum;
	pTSInfoParser->es_buffer = SAGETV_MALLOC( nMaxStreamNum*sizeof(ES_BUFFER) );
	for ( i = 0; i<nMaxStreamNum; i++ )
	{
		pTSInfoParser->es_buffer[i].buffer = SAGETV_MALLOC( TMP_ES_BUFFER_SIZE );
		pTSInfoParser->es_buffer[i].buffer_size = TMP_ES_BUFFER_SIZE;
	}


	pTSInfoParser->ts_filter->dumper.pat_dumper = (DUMP)PATDumper;
	pTSInfoParser->ts_filter->dumper.pat_dumper_context = pTSInfoParser;
	pTSInfoParser->ts_filter->dumper.pmt_dumper = (DUMP)PMTDumper;
	pTSInfoParser->ts_filter->dumper.pmt_dumper_context = pTSInfoParser;
	pTSInfoParser->ts_filter->dumper.pcr_dumper = (DUMP)PCRDumper;
	pTSInfoParser->ts_filter->dumper.pcr_dumper_context = pTSInfoParser;
	pTSInfoParser->ts_filter->dumper.stream_dumper = (DUMP)StreamDumper;
	pTSInfoParser->ts_filter->dumper.stream_dumper_context = pTSInfoParser;

	pTSInfoParser->ts_filter->psi_parser->dumper.channel_info_dumper  =	(DUMP)ChannelInfoDumper;
	pTSInfoParser->ts_filter->psi_parser->dumper.channel_info_context =	pTSInfoParser;
	pTSInfoParser->ts_filter->psi_parser->dumper.pid_dumper  =	(DUMP)PSIPidDumper;
	pTSInfoParser->ts_filter->psi_parser->dumper.pid_context =	pTSInfoParser;
	pTSInfoParser->ts_filter->psi_parser->dumper.system_time_dumper   =	(DUMP)SystemTimeDumper;
	pTSInfoParser->ts_filter->psi_parser->dumper.system_time_context  =	pTSInfoParser;
	//pTSInfoParser->ts_filter->psi_parser->dumper.tune_info_dumper     = (DUMP)TuneInfoDumper;
	//pTSInfoParser->ts_filter->psi_parser->dumper.tune_info_context    = pTSInfoParser;
	//pTSInfoParser->ts_filter->psi_parser->dumper.message_dumper       = (DUMP)MessageDumper;
	//pTSInfoParser->ts_filter->psi_parser->dumper.message_context      = pTSInfoParser;
	pTSInfoParser->utc_sec_start = 0;
	pTSInfoParser->pcr_sec_start = 0;
	pTSInfoParser->max_check_limit = 1024*1024*32; //max check 64M data for avinfo
	SageLog(( _LOG_TRACE, 3, TEXT("TS Info Parser filter is created  version 1.0.2  .") ));
	return pTSInfoParser;
}
Exemple #7
0
TS_CHANNEL_PARSER* CreateTSChannelParser( int nMaxStreamNum, int nStreamFormat, int nSubFormat )
{
	int i;
	TS_CHANNEL_PARSER *pTSChannelParser = SAGETV_MALLOC( sizeof(TS_CHANNEL_PARSER) );
	pTSChannelParser->ts_filter = CreateTSFilter( DEFAULT_PAT_NUM, DEFAULT_PMT_NUM, nStreamFormat, nSubFormat ); //ATSC_STREAM, TERRESTRIAL;
	pTSChannelParser->max_stream_num = nMaxStreamNum;
	pTSChannelParser->ts_streams.ts_element = SAGETV_MALLOC( nMaxStreamNum*sizeof(TS_ELEMENT) );
	pTSChannelParser->ts_streams.total_streams = nMaxStreamNum;
	pTSChannelParser->es_streams.es_element = SAGETV_MALLOC( nMaxStreamNum*sizeof(ES_ELEMENT) );
	pTSChannelParser->es_streams.total_streams = nMaxStreamNum;
	pTSChannelParser->av_streams.av_element = SAGETV_MALLOC( nMaxStreamNum*sizeof(AV_ELEMENT) );
	pTSChannelParser->av_streams.total_streams = nMaxStreamNum;
	pTSChannelParser->es_buffer = SAGETV_MALLOC( nMaxStreamNum*sizeof(ES_BUFFER_) );
	for ( i = 0; i<nMaxStreamNum; i++ )
	{
		pTSChannelParser->es_buffer[i].buffer = SAGETV_MALLOC( TMP_ES_BUFFER_SIZE );
		pTSChannelParser->es_buffer[i].buffer_size = TMP_ES_BUFFER_SIZE;
	}


	pTSChannelParser->ts_filter->dumper.pat_dumper = (DUMP)PATDumper;
	pTSChannelParser->ts_filter->dumper.pat_dumper_context = pTSChannelParser;
	pTSChannelParser->ts_filter->dumper.pmt_dumper = (DUMP)PMTDumper;
	pTSChannelParser->ts_filter->dumper.pmt_dumper_context = pTSChannelParser;
	pTSChannelParser->ts_filter->dumper.stream_dumper = (DUMP)StreamDumper;
	pTSChannelParser->ts_filter->dumper.stream_dumper_context = pTSChannelParser;

	pTSChannelParser->ts_filter->psi_parser->dumper.channel_info_dumper  =	(DUMP)ChannelInfoDumper;
	pTSChannelParser->ts_filter->psi_parser->dumper.channel_info_context =	pTSChannelParser;
	pTSChannelParser->ts_filter->psi_parser->dumper.pid_dumper  =	(DUMP)PSIPidDumper;
	pTSChannelParser->ts_filter->psi_parser->dumper.pid_context =	pTSChannelParser;

	InitScanData( pTSChannelParser,  nStreamFormat, nSubFormat );

	pTSChannelParser->max_check_limit = 1024*1024*12; //max check 12M data for avinfo
	SageLog(( _LOG_TRACE, 3, TEXT("TS Channel Parser is created  version 1.0.0  .") ));
	return pTSChannelParser;
}