Beispiel #1
0
int CVSCPTable::setTableInfo( const char *path,
									uint8_t type,
									const char *tableName, 
									const char *tableDescription,
									const char *xAxisLabel, 
									const char *yAxisLabel,
									uint32_t size,
									uint16_t vscp_class, 
									uint16_t vscp_type,
									uint8_t vscp_unit )
{
	int rv = VSCP_ERROR_SUCCESS;

	m_path = wxString::FromAscii( path );
	if ( type < 2 ) {
        m_vscpFileHead.type = type;
    }
    else {
        m_vscpFileHead.type = 0;
    }
	strncpy( m_vscpFileHead.nameTable, tableName, sizeof( m_vscpFileHead.nameTable ) );
	strncpy( m_vscpFileHead.descriptionTable, tableDescription, sizeof( m_vscpFileHead.descriptionTable ) );
	strncpy( m_vscpFileHead.nameXLabel, xAxisLabel, sizeof( m_vscpFileHead.nameXLabel ) );
	strncpy( m_vscpFileHead.nameYLabel, yAxisLabel, sizeof( m_vscpFileHead.nameYLabel) );
	m_vscpFileHead.staticSize = size;
	m_vscpFileHead.vscp_class = vscp_class;
	m_vscpFileHead.vscp_type = vscp_type;
	m_vscpFileHead.vscp_unit = vscp_unit;

	// Write header
	rv = writeMainHeader();		

	return rv;
}
void TypeObjectGenerator::extract(const QString &data)
{
    QDir().mkpath(m_dst);

    QMap<QString, QList<GeneratorTypes::TypeStruct> > types = extractTypes(data, "object", QString(), "types");
    QMapIterator<QString, QList<GeneratorTypes::TypeStruct> > i(types);
    while(i.hasNext())
    {
        i.next();
        const QString &name = i.key();
        const QList<GeneratorTypes::TypeStruct> &types = i.value();
        writeType(name, types);
    }

    writePri(types.keys());
    writeMainHeader(types.keys());
    writeQmlRegister(types.keys());
    copyEmbeds();
}
//_______________________________________________________
//
//   Begin to save, built header and prepare structure
//   The nb frames is indicative but the real value
//   must be smaller than this parameter
//
//_______________________________________________________
uint8_t aviWrite::saveBegin (char 	*name,
		     MainAVIHeader 	*inmainheader, 
		     uint32_t 		nb_frame,
		     AVIStreamHeader * invideostream,
		     BITMAPINFOHEADER	*bih,
		     uint8_t 		*videoextra,
		     uint32_t  		videoextraLen,
		     AVDMGenericAudioStream * inaudiostream,
		     AVDMGenericAudioStream * inaudiostream2)
{

	asize=asize2=0;

//  Sanity Check
  	assert (_out == NULL);
  	if (!(_out = fopen (name, "wb")))
  {
		printf("Problem writing : %s\n",name);
    return 0;
    }
  curindex = 0;
  vframe = asize = 0;
  nb_audio=0;
// update avi header according to the information WE want
//
  	memcpy (&_mainheader, inmainheader, sizeof (MainAVIHeader));
  	_mainheader.dwFlags = AVIF_HASINDEX + AVIF_ISINTERLEAVED;
	if(!_mainheader.dwMicroSecPerFrame)
	{
		_mainheader.dwMicroSecPerFrame=40000;
	}
  // update main header codec with video codev
  if (inaudiostream)
  {
    		_mainheader.dwStreams = 2;
		nb_audio=1;
  }
  else
    		_mainheader.dwStreams = 1;

	if(inaudiostream2)
	{
	 	printf("\n +++Dual audio stream...\n");
     		_mainheader.dwStreams ++;
		nb_audio++;
	}

  	_mainheader.dwTotalFrames = nb_frame;
//  Idem for video stream
//
  	memcpy (&_videostream, invideostream, sizeof (AVIStreamHeader));
  	_videostream.dwLength = nb_frame;
	_videostream.fccType=fourCC::get((uint8_t *)"vids");
	memcpy(&_bih,bih,sizeof(_bih));
  //___________________
  // Prepare header
  //___________________

	writeMainHeader( );

	writeVideoHeader(videoextra,videoextraLen );

	writeAudioHeader (	inaudiostream , &_audio1 );
	writeAudioHeader (	inaudiostream2, &_audio2); 

	LMain->End();
	delete LMain;
	LMain=NULL;
  //

  assert (!LMovie);
  	LMovie = new AviList ("LIST", _out);
  LMovie->Begin ("movi");
  curindex = 0;
  // the *2 is for audio and video
  // the *3 if for security sake
  myindex = (IdxEntry *) malloc (sizeof (IdxEntry) * (nb_frame * 4));
  asize = 0;
  vframe = 0;
  return 1;
}