Ejemplo n.º 1
0
void ChangeNumTracks(int total)
{
    int i;
    
    if (total>0 && total <= TotalTracks) {
	/* scrap everything */
	DestroyTracks();

	NumTracks= total;
	lowTrkIndex= 0;
	highTrkIndex= total - 1;

	tracks= (Track **)Malloc(sizeof(Track*)*NumTracks);
	if (tracks==NULL) return;   /* not enuff mem */

	CreateTracks(tracesFrame);

	for(i=0; i <= LastTrack; i++) {
	    Trace *trc= traces[i];
	    /* resize? */
	    if (trc && trc->wave) {
		/* cp from ``trackmgr.c'' */
		ScaleYAxis(&trc->axis, tracks[0]->height);
		/* lazy-- taxis is the same */
	    }
	}
	AdjustSbar();
	RedrawScreen();
    }
}
Ejemplo n.º 2
0
int CreateFileOutputW( REMUXER *pRemuxer, wchar_t* pFileName, int nOutputFormat, int nMaxTrackNum)
{
	//pRemuxer->output_file = fopen( pFileName, "wb" );
#ifdef WIN32	
	//pRemuxer->output_file  = FOPEN( pFileName, _O_WRONLY|_O_BINARY|_O_CREAT, _SH_DENYNO , _S_IREAD|_S_IWRITE );
	pRemuxer->output_file = _wsopen( (wchar_t*)pFileName, _O_RDONLY|_O_BINARY, _SH_DENYNO , _S_IREAD|_S_IWRITE );
#else
	pRemuxer->output_file  = open( (char*)pFileName, O_WRONLY|O_CREAT, 0666 );
#endif	

	if ( pRemuxer->output_file )
	{
		SageLog(( _LOG_TRACE, 3, TEXT("Output file %s"), pFileName ));
	} else
		return 0;

	pRemuxer->output_track[0] = CreateTracks(nMaxTrackNum);
	pRemuxer->output_track[0]->track_type = nOutputFormat;
	if ( IS_PS_TYPE( nOutputFormat ) )
	{
		int build_header_in_buffer; //if es block has space to build a PACK+PES
		build_header_in_buffer = SourceIsTSType( pRemuxer->demuxer );
		pRemuxer->ps_builder = CreatePSBuilder( pRemuxer->output_track[0], ES_PACKET_SIZE, build_header_in_buffer );
		pRemuxer->ps_builder->dumper.stream_dumper = (DUMP)PSOutputDataFileDumper;
		pRemuxer->ps_builder->dumper.stream_dumper_context = pRemuxer;
	} else
	if ( IS_TS_TYPE(nOutputFormat) )
	{
		pRemuxer->ts_builder = CreateTSBuilder( pRemuxer->output_track[0], nOutputFormat );
		pRemuxer->ts_builder->dumper.stream_dumper = (DUMP)TSOutputDataFileDumper;
		pRemuxer->ts_builder->dumper.stream_dumper_context = pRemuxer;
	}
	return 1;
}
Ejemplo n.º 3
0
int CreateStreamOutput( REMUXER *pRemuxer, int nOutputFormat, DUMP pfnOutputDump, void* pOutputDumpContext )
{
	pRemuxer->output_track[0] = CreateTracks(MAX_TRACK_NUM);
	pRemuxer->output_track[0]->track_type = nOutputFormat;
	if ( IS_PS_TYPE( nOutputFormat ) )
	{
		int build_header_in_buffer; //if es block has space to build a PACK+PES
		build_header_in_buffer = SourceIsTSType( pRemuxer->demuxer );
		pRemuxer->ps_builder = CreatePSBuilder( pRemuxer->output_track[0], ES_PACKET_SIZE, build_header_in_buffer );
		pRemuxer->ps_builder->dumper.stream_dumper = pfnOutputDump;
		pRemuxer->ps_builder->dumper.stream_dumper_context = pOutputDumpContext;
		SetupBlockDataDumper( pRemuxer->demuxer, BlockBufferPSDump, pRemuxer->ps_builder );
	} else
	if ( IS_TS_TYPE(nOutputFormat) )
	{
		pRemuxer->ts_builder = CreateTSBuilder( pRemuxer->output_track[0], nOutputFormat );
		pRemuxer->ts_builder->dumper.stream_dumper = pfnOutputDump;
		pRemuxer->ts_builder->dumper.stream_dumper_context = pOutputDumpContext;
		SetupBlockDataDumper( pRemuxer->demuxer, BlockBufferTSDump, pRemuxer->ts_builder );
	}
	pRemuxer->output_format = nOutputFormat;

	return 1;
}
Ejemplo n.º 4
0
void initTracks(Frame frame)
{    
    int i;

    tracks= (Track **)Malloc(sizeof(Track*)*NumTracks);
    traces= (Trace **)Malloc(sizeof(Trace*)*TotalTracks);
    if (tracks==NULL || traces==NULL) {
	return;	/* not enuff mem */
    }
    if (!Mode_CLI) {
	CreateTracks(frame);
    }else {
	for(i=0; i < NumTracks; i++) {
	    Track *trk;
	    trk= tracks[i]= (Track *)Malloc(sizeof(Track));
	    trk->height= 100;	/* arbitrary */
	    trk->width= 800;	/* arbitrary */
	}
    }
    
    for(i=0; i < TotalTracks; i++) {
	traces[i]= newTrace();
	if (traces[i]==NULL) return;	/* not enuff mem */
    }

    if(TotalWaifTraces > 0) {
	waifTraces= (Trace **)Malloc(sizeof(Trace*)*TotalWaifTraces);
	if (waifTraces==NULL) {
	    return;	/* not enuff mem */
	}
	for (i = 0; i < TotalWaifTraces; i++){
	    waifTraces[i] = newTrace();
	    if (waifTraces[i] == NULL) return;   /* not unuff mem */
	}
    }
}